ib_user_verbs.h 24 KB

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