ib_user_verbs.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. /*
  2. * Copyright (c) 2005 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005 Cisco Systems. 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. * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $
  34. */
  35. #ifndef IB_USER_VERBS_H
  36. #define IB_USER_VERBS_H
  37. #include <linux/types.h>
  38. /*
  39. * Increment this value if any changes that break userspace ABI
  40. * compatibility are made.
  41. */
  42. #define IB_USER_VERBS_ABI_VERSION 1
  43. enum {
  44. IB_USER_VERBS_CMD_QUERY_PARAMS,
  45. IB_USER_VERBS_CMD_GET_CONTEXT,
  46. IB_USER_VERBS_CMD_QUERY_DEVICE,
  47. IB_USER_VERBS_CMD_QUERY_PORT,
  48. IB_USER_VERBS_CMD_QUERY_GID,
  49. IB_USER_VERBS_CMD_QUERY_PKEY,
  50. IB_USER_VERBS_CMD_ALLOC_PD,
  51. IB_USER_VERBS_CMD_DEALLOC_PD,
  52. IB_USER_VERBS_CMD_CREATE_AH,
  53. IB_USER_VERBS_CMD_MODIFY_AH,
  54. IB_USER_VERBS_CMD_QUERY_AH,
  55. IB_USER_VERBS_CMD_DESTROY_AH,
  56. IB_USER_VERBS_CMD_REG_MR,
  57. IB_USER_VERBS_CMD_REG_SMR,
  58. IB_USER_VERBS_CMD_REREG_MR,
  59. IB_USER_VERBS_CMD_QUERY_MR,
  60. IB_USER_VERBS_CMD_DEREG_MR,
  61. IB_USER_VERBS_CMD_ALLOC_MW,
  62. IB_USER_VERBS_CMD_BIND_MW,
  63. IB_USER_VERBS_CMD_DEALLOC_MW,
  64. IB_USER_VERBS_CMD_CREATE_CQ,
  65. IB_USER_VERBS_CMD_RESIZE_CQ,
  66. IB_USER_VERBS_CMD_DESTROY_CQ,
  67. IB_USER_VERBS_CMD_POLL_CQ,
  68. IB_USER_VERBS_CMD_PEEK_CQ,
  69. IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
  70. IB_USER_VERBS_CMD_CREATE_QP,
  71. IB_USER_VERBS_CMD_QUERY_QP,
  72. IB_USER_VERBS_CMD_MODIFY_QP,
  73. IB_USER_VERBS_CMD_DESTROY_QP,
  74. IB_USER_VERBS_CMD_POST_SEND,
  75. IB_USER_VERBS_CMD_POST_RECV,
  76. IB_USER_VERBS_CMD_ATTACH_MCAST,
  77. IB_USER_VERBS_CMD_DETACH_MCAST
  78. };
  79. /*
  80. * Make sure that all structs defined in this file remain laid out so
  81. * that they pack the same way on 32-bit and 64-bit architectures (to
  82. * avoid incompatibility between 32-bit userspace and 64-bit kernels).
  83. * In particular do not use pointer types -- pass pointers in __u64
  84. * instead.
  85. */
  86. struct ib_uverbs_async_event_desc {
  87. __u64 element;
  88. __u32 event_type; /* enum ib_event_type */
  89. __u32 reserved;
  90. };
  91. struct ib_uverbs_comp_event_desc {
  92. __u64 cq_handle;
  93. };
  94. /*
  95. * All commands from userspace should start with a __u32 command field
  96. * followed by __u16 in_words and out_words fields (which give the
  97. * length of the command block and response buffer if any in 32-bit
  98. * words). The kernel driver will read these fields first and read
  99. * the rest of the command struct based on these value.
  100. */
  101. struct ib_uverbs_cmd_hdr {
  102. __u32 command;
  103. __u16 in_words;
  104. __u16 out_words;
  105. };
  106. /*
  107. * No driver_data for "query params" command, since this is intended
  108. * to be a core function with no possible device dependence.
  109. */
  110. struct ib_uverbs_query_params {
  111. __u64 response;
  112. };
  113. struct ib_uverbs_query_params_resp {
  114. __u32 num_cq_events;
  115. };
  116. struct ib_uverbs_get_context {
  117. __u64 response;
  118. __u64 cq_fd_tab;
  119. __u64 driver_data[0];
  120. };
  121. struct ib_uverbs_get_context_resp {
  122. __u32 async_fd;
  123. __u32 reserved;
  124. };
  125. struct ib_uverbs_query_device {
  126. __u64 response;
  127. __u64 driver_data[0];
  128. };
  129. struct ib_uverbs_query_device_resp {
  130. __u64 fw_ver;
  131. __u64 node_guid;
  132. __u64 sys_image_guid;
  133. __u64 max_mr_size;
  134. __u64 page_size_cap;
  135. __u32 vendor_id;
  136. __u32 vendor_part_id;
  137. __u32 hw_ver;
  138. __u32 max_qp;
  139. __u32 max_qp_wr;
  140. __u32 device_cap_flags;
  141. __u32 max_sge;
  142. __u32 max_sge_rd;
  143. __u32 max_cq;
  144. __u32 max_cqe;
  145. __u32 max_mr;
  146. __u32 max_pd;
  147. __u32 max_qp_rd_atom;
  148. __u32 max_ee_rd_atom;
  149. __u32 max_res_rd_atom;
  150. __u32 max_qp_init_rd_atom;
  151. __u32 max_ee_init_rd_atom;
  152. __u32 atomic_cap;
  153. __u32 max_ee;
  154. __u32 max_rdd;
  155. __u32 max_mw;
  156. __u32 max_raw_ipv6_qp;
  157. __u32 max_raw_ethy_qp;
  158. __u32 max_mcast_grp;
  159. __u32 max_mcast_qp_attach;
  160. __u32 max_total_mcast_qp_attach;
  161. __u32 max_ah;
  162. __u32 max_fmr;
  163. __u32 max_map_per_fmr;
  164. __u32 max_srq;
  165. __u32 max_srq_wr;
  166. __u32 max_srq_sge;
  167. __u16 max_pkeys;
  168. __u8 local_ca_ack_delay;
  169. __u8 phys_port_cnt;
  170. __u8 reserved[4];
  171. };
  172. struct ib_uverbs_query_port {
  173. __u64 response;
  174. __u8 port_num;
  175. __u8 reserved[7];
  176. __u64 driver_data[0];
  177. };
  178. struct ib_uverbs_query_port_resp {
  179. __u32 port_cap_flags;
  180. __u32 max_msg_sz;
  181. __u32 bad_pkey_cntr;
  182. __u32 qkey_viol_cntr;
  183. __u32 gid_tbl_len;
  184. __u16 pkey_tbl_len;
  185. __u16 lid;
  186. __u16 sm_lid;
  187. __u8 state;
  188. __u8 max_mtu;
  189. __u8 active_mtu;
  190. __u8 lmc;
  191. __u8 max_vl_num;
  192. __u8 sm_sl;
  193. __u8 subnet_timeout;
  194. __u8 init_type_reply;
  195. __u8 active_width;
  196. __u8 active_speed;
  197. __u8 phys_state;
  198. __u8 reserved[3];
  199. };
  200. struct ib_uverbs_query_gid {
  201. __u64 response;
  202. __u8 port_num;
  203. __u8 index;
  204. __u8 reserved[6];
  205. __u64 driver_data[0];
  206. };
  207. struct ib_uverbs_query_gid_resp {
  208. __u8 gid[16];
  209. };
  210. struct ib_uverbs_query_pkey {
  211. __u64 response;
  212. __u8 port_num;
  213. __u8 index;
  214. __u8 reserved[6];
  215. __u64 driver_data[0];
  216. };
  217. struct ib_uverbs_query_pkey_resp {
  218. __u16 pkey;
  219. __u16 reserved;
  220. };
  221. struct ib_uverbs_alloc_pd {
  222. __u64 response;
  223. __u64 driver_data[0];
  224. };
  225. struct ib_uverbs_alloc_pd_resp {
  226. __u32 pd_handle;
  227. };
  228. struct ib_uverbs_dealloc_pd {
  229. __u32 pd_handle;
  230. };
  231. struct ib_uverbs_reg_mr {
  232. __u64 response;
  233. __u64 start;
  234. __u64 length;
  235. __u64 hca_va;
  236. __u32 pd_handle;
  237. __u32 access_flags;
  238. __u64 driver_data[0];
  239. };
  240. struct ib_uverbs_reg_mr_resp {
  241. __u32 mr_handle;
  242. __u32 lkey;
  243. __u32 rkey;
  244. };
  245. struct ib_uverbs_dereg_mr {
  246. __u32 mr_handle;
  247. };
  248. struct ib_uverbs_create_cq {
  249. __u64 response;
  250. __u64 user_handle;
  251. __u32 cqe;
  252. __u32 event_handler;
  253. __u64 driver_data[0];
  254. };
  255. struct ib_uverbs_create_cq_resp {
  256. __u32 cq_handle;
  257. __u32 cqe;
  258. };
  259. struct ib_uverbs_destroy_cq {
  260. __u32 cq_handle;
  261. };
  262. struct ib_uverbs_create_qp {
  263. __u64 response;
  264. __u64 user_handle;
  265. __u32 pd_handle;
  266. __u32 send_cq_handle;
  267. __u32 recv_cq_handle;
  268. __u32 srq_handle;
  269. __u32 max_send_wr;
  270. __u32 max_recv_wr;
  271. __u32 max_send_sge;
  272. __u32 max_recv_sge;
  273. __u32 max_inline_data;
  274. __u8 sq_sig_all;
  275. __u8 qp_type;
  276. __u8 is_srq;
  277. __u8 reserved;
  278. __u64 driver_data[0];
  279. };
  280. struct ib_uverbs_create_qp_resp {
  281. __u32 qp_handle;
  282. __u32 qpn;
  283. };
  284. /*
  285. * This struct needs to remain a multiple of 8 bytes to keep the
  286. * alignment of the modify QP parameters.
  287. */
  288. struct ib_uverbs_qp_dest {
  289. __u8 dgid[16];
  290. __u32 flow_label;
  291. __u16 dlid;
  292. __u16 reserved;
  293. __u8 sgid_index;
  294. __u8 hop_limit;
  295. __u8 traffic_class;
  296. __u8 sl;
  297. __u8 src_path_bits;
  298. __u8 static_rate;
  299. __u8 is_global;
  300. __u8 port_num;
  301. };
  302. struct ib_uverbs_modify_qp {
  303. struct ib_uverbs_qp_dest dest;
  304. struct ib_uverbs_qp_dest alt_dest;
  305. __u32 qp_handle;
  306. __u32 attr_mask;
  307. __u32 qkey;
  308. __u32 rq_psn;
  309. __u32 sq_psn;
  310. __u32 dest_qp_num;
  311. __u32 qp_access_flags;
  312. __u16 pkey_index;
  313. __u16 alt_pkey_index;
  314. __u8 qp_state;
  315. __u8 cur_qp_state;
  316. __u8 path_mtu;
  317. __u8 path_mig_state;
  318. __u8 en_sqd_async_notify;
  319. __u8 max_rd_atomic;
  320. __u8 max_dest_rd_atomic;
  321. __u8 min_rnr_timer;
  322. __u8 port_num;
  323. __u8 timeout;
  324. __u8 retry_cnt;
  325. __u8 rnr_retry;
  326. __u8 alt_port_num;
  327. __u8 alt_timeout;
  328. __u8 reserved[2];
  329. __u64 driver_data[0];
  330. };
  331. struct ib_uverbs_modify_qp_resp {
  332. };
  333. struct ib_uverbs_destroy_qp {
  334. __u32 qp_handle;
  335. };
  336. struct ib_uverbs_attach_mcast {
  337. __u8 gid[16];
  338. __u32 qp_handle;
  339. __u16 mlid;
  340. __u16 reserved;
  341. __u64 driver_data[0];
  342. };
  343. struct ib_uverbs_detach_mcast {
  344. __u8 gid[16];
  345. __u32 qp_handle;
  346. __u16 mlid;
  347. __u16 reserved;
  348. __u64 driver_data[0];
  349. };
  350. #endif /* IB_USER_VERBS_H */