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