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