ib_user_verbs.h 20 KB

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