Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
[linux-2.6-microblaze.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 #include <rdma/ib_verbs.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_ex_query_device_resp {
241         struct ib_uverbs_query_device_resp base;
242         __u32 comp_mask;
243         __u32 response_length;
244         struct ib_uverbs_odp_caps odp_caps;
245         __u64 timestamp_mask;
246         __u64 hca_core_clock; /* in KHZ */
247         __u64 device_cap_flags_ex;
248         struct ib_uverbs_rss_caps rss_caps;
249         __u32  max_wq_type_rq;
250         __u32 reserved;
251 };
252
253 struct ib_uverbs_query_port {
254         __u64 response;
255         __u8  port_num;
256         __u8  reserved[7];
257         __u64 driver_data[0];
258 };
259
260 struct ib_uverbs_query_port_resp {
261         __u32 port_cap_flags;
262         __u32 max_msg_sz;
263         __u32 bad_pkey_cntr;
264         __u32 qkey_viol_cntr;
265         __u32 gid_tbl_len;
266         __u16 pkey_tbl_len;
267         __u16 lid;
268         __u16 sm_lid;
269         __u8  state;
270         __u8  max_mtu;
271         __u8  active_mtu;
272         __u8  lmc;
273         __u8  max_vl_num;
274         __u8  sm_sl;
275         __u8  subnet_timeout;
276         __u8  init_type_reply;
277         __u8  active_width;
278         __u8  active_speed;
279         __u8  phys_state;
280         __u8  link_layer;
281         __u8  reserved[2];
282 };
283
284 struct ib_uverbs_alloc_pd {
285         __u64 response;
286         __u64 driver_data[0];
287 };
288
289 struct ib_uverbs_alloc_pd_resp {
290         __u32 pd_handle;
291 };
292
293 struct ib_uverbs_dealloc_pd {
294         __u32 pd_handle;
295 };
296
297 struct ib_uverbs_open_xrcd {
298         __u64 response;
299         __u32 fd;
300         __u32 oflags;
301         __u64 driver_data[0];
302 };
303
304 struct ib_uverbs_open_xrcd_resp {
305         __u32 xrcd_handle;
306 };
307
308 struct ib_uverbs_close_xrcd {
309         __u32 xrcd_handle;
310 };
311
312 struct ib_uverbs_reg_mr {
313         __u64 response;
314         __u64 start;
315         __u64 length;
316         __u64 hca_va;
317         __u32 pd_handle;
318         __u32 access_flags;
319         __u64 driver_data[0];
320 };
321
322 struct ib_uverbs_reg_mr_resp {
323         __u32 mr_handle;
324         __u32 lkey;
325         __u32 rkey;
326 };
327
328 struct ib_uverbs_rereg_mr {
329         __u64 response;
330         __u32 mr_handle;
331         __u32 flags;
332         __u64 start;
333         __u64 length;
334         __u64 hca_va;
335         __u32 pd_handle;
336         __u32 access_flags;
337 };
338
339 struct ib_uverbs_rereg_mr_resp {
340         __u32 lkey;
341         __u32 rkey;
342 };
343
344 struct ib_uverbs_dereg_mr {
345         __u32 mr_handle;
346 };
347
348 struct ib_uverbs_alloc_mw {
349         __u64 response;
350         __u32 pd_handle;
351         __u8  mw_type;
352         __u8  reserved[3];
353 };
354
355 struct ib_uverbs_alloc_mw_resp {
356         __u32 mw_handle;
357         __u32 rkey;
358 };
359
360 struct ib_uverbs_dealloc_mw {
361         __u32 mw_handle;
362 };
363
364 struct ib_uverbs_create_comp_channel {
365         __u64 response;
366 };
367
368 struct ib_uverbs_create_comp_channel_resp {
369         __u32 fd;
370 };
371
372 struct ib_uverbs_create_cq {
373         __u64 response;
374         __u64 user_handle;
375         __u32 cqe;
376         __u32 comp_vector;
377         __s32 comp_channel;
378         __u32 reserved;
379         __u64 driver_data[0];
380 };
381
382 struct ib_uverbs_ex_create_cq {
383         __u64 user_handle;
384         __u32 cqe;
385         __u32 comp_vector;
386         __s32 comp_channel;
387         __u32 comp_mask;
388         __u32 flags;
389         __u32 reserved;
390 };
391
392 struct ib_uverbs_create_cq_resp {
393         __u32 cq_handle;
394         __u32 cqe;
395 };
396
397 struct ib_uverbs_ex_create_cq_resp {
398         struct ib_uverbs_create_cq_resp base;
399         __u32 comp_mask;
400         __u32 response_length;
401 };
402
403 struct ib_uverbs_resize_cq {
404         __u64 response;
405         __u32 cq_handle;
406         __u32 cqe;
407         __u64 driver_data[0];
408 };
409
410 struct ib_uverbs_resize_cq_resp {
411         __u32 cqe;
412         __u32 reserved;
413         __u64 driver_data[0];
414 };
415
416 struct ib_uverbs_poll_cq {
417         __u64 response;
418         __u32 cq_handle;
419         __u32 ne;
420 };
421
422 struct ib_uverbs_wc {
423         __u64 wr_id;
424         __u32 status;
425         __u32 opcode;
426         __u32 vendor_err;
427         __u32 byte_len;
428         union {
429                 __u32 imm_data;
430                 __u32 invalidate_rkey;
431         } ex;
432         __u32 qp_num;
433         __u32 src_qp;
434         __u32 wc_flags;
435         __u16 pkey_index;
436         __u16 slid;
437         __u8 sl;
438         __u8 dlid_path_bits;
439         __u8 port_num;
440         __u8 reserved;
441 };
442
443 struct ib_uverbs_poll_cq_resp {
444         __u32 count;
445         __u32 reserved;
446         struct ib_uverbs_wc wc[0];
447 };
448
449 struct ib_uverbs_req_notify_cq {
450         __u32 cq_handle;
451         __u32 solicited_only;
452 };
453
454 struct ib_uverbs_destroy_cq {
455         __u64 response;
456         __u32 cq_handle;
457         __u32 reserved;
458 };
459
460 struct ib_uverbs_destroy_cq_resp {
461         __u32 comp_events_reported;
462         __u32 async_events_reported;
463 };
464
465 struct ib_uverbs_global_route {
466         __u8  dgid[16];
467         __u32 flow_label;
468         __u8  sgid_index;
469         __u8  hop_limit;
470         __u8  traffic_class;
471         __u8  reserved;
472 };
473
474 struct ib_uverbs_ah_attr {
475         struct ib_uverbs_global_route grh;
476         __u16 dlid;
477         __u8  sl;
478         __u8  src_path_bits;
479         __u8  static_rate;
480         __u8  is_global;
481         __u8  port_num;
482         __u8  reserved;
483 };
484
485 struct ib_uverbs_qp_attr {
486         __u32   qp_attr_mask;
487         __u32   qp_state;
488         __u32   cur_qp_state;
489         __u32   path_mtu;
490         __u32   path_mig_state;
491         __u32   qkey;
492         __u32   rq_psn;
493         __u32   sq_psn;
494         __u32   dest_qp_num;
495         __u32   qp_access_flags;
496
497         struct ib_uverbs_ah_attr ah_attr;
498         struct ib_uverbs_ah_attr alt_ah_attr;
499
500         /* ib_qp_cap */
501         __u32   max_send_wr;
502         __u32   max_recv_wr;
503         __u32   max_send_sge;
504         __u32   max_recv_sge;
505         __u32   max_inline_data;
506
507         __u16   pkey_index;
508         __u16   alt_pkey_index;
509         __u8    en_sqd_async_notify;
510         __u8    sq_draining;
511         __u8    max_rd_atomic;
512         __u8    max_dest_rd_atomic;
513         __u8    min_rnr_timer;
514         __u8    port_num;
515         __u8    timeout;
516         __u8    retry_cnt;
517         __u8    rnr_retry;
518         __u8    alt_port_num;
519         __u8    alt_timeout;
520         __u8    reserved[5];
521 };
522
523 struct ib_uverbs_create_qp {
524         __u64 response;
525         __u64 user_handle;
526         __u32 pd_handle;
527         __u32 send_cq_handle;
528         __u32 recv_cq_handle;
529         __u32 srq_handle;
530         __u32 max_send_wr;
531         __u32 max_recv_wr;
532         __u32 max_send_sge;
533         __u32 max_recv_sge;
534         __u32 max_inline_data;
535         __u8  sq_sig_all;
536         __u8  qp_type;
537         __u8  is_srq;
538         __u8  reserved;
539         __u64 driver_data[0];
540 };
541
542 enum ib_uverbs_create_qp_mask {
543         IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
544 };
545
546 enum {
547         IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
548 };
549
550 enum {
551         IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
552 };
553
554 enum {
555         IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
556 };
557
558 struct ib_uverbs_ex_create_qp {
559         __u64 user_handle;
560         __u32 pd_handle;
561         __u32 send_cq_handle;
562         __u32 recv_cq_handle;
563         __u32 srq_handle;
564         __u32 max_send_wr;
565         __u32 max_recv_wr;
566         __u32 max_send_sge;
567         __u32 max_recv_sge;
568         __u32 max_inline_data;
569         __u8  sq_sig_all;
570         __u8  qp_type;
571         __u8  is_srq;
572         __u8 reserved;
573         __u32 comp_mask;
574         __u32 create_flags;
575         __u32 rwq_ind_tbl_handle;
576         __u32  reserved1;
577 };
578
579 struct ib_uverbs_open_qp {
580         __u64 response;
581         __u64 user_handle;
582         __u32 pd_handle;
583         __u32 qpn;
584         __u8  qp_type;
585         __u8  reserved[7];
586         __u64 driver_data[0];
587 };
588
589 /* also used for open response */
590 struct ib_uverbs_create_qp_resp {
591         __u32 qp_handle;
592         __u32 qpn;
593         __u32 max_send_wr;
594         __u32 max_recv_wr;
595         __u32 max_send_sge;
596         __u32 max_recv_sge;
597         __u32 max_inline_data;
598         __u32 reserved;
599 };
600
601 struct ib_uverbs_ex_create_qp_resp {
602         struct ib_uverbs_create_qp_resp base;
603         __u32 comp_mask;
604         __u32 response_length;
605 };
606
607 /*
608  * This struct needs to remain a multiple of 8 bytes to keep the
609  * alignment of the modify QP parameters.
610  */
611 struct ib_uverbs_qp_dest {
612         __u8  dgid[16];
613         __u32 flow_label;
614         __u16 dlid;
615         __u16 reserved;
616         __u8  sgid_index;
617         __u8  hop_limit;
618         __u8  traffic_class;
619         __u8  sl;
620         __u8  src_path_bits;
621         __u8  static_rate;
622         __u8  is_global;
623         __u8  port_num;
624 };
625
626 struct ib_uverbs_query_qp {
627         __u64 response;
628         __u32 qp_handle;
629         __u32 attr_mask;
630         __u64 driver_data[0];
631 };
632
633 struct ib_uverbs_query_qp_resp {
634         struct ib_uverbs_qp_dest dest;
635         struct ib_uverbs_qp_dest alt_dest;
636         __u32 max_send_wr;
637         __u32 max_recv_wr;
638         __u32 max_send_sge;
639         __u32 max_recv_sge;
640         __u32 max_inline_data;
641         __u32 qkey;
642         __u32 rq_psn;
643         __u32 sq_psn;
644         __u32 dest_qp_num;
645         __u32 qp_access_flags;
646         __u16 pkey_index;
647         __u16 alt_pkey_index;
648         __u8  qp_state;
649         __u8  cur_qp_state;
650         __u8  path_mtu;
651         __u8  path_mig_state;
652         __u8  sq_draining;
653         __u8  max_rd_atomic;
654         __u8  max_dest_rd_atomic;
655         __u8  min_rnr_timer;
656         __u8  port_num;
657         __u8  timeout;
658         __u8  retry_cnt;
659         __u8  rnr_retry;
660         __u8  alt_port_num;
661         __u8  alt_timeout;
662         __u8  sq_sig_all;
663         __u8  reserved[5];
664         __u64 driver_data[0];
665 };
666
667 struct ib_uverbs_modify_qp {
668         struct ib_uverbs_qp_dest dest;
669         struct ib_uverbs_qp_dest alt_dest;
670         __u32 qp_handle;
671         __u32 attr_mask;
672         __u32 qkey;
673         __u32 rq_psn;
674         __u32 sq_psn;
675         __u32 dest_qp_num;
676         __u32 qp_access_flags;
677         __u16 pkey_index;
678         __u16 alt_pkey_index;
679         __u8  qp_state;
680         __u8  cur_qp_state;
681         __u8  path_mtu;
682         __u8  path_mig_state;
683         __u8  en_sqd_async_notify;
684         __u8  max_rd_atomic;
685         __u8  max_dest_rd_atomic;
686         __u8  min_rnr_timer;
687         __u8  port_num;
688         __u8  timeout;
689         __u8  retry_cnt;
690         __u8  rnr_retry;
691         __u8  alt_port_num;
692         __u8  alt_timeout;
693         __u8  reserved[2];
694         __u64 driver_data[0];
695 };
696
697 struct ib_uverbs_ex_modify_qp {
698         struct ib_uverbs_modify_qp base;
699         __u32   rate_limit;
700         __u32   reserved;
701 };
702
703 struct ib_uverbs_modify_qp_resp {
704 };
705
706 struct ib_uverbs_ex_modify_qp_resp {
707         __u32  comp_mask;
708         __u32  response_length;
709 };
710
711 struct ib_uverbs_destroy_qp {
712         __u64 response;
713         __u32 qp_handle;
714         __u32 reserved;
715 };
716
717 struct ib_uverbs_destroy_qp_resp {
718         __u32 events_reported;
719 };
720
721 /*
722  * The ib_uverbs_sge structure isn't used anywhere, since we assume
723  * the ib_sge structure is packed the same way on 32-bit and 64-bit
724  * architectures in both kernel and user space.  It's just here to
725  * document the ABI.
726  */
727 struct ib_uverbs_sge {
728         __u64 addr;
729         __u32 length;
730         __u32 lkey;
731 };
732
733 struct ib_uverbs_send_wr {
734         __u64 wr_id;
735         __u32 num_sge;
736         __u32 opcode;
737         __u32 send_flags;
738         union {
739                 __u32 imm_data;
740                 __u32 invalidate_rkey;
741         } ex;
742         union {
743                 struct {
744                         __u64 remote_addr;
745                         __u32 rkey;
746                         __u32 reserved;
747                 } rdma;
748                 struct {
749                         __u64 remote_addr;
750                         __u64 compare_add;
751                         __u64 swap;
752                         __u32 rkey;
753                         __u32 reserved;
754                 } atomic;
755                 struct {
756                         __u32 ah;
757                         __u32 remote_qpn;
758                         __u32 remote_qkey;
759                         __u32 reserved;
760                 } ud;
761         } wr;
762 };
763
764 struct ib_uverbs_post_send {
765         __u64 response;
766         __u32 qp_handle;
767         __u32 wr_count;
768         __u32 sge_count;
769         __u32 wqe_size;
770         struct ib_uverbs_send_wr send_wr[0];
771 };
772
773 struct ib_uverbs_post_send_resp {
774         __u32 bad_wr;
775 };
776
777 struct ib_uverbs_recv_wr {
778         __u64 wr_id;
779         __u32 num_sge;
780         __u32 reserved;
781 };
782
783 struct ib_uverbs_post_recv {
784         __u64 response;
785         __u32 qp_handle;
786         __u32 wr_count;
787         __u32 sge_count;
788         __u32 wqe_size;
789         struct ib_uverbs_recv_wr recv_wr[0];
790 };
791
792 struct ib_uverbs_post_recv_resp {
793         __u32 bad_wr;
794 };
795
796 struct ib_uverbs_post_srq_recv {
797         __u64 response;
798         __u32 srq_handle;
799         __u32 wr_count;
800         __u32 sge_count;
801         __u32 wqe_size;
802         struct ib_uverbs_recv_wr recv[0];
803 };
804
805 struct ib_uverbs_post_srq_recv_resp {
806         __u32 bad_wr;
807 };
808
809 struct ib_uverbs_create_ah {
810         __u64 response;
811         __u64 user_handle;
812         __u32 pd_handle;
813         __u32 reserved;
814         struct ib_uverbs_ah_attr attr;
815 };
816
817 struct ib_uverbs_create_ah_resp {
818         __u32 ah_handle;
819 };
820
821 struct ib_uverbs_destroy_ah {
822         __u32 ah_handle;
823 };
824
825 struct ib_uverbs_attach_mcast {
826         __u8  gid[16];
827         __u32 qp_handle;
828         __u16 mlid;
829         __u16 reserved;
830         __u64 driver_data[0];
831 };
832
833 struct ib_uverbs_detach_mcast {
834         __u8  gid[16];
835         __u32 qp_handle;
836         __u16 mlid;
837         __u16 reserved;
838         __u64 driver_data[0];
839 };
840
841 struct ib_uverbs_flow_spec_hdr {
842         __u32 type;
843         __u16 size;
844         __u16 reserved;
845         /* followed by flow_spec */
846         __u64 flow_spec_data[0];
847 };
848
849 struct ib_uverbs_flow_eth_filter {
850         __u8  dst_mac[6];
851         __u8  src_mac[6];
852         __be16 ether_type;
853         __be16 vlan_tag;
854 };
855
856 struct ib_uverbs_flow_spec_eth {
857         union {
858                 struct ib_uverbs_flow_spec_hdr hdr;
859                 struct {
860                         __u32 type;
861                         __u16 size;
862                         __u16 reserved;
863                 };
864         };
865         struct ib_uverbs_flow_eth_filter val;
866         struct ib_uverbs_flow_eth_filter mask;
867 };
868
869 struct ib_uverbs_flow_ipv4_filter {
870         __be32 src_ip;
871         __be32 dst_ip;
872         __u8    proto;
873         __u8    tos;
874         __u8    ttl;
875         __u8    flags;
876 };
877
878 struct ib_uverbs_flow_spec_ipv4 {
879         union {
880                 struct ib_uverbs_flow_spec_hdr hdr;
881                 struct {
882                         __u32 type;
883                         __u16 size;
884                         __u16 reserved;
885                 };
886         };
887         struct ib_uverbs_flow_ipv4_filter val;
888         struct ib_uverbs_flow_ipv4_filter mask;
889 };
890
891 struct ib_uverbs_flow_tcp_udp_filter {
892         __be16 dst_port;
893         __be16 src_port;
894 };
895
896 struct ib_uverbs_flow_spec_tcp_udp {
897         union {
898                 struct ib_uverbs_flow_spec_hdr hdr;
899                 struct {
900                         __u32 type;
901                         __u16 size;
902                         __u16 reserved;
903                 };
904         };
905         struct ib_uverbs_flow_tcp_udp_filter val;
906         struct ib_uverbs_flow_tcp_udp_filter mask;
907 };
908
909 struct ib_uverbs_flow_ipv6_filter {
910         __u8    src_ip[16];
911         __u8    dst_ip[16];
912         __be32  flow_label;
913         __u8    next_hdr;
914         __u8    traffic_class;
915         __u8    hop_limit;
916         __u8    reserved;
917 };
918
919 struct ib_uverbs_flow_spec_ipv6 {
920         union {
921                 struct ib_uverbs_flow_spec_hdr hdr;
922                 struct {
923                         __u32 type;
924                         __u16 size;
925                         __u16 reserved;
926                 };
927         };
928         struct ib_uverbs_flow_ipv6_filter val;
929         struct ib_uverbs_flow_ipv6_filter mask;
930 };
931
932 struct ib_uverbs_flow_tunnel_filter {
933         __be32 tunnel_id;
934 };
935
936 struct ib_uverbs_flow_spec_tunnel {
937         union {
938                 struct ib_uverbs_flow_spec_hdr hdr;
939                 struct {
940                         __u32 type;
941                         __u16 size;
942                         __u16 reserved;
943                 };
944         };
945         struct ib_uverbs_flow_tunnel_filter val;
946         struct ib_uverbs_flow_tunnel_filter mask;
947 };
948
949 struct ib_uverbs_flow_attr {
950         __u32 type;
951         __u16 size;
952         __u16 priority;
953         __u8  num_of_specs;
954         __u8  reserved[2];
955         __u8  port;
956         __u32 flags;
957         /* Following are the optional layers according to user request
958          * struct ib_flow_spec_xxx
959          * struct ib_flow_spec_yyy
960          */
961         struct ib_uverbs_flow_spec_hdr flow_specs[0];
962 };
963
964 struct ib_uverbs_create_flow  {
965         __u32 comp_mask;
966         __u32 qp_handle;
967         struct ib_uverbs_flow_attr flow_attr;
968 };
969
970 struct ib_uverbs_create_flow_resp {
971         __u32 comp_mask;
972         __u32 flow_handle;
973 };
974
975 struct ib_uverbs_destroy_flow  {
976         __u32 comp_mask;
977         __u32 flow_handle;
978 };
979
980 struct ib_uverbs_create_srq {
981         __u64 response;
982         __u64 user_handle;
983         __u32 pd_handle;
984         __u32 max_wr;
985         __u32 max_sge;
986         __u32 srq_limit;
987         __u64 driver_data[0];
988 };
989
990 struct ib_uverbs_create_xsrq {
991         __u64 response;
992         __u64 user_handle;
993         __u32 srq_type;
994         __u32 pd_handle;
995         __u32 max_wr;
996         __u32 max_sge;
997         __u32 srq_limit;
998         __u32 reserved;
999         __u32 xrcd_handle;
1000         __u32 cq_handle;
1001         __u64 driver_data[0];
1002 };
1003
1004 struct ib_uverbs_create_srq_resp {
1005         __u32 srq_handle;
1006         __u32 max_wr;
1007         __u32 max_sge;
1008         __u32 srqn;
1009 };
1010
1011 struct ib_uverbs_modify_srq {
1012         __u32 srq_handle;
1013         __u32 attr_mask;
1014         __u32 max_wr;
1015         __u32 srq_limit;
1016         __u64 driver_data[0];
1017 };
1018
1019 struct ib_uverbs_query_srq {
1020         __u64 response;
1021         __u32 srq_handle;
1022         __u32 reserved;
1023         __u64 driver_data[0];
1024 };
1025
1026 struct ib_uverbs_query_srq_resp {
1027         __u32 max_wr;
1028         __u32 max_sge;
1029         __u32 srq_limit;
1030         __u32 reserved;
1031 };
1032
1033 struct ib_uverbs_destroy_srq {
1034         __u64 response;
1035         __u32 srq_handle;
1036         __u32 reserved;
1037 };
1038
1039 struct ib_uverbs_destroy_srq_resp {
1040         __u32 events_reported;
1041 };
1042
1043 struct ib_uverbs_ex_create_wq  {
1044         __u32 comp_mask;
1045         __u32 wq_type;
1046         __u64 user_handle;
1047         __u32 pd_handle;
1048         __u32 cq_handle;
1049         __u32 max_wr;
1050         __u32 max_sge;
1051 };
1052
1053 struct ib_uverbs_ex_create_wq_resp {
1054         __u32 comp_mask;
1055         __u32 response_length;
1056         __u32 wq_handle;
1057         __u32 max_wr;
1058         __u32 max_sge;
1059         __u32 wqn;
1060 };
1061
1062 struct ib_uverbs_ex_destroy_wq  {
1063         __u32 comp_mask;
1064         __u32 wq_handle;
1065 };
1066
1067 struct ib_uverbs_ex_destroy_wq_resp {
1068         __u32 comp_mask;
1069         __u32 response_length;
1070         __u32 events_reported;
1071         __u32 reserved;
1072 };
1073
1074 struct ib_uverbs_ex_modify_wq  {
1075         __u32 attr_mask;
1076         __u32 wq_handle;
1077         __u32 wq_state;
1078         __u32 curr_wq_state;
1079 };
1080
1081 /* Prevent memory allocation rather than max expected size */
1082 #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1083 struct ib_uverbs_ex_create_rwq_ind_table  {
1084         __u32 comp_mask;
1085         __u32 log_ind_tbl_size;
1086         /* Following are the wq handles according to log_ind_tbl_size
1087          * wq_handle1
1088          * wq_handle2
1089          */
1090         __u32 wq_handles[0];
1091 };
1092
1093 struct ib_uverbs_ex_create_rwq_ind_table_resp {
1094         __u32 comp_mask;
1095         __u32 response_length;
1096         __u32 ind_tbl_handle;
1097         __u32 ind_tbl_num;
1098 };
1099
1100 struct ib_uverbs_ex_destroy_rwq_ind_table  {
1101         __u32 comp_mask;
1102         __u32 ind_tbl_handle;
1103 };
1104
1105 #endif /* IB_USER_VERBS_H */