xref: /freebsd/sys/ofed/include/rdma/ib_cm.h (revision fe267a559009cbf34f9341666fe4d88a92c02d5e)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
4  * Copyright (c) 2004, 2005 Intel Corporation.  All rights reserved.
5  * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
6  * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
7  * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
8  *
9  * This software is available to you under a choice of one of two
10  * licenses.  You may choose to be licensed under the terms of the GNU
11  * General Public License (GPL) Version 2, available from the file
12  * COPYING in the main directory of this source tree, or the
13  * OpenIB.org BSD license below:
14  *
15  *     Redistribution and use in source and binary forms, with or
16  *     without modification, are permitted provided that the following
17  *     conditions are met:
18  *
19  *      - Redistributions of source code must retain the above
20  *        copyright notice, this list of conditions and the following
21  *        disclaimer.
22  *
23  *      - Redistributions in binary form must reproduce the above
24  *        copyright notice, this list of conditions and the following
25  *        disclaimer in the documentation and/or other materials
26  *        provided with the distribution.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
32  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
33  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
34  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35  * SOFTWARE.
36  */
37 #if !defined(IB_CM_H)
38 #define IB_CM_H
39 
40 #include <rdma/ib_mad.h>
41 #include <rdma/ib_sa.h>
42 
43 /* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
44 extern struct class cm_class;
45 
46 enum ib_cm_state {
47 	IB_CM_IDLE,
48 	IB_CM_LISTEN,
49 	IB_CM_REQ_SENT,
50 	IB_CM_REQ_RCVD,
51 	IB_CM_MRA_REQ_SENT,
52 	IB_CM_MRA_REQ_RCVD,
53 	IB_CM_REP_SENT,
54 	IB_CM_REP_RCVD,
55 	IB_CM_MRA_REP_SENT,
56 	IB_CM_MRA_REP_RCVD,
57 	IB_CM_ESTABLISHED,
58 	IB_CM_DREQ_SENT,
59 	IB_CM_DREQ_RCVD,
60 	IB_CM_TIMEWAIT,
61 	IB_CM_SIDR_REQ_SENT,
62 	IB_CM_SIDR_REQ_RCVD
63 };
64 
65 enum ib_cm_lap_state {
66 	IB_CM_LAP_UNINIT,
67 	IB_CM_LAP_IDLE,
68 	IB_CM_LAP_SENT,
69 	IB_CM_LAP_RCVD,
70 	IB_CM_MRA_LAP_SENT,
71 	IB_CM_MRA_LAP_RCVD,
72 };
73 
74 enum ib_cm_event_type {
75 	IB_CM_REQ_ERROR,
76 	IB_CM_REQ_RECEIVED,
77 	IB_CM_REP_ERROR,
78 	IB_CM_REP_RECEIVED,
79 	IB_CM_RTU_RECEIVED,
80 	IB_CM_USER_ESTABLISHED,
81 	IB_CM_DREQ_ERROR,
82 	IB_CM_DREQ_RECEIVED,
83 	IB_CM_DREP_RECEIVED,
84 	IB_CM_TIMEWAIT_EXIT,
85 	IB_CM_MRA_RECEIVED,
86 	IB_CM_REJ_RECEIVED,
87 	IB_CM_LAP_ERROR,
88 	IB_CM_LAP_RECEIVED,
89 	IB_CM_APR_RECEIVED,
90 	IB_CM_SIDR_REQ_ERROR,
91 	IB_CM_SIDR_REQ_RECEIVED,
92 	IB_CM_SIDR_REP_RECEIVED
93 };
94 
95 enum ib_cm_data_size {
96 	IB_CM_REQ_PRIVATE_DATA_SIZE	 = 92,
97 	IB_CM_MRA_PRIVATE_DATA_SIZE	 = 222,
98 	IB_CM_REJ_PRIVATE_DATA_SIZE	 = 148,
99 	IB_CM_REP_PRIVATE_DATA_SIZE	 = 196,
100 	IB_CM_RTU_PRIVATE_DATA_SIZE	 = 224,
101 	IB_CM_DREQ_PRIVATE_DATA_SIZE	 = 220,
102 	IB_CM_DREP_PRIVATE_DATA_SIZE	 = 224,
103 	IB_CM_REJ_ARI_LENGTH		 = 72,
104 	IB_CM_LAP_PRIVATE_DATA_SIZE	 = 168,
105 	IB_CM_APR_PRIVATE_DATA_SIZE	 = 148,
106 	IB_CM_APR_INFO_LENGTH		 = 72,
107 	IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
108 	IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
109 	IB_CM_SIDR_REP_INFO_LENGTH	 = 72,
110 };
111 
112 struct ib_cm_id;
113 
114 struct ib_cm_req_event_param {
115 	struct ib_cm_id		*listen_id;
116 
117 	/* P_Key that was used by the GMP's BTH header */
118 	u16			bth_pkey;
119 
120 	u8			port;
121 
122 	struct ib_sa_path_rec	*primary_path;
123 	struct ib_sa_path_rec	*alternate_path;
124 
125 	__be64			remote_ca_guid;
126 	u32			remote_qkey;
127 	u32			remote_qpn;
128 	enum ib_qp_type		qp_type;
129 
130 	u32			starting_psn;
131 	u8			responder_resources;
132 	u8			initiator_depth;
133 	unsigned int		local_cm_response_timeout:5;
134 	unsigned int		flow_control:1;
135 	unsigned int		remote_cm_response_timeout:5;
136 	unsigned int		retry_count:3;
137 	unsigned int		rnr_retry_count:3;
138 	unsigned int		srq:1;
139 };
140 
141 struct ib_cm_rep_event_param {
142 	__be64			remote_ca_guid;
143 	u32			remote_qkey;
144 	u32			remote_qpn;
145 	u32			starting_psn;
146 	u8			responder_resources;
147 	u8			initiator_depth;
148 	unsigned int		target_ack_delay:5;
149 	unsigned int		failover_accepted:2;
150 	unsigned int		flow_control:1;
151 	unsigned int		rnr_retry_count:3;
152 	unsigned int		srq:1;
153 };
154 
155 enum ib_cm_rej_reason {
156 	IB_CM_REJ_NO_QP				= 1,
157 	IB_CM_REJ_NO_EEC			= 2,
158 	IB_CM_REJ_NO_RESOURCES			= 3,
159 	IB_CM_REJ_TIMEOUT			= 4,
160 	IB_CM_REJ_UNSUPPORTED			= 5,
161 	IB_CM_REJ_INVALID_COMM_ID		= 6,
162 	IB_CM_REJ_INVALID_COMM_INSTANCE		= 7,
163 	IB_CM_REJ_INVALID_SERVICE_ID		= 8,
164 	IB_CM_REJ_INVALID_TRANSPORT_TYPE	= 9,
165 	IB_CM_REJ_STALE_CONN			= 10,
166 	IB_CM_REJ_RDC_NOT_EXIST			= 11,
167 	IB_CM_REJ_INVALID_GID			= 12,
168 	IB_CM_REJ_INVALID_LID			= 13,
169 	IB_CM_REJ_INVALID_SL			= 14,
170 	IB_CM_REJ_INVALID_TRAFFIC_CLASS		= 15,
171 	IB_CM_REJ_INVALID_HOP_LIMIT		= 16,
172 	IB_CM_REJ_INVALID_PACKET_RATE		= 17,
173 	IB_CM_REJ_INVALID_ALT_GID		= 18,
174 	IB_CM_REJ_INVALID_ALT_LID		= 19,
175 	IB_CM_REJ_INVALID_ALT_SL		= 20,
176 	IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS	= 21,
177 	IB_CM_REJ_INVALID_ALT_HOP_LIMIT		= 22,
178 	IB_CM_REJ_INVALID_ALT_PACKET_RATE	= 23,
179 	IB_CM_REJ_PORT_CM_REDIRECT		= 24,
180 	IB_CM_REJ_PORT_REDIRECT			= 25,
181 	IB_CM_REJ_INVALID_MTU			= 26,
182 	IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES	= 27,
183 	IB_CM_REJ_CONSUMER_DEFINED		= 28,
184 	IB_CM_REJ_INVALID_RNR_RETRY		= 29,
185 	IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID	= 30,
186 	IB_CM_REJ_INVALID_CLASS_VERSION		= 31,
187 	IB_CM_REJ_INVALID_FLOW_LABEL		= 32,
188 	IB_CM_REJ_INVALID_ALT_FLOW_LABEL	= 33
189 };
190 
191 struct ib_cm_rej_event_param {
192 	enum ib_cm_rej_reason	reason;
193 	void			*ari;
194 	u8			ari_length;
195 };
196 
197 struct ib_cm_mra_event_param {
198 	u8	service_timeout;
199 };
200 
201 struct ib_cm_lap_event_param {
202 	struct ib_sa_path_rec	*alternate_path;
203 };
204 
205 enum ib_cm_apr_status {
206 	IB_CM_APR_SUCCESS,
207 	IB_CM_APR_INVALID_COMM_ID,
208 	IB_CM_APR_UNSUPPORTED,
209 	IB_CM_APR_REJECT,
210 	IB_CM_APR_REDIRECT,
211 	IB_CM_APR_IS_CURRENT,
212 	IB_CM_APR_INVALID_QPN_EECN,
213 	IB_CM_APR_INVALID_LID,
214 	IB_CM_APR_INVALID_GID,
215 	IB_CM_APR_INVALID_FLOW_LABEL,
216 	IB_CM_APR_INVALID_TCLASS,
217 	IB_CM_APR_INVALID_HOP_LIMIT,
218 	IB_CM_APR_INVALID_PACKET_RATE,
219 	IB_CM_APR_INVALID_SL
220 };
221 
222 struct ib_cm_apr_event_param {
223 	enum ib_cm_apr_status	ap_status;
224 	void			*apr_info;
225 	u8			info_len;
226 };
227 
228 struct ib_cm_sidr_req_event_param {
229 	struct ib_cm_id		*listen_id;
230 	__be64			service_id;
231 	/* P_Key that was used by the GMP's BTH header */
232 	u16			bth_pkey;
233 	u8			port;
234 	u16			pkey;
235 };
236 
237 enum ib_cm_sidr_status {
238 	IB_SIDR_SUCCESS,
239 	IB_SIDR_UNSUPPORTED,
240 	IB_SIDR_REJECT,
241 	IB_SIDR_NO_QP,
242 	IB_SIDR_REDIRECT,
243 	IB_SIDR_UNSUPPORTED_VERSION
244 };
245 
246 struct ib_cm_sidr_rep_event_param {
247 	enum ib_cm_sidr_status	status;
248 	u32			qkey;
249 	u32			qpn;
250 	void			*info;
251 	u8			info_len;
252 };
253 
254 struct ib_cm_event {
255 	enum ib_cm_event_type	event;
256 	union {
257 		struct ib_cm_req_event_param	req_rcvd;
258 		struct ib_cm_rep_event_param	rep_rcvd;
259 		/* No data for RTU received events. */
260 		struct ib_cm_rej_event_param	rej_rcvd;
261 		struct ib_cm_mra_event_param	mra_rcvd;
262 		struct ib_cm_lap_event_param	lap_rcvd;
263 		struct ib_cm_apr_event_param	apr_rcvd;
264 		/* No data for DREQ/DREP received events. */
265 		struct ib_cm_sidr_req_event_param sidr_req_rcvd;
266 		struct ib_cm_sidr_rep_event_param sidr_rep_rcvd;
267 		enum ib_wc_status		send_status;
268 	} param;
269 
270 	void			*private_data;
271 };
272 
273 #define CM_REQ_ATTR_ID		cpu_to_be16(0x0010)
274 #define CM_MRA_ATTR_ID		cpu_to_be16(0x0011)
275 #define CM_REJ_ATTR_ID		cpu_to_be16(0x0012)
276 #define CM_REP_ATTR_ID		cpu_to_be16(0x0013)
277 #define CM_RTU_ATTR_ID		cpu_to_be16(0x0014)
278 #define CM_DREQ_ATTR_ID		cpu_to_be16(0x0015)
279 #define CM_DREP_ATTR_ID		cpu_to_be16(0x0016)
280 #define CM_SIDR_REQ_ATTR_ID	cpu_to_be16(0x0017)
281 #define CM_SIDR_REP_ATTR_ID	cpu_to_be16(0x0018)
282 #define CM_LAP_ATTR_ID		cpu_to_be16(0x0019)
283 #define CM_APR_ATTR_ID		cpu_to_be16(0x001A)
284 
285 /**
286  * ib_cm_handler - User-defined callback to process communication events.
287  * @cm_id: Communication identifier associated with the reported event.
288  * @event: Information about the communication event.
289  *
290  * IB_CM_REQ_RECEIVED and IB_CM_SIDR_REQ_RECEIVED communication events
291  * generated as a result of listen requests result in the allocation of a
292  * new @cm_id.  The new @cm_id is returned to the user through this callback.
293  * Clients are responsible for destroying the new @cm_id.  For peer-to-peer
294  * IB_CM_REQ_RECEIVED and all other events, the returned @cm_id corresponds
295  * to a user's existing communication identifier.
296  *
297  * Users may not call ib_destroy_cm_id while in the context of this callback;
298  * however, returning a non-zero value instructs the communication manager to
299  * destroy the @cm_id after the callback completes.
300  */
301 typedef int (*ib_cm_handler)(struct ib_cm_id *cm_id,
302 			     struct ib_cm_event *event);
303 
304 struct ib_cm_id {
305 	ib_cm_handler		cm_handler;
306 	void			*context;
307 	struct ib_device	*device;
308 	__be64			service_id;
309 	__be64			service_mask;
310 	enum ib_cm_state	state;		/* internal CM/debug use */
311 	enum ib_cm_lap_state	lap_state;	/* internal CM/debug use */
312 	__be32			local_id;
313 	__be32			remote_id;
314 	u32			remote_cm_qpn;  /* 1 unless redirected */
315 };
316 
317 /**
318  * ib_create_cm_id - Allocate a communication identifier.
319  * @device: Device associated with the cm_id.  All related communication will
320  * be associated with the specified device.
321  * @cm_handler: Callback invoked to notify the user of CM events.
322  * @context: User specified context associated with the communication
323  *   identifier.
324  *
325  * Communication identifiers are used to track connection states, service
326  * ID resolution requests, and listen requests.
327  */
328 struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
329 				 ib_cm_handler cm_handler,
330 				 void *context);
331 
332 /**
333  * ib_destroy_cm_id - Destroy a connection identifier.
334  * @cm_id: Connection identifier to destroy.
335  *
336  * This call blocks until the connection identifier is destroyed.
337  */
338 void ib_destroy_cm_id(struct ib_cm_id *cm_id);
339 
340 #define IB_SERVICE_ID_AGN_MASK	cpu_to_be64(0xFF00000000000000ULL)
341 #define IB_CM_ASSIGN_SERVICE_ID	cpu_to_be64(0x0200000000000000ULL)
342 #define IB_CMA_SERVICE_ID	cpu_to_be64(0x0000000001000000ULL)
343 #define IB_CMA_SERVICE_ID_MASK	cpu_to_be64(0xFFFFFFFFFF000000ULL)
344 #define IB_SDP_SERVICE_ID	cpu_to_be64(0x0000000000010000ULL)
345 #define IB_SDP_SERVICE_ID_MASK	cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
346 
347 /**
348  * ib_cm_listen - Initiates listening on the specified service ID for
349  *   connection and service ID resolution requests.
350  * @cm_id: Connection identifier associated with the listen request.
351  * @service_id: Service identifier matched against incoming connection
352  *   and service ID resolution requests.  The service ID should be specified
353  *   network-byte order.  If set to IB_CM_ASSIGN_SERVICE_ID, the CM will
354  *   assign a service ID to the caller.
355  * @service_mask: Mask applied to service ID used to listen across a
356  *   range of service IDs.  If set to 0, the service ID is matched
357  *   exactly.  This parameter is ignored if %service_id is set to
358  *   IB_CM_ASSIGN_SERVICE_ID.
359  */
360 int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id,
361 		 __be64 service_mask);
362 
363 struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
364 				     ib_cm_handler cm_handler,
365 				     __be64 service_id);
366 
367 struct ib_cm_req_param {
368 	struct ib_sa_path_rec	*primary_path;
369 	struct ib_sa_path_rec	*alternate_path;
370 	__be64			service_id;
371 	u32			qp_num;
372 	enum ib_qp_type		qp_type;
373 	u32			starting_psn;
374 	const void		*private_data;
375 	u8			private_data_len;
376 	u8			peer_to_peer;
377 	u8			responder_resources;
378 	u8			initiator_depth;
379 	u8			remote_cm_response_timeout;
380 	u8			flow_control;
381 	u8			local_cm_response_timeout;
382 	u8			retry_count;
383 	u8			rnr_retry_count;
384 	u8			max_cm_retries;
385 	u8			srq;
386 };
387 
388 /**
389  * ib_send_cm_req - Sends a connection request to the remote node.
390  * @cm_id: Connection identifier that will be associated with the
391  *   connection request.
392  * @param: Connection request information needed to establish the
393  *   connection.
394  */
395 int ib_send_cm_req(struct ib_cm_id *cm_id,
396 		   struct ib_cm_req_param *param);
397 
398 struct ib_cm_rep_param {
399 	u32		qp_num;
400 	u32		starting_psn;
401 	const void	*private_data;
402 	u8		private_data_len;
403 	u8		responder_resources;
404 	u8		initiator_depth;
405 	u8		failover_accepted;
406 	u8		flow_control;
407 	u8		rnr_retry_count;
408 	u8		srq;
409 };
410 
411 /**
412  * ib_send_cm_rep - Sends a connection reply in response to a connection
413  *   request.
414  * @cm_id: Connection identifier that will be associated with the
415  *   connection request.
416  * @param: Connection reply information needed to establish the
417  *   connection.
418  */
419 int ib_send_cm_rep(struct ib_cm_id *cm_id,
420 		   struct ib_cm_rep_param *param);
421 
422 /**
423  * ib_send_cm_rtu - Sends a connection ready to use message in response
424  *   to a connection reply message.
425  * @cm_id: Connection identifier associated with the connection request.
426  * @private_data: Optional user-defined private data sent with the
427  *   ready to use message.
428  * @private_data_len: Size of the private data buffer, in bytes.
429  */
430 int ib_send_cm_rtu(struct ib_cm_id *cm_id,
431 		   const void *private_data,
432 		   u8 private_data_len);
433 
434 /**
435  * ib_send_cm_dreq - Sends a disconnection request for an existing
436  *   connection.
437  * @cm_id: Connection identifier associated with the connection being
438  *   released.
439  * @private_data: Optional user-defined private data sent with the
440  *   disconnection request message.
441  * @private_data_len: Size of the private data buffer, in bytes.
442  */
443 int ib_send_cm_dreq(struct ib_cm_id *cm_id,
444 		    const void *private_data,
445 		    u8 private_data_len);
446 
447 /**
448  * ib_send_cm_drep - Sends a disconnection reply to a disconnection request.
449  * @cm_id: Connection identifier associated with the connection being
450  *   released.
451  * @private_data: Optional user-defined private data sent with the
452  *   disconnection reply message.
453  * @private_data_len: Size of the private data buffer, in bytes.
454  *
455  * If the cm_id is in the correct state, the CM will transition the connection
456  * to the timewait state, even if an error occurs sending the DREP message.
457  */
458 int ib_send_cm_drep(struct ib_cm_id *cm_id,
459 		    const void *private_data,
460 		    u8 private_data_len);
461 
462 /**
463  * ib_cm_notify - Notifies the CM of an event reported to the consumer.
464  * @cm_id: Connection identifier to transition to established.
465  * @event: Type of event.
466  *
467  * This routine should be invoked by users to notify the CM of relevant
468  * communication events.  Events that should be reported to the CM and
469  * when to report them are:
470  *
471  * IB_EVENT_COMM_EST - Used when a message is received on a connected
472  *    QP before an RTU has been received.
473  * IB_EVENT_PATH_MIG - Notifies the CM that the connection has failed over
474  *   to the alternate path.
475  */
476 int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event);
477 
478 /**
479  * ib_send_cm_rej - Sends a connection rejection message to the
480  *   remote node.
481  * @cm_id: Connection identifier associated with the connection being
482  *   rejected.
483  * @reason: Reason for the connection request rejection.
484  * @ari: Optional additional rejection information.
485  * @ari_length: Size of the additional rejection information, in bytes.
486  * @private_data: Optional user-defined private data sent with the
487  *   rejection message.
488  * @private_data_len: Size of the private data buffer, in bytes.
489  */
490 int ib_send_cm_rej(struct ib_cm_id *cm_id,
491 		   enum ib_cm_rej_reason reason,
492 		   void *ari,
493 		   u8 ari_length,
494 		   const void *private_data,
495 		   u8 private_data_len);
496 
497 #define IB_CM_MRA_FLAG_DELAY 0x80  /* Send MRA only after a duplicate msg */
498 
499 /**
500  * ib_send_cm_mra - Sends a message receipt acknowledgement to a connection
501  *   message.
502  * @cm_id: Connection identifier associated with the connection message.
503  * @service_timeout: The lower 5-bits specify the maximum time required for
504  *   the sender to reply to the connection message.  The upper 3-bits
505  *   specify additional control flags.
506  * @private_data: Optional user-defined private data sent with the
507  *   message receipt acknowledgement.
508  * @private_data_len: Size of the private data buffer, in bytes.
509  */
510 int ib_send_cm_mra(struct ib_cm_id *cm_id,
511 		   u8 service_timeout,
512 		   const void *private_data,
513 		   u8 private_data_len);
514 
515 /**
516  * ib_send_cm_lap - Sends a load alternate path request.
517  * @cm_id: Connection identifier associated with the load alternate path
518  *   message.
519  * @alternate_path: A path record that identifies the alternate path to
520  *   load.
521  * @private_data: Optional user-defined private data sent with the
522  *   load alternate path message.
523  * @private_data_len: Size of the private data buffer, in bytes.
524  */
525 int ib_send_cm_lap(struct ib_cm_id *cm_id,
526 		   struct ib_sa_path_rec *alternate_path,
527 		   const void *private_data,
528 		   u8 private_data_len);
529 
530 /**
531  * ib_cm_init_qp_attr - Initializes the QP attributes for use in transitioning
532  *   to a specified QP state.
533  * @cm_id: Communication identifier associated with the QP attributes to
534  *   initialize.
535  * @qp_attr: On input, specifies the desired QP state.  On output, the
536  *   mandatory and desired optional attributes will be set in order to
537  *   modify the QP to the specified state.
538  * @qp_attr_mask: The QP attribute mask that may be used to transition the
539  *   QP to the specified state.
540  *
541  * Users must set the @qp_attr->qp_state to the desired QP state.  This call
542  * will set all required attributes for the given transition, along with
543  * known optional attributes.  Users may override the attributes returned from
544  * this call before calling ib_modify_qp.
545  */
546 int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
547 		       struct ib_qp_attr *qp_attr,
548 		       int *qp_attr_mask);
549 
550 /**
551  * ib_send_cm_apr - Sends an alternate path response message in response to
552  *   a load alternate path request.
553  * @cm_id: Connection identifier associated with the alternate path response.
554  * @status: Reply status sent with the alternate path response.
555  * @info: Optional additional information sent with the alternate path
556  *   response.
557  * @info_length: Size of the additional information, in bytes.
558  * @private_data: Optional user-defined private data sent with the
559  *   alternate path response message.
560  * @private_data_len: Size of the private data buffer, in bytes.
561  */
562 int ib_send_cm_apr(struct ib_cm_id *cm_id,
563 		   enum ib_cm_apr_status status,
564 		   void *info,
565 		   u8 info_length,
566 		   const void *private_data,
567 		   u8 private_data_len);
568 
569 struct ib_cm_sidr_req_param {
570 	struct ib_sa_path_rec	*path;
571 	__be64			service_id;
572 	int			timeout_ms;
573 	const void		*private_data;
574 	u8			private_data_len;
575 	u8			max_cm_retries;
576 };
577 
578 /**
579  * ib_send_cm_sidr_req - Sends a service ID resolution request to the
580  *   remote node.
581  * @cm_id: Communication identifier that will be associated with the
582  *   service ID resolution request.
583  * @param: Service ID resolution request information.
584  */
585 int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
586 			struct ib_cm_sidr_req_param *param);
587 
588 struct ib_cm_sidr_rep_param {
589 	u32			qp_num;
590 	u32			qkey;
591 	enum ib_cm_sidr_status	status;
592 	const void		*info;
593 	u8			info_length;
594 	const void		*private_data;
595 	u8			private_data_len;
596 };
597 
598 /**
599  * ib_send_cm_sidr_rep - Sends a service ID resolution reply to the
600  *   remote node.
601  * @cm_id: Communication identifier associated with the received service ID
602  *   resolution request.
603  * @param: Service ID resolution reply information.
604  */
605 int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
606 			struct ib_cm_sidr_rep_param *param);
607 
608 #endif /* IB_CM_H */
609