rdma_cma_abi.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. /*
  2. * Copyright (c) 2005-2011 Intel Corporation. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef RDMA_CMA_ABI_H
  33. #define RDMA_CMA_ABI_H
  34. #include <rdma/ib_user_sa.h>
  35. #include <rdma/ib_user_verbs.h>
  36. #include <infiniband/sa.h>
  37. #include <netinet/in.h>
  38. /*
  39. * This file must be kept in sync with the kernel's version of rdma_user_cm.h
  40. */
  41. #define RDMA_USER_CM_MIN_ABI_VERSION 3
  42. #define RDMA_USER_CM_MAX_ABI_VERSION 4
  43. #define RDMA_MAX_PRIVATE_DATA 256
  44. enum {
  45. UCMA_CMD_CREATE_ID,
  46. UCMA_CMD_DESTROY_ID,
  47. UCMA_CMD_BIND_IP,
  48. UCMA_CMD_RESOLVE_IP,
  49. UCMA_CMD_RESOLVE_ROUTE,
  50. UCMA_CMD_QUERY_ROUTE,
  51. UCMA_CMD_CONNECT,
  52. UCMA_CMD_LISTEN,
  53. UCMA_CMD_ACCEPT,
  54. UCMA_CMD_REJECT,
  55. UCMA_CMD_DISCONNECT,
  56. UCMA_CMD_INIT_QP_ATTR,
  57. UCMA_CMD_GET_EVENT,
  58. UCMA_CMD_GET_OPTION,
  59. UCMA_CMD_SET_OPTION,
  60. UCMA_CMD_NOTIFY,
  61. UCMA_CMD_JOIN_IP_MCAST,
  62. UCMA_CMD_LEAVE_MCAST,
  63. UCMA_CMD_MIGRATE_ID,
  64. UCMA_CMD_QUERY,
  65. UCMA_CMD_BIND,
  66. UCMA_CMD_RESOLVE_ADDR,
  67. UCMA_CMD_JOIN_MCAST
  68. };
  69. struct ucma_abi_cmd_hdr {
  70. __u32 cmd;
  71. __u16 in;
  72. __u16 out;
  73. };
  74. struct ucma_abi_create_id {
  75. __u32 cmd;
  76. __u16 in;
  77. __u16 out;
  78. __u64 uid;
  79. __u64 response;
  80. __u16 ps;
  81. __u8 qp_type;
  82. __u8 reserved[5];
  83. };
  84. struct ucma_abi_create_id_resp {
  85. __u32 id;
  86. };
  87. struct ucma_abi_destroy_id {
  88. __u32 cmd;
  89. __u16 in;
  90. __u16 out;
  91. __u64 response;
  92. __u32 id;
  93. __u32 reserved;
  94. };
  95. struct ucma_abi_destroy_id_resp {
  96. __u32 events_reported;
  97. };
  98. struct ucma_abi_bind_ip {
  99. __u32 cmd;
  100. __u16 in;
  101. __u16 out;
  102. __u64 response;
  103. struct sockaddr_in6 addr;
  104. __u32 id;
  105. };
  106. struct ucma_abi_bind {
  107. __u32 cmd;
  108. __u16 in;
  109. __u16 out;
  110. __u32 id;
  111. __u16 addr_size;
  112. __u16 reserved;
  113. struct sockaddr_storage addr;
  114. };
  115. struct ucma_abi_resolve_ip {
  116. __u32 cmd;
  117. __u16 in;
  118. __u16 out;
  119. struct sockaddr_in6 src_addr;
  120. struct sockaddr_in6 dst_addr;
  121. __u32 id;
  122. __u32 timeout_ms;
  123. };
  124. struct ucma_abi_resolve_addr {
  125. __u32 cmd;
  126. __u16 in;
  127. __u16 out;
  128. __u32 id;
  129. __u32 timeout_ms;
  130. __u16 src_size;
  131. __u16 dst_size;
  132. __u32 reserved;
  133. struct sockaddr_storage src_addr;
  134. struct sockaddr_storage dst_addr;
  135. };
  136. struct ucma_abi_resolve_route {
  137. __u32 cmd;
  138. __u16 in;
  139. __u16 out;
  140. __u32 id;
  141. __u32 timeout_ms;
  142. };
  143. enum {
  144. UCMA_QUERY_ADDR,
  145. UCMA_QUERY_PATH,
  146. UCMA_QUERY_GID
  147. };
  148. struct ucma_abi_query {
  149. __u32 cmd;
  150. __u16 in;
  151. __u16 out;
  152. __u64 response;
  153. __u32 id;
  154. __u32 option;
  155. };
  156. struct ucma_abi_query_route_resp {
  157. __be64 node_guid;
  158. struct ib_user_path_rec ib_route[2];
  159. struct sockaddr_in6 src_addr;
  160. struct sockaddr_in6 dst_addr;
  161. __u32 num_paths;
  162. __u8 port_num;
  163. __u8 reserved[3];
  164. __u32 ibdev_index;
  165. __u32 reserved1;
  166. };
  167. struct ucma_abi_query_addr_resp {
  168. __be64 node_guid;
  169. __u8 port_num;
  170. __u8 reserved;
  171. __be16 pkey;
  172. __u16 src_size;
  173. __u16 dst_size;
  174. struct sockaddr_storage src_addr;
  175. struct sockaddr_storage dst_addr;
  176. __u32 ibdev_index;
  177. __u32 reserved1;
  178. };
  179. struct ucma_abi_query_path_resp {
  180. __u32 num_paths;
  181. __u32 reserved;
  182. struct ibv_path_data path_data[0];
  183. };
  184. struct ucma_abi_conn_param {
  185. __u32 qp_num;
  186. __u32 reserved;
  187. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  188. __u8 private_data_len;
  189. __u8 srq;
  190. __u8 responder_resources;
  191. __u8 initiator_depth;
  192. __u8 flow_control;
  193. __u8 retry_count;
  194. __u8 rnr_retry_count;
  195. __u8 valid;
  196. };
  197. struct ucma_abi_ud_param {
  198. __u32 qp_num;
  199. __u32 qkey;
  200. struct ib_uverbs_ah_attr ah_attr;
  201. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  202. __u8 private_data_len;
  203. __u8 reserved[7];
  204. __u8 reserved2[4]; /* Round to 8-byte boundary to support 32/64 */
  205. };
  206. struct ucma_abi_ece {
  207. __u32 vendor_id;
  208. __u32 attr_mod;
  209. };
  210. struct ucma_abi_connect {
  211. __u32 cmd;
  212. __u16 in;
  213. __u16 out;
  214. struct ucma_abi_conn_param conn_param;
  215. __u32 id;
  216. __u32 reserved;
  217. struct ucma_abi_ece ece;
  218. };
  219. struct ucma_abi_listen {
  220. __u32 cmd;
  221. __u16 in;
  222. __u16 out;
  223. __u32 id;
  224. __u32 backlog;
  225. };
  226. struct ucma_abi_accept {
  227. __u32 cmd;
  228. __u16 in;
  229. __u16 out;
  230. __u64 uid;
  231. struct ucma_abi_conn_param conn_param;
  232. __u32 id;
  233. __u32 reserved;
  234. struct ucma_abi_ece ece;
  235. };
  236. struct ucma_abi_reject {
  237. __u32 cmd;
  238. __u16 in;
  239. __u16 out;
  240. __u32 id;
  241. __u8 private_data_len;
  242. __u8 reason;
  243. __u8 reserved[2];
  244. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  245. };
  246. struct ucma_abi_disconnect {
  247. __u32 cmd;
  248. __u16 in;
  249. __u16 out;
  250. __u32 id;
  251. };
  252. struct ucma_abi_init_qp_attr {
  253. __u32 cmd;
  254. __u16 in;
  255. __u16 out;
  256. __u64 response;
  257. __u32 id;
  258. __u32 qp_state;
  259. };
  260. struct ucma_abi_notify {
  261. __u32 cmd;
  262. __u16 in;
  263. __u16 out;
  264. __u32 id;
  265. __u32 event;
  266. };
  267. struct ucma_abi_join_ip_mcast {
  268. __u32 cmd;
  269. __u16 in;
  270. __u16 out;
  271. __u64 response; /* ucma_abi_create_id_resp */
  272. __u64 uid;
  273. struct sockaddr_in6 addr;
  274. __u32 id;
  275. };
  276. struct ucma_abi_join_mcast {
  277. __u32 cmd;
  278. __u16 in;
  279. __u16 out;
  280. __u64 response; /* rdma_ucma_create_id_resp */
  281. __u64 uid;
  282. __u32 id;
  283. __u16 addr_size;
  284. __u16 join_flags;
  285. struct sockaddr_storage addr;
  286. };
  287. struct ucma_abi_get_event {
  288. __u32 cmd;
  289. __u16 in;
  290. __u16 out;
  291. __u64 response;
  292. };
  293. struct ucma_abi_event_resp {
  294. __u64 uid;
  295. __u32 id;
  296. __u32 event;
  297. __u32 status;
  298. union {
  299. struct ucma_abi_conn_param conn;
  300. struct ucma_abi_ud_param ud;
  301. } param;
  302. struct ucma_abi_ece ece;
  303. };
  304. struct ucma_abi_set_option {
  305. __u32 cmd;
  306. __u16 in;
  307. __u16 out;
  308. __u64 optval;
  309. __u32 id;
  310. __u32 level;
  311. __u32 optname;
  312. __u32 optlen;
  313. };
  314. struct ucma_abi_migrate_id {
  315. __u32 cmd;
  316. __u16 in;
  317. __u16 out;
  318. __u64 response;
  319. __u32 id;
  320. __u32 fd;
  321. };
  322. struct ucma_abi_migrate_resp {
  323. __u32 events_reported;
  324. };
  325. #endif /* RDMA_CMA_ABI_H */