rdma_user_cm.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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/in6.h>
  36. #include <rdma/ib_user_verbs.h>
  37. #include <rdma/ib_user_sa.h>
  38. #define RDMA_USER_CM_ABI_VERSION 4
  39. #define RDMA_MAX_PRIVATE_DATA 256
  40. enum {
  41. RDMA_USER_CM_CMD_CREATE_ID,
  42. RDMA_USER_CM_CMD_DESTROY_ID,
  43. RDMA_USER_CM_CMD_BIND_ADDR,
  44. RDMA_USER_CM_CMD_RESOLVE_ADDR,
  45. RDMA_USER_CM_CMD_RESOLVE_ROUTE,
  46. RDMA_USER_CM_CMD_QUERY_ROUTE,
  47. RDMA_USER_CM_CMD_CONNECT,
  48. RDMA_USER_CM_CMD_LISTEN,
  49. RDMA_USER_CM_CMD_ACCEPT,
  50. RDMA_USER_CM_CMD_REJECT,
  51. RDMA_USER_CM_CMD_DISCONNECT,
  52. RDMA_USER_CM_CMD_INIT_QP_ATTR,
  53. RDMA_USER_CM_CMD_GET_EVENT,
  54. RDMA_USER_CM_CMD_GET_OPTION,
  55. RDMA_USER_CM_CMD_SET_OPTION,
  56. RDMA_USER_CM_CMD_NOTIFY,
  57. RDMA_USER_CM_CMD_JOIN_MCAST,
  58. RDMA_USER_CM_CMD_LEAVE_MCAST,
  59. RDMA_USER_CM_CMD_MIGRATE_ID
  60. };
  61. /*
  62. * command ABI structures.
  63. */
  64. struct rdma_ucm_cmd_hdr {
  65. __u32 cmd;
  66. __u16 in;
  67. __u16 out;
  68. };
  69. struct rdma_ucm_create_id {
  70. __u64 uid;
  71. __u64 response;
  72. __u16 ps;
  73. __u8 reserved[6];
  74. };
  75. struct rdma_ucm_create_id_resp {
  76. __u32 id;
  77. };
  78. struct rdma_ucm_destroy_id {
  79. __u64 response;
  80. __u32 id;
  81. __u32 reserved;
  82. };
  83. struct rdma_ucm_destroy_id_resp {
  84. __u32 events_reported;
  85. };
  86. struct rdma_ucm_bind_addr {
  87. __u64 response;
  88. struct sockaddr_in6 addr;
  89. __u32 id;
  90. };
  91. struct rdma_ucm_resolve_addr {
  92. struct sockaddr_in6 src_addr;
  93. struct sockaddr_in6 dst_addr;
  94. __u32 id;
  95. __u32 timeout_ms;
  96. };
  97. struct rdma_ucm_resolve_route {
  98. __u32 id;
  99. __u32 timeout_ms;
  100. };
  101. struct rdma_ucm_query_route {
  102. __u64 response;
  103. __u32 id;
  104. __u32 reserved;
  105. };
  106. struct rdma_ucm_query_route_resp {
  107. __u64 node_guid;
  108. struct ib_user_path_rec ib_route[2];
  109. struct sockaddr_in6 src_addr;
  110. struct sockaddr_in6 dst_addr;
  111. __u32 num_paths;
  112. __u8 port_num;
  113. __u8 reserved[3];
  114. };
  115. struct rdma_ucm_conn_param {
  116. __u32 qp_num;
  117. __u32 reserved;
  118. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  119. __u8 private_data_len;
  120. __u8 srq;
  121. __u8 responder_resources;
  122. __u8 initiator_depth;
  123. __u8 flow_control;
  124. __u8 retry_count;
  125. __u8 rnr_retry_count;
  126. __u8 valid;
  127. };
  128. struct rdma_ucm_ud_param {
  129. __u32 qp_num;
  130. __u32 qkey;
  131. struct ib_uverbs_ah_attr ah_attr;
  132. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  133. __u8 private_data_len;
  134. __u8 reserved[7];
  135. };
  136. struct rdma_ucm_connect {
  137. struct rdma_ucm_conn_param conn_param;
  138. __u32 id;
  139. __u32 reserved;
  140. };
  141. struct rdma_ucm_listen {
  142. __u32 id;
  143. __u32 backlog;
  144. };
  145. struct rdma_ucm_accept {
  146. __u64 uid;
  147. struct rdma_ucm_conn_param conn_param;
  148. __u32 id;
  149. __u32 reserved;
  150. };
  151. struct rdma_ucm_reject {
  152. __u32 id;
  153. __u8 private_data_len;
  154. __u8 reserved[3];
  155. __u8 private_data[RDMA_MAX_PRIVATE_DATA];
  156. };
  157. struct rdma_ucm_disconnect {
  158. __u32 id;
  159. };
  160. struct rdma_ucm_init_qp_attr {
  161. __u64 response;
  162. __u32 id;
  163. __u32 qp_state;
  164. };
  165. struct rdma_ucm_notify {
  166. __u32 id;
  167. __u32 event;
  168. };
  169. struct rdma_ucm_join_mcast {
  170. __u64 response; /* rdma_ucm_create_id_resp */
  171. __u64 uid;
  172. struct sockaddr_in6 addr;
  173. __u32 id;
  174. };
  175. struct rdma_ucm_get_event {
  176. __u64 response;
  177. };
  178. struct rdma_ucm_event_resp {
  179. __u64 uid;
  180. __u32 id;
  181. __u32 event;
  182. __u32 status;
  183. union {
  184. struct rdma_ucm_conn_param conn;
  185. struct rdma_ucm_ud_param ud;
  186. } param;
  187. };
  188. /* Option levels */
  189. enum {
  190. RDMA_OPTION_ID = 0,
  191. RDMA_OPTION_IB = 1
  192. };
  193. /* Option details */
  194. enum {
  195. RDMA_OPTION_ID_TOS = 0,
  196. RDMA_OPTION_ID_REUSEADDR = 1,
  197. RDMA_OPTION_IB_PATH = 1
  198. };
  199. struct rdma_ucm_set_option {
  200. __u64 optval;
  201. __u32 id;
  202. __u32 level;
  203. __u32 optname;
  204. __u32 optlen;
  205. };
  206. struct rdma_ucm_migrate_id {
  207. __u64 response;
  208. __u32 id;
  209. __u32 fd;
  210. };
  211. struct rdma_ucm_migrate_resp {
  212. __u32 events_reported;
  213. };
  214. #endif /* RDMA_USER_CM_H */