ib_user_verbs.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380
  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 ib_uverbs_write_cmds {
  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. /* see IBA A19.4.1.1 Placement Types */
  103. enum ib_placement_type {
  104. IB_FLUSH_GLOBAL = 1U << 0,
  105. IB_FLUSH_PERSISTENT = 1U << 1,
  106. };
  107. /* see IBA A19.4.1.2 Selectivity Level */
  108. enum ib_selectivity_level {
  109. IB_FLUSH_RANGE = 0,
  110. IB_FLUSH_MR,
  111. };
  112. /*
  113. * Make sure that all structs defined in this file remain laid out so
  114. * that they pack the same way on 32-bit and 64-bit architectures (to
  115. * avoid incompatibility between 32-bit userspace and 64-bit kernels).
  116. * Specifically:
  117. * - Do not use pointer types -- pass pointers in __u64 instead.
  118. * - Make sure that any structure larger than 4 bytes is padded to a
  119. * multiple of 8 bytes. Otherwise the structure size will be
  120. * different between 32-bit and 64-bit architectures.
  121. */
  122. struct ib_uverbs_async_event_desc {
  123. __aligned_u64 element;
  124. __u32 event_type; /* enum ib_event_type */
  125. __u32 reserved;
  126. };
  127. struct ib_uverbs_comp_event_desc {
  128. __aligned_u64 cq_handle;
  129. };
  130. struct ib_uverbs_cq_moderation_caps {
  131. __u16 max_cq_moderation_count;
  132. __u16 max_cq_moderation_period;
  133. __u32 reserved;
  134. };
  135. /*
  136. * All commands from userspace should start with a __u32 command field
  137. * followed by __u16 in_words and out_words fields (which give the
  138. * length of the command block and response buffer if any in 32-bit
  139. * words). The kernel driver will read these fields first and read
  140. * the rest of the command struct based on these value.
  141. */
  142. #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
  143. #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u
  144. struct ib_uverbs_cmd_hdr {
  145. __u32 command;
  146. __u16 in_words;
  147. __u16 out_words;
  148. };
  149. struct ib_uverbs_ex_cmd_hdr {
  150. __aligned_u64 response;
  151. __u16 provider_in_words;
  152. __u16 provider_out_words;
  153. __u32 cmd_hdr_reserved;
  154. };
  155. struct ib_uverbs_get_context {
  156. __aligned_u64 response;
  157. __aligned_u64 driver_data[];
  158. };
  159. struct ib_uverbs_get_context_resp {
  160. __u32 async_fd;
  161. __u32 num_comp_vectors;
  162. __aligned_u64 driver_data[];
  163. };
  164. struct ib_uverbs_query_device {
  165. __aligned_u64 response;
  166. __aligned_u64 driver_data[];
  167. };
  168. struct ib_uverbs_query_device_resp {
  169. __aligned_u64 fw_ver;
  170. __be64 node_guid;
  171. __be64 sys_image_guid;
  172. __aligned_u64 max_mr_size;
  173. __aligned_u64 page_size_cap;
  174. __u32 vendor_id;
  175. __u32 vendor_part_id;
  176. __u32 hw_ver;
  177. __u32 max_qp;
  178. __u32 max_qp_wr;
  179. __u32 device_cap_flags;
  180. __u32 max_sge;
  181. __u32 max_sge_rd;
  182. __u32 max_cq;
  183. __u32 max_cqe;
  184. __u32 max_mr;
  185. __u32 max_pd;
  186. __u32 max_qp_rd_atom;
  187. __u32 max_ee_rd_atom;
  188. __u32 max_res_rd_atom;
  189. __u32 max_qp_init_rd_atom;
  190. __u32 max_ee_init_rd_atom;
  191. __u32 atomic_cap;
  192. __u32 max_ee;
  193. __u32 max_rdd;
  194. __u32 max_mw;
  195. __u32 max_raw_ipv6_qp;
  196. __u32 max_raw_ethy_qp;
  197. __u32 max_mcast_grp;
  198. __u32 max_mcast_qp_attach;
  199. __u32 max_total_mcast_qp_attach;
  200. __u32 max_ah;
  201. __u32 max_fmr;
  202. __u32 max_map_per_fmr;
  203. __u32 max_srq;
  204. __u32 max_srq_wr;
  205. __u32 max_srq_sge;
  206. __u16 max_pkeys;
  207. __u8 local_ca_ack_delay;
  208. __u8 phys_port_cnt;
  209. __u8 reserved[4];
  210. };
  211. struct ib_uverbs_ex_query_device {
  212. __u32 comp_mask;
  213. __u32 reserved;
  214. };
  215. enum ib_uverbs_odp_general_cap_bits {
  216. IB_UVERBS_ODP_SUPPORT = 1 << 0,
  217. IB_UVERBS_ODP_SUPPORT_IMPLICIT = 1 << 1,
  218. };
  219. enum ib_uverbs_odp_transport_cap_bits {
  220. IB_UVERBS_ODP_SUPPORT_SEND = 1 << 0,
  221. IB_UVERBS_ODP_SUPPORT_RECV = 1 << 1,
  222. IB_UVERBS_ODP_SUPPORT_WRITE = 1 << 2,
  223. IB_UVERBS_ODP_SUPPORT_READ = 1 << 3,
  224. IB_UVERBS_ODP_SUPPORT_ATOMIC = 1 << 4,
  225. IB_UVERBS_ODP_SUPPORT_SRQ_RECV = 1 << 5,
  226. IB_UVERBS_ODP_SUPPORT_FLUSH = 1 << 6,
  227. IB_UVERBS_ODP_SUPPORT_ATOMIC_WRITE = 1 << 7,
  228. };
  229. struct ib_uverbs_odp_caps {
  230. __aligned_u64 general_caps;
  231. struct {
  232. __u32 rc_odp_caps;
  233. __u32 uc_odp_caps;
  234. __u32 ud_odp_caps;
  235. } per_transport_caps;
  236. __u32 reserved;
  237. };
  238. struct ib_uverbs_rss_caps {
  239. /* Corresponding bit will be set if qp type from
  240. * 'enum ib_qp_type' is supported, e.g.
  241. * supported_qpts |= 1 << IB_QPT_UD
  242. */
  243. __u32 supported_qpts;
  244. __u32 max_rwq_indirection_tables;
  245. __u32 max_rwq_indirection_table_size;
  246. __u32 reserved;
  247. };
  248. struct ib_uverbs_tm_caps {
  249. /* Max size of rendezvous request message */
  250. __u32 max_rndv_hdr_size;
  251. /* Max number of entries in tag matching list */
  252. __u32 max_num_tags;
  253. /* TM flags */
  254. __u32 flags;
  255. /* Max number of outstanding list operations */
  256. __u32 max_ops;
  257. /* Max number of SGE in tag matching entry */
  258. __u32 max_sge;
  259. __u32 reserved;
  260. };
  261. struct ib_uverbs_ex_query_device_resp {
  262. struct ib_uverbs_query_device_resp base;
  263. __u32 comp_mask;
  264. __u32 response_length;
  265. struct ib_uverbs_odp_caps odp_caps;
  266. __aligned_u64 timestamp_mask;
  267. __aligned_u64 hca_core_clock; /* in KHZ */
  268. __aligned_u64 device_cap_flags_ex;
  269. struct ib_uverbs_rss_caps rss_caps;
  270. __u32 max_wq_type_rq;
  271. __u32 raw_packet_caps;
  272. struct ib_uverbs_tm_caps tm_caps;
  273. struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
  274. __aligned_u64 max_dm_size;
  275. __u32 xrc_odp_caps;
  276. __u32 reserved;
  277. };
  278. struct ib_uverbs_query_port {
  279. __aligned_u64 response;
  280. __u8 port_num;
  281. __u8 reserved[7];
  282. __aligned_u64 driver_data[];
  283. };
  284. struct ib_uverbs_query_port_resp {
  285. __u32 port_cap_flags; /* see ib_uverbs_query_port_cap_flags */
  286. __u32 max_msg_sz;
  287. __u32 bad_pkey_cntr;
  288. __u32 qkey_viol_cntr;
  289. __u32 gid_tbl_len;
  290. __u16 pkey_tbl_len;
  291. __u16 lid;
  292. __u16 sm_lid;
  293. __u8 state;
  294. __u8 max_mtu;
  295. __u8 active_mtu;
  296. __u8 lmc;
  297. __u8 max_vl_num;
  298. __u8 sm_sl;
  299. __u8 subnet_timeout;
  300. __u8 init_type_reply;
  301. __u8 active_width;
  302. __u8 active_speed;
  303. __u8 phys_state;
  304. __u8 link_layer;
  305. __u8 flags; /* see ib_uverbs_query_port_flags */
  306. __u8 reserved;
  307. };
  308. struct ib_uverbs_alloc_pd {
  309. __aligned_u64 response;
  310. __aligned_u64 driver_data[];
  311. };
  312. struct ib_uverbs_alloc_pd_resp {
  313. __u32 pd_handle;
  314. __u32 driver_data[];
  315. };
  316. struct ib_uverbs_dealloc_pd {
  317. __u32 pd_handle;
  318. };
  319. struct ib_uverbs_open_xrcd {
  320. __aligned_u64 response;
  321. __u32 fd;
  322. __u32 oflags;
  323. __aligned_u64 driver_data[];
  324. };
  325. struct ib_uverbs_open_xrcd_resp {
  326. __u32 xrcd_handle;
  327. __u32 driver_data[];
  328. };
  329. struct ib_uverbs_close_xrcd {
  330. __u32 xrcd_handle;
  331. };
  332. struct ib_uverbs_reg_mr {
  333. __aligned_u64 response;
  334. __aligned_u64 start;
  335. __aligned_u64 length;
  336. __aligned_u64 hca_va;
  337. __u32 pd_handle;
  338. __u32 access_flags;
  339. __aligned_u64 driver_data[];
  340. };
  341. struct ib_uverbs_reg_mr_resp {
  342. __u32 mr_handle;
  343. __u32 lkey;
  344. __u32 rkey;
  345. __u32 driver_data[];
  346. };
  347. struct ib_uverbs_rereg_mr {
  348. __aligned_u64 response;
  349. __u32 mr_handle;
  350. __u32 flags;
  351. __aligned_u64 start;
  352. __aligned_u64 length;
  353. __aligned_u64 hca_va;
  354. __u32 pd_handle;
  355. __u32 access_flags;
  356. __aligned_u64 driver_data[];
  357. };
  358. struct ib_uverbs_rereg_mr_resp {
  359. __u32 lkey;
  360. __u32 rkey;
  361. __aligned_u64 driver_data[];
  362. };
  363. struct ib_uverbs_dereg_mr {
  364. __u32 mr_handle;
  365. };
  366. struct ib_uverbs_alloc_mw {
  367. __aligned_u64 response;
  368. __u32 pd_handle;
  369. __u8 mw_type;
  370. __u8 reserved[3];
  371. __aligned_u64 driver_data[];
  372. };
  373. struct ib_uverbs_alloc_mw_resp {
  374. __u32 mw_handle;
  375. __u32 rkey;
  376. __aligned_u64 driver_data[];
  377. };
  378. struct ib_uverbs_dealloc_mw {
  379. __u32 mw_handle;
  380. };
  381. struct ib_uverbs_create_comp_channel {
  382. __aligned_u64 response;
  383. };
  384. struct ib_uverbs_create_comp_channel_resp {
  385. __u32 fd;
  386. };
  387. struct ib_uverbs_create_cq {
  388. __aligned_u64 response;
  389. __aligned_u64 user_handle;
  390. __u32 cqe;
  391. __u32 comp_vector;
  392. __s32 comp_channel;
  393. __u32 reserved;
  394. __aligned_u64 driver_data[];
  395. };
  396. enum ib_uverbs_ex_create_cq_flags {
  397. IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0,
  398. IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1,
  399. };
  400. struct ib_uverbs_ex_create_cq {
  401. __aligned_u64 user_handle;
  402. __u32 cqe;
  403. __u32 comp_vector;
  404. __s32 comp_channel;
  405. __u32 comp_mask;
  406. __u32 flags; /* bitmask of ib_uverbs_ex_create_cq_flags */
  407. __u32 reserved;
  408. };
  409. struct ib_uverbs_create_cq_resp {
  410. __u32 cq_handle;
  411. __u32 cqe;
  412. __aligned_u64 driver_data[0];
  413. };
  414. struct ib_uverbs_ex_create_cq_resp {
  415. struct ib_uverbs_create_cq_resp base;
  416. __u32 comp_mask;
  417. __u32 response_length;
  418. };
  419. struct ib_uverbs_resize_cq {
  420. __aligned_u64 response;
  421. __u32 cq_handle;
  422. __u32 cqe;
  423. __aligned_u64 driver_data[];
  424. };
  425. struct ib_uverbs_resize_cq_resp {
  426. __u32 cqe;
  427. __u32 reserved;
  428. __aligned_u64 driver_data[];
  429. };
  430. struct ib_uverbs_poll_cq {
  431. __aligned_u64 response;
  432. __u32 cq_handle;
  433. __u32 ne;
  434. };
  435. enum ib_uverbs_wc_opcode {
  436. IB_UVERBS_WC_SEND = 0,
  437. IB_UVERBS_WC_RDMA_WRITE = 1,
  438. IB_UVERBS_WC_RDMA_READ = 2,
  439. IB_UVERBS_WC_COMP_SWAP = 3,
  440. IB_UVERBS_WC_FETCH_ADD = 4,
  441. IB_UVERBS_WC_BIND_MW = 5,
  442. IB_UVERBS_WC_LOCAL_INV = 6,
  443. IB_UVERBS_WC_TSO = 7,
  444. IB_UVERBS_WC_FLUSH = 8,
  445. IB_UVERBS_WC_ATOMIC_WRITE = 9,
  446. };
  447. struct ib_uverbs_wc {
  448. __aligned_u64 wr_id;
  449. __u32 status;
  450. __u32 opcode;
  451. __u32 vendor_err;
  452. __u32 byte_len;
  453. union {
  454. __be32 imm_data;
  455. __u32 invalidate_rkey;
  456. } ex;
  457. __u32 qp_num;
  458. __u32 src_qp;
  459. __u32 wc_flags;
  460. __u16 pkey_index;
  461. __u16 slid;
  462. __u8 sl;
  463. __u8 dlid_path_bits;
  464. __u8 port_num;
  465. __u8 reserved;
  466. };
  467. struct ib_uverbs_poll_cq_resp {
  468. __u32 count;
  469. __u32 reserved;
  470. struct ib_uverbs_wc wc[];
  471. };
  472. struct ib_uverbs_req_notify_cq {
  473. __u32 cq_handle;
  474. __u32 solicited_only;
  475. };
  476. struct ib_uverbs_destroy_cq {
  477. __aligned_u64 response;
  478. __u32 cq_handle;
  479. __u32 reserved;
  480. };
  481. struct ib_uverbs_destroy_cq_resp {
  482. __u32 comp_events_reported;
  483. __u32 async_events_reported;
  484. };
  485. struct ib_uverbs_global_route {
  486. __u8 dgid[16];
  487. __u32 flow_label;
  488. __u8 sgid_index;
  489. __u8 hop_limit;
  490. __u8 traffic_class;
  491. __u8 reserved;
  492. };
  493. struct ib_uverbs_ah_attr {
  494. struct ib_uverbs_global_route grh;
  495. __u16 dlid;
  496. __u8 sl;
  497. __u8 src_path_bits;
  498. __u8 static_rate;
  499. __u8 is_global;
  500. __u8 port_num;
  501. __u8 reserved;
  502. };
  503. struct ib_uverbs_qp_attr {
  504. __u32 qp_attr_mask;
  505. __u32 qp_state;
  506. __u32 cur_qp_state;
  507. __u32 path_mtu;
  508. __u32 path_mig_state;
  509. __u32 qkey;
  510. __u32 rq_psn;
  511. __u32 sq_psn;
  512. __u32 dest_qp_num;
  513. __u32 qp_access_flags;
  514. struct ib_uverbs_ah_attr ah_attr;
  515. struct ib_uverbs_ah_attr alt_ah_attr;
  516. /* ib_qp_cap */
  517. __u32 max_send_wr;
  518. __u32 max_recv_wr;
  519. __u32 max_send_sge;
  520. __u32 max_recv_sge;
  521. __u32 max_inline_data;
  522. __u16 pkey_index;
  523. __u16 alt_pkey_index;
  524. __u8 en_sqd_async_notify;
  525. __u8 sq_draining;
  526. __u8 max_rd_atomic;
  527. __u8 max_dest_rd_atomic;
  528. __u8 min_rnr_timer;
  529. __u8 port_num;
  530. __u8 timeout;
  531. __u8 retry_cnt;
  532. __u8 rnr_retry;
  533. __u8 alt_port_num;
  534. __u8 alt_timeout;
  535. __u8 reserved[5];
  536. };
  537. struct ib_uverbs_create_qp {
  538. __aligned_u64 response;
  539. __aligned_u64 user_handle;
  540. __u32 pd_handle;
  541. __u32 send_cq_handle;
  542. __u32 recv_cq_handle;
  543. __u32 srq_handle;
  544. __u32 max_send_wr;
  545. __u32 max_recv_wr;
  546. __u32 max_send_sge;
  547. __u32 max_recv_sge;
  548. __u32 max_inline_data;
  549. __u8 sq_sig_all;
  550. __u8 qp_type;
  551. __u8 is_srq;
  552. __u8 reserved;
  553. __aligned_u64 driver_data[];
  554. };
  555. enum ib_uverbs_create_qp_mask {
  556. IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
  557. };
  558. enum {
  559. IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
  560. };
  561. struct ib_uverbs_ex_create_qp {
  562. __aligned_u64 user_handle;
  563. __u32 pd_handle;
  564. __u32 send_cq_handle;
  565. __u32 recv_cq_handle;
  566. __u32 srq_handle;
  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. __u8 sq_sig_all;
  573. __u8 qp_type;
  574. __u8 is_srq;
  575. __u8 reserved;
  576. __u32 comp_mask;
  577. __u32 create_flags;
  578. __u32 rwq_ind_tbl_handle;
  579. __u32 source_qpn;
  580. };
  581. struct ib_uverbs_open_qp {
  582. __aligned_u64 response;
  583. __aligned_u64 user_handle;
  584. __u32 pd_handle;
  585. __u32 qpn;
  586. __u8 qp_type;
  587. __u8 reserved[7];
  588. __aligned_u64 driver_data[];
  589. };
  590. /* also used for open response */
  591. struct ib_uverbs_create_qp_resp {
  592. __u32 qp_handle;
  593. __u32 qpn;
  594. __u32 max_send_wr;
  595. __u32 max_recv_wr;
  596. __u32 max_send_sge;
  597. __u32 max_recv_sge;
  598. __u32 max_inline_data;
  599. __u32 reserved;
  600. __u32 driver_data[0];
  601. };
  602. struct ib_uverbs_ex_create_qp_resp {
  603. struct ib_uverbs_create_qp_resp base;
  604. __u32 comp_mask;
  605. __u32 response_length;
  606. };
  607. /*
  608. * This struct needs to remain a multiple of 8 bytes to keep the
  609. * alignment of the modify QP parameters.
  610. */
  611. struct ib_uverbs_qp_dest {
  612. __u8 dgid[16];
  613. __u32 flow_label;
  614. __u16 dlid;
  615. __u16 reserved;
  616. __u8 sgid_index;
  617. __u8 hop_limit;
  618. __u8 traffic_class;
  619. __u8 sl;
  620. __u8 src_path_bits;
  621. __u8 static_rate;
  622. __u8 is_global;
  623. __u8 port_num;
  624. };
  625. struct ib_uverbs_query_qp {
  626. __aligned_u64 response;
  627. __u32 qp_handle;
  628. __u32 attr_mask;
  629. __aligned_u64 driver_data[];
  630. };
  631. struct ib_uverbs_query_qp_resp {
  632. struct ib_uverbs_qp_dest dest;
  633. struct ib_uverbs_qp_dest alt_dest;
  634. __u32 max_send_wr;
  635. __u32 max_recv_wr;
  636. __u32 max_send_sge;
  637. __u32 max_recv_sge;
  638. __u32 max_inline_data;
  639. __u32 qkey;
  640. __u32 rq_psn;
  641. __u32 sq_psn;
  642. __u32 dest_qp_num;
  643. __u32 qp_access_flags;
  644. __u16 pkey_index;
  645. __u16 alt_pkey_index;
  646. __u8 qp_state;
  647. __u8 cur_qp_state;
  648. __u8 path_mtu;
  649. __u8 path_mig_state;
  650. __u8 sq_draining;
  651. __u8 max_rd_atomic;
  652. __u8 max_dest_rd_atomic;
  653. __u8 min_rnr_timer;
  654. __u8 port_num;
  655. __u8 timeout;
  656. __u8 retry_cnt;
  657. __u8 rnr_retry;
  658. __u8 alt_port_num;
  659. __u8 alt_timeout;
  660. __u8 sq_sig_all;
  661. __u8 reserved[5];
  662. __aligned_u64 driver_data[];
  663. };
  664. struct ib_uverbs_modify_qp {
  665. struct ib_uverbs_qp_dest dest;
  666. struct ib_uverbs_qp_dest alt_dest;
  667. __u32 qp_handle;
  668. __u32 attr_mask;
  669. __u32 qkey;
  670. __u32 rq_psn;
  671. __u32 sq_psn;
  672. __u32 dest_qp_num;
  673. __u32 qp_access_flags;
  674. __u16 pkey_index;
  675. __u16 alt_pkey_index;
  676. __u8 qp_state;
  677. __u8 cur_qp_state;
  678. __u8 path_mtu;
  679. __u8 path_mig_state;
  680. __u8 en_sqd_async_notify;
  681. __u8 max_rd_atomic;
  682. __u8 max_dest_rd_atomic;
  683. __u8 min_rnr_timer;
  684. __u8 port_num;
  685. __u8 timeout;
  686. __u8 retry_cnt;
  687. __u8 rnr_retry;
  688. __u8 alt_port_num;
  689. __u8 alt_timeout;
  690. __u8 reserved[2];
  691. __aligned_u64 driver_data[0];
  692. };
  693. struct ib_uverbs_ex_modify_qp {
  694. struct ib_uverbs_modify_qp base;
  695. __u32 rate_limit;
  696. __u32 reserved;
  697. };
  698. struct ib_uverbs_ex_modify_qp_resp {
  699. __u32 comp_mask;
  700. __u32 response_length;
  701. };
  702. struct ib_uverbs_destroy_qp {
  703. __aligned_u64 response;
  704. __u32 qp_handle;
  705. __u32 reserved;
  706. };
  707. struct ib_uverbs_destroy_qp_resp {
  708. __u32 events_reported;
  709. };
  710. /*
  711. * The ib_uverbs_sge structure isn't used anywhere, since we assume
  712. * the ib_sge structure is packed the same way on 32-bit and 64-bit
  713. * architectures in both kernel and user space. It's just here to
  714. * document the ABI.
  715. */
  716. struct ib_uverbs_sge {
  717. __aligned_u64 addr;
  718. __u32 length;
  719. __u32 lkey;
  720. };
  721. enum ib_uverbs_wr_opcode {
  722. IB_UVERBS_WR_RDMA_WRITE = 0,
  723. IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1,
  724. IB_UVERBS_WR_SEND = 2,
  725. IB_UVERBS_WR_SEND_WITH_IMM = 3,
  726. IB_UVERBS_WR_RDMA_READ = 4,
  727. IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5,
  728. IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6,
  729. IB_UVERBS_WR_LOCAL_INV = 7,
  730. IB_UVERBS_WR_BIND_MW = 8,
  731. IB_UVERBS_WR_SEND_WITH_INV = 9,
  732. IB_UVERBS_WR_TSO = 10,
  733. IB_UVERBS_WR_RDMA_READ_WITH_INV = 11,
  734. IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12,
  735. IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13,
  736. IB_UVERBS_WR_FLUSH = 14,
  737. IB_UVERBS_WR_ATOMIC_WRITE = 15,
  738. /* Review enum ib_wr_opcode before modifying this */
  739. };
  740. struct ib_uverbs_send_wr {
  741. __aligned_u64 wr_id;
  742. __u32 num_sge;
  743. __u32 opcode; /* see enum ib_uverbs_wr_opcode */
  744. __u32 send_flags;
  745. union {
  746. __be32 imm_data;
  747. __u32 invalidate_rkey;
  748. } ex;
  749. union {
  750. struct {
  751. __aligned_u64 remote_addr;
  752. __u32 rkey;
  753. __u32 reserved;
  754. } rdma;
  755. struct {
  756. __aligned_u64 remote_addr;
  757. __aligned_u64 compare_add;
  758. __aligned_u64 swap;
  759. __u32 rkey;
  760. __u32 reserved;
  761. } atomic;
  762. struct {
  763. __u32 ah;
  764. __u32 remote_qpn;
  765. __u32 remote_qkey;
  766. __u32 reserved;
  767. } ud;
  768. } wr;
  769. };
  770. struct ib_uverbs_post_send {
  771. __aligned_u64 response;
  772. __u32 qp_handle;
  773. __u32 wr_count;
  774. __u32 sge_count;
  775. __u32 wqe_size;
  776. struct ib_uverbs_send_wr send_wr[];
  777. };
  778. struct ib_uverbs_post_send_resp {
  779. __u32 bad_wr;
  780. };
  781. struct ib_uverbs_recv_wr {
  782. __aligned_u64 wr_id;
  783. __u32 num_sge;
  784. __u32 reserved;
  785. };
  786. struct ib_uverbs_post_recv {
  787. __aligned_u64 response;
  788. __u32 qp_handle;
  789. __u32 wr_count;
  790. __u32 sge_count;
  791. __u32 wqe_size;
  792. struct ib_uverbs_recv_wr recv_wr[];
  793. };
  794. struct ib_uverbs_post_recv_resp {
  795. __u32 bad_wr;
  796. };
  797. struct ib_uverbs_post_srq_recv {
  798. __aligned_u64 response;
  799. __u32 srq_handle;
  800. __u32 wr_count;
  801. __u32 sge_count;
  802. __u32 wqe_size;
  803. struct ib_uverbs_recv_wr recv[];
  804. };
  805. struct ib_uverbs_post_srq_recv_resp {
  806. __u32 bad_wr;
  807. };
  808. struct ib_uverbs_create_ah {
  809. __aligned_u64 response;
  810. __aligned_u64 user_handle;
  811. __u32 pd_handle;
  812. __u32 reserved;
  813. struct ib_uverbs_ah_attr attr;
  814. __aligned_u64 driver_data[];
  815. };
  816. struct ib_uverbs_create_ah_resp {
  817. __u32 ah_handle;
  818. __u32 driver_data[];
  819. };
  820. struct ib_uverbs_destroy_ah {
  821. __u32 ah_handle;
  822. };
  823. struct ib_uverbs_attach_mcast {
  824. __u8 gid[16];
  825. __u32 qp_handle;
  826. __u16 mlid;
  827. __u16 reserved;
  828. __aligned_u64 driver_data[];
  829. };
  830. struct ib_uverbs_detach_mcast {
  831. __u8 gid[16];
  832. __u32 qp_handle;
  833. __u16 mlid;
  834. __u16 reserved;
  835. __aligned_u64 driver_data[];
  836. };
  837. struct ib_uverbs_flow_spec_hdr {
  838. __u32 type;
  839. __u16 size;
  840. __u16 reserved;
  841. /* followed by flow_spec */
  842. __aligned_u64 flow_spec_data[0];
  843. };
  844. struct ib_uverbs_flow_eth_filter {
  845. __u8 dst_mac[6];
  846. __u8 src_mac[6];
  847. __be16 ether_type;
  848. __be16 vlan_tag;
  849. };
  850. struct ib_uverbs_flow_spec_eth {
  851. union {
  852. struct ib_uverbs_flow_spec_hdr hdr;
  853. struct {
  854. __u32 type;
  855. __u16 size;
  856. __u16 reserved;
  857. };
  858. };
  859. struct ib_uverbs_flow_eth_filter val;
  860. struct ib_uverbs_flow_eth_filter mask;
  861. };
  862. struct ib_uverbs_flow_ipv4_filter {
  863. __be32 src_ip;
  864. __be32 dst_ip;
  865. __u8 proto;
  866. __u8 tos;
  867. __u8 ttl;
  868. __u8 flags;
  869. };
  870. struct ib_uverbs_flow_spec_ipv4 {
  871. union {
  872. struct ib_uverbs_flow_spec_hdr hdr;
  873. struct {
  874. __u32 type;
  875. __u16 size;
  876. __u16 reserved;
  877. };
  878. };
  879. struct ib_uverbs_flow_ipv4_filter val;
  880. struct ib_uverbs_flow_ipv4_filter mask;
  881. };
  882. struct ib_uverbs_flow_tcp_udp_filter {
  883. __be16 dst_port;
  884. __be16 src_port;
  885. };
  886. struct ib_uverbs_flow_spec_tcp_udp {
  887. union {
  888. struct ib_uverbs_flow_spec_hdr hdr;
  889. struct {
  890. __u32 type;
  891. __u16 size;
  892. __u16 reserved;
  893. };
  894. };
  895. struct ib_uverbs_flow_tcp_udp_filter val;
  896. struct ib_uverbs_flow_tcp_udp_filter mask;
  897. };
  898. struct ib_uverbs_flow_ipv6_filter {
  899. __u8 src_ip[16];
  900. __u8 dst_ip[16];
  901. __be32 flow_label;
  902. __u8 next_hdr;
  903. __u8 traffic_class;
  904. __u8 hop_limit;
  905. __u8 reserved;
  906. };
  907. struct ib_uverbs_flow_spec_ipv6 {
  908. union {
  909. struct ib_uverbs_flow_spec_hdr hdr;
  910. struct {
  911. __u32 type;
  912. __u16 size;
  913. __u16 reserved;
  914. };
  915. };
  916. struct ib_uverbs_flow_ipv6_filter val;
  917. struct ib_uverbs_flow_ipv6_filter mask;
  918. };
  919. struct ib_uverbs_flow_spec_action_tag {
  920. union {
  921. struct ib_uverbs_flow_spec_hdr hdr;
  922. struct {
  923. __u32 type;
  924. __u16 size;
  925. __u16 reserved;
  926. };
  927. };
  928. __u32 tag_id;
  929. __u32 reserved1;
  930. };
  931. struct ib_uverbs_flow_spec_action_drop {
  932. union {
  933. struct ib_uverbs_flow_spec_hdr hdr;
  934. struct {
  935. __u32 type;
  936. __u16 size;
  937. __u16 reserved;
  938. };
  939. };
  940. };
  941. struct ib_uverbs_flow_spec_action_handle {
  942. union {
  943. struct ib_uverbs_flow_spec_hdr hdr;
  944. struct {
  945. __u32 type;
  946. __u16 size;
  947. __u16 reserved;
  948. };
  949. };
  950. __u32 handle;
  951. __u32 reserved1;
  952. };
  953. struct ib_uverbs_flow_spec_action_count {
  954. union {
  955. struct ib_uverbs_flow_spec_hdr hdr;
  956. struct {
  957. __u32 type;
  958. __u16 size;
  959. __u16 reserved;
  960. };
  961. };
  962. __u32 handle;
  963. __u32 reserved1;
  964. };
  965. struct ib_uverbs_flow_tunnel_filter {
  966. __be32 tunnel_id;
  967. };
  968. struct ib_uverbs_flow_spec_tunnel {
  969. union {
  970. struct ib_uverbs_flow_spec_hdr hdr;
  971. struct {
  972. __u32 type;
  973. __u16 size;
  974. __u16 reserved;
  975. };
  976. };
  977. struct ib_uverbs_flow_tunnel_filter val;
  978. struct ib_uverbs_flow_tunnel_filter mask;
  979. };
  980. struct ib_uverbs_flow_spec_esp_filter {
  981. __u32 spi;
  982. __u32 seq;
  983. };
  984. struct ib_uverbs_flow_spec_esp {
  985. union {
  986. struct ib_uverbs_flow_spec_hdr hdr;
  987. struct {
  988. __u32 type;
  989. __u16 size;
  990. __u16 reserved;
  991. };
  992. };
  993. struct ib_uverbs_flow_spec_esp_filter val;
  994. struct ib_uverbs_flow_spec_esp_filter mask;
  995. };
  996. struct ib_uverbs_flow_gre_filter {
  997. /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header:
  998. * bit 0 - C - checksum bit.
  999. * bit 1 - reserved. set to 0.
  1000. * bit 2 - key bit.
  1001. * bit 3 - sequence number bit.
  1002. * bits 4:12 - reserved. set to 0.
  1003. * bits 13:15 - GRE version.
  1004. */
  1005. __be16 c_ks_res0_ver;
  1006. __be16 protocol;
  1007. __be32 key;
  1008. };
  1009. struct ib_uverbs_flow_spec_gre {
  1010. union {
  1011. struct ib_uverbs_flow_spec_hdr hdr;
  1012. struct {
  1013. __u32 type;
  1014. __u16 size;
  1015. __u16 reserved;
  1016. };
  1017. };
  1018. struct ib_uverbs_flow_gre_filter val;
  1019. struct ib_uverbs_flow_gre_filter mask;
  1020. };
  1021. struct ib_uverbs_flow_mpls_filter {
  1022. /* The field includes the entire MPLS label:
  1023. * bits 0:19 - label field.
  1024. * bits 20:22 - traffic class field.
  1025. * bits 23 - bottom of stack bit.
  1026. * bits 24:31 - ttl field.
  1027. */
  1028. __be32 label;
  1029. };
  1030. struct ib_uverbs_flow_spec_mpls {
  1031. union {
  1032. struct ib_uverbs_flow_spec_hdr hdr;
  1033. struct {
  1034. __u32 type;
  1035. __u16 size;
  1036. __u16 reserved;
  1037. };
  1038. };
  1039. struct ib_uverbs_flow_mpls_filter val;
  1040. struct ib_uverbs_flow_mpls_filter mask;
  1041. };
  1042. struct ib_uverbs_flow_attr {
  1043. __u32 type;
  1044. __u16 size;
  1045. __u16 priority;
  1046. __u8 num_of_specs;
  1047. __u8 reserved[2];
  1048. __u8 port;
  1049. __u32 flags;
  1050. /* Following are the optional layers according to user request
  1051. * struct ib_flow_spec_xxx
  1052. * struct ib_flow_spec_yyy
  1053. */
  1054. struct ib_uverbs_flow_spec_hdr flow_specs[];
  1055. };
  1056. struct ib_uverbs_create_flow {
  1057. __u32 comp_mask;
  1058. __u32 qp_handle;
  1059. struct ib_uverbs_flow_attr flow_attr;
  1060. };
  1061. struct ib_uverbs_create_flow_resp {
  1062. __u32 comp_mask;
  1063. __u32 flow_handle;
  1064. };
  1065. struct ib_uverbs_destroy_flow {
  1066. __u32 comp_mask;
  1067. __u32 flow_handle;
  1068. };
  1069. struct ib_uverbs_create_srq {
  1070. __aligned_u64 response;
  1071. __aligned_u64 user_handle;
  1072. __u32 pd_handle;
  1073. __u32 max_wr;
  1074. __u32 max_sge;
  1075. __u32 srq_limit;
  1076. __aligned_u64 driver_data[];
  1077. };
  1078. struct ib_uverbs_create_xsrq {
  1079. __aligned_u64 response;
  1080. __aligned_u64 user_handle;
  1081. __u32 srq_type;
  1082. __u32 pd_handle;
  1083. __u32 max_wr;
  1084. __u32 max_sge;
  1085. __u32 srq_limit;
  1086. __u32 max_num_tags;
  1087. __u32 xrcd_handle;
  1088. __u32 cq_handle;
  1089. __aligned_u64 driver_data[];
  1090. };
  1091. struct ib_uverbs_create_srq_resp {
  1092. __u32 srq_handle;
  1093. __u32 max_wr;
  1094. __u32 max_sge;
  1095. __u32 srqn;
  1096. __u32 driver_data[];
  1097. };
  1098. struct ib_uverbs_modify_srq {
  1099. __u32 srq_handle;
  1100. __u32 attr_mask;
  1101. __u32 max_wr;
  1102. __u32 srq_limit;
  1103. __aligned_u64 driver_data[];
  1104. };
  1105. struct ib_uverbs_query_srq {
  1106. __aligned_u64 response;
  1107. __u32 srq_handle;
  1108. __u32 reserved;
  1109. __aligned_u64 driver_data[];
  1110. };
  1111. struct ib_uverbs_query_srq_resp {
  1112. __u32 max_wr;
  1113. __u32 max_sge;
  1114. __u32 srq_limit;
  1115. __u32 reserved;
  1116. };
  1117. struct ib_uverbs_destroy_srq {
  1118. __aligned_u64 response;
  1119. __u32 srq_handle;
  1120. __u32 reserved;
  1121. };
  1122. struct ib_uverbs_destroy_srq_resp {
  1123. __u32 events_reported;
  1124. };
  1125. struct ib_uverbs_ex_create_wq {
  1126. __u32 comp_mask;
  1127. __u32 wq_type;
  1128. __aligned_u64 user_handle;
  1129. __u32 pd_handle;
  1130. __u32 cq_handle;
  1131. __u32 max_wr;
  1132. __u32 max_sge;
  1133. __u32 create_flags; /* Use enum ib_wq_flags */
  1134. __u32 reserved;
  1135. };
  1136. struct ib_uverbs_ex_create_wq_resp {
  1137. __u32 comp_mask;
  1138. __u32 response_length;
  1139. __u32 wq_handle;
  1140. __u32 max_wr;
  1141. __u32 max_sge;
  1142. __u32 wqn;
  1143. };
  1144. struct ib_uverbs_ex_destroy_wq {
  1145. __u32 comp_mask;
  1146. __u32 wq_handle;
  1147. };
  1148. struct ib_uverbs_ex_destroy_wq_resp {
  1149. __u32 comp_mask;
  1150. __u32 response_length;
  1151. __u32 events_reported;
  1152. __u32 reserved;
  1153. };
  1154. struct ib_uverbs_ex_modify_wq {
  1155. __u32 attr_mask;
  1156. __u32 wq_handle;
  1157. __u32 wq_state;
  1158. __u32 curr_wq_state;
  1159. __u32 flags; /* Use enum ib_wq_flags */
  1160. __u32 flags_mask; /* Use enum ib_wq_flags */
  1161. };
  1162. /* Prevent memory allocation rather than max expected size */
  1163. #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
  1164. struct ib_uverbs_ex_create_rwq_ind_table {
  1165. __u32 comp_mask;
  1166. __u32 log_ind_tbl_size;
  1167. /* Following are the wq handles according to log_ind_tbl_size
  1168. * wq_handle1
  1169. * wq_handle2
  1170. */
  1171. __u32 wq_handles[];
  1172. };
  1173. struct ib_uverbs_ex_create_rwq_ind_table_resp {
  1174. __u32 comp_mask;
  1175. __u32 response_length;
  1176. __u32 ind_tbl_handle;
  1177. __u32 ind_tbl_num;
  1178. };
  1179. struct ib_uverbs_ex_destroy_rwq_ind_table {
  1180. __u32 comp_mask;
  1181. __u32 ind_tbl_handle;
  1182. };
  1183. struct ib_uverbs_cq_moderation {
  1184. __u16 cq_count;
  1185. __u16 cq_period;
  1186. };
  1187. struct ib_uverbs_ex_modify_cq {
  1188. __u32 cq_handle;
  1189. __u32 attr_mask;
  1190. struct ib_uverbs_cq_moderation attr;
  1191. __u32 reserved;
  1192. };
  1193. #define IB_DEVICE_NAME_MAX 64
  1194. /*
  1195. * bits 9, 15, 16, 19, 22, 27, 30, 31, 32, 33, 35 and 37 may be set by old
  1196. * kernels and should not be used.
  1197. */
  1198. enum ib_uverbs_device_cap_flags {
  1199. IB_UVERBS_DEVICE_RESIZE_MAX_WR = 1 << 0,
  1200. IB_UVERBS_DEVICE_BAD_PKEY_CNTR = 1 << 1,
  1201. IB_UVERBS_DEVICE_BAD_QKEY_CNTR = 1 << 2,
  1202. IB_UVERBS_DEVICE_RAW_MULTI = 1 << 3,
  1203. IB_UVERBS_DEVICE_AUTO_PATH_MIG = 1 << 4,
  1204. IB_UVERBS_DEVICE_CHANGE_PHY_PORT = 1 << 5,
  1205. IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE = 1 << 6,
  1206. IB_UVERBS_DEVICE_CURR_QP_STATE_MOD = 1 << 7,
  1207. IB_UVERBS_DEVICE_SHUTDOWN_PORT = 1 << 8,
  1208. /* IB_UVERBS_DEVICE_INIT_TYPE = 1 << 9, (not in use) */
  1209. IB_UVERBS_DEVICE_PORT_ACTIVE_EVENT = 1 << 10,
  1210. IB_UVERBS_DEVICE_SYS_IMAGE_GUID = 1 << 11,
  1211. IB_UVERBS_DEVICE_RC_RNR_NAK_GEN = 1 << 12,
  1212. IB_UVERBS_DEVICE_SRQ_RESIZE = 1 << 13,
  1213. IB_UVERBS_DEVICE_N_NOTIFY_CQ = 1 << 14,
  1214. IB_UVERBS_DEVICE_MEM_WINDOW = 1 << 17,
  1215. IB_UVERBS_DEVICE_UD_IP_CSUM = 1 << 18,
  1216. IB_UVERBS_DEVICE_XRC = 1 << 20,
  1217. IB_UVERBS_DEVICE_MEM_MGT_EXTENSIONS = 1 << 21,
  1218. IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2A = 1 << 23,
  1219. IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2B = 1 << 24,
  1220. IB_UVERBS_DEVICE_RC_IP_CSUM = 1 << 25,
  1221. /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_IP_CSUM. */
  1222. IB_UVERBS_DEVICE_RAW_IP_CSUM = 1 << 26,
  1223. IB_UVERBS_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
  1224. /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS. */
  1225. IB_UVERBS_DEVICE_RAW_SCATTER_FCS = 1ULL << 34,
  1226. IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING = 1ULL << 36,
  1227. /* Flush placement types */
  1228. IB_UVERBS_DEVICE_FLUSH_GLOBAL = 1ULL << 38,
  1229. IB_UVERBS_DEVICE_FLUSH_PERSISTENT = 1ULL << 39,
  1230. /* Atomic write attributes */
  1231. IB_UVERBS_DEVICE_ATOMIC_WRITE = 1ULL << 40,
  1232. };
  1233. enum ib_uverbs_raw_packet_caps {
  1234. IB_UVERBS_RAW_PACKET_CAP_CVLAN_STRIPPING = 1 << 0,
  1235. IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS = 1 << 1,
  1236. IB_UVERBS_RAW_PACKET_CAP_IP_CSUM = 1 << 2,
  1237. IB_UVERBS_RAW_PACKET_CAP_DELAY_DROP = 1 << 3,
  1238. };
  1239. #endif /* IB_USER_VERBS_H */