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