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