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