ib_user_verbs.h 21 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. /*
  2. * Copyright (c) 2005 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
  4. * Copyright (c) 2005 PathScale, Inc. All rights reserved.
  5. * Copyright (c) 2006 Mellanox Technologies. All rights reserved.
  6. *
  7. * This software is available to you under a choice of one of two
  8. * licenses. You may choose to be licensed under the terms of the GNU
  9. * General Public License (GPL) Version 2, available from the file
  10. * COPYING in the main directory of this source tree, or the
  11. * OpenIB.org BSD license below:
  12. *
  13. * Redistribution and use in source and binary forms, with or
  14. * without modification, are permitted provided that the following
  15. * conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above
  18. * copyright notice, this list of conditions and the following
  19. * disclaimer.
  20. *
  21. * - Redistributions in binary form must reproduce the above
  22. * copyright notice, this list of conditions and the following
  23. * disclaimer in the documentation and/or other materials
  24. * provided with the distribution.
  25. *
  26. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  27. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  29. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  30. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  31. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  32. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  33. * SOFTWARE.
  34. */
  35. #ifndef IB_USER_VERBS_H
  36. #define IB_USER_VERBS_H
  37. #include <linux/types.h>
  38. #include <rdma/ib_verbs.h>
  39. /*
  40. * Increment this value if any changes that break userspace ABI
  41. * compatibility are made.
  42. */
  43. #define IB_USER_VERBS_ABI_VERSION 6
  44. #define IB_USER_VERBS_CMD_THRESHOLD 50
  45. enum {
  46. IB_USER_VERBS_CMD_GET_CONTEXT,
  47. IB_USER_VERBS_CMD_QUERY_DEVICE,
  48. IB_USER_VERBS_CMD_QUERY_PORT,
  49. IB_USER_VERBS_CMD_ALLOC_PD,
  50. IB_USER_VERBS_CMD_DEALLOC_PD,
  51. IB_USER_VERBS_CMD_CREATE_AH,
  52. IB_USER_VERBS_CMD_MODIFY_AH,
  53. IB_USER_VERBS_CMD_QUERY_AH,
  54. IB_USER_VERBS_CMD_DESTROY_AH,
  55. IB_USER_VERBS_CMD_REG_MR,
  56. IB_USER_VERBS_CMD_REG_SMR,
  57. IB_USER_VERBS_CMD_REREG_MR,
  58. IB_USER_VERBS_CMD_QUERY_MR,
  59. IB_USER_VERBS_CMD_DEREG_MR,
  60. IB_USER_VERBS_CMD_ALLOC_MW,
  61. IB_USER_VERBS_CMD_BIND_MW,
  62. IB_USER_VERBS_CMD_DEALLOC_MW,
  63. IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
  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. IB_USER_VERBS_CMD_OPEN_XRCD,
  84. IB_USER_VERBS_CMD_CLOSE_XRCD,
  85. IB_USER_VERBS_CMD_CREATE_XSRQ,
  86. IB_USER_VERBS_CMD_OPEN_QP,
  87. };
  88. enum {
  89. IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
  90. IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
  91. IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP,
  92. IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
  93. IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
  94. IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
  95. IB_USER_VERBS_EX_CMD_CREATE_WQ,
  96. IB_USER_VERBS_EX_CMD_MODIFY_WQ,
  97. IB_USER_VERBS_EX_CMD_DESTROY_WQ,
  98. IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
  99. IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
  100. };
  101. /*
  102. * Make sure that all structs defined in this file remain laid out so
  103. * that they pack the same way on 32-bit and 64-bit architectures (to
  104. * avoid incompatibility between 32-bit userspace and 64-bit kernels).
  105. * Specifically:
  106. * - Do not use pointer types -- pass pointers in __u64 instead.
  107. * - Make sure that any structure larger than 4 bytes is padded to a
  108. * multiple of 8 bytes. Otherwise the structure size will be
  109. * different between 32-bit and 64-bit architectures.
  110. */
  111. struct ib_uverbs_async_event_desc {
  112. __u64 element;
  113. __u32 event_type; /* enum ib_event_type */
  114. __u32 reserved;
  115. };
  116. struct ib_uverbs_comp_event_desc {
  117. __u64 cq_handle;
  118. };
  119. /*
  120. * All commands from userspace should start with a __u32 command field
  121. * followed by __u16 in_words and out_words fields (which give the
  122. * length of the command block and response buffer if any in 32-bit
  123. * words). The kernel driver will read these fields first and read
  124. * the rest of the command struct based on these value.
  125. */
  126. #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
  127. #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
  128. #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
  129. #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
  130. struct ib_uverbs_cmd_hdr {
  131. __u32 command;
  132. __u16 in_words;
  133. __u16 out_words;
  134. };
  135. struct ib_uverbs_ex_cmd_hdr {
  136. __u64 response;
  137. __u16 provider_in_words;
  138. __u16 provider_out_words;
  139. __u32 cmd_hdr_reserved;
  140. };
  141. struct ib_uverbs_get_context {
  142. __u64 response;
  143. __u64 driver_data[0];
  144. };
  145. struct ib_uverbs_get_context_resp {
  146. __u32 async_fd;
  147. __u32 num_comp_vectors;
  148. };
  149. struct ib_uverbs_query_device {
  150. __u64 response;
  151. __u64 driver_data[0];
  152. };
  153. struct ib_uverbs_query_device_resp {
  154. __u64 fw_ver;
  155. __be64 node_guid;
  156. __be64 sys_image_guid;
  157. __u64 max_mr_size;
  158. __u64 page_size_cap;
  159. __u32 vendor_id;
  160. __u32 vendor_part_id;
  161. __u32 hw_ver;
  162. __u32 max_qp;
  163. __u32 max_qp_wr;
  164. __u32 device_cap_flags;
  165. __u32 max_sge;
  166. __u32 max_sge_rd;
  167. __u32 max_cq;
  168. __u32 max_cqe;
  169. __u32 max_mr;
  170. __u32 max_pd;
  171. __u32 max_qp_rd_atom;
  172. __u32 max_ee_rd_atom;
  173. __u32 max_res_rd_atom;
  174. __u32 max_qp_init_rd_atom;
  175. __u32 max_ee_init_rd_atom;
  176. __u32 atomic_cap;
  177. __u32 max_ee;
  178. __u32 max_rdd;
  179. __u32 max_mw;
  180. __u32 max_raw_ipv6_qp;
  181. __u32 max_raw_ethy_qp;
  182. __u32 max_mcast_grp;
  183. __u32 max_mcast_qp_attach;
  184. __u32 max_total_mcast_qp_attach;
  185. __u32 max_ah;
  186. __u32 max_fmr;
  187. __u32 max_map_per_fmr;
  188. __u32 max_srq;
  189. __u32 max_srq_wr;
  190. __u32 max_srq_sge;
  191. __u16 max_pkeys;
  192. __u8 local_ca_ack_delay;
  193. __u8 phys_port_cnt;
  194. __u8 reserved[4];
  195. };
  196. struct ib_uverbs_ex_query_device {
  197. __u32 comp_mask;
  198. __u32 reserved;
  199. };
  200. struct ib_uverbs_odp_caps {
  201. __u64 general_caps;
  202. struct {
  203. __u32 rc_odp_caps;
  204. __u32 uc_odp_caps;
  205. __u32 ud_odp_caps;
  206. } per_transport_caps;
  207. __u32 reserved;
  208. };
  209. struct ib_uverbs_rss_caps {
  210. /* Corresponding bit will be set if qp type from
  211. * 'enum ib_qp_type' is supported, e.g.
  212. * supported_qpts |= 1 << IB_QPT_UD
  213. */
  214. __u32 supported_qpts;
  215. __u32 max_rwq_indirection_tables;
  216. __u32 max_rwq_indirection_table_size;
  217. __u32 reserved;
  218. };
  219. struct ib_uverbs_ex_query_device_resp {
  220. struct ib_uverbs_query_device_resp base;
  221. __u32 comp_mask;
  222. __u32 response_length;
  223. struct ib_uverbs_odp_caps odp_caps;
  224. __u64 timestamp_mask;
  225. __u64 hca_core_clock; /* in KHZ */
  226. __u64 device_cap_flags_ex;
  227. struct ib_uverbs_rss_caps rss_caps;
  228. __u32 max_wq_type_rq;
  229. __u32 reserved;
  230. };
  231. struct ib_uverbs_query_port {
  232. __u64 response;
  233. __u8 port_num;
  234. __u8 reserved[7];
  235. __u64 driver_data[0];
  236. };
  237. struct ib_uverbs_query_port_resp {
  238. __u32 port_cap_flags;
  239. __u32 max_msg_sz;
  240. __u32 bad_pkey_cntr;
  241. __u32 qkey_viol_cntr;
  242. __u32 gid_tbl_len;
  243. __u16 pkey_tbl_len;
  244. __u16 lid;
  245. __u16 sm_lid;
  246. __u8 state;
  247. __u8 max_mtu;
  248. __u8 active_mtu;
  249. __u8 lmc;
  250. __u8 max_vl_num;
  251. __u8 sm_sl;
  252. __u8 subnet_timeout;
  253. __u8 init_type_reply;
  254. __u8 active_width;
  255. __u8 active_speed;
  256. __u8 phys_state;
  257. __u8 link_layer;
  258. __u8 reserved[2];
  259. };
  260. struct ib_uverbs_alloc_pd {
  261. __u64 response;
  262. __u64 driver_data[0];
  263. };
  264. struct ib_uverbs_alloc_pd_resp {
  265. __u32 pd_handle;
  266. };
  267. struct ib_uverbs_dealloc_pd {
  268. __u32 pd_handle;
  269. };
  270. struct ib_uverbs_open_xrcd {
  271. __u64 response;
  272. __u32 fd;
  273. __u32 oflags;
  274. __u64 driver_data[0];
  275. };
  276. struct ib_uverbs_open_xrcd_resp {
  277. __u32 xrcd_handle;
  278. };
  279. struct ib_uverbs_close_xrcd {
  280. __u32 xrcd_handle;
  281. };
  282. struct ib_uverbs_reg_mr {
  283. __u64 response;
  284. __u64 start;
  285. __u64 length;
  286. __u64 hca_va;
  287. __u32 pd_handle;
  288. __u32 access_flags;
  289. __u64 driver_data[0];
  290. };
  291. struct ib_uverbs_reg_mr_resp {
  292. __u32 mr_handle;
  293. __u32 lkey;
  294. __u32 rkey;
  295. };
  296. struct ib_uverbs_rereg_mr {
  297. __u64 response;
  298. __u32 mr_handle;
  299. __u32 flags;
  300. __u64 start;
  301. __u64 length;
  302. __u64 hca_va;
  303. __u32 pd_handle;
  304. __u32 access_flags;
  305. };
  306. struct ib_uverbs_rereg_mr_resp {
  307. __u32 lkey;
  308. __u32 rkey;
  309. };
  310. struct ib_uverbs_dereg_mr {
  311. __u32 mr_handle;
  312. };
  313. struct ib_uverbs_alloc_mw {
  314. __u64 response;
  315. __u32 pd_handle;
  316. __u8 mw_type;
  317. __u8 reserved[3];
  318. };
  319. struct ib_uverbs_alloc_mw_resp {
  320. __u32 mw_handle;
  321. __u32 rkey;
  322. };
  323. struct ib_uverbs_dealloc_mw {
  324. __u32 mw_handle;
  325. };
  326. struct ib_uverbs_create_comp_channel {
  327. __u64 response;
  328. };
  329. struct ib_uverbs_create_comp_channel_resp {
  330. __u32 fd;
  331. };
  332. struct ib_uverbs_create_cq {
  333. __u64 response;
  334. __u64 user_handle;
  335. __u32 cqe;
  336. __u32 comp_vector;
  337. __s32 comp_channel;
  338. __u32 reserved;
  339. __u64 driver_data[0];
  340. };
  341. struct ib_uverbs_ex_create_cq {
  342. __u64 user_handle;
  343. __u32 cqe;
  344. __u32 comp_vector;
  345. __s32 comp_channel;
  346. __u32 comp_mask;
  347. __u32 flags;
  348. __u32 reserved;
  349. };
  350. struct ib_uverbs_create_cq_resp {
  351. __u32 cq_handle;
  352. __u32 cqe;
  353. };
  354. struct ib_uverbs_ex_create_cq_resp {
  355. struct ib_uverbs_create_cq_resp base;
  356. __u32 comp_mask;
  357. __u32 response_length;
  358. };
  359. struct ib_uverbs_resize_cq {
  360. __u64 response;
  361. __u32 cq_handle;
  362. __u32 cqe;
  363. __u64 driver_data[0];
  364. };
  365. struct ib_uverbs_resize_cq_resp {
  366. __u32 cqe;
  367. __u32 reserved;
  368. __u64 driver_data[0];
  369. };
  370. struct ib_uverbs_poll_cq {
  371. __u64 response;
  372. __u32 cq_handle;
  373. __u32 ne;
  374. };
  375. struct ib_uverbs_wc {
  376. __u64 wr_id;
  377. __u32 status;
  378. __u32 opcode;
  379. __u32 vendor_err;
  380. __u32 byte_len;
  381. union {
  382. __u32 imm_data;
  383. __u32 invalidate_rkey;
  384. } ex;
  385. __u32 qp_num;
  386. __u32 src_qp;
  387. __u32 wc_flags;
  388. __u16 pkey_index;
  389. __u16 slid;
  390. __u8 sl;
  391. __u8 dlid_path_bits;
  392. __u8 port_num;
  393. __u8 reserved;
  394. };
  395. struct ib_uverbs_poll_cq_resp {
  396. __u32 count;
  397. __u32 reserved;
  398. struct ib_uverbs_wc wc[0];
  399. };
  400. struct ib_uverbs_req_notify_cq {
  401. __u32 cq_handle;
  402. __u32 solicited_only;
  403. };
  404. struct ib_uverbs_destroy_cq {
  405. __u64 response;
  406. __u32 cq_handle;
  407. __u32 reserved;
  408. };
  409. struct ib_uverbs_destroy_cq_resp {
  410. __u32 comp_events_reported;
  411. __u32 async_events_reported;
  412. };
  413. struct ib_uverbs_global_route {
  414. __u8 dgid[16];
  415. __u32 flow_label;
  416. __u8 sgid_index;
  417. __u8 hop_limit;
  418. __u8 traffic_class;
  419. __u8 reserved;
  420. };
  421. struct ib_uverbs_ah_attr {
  422. struct ib_uverbs_global_route grh;
  423. __u16 dlid;
  424. __u8 sl;
  425. __u8 src_path_bits;
  426. __u8 static_rate;
  427. __u8 is_global;
  428. __u8 port_num;
  429. __u8 reserved;
  430. };
  431. struct ib_uverbs_qp_attr {
  432. __u32 qp_attr_mask;
  433. __u32 qp_state;
  434. __u32 cur_qp_state;
  435. __u32 path_mtu;
  436. __u32 path_mig_state;
  437. __u32 qkey;
  438. __u32 rq_psn;
  439. __u32 sq_psn;
  440. __u32 dest_qp_num;
  441. __u32 qp_access_flags;
  442. struct ib_uverbs_ah_attr ah_attr;
  443. struct ib_uverbs_ah_attr alt_ah_attr;
  444. /* ib_qp_cap */
  445. __u32 max_send_wr;
  446. __u32 max_recv_wr;
  447. __u32 max_send_sge;
  448. __u32 max_recv_sge;
  449. __u32 max_inline_data;
  450. __u16 pkey_index;
  451. __u16 alt_pkey_index;
  452. __u8 en_sqd_async_notify;
  453. __u8 sq_draining;
  454. __u8 max_rd_atomic;
  455. __u8 max_dest_rd_atomic;
  456. __u8 min_rnr_timer;
  457. __u8 port_num;
  458. __u8 timeout;
  459. __u8 retry_cnt;
  460. __u8 rnr_retry;
  461. __u8 alt_port_num;
  462. __u8 alt_timeout;
  463. __u8 reserved[5];
  464. };
  465. struct ib_uverbs_create_qp {
  466. __u64 response;
  467. __u64 user_handle;
  468. __u32 pd_handle;
  469. __u32 send_cq_handle;
  470. __u32 recv_cq_handle;
  471. __u32 srq_handle;
  472. __u32 max_send_wr;
  473. __u32 max_recv_wr;
  474. __u32 max_send_sge;
  475. __u32 max_recv_sge;
  476. __u32 max_inline_data;
  477. __u8 sq_sig_all;
  478. __u8 qp_type;
  479. __u8 is_srq;
  480. __u8 reserved;
  481. __u64 driver_data[0];
  482. };
  483. enum ib_uverbs_create_qp_mask {
  484. IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
  485. };
  486. enum {
  487. IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
  488. };
  489. enum {
  490. IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
  491. };
  492. enum {
  493. IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
  494. };
  495. struct ib_uverbs_ex_create_qp {
  496. __u64 user_handle;
  497. __u32 pd_handle;
  498. __u32 send_cq_handle;
  499. __u32 recv_cq_handle;
  500. __u32 srq_handle;
  501. __u32 max_send_wr;
  502. __u32 max_recv_wr;
  503. __u32 max_send_sge;
  504. __u32 max_recv_sge;
  505. __u32 max_inline_data;
  506. __u8 sq_sig_all;
  507. __u8 qp_type;
  508. __u8 is_srq;
  509. __u8 reserved;
  510. __u32 comp_mask;
  511. __u32 create_flags;
  512. __u32 rwq_ind_tbl_handle;
  513. __u32 reserved1;
  514. };
  515. struct ib_uverbs_open_qp {
  516. __u64 response;
  517. __u64 user_handle;
  518. __u32 pd_handle;
  519. __u32 qpn;
  520. __u8 qp_type;
  521. __u8 reserved[7];
  522. __u64 driver_data[0];
  523. };
  524. /* also used for open response */
  525. struct ib_uverbs_create_qp_resp {
  526. __u32 qp_handle;
  527. __u32 qpn;
  528. __u32 max_send_wr;
  529. __u32 max_recv_wr;
  530. __u32 max_send_sge;
  531. __u32 max_recv_sge;
  532. __u32 max_inline_data;
  533. __u32 reserved;
  534. };
  535. struct ib_uverbs_ex_create_qp_resp {
  536. struct ib_uverbs_create_qp_resp base;
  537. __u32 comp_mask;
  538. __u32 response_length;
  539. };
  540. /*
  541. * This struct needs to remain a multiple of 8 bytes to keep the
  542. * alignment of the modify QP parameters.
  543. */
  544. struct ib_uverbs_qp_dest {
  545. __u8 dgid[16];
  546. __u32 flow_label;
  547. __u16 dlid;
  548. __u16 reserved;
  549. __u8 sgid_index;
  550. __u8 hop_limit;
  551. __u8 traffic_class;
  552. __u8 sl;
  553. __u8 src_path_bits;
  554. __u8 static_rate;
  555. __u8 is_global;
  556. __u8 port_num;
  557. };
  558. struct ib_uverbs_query_qp {
  559. __u64 response;
  560. __u32 qp_handle;
  561. __u32 attr_mask;
  562. __u64 driver_data[0];
  563. };
  564. struct ib_uverbs_query_qp_resp {
  565. struct ib_uverbs_qp_dest dest;
  566. struct ib_uverbs_qp_dest alt_dest;
  567. __u32 max_send_wr;
  568. __u32 max_recv_wr;
  569. __u32 max_send_sge;
  570. __u32 max_recv_sge;
  571. __u32 max_inline_data;
  572. __u32 qkey;
  573. __u32 rq_psn;
  574. __u32 sq_psn;
  575. __u32 dest_qp_num;
  576. __u32 qp_access_flags;
  577. __u16 pkey_index;
  578. __u16 alt_pkey_index;
  579. __u8 qp_state;
  580. __u8 cur_qp_state;
  581. __u8 path_mtu;
  582. __u8 path_mig_state;
  583. __u8 sq_draining;
  584. __u8 max_rd_atomic;
  585. __u8 max_dest_rd_atomic;
  586. __u8 min_rnr_timer;
  587. __u8 port_num;
  588. __u8 timeout;
  589. __u8 retry_cnt;
  590. __u8 rnr_retry;
  591. __u8 alt_port_num;
  592. __u8 alt_timeout;
  593. __u8 sq_sig_all;
  594. __u8 reserved[5];
  595. __u64 driver_data[0];
  596. };
  597. struct ib_uverbs_modify_qp {
  598. struct ib_uverbs_qp_dest dest;
  599. struct ib_uverbs_qp_dest alt_dest;
  600. __u32 qp_handle;
  601. __u32 attr_mask;
  602. __u32 qkey;
  603. __u32 rq_psn;
  604. __u32 sq_psn;
  605. __u32 dest_qp_num;
  606. __u32 qp_access_flags;
  607. __u16 pkey_index;
  608. __u16 alt_pkey_index;
  609. __u8 qp_state;
  610. __u8 cur_qp_state;
  611. __u8 path_mtu;
  612. __u8 path_mig_state;
  613. __u8 en_sqd_async_notify;
  614. __u8 max_rd_atomic;
  615. __u8 max_dest_rd_atomic;
  616. __u8 min_rnr_timer;
  617. __u8 port_num;
  618. __u8 timeout;
  619. __u8 retry_cnt;
  620. __u8 rnr_retry;
  621. __u8 alt_port_num;
  622. __u8 alt_timeout;
  623. __u8 reserved[2];
  624. __u64 driver_data[0];
  625. };
  626. struct ib_uverbs_ex_modify_qp {
  627. struct ib_uverbs_modify_qp base;
  628. __u32 rate_limit;
  629. __u32 reserved;
  630. };
  631. struct ib_uverbs_modify_qp_resp {
  632. };
  633. struct ib_uverbs_ex_modify_qp_resp {
  634. __u32 comp_mask;
  635. __u32 response_length;
  636. };
  637. struct ib_uverbs_destroy_qp {
  638. __u64 response;
  639. __u32 qp_handle;
  640. __u32 reserved;
  641. };
  642. struct ib_uverbs_destroy_qp_resp {
  643. __u32 events_reported;
  644. };
  645. /*
  646. * The ib_uverbs_sge structure isn't used anywhere, since we assume
  647. * the ib_sge structure is packed the same way on 32-bit and 64-bit
  648. * architectures in both kernel and user space. It's just here to
  649. * document the ABI.
  650. */
  651. struct ib_uverbs_sge {
  652. __u64 addr;
  653. __u32 length;
  654. __u32 lkey;
  655. };
  656. struct ib_uverbs_send_wr {
  657. __u64 wr_id;
  658. __u32 num_sge;
  659. __u32 opcode;
  660. __u32 send_flags;
  661. union {
  662. __u32 imm_data;
  663. __u32 invalidate_rkey;
  664. } ex;
  665. union {
  666. struct {
  667. __u64 remote_addr;
  668. __u32 rkey;
  669. __u32 reserved;
  670. } rdma;
  671. struct {
  672. __u64 remote_addr;
  673. __u64 compare_add;
  674. __u64 swap;
  675. __u32 rkey;
  676. __u32 reserved;
  677. } atomic;
  678. struct {
  679. __u32 ah;
  680. __u32 remote_qpn;
  681. __u32 remote_qkey;
  682. __u32 reserved;
  683. } ud;
  684. } wr;
  685. };
  686. struct ib_uverbs_post_send {
  687. __u64 response;
  688. __u32 qp_handle;
  689. __u32 wr_count;
  690. __u32 sge_count;
  691. __u32 wqe_size;
  692. struct ib_uverbs_send_wr send_wr[0];
  693. };
  694. struct ib_uverbs_post_send_resp {
  695. __u32 bad_wr;
  696. };
  697. struct ib_uverbs_recv_wr {
  698. __u64 wr_id;
  699. __u32 num_sge;
  700. __u32 reserved;
  701. };
  702. struct ib_uverbs_post_recv {
  703. __u64 response;
  704. __u32 qp_handle;
  705. __u32 wr_count;
  706. __u32 sge_count;
  707. __u32 wqe_size;
  708. struct ib_uverbs_recv_wr recv_wr[0];
  709. };
  710. struct ib_uverbs_post_recv_resp {
  711. __u32 bad_wr;
  712. };
  713. struct ib_uverbs_post_srq_recv {
  714. __u64 response;
  715. __u32 srq_handle;
  716. __u32 wr_count;
  717. __u32 sge_count;
  718. __u32 wqe_size;
  719. struct ib_uverbs_recv_wr recv[0];
  720. };
  721. struct ib_uverbs_post_srq_recv_resp {
  722. __u32 bad_wr;
  723. };
  724. struct ib_uverbs_create_ah {
  725. __u64 response;
  726. __u64 user_handle;
  727. __u32 pd_handle;
  728. __u32 reserved;
  729. struct ib_uverbs_ah_attr attr;
  730. };
  731. struct ib_uverbs_create_ah_resp {
  732. __u32 ah_handle;
  733. };
  734. struct ib_uverbs_destroy_ah {
  735. __u32 ah_handle;
  736. };
  737. struct ib_uverbs_attach_mcast {
  738. __u8 gid[16];
  739. __u32 qp_handle;
  740. __u16 mlid;
  741. __u16 reserved;
  742. __u64 driver_data[0];
  743. };
  744. struct ib_uverbs_detach_mcast {
  745. __u8 gid[16];
  746. __u32 qp_handle;
  747. __u16 mlid;
  748. __u16 reserved;
  749. __u64 driver_data[0];
  750. };
  751. struct ib_uverbs_flow_spec_hdr {
  752. __u32 type;
  753. __u16 size;
  754. __u16 reserved;
  755. /* followed by flow_spec */
  756. __u64 flow_spec_data[0];
  757. };
  758. struct ib_uverbs_flow_eth_filter {
  759. __u8 dst_mac[6];
  760. __u8 src_mac[6];
  761. __be16 ether_type;
  762. __be16 vlan_tag;
  763. };
  764. struct ib_uverbs_flow_spec_eth {
  765. union {
  766. struct ib_uverbs_flow_spec_hdr hdr;
  767. struct {
  768. __u32 type;
  769. __u16 size;
  770. __u16 reserved;
  771. };
  772. };
  773. struct ib_uverbs_flow_eth_filter val;
  774. struct ib_uverbs_flow_eth_filter mask;
  775. };
  776. struct ib_uverbs_flow_ipv4_filter {
  777. __be32 src_ip;
  778. __be32 dst_ip;
  779. __u8 proto;
  780. __u8 tos;
  781. __u8 ttl;
  782. __u8 flags;
  783. };
  784. struct ib_uverbs_flow_spec_ipv4 {
  785. union {
  786. struct ib_uverbs_flow_spec_hdr hdr;
  787. struct {
  788. __u32 type;
  789. __u16 size;
  790. __u16 reserved;
  791. };
  792. };
  793. struct ib_uverbs_flow_ipv4_filter val;
  794. struct ib_uverbs_flow_ipv4_filter mask;
  795. };
  796. struct ib_uverbs_flow_tcp_udp_filter {
  797. __be16 dst_port;
  798. __be16 src_port;
  799. };
  800. struct ib_uverbs_flow_spec_tcp_udp {
  801. union {
  802. struct ib_uverbs_flow_spec_hdr hdr;
  803. struct {
  804. __u32 type;
  805. __u16 size;
  806. __u16 reserved;
  807. };
  808. };
  809. struct ib_uverbs_flow_tcp_udp_filter val;
  810. struct ib_uverbs_flow_tcp_udp_filter mask;
  811. };
  812. struct ib_uverbs_flow_ipv6_filter {
  813. __u8 src_ip[16];
  814. __u8 dst_ip[16];
  815. __be32 flow_label;
  816. __u8 next_hdr;
  817. __u8 traffic_class;
  818. __u8 hop_limit;
  819. __u8 reserved;
  820. };
  821. struct ib_uverbs_flow_spec_ipv6 {
  822. union {
  823. struct ib_uverbs_flow_spec_hdr hdr;
  824. struct {
  825. __u32 type;
  826. __u16 size;
  827. __u16 reserved;
  828. };
  829. };
  830. struct ib_uverbs_flow_ipv6_filter val;
  831. struct ib_uverbs_flow_ipv6_filter mask;
  832. };
  833. struct ib_uverbs_flow_tunnel_filter {
  834. __be32 tunnel_id;
  835. };
  836. struct ib_uverbs_flow_spec_tunnel {
  837. union {
  838. struct ib_uverbs_flow_spec_hdr hdr;
  839. struct {
  840. __u32 type;
  841. __u16 size;
  842. __u16 reserved;
  843. };
  844. };
  845. struct ib_uverbs_flow_tunnel_filter val;
  846. struct ib_uverbs_flow_tunnel_filter mask;
  847. };
  848. struct ib_uverbs_flow_attr {
  849. __u32 type;
  850. __u16 size;
  851. __u16 priority;
  852. __u8 num_of_specs;
  853. __u8 reserved[2];
  854. __u8 port;
  855. __u32 flags;
  856. /* Following are the optional layers according to user request
  857. * struct ib_flow_spec_xxx
  858. * struct ib_flow_spec_yyy
  859. */
  860. struct ib_uverbs_flow_spec_hdr flow_specs[0];
  861. };
  862. struct ib_uverbs_create_flow {
  863. __u32 comp_mask;
  864. __u32 qp_handle;
  865. struct ib_uverbs_flow_attr flow_attr;
  866. };
  867. struct ib_uverbs_create_flow_resp {
  868. __u32 comp_mask;
  869. __u32 flow_handle;
  870. };
  871. struct ib_uverbs_destroy_flow {
  872. __u32 comp_mask;
  873. __u32 flow_handle;
  874. };
  875. struct ib_uverbs_create_srq {
  876. __u64 response;
  877. __u64 user_handle;
  878. __u32 pd_handle;
  879. __u32 max_wr;
  880. __u32 max_sge;
  881. __u32 srq_limit;
  882. __u64 driver_data[0];
  883. };
  884. struct ib_uverbs_create_xsrq {
  885. __u64 response;
  886. __u64 user_handle;
  887. __u32 srq_type;
  888. __u32 pd_handle;
  889. __u32 max_wr;
  890. __u32 max_sge;
  891. __u32 srq_limit;
  892. __u32 reserved;
  893. __u32 xrcd_handle;
  894. __u32 cq_handle;
  895. __u64 driver_data[0];
  896. };
  897. struct ib_uverbs_create_srq_resp {
  898. __u32 srq_handle;
  899. __u32 max_wr;
  900. __u32 max_sge;
  901. __u32 srqn;
  902. };
  903. struct ib_uverbs_modify_srq {
  904. __u32 srq_handle;
  905. __u32 attr_mask;
  906. __u32 max_wr;
  907. __u32 srq_limit;
  908. __u64 driver_data[0];
  909. };
  910. struct ib_uverbs_query_srq {
  911. __u64 response;
  912. __u32 srq_handle;
  913. __u32 reserved;
  914. __u64 driver_data[0];
  915. };
  916. struct ib_uverbs_query_srq_resp {
  917. __u32 max_wr;
  918. __u32 max_sge;
  919. __u32 srq_limit;
  920. __u32 reserved;
  921. };
  922. struct ib_uverbs_destroy_srq {
  923. __u64 response;
  924. __u32 srq_handle;
  925. __u32 reserved;
  926. };
  927. struct ib_uverbs_destroy_srq_resp {
  928. __u32 events_reported;
  929. };
  930. struct ib_uverbs_ex_create_wq {
  931. __u32 comp_mask;
  932. __u32 wq_type;
  933. __u64 user_handle;
  934. __u32 pd_handle;
  935. __u32 cq_handle;
  936. __u32 max_wr;
  937. __u32 max_sge;
  938. };
  939. struct ib_uverbs_ex_create_wq_resp {
  940. __u32 comp_mask;
  941. __u32 response_length;
  942. __u32 wq_handle;
  943. __u32 max_wr;
  944. __u32 max_sge;
  945. __u32 wqn;
  946. };
  947. struct ib_uverbs_ex_destroy_wq {
  948. __u32 comp_mask;
  949. __u32 wq_handle;
  950. };
  951. struct ib_uverbs_ex_destroy_wq_resp {
  952. __u32 comp_mask;
  953. __u32 response_length;
  954. __u32 events_reported;
  955. __u32 reserved;
  956. };
  957. struct ib_uverbs_ex_modify_wq {
  958. __u32 attr_mask;
  959. __u32 wq_handle;
  960. __u32 wq_state;
  961. __u32 curr_wq_state;
  962. };
  963. /* Prevent memory allocation rather than max expected size */
  964. #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
  965. struct ib_uverbs_ex_create_rwq_ind_table {
  966. __u32 comp_mask;
  967. __u32 log_ind_tbl_size;
  968. /* Following are the wq handles according to log_ind_tbl_size
  969. * wq_handle1
  970. * wq_handle2
  971. */
  972. __u32 wq_handles[0];
  973. };
  974. struct ib_uverbs_ex_create_rwq_ind_table_resp {
  975. __u32 comp_mask;
  976. __u32 response_length;
  977. __u32 ind_tbl_handle;
  978. __u32 ind_tbl_num;
  979. };
  980. struct ib_uverbs_ex_destroy_rwq_ind_table {
  981. __u32 comp_mask;
  982. __u32 ind_tbl_handle;
  983. };
  984. #endif /* IB_USER_VERBS_H */