1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/*
3 * Copyright (c) 2005 Topspin Communications. All rights reserved.
4 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
5 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
6 * Copyright (c) 2006 Mellanox Technologies. All rights reserved.
7 *
8 * This software is available to you under a choice of one of two
9 * licenses. You may choose to be licensed under the terms of the GNU
10 * General Public License (GPL) Version 2, available from the file
11 * COPYING in the main directory of this source tree, or the
12 * OpenIB.org BSD license below:
13 *
14 * Redistribution and use in source and binary forms, with or
15 * without modification, are permitted provided that the following
16 * conditions are met:
17 *
18 * - Redistributions of source code must retain the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer.
21 *
22 * - Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials
25 * provided with the distribution.
26 *
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE.
35 */
36
37#ifndef IB_USER_VERBS_H
38#define IB_USER_VERBS_H
39
40#include <linux/types.h>
41
42/*
43 * Increment this value if any changes that break userspace ABI
44 * compatibility are made.
45 */
46#define IB_USER_VERBS_ABI_VERSION 6
47#define IB_USER_VERBS_CMD_THRESHOLD 50
48
49enum ib_uverbs_write_cmds {
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
93enum {
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 IB_USER_VERBS_EX_CMD_MODIFY_CQ
106};
107
108/* see IBA A19.4.1.1 Placement Types */
109enum ib_placement_type {
110 IB_FLUSH_GLOBAL = 1U << 0,
111 IB_FLUSH_PERSISTENT = 1U << 1,
112};
113
114/* see IBA A19.4.1.2 Selectivity Level */
115enum ib_selectivity_level {
116 IB_FLUSH_RANGE = 0,
117 IB_FLUSH_MR,
118};
119
120/*
121 * Make sure that all structs defined in this file remain laid out so
122 * that they pack the same way on 32-bit and 64-bit architectures (to
123 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
124 * Specifically:
125 * - Do not use pointer types -- pass pointers in __u64 instead.
126 * - Make sure that any structure larger than 4 bytes is padded to a
127 * multiple of 8 bytes. Otherwise the structure size will be
128 * different between 32-bit and 64-bit architectures.
129 */
130
131struct ib_uverbs_async_event_desc {
132 __aligned_u64 element;
133 __u32 event_type; /* enum ib_event_type */
134 __u32 reserved;
135};
136
137struct ib_uverbs_comp_event_desc {
138 __aligned_u64 cq_handle;
139};
140
141struct ib_uverbs_cq_moderation_caps {
142 __u16 max_cq_moderation_count;
143 __u16 max_cq_moderation_period;
144 __u32 reserved;
145};
146
147/*
148 * All commands from userspace should start with a __u32 command field
149 * followed by __u16 in_words and out_words fields (which give the
150 * length of the command block and response buffer if any in 32-bit
151 * words). The kernel driver will read these fields first and read
152 * the rest of the command struct based on these value.
153 */
154
155#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
156#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u
157
158struct ib_uverbs_cmd_hdr {
159 __u32 command;
160 __u16 in_words;
161 __u16 out_words;
162};
163
164struct ib_uverbs_ex_cmd_hdr {
165 __aligned_u64 response;
166 __u16 provider_in_words;
167 __u16 provider_out_words;
168 __u32 cmd_hdr_reserved;
169};
170
171struct ib_uverbs_get_context {
172 __aligned_u64 response;
173 __aligned_u64 driver_data[];
174};
175
176struct ib_uverbs_get_context_resp {
177 __u32 async_fd;
178 __u32 num_comp_vectors;
179 __aligned_u64 driver_data[];
180};
181
182struct ib_uverbs_query_device {
183 __aligned_u64 response;
184 __aligned_u64 driver_data[];
185};
186
187struct ib_uverbs_query_device_resp {
188 __aligned_u64 fw_ver;
189 __be64 node_guid;
190 __be64 sys_image_guid;
191 __aligned_u64 max_mr_size;
192 __aligned_u64 page_size_cap;
193 __u32 vendor_id;
194 __u32 vendor_part_id;
195 __u32 hw_ver;
196 __u32 max_qp;
197 __u32 max_qp_wr;
198 __u32 device_cap_flags;
199 __u32 max_sge;
200 __u32 max_sge_rd;
201 __u32 max_cq;
202 __u32 max_cqe;
203 __u32 max_mr;
204 __u32 max_pd;
205 __u32 max_qp_rd_atom;
206 __u32 max_ee_rd_atom;
207 __u32 max_res_rd_atom;
208 __u32 max_qp_init_rd_atom;
209 __u32 max_ee_init_rd_atom;
210 __u32 atomic_cap;
211 __u32 max_ee;
212 __u32 max_rdd;
213 __u32 max_mw;
214 __u32 max_raw_ipv6_qp;
215 __u32 max_raw_ethy_qp;
216 __u32 max_mcast_grp;
217 __u32 max_mcast_qp_attach;
218 __u32 max_total_mcast_qp_attach;
219 __u32 max_ah;
220 __u32 max_fmr;
221 __u32 max_map_per_fmr;
222 __u32 max_srq;
223 __u32 max_srq_wr;
224 __u32 max_srq_sge;
225 __u16 max_pkeys;
226 __u8 local_ca_ack_delay;
227 __u8 phys_port_cnt;
228 __u8 reserved[4];
229};
230
231struct ib_uverbs_ex_query_device {
232 __u32 comp_mask;
233 __u32 reserved;
234};
235
236struct ib_uverbs_odp_caps {
237 __aligned_u64 general_caps;
238 struct {
239 __u32 rc_odp_caps;
240 __u32 uc_odp_caps;
241 __u32 ud_odp_caps;
242 } per_transport_caps;
243 __u32 reserved;
244};
245
246struct ib_uverbs_rss_caps {
247 /* Corresponding bit will be set if qp type from
248 * 'enum ib_qp_type' is supported, e.g.
249 * supported_qpts |= 1 << IB_QPT_UD
250 */
251 __u32 supported_qpts;
252 __u32 max_rwq_indirection_tables;
253 __u32 max_rwq_indirection_table_size;
254 __u32 reserved;
255};
256
257struct ib_uverbs_tm_caps {
258 /* Max size of rendezvous request message */
259 __u32 max_rndv_hdr_size;
260 /* Max number of entries in tag matching list */
261 __u32 max_num_tags;
262 /* TM flags */
263 __u32 flags;
264 /* Max number of outstanding list operations */
265 __u32 max_ops;
266 /* Max number of SGE in tag matching entry */
267 __u32 max_sge;
268 __u32 reserved;
269};
270
271struct ib_uverbs_ex_query_device_resp {
272 struct ib_uverbs_query_device_resp base;
273 __u32 comp_mask;
274 __u32 response_length;
275 struct ib_uverbs_odp_caps odp_caps;
276 __aligned_u64 timestamp_mask;
277 __aligned_u64 hca_core_clock; /* in KHZ */
278 __aligned_u64 device_cap_flags_ex;
279 struct ib_uverbs_rss_caps rss_caps;
280 __u32 max_wq_type_rq;
281 __u32 raw_packet_caps;
282 struct ib_uverbs_tm_caps tm_caps;
283 struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
284 __aligned_u64 max_dm_size;
285 __u32 xrc_odp_caps;
286 __u32 reserved;
287};
288
289struct ib_uverbs_query_port {
290 __aligned_u64 response;
291 __u8 port_num;
292 __u8 reserved[7];
293 __aligned_u64 driver_data[];
294};
295
296struct ib_uverbs_query_port_resp {
297 __u32 port_cap_flags; /* see ib_uverbs_query_port_cap_flags */
298 __u32 max_msg_sz;
299 __u32 bad_pkey_cntr;
300 __u32 qkey_viol_cntr;
301 __u32 gid_tbl_len;
302 __u16 pkey_tbl_len;
303 __u16 lid;
304 __u16 sm_lid;
305 __u8 state;
306 __u8 max_mtu;
307 __u8 active_mtu;
308 __u8 lmc;
309 __u8 max_vl_num;
310 __u8 sm_sl;
311 __u8 subnet_timeout;
312 __u8 init_type_reply;
313 __u8 active_width;
314 __u8 active_speed;
315 __u8 phys_state;
316 __u8 link_layer;
317 __u8 flags; /* see ib_uverbs_query_port_flags */
318 __u8 reserved;
319};
320
321struct ib_uverbs_alloc_pd {
322 __aligned_u64 response;
323 __aligned_u64 driver_data[];
324};
325
326struct ib_uverbs_alloc_pd_resp {
327 __u32 pd_handle;
328 __u32 driver_data[];
329};
330
331struct ib_uverbs_dealloc_pd {
332 __u32 pd_handle;
333};
334
335struct ib_uverbs_open_xrcd {
336 __aligned_u64 response;
337 __u32 fd;
338 __u32 oflags;
339 __aligned_u64 driver_data[];
340};
341
342struct ib_uverbs_open_xrcd_resp {
343 __u32 xrcd_handle;
344 __u32 driver_data[];
345};
346
347struct ib_uverbs_close_xrcd {
348 __u32 xrcd_handle;
349};
350
351struct ib_uverbs_reg_mr {
352 __aligned_u64 response;
353 __aligned_u64 start;
354 __aligned_u64 length;
355 __aligned_u64 hca_va;
356 __u32 pd_handle;
357 __u32 access_flags;
358 __aligned_u64 driver_data[];
359};
360
361struct ib_uverbs_reg_mr_resp {
362 __u32 mr_handle;
363 __u32 lkey;
364 __u32 rkey;
365 __u32 driver_data[];
366};
367
368struct ib_uverbs_rereg_mr {
369 __aligned_u64 response;
370 __u32 mr_handle;
371 __u32 flags;
372 __aligned_u64 start;
373 __aligned_u64 length;
374 __aligned_u64 hca_va;
375 __u32 pd_handle;
376 __u32 access_flags;
377 __aligned_u64 driver_data[];
378};
379
380struct ib_uverbs_rereg_mr_resp {
381 __u32 lkey;
382 __u32 rkey;
383 __aligned_u64 driver_data[];
384};
385
386struct ib_uverbs_dereg_mr {
387 __u32 mr_handle;
388};
389
390struct ib_uverbs_alloc_mw {
391 __aligned_u64 response;
392 __u32 pd_handle;
393 __u8 mw_type;
394 __u8 reserved[3];
395 __aligned_u64 driver_data[];
396};
397
398struct ib_uverbs_alloc_mw_resp {
399 __u32 mw_handle;
400 __u32 rkey;
401 __aligned_u64 driver_data[];
402};
403
404struct ib_uverbs_dealloc_mw {
405 __u32 mw_handle;
406};
407
408struct ib_uverbs_create_comp_channel {
409 __aligned_u64 response;
410};
411
412struct ib_uverbs_create_comp_channel_resp {
413 __u32 fd;
414};
415
416struct ib_uverbs_create_cq {
417 __aligned_u64 response;
418 __aligned_u64 user_handle;
419 __u32 cqe;
420 __u32 comp_vector;
421 __s32 comp_channel;
422 __u32 reserved;
423 __aligned_u64 driver_data[];
424};
425
426enum ib_uverbs_ex_create_cq_flags {
427 IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0,
428 IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1,
429};
430
431struct ib_uverbs_ex_create_cq {
432 __aligned_u64 user_handle;
433 __u32 cqe;
434 __u32 comp_vector;
435 __s32 comp_channel;
436 __u32 comp_mask;
437 __u32 flags; /* bitmask of ib_uverbs_ex_create_cq_flags */
438 __u32 reserved;
439};
440
441struct ib_uverbs_create_cq_resp {
442 __u32 cq_handle;
443 __u32 cqe;
444 __aligned_u64 driver_data[0];
445};
446
447struct ib_uverbs_ex_create_cq_resp {
448 struct ib_uverbs_create_cq_resp base;
449 __u32 comp_mask;
450 __u32 response_length;
451};
452
453struct ib_uverbs_resize_cq {
454 __aligned_u64 response;
455 __u32 cq_handle;
456 __u32 cqe;
457 __aligned_u64 driver_data[];
458};
459
460struct ib_uverbs_resize_cq_resp {
461 __u32 cqe;
462 __u32 reserved;
463 __aligned_u64 driver_data[];
464};
465
466struct ib_uverbs_poll_cq {
467 __aligned_u64 response;
468 __u32 cq_handle;
469 __u32 ne;
470};
471
472enum ib_uverbs_wc_opcode {
473 IB_UVERBS_WC_SEND = 0,
474 IB_UVERBS_WC_RDMA_WRITE = 1,
475 IB_UVERBS_WC_RDMA_READ = 2,
476 IB_UVERBS_WC_COMP_SWAP = 3,
477 IB_UVERBS_WC_FETCH_ADD = 4,
478 IB_UVERBS_WC_BIND_MW = 5,
479 IB_UVERBS_WC_LOCAL_INV = 6,
480 IB_UVERBS_WC_TSO = 7,
481 IB_UVERBS_WC_FLUSH = 8,
482 IB_UVERBS_WC_ATOMIC_WRITE = 9,
483};
484
485struct ib_uverbs_wc {
486 __aligned_u64 wr_id;
487 __u32 status;
488 __u32 opcode;
489 __u32 vendor_err;
490 __u32 byte_len;
491 union {
492 __be32 imm_data;
493 __u32 invalidate_rkey;
494 } ex;
495 __u32 qp_num;
496 __u32 src_qp;
497 __u32 wc_flags;
498 __u16 pkey_index;
499 __u16 slid;
500 __u8 sl;
501 __u8 dlid_path_bits;
502 __u8 port_num;
503 __u8 reserved;
504};
505
506struct ib_uverbs_poll_cq_resp {
507 __u32 count;
508 __u32 reserved;
509 struct ib_uverbs_wc wc[];
510};
511
512struct ib_uverbs_req_notify_cq {
513 __u32 cq_handle;
514 __u32 solicited_only;
515};
516
517struct ib_uverbs_destroy_cq {
518 __aligned_u64 response;
519 __u32 cq_handle;
520 __u32 reserved;
521};
522
523struct ib_uverbs_destroy_cq_resp {
524 __u32 comp_events_reported;
525 __u32 async_events_reported;
526};
527
528struct ib_uverbs_global_route {
529 __u8 dgid[16];
530 __u32 flow_label;
531 __u8 sgid_index;
532 __u8 hop_limit;
533 __u8 traffic_class;
534 __u8 reserved;
535};
536
537struct ib_uverbs_ah_attr {
538 struct ib_uverbs_global_route grh;
539 __u16 dlid;
540 __u8 sl;
541 __u8 src_path_bits;
542 __u8 static_rate;
543 __u8 is_global;
544 __u8 port_num;
545 __u8 reserved;
546};
547
548struct ib_uverbs_qp_attr {
549 __u32 qp_attr_mask;
550 __u32 qp_state;
551 __u32 cur_qp_state;
552 __u32 path_mtu;
553 __u32 path_mig_state;
554 __u32 qkey;
555 __u32 rq_psn;
556 __u32 sq_psn;
557 __u32 dest_qp_num;
558 __u32 qp_access_flags;
559
560 struct ib_uverbs_ah_attr ah_attr;
561 struct ib_uverbs_ah_attr alt_ah_attr;
562
563 /* ib_qp_cap */
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
570 __u16 pkey_index;
571 __u16 alt_pkey_index;
572 __u8 en_sqd_async_notify;
573 __u8 sq_draining;
574 __u8 max_rd_atomic;
575 __u8 max_dest_rd_atomic;
576 __u8 min_rnr_timer;
577 __u8 port_num;
578 __u8 timeout;
579 __u8 retry_cnt;
580 __u8 rnr_retry;
581 __u8 alt_port_num;
582 __u8 alt_timeout;
583 __u8 reserved[5];
584};
585
586struct ib_uverbs_create_qp {
587 __aligned_u64 response;
588 __aligned_u64 user_handle;
589 __u32 pd_handle;
590 __u32 send_cq_handle;
591 __u32 recv_cq_handle;
592 __u32 srq_handle;
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 __u8 sq_sig_all;
599 __u8 qp_type;
600 __u8 is_srq;
601 __u8 reserved;
602 __aligned_u64 driver_data[];
603};
604
605enum ib_uverbs_create_qp_mask {
606 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
607};
608
609enum {
610 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
611};
612
613struct ib_uverbs_ex_create_qp {
614 __aligned_u64 user_handle;
615 __u32 pd_handle;
616 __u32 send_cq_handle;
617 __u32 recv_cq_handle;
618 __u32 srq_handle;
619 __u32 max_send_wr;
620 __u32 max_recv_wr;
621 __u32 max_send_sge;
622 __u32 max_recv_sge;
623 __u32 max_inline_data;
624 __u8 sq_sig_all;
625 __u8 qp_type;
626 __u8 is_srq;
627 __u8 reserved;
628 __u32 comp_mask;
629 __u32 create_flags;
630 __u32 rwq_ind_tbl_handle;
631 __u32 source_qpn;
632};
633
634struct ib_uverbs_open_qp {
635 __aligned_u64 response;
636 __aligned_u64 user_handle;
637 __u32 pd_handle;
638 __u32 qpn;
639 __u8 qp_type;
640 __u8 reserved[7];
641 __aligned_u64 driver_data[];
642};
643
644/* also used for open response */
645struct ib_uverbs_create_qp_resp {
646 __u32 qp_handle;
647 __u32 qpn;
648 __u32 max_send_wr;
649 __u32 max_recv_wr;
650 __u32 max_send_sge;
651 __u32 max_recv_sge;
652 __u32 max_inline_data;
653 __u32 reserved;
654 __u32 driver_data[0];
655};
656
657struct ib_uverbs_ex_create_qp_resp {
658 struct ib_uverbs_create_qp_resp base;
659 __u32 comp_mask;
660 __u32 response_length;
661};
662
663/*
664 * This struct needs to remain a multiple of 8 bytes to keep the
665 * alignment of the modify QP parameters.
666 */
667struct ib_uverbs_qp_dest {
668 __u8 dgid[16];
669 __u32 flow_label;
670 __u16 dlid;
671 __u16 reserved;
672 __u8 sgid_index;
673 __u8 hop_limit;
674 __u8 traffic_class;
675 __u8 sl;
676 __u8 src_path_bits;
677 __u8 static_rate;
678 __u8 is_global;
679 __u8 port_num;
680};
681
682struct ib_uverbs_query_qp {
683 __aligned_u64 response;
684 __u32 qp_handle;
685 __u32 attr_mask;
686 __aligned_u64 driver_data[];
687};
688
689struct ib_uverbs_query_qp_resp {
690 struct ib_uverbs_qp_dest dest;
691 struct ib_uverbs_qp_dest alt_dest;
692 __u32 max_send_wr;
693 __u32 max_recv_wr;
694 __u32 max_send_sge;
695 __u32 max_recv_sge;
696 __u32 max_inline_data;
697 __u32 qkey;
698 __u32 rq_psn;
699 __u32 sq_psn;
700 __u32 dest_qp_num;
701 __u32 qp_access_flags;
702 __u16 pkey_index;
703 __u16 alt_pkey_index;
704 __u8 qp_state;
705 __u8 cur_qp_state;
706 __u8 path_mtu;
707 __u8 path_mig_state;
708 __u8 sq_draining;
709 __u8 max_rd_atomic;
710 __u8 max_dest_rd_atomic;
711 __u8 min_rnr_timer;
712 __u8 port_num;
713 __u8 timeout;
714 __u8 retry_cnt;
715 __u8 rnr_retry;
716 __u8 alt_port_num;
717 __u8 alt_timeout;
718 __u8 sq_sig_all;
719 __u8 reserved[5];
720 __aligned_u64 driver_data[];
721};
722
723struct ib_uverbs_modify_qp {
724 struct ib_uverbs_qp_dest dest;
725 struct ib_uverbs_qp_dest alt_dest;
726 __u32 qp_handle;
727 __u32 attr_mask;
728 __u32 qkey;
729 __u32 rq_psn;
730 __u32 sq_psn;
731 __u32 dest_qp_num;
732 __u32 qp_access_flags;
733 __u16 pkey_index;
734 __u16 alt_pkey_index;
735 __u8 qp_state;
736 __u8 cur_qp_state;
737 __u8 path_mtu;
738 __u8 path_mig_state;
739 __u8 en_sqd_async_notify;
740 __u8 max_rd_atomic;
741 __u8 max_dest_rd_atomic;
742 __u8 min_rnr_timer;
743 __u8 port_num;
744 __u8 timeout;
745 __u8 retry_cnt;
746 __u8 rnr_retry;
747 __u8 alt_port_num;
748 __u8 alt_timeout;
749 __u8 reserved[2];
750 __aligned_u64 driver_data[0];
751};
752
753struct ib_uverbs_ex_modify_qp {
754 struct ib_uverbs_modify_qp base;
755 __u32 rate_limit;
756 __u32 reserved;
757};
758
759struct ib_uverbs_ex_modify_qp_resp {
760 __u32 comp_mask;
761 __u32 response_length;
762};
763
764struct ib_uverbs_destroy_qp {
765 __aligned_u64 response;
766 __u32 qp_handle;
767 __u32 reserved;
768};
769
770struct ib_uverbs_destroy_qp_resp {
771 __u32 events_reported;
772};
773
774/*
775 * The ib_uverbs_sge structure isn't used anywhere, since we assume
776 * the ib_sge structure is packed the same way on 32-bit and 64-bit
777 * architectures in both kernel and user space. It's just here to
778 * document the ABI.
779 */
780struct ib_uverbs_sge {
781 __aligned_u64 addr;
782 __u32 length;
783 __u32 lkey;
784};
785
786enum ib_uverbs_wr_opcode {
787 IB_UVERBS_WR_RDMA_WRITE = 0,
788 IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1,
789 IB_UVERBS_WR_SEND = 2,
790 IB_UVERBS_WR_SEND_WITH_IMM = 3,
791 IB_UVERBS_WR_RDMA_READ = 4,
792 IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5,
793 IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6,
794 IB_UVERBS_WR_LOCAL_INV = 7,
795 IB_UVERBS_WR_BIND_MW = 8,
796 IB_UVERBS_WR_SEND_WITH_INV = 9,
797 IB_UVERBS_WR_TSO = 10,
798 IB_UVERBS_WR_RDMA_READ_WITH_INV = 11,
799 IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12,
800 IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13,
801 IB_UVERBS_WR_FLUSH = 14,
802 IB_UVERBS_WR_ATOMIC_WRITE = 15,
803 /* Review enum ib_wr_opcode before modifying this */
804};
805
806struct ib_uverbs_send_wr {
807 __aligned_u64 wr_id;
808 __u32 num_sge;
809 __u32 opcode; /* see enum ib_uverbs_wr_opcode */
810 __u32 send_flags;
811 union {
812 __be32 imm_data;
813 __u32 invalidate_rkey;
814 } ex;
815 union {
816 struct {
817 __aligned_u64 remote_addr;
818 __u32 rkey;
819 __u32 reserved;
820 } rdma;
821 struct {
822 __aligned_u64 remote_addr;
823 __aligned_u64 compare_add;
824 __aligned_u64 swap;
825 __u32 rkey;
826 __u32 reserved;
827 } atomic;
828 struct {
829 __u32 ah;
830 __u32 remote_qpn;
831 __u32 remote_qkey;
832 __u32 reserved;
833 } ud;
834 } wr;
835};
836
837struct ib_uverbs_post_send {
838 __aligned_u64 response;
839 __u32 qp_handle;
840 __u32 wr_count;
841 __u32 sge_count;
842 __u32 wqe_size;
843 struct ib_uverbs_send_wr send_wr[];
844};
845
846struct ib_uverbs_post_send_resp {
847 __u32 bad_wr;
848};
849
850struct ib_uverbs_recv_wr {
851 __aligned_u64 wr_id;
852 __u32 num_sge;
853 __u32 reserved;
854};
855
856struct ib_uverbs_post_recv {
857 __aligned_u64 response;
858 __u32 qp_handle;
859 __u32 wr_count;
860 __u32 sge_count;
861 __u32 wqe_size;
862 struct ib_uverbs_recv_wr recv_wr[];
863};
864
865struct ib_uverbs_post_recv_resp {
866 __u32 bad_wr;
867};
868
869struct ib_uverbs_post_srq_recv {
870 __aligned_u64 response;
871 __u32 srq_handle;
872 __u32 wr_count;
873 __u32 sge_count;
874 __u32 wqe_size;
875 struct ib_uverbs_recv_wr recv[];
876};
877
878struct ib_uverbs_post_srq_recv_resp {
879 __u32 bad_wr;
880};
881
882struct ib_uverbs_create_ah {
883 __aligned_u64 response;
884 __aligned_u64 user_handle;
885 __u32 pd_handle;
886 __u32 reserved;
887 struct ib_uverbs_ah_attr attr;
888 __aligned_u64 driver_data[];
889};
890
891struct ib_uverbs_create_ah_resp {
892 __u32 ah_handle;
893 __u32 driver_data[];
894};
895
896struct ib_uverbs_destroy_ah {
897 __u32 ah_handle;
898};
899
900struct ib_uverbs_attach_mcast {
901 __u8 gid[16];
902 __u32 qp_handle;
903 __u16 mlid;
904 __u16 reserved;
905 __aligned_u64 driver_data[];
906};
907
908struct ib_uverbs_detach_mcast {
909 __u8 gid[16];
910 __u32 qp_handle;
911 __u16 mlid;
912 __u16 reserved;
913 __aligned_u64 driver_data[];
914};
915
916struct ib_uverbs_flow_spec_hdr {
917 __u32 type;
918 __u16 size;
919 __u16 reserved;
920 /* followed by flow_spec */
921 __aligned_u64 flow_spec_data[0];
922};
923
924struct ib_uverbs_flow_eth_filter {
925 __u8 dst_mac[6];
926 __u8 src_mac[6];
927 __be16 ether_type;
928 __be16 vlan_tag;
929};
930
931struct ib_uverbs_flow_spec_eth {
932 union {
933 struct ib_uverbs_flow_spec_hdr hdr;
934 struct {
935 __u32 type;
936 __u16 size;
937 __u16 reserved;
938 };
939 };
940 struct ib_uverbs_flow_eth_filter val;
941 struct ib_uverbs_flow_eth_filter mask;
942};
943
944struct ib_uverbs_flow_ipv4_filter {
945 __be32 src_ip;
946 __be32 dst_ip;
947 __u8 proto;
948 __u8 tos;
949 __u8 ttl;
950 __u8 flags;
951};
952
953struct ib_uverbs_flow_spec_ipv4 {
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_ipv4_filter val;
963 struct ib_uverbs_flow_ipv4_filter mask;
964};
965
966struct ib_uverbs_flow_tcp_udp_filter {
967 __be16 dst_port;
968 __be16 src_port;
969};
970
971struct ib_uverbs_flow_spec_tcp_udp {
972 union {
973 struct ib_uverbs_flow_spec_hdr hdr;
974 struct {
975 __u32 type;
976 __u16 size;
977 __u16 reserved;
978 };
979 };
980 struct ib_uverbs_flow_tcp_udp_filter val;
981 struct ib_uverbs_flow_tcp_udp_filter mask;
982};
983
984struct ib_uverbs_flow_ipv6_filter {
985 __u8 src_ip[16];
986 __u8 dst_ip[16];
987 __be32 flow_label;
988 __u8 next_hdr;
989 __u8 traffic_class;
990 __u8 hop_limit;
991 __u8 reserved;
992};
993
994struct ib_uverbs_flow_spec_ipv6 {
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_ipv6_filter val;
1004 struct ib_uverbs_flow_ipv6_filter mask;
1005};
1006
1007struct ib_uverbs_flow_spec_action_tag {
1008 union {
1009 struct ib_uverbs_flow_spec_hdr hdr;
1010 struct {
1011 __u32 type;
1012 __u16 size;
1013 __u16 reserved;
1014 };
1015 };
1016 __u32 tag_id;
1017 __u32 reserved1;
1018};
1019
1020struct ib_uverbs_flow_spec_action_drop {
1021 union {
1022 struct ib_uverbs_flow_spec_hdr hdr;
1023 struct {
1024 __u32 type;
1025 __u16 size;
1026 __u16 reserved;
1027 };
1028 };
1029};
1030
1031struct ib_uverbs_flow_spec_action_handle {
1032 union {
1033 struct ib_uverbs_flow_spec_hdr hdr;
1034 struct {
1035 __u32 type;
1036 __u16 size;
1037 __u16 reserved;
1038 };
1039 };
1040 __u32 handle;
1041 __u32 reserved1;
1042};
1043
1044struct ib_uverbs_flow_spec_action_count {
1045 union {
1046 struct ib_uverbs_flow_spec_hdr hdr;
1047 struct {
1048 __u32 type;
1049 __u16 size;
1050 __u16 reserved;
1051 };
1052 };
1053 __u32 handle;
1054 __u32 reserved1;
1055};
1056
1057struct ib_uverbs_flow_tunnel_filter {
1058 __be32 tunnel_id;
1059};
1060
1061struct ib_uverbs_flow_spec_tunnel {
1062 union {
1063 struct ib_uverbs_flow_spec_hdr hdr;
1064 struct {
1065 __u32 type;
1066 __u16 size;
1067 __u16 reserved;
1068 };
1069 };
1070 struct ib_uverbs_flow_tunnel_filter val;
1071 struct ib_uverbs_flow_tunnel_filter mask;
1072};
1073
1074struct ib_uverbs_flow_spec_esp_filter {
1075 __u32 spi;
1076 __u32 seq;
1077};
1078
1079struct ib_uverbs_flow_spec_esp {
1080 union {
1081 struct ib_uverbs_flow_spec_hdr hdr;
1082 struct {
1083 __u32 type;
1084 __u16 size;
1085 __u16 reserved;
1086 };
1087 };
1088 struct ib_uverbs_flow_spec_esp_filter val;
1089 struct ib_uverbs_flow_spec_esp_filter mask;
1090};
1091
1092struct ib_uverbs_flow_gre_filter {
1093 /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header:
1094 * bit 0 - C - checksum bit.
1095 * bit 1 - reserved. set to 0.
1096 * bit 2 - key bit.
1097 * bit 3 - sequence number bit.
1098 * bits 4:12 - reserved. set to 0.
1099 * bits 13:15 - GRE version.
1100 */
1101 __be16 c_ks_res0_ver;
1102 __be16 protocol;
1103 __be32 key;
1104};
1105
1106struct ib_uverbs_flow_spec_gre {
1107 union {
1108 struct ib_uverbs_flow_spec_hdr hdr;
1109 struct {
1110 __u32 type;
1111 __u16 size;
1112 __u16 reserved;
1113 };
1114 };
1115 struct ib_uverbs_flow_gre_filter val;
1116 struct ib_uverbs_flow_gre_filter mask;
1117};
1118
1119struct ib_uverbs_flow_mpls_filter {
1120 /* The field includes the entire MPLS label:
1121 * bits 0:19 - label field.
1122 * bits 20:22 - traffic class field.
1123 * bits 23 - bottom of stack bit.
1124 * bits 24:31 - ttl field.
1125 */
1126 __be32 label;
1127};
1128
1129struct ib_uverbs_flow_spec_mpls {
1130 union {
1131 struct ib_uverbs_flow_spec_hdr hdr;
1132 struct {
1133 __u32 type;
1134 __u16 size;
1135 __u16 reserved;
1136 };
1137 };
1138 struct ib_uverbs_flow_mpls_filter val;
1139 struct ib_uverbs_flow_mpls_filter mask;
1140};
1141
1142struct ib_uverbs_flow_attr {
1143 __u32 type;
1144 __u16 size;
1145 __u16 priority;
1146 __u8 num_of_specs;
1147 __u8 reserved[2];
1148 __u8 port;
1149 __u32 flags;
1150 /* Following are the optional layers according to user request
1151 * struct ib_flow_spec_xxx
1152 * struct ib_flow_spec_yyy
1153 */
1154 struct ib_uverbs_flow_spec_hdr flow_specs[];
1155};
1156
1157struct ib_uverbs_create_flow {
1158 __u32 comp_mask;
1159 __u32 qp_handle;
1160 struct ib_uverbs_flow_attr flow_attr;
1161};
1162
1163struct ib_uverbs_create_flow_resp {
1164 __u32 comp_mask;
1165 __u32 flow_handle;
1166};
1167
1168struct ib_uverbs_destroy_flow {
1169 __u32 comp_mask;
1170 __u32 flow_handle;
1171};
1172
1173struct ib_uverbs_create_srq {
1174 __aligned_u64 response;
1175 __aligned_u64 user_handle;
1176 __u32 pd_handle;
1177 __u32 max_wr;
1178 __u32 max_sge;
1179 __u32 srq_limit;
1180 __aligned_u64 driver_data[];
1181};
1182
1183struct ib_uverbs_create_xsrq {
1184 __aligned_u64 response;
1185 __aligned_u64 user_handle;
1186 __u32 srq_type;
1187 __u32 pd_handle;
1188 __u32 max_wr;
1189 __u32 max_sge;
1190 __u32 srq_limit;
1191 __u32 max_num_tags;
1192 __u32 xrcd_handle;
1193 __u32 cq_handle;
1194 __aligned_u64 driver_data[];
1195};
1196
1197struct ib_uverbs_create_srq_resp {
1198 __u32 srq_handle;
1199 __u32 max_wr;
1200 __u32 max_sge;
1201 __u32 srqn;
1202 __u32 driver_data[];
1203};
1204
1205struct ib_uverbs_modify_srq {
1206 __u32 srq_handle;
1207 __u32 attr_mask;
1208 __u32 max_wr;
1209 __u32 srq_limit;
1210 __aligned_u64 driver_data[];
1211};
1212
1213struct ib_uverbs_query_srq {
1214 __aligned_u64 response;
1215 __u32 srq_handle;
1216 __u32 reserved;
1217 __aligned_u64 driver_data[];
1218};
1219
1220struct ib_uverbs_query_srq_resp {
1221 __u32 max_wr;
1222 __u32 max_sge;
1223 __u32 srq_limit;
1224 __u32 reserved;
1225};
1226
1227struct ib_uverbs_destroy_srq {
1228 __aligned_u64 response;
1229 __u32 srq_handle;
1230 __u32 reserved;
1231};
1232
1233struct ib_uverbs_destroy_srq_resp {
1234 __u32 events_reported;
1235};
1236
1237struct ib_uverbs_ex_create_wq {
1238 __u32 comp_mask;
1239 __u32 wq_type;
1240 __aligned_u64 user_handle;
1241 __u32 pd_handle;
1242 __u32 cq_handle;
1243 __u32 max_wr;
1244 __u32 max_sge;
1245 __u32 create_flags; /* Use enum ib_wq_flags */
1246 __u32 reserved;
1247};
1248
1249struct ib_uverbs_ex_create_wq_resp {
1250 __u32 comp_mask;
1251 __u32 response_length;
1252 __u32 wq_handle;
1253 __u32 max_wr;
1254 __u32 max_sge;
1255 __u32 wqn;
1256};
1257
1258struct ib_uverbs_ex_destroy_wq {
1259 __u32 comp_mask;
1260 __u32 wq_handle;
1261};
1262
1263struct ib_uverbs_ex_destroy_wq_resp {
1264 __u32 comp_mask;
1265 __u32 response_length;
1266 __u32 events_reported;
1267 __u32 reserved;
1268};
1269
1270struct ib_uverbs_ex_modify_wq {
1271 __u32 attr_mask;
1272 __u32 wq_handle;
1273 __u32 wq_state;
1274 __u32 curr_wq_state;
1275 __u32 flags; /* Use enum ib_wq_flags */
1276 __u32 flags_mask; /* Use enum ib_wq_flags */
1277};
1278
1279/* Prevent memory allocation rather than max expected size */
1280#define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1281struct ib_uverbs_ex_create_rwq_ind_table {
1282 __u32 comp_mask;
1283 __u32 log_ind_tbl_size;
1284 /* Following are the wq handles according to log_ind_tbl_size
1285 * wq_handle1
1286 * wq_handle2
1287 */
1288 __u32 wq_handles[];
1289};
1290
1291struct ib_uverbs_ex_create_rwq_ind_table_resp {
1292 __u32 comp_mask;
1293 __u32 response_length;
1294 __u32 ind_tbl_handle;
1295 __u32 ind_tbl_num;
1296};
1297
1298struct ib_uverbs_ex_destroy_rwq_ind_table {
1299 __u32 comp_mask;
1300 __u32 ind_tbl_handle;
1301};
1302
1303struct ib_uverbs_cq_moderation {
1304 __u16 cq_count;
1305 __u16 cq_period;
1306};
1307
1308struct ib_uverbs_ex_modify_cq {
1309 __u32 cq_handle;
1310 __u32 attr_mask;
1311 struct ib_uverbs_cq_moderation attr;
1312 __u32 reserved;
1313};
1314
1315#define IB_DEVICE_NAME_MAX 64
1316
1317/*
1318 * bits 9, 15, 16, 19, 22, 27, 30, 31, 32, 33, 35 and 37 may be set by old
1319 * kernels and should not be used.
1320 */
1321enum ib_uverbs_device_cap_flags {
1322 IB_UVERBS_DEVICE_RESIZE_MAX_WR = 1 << 0,
1323 IB_UVERBS_DEVICE_BAD_PKEY_CNTR = 1 << 1,
1324 IB_UVERBS_DEVICE_BAD_QKEY_CNTR = 1 << 2,
1325 IB_UVERBS_DEVICE_RAW_MULTI = 1 << 3,
1326 IB_UVERBS_DEVICE_AUTO_PATH_MIG = 1 << 4,
1327 IB_UVERBS_DEVICE_CHANGE_PHY_PORT = 1 << 5,
1328 IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE = 1 << 6,
1329 IB_UVERBS_DEVICE_CURR_QP_STATE_MOD = 1 << 7,
1330 IB_UVERBS_DEVICE_SHUTDOWN_PORT = 1 << 8,
1331 /* IB_UVERBS_DEVICE_INIT_TYPE = 1 << 9, (not in use) */
1332 IB_UVERBS_DEVICE_PORT_ACTIVE_EVENT = 1 << 10,
1333 IB_UVERBS_DEVICE_SYS_IMAGE_GUID = 1 << 11,
1334 IB_UVERBS_DEVICE_RC_RNR_NAK_GEN = 1 << 12,
1335 IB_UVERBS_DEVICE_SRQ_RESIZE = 1 << 13,
1336 IB_UVERBS_DEVICE_N_NOTIFY_CQ = 1 << 14,
1337 IB_UVERBS_DEVICE_MEM_WINDOW = 1 << 17,
1338 IB_UVERBS_DEVICE_UD_IP_CSUM = 1 << 18,
1339 IB_UVERBS_DEVICE_XRC = 1 << 20,
1340 IB_UVERBS_DEVICE_MEM_MGT_EXTENSIONS = 1 << 21,
1341 IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2A = 1 << 23,
1342 IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2B = 1 << 24,
1343 IB_UVERBS_DEVICE_RC_IP_CSUM = 1 << 25,
1344 /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_IP_CSUM. */
1345 IB_UVERBS_DEVICE_RAW_IP_CSUM = 1 << 26,
1346 IB_UVERBS_DEVICE_MANAGED_FLOW_STEERING = 1 << 29,
1347 /* Deprecated. Please use IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS. */
1348 IB_UVERBS_DEVICE_RAW_SCATTER_FCS = 1ULL << 34,
1349 IB_UVERBS_DEVICE_PCI_WRITE_END_PADDING = 1ULL << 36,
1350 /* Flush placement types */
1351 IB_UVERBS_DEVICE_FLUSH_GLOBAL = 1ULL << 38,
1352 IB_UVERBS_DEVICE_FLUSH_PERSISTENT = 1ULL << 39,
1353 /* Atomic write attributes */
1354 IB_UVERBS_DEVICE_ATOMIC_WRITE = 1ULL << 40,
1355};
1356
1357enum ib_uverbs_raw_packet_caps {
1358 IB_UVERBS_RAW_PACKET_CAP_CVLAN_STRIPPING = 1 << 0,
1359 IB_UVERBS_RAW_PACKET_CAP_SCATTER_FCS = 1 << 1,
1360 IB_UVERBS_RAW_PACKET_CAP_IP_CSUM = 1 << 2,
1361 IB_UVERBS_RAW_PACKET_CAP_DELAY_DROP = 1 << 3,
1362};
1363
1364#endif /* IB_USER_VERBS_H */
1365

source code of linux/include/uapi/rdma/ib_user_verbs.h