ib_user_verbs.h 22 KB

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