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