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