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