ib_user_verbs.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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 2
  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. IB_USER_VERBS_CMD_CREATE_SRQ,
  79. IB_USER_VERBS_CMD_MODIFY_SRQ,
  80. IB_USER_VERBS_CMD_QUERY_SRQ,
  81. IB_USER_VERBS_CMD_DESTROY_SRQ,
  82. IB_USER_VERBS_CMD_POST_SRQ_RECV
  83. };
  84. /*
  85. * Make sure that all structs defined in this file remain laid out so
  86. * that they pack the same way on 32-bit and 64-bit architectures (to
  87. * avoid incompatibility between 32-bit userspace and 64-bit kernels).
  88. * In particular do not use pointer types -- pass pointers in __u64
  89. * instead.
  90. */
  91. struct ib_uverbs_async_event_desc {
  92. __u64 element;
  93. __u32 event_type; /* enum ib_event_type */
  94. __u32 reserved;
  95. };
  96. struct ib_uverbs_comp_event_desc {
  97. __u64 cq_handle;
  98. };
  99. /*
  100. * All commands from userspace should start with a __u32 command field
  101. * followed by __u16 in_words and out_words fields (which give the
  102. * length of the command block and response buffer if any in 32-bit
  103. * words). The kernel driver will read these fields first and read
  104. * the rest of the command struct based on these value.
  105. */
  106. struct ib_uverbs_cmd_hdr {
  107. __u32 command;
  108. __u16 in_words;
  109. __u16 out_words;
  110. };
  111. /*
  112. * No driver_data for "query params" command, since this is intended
  113. * to be a core function with no possible device dependence.
  114. */
  115. struct ib_uverbs_query_params {
  116. __u64 response;
  117. };
  118. struct ib_uverbs_query_params_resp {
  119. __u32 num_cq_events;
  120. };
  121. struct ib_uverbs_get_context {
  122. __u64 response;
  123. __u64 cq_fd_tab;
  124. __u64 driver_data[0];
  125. };
  126. struct ib_uverbs_get_context_resp {
  127. __u32 async_fd;
  128. __u32 reserved;
  129. };
  130. struct ib_uverbs_query_device {
  131. __u64 response;
  132. __u64 driver_data[0];
  133. };
  134. struct ib_uverbs_query_device_resp {
  135. __u64 fw_ver;
  136. __be64 node_guid;
  137. __be64 sys_image_guid;
  138. __u64 max_mr_size;
  139. __u64 page_size_cap;
  140. __u32 vendor_id;
  141. __u32 vendor_part_id;
  142. __u32 hw_ver;
  143. __u32 max_qp;
  144. __u32 max_qp_wr;
  145. __u32 device_cap_flags;
  146. __u32 max_sge;
  147. __u32 max_sge_rd;
  148. __u32 max_cq;
  149. __u32 max_cqe;
  150. __u32 max_mr;
  151. __u32 max_pd;
  152. __u32 max_qp_rd_atom;
  153. __u32 max_ee_rd_atom;
  154. __u32 max_res_rd_atom;
  155. __u32 max_qp_init_rd_atom;
  156. __u32 max_ee_init_rd_atom;
  157. __u32 atomic_cap;
  158. __u32 max_ee;
  159. __u32 max_rdd;
  160. __u32 max_mw;
  161. __u32 max_raw_ipv6_qp;
  162. __u32 max_raw_ethy_qp;
  163. __u32 max_mcast_grp;
  164. __u32 max_mcast_qp_attach;
  165. __u32 max_total_mcast_qp_attach;
  166. __u32 max_ah;
  167. __u32 max_fmr;
  168. __u32 max_map_per_fmr;
  169. __u32 max_srq;
  170. __u32 max_srq_wr;
  171. __u32 max_srq_sge;
  172. __u16 max_pkeys;
  173. __u8 local_ca_ack_delay;
  174. __u8 phys_port_cnt;
  175. __u8 reserved[4];
  176. };
  177. struct ib_uverbs_query_port {
  178. __u64 response;
  179. __u8 port_num;
  180. __u8 reserved[7];
  181. __u64 driver_data[0];
  182. };
  183. struct ib_uverbs_query_port_resp {
  184. __u32 port_cap_flags;
  185. __u32 max_msg_sz;
  186. __u32 bad_pkey_cntr;
  187. __u32 qkey_viol_cntr;
  188. __u32 gid_tbl_len;
  189. __u16 pkey_tbl_len;
  190. __u16 lid;
  191. __u16 sm_lid;
  192. __u8 state;
  193. __u8 max_mtu;
  194. __u8 active_mtu;
  195. __u8 lmc;
  196. __u8 max_vl_num;
  197. __u8 sm_sl;
  198. __u8 subnet_timeout;
  199. __u8 init_type_reply;
  200. __u8 active_width;
  201. __u8 active_speed;
  202. __u8 phys_state;
  203. __u8 reserved[3];
  204. };
  205. struct ib_uverbs_query_gid {
  206. __u64 response;
  207. __u8 port_num;
  208. __u8 index;
  209. __u8 reserved[6];
  210. __u64 driver_data[0];
  211. };
  212. struct ib_uverbs_query_gid_resp {
  213. __u8 gid[16];
  214. };
  215. struct ib_uverbs_query_pkey {
  216. __u64 response;
  217. __u8 port_num;
  218. __u8 index;
  219. __u8 reserved[6];
  220. __u64 driver_data[0];
  221. };
  222. struct ib_uverbs_query_pkey_resp {
  223. __u16 pkey;
  224. __u16 reserved;
  225. };
  226. struct ib_uverbs_alloc_pd {
  227. __u64 response;
  228. __u64 driver_data[0];
  229. };
  230. struct ib_uverbs_alloc_pd_resp {
  231. __u32 pd_handle;
  232. };
  233. struct ib_uverbs_dealloc_pd {
  234. __u32 pd_handle;
  235. };
  236. struct ib_uverbs_reg_mr {
  237. __u64 response;
  238. __u64 start;
  239. __u64 length;
  240. __u64 hca_va;
  241. __u32 pd_handle;
  242. __u32 access_flags;
  243. __u64 driver_data[0];
  244. };
  245. struct ib_uverbs_reg_mr_resp {
  246. __u32 mr_handle;
  247. __u32 lkey;
  248. __u32 rkey;
  249. };
  250. struct ib_uverbs_dereg_mr {
  251. __u32 mr_handle;
  252. };
  253. struct ib_uverbs_create_cq {
  254. __u64 response;
  255. __u64 user_handle;
  256. __u32 cqe;
  257. __u32 event_handler;
  258. __u64 driver_data[0];
  259. };
  260. struct ib_uverbs_create_cq_resp {
  261. __u32 cq_handle;
  262. __u32 cqe;
  263. };
  264. struct ib_uverbs_destroy_cq {
  265. __u64 response;
  266. __u32 cq_handle;
  267. __u32 reserved;
  268. };
  269. struct ib_uverbs_destroy_cq_resp {
  270. __u32 comp_events_reported;
  271. __u32 async_events_reported;
  272. };
  273. struct ib_uverbs_create_qp {
  274. __u64 response;
  275. __u64 user_handle;
  276. __u32 pd_handle;
  277. __u32 send_cq_handle;
  278. __u32 recv_cq_handle;
  279. __u32 srq_handle;
  280. __u32 max_send_wr;
  281. __u32 max_recv_wr;
  282. __u32 max_send_sge;
  283. __u32 max_recv_sge;
  284. __u32 max_inline_data;
  285. __u8 sq_sig_all;
  286. __u8 qp_type;
  287. __u8 is_srq;
  288. __u8 reserved;
  289. __u64 driver_data[0];
  290. };
  291. struct ib_uverbs_create_qp_resp {
  292. __u32 qp_handle;
  293. __u32 qpn;
  294. };
  295. /*
  296. * This struct needs to remain a multiple of 8 bytes to keep the
  297. * alignment of the modify QP parameters.
  298. */
  299. struct ib_uverbs_qp_dest {
  300. __u8 dgid[16];
  301. __u32 flow_label;
  302. __u16 dlid;
  303. __u16 reserved;
  304. __u8 sgid_index;
  305. __u8 hop_limit;
  306. __u8 traffic_class;
  307. __u8 sl;
  308. __u8 src_path_bits;
  309. __u8 static_rate;
  310. __u8 is_global;
  311. __u8 port_num;
  312. };
  313. struct ib_uverbs_modify_qp {
  314. struct ib_uverbs_qp_dest dest;
  315. struct ib_uverbs_qp_dest alt_dest;
  316. __u32 qp_handle;
  317. __u32 attr_mask;
  318. __u32 qkey;
  319. __u32 rq_psn;
  320. __u32 sq_psn;
  321. __u32 dest_qp_num;
  322. __u32 qp_access_flags;
  323. __u16 pkey_index;
  324. __u16 alt_pkey_index;
  325. __u8 qp_state;
  326. __u8 cur_qp_state;
  327. __u8 path_mtu;
  328. __u8 path_mig_state;
  329. __u8 en_sqd_async_notify;
  330. __u8 max_rd_atomic;
  331. __u8 max_dest_rd_atomic;
  332. __u8 min_rnr_timer;
  333. __u8 port_num;
  334. __u8 timeout;
  335. __u8 retry_cnt;
  336. __u8 rnr_retry;
  337. __u8 alt_port_num;
  338. __u8 alt_timeout;
  339. __u8 reserved[2];
  340. __u64 driver_data[0];
  341. };
  342. struct ib_uverbs_modify_qp_resp {
  343. };
  344. struct ib_uverbs_destroy_qp {
  345. __u64 response;
  346. __u32 qp_handle;
  347. __u32 reserved;
  348. };
  349. struct ib_uverbs_destroy_qp_resp {
  350. __u32 events_reported;
  351. };
  352. struct ib_uverbs_attach_mcast {
  353. __u8 gid[16];
  354. __u32 qp_handle;
  355. __u16 mlid;
  356. __u16 reserved;
  357. __u64 driver_data[0];
  358. };
  359. struct ib_uverbs_detach_mcast {
  360. __u8 gid[16];
  361. __u32 qp_handle;
  362. __u16 mlid;
  363. __u16 reserved;
  364. __u64 driver_data[0];
  365. };
  366. struct ib_uverbs_create_srq {
  367. __u64 response;
  368. __u64 user_handle;
  369. __u32 pd_handle;
  370. __u32 max_wr;
  371. __u32 max_sge;
  372. __u32 srq_limit;
  373. __u64 driver_data[0];
  374. };
  375. struct ib_uverbs_create_srq_resp {
  376. __u32 srq_handle;
  377. };
  378. struct ib_uverbs_modify_srq {
  379. __u32 srq_handle;
  380. __u32 attr_mask;
  381. __u32 max_wr;
  382. __u32 max_sge;
  383. __u32 srq_limit;
  384. __u32 reserved;
  385. __u64 driver_data[0];
  386. };
  387. struct ib_uverbs_destroy_srq {
  388. __u64 response;
  389. __u32 srq_handle;
  390. __u32 reserved;
  391. };
  392. struct ib_uverbs_destroy_srq_resp {
  393. __u32 events_reported;
  394. };
  395. #endif /* IB_USER_VERBS_H */