ib_user_verbs.h 23 KB

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