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