Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*
  2 * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
  3 * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
  4 *
  5 * This software is available to you under a choice of one of two
  6 * licenses.  You may choose to be licensed under the terms of the GNU
  7 * General Public License (GPL) Version 2, available from the file
  8 * COPYING in the main directory of this source tree, or the
  9 * OpenIB.org BSD license below:
 10 *
 11 *     Redistribution and use in source and binary forms, with or
 12 *     without modification, are permitted provided that the following
 13 *     conditions are met:
 14 *
 15 *      - Redistributions of source code must retain the above
 16 *        copyright notice, this list of conditions and the following
 17 *        disclaimer.
 18 *
 19 *      - Redistributions in binary form must reproduce the above
 20 *        copyright notice, this list of conditions and the following
 21 *        disclaimer in the documentation and/or other materials
 22 *        provided with the distribution.
 23 *
 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 31 * SOFTWARE.
 32 */
 
 33#ifndef IW_CM_H
 34#define IW_CM_H
 35
 36#include <linux/in.h>
 37#include <rdma/ib_cm.h>
 38
 39struct iw_cm_id;
 40
 41enum iw_cm_event_type {
 42	IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
 43	IW_CM_EVENT_CONNECT_REPLY,	 /* reply from active connect request */
 44	IW_CM_EVENT_ESTABLISHED,	 /* passive side accept successful */
 45	IW_CM_EVENT_DISCONNECT,		 /* orderly shutdown */
 46	IW_CM_EVENT_CLOSE		 /* close complete */
 47};
 48
 49struct iw_cm_event {
 50	enum iw_cm_event_type event;
 51	int			 status;
 52	struct sockaddr_in local_addr;
 53	struct sockaddr_in remote_addr;
 54	void *private_data;
 55	u8 private_data_len;
 56	void *provider_data;
 
 
 
 57};
 58
 59/**
 60 * iw_cm_handler - Function to be called by the IW CM when delivering events
 61 * to the client.
 62 *
 63 * @cm_id: The IW CM identifier associated with the event.
 64 * @event: Pointer to the event structure.
 65 */
 66typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
 67			     struct iw_cm_event *event);
 68
 69/**
 70 * iw_event_handler - Function called by the provider when delivering provider
 71 * events to the IW CM.  Returns either 0 indicating the event was processed
 72 * or -errno if the event could not be processed.
 73 *
 74 * @cm_id: The IW CM identifier associated with the event.
 75 * @event: Pointer to the event structure.
 76 */
 77typedef int (*iw_event_handler)(struct iw_cm_id *cm_id,
 78				 struct iw_cm_event *event);
 79
 80struct iw_cm_id {
 81	iw_cm_handler		cm_handler;      /* client callback function */
 82	void		        *context;	 /* client cb context */
 83	struct ib_device	*device;
 84	struct sockaddr_in      local_addr;
 85	struct sockaddr_in	remote_addr;
 
 
 86	void			*provider_data;	 /* provider private data */
 87	iw_event_handler        event_handler;   /* cb for provider
 88						    events */
 89	/* Used by provider to add and remove refs on IW cm_id */
 90	void (*add_ref)(struct iw_cm_id *);
 91	void (*rem_ref)(struct iw_cm_id *);
 
 
 
 
 92};
 93
 94struct iw_cm_conn_param {
 95	const void *private_data;
 96	u16 private_data_len;
 97	u32 ord;
 98	u32 ird;
 99	u32 qpn;
100};
101
102struct iw_cm_verbs {
103	void		(*add_ref)(struct ib_qp *qp);
104
105	void		(*rem_ref)(struct ib_qp *qp);
106
107	struct ib_qp *	(*get_qp)(struct ib_device *device,
108				  int qpn);
109
110	int		(*connect)(struct iw_cm_id *cm_id,
111				   struct iw_cm_conn_param *conn_param);
112
113	int		(*accept)(struct iw_cm_id *cm_id,
114				  struct iw_cm_conn_param *conn_param);
115
116	int		(*reject)(struct iw_cm_id *cm_id,
117				  const void *pdata, u8 pdata_len);
118
119	int		(*create_listen)(struct iw_cm_id *cm_id,
120					 int backlog);
121
122	int		(*destroy_listen)(struct iw_cm_id *cm_id);
123};
124
125/**
126 * iw_create_cm_id - Create an IW CM identifier.
127 *
128 * @device: The IB device on which to create the IW CM identier.
129 * @event_handler: User callback invoked to report events associated with the
130 *   returned IW CM identifier.
131 * @context: User specified context associated with the id.
132 */
133struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
134				 iw_cm_handler cm_handler, void *context);
135
136/**
137 * iw_destroy_cm_id - Destroy an IW CM identifier.
138 *
139 * @cm_id: The previously created IW CM identifier to destroy.
140 *
141 * The client can assume that no events will be delivered for the CM ID after
142 * this function returns.
143 */
144void iw_destroy_cm_id(struct iw_cm_id *cm_id);
145
146/**
147 * iw_cm_bind_qp - Unbind the specified IW CM identifier and QP
148 *
149 * @cm_id: The IW CM idenfier to unbind from the QP.
150 * @qp: The QP
151 *
152 * This is called by the provider when destroying the QP to ensure
153 * that any references held by the IWCM are released. It may also
154 * be called by the IWCM when destroying a CM_ID to that any
155 * references held by the provider are released.
156 */
157void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp);
158
159/**
160 * iw_cm_get_qp - Return the ib_qp associated with a QPN
161 *
162 * @ib_device: The IB device
163 * @qpn: The queue pair number
164 */
165struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn);
166
167/**
168 * iw_cm_listen - Listen for incoming connection requests on the
169 * specified IW CM id.
170 *
171 * @cm_id: The IW CM identifier.
172 * @backlog: The maximum number of outstanding un-accepted inbound listen
173 *   requests to queue.
174 *
175 * The source address and port number are specified in the IW CM identifier
176 * structure.
177 */
178int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
179
180/**
181 * iw_cm_accept - Called to accept an incoming connect request.
182 *
183 * @cm_id: The IW CM identifier associated with the connection request.
184 * @iw_param: Pointer to a structure containing connection establishment
185 *   parameters.
186 *
187 * The specified cm_id will have been provided in the event data for a
188 * CONNECT_REQUEST event. Subsequent events related to this connection will be
189 * delivered to the specified IW CM identifier prior and may occur prior to
190 * the return of this function. If this function returns a non-zero value, the
191 * client can assume that no events will be delivered to the specified IW CM
192 * identifier.
193 */
194int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
195
196/**
197 * iw_cm_reject - Reject an incoming connection request.
198 *
199 * @cm_id: Connection identifier associated with the request.
200 * @private_daa: Pointer to data to deliver to the remote peer as part of the
201 *   reject message.
202 * @private_data_len: The number of bytes in the private_data parameter.
203 *
204 * The client can assume that no events will be delivered to the specified IW
205 * CM identifier following the return of this function. The private_data
206 * buffer is available for reuse when this function returns.
207 */
208int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data,
209		 u8 private_data_len);
210
211/**
212 * iw_cm_connect - Called to request a connection to a remote peer.
213 *
214 * @cm_id: The IW CM identifier for the connection.
215 * @iw_param: Pointer to a structure containing connection  establishment
216 *   parameters.
217 *
218 * Events may be delivered to the specified IW CM identifier prior to the
219 * return of this function. If this function returns a non-zero value, the
220 * client can assume that no events will be delivered to the specified IW CM
221 * identifier.
222 */
223int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
224
225/**
226 * iw_cm_disconnect - Close the specified connection.
227 *
228 * @cm_id: The IW CM identifier to close.
229 * @abrupt: If 0, the connection will be closed gracefully, otherwise, the
230 *   connection will be reset.
231 *
232 * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is
233 * delivered.
234 */
235int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt);
236
237/**
238 * iw_cm_init_qp_attr - Called to initialize the attributes of the QP
239 * associated with a IW CM identifier.
240 *
241 * @cm_id: The IW CM identifier associated with the QP
242 * @qp_attr: Pointer to the QP attributes structure.
243 * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are
244 *   valid.
245 */
246int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr,
247		       int *qp_attr_mask);
 
 
 
 
 
 
248
249#endif /* IW_CM_H */
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2/*
  3 * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
  4 * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef IW_CM_H
  8#define IW_CM_H
  9
 10#include <linux/in.h>
 11#include <rdma/ib_cm.h>
 12
 13struct iw_cm_id;
 14
 15enum iw_cm_event_type {
 16	IW_CM_EVENT_CONNECT_REQUEST = 1, /* connect request received */
 17	IW_CM_EVENT_CONNECT_REPLY,	 /* reply from active connect request */
 18	IW_CM_EVENT_ESTABLISHED,	 /* passive side accept successful */
 19	IW_CM_EVENT_DISCONNECT,		 /* orderly shutdown */
 20	IW_CM_EVENT_CLOSE		 /* close complete */
 21};
 22
 23struct iw_cm_event {
 24	enum iw_cm_event_type event;
 25	int			 status;
 26	struct sockaddr_storage local_addr;
 27	struct sockaddr_storage remote_addr;
 28	void *private_data;
 
 29	void *provider_data;
 30	u8 private_data_len;
 31	u8 ord;
 32	u8 ird;
 33};
 34
 35/**
 36 * iw_cm_handler - Function to be called by the IW CM when delivering events
 37 * to the client.
 38 *
 39 * @cm_id: The IW CM identifier associated with the event.
 40 * @event: Pointer to the event structure.
 41 */
 42typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id,
 43			     struct iw_cm_event *event);
 44
 45/**
 46 * iw_event_handler - Function called by the provider when delivering provider
 47 * events to the IW CM.  Returns either 0 indicating the event was processed
 48 * or -errno if the event could not be processed.
 49 *
 50 * @cm_id: The IW CM identifier associated with the event.
 51 * @event: Pointer to the event structure.
 52 */
 53typedef int (*iw_event_handler)(struct iw_cm_id *cm_id,
 54				 struct iw_cm_event *event);
 55
 56struct iw_cm_id {
 57	iw_cm_handler		cm_handler;      /* client callback function */
 58	void		        *context;	 /* client cb context */
 59	struct ib_device	*device;
 60	struct sockaddr_storage local_addr;      /* local addr */
 61	struct sockaddr_storage	remote_addr;
 62	struct sockaddr_storage m_local_addr;	 /* nmapped local addr */
 63	struct sockaddr_storage	m_remote_addr;	 /* nmapped rem addr */
 64	void			*provider_data;	 /* provider private data */
 65	iw_event_handler        event_handler;   /* cb for provider
 66						    events */
 67	/* Used by provider to add and remove refs on IW cm_id */
 68	void (*add_ref)(struct iw_cm_id *);
 69	void (*rem_ref)(struct iw_cm_id *);
 70	u8  tos;
 71	bool tos_set:1;
 72	bool mapped:1;
 73	bool afonly:1;
 74};
 75
 76struct iw_cm_conn_param {
 77	const void *private_data;
 78	u16 private_data_len;
 79	u32 ord;
 80	u32 ird;
 81	u32 qpn;
 82};
 83
 84enum iw_flags {
 
 
 
 
 
 
 85
 86	/*
 87	 * This flag allows the iwcm and iwpmd to still advertise
 88	 * mappings but the real and mapped port numbers are the
 89	 * same.  Further, iwpmd will not bind any user socket to
 90	 * reserve the port.  This is required for soft iwarp
 91	 * to play in the port mapped iwarp space.
 92	 */
 93	IW_F_NO_PORT_MAP = (1 << 0),
 
 
 
 
 
 94};
 95
 96/**
 97 * iw_create_cm_id - Create an IW CM identifier.
 98 *
 99 * @device: The IB device on which to create the IW CM identier.
100 * @event_handler: User callback invoked to report events associated with the
101 *   returned IW CM identifier.
102 * @context: User specified context associated with the id.
103 */
104struct iw_cm_id *iw_create_cm_id(struct ib_device *device,
105				 iw_cm_handler cm_handler, void *context);
106
107/**
108 * iw_destroy_cm_id - Destroy an IW CM identifier.
109 *
110 * @cm_id: The previously created IW CM identifier to destroy.
111 *
112 * The client can assume that no events will be delivered for the CM ID after
113 * this function returns.
114 */
115void iw_destroy_cm_id(struct iw_cm_id *cm_id);
116
117/**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118 * iw_cm_listen - Listen for incoming connection requests on the
119 * specified IW CM id.
120 *
121 * @cm_id: The IW CM identifier.
122 * @backlog: The maximum number of outstanding un-accepted inbound listen
123 *   requests to queue.
124 *
125 * The source address and port number are specified in the IW CM identifier
126 * structure.
127 */
128int iw_cm_listen(struct iw_cm_id *cm_id, int backlog);
129
130/**
131 * iw_cm_accept - Called to accept an incoming connect request.
132 *
133 * @cm_id: The IW CM identifier associated with the connection request.
134 * @iw_param: Pointer to a structure containing connection establishment
135 *   parameters.
136 *
137 * The specified cm_id will have been provided in the event data for a
138 * CONNECT_REQUEST event. Subsequent events related to this connection will be
139 * delivered to the specified IW CM identifier prior and may occur prior to
140 * the return of this function. If this function returns a non-zero value, the
141 * client can assume that no events will be delivered to the specified IW CM
142 * identifier.
143 */
144int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
145
146/**
147 * iw_cm_reject - Reject an incoming connection request.
148 *
149 * @cm_id: Connection identifier associated with the request.
150 * @private_daa: Pointer to data to deliver to the remote peer as part of the
151 *   reject message.
152 * @private_data_len: The number of bytes in the private_data parameter.
153 *
154 * The client can assume that no events will be delivered to the specified IW
155 * CM identifier following the return of this function. The private_data
156 * buffer is available for reuse when this function returns.
157 */
158int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data,
159		 u8 private_data_len);
160
161/**
162 * iw_cm_connect - Called to request a connection to a remote peer.
163 *
164 * @cm_id: The IW CM identifier for the connection.
165 * @iw_param: Pointer to a structure containing connection  establishment
166 *   parameters.
167 *
168 * Events may be delivered to the specified IW CM identifier prior to the
169 * return of this function. If this function returns a non-zero value, the
170 * client can assume that no events will be delivered to the specified IW CM
171 * identifier.
172 */
173int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param);
174
175/**
176 * iw_cm_disconnect - Close the specified connection.
177 *
178 * @cm_id: The IW CM identifier to close.
179 * @abrupt: If 0, the connection will be closed gracefully, otherwise, the
180 *   connection will be reset.
181 *
182 * The IW CM identifier is still active until the IW_CM_EVENT_CLOSE event is
183 * delivered.
184 */
185int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt);
186
187/**
188 * iw_cm_init_qp_attr - Called to initialize the attributes of the QP
189 * associated with a IW CM identifier.
190 *
191 * @cm_id: The IW CM identifier associated with the QP
192 * @qp_attr: Pointer to the QP attributes structure.
193 * @qp_attr_mask: Pointer to a bit vector specifying which QP attributes are
194 *   valid.
195 */
196int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr,
197		       int *qp_attr_mask);
198
199/**
200 * iwcm_reject_msg - return a pointer to a reject message string.
201 * @reason: Value returned in the REJECT event status field.
202 */
203const char *__attribute_const__ iwcm_reject_msg(int reason);
204
205#endif /* IW_CM_H */