ib_user_cm.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
  2. /*
  3. * Copyright (c) 2005 Topspin Communications. All rights reserved.
  4. * Copyright (c) 2005 Intel Corporation. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef IB_USER_CM_H
  35. #define IB_USER_CM_H
  36. #include <linux/types.h>
  37. #include <rdma/ib_user_sa.h>
  38. #define IB_USER_CM_ABI_VERSION 5
  39. enum {
  40. IB_USER_CM_CMD_CREATE_ID,
  41. IB_USER_CM_CMD_DESTROY_ID,
  42. IB_USER_CM_CMD_ATTR_ID,
  43. IB_USER_CM_CMD_LISTEN,
  44. IB_USER_CM_CMD_NOTIFY,
  45. IB_USER_CM_CMD_SEND_REQ,
  46. IB_USER_CM_CMD_SEND_REP,
  47. IB_USER_CM_CMD_SEND_RTU,
  48. IB_USER_CM_CMD_SEND_DREQ,
  49. IB_USER_CM_CMD_SEND_DREP,
  50. IB_USER_CM_CMD_SEND_REJ,
  51. IB_USER_CM_CMD_SEND_MRA,
  52. IB_USER_CM_CMD_SEND_LAP,
  53. IB_USER_CM_CMD_SEND_APR,
  54. IB_USER_CM_CMD_SEND_SIDR_REQ,
  55. IB_USER_CM_CMD_SEND_SIDR_REP,
  56. IB_USER_CM_CMD_EVENT,
  57. IB_USER_CM_CMD_INIT_QP_ATTR,
  58. };
  59. /*
  60. * command ABI structures.
  61. */
  62. struct ib_ucm_cmd_hdr {
  63. __u32 cmd;
  64. __u16 in;
  65. __u16 out;
  66. };
  67. struct ib_ucm_create_id {
  68. __aligned_u64 uid;
  69. __aligned_u64 response;
  70. };
  71. struct ib_ucm_create_id_resp {
  72. __u32 id;
  73. };
  74. struct ib_ucm_destroy_id {
  75. __aligned_u64 response;
  76. __u32 id;
  77. __u32 reserved;
  78. };
  79. struct ib_ucm_destroy_id_resp {
  80. __u32 events_reported;
  81. };
  82. struct ib_ucm_attr_id {
  83. __aligned_u64 response;
  84. __u32 id;
  85. __u32 reserved;
  86. };
  87. struct ib_ucm_attr_id_resp {
  88. __be64 service_id;
  89. __be64 service_mask;
  90. __be32 local_id;
  91. __be32 remote_id;
  92. };
  93. struct ib_ucm_init_qp_attr {
  94. __aligned_u64 response;
  95. __u32 id;
  96. __u32 qp_state;
  97. };
  98. struct ib_ucm_listen {
  99. __be64 service_id;
  100. __be64 service_mask;
  101. __u32 id;
  102. __u32 reserved;
  103. };
  104. struct ib_ucm_notify {
  105. __u32 id;
  106. __u32 event;
  107. };
  108. struct ib_ucm_private_data {
  109. __aligned_u64 data;
  110. __u32 id;
  111. __u8 len;
  112. __u8 reserved[3];
  113. };
  114. struct ib_ucm_req {
  115. __u32 id;
  116. __u32 qpn;
  117. __u32 qp_type;
  118. __u32 psn;
  119. __be64 sid;
  120. __aligned_u64 data;
  121. __aligned_u64 primary_path;
  122. __aligned_u64 alternate_path;
  123. __u8 len;
  124. __u8 peer_to_peer;
  125. __u8 responder_resources;
  126. __u8 initiator_depth;
  127. __u8 remote_cm_response_timeout;
  128. __u8 flow_control;
  129. __u8 local_cm_response_timeout;
  130. __u8 retry_count;
  131. __u8 rnr_retry_count;
  132. __u8 max_cm_retries;
  133. __u8 srq;
  134. __u8 reserved[5];
  135. };
  136. struct ib_ucm_rep {
  137. __aligned_u64 uid;
  138. __aligned_u64 data;
  139. __u32 id;
  140. __u32 qpn;
  141. __u32 psn;
  142. __u8 len;
  143. __u8 responder_resources;
  144. __u8 initiator_depth;
  145. __u8 target_ack_delay;
  146. __u8 failover_accepted;
  147. __u8 flow_control;
  148. __u8 rnr_retry_count;
  149. __u8 srq;
  150. __u8 reserved[4];
  151. };
  152. struct ib_ucm_info {
  153. __u32 id;
  154. __u32 status;
  155. __aligned_u64 info;
  156. __aligned_u64 data;
  157. __u8 info_len;
  158. __u8 data_len;
  159. __u8 reserved[6];
  160. };
  161. struct ib_ucm_mra {
  162. __aligned_u64 data;
  163. __u32 id;
  164. __u8 len;
  165. __u8 timeout;
  166. __u8 reserved[2];
  167. };
  168. struct ib_ucm_lap {
  169. __aligned_u64 path;
  170. __aligned_u64 data;
  171. __u32 id;
  172. __u8 len;
  173. __u8 reserved[3];
  174. };
  175. struct ib_ucm_sidr_req {
  176. __u32 id;
  177. __u32 timeout;
  178. __be64 sid;
  179. __aligned_u64 data;
  180. __aligned_u64 path;
  181. __u16 reserved_pkey;
  182. __u8 len;
  183. __u8 max_cm_retries;
  184. __u8 reserved[4];
  185. };
  186. struct ib_ucm_sidr_rep {
  187. __u32 id;
  188. __u32 qpn;
  189. __u32 qkey;
  190. __u32 status;
  191. __aligned_u64 info;
  192. __aligned_u64 data;
  193. __u8 info_len;
  194. __u8 data_len;
  195. __u8 reserved[6];
  196. };
  197. /*
  198. * event notification ABI structures.
  199. */
  200. struct ib_ucm_event_get {
  201. __aligned_u64 response;
  202. __aligned_u64 data;
  203. __aligned_u64 info;
  204. __u8 data_len;
  205. __u8 info_len;
  206. __u8 reserved[6];
  207. };
  208. struct ib_ucm_req_event_resp {
  209. struct ib_user_path_rec primary_path;
  210. struct ib_user_path_rec alternate_path;
  211. __be64 remote_ca_guid;
  212. __u32 remote_qkey;
  213. __u32 remote_qpn;
  214. __u32 qp_type;
  215. __u32 starting_psn;
  216. __u8 responder_resources;
  217. __u8 initiator_depth;
  218. __u8 local_cm_response_timeout;
  219. __u8 flow_control;
  220. __u8 remote_cm_response_timeout;
  221. __u8 retry_count;
  222. __u8 rnr_retry_count;
  223. __u8 srq;
  224. __u8 port;
  225. __u8 reserved[7];
  226. };
  227. struct ib_ucm_rep_event_resp {
  228. __be64 remote_ca_guid;
  229. __u32 remote_qkey;
  230. __u32 remote_qpn;
  231. __u32 starting_psn;
  232. __u8 responder_resources;
  233. __u8 initiator_depth;
  234. __u8 target_ack_delay;
  235. __u8 failover_accepted;
  236. __u8 flow_control;
  237. __u8 rnr_retry_count;
  238. __u8 srq;
  239. __u8 reserved[5];
  240. };
  241. struct ib_ucm_rej_event_resp {
  242. __u32 reason;
  243. /* ari in ib_ucm_event_get info field. */
  244. };
  245. struct ib_ucm_mra_event_resp {
  246. __u8 timeout;
  247. __u8 reserved[3];
  248. };
  249. struct ib_ucm_lap_event_resp {
  250. struct ib_user_path_rec path;
  251. };
  252. struct ib_ucm_apr_event_resp {
  253. __u32 status;
  254. /* apr info in ib_ucm_event_get info field. */
  255. };
  256. struct ib_ucm_sidr_req_event_resp {
  257. __u16 pkey;
  258. __u8 port;
  259. __u8 reserved;
  260. };
  261. struct ib_ucm_sidr_rep_event_resp {
  262. __u32 status;
  263. __u32 qkey;
  264. __u32 qpn;
  265. /* info in ib_ucm_event_get info field. */
  266. };
  267. #define IB_UCM_PRES_DATA 0x01
  268. #define IB_UCM_PRES_INFO 0x02
  269. #define IB_UCM_PRES_PRIMARY 0x04
  270. #define IB_UCM_PRES_ALTERNATE 0x08
  271. struct ib_ucm_event_resp {
  272. __aligned_u64 uid;
  273. __u32 id;
  274. __u32 event;
  275. __u32 present;
  276. __u32 reserved;
  277. union {
  278. struct ib_ucm_req_event_resp req_resp;
  279. struct ib_ucm_rep_event_resp rep_resp;
  280. struct ib_ucm_rej_event_resp rej_resp;
  281. struct ib_ucm_mra_event_resp mra_resp;
  282. struct ib_ucm_lap_event_resp lap_resp;
  283. struct ib_ucm_apr_event_resp apr_resp;
  284. struct ib_ucm_sidr_req_event_resp sidr_req_resp;
  285. struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
  286. __u32 send_status;
  287. } u;
  288. };
  289. #endif /* IB_USER_CM_H */