ib_user_verbs.h 22 KB

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