GNU Linux-libre 4.14.290-gnu1
[releases.git] / include / uapi / rdma / ib_user_verbs.h
1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2 /*
3  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
4  * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
5  * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
6  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
7  *
8  * This software is available to you under a choice of one of two
9  * licenses.  You may choose to be licensed under the terms of the GNU
10  * General Public License (GPL) Version 2, available from the file
11  * COPYING in the main directory of this source tree, or the
12  * OpenIB.org BSD license below:
13  *
14  *     Redistribution and use in source and binary forms, with or
15  *     without modification, are permitted provided that the following
16  *     conditions are met:
17  *
18  *      - Redistributions of source code must retain the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer.
21  *
22  *      - Redistributions in binary form must reproduce the above
23  *        copyright notice, this list of conditions and the following
24  *        disclaimer in the documentation and/or other materials
25  *        provided with the distribution.
26  *
27  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34  * SOFTWARE.
35  */
36
37 #ifndef IB_USER_VERBS_H
38 #define IB_USER_VERBS_H
39
40 #include <linux/types.h>
41
42 /*
43  * Increment this value if any changes that break userspace ABI
44  * compatibility are made.
45  */
46 #define IB_USER_VERBS_ABI_VERSION       6
47 #define IB_USER_VERBS_CMD_THRESHOLD    50
48
49 enum {
50         IB_USER_VERBS_CMD_GET_CONTEXT,
51         IB_USER_VERBS_CMD_QUERY_DEVICE,
52         IB_USER_VERBS_CMD_QUERY_PORT,
53         IB_USER_VERBS_CMD_ALLOC_PD,
54         IB_USER_VERBS_CMD_DEALLOC_PD,
55         IB_USER_VERBS_CMD_CREATE_AH,
56         IB_USER_VERBS_CMD_MODIFY_AH,
57         IB_USER_VERBS_CMD_QUERY_AH,
58         IB_USER_VERBS_CMD_DESTROY_AH,
59         IB_USER_VERBS_CMD_REG_MR,
60         IB_USER_VERBS_CMD_REG_SMR,
61         IB_USER_VERBS_CMD_REREG_MR,
62         IB_USER_VERBS_CMD_QUERY_MR,
63         IB_USER_VERBS_CMD_DEREG_MR,
64         IB_USER_VERBS_CMD_ALLOC_MW,
65         IB_USER_VERBS_CMD_BIND_MW,
66         IB_USER_VERBS_CMD_DEALLOC_MW,
67         IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
68         IB_USER_VERBS_CMD_CREATE_CQ,
69         IB_USER_VERBS_CMD_RESIZE_CQ,
70         IB_USER_VERBS_CMD_DESTROY_CQ,
71         IB_USER_VERBS_CMD_POLL_CQ,
72         IB_USER_VERBS_CMD_PEEK_CQ,
73         IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
74         IB_USER_VERBS_CMD_CREATE_QP,
75         IB_USER_VERBS_CMD_QUERY_QP,
76         IB_USER_VERBS_CMD_MODIFY_QP,
77         IB_USER_VERBS_CMD_DESTROY_QP,
78         IB_USER_VERBS_CMD_POST_SEND,
79         IB_USER_VERBS_CMD_POST_RECV,
80         IB_USER_VERBS_CMD_ATTACH_MCAST,
81         IB_USER_VERBS_CMD_DETACH_MCAST,
82         IB_USER_VERBS_CMD_CREATE_SRQ,
83         IB_USER_VERBS_CMD_MODIFY_SRQ,
84         IB_USER_VERBS_CMD_QUERY_SRQ,
85         IB_USER_VERBS_CMD_DESTROY_SRQ,
86         IB_USER_VERBS_CMD_POST_SRQ_RECV,
87         IB_USER_VERBS_CMD_OPEN_XRCD,
88         IB_USER_VERBS_CMD_CLOSE_XRCD,
89         IB_USER_VERBS_CMD_CREATE_XSRQ,
90         IB_USER_VERBS_CMD_OPEN_QP,
91 };
92
93 enum {
94         IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
95         IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
96         IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP,
97         IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
98         IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
99         IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
100         IB_USER_VERBS_EX_CMD_CREATE_WQ,
101         IB_USER_VERBS_EX_CMD_MODIFY_WQ,
102         IB_USER_VERBS_EX_CMD_DESTROY_WQ,
103         IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
104         IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
105 };
106
107 /*
108  * Make sure that all structs defined in this file remain laid out so
109  * that they pack the same way on 32-bit and 64-bit architectures (to
110  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
111  * Specifically:
112  *  - Do not use pointer types -- pass pointers in __u64 instead.
113  *  - Make sure that any structure larger than 4 bytes is padded to a
114  *    multiple of 8 bytes.  Otherwise the structure size will be
115  *    different between 32-bit and 64-bit architectures.
116  */
117
118 struct ib_uverbs_async_event_desc {
119         __u64 element;
120         __u32 event_type;       /* enum ib_event_type */
121         __u32 reserved;
122 };
123
124 struct ib_uverbs_comp_event_desc {
125         __u64 cq_handle;
126 };
127
128 /*
129  * All commands from userspace should start with a __u32 command field
130  * followed by __u16 in_words and out_words fields (which give the
131  * length of the command block and response buffer if any in 32-bit
132  * words).  The kernel driver will read these fields first and read
133  * the rest of the command struct based on these value.
134  */
135
136 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
137 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
138 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
139
140 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
141
142 struct ib_uverbs_cmd_hdr {
143         __u32 command;
144         __u16 in_words;
145         __u16 out_words;
146 };
147
148 struct ib_uverbs_ex_cmd_hdr {
149         __u64 response;
150         __u16 provider_in_words;
151         __u16 provider_out_words;
152         __u32 cmd_hdr_reserved;
153 };
154
155 struct ib_uverbs_get_context {
156         __u64 response;
157         __u64 driver_data[0];
158 };
159
160 struct ib_uverbs_get_context_resp {
161         __u32 async_fd;
162         __u32 num_comp_vectors;
163 };
164
165 struct ib_uverbs_query_device {
166         __u64 response;
167         __u64 driver_data[0];
168 };
169
170 struct ib_uverbs_query_device_resp {
171         __u64 fw_ver;
172         __be64 node_guid;
173         __be64 sys_image_guid;
174         __u64 max_mr_size;
175         __u64 page_size_cap;
176         __u32 vendor_id;
177         __u32 vendor_part_id;
178         __u32 hw_ver;
179         __u32 max_qp;
180         __u32 max_qp_wr;
181         __u32 device_cap_flags;
182         __u32 max_sge;
183         __u32 max_sge_rd;
184         __u32 max_cq;
185         __u32 max_cqe;
186         __u32 max_mr;
187         __u32 max_pd;
188         __u32 max_qp_rd_atom;
189         __u32 max_ee_rd_atom;
190         __u32 max_res_rd_atom;
191         __u32 max_qp_init_rd_atom;
192         __u32 max_ee_init_rd_atom;
193         __u32 atomic_cap;
194         __u32 max_ee;
195         __u32 max_rdd;
196         __u32 max_mw;
197         __u32 max_raw_ipv6_qp;
198         __u32 max_raw_ethy_qp;
199         __u32 max_mcast_grp;
200         __u32 max_mcast_qp_attach;
201         __u32 max_total_mcast_qp_attach;
202         __u32 max_ah;
203         __u32 max_fmr;
204         __u32 max_map_per_fmr;
205         __u32 max_srq;
206         __u32 max_srq_wr;
207         __u32 max_srq_sge;
208         __u16 max_pkeys;
209         __u8  local_ca_ack_delay;
210         __u8  phys_port_cnt;
211         __u8  reserved[4];
212 };
213
214 struct ib_uverbs_ex_query_device {
215         __u32 comp_mask;
216         __u32 reserved;
217 };
218
219 struct ib_uverbs_odp_caps {
220         __u64 general_caps;
221         struct {
222                 __u32 rc_odp_caps;
223                 __u32 uc_odp_caps;
224                 __u32 ud_odp_caps;
225         } per_transport_caps;
226         __u32 reserved;
227 };
228
229 struct ib_uverbs_rss_caps {
230         /* Corresponding bit will be set if qp type from
231          * 'enum ib_qp_type' is supported, e.g.
232          * supported_qpts |= 1 << IB_QPT_UD
233          */
234         __u32 supported_qpts;
235         __u32 max_rwq_indirection_tables;
236         __u32 max_rwq_indirection_table_size;
237         __u32 reserved;
238 };
239
240 struct ib_uverbs_tm_caps {
241         /* Max size of rendezvous request message */
242         __u32 max_rndv_hdr_size;
243         /* Max number of entries in tag matching list */
244         __u32 max_num_tags;
245         /* TM flags */
246         __u32 flags;
247         /* Max number of outstanding list operations */
248         __u32 max_ops;
249         /* Max number of SGE in tag matching entry */
250         __u32 max_sge;
251         __u32 reserved;
252 };
253
254 struct ib_uverbs_ex_query_device_resp {
255         struct ib_uverbs_query_device_resp base;
256         __u32 comp_mask;
257         __u32 response_length;
258         struct ib_uverbs_odp_caps odp_caps;
259         __u64 timestamp_mask;
260         __u64 hca_core_clock; /* in KHZ */
261         __u64 device_cap_flags_ex;
262         struct ib_uverbs_rss_caps rss_caps;
263         __u32  max_wq_type_rq;
264         __u32 raw_packet_caps;
265         struct ib_uverbs_tm_caps tm_caps;
266 };
267
268 struct ib_uverbs_query_port {
269         __u64 response;
270         __u8  port_num;
271         __u8  reserved[7];
272         __u64 driver_data[0];
273 };
274
275 struct ib_uverbs_query_port_resp {
276         __u32 port_cap_flags;
277         __u32 max_msg_sz;
278         __u32 bad_pkey_cntr;
279         __u32 qkey_viol_cntr;
280         __u32 gid_tbl_len;
281         __u16 pkey_tbl_len;
282         __u16 lid;
283         __u16 sm_lid;
284         __u8  state;
285         __u8  max_mtu;
286         __u8  active_mtu;
287         __u8  lmc;
288         __u8  max_vl_num;
289         __u8  sm_sl;
290         __u8  subnet_timeout;
291         __u8  init_type_reply;
292         __u8  active_width;
293         __u8  active_speed;
294         __u8  phys_state;
295         __u8  link_layer;
296         __u8  reserved[2];
297 };
298
299 struct ib_uverbs_alloc_pd {
300         __u64 response;
301         __u64 driver_data[0];
302 };
303
304 struct ib_uverbs_alloc_pd_resp {
305         __u32 pd_handle;
306 };
307
308 struct ib_uverbs_dealloc_pd {
309         __u32 pd_handle;
310 };
311
312 struct ib_uverbs_open_xrcd {
313         __u64 response;
314         __u32 fd;
315         __u32 oflags;
316         __u64 driver_data[0];
317 };
318
319 struct ib_uverbs_open_xrcd_resp {
320         __u32 xrcd_handle;
321 };
322
323 struct ib_uverbs_close_xrcd {
324         __u32 xrcd_handle;
325 };
326
327 struct ib_uverbs_reg_mr {
328         __u64 response;
329         __u64 start;
330         __u64 length;
331         __u64 hca_va;
332         __u32 pd_handle;
333         __u32 access_flags;
334         __u64 driver_data[0];
335 };
336
337 struct ib_uverbs_reg_mr_resp {
338         __u32 mr_handle;
339         __u32 lkey;
340         __u32 rkey;
341 };
342
343 struct ib_uverbs_rereg_mr {
344         __u64 response;
345         __u32 mr_handle;
346         __u32 flags;
347         __u64 start;
348         __u64 length;
349         __u64 hca_va;
350         __u32 pd_handle;
351         __u32 access_flags;
352 };
353
354 struct ib_uverbs_rereg_mr_resp {
355         __u32 lkey;
356         __u32 rkey;
357 };
358
359 struct ib_uverbs_dereg_mr {
360         __u32 mr_handle;
361 };
362
363 struct ib_uverbs_alloc_mw {
364         __u64 response;
365         __u32 pd_handle;
366         __u8  mw_type;
367         __u8  reserved[3];
368 };
369
370 struct ib_uverbs_alloc_mw_resp {
371         __u32 mw_handle;
372         __u32 rkey;
373 };
374
375 struct ib_uverbs_dealloc_mw {
376         __u32 mw_handle;
377 };
378
379 struct ib_uverbs_create_comp_channel {
380         __u64 response;
381 };
382
383 struct ib_uverbs_create_comp_channel_resp {
384         __u32 fd;
385 };
386
387 struct ib_uverbs_create_cq {
388         __u64 response;
389         __u64 user_handle;
390         __u32 cqe;
391         __u32 comp_vector;
392         __s32 comp_channel;
393         __u32 reserved;
394         __u64 driver_data[0];
395 };
396
397 struct ib_uverbs_ex_create_cq {
398         __u64 user_handle;
399         __u32 cqe;
400         __u32 comp_vector;
401         __s32 comp_channel;
402         __u32 comp_mask;
403         __u32 flags;
404         __u32 reserved;
405 };
406
407 struct ib_uverbs_create_cq_resp {
408         __u32 cq_handle;
409         __u32 cqe;
410 };
411
412 struct ib_uverbs_ex_create_cq_resp {
413         struct ib_uverbs_create_cq_resp base;
414         __u32 comp_mask;
415         __u32 response_length;
416 };
417
418 struct ib_uverbs_resize_cq {
419         __u64 response;
420         __u32 cq_handle;
421         __u32 cqe;
422         __u64 driver_data[0];
423 };
424
425 struct ib_uverbs_resize_cq_resp {
426         __u32 cqe;
427         __u32 reserved;
428         __u64 driver_data[0];
429 };
430
431 struct ib_uverbs_poll_cq {
432         __u64 response;
433         __u32 cq_handle;
434         __u32 ne;
435 };
436
437 struct ib_uverbs_wc {
438         __u64 wr_id;
439         __u32 status;
440         __u32 opcode;
441         __u32 vendor_err;
442         __u32 byte_len;
443         union {
444                 __u32 imm_data;
445                 __u32 invalidate_rkey;
446         } ex;
447         __u32 qp_num;
448         __u32 src_qp;
449         __u32 wc_flags;
450         __u16 pkey_index;
451         __u16 slid;
452         __u8 sl;
453         __u8 dlid_path_bits;
454         __u8 port_num;
455         __u8 reserved;
456 };
457
458 struct ib_uverbs_poll_cq_resp {
459         __u32 count;
460         __u32 reserved;
461         struct ib_uverbs_wc wc[0];
462 };
463
464 struct ib_uverbs_req_notify_cq {
465         __u32 cq_handle;
466         __u32 solicited_only;
467 };
468
469 struct ib_uverbs_destroy_cq {
470         __u64 response;
471         __u32 cq_handle;
472         __u32 reserved;
473 };
474
475 struct ib_uverbs_destroy_cq_resp {
476         __u32 comp_events_reported;
477         __u32 async_events_reported;
478 };
479
480 struct ib_uverbs_global_route {
481         __u8  dgid[16];
482         __u32 flow_label;
483         __u8  sgid_index;
484         __u8  hop_limit;
485         __u8  traffic_class;
486         __u8  reserved;
487 };
488
489 struct ib_uverbs_ah_attr {
490         struct ib_uverbs_global_route grh;
491         __u16 dlid;
492         __u8  sl;
493         __u8  src_path_bits;
494         __u8  static_rate;
495         __u8  is_global;
496         __u8  port_num;
497         __u8  reserved;
498 };
499
500 struct ib_uverbs_qp_attr {
501         __u32   qp_attr_mask;
502         __u32   qp_state;
503         __u32   cur_qp_state;
504         __u32   path_mtu;
505         __u32   path_mig_state;
506         __u32   qkey;
507         __u32   rq_psn;
508         __u32   sq_psn;
509         __u32   dest_qp_num;
510         __u32   qp_access_flags;
511
512         struct ib_uverbs_ah_attr ah_attr;
513         struct ib_uverbs_ah_attr alt_ah_attr;
514
515         /* ib_qp_cap */
516         __u32   max_send_wr;
517         __u32   max_recv_wr;
518         __u32   max_send_sge;
519         __u32   max_recv_sge;
520         __u32   max_inline_data;
521
522         __u16   pkey_index;
523         __u16   alt_pkey_index;
524         __u8    en_sqd_async_notify;
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    reserved[5];
536 };
537
538 struct ib_uverbs_create_qp {
539         __u64 response;
540         __u64 user_handle;
541         __u32 pd_handle;
542         __u32 send_cq_handle;
543         __u32 recv_cq_handle;
544         __u32 srq_handle;
545         __u32 max_send_wr;
546         __u32 max_recv_wr;
547         __u32 max_send_sge;
548         __u32 max_recv_sge;
549         __u32 max_inline_data;
550         __u8  sq_sig_all;
551         __u8  qp_type;
552         __u8  is_srq;
553         __u8  reserved;
554         __u64 driver_data[0];
555 };
556
557 enum ib_uverbs_create_qp_mask {
558         IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
559 };
560
561 enum {
562         IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
563 };
564
565 enum {
566         /*
567          * This value is equal to IB_QP_DEST_QPN.
568          */
569         IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
570 };
571
572 enum {
573         /*
574          * This value is equal to IB_QP_RATE_LIMIT.
575          */
576         IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
577 };
578
579 struct ib_uverbs_ex_create_qp {
580         __u64 user_handle;
581         __u32 pd_handle;
582         __u32 send_cq_handle;
583         __u32 recv_cq_handle;
584         __u32 srq_handle;
585         __u32 max_send_wr;
586         __u32 max_recv_wr;
587         __u32 max_send_sge;
588         __u32 max_recv_sge;
589         __u32 max_inline_data;
590         __u8  sq_sig_all;
591         __u8  qp_type;
592         __u8  is_srq;
593         __u8 reserved;
594         __u32 comp_mask;
595         __u32 create_flags;
596         __u32 rwq_ind_tbl_handle;
597         __u32  source_qpn;
598 };
599
600 struct ib_uverbs_open_qp {
601         __u64 response;
602         __u64 user_handle;
603         __u32 pd_handle;
604         __u32 qpn;
605         __u8  qp_type;
606         __u8  reserved[7];
607         __u64 driver_data[0];
608 };
609
610 /* also used for open response */
611 struct ib_uverbs_create_qp_resp {
612         __u32 qp_handle;
613         __u32 qpn;
614         __u32 max_send_wr;
615         __u32 max_recv_wr;
616         __u32 max_send_sge;
617         __u32 max_recv_sge;
618         __u32 max_inline_data;
619         __u32 reserved;
620 };
621
622 struct ib_uverbs_ex_create_qp_resp {
623         struct ib_uverbs_create_qp_resp base;
624         __u32 comp_mask;
625         __u32 response_length;
626 };
627
628 /*
629  * This struct needs to remain a multiple of 8 bytes to keep the
630  * alignment of the modify QP parameters.
631  */
632 struct ib_uverbs_qp_dest {
633         __u8  dgid[16];
634         __u32 flow_label;
635         __u16 dlid;
636         __u16 reserved;
637         __u8  sgid_index;
638         __u8  hop_limit;
639         __u8  traffic_class;
640         __u8  sl;
641         __u8  src_path_bits;
642         __u8  static_rate;
643         __u8  is_global;
644         __u8  port_num;
645 };
646
647 struct ib_uverbs_query_qp {
648         __u64 response;
649         __u32 qp_handle;
650         __u32 attr_mask;
651         __u64 driver_data[0];
652 };
653
654 struct ib_uverbs_query_qp_resp {
655         struct ib_uverbs_qp_dest dest;
656         struct ib_uverbs_qp_dest alt_dest;
657         __u32 max_send_wr;
658         __u32 max_recv_wr;
659         __u32 max_send_sge;
660         __u32 max_recv_sge;
661         __u32 max_inline_data;
662         __u32 qkey;
663         __u32 rq_psn;
664         __u32 sq_psn;
665         __u32 dest_qp_num;
666         __u32 qp_access_flags;
667         __u16 pkey_index;
668         __u16 alt_pkey_index;
669         __u8  qp_state;
670         __u8  cur_qp_state;
671         __u8  path_mtu;
672         __u8  path_mig_state;
673         __u8  sq_draining;
674         __u8  max_rd_atomic;
675         __u8  max_dest_rd_atomic;
676         __u8  min_rnr_timer;
677         __u8  port_num;
678         __u8  timeout;
679         __u8  retry_cnt;
680         __u8  rnr_retry;
681         __u8  alt_port_num;
682         __u8  alt_timeout;
683         __u8  sq_sig_all;
684         __u8  reserved[5];
685         __u64 driver_data[0];
686 };
687
688 struct ib_uverbs_modify_qp {
689         struct ib_uverbs_qp_dest dest;
690         struct ib_uverbs_qp_dest alt_dest;
691         __u32 qp_handle;
692         __u32 attr_mask;
693         __u32 qkey;
694         __u32 rq_psn;
695         __u32 sq_psn;
696         __u32 dest_qp_num;
697         __u32 qp_access_flags;
698         __u16 pkey_index;
699         __u16 alt_pkey_index;
700         __u8  qp_state;
701         __u8  cur_qp_state;
702         __u8  path_mtu;
703         __u8  path_mig_state;
704         __u8  en_sqd_async_notify;
705         __u8  max_rd_atomic;
706         __u8  max_dest_rd_atomic;
707         __u8  min_rnr_timer;
708         __u8  port_num;
709         __u8  timeout;
710         __u8  retry_cnt;
711         __u8  rnr_retry;
712         __u8  alt_port_num;
713         __u8  alt_timeout;
714         __u8  reserved[2];
715         __u64 driver_data[0];
716 };
717
718 struct ib_uverbs_ex_modify_qp {
719         struct ib_uverbs_modify_qp base;
720         __u32   rate_limit;
721         __u32   reserved;
722 };
723
724 struct ib_uverbs_modify_qp_resp {
725 };
726
727 struct ib_uverbs_ex_modify_qp_resp {
728         __u32  comp_mask;
729         __u32  response_length;
730 };
731
732 struct ib_uverbs_destroy_qp {
733         __u64 response;
734         __u32 qp_handle;
735         __u32 reserved;
736 };
737
738 struct ib_uverbs_destroy_qp_resp {
739         __u32 events_reported;
740 };
741
742 /*
743  * The ib_uverbs_sge structure isn't used anywhere, since we assume
744  * the ib_sge structure is packed the same way on 32-bit and 64-bit
745  * architectures in both kernel and user space.  It's just here to
746  * document the ABI.
747  */
748 struct ib_uverbs_sge {
749         __u64 addr;
750         __u32 length;
751         __u32 lkey;
752 };
753
754 enum ib_uverbs_wr_opcode {
755         IB_UVERBS_WR_RDMA_WRITE = 0,
756         IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1,
757         IB_UVERBS_WR_SEND = 2,
758         IB_UVERBS_WR_SEND_WITH_IMM = 3,
759         IB_UVERBS_WR_RDMA_READ = 4,
760         IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5,
761         IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6,
762         IB_UVERBS_WR_LOCAL_INV = 7,
763         IB_UVERBS_WR_BIND_MW = 8,
764         IB_UVERBS_WR_SEND_WITH_INV = 9,
765         IB_UVERBS_WR_TSO = 10,
766         IB_UVERBS_WR_RDMA_READ_WITH_INV = 11,
767         IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12,
768         IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13,
769         /* Review enum ib_wr_opcode before modifying this */
770 };
771
772 struct ib_uverbs_send_wr {
773         __u64 wr_id;
774         __u32 num_sge;
775         __u32 opcode;           /* see enum ib_uverbs_wr_opcode */
776         __u32 send_flags;
777         union {
778                 __u32 imm_data;
779                 __u32 invalidate_rkey;
780         } ex;
781         union {
782                 struct {
783                         __u64 remote_addr;
784                         __u32 rkey;
785                         __u32 reserved;
786                 } rdma;
787                 struct {
788                         __u64 remote_addr;
789                         __u64 compare_add;
790                         __u64 swap;
791                         __u32 rkey;
792                         __u32 reserved;
793                 } atomic;
794                 struct {
795                         __u32 ah;
796                         __u32 remote_qpn;
797                         __u32 remote_qkey;
798                         __u32 reserved;
799                 } ud;
800         } wr;
801 };
802
803 struct ib_uverbs_post_send {
804         __u64 response;
805         __u32 qp_handle;
806         __u32 wr_count;
807         __u32 sge_count;
808         __u32 wqe_size;
809         struct ib_uverbs_send_wr send_wr[0];
810 };
811
812 struct ib_uverbs_post_send_resp {
813         __u32 bad_wr;
814 };
815
816 struct ib_uverbs_recv_wr {
817         __u64 wr_id;
818         __u32 num_sge;
819         __u32 reserved;
820 };
821
822 struct ib_uverbs_post_recv {
823         __u64 response;
824         __u32 qp_handle;
825         __u32 wr_count;
826         __u32 sge_count;
827         __u32 wqe_size;
828         struct ib_uverbs_recv_wr recv_wr[0];
829 };
830
831 struct ib_uverbs_post_recv_resp {
832         __u32 bad_wr;
833 };
834
835 struct ib_uverbs_post_srq_recv {
836         __u64 response;
837         __u32 srq_handle;
838         __u32 wr_count;
839         __u32 sge_count;
840         __u32 wqe_size;
841         struct ib_uverbs_recv_wr recv[0];
842 };
843
844 struct ib_uverbs_post_srq_recv_resp {
845         __u32 bad_wr;
846 };
847
848 struct ib_uverbs_create_ah {
849         __u64 response;
850         __u64 user_handle;
851         __u32 pd_handle;
852         __u32 reserved;
853         struct ib_uverbs_ah_attr attr;
854 };
855
856 struct ib_uverbs_create_ah_resp {
857         __u32 ah_handle;
858 };
859
860 struct ib_uverbs_destroy_ah {
861         __u32 ah_handle;
862 };
863
864 struct ib_uverbs_attach_mcast {
865         __u8  gid[16];
866         __u32 qp_handle;
867         __u16 mlid;
868         __u16 reserved;
869         __u64 driver_data[0];
870 };
871
872 struct ib_uverbs_detach_mcast {
873         __u8  gid[16];
874         __u32 qp_handle;
875         __u16 mlid;
876         __u16 reserved;
877         __u64 driver_data[0];
878 };
879
880 struct ib_uverbs_flow_spec_hdr {
881         __u32 type;
882         __u16 size;
883         __u16 reserved;
884         /* followed by flow_spec */
885         __u64 flow_spec_data[0];
886 };
887
888 struct ib_uverbs_flow_eth_filter {
889         __u8  dst_mac[6];
890         __u8  src_mac[6];
891         __be16 ether_type;
892         __be16 vlan_tag;
893 };
894
895 struct ib_uverbs_flow_spec_eth {
896         union {
897                 struct ib_uverbs_flow_spec_hdr hdr;
898                 struct {
899                         __u32 type;
900                         __u16 size;
901                         __u16 reserved;
902                 };
903         };
904         struct ib_uverbs_flow_eth_filter val;
905         struct ib_uverbs_flow_eth_filter mask;
906 };
907
908 struct ib_uverbs_flow_ipv4_filter {
909         __be32 src_ip;
910         __be32 dst_ip;
911         __u8    proto;
912         __u8    tos;
913         __u8    ttl;
914         __u8    flags;
915 };
916
917 struct ib_uverbs_flow_spec_ipv4 {
918         union {
919                 struct ib_uverbs_flow_spec_hdr hdr;
920                 struct {
921                         __u32 type;
922                         __u16 size;
923                         __u16 reserved;
924                 };
925         };
926         struct ib_uverbs_flow_ipv4_filter val;
927         struct ib_uverbs_flow_ipv4_filter mask;
928 };
929
930 struct ib_uverbs_flow_tcp_udp_filter {
931         __be16 dst_port;
932         __be16 src_port;
933 };
934
935 struct ib_uverbs_flow_spec_tcp_udp {
936         union {
937                 struct ib_uverbs_flow_spec_hdr hdr;
938                 struct {
939                         __u32 type;
940                         __u16 size;
941                         __u16 reserved;
942                 };
943         };
944         struct ib_uverbs_flow_tcp_udp_filter val;
945         struct ib_uverbs_flow_tcp_udp_filter mask;
946 };
947
948 struct ib_uverbs_flow_ipv6_filter {
949         __u8    src_ip[16];
950         __u8    dst_ip[16];
951         __be32  flow_label;
952         __u8    next_hdr;
953         __u8    traffic_class;
954         __u8    hop_limit;
955         __u8    reserved;
956 };
957
958 struct ib_uverbs_flow_spec_ipv6 {
959         union {
960                 struct ib_uverbs_flow_spec_hdr hdr;
961                 struct {
962                         __u32 type;
963                         __u16 size;
964                         __u16 reserved;
965                 };
966         };
967         struct ib_uverbs_flow_ipv6_filter val;
968         struct ib_uverbs_flow_ipv6_filter mask;
969 };
970
971 struct ib_uverbs_flow_spec_action_tag {
972         union {
973                 struct ib_uverbs_flow_spec_hdr hdr;
974                 struct {
975                         __u32 type;
976                         __u16 size;
977                         __u16 reserved;
978                 };
979         };
980         __u32                         tag_id;
981         __u32                         reserved1;
982 };
983
984 struct ib_uverbs_flow_spec_action_drop {
985         union {
986                 struct ib_uverbs_flow_spec_hdr hdr;
987                 struct {
988                         __u32 type;
989                         __u16 size;
990                         __u16 reserved;
991                 };
992         };
993 };
994
995 struct ib_uverbs_flow_tunnel_filter {
996         __be32 tunnel_id;
997 };
998
999 struct ib_uverbs_flow_spec_tunnel {
1000         union {
1001                 struct ib_uverbs_flow_spec_hdr hdr;
1002                 struct {
1003                         __u32 type;
1004                         __u16 size;
1005                         __u16 reserved;
1006                 };
1007         };
1008         struct ib_uverbs_flow_tunnel_filter val;
1009         struct ib_uverbs_flow_tunnel_filter mask;
1010 };
1011
1012 struct ib_uverbs_flow_attr {
1013         __u32 type;
1014         __u16 size;
1015         __u16 priority;
1016         __u8  num_of_specs;
1017         __u8  reserved[2];
1018         __u8  port;
1019         __u32 flags;
1020         /* Following are the optional layers according to user request
1021          * struct ib_flow_spec_xxx
1022          * struct ib_flow_spec_yyy
1023          */
1024         struct ib_uverbs_flow_spec_hdr flow_specs[0];
1025 };
1026
1027 struct ib_uverbs_create_flow  {
1028         __u32 comp_mask;
1029         __u32 qp_handle;
1030         struct ib_uverbs_flow_attr flow_attr;
1031 };
1032
1033 struct ib_uverbs_create_flow_resp {
1034         __u32 comp_mask;
1035         __u32 flow_handle;
1036 };
1037
1038 struct ib_uverbs_destroy_flow  {
1039         __u32 comp_mask;
1040         __u32 flow_handle;
1041 };
1042
1043 struct ib_uverbs_create_srq {
1044         __u64 response;
1045         __u64 user_handle;
1046         __u32 pd_handle;
1047         __u32 max_wr;
1048         __u32 max_sge;
1049         __u32 srq_limit;
1050         __u64 driver_data[0];
1051 };
1052
1053 struct ib_uverbs_create_xsrq {
1054         __u64 response;
1055         __u64 user_handle;
1056         __u32 srq_type;
1057         __u32 pd_handle;
1058         __u32 max_wr;
1059         __u32 max_sge;
1060         __u32 srq_limit;
1061         __u32 max_num_tags;
1062         __u32 xrcd_handle;
1063         __u32 cq_handle;
1064         __u64 driver_data[0];
1065 };
1066
1067 struct ib_uverbs_create_srq_resp {
1068         __u32 srq_handle;
1069         __u32 max_wr;
1070         __u32 max_sge;
1071         __u32 srqn;
1072 };
1073
1074 struct ib_uverbs_modify_srq {
1075         __u32 srq_handle;
1076         __u32 attr_mask;
1077         __u32 max_wr;
1078         __u32 srq_limit;
1079         __u64 driver_data[0];
1080 };
1081
1082 struct ib_uverbs_query_srq {
1083         __u64 response;
1084         __u32 srq_handle;
1085         __u32 reserved;
1086         __u64 driver_data[0];
1087 };
1088
1089 struct ib_uverbs_query_srq_resp {
1090         __u32 max_wr;
1091         __u32 max_sge;
1092         __u32 srq_limit;
1093         __u32 reserved;
1094 };
1095
1096 struct ib_uverbs_destroy_srq {
1097         __u64 response;
1098         __u32 srq_handle;
1099         __u32 reserved;
1100 };
1101
1102 struct ib_uverbs_destroy_srq_resp {
1103         __u32 events_reported;
1104 };
1105
1106 struct ib_uverbs_ex_create_wq  {
1107         __u32 comp_mask;
1108         __u32 wq_type;
1109         __u64 user_handle;
1110         __u32 pd_handle;
1111         __u32 cq_handle;
1112         __u32 max_wr;
1113         __u32 max_sge;
1114         __u32 create_flags; /* Use enum ib_wq_flags */
1115         __u32 reserved;
1116 };
1117
1118 struct ib_uverbs_ex_create_wq_resp {
1119         __u32 comp_mask;
1120         __u32 response_length;
1121         __u32 wq_handle;
1122         __u32 max_wr;
1123         __u32 max_sge;
1124         __u32 wqn;
1125 };
1126
1127 struct ib_uverbs_ex_destroy_wq  {
1128         __u32 comp_mask;
1129         __u32 wq_handle;
1130 };
1131
1132 struct ib_uverbs_ex_destroy_wq_resp {
1133         __u32 comp_mask;
1134         __u32 response_length;
1135         __u32 events_reported;
1136         __u32 reserved;
1137 };
1138
1139 struct ib_uverbs_ex_modify_wq  {
1140         __u32 attr_mask;
1141         __u32 wq_handle;
1142         __u32 wq_state;
1143         __u32 curr_wq_state;
1144         __u32 flags; /* Use enum ib_wq_flags */
1145         __u32 flags_mask; /* Use enum ib_wq_flags */
1146 };
1147
1148 /* Prevent memory allocation rather than max expected size */
1149 #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1150 struct ib_uverbs_ex_create_rwq_ind_table  {
1151         __u32 comp_mask;
1152         __u32 log_ind_tbl_size;
1153         /* Following are the wq handles according to log_ind_tbl_size
1154          * wq_handle1
1155          * wq_handle2
1156          */
1157         __u32 wq_handles[0];
1158 };
1159
1160 struct ib_uverbs_ex_create_rwq_ind_table_resp {
1161         __u32 comp_mask;
1162         __u32 response_length;
1163         __u32 ind_tbl_handle;
1164         __u32 ind_tbl_num;
1165 };
1166
1167 struct ib_uverbs_ex_destroy_rwq_ind_table  {
1168         __u32 comp_mask;
1169         __u32 ind_tbl_handle;
1170 };
1171
1172 #define IB_DEVICE_NAME_MAX 64
1173
1174 #endif /* IB_USER_VERBS_H */