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