ib_user_verbs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  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_rss_caps {
  208. /* Corresponding bit will be set if qp type from
  209. * 'enum ib_qp_type' is supported, e.g.
  210. * supported_qpts |= 1 << IB_QPT_UD
  211. */
  212. __u32 supported_qpts;
  213. __u32 max_rwq_indirection_tables;
  214. __u32 max_rwq_indirection_table_size;
  215. __u32 reserved;
  216. };
  217. struct ib_uverbs_ex_query_device_resp {
  218. struct ib_uverbs_query_device_resp base;
  219. __u32 comp_mask;
  220. __u32 response_length;
  221. struct ib_uverbs_odp_caps odp_caps;
  222. __u64 timestamp_mask;
  223. __u64 hca_core_clock; /* in KHZ */
  224. __u64 device_cap_flags_ex;
  225. struct ib_uverbs_rss_caps rss_caps;
  226. __u32 max_wq_type_rq;
  227. __u32 reserved;
  228. };
  229. struct ib_uverbs_query_port {
  230. __u64 response;
  231. __u8 port_num;
  232. __u8 reserved[7];
  233. __u64 driver_data[0];
  234. };
  235. struct ib_uverbs_query_port_resp {
  236. __u32 port_cap_flags;
  237. __u32 max_msg_sz;
  238. __u32 bad_pkey_cntr;
  239. __u32 qkey_viol_cntr;
  240. __u32 gid_tbl_len;
  241. __u16 pkey_tbl_len;
  242. __u16 lid;
  243. __u16 sm_lid;
  244. __u8 state;
  245. __u8 max_mtu;
  246. __u8 active_mtu;
  247. __u8 lmc;
  248. __u8 max_vl_num;
  249. __u8 sm_sl;
  250. __u8 subnet_timeout;
  251. __u8 init_type_reply;
  252. __u8 active_width;
  253. __u8 active_speed;
  254. __u8 phys_state;
  255. __u8 link_layer;
  256. __u8 reserved[2];
  257. };
  258. struct ib_uverbs_alloc_pd {
  259. __u64 response;
  260. __u64 driver_data[0];
  261. };
  262. struct ib_uverbs_alloc_pd_resp {
  263. __u32 pd_handle;
  264. };
  265. struct ib_uverbs_dealloc_pd {
  266. __u32 pd_handle;
  267. };
  268. struct ib_uverbs_open_xrcd {
  269. __u64 response;
  270. __u32 fd;
  271. __u32 oflags;
  272. __u64 driver_data[0];
  273. };
  274. struct ib_uverbs_open_xrcd_resp {
  275. __u32 xrcd_handle;
  276. };
  277. struct ib_uverbs_close_xrcd {
  278. __u32 xrcd_handle;
  279. };
  280. struct ib_uverbs_reg_mr {
  281. __u64 response;
  282. __u64 start;
  283. __u64 length;
  284. __u64 hca_va;
  285. __u32 pd_handle;
  286. __u32 access_flags;
  287. __u64 driver_data[0];
  288. };
  289. struct ib_uverbs_reg_mr_resp {
  290. __u32 mr_handle;
  291. __u32 lkey;
  292. __u32 rkey;
  293. };
  294. struct ib_uverbs_rereg_mr {
  295. __u64 response;
  296. __u32 mr_handle;
  297. __u32 flags;
  298. __u64 start;
  299. __u64 length;
  300. __u64 hca_va;
  301. __u32 pd_handle;
  302. __u32 access_flags;
  303. };
  304. struct ib_uverbs_rereg_mr_resp {
  305. __u32 lkey;
  306. __u32 rkey;
  307. };
  308. struct ib_uverbs_dereg_mr {
  309. __u32 mr_handle;
  310. };
  311. struct ib_uverbs_alloc_mw {
  312. __u64 response;
  313. __u32 pd_handle;
  314. __u8 mw_type;
  315. __u8 reserved[3];
  316. };
  317. struct ib_uverbs_alloc_mw_resp {
  318. __u32 mw_handle;
  319. __u32 rkey;
  320. };
  321. struct ib_uverbs_dealloc_mw {
  322. __u32 mw_handle;
  323. };
  324. struct ib_uverbs_create_comp_channel {
  325. __u64 response;
  326. };
  327. struct ib_uverbs_create_comp_channel_resp {
  328. __u32 fd;
  329. };
  330. struct ib_uverbs_create_cq {
  331. __u64 response;
  332. __u64 user_handle;
  333. __u32 cqe;
  334. __u32 comp_vector;
  335. __s32 comp_channel;
  336. __u32 reserved;
  337. __u64 driver_data[0];
  338. };
  339. struct ib_uverbs_ex_create_cq {
  340. __u64 user_handle;
  341. __u32 cqe;
  342. __u32 comp_vector;
  343. __s32 comp_channel;
  344. __u32 comp_mask;
  345. __u32 flags;
  346. __u32 reserved;
  347. };
  348. struct ib_uverbs_create_cq_resp {
  349. __u32 cq_handle;
  350. __u32 cqe;
  351. };
  352. struct ib_uverbs_ex_create_cq_resp {
  353. struct ib_uverbs_create_cq_resp base;
  354. __u32 comp_mask;
  355. __u32 response_length;
  356. };
  357. struct ib_uverbs_resize_cq {
  358. __u64 response;
  359. __u32 cq_handle;
  360. __u32 cqe;
  361. __u64 driver_data[0];
  362. };
  363. struct ib_uverbs_resize_cq_resp {
  364. __u32 cqe;
  365. __u32 reserved;
  366. __u64 driver_data[0];
  367. };
  368. struct ib_uverbs_poll_cq {
  369. __u64 response;
  370. __u32 cq_handle;
  371. __u32 ne;
  372. };
  373. struct ib_uverbs_wc {
  374. __u64 wr_id;
  375. __u32 status;
  376. __u32 opcode;
  377. __u32 vendor_err;
  378. __u32 byte_len;
  379. union {
  380. __u32 imm_data;
  381. __u32 invalidate_rkey;
  382. } ex;
  383. __u32 qp_num;
  384. __u32 src_qp;
  385. __u32 wc_flags;
  386. __u16 pkey_index;
  387. __u16 slid;
  388. __u8 sl;
  389. __u8 dlid_path_bits;
  390. __u8 port_num;
  391. __u8 reserved;
  392. };
  393. struct ib_uverbs_poll_cq_resp {
  394. __u32 count;
  395. __u32 reserved;
  396. struct ib_uverbs_wc wc[0];
  397. };
  398. struct ib_uverbs_req_notify_cq {
  399. __u32 cq_handle;
  400. __u32 solicited_only;
  401. };
  402. struct ib_uverbs_destroy_cq {
  403. __u64 response;
  404. __u32 cq_handle;
  405. __u32 reserved;
  406. };
  407. struct ib_uverbs_destroy_cq_resp {
  408. __u32 comp_events_reported;
  409. __u32 async_events_reported;
  410. };
  411. struct ib_uverbs_global_route {
  412. __u8 dgid[16];
  413. __u32 flow_label;
  414. __u8 sgid_index;
  415. __u8 hop_limit;
  416. __u8 traffic_class;
  417. __u8 reserved;
  418. };
  419. struct ib_uverbs_ah_attr {
  420. struct ib_uverbs_global_route grh;
  421. __u16 dlid;
  422. __u8 sl;
  423. __u8 src_path_bits;
  424. __u8 static_rate;
  425. __u8 is_global;
  426. __u8 port_num;
  427. __u8 reserved;
  428. };
  429. struct ib_uverbs_qp_attr {
  430. __u32 qp_attr_mask;
  431. __u32 qp_state;
  432. __u32 cur_qp_state;
  433. __u32 path_mtu;
  434. __u32 path_mig_state;
  435. __u32 qkey;
  436. __u32 rq_psn;
  437. __u32 sq_psn;
  438. __u32 dest_qp_num;
  439. __u32 qp_access_flags;
  440. struct ib_uverbs_ah_attr ah_attr;
  441. struct ib_uverbs_ah_attr alt_ah_attr;
  442. /* ib_qp_cap */
  443. __u32 max_send_wr;
  444. __u32 max_recv_wr;
  445. __u32 max_send_sge;
  446. __u32 max_recv_sge;
  447. __u32 max_inline_data;
  448. __u16 pkey_index;
  449. __u16 alt_pkey_index;
  450. __u8 en_sqd_async_notify;
  451. __u8 sq_draining;
  452. __u8 max_rd_atomic;
  453. __u8 max_dest_rd_atomic;
  454. __u8 min_rnr_timer;
  455. __u8 port_num;
  456. __u8 timeout;
  457. __u8 retry_cnt;
  458. __u8 rnr_retry;
  459. __u8 alt_port_num;
  460. __u8 alt_timeout;
  461. __u8 reserved[5];
  462. };
  463. struct ib_uverbs_create_qp {
  464. __u64 response;
  465. __u64 user_handle;
  466. __u32 pd_handle;
  467. __u32 send_cq_handle;
  468. __u32 recv_cq_handle;
  469. __u32 srq_handle;
  470. __u32 max_send_wr;
  471. __u32 max_recv_wr;
  472. __u32 max_send_sge;
  473. __u32 max_recv_sge;
  474. __u32 max_inline_data;
  475. __u8 sq_sig_all;
  476. __u8 qp_type;
  477. __u8 is_srq;
  478. __u8 reserved;
  479. __u64 driver_data[0];
  480. };
  481. enum ib_uverbs_create_qp_mask {
  482. IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
  483. };
  484. enum {
  485. IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
  486. };
  487. struct ib_uverbs_ex_create_qp {
  488. __u64 user_handle;
  489. __u32 pd_handle;
  490. __u32 send_cq_handle;
  491. __u32 recv_cq_handle;
  492. __u32 srq_handle;
  493. __u32 max_send_wr;
  494. __u32 max_recv_wr;
  495. __u32 max_send_sge;
  496. __u32 max_recv_sge;
  497. __u32 max_inline_data;
  498. __u8 sq_sig_all;
  499. __u8 qp_type;
  500. __u8 is_srq;
  501. __u8 reserved;
  502. __u32 comp_mask;
  503. __u32 create_flags;
  504. __u32 rwq_ind_tbl_handle;
  505. __u32 reserved1;
  506. };
  507. struct ib_uverbs_open_qp {
  508. __u64 response;
  509. __u64 user_handle;
  510. __u32 pd_handle;
  511. __u32 qpn;
  512. __u8 qp_type;
  513. __u8 reserved[7];
  514. __u64 driver_data[0];
  515. };
  516. /* also used for open response */
  517. struct ib_uverbs_create_qp_resp {
  518. __u32 qp_handle;
  519. __u32 qpn;
  520. __u32 max_send_wr;
  521. __u32 max_recv_wr;
  522. __u32 max_send_sge;
  523. __u32 max_recv_sge;
  524. __u32 max_inline_data;
  525. __u32 reserved;
  526. };
  527. struct ib_uverbs_ex_create_qp_resp {
  528. struct ib_uverbs_create_qp_resp base;
  529. __u32 comp_mask;
  530. __u32 response_length;
  531. };
  532. /*
  533. * This struct needs to remain a multiple of 8 bytes to keep the
  534. * alignment of the modify QP parameters.
  535. */
  536. struct ib_uverbs_qp_dest {
  537. __u8 dgid[16];
  538. __u32 flow_label;
  539. __u16 dlid;
  540. __u16 reserved;
  541. __u8 sgid_index;
  542. __u8 hop_limit;
  543. __u8 traffic_class;
  544. __u8 sl;
  545. __u8 src_path_bits;
  546. __u8 static_rate;
  547. __u8 is_global;
  548. __u8 port_num;
  549. };
  550. struct ib_uverbs_query_qp {
  551. __u64 response;
  552. __u32 qp_handle;
  553. __u32 attr_mask;
  554. __u64 driver_data[0];
  555. };
  556. struct ib_uverbs_query_qp_resp {
  557. struct ib_uverbs_qp_dest dest;
  558. struct ib_uverbs_qp_dest alt_dest;
  559. __u32 max_send_wr;
  560. __u32 max_recv_wr;
  561. __u32 max_send_sge;
  562. __u32 max_recv_sge;
  563. __u32 max_inline_data;
  564. __u32 qkey;
  565. __u32 rq_psn;
  566. __u32 sq_psn;
  567. __u32 dest_qp_num;
  568. __u32 qp_access_flags;
  569. __u16 pkey_index;
  570. __u16 alt_pkey_index;
  571. __u8 qp_state;
  572. __u8 cur_qp_state;
  573. __u8 path_mtu;
  574. __u8 path_mig_state;
  575. __u8 sq_draining;
  576. __u8 max_rd_atomic;
  577. __u8 max_dest_rd_atomic;
  578. __u8 min_rnr_timer;
  579. __u8 port_num;
  580. __u8 timeout;
  581. __u8 retry_cnt;
  582. __u8 rnr_retry;
  583. __u8 alt_port_num;
  584. __u8 alt_timeout;
  585. __u8 sq_sig_all;
  586. __u8 reserved[5];
  587. __u64 driver_data[0];
  588. };
  589. struct ib_uverbs_modify_qp {
  590. struct ib_uverbs_qp_dest dest;
  591. struct ib_uverbs_qp_dest alt_dest;
  592. __u32 qp_handle;
  593. __u32 attr_mask;
  594. __u32 qkey;
  595. __u32 rq_psn;
  596. __u32 sq_psn;
  597. __u32 dest_qp_num;
  598. __u32 qp_access_flags;
  599. __u16 pkey_index;
  600. __u16 alt_pkey_index;
  601. __u8 qp_state;
  602. __u8 cur_qp_state;
  603. __u8 path_mtu;
  604. __u8 path_mig_state;
  605. __u8 en_sqd_async_notify;
  606. __u8 max_rd_atomic;
  607. __u8 max_dest_rd_atomic;
  608. __u8 min_rnr_timer;
  609. __u8 port_num;
  610. __u8 timeout;
  611. __u8 retry_cnt;
  612. __u8 rnr_retry;
  613. __u8 alt_port_num;
  614. __u8 alt_timeout;
  615. __u8 reserved[2];
  616. __u64 driver_data[0];
  617. };
  618. struct ib_uverbs_modify_qp_resp {
  619. };
  620. struct ib_uverbs_destroy_qp {
  621. __u64 response;
  622. __u32 qp_handle;
  623. __u32 reserved;
  624. };
  625. struct ib_uverbs_destroy_qp_resp {
  626. __u32 events_reported;
  627. };
  628. /*
  629. * The ib_uverbs_sge structure isn't used anywhere, since we assume
  630. * the ib_sge structure is packed the same way on 32-bit and 64-bit
  631. * architectures in both kernel and user space. It's just here to
  632. * document the ABI.
  633. */
  634. struct ib_uverbs_sge {
  635. __u64 addr;
  636. __u32 length;
  637. __u32 lkey;
  638. };
  639. struct ib_uverbs_send_wr {
  640. __u64 wr_id;
  641. __u32 num_sge;
  642. __u32 opcode;
  643. __u32 send_flags;
  644. union {
  645. __u32 imm_data;
  646. __u32 invalidate_rkey;
  647. } ex;
  648. union {
  649. struct {
  650. __u64 remote_addr;
  651. __u32 rkey;
  652. __u32 reserved;
  653. } rdma;
  654. struct {
  655. __u64 remote_addr;
  656. __u64 compare_add;
  657. __u64 swap;
  658. __u32 rkey;
  659. __u32 reserved;
  660. } atomic;
  661. struct {
  662. __u32 ah;
  663. __u32 remote_qpn;
  664. __u32 remote_qkey;
  665. __u32 reserved;
  666. } ud;
  667. } wr;
  668. };
  669. struct ib_uverbs_post_send {
  670. __u64 response;
  671. __u32 qp_handle;
  672. __u32 wr_count;
  673. __u32 sge_count;
  674. __u32 wqe_size;
  675. struct ib_uverbs_send_wr send_wr[0];
  676. };
  677. struct ib_uverbs_post_send_resp {
  678. __u32 bad_wr;
  679. };
  680. struct ib_uverbs_recv_wr {
  681. __u64 wr_id;
  682. __u32 num_sge;
  683. __u32 reserved;
  684. };
  685. struct ib_uverbs_post_recv {
  686. __u64 response;
  687. __u32 qp_handle;
  688. __u32 wr_count;
  689. __u32 sge_count;
  690. __u32 wqe_size;
  691. struct ib_uverbs_recv_wr recv_wr[0];
  692. };
  693. struct ib_uverbs_post_recv_resp {
  694. __u32 bad_wr;
  695. };
  696. struct ib_uverbs_post_srq_recv {
  697. __u64 response;
  698. __u32 srq_handle;
  699. __u32 wr_count;
  700. __u32 sge_count;
  701. __u32 wqe_size;
  702. struct ib_uverbs_recv_wr recv[0];
  703. };
  704. struct ib_uverbs_post_srq_recv_resp {
  705. __u32 bad_wr;
  706. };
  707. struct ib_uverbs_create_ah {
  708. __u64 response;
  709. __u64 user_handle;
  710. __u32 pd_handle;
  711. __u32 reserved;
  712. struct ib_uverbs_ah_attr attr;
  713. };
  714. struct ib_uverbs_create_ah_resp {
  715. __u32 ah_handle;
  716. };
  717. struct ib_uverbs_destroy_ah {
  718. __u32 ah_handle;
  719. };
  720. struct ib_uverbs_attach_mcast {
  721. __u8 gid[16];
  722. __u32 qp_handle;
  723. __u16 mlid;
  724. __u16 reserved;
  725. __u64 driver_data[0];
  726. };
  727. struct ib_uverbs_detach_mcast {
  728. __u8 gid[16];
  729. __u32 qp_handle;
  730. __u16 mlid;
  731. __u16 reserved;
  732. __u64 driver_data[0];
  733. };
  734. struct ib_uverbs_flow_spec_hdr {
  735. __u32 type;
  736. __u16 size;
  737. __u16 reserved;
  738. /* followed by flow_spec */
  739. __u64 flow_spec_data[0];
  740. };
  741. struct ib_uverbs_flow_eth_filter {
  742. __u8 dst_mac[6];
  743. __u8 src_mac[6];
  744. __be16 ether_type;
  745. __be16 vlan_tag;
  746. };
  747. struct ib_uverbs_flow_spec_eth {
  748. union {
  749. struct ib_uverbs_flow_spec_hdr hdr;
  750. struct {
  751. __u32 type;
  752. __u16 size;
  753. __u16 reserved;
  754. };
  755. };
  756. struct ib_uverbs_flow_eth_filter val;
  757. struct ib_uverbs_flow_eth_filter mask;
  758. };
  759. struct ib_uverbs_flow_ipv4_filter {
  760. __be32 src_ip;
  761. __be32 dst_ip;
  762. __u8 proto;
  763. __u8 tos;
  764. __u8 ttl;
  765. __u8 flags;
  766. };
  767. struct ib_uverbs_flow_spec_ipv4 {
  768. union {
  769. struct ib_uverbs_flow_spec_hdr hdr;
  770. struct {
  771. __u32 type;
  772. __u16 size;
  773. __u16 reserved;
  774. };
  775. };
  776. struct ib_uverbs_flow_ipv4_filter val;
  777. struct ib_uverbs_flow_ipv4_filter mask;
  778. };
  779. struct ib_uverbs_flow_tcp_udp_filter {
  780. __be16 dst_port;
  781. __be16 src_port;
  782. };
  783. struct ib_uverbs_flow_spec_tcp_udp {
  784. union {
  785. struct ib_uverbs_flow_spec_hdr hdr;
  786. struct {
  787. __u32 type;
  788. __u16 size;
  789. __u16 reserved;
  790. };
  791. };
  792. struct ib_uverbs_flow_tcp_udp_filter val;
  793. struct ib_uverbs_flow_tcp_udp_filter mask;
  794. };
  795. struct ib_uverbs_flow_ipv6_filter {
  796. __u8 src_ip[16];
  797. __u8 dst_ip[16];
  798. __be32 flow_label;
  799. __u8 next_hdr;
  800. __u8 traffic_class;
  801. __u8 hop_limit;
  802. __u8 reserved;
  803. };
  804. struct ib_uverbs_flow_spec_ipv6 {
  805. union {
  806. struct ib_uverbs_flow_spec_hdr hdr;
  807. struct {
  808. __u32 type;
  809. __u16 size;
  810. __u16 reserved;
  811. };
  812. };
  813. struct ib_uverbs_flow_ipv6_filter val;
  814. struct ib_uverbs_flow_ipv6_filter mask;
  815. };
  816. struct ib_uverbs_flow_attr {
  817. __u32 type;
  818. __u16 size;
  819. __u16 priority;
  820. __u8 num_of_specs;
  821. __u8 reserved[2];
  822. __u8 port;
  823. __u32 flags;
  824. /* Following are the optional layers according to user request
  825. * struct ib_flow_spec_xxx
  826. * struct ib_flow_spec_yyy
  827. */
  828. struct ib_uverbs_flow_spec_hdr flow_specs[0];
  829. };
  830. struct ib_uverbs_create_flow {
  831. __u32 comp_mask;
  832. __u32 qp_handle;
  833. struct ib_uverbs_flow_attr flow_attr;
  834. };
  835. struct ib_uverbs_create_flow_resp {
  836. __u32 comp_mask;
  837. __u32 flow_handle;
  838. };
  839. struct ib_uverbs_destroy_flow {
  840. __u32 comp_mask;
  841. __u32 flow_handle;
  842. };
  843. struct ib_uverbs_create_srq {
  844. __u64 response;
  845. __u64 user_handle;
  846. __u32 pd_handle;
  847. __u32 max_wr;
  848. __u32 max_sge;
  849. __u32 srq_limit;
  850. __u64 driver_data[0];
  851. };
  852. struct ib_uverbs_create_xsrq {
  853. __u64 response;
  854. __u64 user_handle;
  855. __u32 srq_type;
  856. __u32 pd_handle;
  857. __u32 max_wr;
  858. __u32 max_sge;
  859. __u32 srq_limit;
  860. __u32 reserved;
  861. __u32 xrcd_handle;
  862. __u32 cq_handle;
  863. __u64 driver_data[0];
  864. };
  865. struct ib_uverbs_create_srq_resp {
  866. __u32 srq_handle;
  867. __u32 max_wr;
  868. __u32 max_sge;
  869. __u32 srqn;
  870. };
  871. struct ib_uverbs_modify_srq {
  872. __u32 srq_handle;
  873. __u32 attr_mask;
  874. __u32 max_wr;
  875. __u32 srq_limit;
  876. __u64 driver_data[0];
  877. };
  878. struct ib_uverbs_query_srq {
  879. __u64 response;
  880. __u32 srq_handle;
  881. __u32 reserved;
  882. __u64 driver_data[0];
  883. };
  884. struct ib_uverbs_query_srq_resp {
  885. __u32 max_wr;
  886. __u32 max_sge;
  887. __u32 srq_limit;
  888. __u32 reserved;
  889. };
  890. struct ib_uverbs_destroy_srq {
  891. __u64 response;
  892. __u32 srq_handle;
  893. __u32 reserved;
  894. };
  895. struct ib_uverbs_destroy_srq_resp {
  896. __u32 events_reported;
  897. };
  898. struct ib_uverbs_ex_create_wq {
  899. __u32 comp_mask;
  900. __u32 wq_type;
  901. __u64 user_handle;
  902. __u32 pd_handle;
  903. __u32 cq_handle;
  904. __u32 max_wr;
  905. __u32 max_sge;
  906. };
  907. struct ib_uverbs_ex_create_wq_resp {
  908. __u32 comp_mask;
  909. __u32 response_length;
  910. __u32 wq_handle;
  911. __u32 max_wr;
  912. __u32 max_sge;
  913. __u32 wqn;
  914. };
  915. struct ib_uverbs_ex_destroy_wq {
  916. __u32 comp_mask;
  917. __u32 wq_handle;
  918. };
  919. struct ib_uverbs_ex_destroy_wq_resp {
  920. __u32 comp_mask;
  921. __u32 response_length;
  922. __u32 events_reported;
  923. __u32 reserved;
  924. };
  925. struct ib_uverbs_ex_modify_wq {
  926. __u32 attr_mask;
  927. __u32 wq_handle;
  928. __u32 wq_state;
  929. __u32 curr_wq_state;
  930. };
  931. /* Prevent memory allocation rather than max expected size */
  932. #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
  933. struct ib_uverbs_ex_create_rwq_ind_table {
  934. __u32 comp_mask;
  935. __u32 log_ind_tbl_size;
  936. /* Following are the wq handles according to log_ind_tbl_size
  937. * wq_handle1
  938. * wq_handle2
  939. */
  940. __u32 wq_handles[0];
  941. };
  942. struct ib_uverbs_ex_create_rwq_ind_table_resp {
  943. __u32 comp_mask;
  944. __u32 response_length;
  945. __u32 ind_tbl_handle;
  946. __u32 ind_tbl_num;
  947. };
  948. struct ib_uverbs_ex_destroy_rwq_ind_table {
  949. __u32 comp_mask;
  950. __u32 ind_tbl_handle;
  951. };
  952. #endif /* IB_USER_VERBS_H */