ib_user_verbs.h 18 KB

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