blob: 7e11bb8651b6410e0be16615ebbb1985407bd61a [file] [log] [blame]
Christopher Ferris25981132017-11-14 16:53:49 -08001/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
Ben Cheng224b54f2013-10-15 18:26:18 -07002/*
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
Christopher Ferrise0845012014-07-09 14:58:51 -070047#define IB_USER_VERBS_CMD_THRESHOLD 50
Ben Cheng224b54f2013-10-15 18:26:18 -070048
49enum {
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,
Christopher Ferrise0845012014-07-09 14:58:51 -070090 IB_USER_VERBS_CMD_OPEN_QP,
91};
92
93enum {
Christopher Ferris12e1f282016-02-04 12:35:07 -080094 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,
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -080097 IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
Christopher Ferrise0845012014-07-09 14:58:51 -070098 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
Christopher Ferris12e1f282016-02-04 12:35:07 -080099 IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
Christopher Ferris6e3550f2016-12-12 14:51:18 -0800100 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,
Christopher Ferrisa1a109e2018-01-31 15:03:12 -0800104 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL,
105 IB_USER_VERBS_EX_CMD_MODIFY_CQ
Ben Cheng224b54f2013-10-15 18:26:18 -0700106};
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).
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.
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
Christopher Ferrisa1a109e2018-01-31 15:03:12 -0800129struct ib_uverbs_cq_moderation_caps {
130 __u16 max_cq_moderation_count;
131 __u16 max_cq_moderation_period;
132 __u32 reserved;
133};
134
Ben Cheng224b54f2013-10-15 18:26:18 -0700135/*
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
Christopher Ferrise0845012014-07-09 14:58:51 -0700143#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
Ben Cheng224b54f2013-10-15 18:26:18 -0700149struct ib_uverbs_cmd_hdr {
150 __u32 command;
151 __u16 in_words;
152 __u16 out_words;
153};
154
Christopher Ferrise0845012014-07-09 14:58:51 -0700155struct ib_uverbs_ex_cmd_hdr {
156 __u64 response;
157 __u16 provider_in_words;
158 __u16 provider_out_words;
159 __u32 cmd_hdr_reserved;
160};
161
Ben Cheng224b54f2013-10-15 18:26:18 -0700162struct ib_uverbs_get_context {
163 __u64 response;
164 __u64 driver_data[0];
165};
166
167struct ib_uverbs_get_context_resp {
168 __u32 async_fd;
169 __u32 num_comp_vectors;
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;
179 __be64 node_guid;
180 __be64 sys_image_guid;
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
Christopher Ferris12e1f282016-02-04 12:35:07 -0800221struct ib_uverbs_ex_query_device {
222 __u32 comp_mask;
223 __u32 reserved;
224};
225
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
Christopher Ferris33185402017-01-13 13:28:52 -0800236struct 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
Christopher Ferris25981132017-11-14 16:53:49 -0800247struct 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
Christopher Ferris12e1f282016-02-04 12:35:07 -0800261struct ib_uverbs_ex_query_device_resp {
262 struct ib_uverbs_query_device_resp base;
263 __u32 comp_mask;
264 __u32 response_length;
265 struct ib_uverbs_odp_caps odp_caps;
266 __u64 timestamp_mask;
267 __u64 hca_core_clock; /* in KHZ */
Christopher Ferrisccfaccd2016-08-24 12:11:31 -0700268 __u64 device_cap_flags_ex;
Christopher Ferris33185402017-01-13 13:28:52 -0800269 struct ib_uverbs_rss_caps rss_caps;
270 __u32 max_wq_type_rq;
Christopher Ferris0543f742017-07-26 13:09:46 -0700271 __u32 raw_packet_caps;
Christopher Ferris25981132017-11-14 16:53:49 -0800272 struct ib_uverbs_tm_caps tm_caps;
Christopher Ferrisa1a109e2018-01-31 15:03:12 -0800273 struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
Christopher Ferris12e1f282016-02-04 12:35:07 -0800274};
275
Ben Cheng224b54f2013-10-15 18:26:18 -0700276struct 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;
303 __u8 link_layer;
304 __u8 reserved[2];
305};
306
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
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
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
Christopher Ferris7c0b6392015-01-23 15:34:26 -0800351struct 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
Ben Cheng224b54f2013-10-15 18:26:18 -0700367struct ib_uverbs_dereg_mr {
368 __u32 mr_handle;
369};
370
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
387struct ib_uverbs_create_comp_channel {
388 __u64 response;
389};
390
391struct ib_uverbs_create_comp_channel_resp {
392 __u32 fd;
393};
394
395struct ib_uverbs_create_cq {
396 __u64 response;
397 __u64 user_handle;
398 __u32 cqe;
399 __u32 comp_vector;
400 __s32 comp_channel;
401 __u32 reserved;
402 __u64 driver_data[0];
403};
404
Christopher Ferris12e1f282016-02-04 12:35:07 -0800405struct ib_uverbs_ex_create_cq {
406 __u64 user_handle;
407 __u32 cqe;
408 __u32 comp_vector;
409 __s32 comp_channel;
410 __u32 comp_mask;
411 __u32 flags;
412 __u32 reserved;
413};
414
Ben Cheng224b54f2013-10-15 18:26:18 -0700415struct ib_uverbs_create_cq_resp {
416 __u32 cq_handle;
417 __u32 cqe;
418};
419
Christopher Ferris12e1f282016-02-04 12:35:07 -0800420struct ib_uverbs_ex_create_cq_resp {
421 struct ib_uverbs_create_cq_resp base;
422 __u32 comp_mask;
423 __u32 response_length;
424};
425
Ben Cheng224b54f2013-10-15 18:26:18 -0700426struct ib_uverbs_resize_cq {
427 __u64 response;
428 __u32 cq_handle;
429 __u32 cqe;
430 __u64 driver_data[0];
431};
432
433struct ib_uverbs_resize_cq_resp {
434 __u32 cqe;
435 __u32 reserved;
436 __u64 driver_data[0];
437};
438
439struct ib_uverbs_poll_cq {
440 __u64 response;
441 __u32 cq_handle;
442 __u32 ne;
443};
444
445struct ib_uverbs_wc {
446 __u64 wr_id;
447 __u32 status;
448 __u32 opcode;
449 __u32 vendor_err;
450 __u32 byte_len;
451 union {
452 __u32 imm_data;
453 __u32 invalidate_rkey;
454 } ex;
455 __u32 qp_num;
456 __u32 src_qp;
457 __u32 wc_flags;
458 __u16 pkey_index;
459 __u16 slid;
460 __u8 sl;
461 __u8 dlid_path_bits;
462 __u8 port_num;
463 __u8 reserved;
464};
465
466struct ib_uverbs_poll_cq_resp {
467 __u32 count;
468 __u32 reserved;
469 struct ib_uverbs_wc wc[0];
470};
471
472struct ib_uverbs_req_notify_cq {
473 __u32 cq_handle;
474 __u32 solicited_only;
475};
476
477struct ib_uverbs_destroy_cq {
478 __u64 response;
479 __u32 cq_handle;
480 __u32 reserved;
481};
482
483struct ib_uverbs_destroy_cq_resp {
484 __u32 comp_events_reported;
485 __u32 async_events_reported;
486};
487
488struct ib_uverbs_global_route {
489 __u8 dgid[16];
490 __u32 flow_label;
491 __u8 sgid_index;
492 __u8 hop_limit;
493 __u8 traffic_class;
494 __u8 reserved;
495};
496
497struct ib_uverbs_ah_attr {
498 struct ib_uverbs_global_route grh;
499 __u16 dlid;
500 __u8 sl;
501 __u8 src_path_bits;
502 __u8 static_rate;
503 __u8 is_global;
504 __u8 port_num;
505 __u8 reserved;
506};
507
508struct ib_uverbs_qp_attr {
509 __u32 qp_attr_mask;
510 __u32 qp_state;
511 __u32 cur_qp_state;
512 __u32 path_mtu;
513 __u32 path_mig_state;
514 __u32 qkey;
515 __u32 rq_psn;
516 __u32 sq_psn;
517 __u32 dest_qp_num;
518 __u32 qp_access_flags;
519
520 struct ib_uverbs_ah_attr ah_attr;
521 struct ib_uverbs_ah_attr alt_ah_attr;
522
523 /* ib_qp_cap */
524 __u32 max_send_wr;
525 __u32 max_recv_wr;
526 __u32 max_send_sge;
527 __u32 max_recv_sge;
528 __u32 max_inline_data;
529
530 __u16 pkey_index;
531 __u16 alt_pkey_index;
532 __u8 en_sqd_async_notify;
533 __u8 sq_draining;
534 __u8 max_rd_atomic;
535 __u8 max_dest_rd_atomic;
536 __u8 min_rnr_timer;
537 __u8 port_num;
538 __u8 timeout;
539 __u8 retry_cnt;
540 __u8 rnr_retry;
541 __u8 alt_port_num;
542 __u8 alt_timeout;
543 __u8 reserved[5];
544};
545
546struct ib_uverbs_create_qp {
547 __u64 response;
548 __u64 user_handle;
549 __u32 pd_handle;
550 __u32 send_cq_handle;
551 __u32 recv_cq_handle;
552 __u32 srq_handle;
553 __u32 max_send_wr;
554 __u32 max_recv_wr;
555 __u32 max_send_sge;
556 __u32 max_recv_sge;
557 __u32 max_inline_data;
558 __u8 sq_sig_all;
559 __u8 qp_type;
560 __u8 is_srq;
561 __u8 reserved;
562 __u64 driver_data[0];
563};
564
Christopher Ferris6e3550f2016-12-12 14:51:18 -0800565enum ib_uverbs_create_qp_mask {
566 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
567};
568
569enum {
570 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
571};
572
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -0800573enum {
574 /*
575 * This value is equal to IB_QP_DEST_QPN.
576 */
577 IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
578};
579
580enum {
581 /*
582 * This value is equal to IB_QP_RATE_LIMIT.
583 */
584 IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
585};
586
Christopher Ferris12e1f282016-02-04 12:35:07 -0800587struct ib_uverbs_ex_create_qp {
588 __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 __u32 comp_mask;
603 __u32 create_flags;
Christopher Ferris6e3550f2016-12-12 14:51:18 -0800604 __u32 rwq_ind_tbl_handle;
Christopher Ferris25981132017-11-14 16:53:49 -0800605 __u32 source_qpn;
Christopher Ferris12e1f282016-02-04 12:35:07 -0800606};
607
Ben Cheng224b54f2013-10-15 18:26:18 -0700608struct ib_uverbs_open_qp {
609 __u64 response;
610 __u64 user_handle;
611 __u32 pd_handle;
612 __u32 qpn;
613 __u8 qp_type;
614 __u8 reserved[7];
615 __u64 driver_data[0];
616};
617
618/* also used for open response */
619struct ib_uverbs_create_qp_resp {
620 __u32 qp_handle;
621 __u32 qpn;
622 __u32 max_send_wr;
623 __u32 max_recv_wr;
624 __u32 max_send_sge;
625 __u32 max_recv_sge;
626 __u32 max_inline_data;
627 __u32 reserved;
628};
629
Christopher Ferris12e1f282016-02-04 12:35:07 -0800630struct ib_uverbs_ex_create_qp_resp {
631 struct ib_uverbs_create_qp_resp base;
632 __u32 comp_mask;
633 __u32 response_length;
634};
635
Ben Cheng224b54f2013-10-15 18:26:18 -0700636/*
637 * This struct needs to remain a multiple of 8 bytes to keep the
638 * alignment of the modify QP parameters.
639 */
640struct ib_uverbs_qp_dest {
641 __u8 dgid[16];
642 __u32 flow_label;
643 __u16 dlid;
644 __u16 reserved;
645 __u8 sgid_index;
646 __u8 hop_limit;
647 __u8 traffic_class;
648 __u8 sl;
649 __u8 src_path_bits;
650 __u8 static_rate;
651 __u8 is_global;
652 __u8 port_num;
653};
654
655struct ib_uverbs_query_qp {
656 __u64 response;
657 __u32 qp_handle;
658 __u32 attr_mask;
659 __u64 driver_data[0];
660};
661
662struct ib_uverbs_query_qp_resp {
663 struct ib_uverbs_qp_dest dest;
664 struct ib_uverbs_qp_dest alt_dest;
665 __u32 max_send_wr;
666 __u32 max_recv_wr;
667 __u32 max_send_sge;
668 __u32 max_recv_sge;
669 __u32 max_inline_data;
670 __u32 qkey;
671 __u32 rq_psn;
672 __u32 sq_psn;
673 __u32 dest_qp_num;
674 __u32 qp_access_flags;
675 __u16 pkey_index;
676 __u16 alt_pkey_index;
677 __u8 qp_state;
678 __u8 cur_qp_state;
679 __u8 path_mtu;
680 __u8 path_mig_state;
681 __u8 sq_draining;
682 __u8 max_rd_atomic;
683 __u8 max_dest_rd_atomic;
684 __u8 min_rnr_timer;
685 __u8 port_num;
686 __u8 timeout;
687 __u8 retry_cnt;
688 __u8 rnr_retry;
689 __u8 alt_port_num;
690 __u8 alt_timeout;
691 __u8 sq_sig_all;
692 __u8 reserved[5];
693 __u64 driver_data[0];
694};
695
696struct ib_uverbs_modify_qp {
697 struct ib_uverbs_qp_dest dest;
698 struct ib_uverbs_qp_dest alt_dest;
699 __u32 qp_handle;
700 __u32 attr_mask;
701 __u32 qkey;
702 __u32 rq_psn;
703 __u32 sq_psn;
704 __u32 dest_qp_num;
705 __u32 qp_access_flags;
706 __u16 pkey_index;
707 __u16 alt_pkey_index;
708 __u8 qp_state;
709 __u8 cur_qp_state;
710 __u8 path_mtu;
711 __u8 path_mig_state;
712 __u8 en_sqd_async_notify;
713 __u8 max_rd_atomic;
714 __u8 max_dest_rd_atomic;
715 __u8 min_rnr_timer;
716 __u8 port_num;
717 __u8 timeout;
718 __u8 retry_cnt;
719 __u8 rnr_retry;
720 __u8 alt_port_num;
721 __u8 alt_timeout;
722 __u8 reserved[2];
723 __u64 driver_data[0];
724};
725
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -0800726struct ib_uverbs_ex_modify_qp {
727 struct ib_uverbs_modify_qp base;
728 __u32 rate_limit;
729 __u32 reserved;
730};
731
Ben Cheng224b54f2013-10-15 18:26:18 -0700732struct ib_uverbs_modify_qp_resp {
733};
734
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -0800735struct ib_uverbs_ex_modify_qp_resp {
736 __u32 comp_mask;
737 __u32 response_length;
738};
739
Ben Cheng224b54f2013-10-15 18:26:18 -0700740struct ib_uverbs_destroy_qp {
741 __u64 response;
742 __u32 qp_handle;
743 __u32 reserved;
744};
745
746struct ib_uverbs_destroy_qp_resp {
747 __u32 events_reported;
748};
749
750/*
751 * The ib_uverbs_sge structure isn't used anywhere, since we assume
752 * the ib_sge structure is packed the same way on 32-bit and 64-bit
753 * architectures in both kernel and user space. It's just here to
754 * document the ABI.
755 */
756struct ib_uverbs_sge {
757 __u64 addr;
758 __u32 length;
759 __u32 lkey;
760};
761
762struct ib_uverbs_send_wr {
763 __u64 wr_id;
764 __u32 num_sge;
765 __u32 opcode;
766 __u32 send_flags;
767 union {
768 __u32 imm_data;
769 __u32 invalidate_rkey;
770 } ex;
771 union {
772 struct {
773 __u64 remote_addr;
774 __u32 rkey;
775 __u32 reserved;
776 } rdma;
777 struct {
778 __u64 remote_addr;
779 __u64 compare_add;
780 __u64 swap;
781 __u32 rkey;
782 __u32 reserved;
783 } atomic;
784 struct {
785 __u32 ah;
786 __u32 remote_qpn;
787 __u32 remote_qkey;
788 __u32 reserved;
789 } ud;
790 } wr;
791};
792
793struct ib_uverbs_post_send {
794 __u64 response;
795 __u32 qp_handle;
796 __u32 wr_count;
797 __u32 sge_count;
798 __u32 wqe_size;
799 struct ib_uverbs_send_wr send_wr[0];
800};
801
802struct ib_uverbs_post_send_resp {
803 __u32 bad_wr;
804};
805
806struct ib_uverbs_recv_wr {
807 __u64 wr_id;
808 __u32 num_sge;
809 __u32 reserved;
810};
811
812struct ib_uverbs_post_recv {
813 __u64 response;
814 __u32 qp_handle;
815 __u32 wr_count;
816 __u32 sge_count;
817 __u32 wqe_size;
818 struct ib_uverbs_recv_wr recv_wr[0];
819};
820
821struct ib_uverbs_post_recv_resp {
822 __u32 bad_wr;
823};
824
825struct ib_uverbs_post_srq_recv {
826 __u64 response;
827 __u32 srq_handle;
828 __u32 wr_count;
829 __u32 sge_count;
830 __u32 wqe_size;
831 struct ib_uverbs_recv_wr recv[0];
832};
833
834struct ib_uverbs_post_srq_recv_resp {
835 __u32 bad_wr;
836};
837
838struct ib_uverbs_create_ah {
839 __u64 response;
840 __u64 user_handle;
841 __u32 pd_handle;
842 __u32 reserved;
843 struct ib_uverbs_ah_attr attr;
844};
845
846struct ib_uverbs_create_ah_resp {
847 __u32 ah_handle;
848};
849
850struct ib_uverbs_destroy_ah {
851 __u32 ah_handle;
852};
853
854struct ib_uverbs_attach_mcast {
855 __u8 gid[16];
856 __u32 qp_handle;
857 __u16 mlid;
858 __u16 reserved;
859 __u64 driver_data[0];
860};
861
862struct ib_uverbs_detach_mcast {
863 __u8 gid[16];
864 __u32 qp_handle;
865 __u16 mlid;
866 __u16 reserved;
867 __u64 driver_data[0];
868};
869
Christopher Ferrise0845012014-07-09 14:58:51 -0700870struct ib_uverbs_flow_spec_hdr {
871 __u32 type;
872 __u16 size;
873 __u16 reserved;
874 /* followed by flow_spec */
875 __u64 flow_spec_data[0];
876};
877
878struct ib_uverbs_flow_eth_filter {
879 __u8 dst_mac[6];
880 __u8 src_mac[6];
881 __be16 ether_type;
882 __be16 vlan_tag;
883};
884
885struct ib_uverbs_flow_spec_eth {
886 union {
887 struct ib_uverbs_flow_spec_hdr hdr;
888 struct {
889 __u32 type;
890 __u16 size;
891 __u16 reserved;
892 };
893 };
894 struct ib_uverbs_flow_eth_filter val;
895 struct ib_uverbs_flow_eth_filter mask;
896};
897
898struct ib_uverbs_flow_ipv4_filter {
899 __be32 src_ip;
900 __be32 dst_ip;
Christopher Ferris33185402017-01-13 13:28:52 -0800901 __u8 proto;
902 __u8 tos;
903 __u8 ttl;
904 __u8 flags;
Christopher Ferrise0845012014-07-09 14:58:51 -0700905};
906
907struct ib_uverbs_flow_spec_ipv4 {
908 union {
909 struct ib_uverbs_flow_spec_hdr hdr;
910 struct {
911 __u32 type;
912 __u16 size;
913 __u16 reserved;
914 };
915 };
916 struct ib_uverbs_flow_ipv4_filter val;
917 struct ib_uverbs_flow_ipv4_filter mask;
918};
919
920struct ib_uverbs_flow_tcp_udp_filter {
921 __be16 dst_port;
922 __be16 src_port;
923};
924
925struct ib_uverbs_flow_spec_tcp_udp {
926 union {
927 struct ib_uverbs_flow_spec_hdr hdr;
928 struct {
929 __u32 type;
930 __u16 size;
931 __u16 reserved;
932 };
933 };
934 struct ib_uverbs_flow_tcp_udp_filter val;
935 struct ib_uverbs_flow_tcp_udp_filter mask;
936};
937
Christopher Ferris6e3550f2016-12-12 14:51:18 -0800938struct ib_uverbs_flow_ipv6_filter {
Christopher Ferris33185402017-01-13 13:28:52 -0800939 __u8 src_ip[16];
940 __u8 dst_ip[16];
941 __be32 flow_label;
942 __u8 next_hdr;
943 __u8 traffic_class;
944 __u8 hop_limit;
945 __u8 reserved;
Christopher Ferris6e3550f2016-12-12 14:51:18 -0800946};
947
948struct ib_uverbs_flow_spec_ipv6 {
949 union {
950 struct ib_uverbs_flow_spec_hdr hdr;
951 struct {
952 __u32 type;
953 __u16 size;
954 __u16 reserved;
955 };
956 };
957 struct ib_uverbs_flow_ipv6_filter val;
958 struct ib_uverbs_flow_ipv6_filter mask;
959};
960
Christopher Ferris0543f742017-07-26 13:09:46 -0700961struct ib_uverbs_flow_spec_action_tag {
962 union {
963 struct ib_uverbs_flow_spec_hdr hdr;
964 struct {
965 __u32 type;
966 __u16 size;
967 __u16 reserved;
968 };
969 };
970 __u32 tag_id;
971 __u32 reserved1;
972};
973
974struct ib_uverbs_flow_spec_action_drop {
975 union {
976 struct ib_uverbs_flow_spec_hdr hdr;
977 struct {
978 __u32 type;
979 __u16 size;
980 __u16 reserved;
981 };
982 };
983};
984
Christopher Ferris2fd4b3c2017-02-21 12:32:08 -0800985struct ib_uverbs_flow_tunnel_filter {
986 __be32 tunnel_id;
987};
988
989struct ib_uverbs_flow_spec_tunnel {
990 union {
991 struct ib_uverbs_flow_spec_hdr hdr;
992 struct {
993 __u32 type;
994 __u16 size;
995 __u16 reserved;
996 };
997 };
998 struct ib_uverbs_flow_tunnel_filter val;
999 struct ib_uverbs_flow_tunnel_filter mask;
1000};
1001
Christopher Ferrise0845012014-07-09 14:58:51 -07001002struct ib_uverbs_flow_attr {
1003 __u32 type;
1004 __u16 size;
1005 __u16 priority;
1006 __u8 num_of_specs;
1007 __u8 reserved[2];
1008 __u8 port;
1009 __u32 flags;
1010 /* Following are the optional layers according to user request
1011 * struct ib_flow_spec_xxx
1012 * struct ib_flow_spec_yyy
1013 */
1014 struct ib_uverbs_flow_spec_hdr flow_specs[0];
1015};
1016
1017struct ib_uverbs_create_flow {
1018 __u32 comp_mask;
1019 __u32 qp_handle;
1020 struct ib_uverbs_flow_attr flow_attr;
1021};
1022
1023struct ib_uverbs_create_flow_resp {
1024 __u32 comp_mask;
1025 __u32 flow_handle;
1026};
1027
1028struct ib_uverbs_destroy_flow {
1029 __u32 comp_mask;
1030 __u32 flow_handle;
1031};
1032
Ben Cheng224b54f2013-10-15 18:26:18 -07001033struct ib_uverbs_create_srq {
1034 __u64 response;
1035 __u64 user_handle;
1036 __u32 pd_handle;
1037 __u32 max_wr;
1038 __u32 max_sge;
1039 __u32 srq_limit;
1040 __u64 driver_data[0];
1041};
1042
1043struct ib_uverbs_create_xsrq {
1044 __u64 response;
1045 __u64 user_handle;
1046 __u32 srq_type;
1047 __u32 pd_handle;
1048 __u32 max_wr;
1049 __u32 max_sge;
1050 __u32 srq_limit;
Christopher Ferris25981132017-11-14 16:53:49 -08001051 __u32 max_num_tags;
Ben Cheng224b54f2013-10-15 18:26:18 -07001052 __u32 xrcd_handle;
1053 __u32 cq_handle;
1054 __u64 driver_data[0];
1055};
1056
1057struct ib_uverbs_create_srq_resp {
1058 __u32 srq_handle;
1059 __u32 max_wr;
1060 __u32 max_sge;
1061 __u32 srqn;
1062};
1063
1064struct ib_uverbs_modify_srq {
1065 __u32 srq_handle;
1066 __u32 attr_mask;
1067 __u32 max_wr;
1068 __u32 srq_limit;
1069 __u64 driver_data[0];
1070};
1071
1072struct ib_uverbs_query_srq {
1073 __u64 response;
1074 __u32 srq_handle;
1075 __u32 reserved;
1076 __u64 driver_data[0];
1077};
1078
1079struct ib_uverbs_query_srq_resp {
1080 __u32 max_wr;
1081 __u32 max_sge;
1082 __u32 srq_limit;
1083 __u32 reserved;
1084};
1085
1086struct ib_uverbs_destroy_srq {
1087 __u64 response;
1088 __u32 srq_handle;
1089 __u32 reserved;
1090};
1091
1092struct ib_uverbs_destroy_srq_resp {
1093 __u32 events_reported;
1094};
1095
Christopher Ferris6e3550f2016-12-12 14:51:18 -08001096struct ib_uverbs_ex_create_wq {
1097 __u32 comp_mask;
1098 __u32 wq_type;
1099 __u64 user_handle;
1100 __u32 pd_handle;
1101 __u32 cq_handle;
1102 __u32 max_wr;
1103 __u32 max_sge;
Christopher Ferris0543f742017-07-26 13:09:46 -07001104 __u32 create_flags; /* Use enum ib_wq_flags */
1105 __u32 reserved;
Christopher Ferris6e3550f2016-12-12 14:51:18 -08001106};
1107
1108struct ib_uverbs_ex_create_wq_resp {
1109 __u32 comp_mask;
1110 __u32 response_length;
1111 __u32 wq_handle;
1112 __u32 max_wr;
1113 __u32 max_sge;
1114 __u32 wqn;
1115};
1116
1117struct ib_uverbs_ex_destroy_wq {
1118 __u32 comp_mask;
1119 __u32 wq_handle;
1120};
1121
1122struct ib_uverbs_ex_destroy_wq_resp {
1123 __u32 comp_mask;
1124 __u32 response_length;
1125 __u32 events_reported;
1126 __u32 reserved;
1127};
1128
1129struct ib_uverbs_ex_modify_wq {
1130 __u32 attr_mask;
1131 __u32 wq_handle;
1132 __u32 wq_state;
1133 __u32 curr_wq_state;
Christopher Ferris0543f742017-07-26 13:09:46 -07001134 __u32 flags; /* Use enum ib_wq_flags */
1135 __u32 flags_mask; /* Use enum ib_wq_flags */
Christopher Ferris6e3550f2016-12-12 14:51:18 -08001136};
1137
1138/* Prevent memory allocation rather than max expected size */
1139#define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1140struct ib_uverbs_ex_create_rwq_ind_table {
1141 __u32 comp_mask;
1142 __u32 log_ind_tbl_size;
1143 /* Following are the wq handles according to log_ind_tbl_size
1144 * wq_handle1
1145 * wq_handle2
1146 */
1147 __u32 wq_handles[0];
1148};
1149
1150struct ib_uverbs_ex_create_rwq_ind_table_resp {
1151 __u32 comp_mask;
1152 __u32 response_length;
1153 __u32 ind_tbl_handle;
1154 __u32 ind_tbl_num;
1155};
1156
1157struct ib_uverbs_ex_destroy_rwq_ind_table {
1158 __u32 comp_mask;
1159 __u32 ind_tbl_handle;
1160};
1161
Christopher Ferrisa1a109e2018-01-31 15:03:12 -08001162struct ib_uverbs_cq_moderation {
1163 __u16 cq_count;
1164 __u16 cq_period;
1165};
1166
1167struct ib_uverbs_ex_modify_cq {
1168 __u32 cq_handle;
1169 __u32 attr_mask;
1170 struct ib_uverbs_cq_moderation attr;
1171 __u32 reserved;
1172};
1173
Christopher Ferris0543f742017-07-26 13:09:46 -07001174#define IB_DEVICE_NAME_MAX 64
1175
Ben Cheng224b54f2013-10-15 18:26:18 -07001176#endif /* IB_USER_VERBS_H */