ib_cm.h 19 KB

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