Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / include / uapi / rdma / ib_user_verbs.h
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 struct ib_uverbs_ex_query_device {
206         __u32 comp_mask;
207         __u32 reserved;
208 };
209
210 struct ib_uverbs_odp_caps {
211         __u64 general_caps;
212         struct {
213                 __u32 rc_odp_caps;
214                 __u32 uc_odp_caps;
215                 __u32 ud_odp_caps;
216         } per_transport_caps;
217         __u32 reserved;
218 };
219
220 struct ib_uverbs_ex_query_device_resp {
221         struct ib_uverbs_query_device_resp base;
222         __u32 comp_mask;
223         __u32 response_length;
224         struct ib_uverbs_odp_caps odp_caps;
225 };
226
227 struct ib_uverbs_query_port {
228         __u64 response;
229         __u8  port_num;
230         __u8  reserved[7];
231         __u64 driver_data[0];
232 };
233
234 struct ib_uverbs_query_port_resp {
235         __u32 port_cap_flags;
236         __u32 max_msg_sz;
237         __u32 bad_pkey_cntr;
238         __u32 qkey_viol_cntr;
239         __u32 gid_tbl_len;
240         __u16 pkey_tbl_len;
241         __u16 lid;
242         __u16 sm_lid;
243         __u8  state;
244         __u8  max_mtu;
245         __u8  active_mtu;
246         __u8  lmc;
247         __u8  max_vl_num;
248         __u8  sm_sl;
249         __u8  subnet_timeout;
250         __u8  init_type_reply;
251         __u8  active_width;
252         __u8  active_speed;
253         __u8  phys_state;
254         __u8  link_layer;
255         __u8  reserved[2];
256 };
257
258 struct ib_uverbs_alloc_pd {
259         __u64 response;
260         __u64 driver_data[0];
261 };
262
263 struct ib_uverbs_alloc_pd_resp {
264         __u32 pd_handle;
265 };
266
267 struct ib_uverbs_dealloc_pd {
268         __u32 pd_handle;
269 };
270
271 struct ib_uverbs_open_xrcd {
272         __u64 response;
273         __u32 fd;
274         __u32 oflags;
275         __u64 driver_data[0];
276 };
277
278 struct ib_uverbs_open_xrcd_resp {
279         __u32 xrcd_handle;
280 };
281
282 struct ib_uverbs_close_xrcd {
283         __u32 xrcd_handle;
284 };
285
286 struct ib_uverbs_reg_mr {
287         __u64 response;
288         __u64 start;
289         __u64 length;
290         __u64 hca_va;
291         __u32 pd_handle;
292         __u32 access_flags;
293         __u64 driver_data[0];
294 };
295
296 struct ib_uverbs_reg_mr_resp {
297         __u32 mr_handle;
298         __u32 lkey;
299         __u32 rkey;
300 };
301
302 struct ib_uverbs_rereg_mr {
303         __u64 response;
304         __u32 mr_handle;
305         __u32 flags;
306         __u64 start;
307         __u64 length;
308         __u64 hca_va;
309         __u32 pd_handle;
310         __u32 access_flags;
311 };
312
313 struct ib_uverbs_rereg_mr_resp {
314         __u32 lkey;
315         __u32 rkey;
316 };
317
318 struct ib_uverbs_dereg_mr {
319         __u32 mr_handle;
320 };
321
322 struct ib_uverbs_alloc_mw {
323         __u64 response;
324         __u32 pd_handle;
325         __u8  mw_type;
326         __u8  reserved[3];
327 };
328
329 struct ib_uverbs_alloc_mw_resp {
330         __u32 mw_handle;
331         __u32 rkey;
332 };
333
334 struct ib_uverbs_dealloc_mw {
335         __u32 mw_handle;
336 };
337
338 struct ib_uverbs_create_comp_channel {
339         __u64 response;
340 };
341
342 struct ib_uverbs_create_comp_channel_resp {
343         __u32 fd;
344 };
345
346 struct ib_uverbs_create_cq {
347         __u64 response;
348         __u64 user_handle;
349         __u32 cqe;
350         __u32 comp_vector;
351         __s32 comp_channel;
352         __u32 reserved;
353         __u64 driver_data[0];
354 };
355
356 struct ib_uverbs_create_cq_resp {
357         __u32 cq_handle;
358         __u32 cqe;
359 };
360
361 struct ib_uverbs_resize_cq {
362         __u64 response;
363         __u32 cq_handle;
364         __u32 cqe;
365         __u64 driver_data[0];
366 };
367
368 struct ib_uverbs_resize_cq_resp {
369         __u32 cqe;
370         __u32 reserved;
371         __u64 driver_data[0];
372 };
373
374 struct ib_uverbs_poll_cq {
375         __u64 response;
376         __u32 cq_handle;
377         __u32 ne;
378 };
379
380 struct ib_uverbs_wc {
381         __u64 wr_id;
382         __u32 status;
383         __u32 opcode;
384         __u32 vendor_err;
385         __u32 byte_len;
386         union {
387                 __u32 imm_data;
388                 __u32 invalidate_rkey;
389         } ex;
390         __u32 qp_num;
391         __u32 src_qp;
392         __u32 wc_flags;
393         __u16 pkey_index;
394         __u16 slid;
395         __u8 sl;
396         __u8 dlid_path_bits;
397         __u8 port_num;
398         __u8 reserved;
399 };
400
401 struct ib_uverbs_poll_cq_resp {
402         __u32 count;
403         __u32 reserved;
404         struct ib_uverbs_wc wc[0];
405 };
406
407 struct ib_uverbs_req_notify_cq {
408         __u32 cq_handle;
409         __u32 solicited_only;
410 };
411
412 struct ib_uverbs_destroy_cq {
413         __u64 response;
414         __u32 cq_handle;
415         __u32 reserved;
416 };
417
418 struct ib_uverbs_destroy_cq_resp {
419         __u32 comp_events_reported;
420         __u32 async_events_reported;
421 };
422
423 struct ib_uverbs_global_route {
424         __u8  dgid[16];
425         __u32 flow_label;
426         __u8  sgid_index;
427         __u8  hop_limit;
428         __u8  traffic_class;
429         __u8  reserved;
430 };
431
432 struct ib_uverbs_ah_attr {
433         struct ib_uverbs_global_route grh;
434         __u16 dlid;
435         __u8  sl;
436         __u8  src_path_bits;
437         __u8  static_rate;
438         __u8  is_global;
439         __u8  port_num;
440         __u8  reserved;
441 };
442
443 struct ib_uverbs_qp_attr {
444         __u32   qp_attr_mask;
445         __u32   qp_state;
446         __u32   cur_qp_state;
447         __u32   path_mtu;
448         __u32   path_mig_state;
449         __u32   qkey;
450         __u32   rq_psn;
451         __u32   sq_psn;
452         __u32   dest_qp_num;
453         __u32   qp_access_flags;
454
455         struct ib_uverbs_ah_attr ah_attr;
456         struct ib_uverbs_ah_attr alt_ah_attr;
457
458         /* ib_qp_cap */
459         __u32   max_send_wr;
460         __u32   max_recv_wr;
461         __u32   max_send_sge;
462         __u32   max_recv_sge;
463         __u32   max_inline_data;
464
465         __u16   pkey_index;
466         __u16   alt_pkey_index;
467         __u8    en_sqd_async_notify;
468         __u8    sq_draining;
469         __u8    max_rd_atomic;
470         __u8    max_dest_rd_atomic;
471         __u8    min_rnr_timer;
472         __u8    port_num;
473         __u8    timeout;
474         __u8    retry_cnt;
475         __u8    rnr_retry;
476         __u8    alt_port_num;
477         __u8    alt_timeout;
478         __u8    reserved[5];
479 };
480
481 struct ib_uverbs_create_qp {
482         __u64 response;
483         __u64 user_handle;
484         __u32 pd_handle;
485         __u32 send_cq_handle;
486         __u32 recv_cq_handle;
487         __u32 srq_handle;
488         __u32 max_send_wr;
489         __u32 max_recv_wr;
490         __u32 max_send_sge;
491         __u32 max_recv_sge;
492         __u32 max_inline_data;
493         __u8  sq_sig_all;
494         __u8  qp_type;
495         __u8  is_srq;
496         __u8  reserved;
497         __u64 driver_data[0];
498 };
499
500 struct ib_uverbs_open_qp {
501         __u64 response;
502         __u64 user_handle;
503         __u32 pd_handle;
504         __u32 qpn;
505         __u8  qp_type;
506         __u8  reserved[7];
507         __u64 driver_data[0];
508 };
509
510 /* also used for open response */
511 struct ib_uverbs_create_qp_resp {
512         __u32 qp_handle;
513         __u32 qpn;
514         __u32 max_send_wr;
515         __u32 max_recv_wr;
516         __u32 max_send_sge;
517         __u32 max_recv_sge;
518         __u32 max_inline_data;
519         __u32 reserved;
520 };
521
522 /*
523  * This struct needs to remain a multiple of 8 bytes to keep the
524  * alignment of the modify QP parameters.
525  */
526 struct ib_uverbs_qp_dest {
527         __u8  dgid[16];
528         __u32 flow_label;
529         __u16 dlid;
530         __u16 reserved;
531         __u8  sgid_index;
532         __u8  hop_limit;
533         __u8  traffic_class;
534         __u8  sl;
535         __u8  src_path_bits;
536         __u8  static_rate;
537         __u8  is_global;
538         __u8  port_num;
539 };
540
541 struct ib_uverbs_query_qp {
542         __u64 response;
543         __u32 qp_handle;
544         __u32 attr_mask;
545         __u64 driver_data[0];
546 };
547
548 struct ib_uverbs_query_qp_resp {
549         struct ib_uverbs_qp_dest dest;
550         struct ib_uverbs_qp_dest alt_dest;
551         __u32 max_send_wr;
552         __u32 max_recv_wr;
553         __u32 max_send_sge;
554         __u32 max_recv_sge;
555         __u32 max_inline_data;
556         __u32 qkey;
557         __u32 rq_psn;
558         __u32 sq_psn;
559         __u32 dest_qp_num;
560         __u32 qp_access_flags;
561         __u16 pkey_index;
562         __u16 alt_pkey_index;
563         __u8  qp_state;
564         __u8  cur_qp_state;
565         __u8  path_mtu;
566         __u8  path_mig_state;
567         __u8  sq_draining;
568         __u8  max_rd_atomic;
569         __u8  max_dest_rd_atomic;
570         __u8  min_rnr_timer;
571         __u8  port_num;
572         __u8  timeout;
573         __u8  retry_cnt;
574         __u8  rnr_retry;
575         __u8  alt_port_num;
576         __u8  alt_timeout;
577         __u8  sq_sig_all;
578         __u8  reserved[5];
579         __u64 driver_data[0];
580 };
581
582 struct ib_uverbs_modify_qp {
583         struct ib_uverbs_qp_dest dest;
584         struct ib_uverbs_qp_dest alt_dest;
585         __u32 qp_handle;
586         __u32 attr_mask;
587         __u32 qkey;
588         __u32 rq_psn;
589         __u32 sq_psn;
590         __u32 dest_qp_num;
591         __u32 qp_access_flags;
592         __u16 pkey_index;
593         __u16 alt_pkey_index;
594         __u8  qp_state;
595         __u8  cur_qp_state;
596         __u8  path_mtu;
597         __u8  path_mig_state;
598         __u8  en_sqd_async_notify;
599         __u8  max_rd_atomic;
600         __u8  max_dest_rd_atomic;
601         __u8  min_rnr_timer;
602         __u8  port_num;
603         __u8  timeout;
604         __u8  retry_cnt;
605         __u8  rnr_retry;
606         __u8  alt_port_num;
607         __u8  alt_timeout;
608         __u8  reserved[2];
609         __u64 driver_data[0];
610 };
611
612 struct ib_uverbs_modify_qp_resp {
613 };
614
615 struct ib_uverbs_destroy_qp {
616         __u64 response;
617         __u32 qp_handle;
618         __u32 reserved;
619 };
620
621 struct ib_uverbs_destroy_qp_resp {
622         __u32 events_reported;
623 };
624
625 /*
626  * The ib_uverbs_sge structure isn't used anywhere, since we assume
627  * the ib_sge structure is packed the same way on 32-bit and 64-bit
628  * architectures in both kernel and user space.  It's just here to
629  * document the ABI.
630  */
631 struct ib_uverbs_sge {
632         __u64 addr;
633         __u32 length;
634         __u32 lkey;
635 };
636
637 struct ib_uverbs_send_wr {
638         __u64 wr_id;
639         __u32 num_sge;
640         __u32 opcode;
641         __u32 send_flags;
642         union {
643                 __u32 imm_data;
644                 __u32 invalidate_rkey;
645         } ex;
646         union {
647                 struct {
648                         __u64 remote_addr;
649                         __u32 rkey;
650                         __u32 reserved;
651                 } rdma;
652                 struct {
653                         __u64 remote_addr;
654                         __u64 compare_add;
655                         __u64 swap;
656                         __u32 rkey;
657                         __u32 reserved;
658                 } atomic;
659                 struct {
660                         __u32 ah;
661                         __u32 remote_qpn;
662                         __u32 remote_qkey;
663                         __u32 reserved;
664                 } ud;
665         } wr;
666 };
667
668 struct ib_uverbs_post_send {
669         __u64 response;
670         __u32 qp_handle;
671         __u32 wr_count;
672         __u32 sge_count;
673         __u32 wqe_size;
674         struct ib_uverbs_send_wr send_wr[0];
675 };
676
677 struct ib_uverbs_post_send_resp {
678         __u32 bad_wr;
679 };
680
681 struct ib_uverbs_recv_wr {
682         __u64 wr_id;
683         __u32 num_sge;
684         __u32 reserved;
685 };
686
687 struct ib_uverbs_post_recv {
688         __u64 response;
689         __u32 qp_handle;
690         __u32 wr_count;
691         __u32 sge_count;
692         __u32 wqe_size;
693         struct ib_uverbs_recv_wr recv_wr[0];
694 };
695
696 struct ib_uverbs_post_recv_resp {
697         __u32 bad_wr;
698 };
699
700 struct ib_uverbs_post_srq_recv {
701         __u64 response;
702         __u32 srq_handle;
703         __u32 wr_count;
704         __u32 sge_count;
705         __u32 wqe_size;
706         struct ib_uverbs_recv_wr recv[0];
707 };
708
709 struct ib_uverbs_post_srq_recv_resp {
710         __u32 bad_wr;
711 };
712
713 struct ib_uverbs_create_ah {
714         __u64 response;
715         __u64 user_handle;
716         __u32 pd_handle;
717         __u32 reserved;
718         struct ib_uverbs_ah_attr attr;
719 };
720
721 struct ib_uverbs_create_ah_resp {
722         __u32 ah_handle;
723 };
724
725 struct ib_uverbs_destroy_ah {
726         __u32 ah_handle;
727 };
728
729 struct ib_uverbs_attach_mcast {
730         __u8  gid[16];
731         __u32 qp_handle;
732         __u16 mlid;
733         __u16 reserved;
734         __u64 driver_data[0];
735 };
736
737 struct ib_uverbs_detach_mcast {
738         __u8  gid[16];
739         __u32 qp_handle;
740         __u16 mlid;
741         __u16 reserved;
742         __u64 driver_data[0];
743 };
744
745 struct ib_uverbs_flow_spec_hdr {
746         __u32 type;
747         __u16 size;
748         __u16 reserved;
749         /* followed by flow_spec */
750         __u64 flow_spec_data[0];
751 };
752
753 struct ib_uverbs_flow_eth_filter {
754         __u8  dst_mac[6];
755         __u8  src_mac[6];
756         __be16 ether_type;
757         __be16 vlan_tag;
758 };
759
760 struct ib_uverbs_flow_spec_eth {
761         union {
762                 struct ib_uverbs_flow_spec_hdr hdr;
763                 struct {
764                         __u32 type;
765                         __u16 size;
766                         __u16 reserved;
767                 };
768         };
769         struct ib_uverbs_flow_eth_filter val;
770         struct ib_uverbs_flow_eth_filter mask;
771 };
772
773 struct ib_uverbs_flow_ipv4_filter {
774         __be32 src_ip;
775         __be32 dst_ip;
776 };
777
778 struct ib_uverbs_flow_spec_ipv4 {
779         union {
780                 struct ib_uverbs_flow_spec_hdr hdr;
781                 struct {
782                         __u32 type;
783                         __u16 size;
784                         __u16 reserved;
785                 };
786         };
787         struct ib_uverbs_flow_ipv4_filter val;
788         struct ib_uverbs_flow_ipv4_filter mask;
789 };
790
791 struct ib_uverbs_flow_tcp_udp_filter {
792         __be16 dst_port;
793         __be16 src_port;
794 };
795
796 struct ib_uverbs_flow_spec_tcp_udp {
797         union {
798                 struct ib_uverbs_flow_spec_hdr hdr;
799                 struct {
800                         __u32 type;
801                         __u16 size;
802                         __u16 reserved;
803                 };
804         };
805         struct ib_uverbs_flow_tcp_udp_filter val;
806         struct ib_uverbs_flow_tcp_udp_filter mask;
807 };
808
809 struct ib_uverbs_flow_attr {
810         __u32 type;
811         __u16 size;
812         __u16 priority;
813         __u8  num_of_specs;
814         __u8  reserved[2];
815         __u8  port;
816         __u32 flags;
817         /* Following are the optional layers according to user request
818          * struct ib_flow_spec_xxx
819          * struct ib_flow_spec_yyy
820          */
821         struct ib_uverbs_flow_spec_hdr flow_specs[0];
822 };
823
824 struct ib_uverbs_create_flow  {
825         __u32 comp_mask;
826         __u32 qp_handle;
827         struct ib_uverbs_flow_attr flow_attr;
828 };
829
830 struct ib_uverbs_create_flow_resp {
831         __u32 comp_mask;
832         __u32 flow_handle;
833 };
834
835 struct ib_uverbs_destroy_flow  {
836         __u32 comp_mask;
837         __u32 flow_handle;
838 };
839
840 struct ib_uverbs_create_srq {
841         __u64 response;
842         __u64 user_handle;
843         __u32 pd_handle;
844         __u32 max_wr;
845         __u32 max_sge;
846         __u32 srq_limit;
847         __u64 driver_data[0];
848 };
849
850 struct ib_uverbs_create_xsrq {
851         __u64 response;
852         __u64 user_handle;
853         __u32 srq_type;
854         __u32 pd_handle;
855         __u32 max_wr;
856         __u32 max_sge;
857         __u32 srq_limit;
858         __u32 reserved;
859         __u32 xrcd_handle;
860         __u32 cq_handle;
861         __u64 driver_data[0];
862 };
863
864 struct ib_uverbs_create_srq_resp {
865         __u32 srq_handle;
866         __u32 max_wr;
867         __u32 max_sge;
868         __u32 srqn;
869 };
870
871 struct ib_uverbs_modify_srq {
872         __u32 srq_handle;
873         __u32 attr_mask;
874         __u32 max_wr;
875         __u32 srq_limit;
876         __u64 driver_data[0];
877 };
878
879 struct ib_uverbs_query_srq {
880         __u64 response;
881         __u32 srq_handle;
882         __u32 reserved;
883         __u64 driver_data[0];
884 };
885
886 struct ib_uverbs_query_srq_resp {
887         __u32 max_wr;
888         __u32 max_sge;
889         __u32 srq_limit;
890         __u32 reserved;
891 };
892
893 struct ib_uverbs_destroy_srq {
894         __u64 response;
895         __u32 srq_handle;
896         __u32 reserved;
897 };
898
899 struct ib_uverbs_destroy_srq_resp {
900         __u32 events_reported;
901 };
902
903 #endif /* IB_USER_VERBS_H */