PageRenderTime 3524ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 1ms

/include/uapi/rdma/rdma_user_cm.h

https://gitlab.com/oyvholm/linux
C Header | 311 lines | 233 code | 40 blank | 38 comment | 0 complexity | 1b05e9556d83e33322c88773792660e7 MD5 | raw file
  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
  2. /*
  3. * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #ifndef RDMA_USER_CM_H
  34. #define RDMA_USER_CM_H
  35. #include <linux/types.h>
  36. #include <linux/socket.h>
  37. #include <linux/in6.h>
  38. #include <rdma/ib_user_verbs.h>
  39. #include <rdma/ib_user_sa.h>
  40. #define RDMA_USER_CM_ABI_VERSION 4
  41. #define RDMA_MAX_PRIVATE_DATA 256
  42. enum {
  43. RDMA_USER_CM_CMD_CREATE_ID,
  44. RDMA_USER_CM_CMD_DESTROY_ID,
  45. RDMA_USER_CM_CMD_BIND_IP,
  46. RDMA_USER_CM_CMD_RESOLVE_IP,
  47. RDMA_USER_CM_CMD_RESOLVE_ROUTE,
  48. RDMA_USER_CM_CMD_QUERY_ROUTE,
  49. RDMA_USER_CM_CMD_CONNECT,
  50. RDMA_USER_CM_CMD_LISTEN,
  51. RDMA_USER_CM_CMD_ACCEPT,
  52. RDMA_USER_CM_CMD_REJECT,
  53. RDMA_USER_CM_CMD_DISCONNECT,
  54. RDMA_USER_CM_CMD_INIT_QP_ATTR,
  55. RDMA_USER_CM_CMD_GET_EVENT,
  56. RDMA_USER_CM_CMD_GET_OPTION,
  57. RDMA_USER_CM_CMD_SET_OPTION,
  58. RDMA_USER_CM_CMD_NOTIFY,
  59. RDMA_USER_CM_CMD_JOIN_IP_MCAST,
  60. RDMA_USER_CM_CMD_LEAVE_MCAST,
  61. RDMA_USER_CM_CMD_MIGRATE_ID,
  62. RDMA_USER_CM_CMD_QUERY,
  63. RDMA_USER_CM_CMD_BIND,
  64. RDMA_USER_CM_CMD_RESOLVE_ADDR,
  65. RDMA_USER_CM_CMD_JOIN_MCAST
  66. };
  67. /*
  68. * command ABI structures.
  69. */
  70. struct rdma_ucm_cmd_hdr {
  71. __u32 cmd;
  72. __u16 in;
  73. __u16 out;
  74. };
  75. struct rdma_ucm_create_id {
  76. __u64 uid;
  77. __u64 response;
  78. __u16 ps;
  79. __u8 qp_type;
  80. __u8 reserved[5];
  81. };
  82. struct rdma_ucm_create_id_resp {
  83. __u32 id;
  84. };
  85. struct rdma_ucm_destroy_id {
  86. __u64 response;
  87. __u32 id;
  88. __u32 reserved;
  89. };
  90. struct rdma_ucm_destroy_id_resp {
  91. __u32 events_reported;
  92. };
  93. struct rdma_ucm_bind_ip {
  94. __u64 response;
  95. struct sockaddr_in6 addr;
  96. __u32 id;
  97. };
  98. struct rdma_ucm_bind {
  99. __u32 id;
  100. __u16 addr_size;
  101. __u16 reserved;
  102. struct __kernel_sockaddr_storage addr;
  103. };
  104. struct rdma_ucm_resolve_ip {
  105. struct sockaddr_in6 src_addr;
  106. struct sockaddr_in6 dst_addr;
  107. __u32 id;
  108. __u32 timeout_ms;
  109. };
  110. struct rdma_ucm_resolve_addr {
  111. __u32 id;
  112. __u32 timeout_ms;
  113. __u16 src_size;
  114. __u16 dst_size;
  115. __u32 reserved;
  116. struct __kernel_sockaddr_storage src_addr;
  117. struct __kernel_sockaddr_storage dst_addr;
  118. };
  119. struct rdma_ucm_resolve_route {
  120. __u32 id;
  121. __u32 timeout_ms;
  122. };
  123. enum {
  124. RDMA_USER_CM_QUERY_ADDR,
  125. RDMA_USER_CM_QUERY_PATH,
  126. RDMA_USER_CM_QUERY_GID
  127. };
  128. struct rdma_ucm_query {
  129. __u64 response;
  130. __u32 id;
  131. __u32 option;
  132. };
  133. struct rdma_ucm_query_route_resp {
  134. __u64 node_guid;
  135. struct ib_user_path_rec ib_route[2];
  136. struct sockaddr_in6 src_addr;
  137. struct sockaddr_in6 dst_addr;
  138. __u32 num_paths;
  139. __u8 port_num;
  140. __u8 reserved[3];
  141. };
  142. struct rdma_ucm_query_addr_resp {
  143. __u64 node_guid;
  144. __u8 port_num;
  145. __u8 reserved;
  146. __u16 pkey;
  147. __u16 src_size;
  148. __u16 dst_size;
  149. struct __kernel_sockaddr_storage src_addr;
  150. struct __kernel_sockaddr_storage dst_addr;
  151. };
  152. struct rdma_ucm_query_path_resp {
  153. __u32 num_paths;
  154. __u32 reserved;
  155. struct ib_path_rec_data path_data[0];
  156. };
  157. struct rdma_ucm_conn_param {
  158. __u32 qp_num;
  159. __u32 qkey;
  160. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  161. __u8 private_data_len;
  162. __u8 srq;
  163. __u8 responder_resources;
  164. __u8 initiator_depth;
  165. __u8 flow_control;
  166. __u8 retry_count;
  167. __u8 rnr_retry_count;
  168. __u8 valid;
  169. };
  170. struct rdma_ucm_ud_param {
  171. __u32 qp_num;
  172. __u32 qkey;
  173. struct ib_uverbs_ah_attr ah_attr;
  174. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  175. __u8 private_data_len;
  176. __u8 reserved[7];
  177. };
  178. struct rdma_ucm_connect {
  179. struct rdma_ucm_conn_param conn_param;
  180. __u32 id;
  181. __u32 reserved;
  182. };
  183. struct rdma_ucm_listen {
  184. __u32 id;
  185. __u32 backlog;
  186. };
  187. struct rdma_ucm_accept {
  188. __u64 uid;
  189. struct rdma_ucm_conn_param conn_param;
  190. __u32 id;
  191. __u32 reserved;
  192. };
  193. struct rdma_ucm_reject {
  194. __u32 id;
  195. __u8 private_data_len;
  196. __u8 reserved[3];
  197. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  198. };
  199. struct rdma_ucm_disconnect {
  200. __u32 id;
  201. };
  202. struct rdma_ucm_init_qp_attr {
  203. __u64 response;
  204. __u32 id;
  205. __u32 qp_state;
  206. };
  207. struct rdma_ucm_notify {
  208. __u32 id;
  209. __u32 event;
  210. };
  211. struct rdma_ucm_join_ip_mcast {
  212. __u64 response; /* rdma_ucm_create_id_resp */
  213. __u64 uid;
  214. struct sockaddr_in6 addr;
  215. __u32 id;
  216. };
  217. /* Multicast join flags */
  218. enum {
  219. RDMA_MC_JOIN_FLAG_FULLMEMBER,
  220. RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER,
  221. RDMA_MC_JOIN_FLAG_RESERVED,
  222. };
  223. struct rdma_ucm_join_mcast {
  224. __u64 response; /* rdma_ucma_create_id_resp */
  225. __u64 uid;
  226. __u32 id;
  227. __u16 addr_size;
  228. __u16 join_flags;
  229. struct __kernel_sockaddr_storage addr;
  230. };
  231. struct rdma_ucm_get_event {
  232. __u64 response;
  233. };
  234. struct rdma_ucm_event_resp {
  235. __u64 uid;
  236. __u32 id;
  237. __u32 event;
  238. __u32 status;
  239. union {
  240. struct rdma_ucm_conn_param conn;
  241. struct rdma_ucm_ud_param ud;
  242. } param;
  243. };
  244. /* Option levels */
  245. enum {
  246. RDMA_OPTION_ID = 0,
  247. RDMA_OPTION_IB = 1
  248. };
  249. /* Option details */
  250. enum {
  251. RDMA_OPTION_ID_TOS = 0,
  252. RDMA_OPTION_ID_REUSEADDR = 1,
  253. RDMA_OPTION_ID_AFONLY = 2,
  254. RDMA_OPTION_IB_PATH = 1
  255. };
  256. struct rdma_ucm_set_option {
  257. __u64 optval;
  258. __u32 id;
  259. __u32 level;
  260. __u32 optname;
  261. __u32 optlen;
  262. };
  263. struct rdma_ucm_migrate_id {
  264. __u64 response;
  265. __u32 id;
  266. __u32 fd;
  267. };
  268. struct rdma_ucm_migrate_resp {
  269. __u32 events_reported;
  270. };
  271. #endif /* RDMA_USER_CM_H */