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