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