rdma_user_cm.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. /*
  2. * Copyright (c) 2005-2006 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_USER_CM_H
  33. #define RDMA_USER_CM_H
  34. #include <linux/types.h>
  35. #include <linux/socket.h>
  36. #include <linux/in6.h>
  37. #include <rdma/ib_user_verbs.h>
  38. #include <rdma/ib_user_sa.h>
  39. #define RDMA_USER_CM_ABI_VERSION 4
  40. #define RDMA_MAX_PRIVATE_DATA 256
  41. enum {
  42. RDMA_USER_CM_CMD_CREATE_ID,
  43. RDMA_USER_CM_CMD_DESTROY_ID,
  44. RDMA_USER_CM_CMD_BIND_IP,
  45. RDMA_USER_CM_CMD_RESOLVE_IP,
  46. RDMA_USER_CM_CMD_RESOLVE_ROUTE,
  47. RDMA_USER_CM_CMD_QUERY_ROUTE,
  48. RDMA_USER_CM_CMD_CONNECT,
  49. RDMA_USER_CM_CMD_LISTEN,
  50. RDMA_USER_CM_CMD_ACCEPT,
  51. RDMA_USER_CM_CMD_REJECT,
  52. RDMA_USER_CM_CMD_DISCONNECT,
  53. RDMA_USER_CM_CMD_INIT_QP_ATTR,
  54. RDMA_USER_CM_CMD_GET_EVENT,
  55. RDMA_USER_CM_CMD_GET_OPTION,
  56. RDMA_USER_CM_CMD_SET_OPTION,
  57. RDMA_USER_CM_CMD_NOTIFY,
  58. RDMA_USER_CM_CMD_JOIN_IP_MCAST,
  59. RDMA_USER_CM_CMD_LEAVE_MCAST,
  60. RDMA_USER_CM_CMD_MIGRATE_ID,
  61. RDMA_USER_CM_CMD_QUERY,
  62. RDMA_USER_CM_CMD_BIND,
  63. RDMA_USER_CM_CMD_RESOLVE_ADDR,
  64. RDMA_USER_CM_CMD_JOIN_MCAST
  65. };
  66. /*
  67. * command ABI structures.
  68. */
  69. struct rdma_ucm_cmd_hdr {
  70. __u32 cmd;
  71. __u16 in;
  72. __u16 out;
  73. };
  74. struct rdma_ucm_create_id {
  75. __u64 uid;
  76. __u64 response;
  77. __u16 ps;
  78. __u8 qp_type;
  79. __u8 reserved[5];
  80. };
  81. struct rdma_ucm_create_id_resp {
  82. __u32 id;
  83. };
  84. struct rdma_ucm_destroy_id {
  85. __u64 response;
  86. __u32 id;
  87. __u32 reserved;
  88. };
  89. struct rdma_ucm_destroy_id_resp {
  90. __u32 events_reported;
  91. };
  92. struct rdma_ucm_bind_ip {
  93. __u64 response;
  94. struct sockaddr_in6 addr;
  95. __u32 id;
  96. };
  97. struct rdma_ucm_bind {
  98. __u32 id;
  99. __u16 addr_size;
  100. __u16 reserved;
  101. struct sockaddr_storage addr;
  102. };
  103. struct rdma_ucm_resolve_ip {
  104. struct sockaddr_in6 src_addr;
  105. struct sockaddr_in6 dst_addr;
  106. __u32 id;
  107. __u32 timeout_ms;
  108. };
  109. struct rdma_ucm_resolve_addr {
  110. __u32 id;
  111. __u32 timeout_ms;
  112. __u16 src_size;
  113. __u16 dst_size;
  114. __u32 reserved;
  115. struct sockaddr_storage src_addr;
  116. struct sockaddr_storage dst_addr;
  117. };
  118. struct rdma_ucm_resolve_route {
  119. __u32 id;
  120. __u32 timeout_ms;
  121. };
  122. enum {
  123. RDMA_USER_CM_QUERY_ADDR,
  124. RDMA_USER_CM_QUERY_PATH,
  125. RDMA_USER_CM_QUERY_GID
  126. };
  127. struct rdma_ucm_query {
  128. __u64 response;
  129. __u32 id;
  130. __u32 option;
  131. };
  132. struct rdma_ucm_query_route_resp {
  133. __u64 node_guid;
  134. struct ib_user_path_rec ib_route[2];
  135. struct sockaddr_in6 src_addr;
  136. struct sockaddr_in6 dst_addr;
  137. __u32 num_paths;
  138. __u8 port_num;
  139. __u8 reserved[3];
  140. };
  141. struct rdma_ucm_query_addr_resp {
  142. __u64 node_guid;
  143. __u8 port_num;
  144. __u8 reserved;
  145. __u16 pkey;
  146. __u16 src_size;
  147. __u16 dst_size;
  148. struct sockaddr_storage src_addr;
  149. struct sockaddr_storage dst_addr;
  150. };
  151. struct rdma_ucm_query_path_resp {
  152. __u32 num_paths;
  153. __u32 reserved;
  154. struct ib_path_rec_data path_data[0];
  155. };
  156. struct rdma_ucm_conn_param {
  157. __u32 qp_num;
  158. __u32 qkey;
  159. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  160. __u8 private_data_len;
  161. __u8 srq;
  162. __u8 responder_resources;
  163. __u8 initiator_depth;
  164. __u8 flow_control;
  165. __u8 retry_count;
  166. __u8 rnr_retry_count;
  167. __u8 valid;
  168. };
  169. struct rdma_ucm_ud_param {
  170. __u32 qp_num;
  171. __u32 qkey;
  172. struct ib_uverbs_ah_attr ah_attr;
  173. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  174. __u8 private_data_len;
  175. __u8 reserved[7];
  176. };
  177. struct rdma_ucm_connect {
  178. struct rdma_ucm_conn_param conn_param;
  179. __u32 id;
  180. __u32 reserved;
  181. };
  182. struct rdma_ucm_listen {
  183. __u32 id;
  184. __u32 backlog;
  185. };
  186. struct rdma_ucm_accept {
  187. __u64 uid;
  188. struct rdma_ucm_conn_param conn_param;
  189. __u32 id;
  190. __u32 reserved;
  191. };
  192. struct rdma_ucm_reject {
  193. __u32 id;
  194. __u8 private_data_len;
  195. __u8 reserved[3];
  196. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  197. };
  198. struct rdma_ucm_disconnect {
  199. __u32 id;
  200. };
  201. struct rdma_ucm_init_qp_attr {
  202. __u64 response;
  203. __u32 id;
  204. __u32 qp_state;
  205. };
  206. struct rdma_ucm_notify {
  207. __u32 id;
  208. __u32 event;
  209. };
  210. struct rdma_ucm_join_ip_mcast {
  211. __u64 response; /* rdma_ucm_create_id_resp */
  212. __u64 uid;
  213. struct sockaddr_in6 addr;
  214. __u32 id;
  215. };
  216. /* Multicast join flags */
  217. enum {
  218. RDMA_MC_JOIN_FLAG_FULLMEMBER,
  219. RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER,
  220. RDMA_MC_JOIN_FLAG_RESERVED,
  221. };
  222. struct rdma_ucm_join_mcast {
  223. __u64 response; /* rdma_ucma_create_id_resp */
  224. __u64 uid;
  225. __u32 id;
  226. __u16 addr_size;
  227. __u16 join_flags;
  228. struct sockaddr_storage addr;
  229. };
  230. struct rdma_ucm_get_event {
  231. __u64 response;
  232. };
  233. struct rdma_ucm_event_resp {
  234. __u64 uid;
  235. __u32 id;
  236. __u32 event;
  237. __u32 status;
  238. union {
  239. struct rdma_ucm_conn_param conn;
  240. struct rdma_ucm_ud_param ud;
  241. } param;
  242. };
  243. /* Option levels */
  244. enum {
  245. RDMA_OPTION_ID = 0,
  246. RDMA_OPTION_IB = 1
  247. };
  248. /* Option details */
  249. enum {
  250. RDMA_OPTION_ID_TOS = 0,
  251. RDMA_OPTION_ID_REUSEADDR = 1,
  252. RDMA_OPTION_ID_AFONLY = 2,
  253. RDMA_OPTION_IB_PATH = 1
  254. };
  255. struct rdma_ucm_set_option {
  256. __u64 optval;
  257. __u32 id;
  258. __u32 level;
  259. __u32 optname;
  260. __u32 optlen;
  261. };
  262. struct rdma_ucm_migrate_id {
  263. __u64 response;
  264. __u32 id;
  265. __u32 fd;
  266. };
  267. struct rdma_ucm_migrate_resp {
  268. __u32 events_reported;
  269. };
  270. #endif /* RDMA_USER_CM_H */