ib_user_verbs.h 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  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_tunnel_filter {
  851. __be32 tunnel_id;
  852. };
  853. struct ib_uverbs_flow_spec_tunnel {
  854. union {
  855. struct ib_uverbs_flow_spec_hdr hdr;
  856. struct {
  857. __u32 type;
  858. __u16 size;
  859. __u16 reserved;
  860. };
  861. };
  862. struct ib_uverbs_flow_tunnel_filter val;
  863. struct ib_uverbs_flow_tunnel_filter mask;
  864. };
  865. struct ib_uverbs_flow_attr {
  866. __u32 type;
  867. __u16 size;
  868. __u16 priority;
  869. __u8 num_of_specs;
  870. __u8 reserved[2];
  871. __u8 port;
  872. __u32 flags;
  873. /* Following are the optional layers according to user request
  874. * struct ib_flow_spec_xxx
  875. * struct ib_flow_spec_yyy
  876. */
  877. struct ib_uverbs_flow_spec_hdr flow_specs[0];
  878. };
  879. struct ib_uverbs_create_flow {
  880. __u32 comp_mask;
  881. __u32 qp_handle;
  882. struct ib_uverbs_flow_attr flow_attr;
  883. };
  884. struct ib_uverbs_create_flow_resp {
  885. __u32 comp_mask;
  886. __u32 flow_handle;
  887. };
  888. struct ib_uverbs_destroy_flow {
  889. __u32 comp_mask;
  890. __u32 flow_handle;
  891. };
  892. struct ib_uverbs_create_srq {
  893. __u64 response;
  894. __u64 user_handle;
  895. __u32 pd_handle;
  896. __u32 max_wr;
  897. __u32 max_sge;
  898. __u32 srq_limit;
  899. __u64 driver_data[0];
  900. };
  901. struct ib_uverbs_create_xsrq {
  902. __u64 response;
  903. __u64 user_handle;
  904. __u32 srq_type;
  905. __u32 pd_handle;
  906. __u32 max_wr;
  907. __u32 max_sge;
  908. __u32 srq_limit;
  909. __u32 reserved;
  910. __u32 xrcd_handle;
  911. __u32 cq_handle;
  912. __u64 driver_data[0];
  913. };
  914. struct ib_uverbs_create_srq_resp {
  915. __u32 srq_handle;
  916. __u32 max_wr;
  917. __u32 max_sge;
  918. __u32 srqn;
  919. };
  920. struct ib_uverbs_modify_srq {
  921. __u32 srq_handle;
  922. __u32 attr_mask;
  923. __u32 max_wr;
  924. __u32 srq_limit;
  925. __u64 driver_data[0];
  926. };
  927. struct ib_uverbs_query_srq {
  928. __u64 response;
  929. __u32 srq_handle;
  930. __u32 reserved;
  931. __u64 driver_data[0];
  932. };
  933. struct ib_uverbs_query_srq_resp {
  934. __u32 max_wr;
  935. __u32 max_sge;
  936. __u32 srq_limit;
  937. __u32 reserved;
  938. };
  939. struct ib_uverbs_destroy_srq {
  940. __u64 response;
  941. __u32 srq_handle;
  942. __u32 reserved;
  943. };
  944. struct ib_uverbs_destroy_srq_resp {
  945. __u32 events_reported;
  946. };
  947. struct ib_uverbs_ex_create_wq {
  948. __u32 comp_mask;
  949. __u32 wq_type;
  950. __u64 user_handle;
  951. __u32 pd_handle;
  952. __u32 cq_handle;
  953. __u32 max_wr;
  954. __u32 max_sge;
  955. __u32 create_flags; /* Use enum ib_wq_flags */
  956. __u32 reserved;
  957. };
  958. struct ib_uverbs_ex_create_wq_resp {
  959. __u32 comp_mask;
  960. __u32 response_length;
  961. __u32 wq_handle;
  962. __u32 max_wr;
  963. __u32 max_sge;
  964. __u32 wqn;
  965. };
  966. struct ib_uverbs_ex_destroy_wq {
  967. __u32 comp_mask;
  968. __u32 wq_handle;
  969. };
  970. struct ib_uverbs_ex_destroy_wq_resp {
  971. __u32 comp_mask;
  972. __u32 response_length;
  973. __u32 events_reported;
  974. __u32 reserved;
  975. };
  976. struct ib_uverbs_ex_modify_wq {
  977. __u32 attr_mask;
  978. __u32 wq_handle;
  979. __u32 wq_state;
  980. __u32 curr_wq_state;
  981. __u32 flags; /* Use enum ib_wq_flags */
  982. __u32 flags_mask; /* Use enum ib_wq_flags */
  983. };
  984. /* Prevent memory allocation rather than max expected size */
  985. #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
  986. struct ib_uverbs_ex_create_rwq_ind_table {
  987. __u32 comp_mask;
  988. __u32 log_ind_tbl_size;
  989. /* Following are the wq handles according to log_ind_tbl_size
  990. * wq_handle1
  991. * wq_handle2
  992. */
  993. __u32 wq_handles[0];
  994. };
  995. struct ib_uverbs_ex_create_rwq_ind_table_resp {
  996. __u32 comp_mask;
  997. __u32 response_length;
  998. __u32 ind_tbl_handle;
  999. __u32 ind_tbl_num;
  1000. };
  1001. struct ib_uverbs_ex_destroy_rwq_ind_table {
  1002. __u32 comp_mask;
  1003. __u32 ind_tbl_handle;
  1004. };
  1005. #endif /* IB_USER_VERBS_H */