blob: 270c350bedc6c4911ff0763275fc034e90b2a018 [file] [log] [blame]
Roland Dreier8a96b3f2005-07-07 17:57:12 -07001/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
Roland Dreier33b9b3e2006-01-30 14:29:21 -08003 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
Roland Dreier91ecd4a2005-10-14 15:21:44 -07004 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
Dotan Barak8bdb0e82006-02-13 16:31:57 -08005 * Copyright (c) 2006 Mellanox Technologies. All rights reserved.
Roland Dreier8a96b3f2005-07-07 17:57:12 -07006 *
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.
Roland Dreier8a96b3f2005-07-07 17:57:12 -070034 */
35
36#ifndef IB_USER_VERBS_H
37#define IB_USER_VERBS_H
38
39#include <linux/types.h>
40
41/*
42 * Increment this value if any changes that break userspace ABI
43 * compatibility are made.
44 */
Dotan Barakea88fd12006-02-23 12:36:18 -080045#define IB_USER_VERBS_ABI_VERSION 6
Igor Ivanov400dbc92013-08-14 13:58:29 +030046#define IB_USER_VERBS_CMD_THRESHOLD 50
Roland Dreier8a96b3f2005-07-07 17:57:12 -070047
48enum {
Roland Dreier8a96b3f2005-07-07 17:57:12 -070049 IB_USER_VERBS_CMD_GET_CONTEXT,
50 IB_USER_VERBS_CMD_QUERY_DEVICE,
51 IB_USER_VERBS_CMD_QUERY_PORT,
Roland Dreier8a96b3f2005-07-07 17:57:12 -070052 IB_USER_VERBS_CMD_ALLOC_PD,
53 IB_USER_VERBS_CMD_DEALLOC_PD,
54 IB_USER_VERBS_CMD_CREATE_AH,
55 IB_USER_VERBS_CMD_MODIFY_AH,
56 IB_USER_VERBS_CMD_QUERY_AH,
57 IB_USER_VERBS_CMD_DESTROY_AH,
58 IB_USER_VERBS_CMD_REG_MR,
59 IB_USER_VERBS_CMD_REG_SMR,
60 IB_USER_VERBS_CMD_REREG_MR,
61 IB_USER_VERBS_CMD_QUERY_MR,
62 IB_USER_VERBS_CMD_DEREG_MR,
63 IB_USER_VERBS_CMD_ALLOC_MW,
64 IB_USER_VERBS_CMD_BIND_MW,
65 IB_USER_VERBS_CMD_DEALLOC_MW,
Roland Dreier6b73597e2005-09-26 13:53:25 -070066 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
Roland Dreier8a96b3f2005-07-07 17:57:12 -070067 IB_USER_VERBS_CMD_CREATE_CQ,
68 IB_USER_VERBS_CMD_RESIZE_CQ,
69 IB_USER_VERBS_CMD_DESTROY_CQ,
70 IB_USER_VERBS_CMD_POLL_CQ,
71 IB_USER_VERBS_CMD_PEEK_CQ,
72 IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
73 IB_USER_VERBS_CMD_CREATE_QP,
74 IB_USER_VERBS_CMD_QUERY_QP,
75 IB_USER_VERBS_CMD_MODIFY_QP,
76 IB_USER_VERBS_CMD_DESTROY_QP,
77 IB_USER_VERBS_CMD_POST_SEND,
78 IB_USER_VERBS_CMD_POST_RECV,
79 IB_USER_VERBS_CMD_ATTACH_MCAST,
Roland Dreierf520ba52005-08-18 12:24:13 -070080 IB_USER_VERBS_CMD_DETACH_MCAST,
81 IB_USER_VERBS_CMD_CREATE_SRQ,
82 IB_USER_VERBS_CMD_MODIFY_SRQ,
83 IB_USER_VERBS_CMD_QUERY_SRQ,
84 IB_USER_VERBS_CMD_DESTROY_SRQ,
Sean Hefty53d0bd12011-05-24 08:33:46 -070085 IB_USER_VERBS_CMD_POST_SRQ_RECV,
86 IB_USER_VERBS_CMD_OPEN_XRCD,
Sean Hefty8541f8d2011-05-25 17:08:38 -070087 IB_USER_VERBS_CMD_CLOSE_XRCD,
Sean Hefty42849b22011-08-11 13:57:43 -070088 IB_USER_VERBS_CMD_CREATE_XSRQ,
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +030089 IB_USER_VERBS_CMD_OPEN_QP,
Roland Dreier8a96b3f2005-07-07 17:57:12 -070090};
91
Yann Droneaudf21519b2013-11-06 23:21:49 +010092enum {
Eli Cohen02d1aa72015-02-08 13:28:50 +020093 IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
Matan Barak565197d2015-06-11 16:35:23 +030094 IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +030095 IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP,
Bodong Wang189aba92016-12-01 13:43:15 +020096 IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
Yann Droneaudf21519b2013-11-06 23:21:49 +010097 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
Eli Cohen5a77abf2014-12-11 17:04:15 +020098 IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
Yishai Hadasf213c052016-05-23 15:20:49 +030099 IB_USER_VERBS_EX_CMD_CREATE_WQ,
100 IB_USER_VERBS_EX_CMD_MODIFY_WQ,
101 IB_USER_VERBS_EX_CMD_DESTROY_WQ,
Yishai Hadasde019a92016-05-23 15:20:52 +0300102 IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
103 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
Yann Droneaudf21519b2013-11-06 23:21:49 +0100104};
Yann Droneaudf21519b2013-11-06 23:21:49 +0100105
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700106/*
107 * Make sure that all structs defined in this file remain laid out so
108 * that they pack the same way on 32-bit and 64-bit architectures (to
109 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700110 * Specifically:
111 * - Do not use pointer types -- pass pointers in __u64 instead.
112 * - Make sure that any structure larger than 4 bytes is padded to a
113 * multiple of 8 bytes. Otherwise the structure size will be
114 * different between 32-bit and 64-bit architectures.
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700115 */
116
117struct ib_uverbs_async_event_desc {
118 __u64 element;
119 __u32 event_type; /* enum ib_event_type */
120 __u32 reserved;
121};
122
123struct ib_uverbs_comp_event_desc {
124 __u64 cq_handle;
125};
126
127/*
128 * All commands from userspace should start with a __u32 command field
129 * followed by __u16 in_words and out_words fields (which give the
130 * length of the command block and response buffer if any in 32-bit
131 * words). The kernel driver will read these fields first and read
132 * the rest of the command struct based on these value.
133 */
134
Yann Droneaudf21519b2013-11-06 23:21:49 +0100135#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
136#define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
137#define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
138
139#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
140
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700141struct ib_uverbs_cmd_hdr {
142 __u32 command;
143 __u16 in_words;
144 __u16 out_words;
145};
146
Yann Droneaudf21519b2013-11-06 23:21:49 +0100147struct ib_uverbs_ex_cmd_hdr {
148 __u64 response;
Igor Ivanov400dbc92013-08-14 13:58:29 +0300149 __u16 provider_in_words;
150 __u16 provider_out_words;
151 __u32 cmd_hdr_reserved;
152};
153
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700154struct ib_uverbs_get_context {
155 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700156 __u64 driver_data[0];
157};
158
159struct ib_uverbs_get_context_resp {
160 __u32 async_fd;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700161 __u32 num_comp_vectors;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700162};
163
164struct ib_uverbs_query_device {
165 __u64 response;
166 __u64 driver_data[0];
167};
168
169struct ib_uverbs_query_device_resp {
170 __u64 fw_ver;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700171 __be64 node_guid;
172 __be64 sys_image_guid;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700173 __u64 max_mr_size;
174 __u64 page_size_cap;
175 __u32 vendor_id;
176 __u32 vendor_part_id;
177 __u32 hw_ver;
178 __u32 max_qp;
179 __u32 max_qp_wr;
180 __u32 device_cap_flags;
181 __u32 max_sge;
182 __u32 max_sge_rd;
183 __u32 max_cq;
184 __u32 max_cqe;
185 __u32 max_mr;
186 __u32 max_pd;
187 __u32 max_qp_rd_atom;
188 __u32 max_ee_rd_atom;
189 __u32 max_res_rd_atom;
190 __u32 max_qp_init_rd_atom;
191 __u32 max_ee_init_rd_atom;
192 __u32 atomic_cap;
193 __u32 max_ee;
194 __u32 max_rdd;
195 __u32 max_mw;
196 __u32 max_raw_ipv6_qp;
197 __u32 max_raw_ethy_qp;
198 __u32 max_mcast_grp;
199 __u32 max_mcast_qp_attach;
200 __u32 max_total_mcast_qp_attach;
201 __u32 max_ah;
202 __u32 max_fmr;
203 __u32 max_map_per_fmr;
204 __u32 max_srq;
205 __u32 max_srq_wr;
206 __u32 max_srq_sge;
207 __u16 max_pkeys;
208 __u8 local_ca_ack_delay;
209 __u8 phys_port_cnt;
210 __u8 reserved[4];
211};
212
Eli Cohen02d1aa72015-02-08 13:28:50 +0200213struct ib_uverbs_ex_query_device {
214 __u32 comp_mask;
215 __u32 reserved;
216};
217
Haggai Eranf4056bf2015-02-08 13:28:51 +0200218struct ib_uverbs_odp_caps {
219 __u64 general_caps;
220 struct {
221 __u32 rc_odp_caps;
222 __u32 uc_odp_caps;
223 __u32 ud_odp_caps;
224 } per_transport_caps;
225 __u32 reserved;
226};
227
Yishai Hadas47adf2f2016-08-28 11:28:44 +0300228struct ib_uverbs_rss_caps {
229 /* Corresponding bit will be set if qp type from
230 * 'enum ib_qp_type' is supported, e.g.
231 * supported_qpts |= 1 << IB_QPT_UD
232 */
233 __u32 supported_qpts;
234 __u32 max_rwq_indirection_tables;
235 __u32 max_rwq_indirection_table_size;
236 __u32 reserved;
237};
238
Eli Cohen02d1aa72015-02-08 13:28:50 +0200239struct ib_uverbs_ex_query_device_resp {
240 struct ib_uverbs_query_device_resp base;
241 __u32 comp_mask;
242 __u32 response_length;
Haggai Eranf4056bf2015-02-08 13:28:51 +0200243 struct ib_uverbs_odp_caps odp_caps;
Matan Barak24306dc2015-06-11 16:35:24 +0300244 __u64 timestamp_mask;
245 __u64 hca_core_clock; /* in KHZ */
Majd Dibbiny0b24e5a2016-04-17 17:19:34 +0300246 __u64 device_cap_flags_ex;
Yishai Hadas47adf2f2016-08-28 11:28:44 +0300247 struct ib_uverbs_rss_caps rss_caps;
248 __u32 max_wq_type_rq;
Noa Osherovich5f23d422017-01-18 15:39:58 +0200249 __u32 raw_packet_caps;
Eli Cohen02d1aa72015-02-08 13:28:50 +0200250};
251
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700252struct ib_uverbs_query_port {
253 __u64 response;
254 __u8 port_num;
255 __u8 reserved[7];
256 __u64 driver_data[0];
257};
258
259struct ib_uverbs_query_port_resp {
260 __u32 port_cap_flags;
261 __u32 max_msg_sz;
262 __u32 bad_pkey_cntr;
263 __u32 qkey_viol_cntr;
264 __u32 gid_tbl_len;
265 __u16 pkey_tbl_len;
266 __u16 lid;
267 __u16 sm_lid;
268 __u8 state;
269 __u8 max_mtu;
270 __u8 active_mtu;
271 __u8 lmc;
272 __u8 max_vl_num;
273 __u8 sm_sl;
274 __u8 subnet_timeout;
275 __u8 init_type_reply;
276 __u8 active_width;
277 __u8 active_speed;
278 __u8 phys_state;
Eli Cohen2420b602010-10-18 14:45:20 -0700279 __u8 link_layer;
280 __u8 reserved[2];
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700281};
282
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700283struct ib_uverbs_alloc_pd {
284 __u64 response;
285 __u64 driver_data[0];
286};
287
288struct ib_uverbs_alloc_pd_resp {
289 __u32 pd_handle;
290};
291
292struct ib_uverbs_dealloc_pd {
293 __u32 pd_handle;
294};
295
Sean Hefty53d0bd12011-05-24 08:33:46 -0700296struct ib_uverbs_open_xrcd {
297 __u64 response;
298 __u32 fd;
299 __u32 oflags;
300 __u64 driver_data[0];
301};
302
303struct ib_uverbs_open_xrcd_resp {
304 __u32 xrcd_handle;
305};
306
307struct ib_uverbs_close_xrcd {
308 __u32 xrcd_handle;
309};
310
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700311struct ib_uverbs_reg_mr {
312 __u64 response;
313 __u64 start;
314 __u64 length;
315 __u64 hca_va;
316 __u32 pd_handle;
317 __u32 access_flags;
318 __u64 driver_data[0];
319};
320
321struct ib_uverbs_reg_mr_resp {
322 __u32 mr_handle;
323 __u32 lkey;
324 __u32 rkey;
325};
326
Matan Barak7e6edb92014-07-31 11:01:28 +0300327struct ib_uverbs_rereg_mr {
328 __u64 response;
329 __u32 mr_handle;
330 __u32 flags;
331 __u64 start;
332 __u64 length;
333 __u64 hca_va;
334 __u32 pd_handle;
335 __u32 access_flags;
336};
337
338struct ib_uverbs_rereg_mr_resp {
339 __u32 lkey;
340 __u32 rkey;
341};
342
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700343struct ib_uverbs_dereg_mr {
344 __u32 mr_handle;
345};
346
Shani Michaeli6b52a122013-02-06 16:19:13 +0000347struct ib_uverbs_alloc_mw {
348 __u64 response;
349 __u32 pd_handle;
350 __u8 mw_type;
351 __u8 reserved[3];
352};
353
354struct ib_uverbs_alloc_mw_resp {
355 __u32 mw_handle;
356 __u32 rkey;
357};
358
359struct ib_uverbs_dealloc_mw {
360 __u32 mw_handle;
361};
362
Roland Dreier6b73597e2005-09-26 13:53:25 -0700363struct ib_uverbs_create_comp_channel {
364 __u64 response;
365};
366
367struct ib_uverbs_create_comp_channel_resp {
368 __u32 fd;
369};
370
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700371struct ib_uverbs_create_cq {
372 __u64 response;
373 __u64 user_handle;
374 __u32 cqe;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700375 __u32 comp_vector;
376 __s32 comp_channel;
377 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700378 __u64 driver_data[0];
379};
380
Matan Barak565197d2015-06-11 16:35:23 +0300381struct ib_uverbs_ex_create_cq {
382 __u64 user_handle;
383 __u32 cqe;
384 __u32 comp_vector;
385 __s32 comp_channel;
386 __u32 comp_mask;
387 __u32 flags;
388 __u32 reserved;
389};
390
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700391struct ib_uverbs_create_cq_resp {
392 __u32 cq_handle;
393 __u32 cqe;
394};
395
Matan Barak565197d2015-06-11 16:35:23 +0300396struct ib_uverbs_ex_create_cq_resp {
397 struct ib_uverbs_create_cq_resp base;
398 __u32 comp_mask;
399 __u32 response_length;
400};
401
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800402struct ib_uverbs_resize_cq {
403 __u64 response;
404 __u32 cq_handle;
405 __u32 cqe;
406 __u64 driver_data[0];
407};
408
409struct ib_uverbs_resize_cq_resp {
410 __u32 cqe;
Ralph Campbell64f817b2006-09-22 15:22:24 -0700411 __u32 reserved;
412 __u64 driver_data[0];
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800413};
414
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700415struct ib_uverbs_poll_cq {
416 __u64 response;
417 __u32 cq_handle;
418 __u32 ne;
419};
420
421struct ib_uverbs_wc {
422 __u64 wr_id;
423 __u32 status;
424 __u32 opcode;
425 __u32 vendor_err;
426 __u32 byte_len;
Steve Wise00f7ec32008-07-14 23:48:45 -0700427 union {
428 __u32 imm_data;
429 __u32 invalidate_rkey;
430 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700431 __u32 qp_num;
432 __u32 src_qp;
433 __u32 wc_flags;
434 __u16 pkey_index;
435 __u16 slid;
436 __u8 sl;
437 __u8 dlid_path_bits;
438 __u8 port_num;
439 __u8 reserved;
440};
441
442struct ib_uverbs_poll_cq_resp {
443 __u32 count;
444 __u32 reserved;
445 struct ib_uverbs_wc wc[0];
446};
447
448struct ib_uverbs_req_notify_cq {
449 __u32 cq_handle;
450 __u32 solicited_only;
451};
452
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700453struct ib_uverbs_destroy_cq {
Roland Dreier63aaf642005-09-09 15:55:08 -0700454 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700455 __u32 cq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700456 __u32 reserved;
457};
458
459struct ib_uverbs_destroy_cq_resp {
460 __u32 comp_events_reported;
461 __u32 async_events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700462};
463
Sean Hefty6a9af2e2006-06-17 20:37:27 -0700464struct ib_uverbs_global_route {
465 __u8 dgid[16];
466 __u32 flow_label;
467 __u8 sgid_index;
468 __u8 hop_limit;
469 __u8 traffic_class;
470 __u8 reserved;
471};
472
473struct ib_uverbs_ah_attr {
474 struct ib_uverbs_global_route grh;
475 __u16 dlid;
476 __u8 sl;
477 __u8 src_path_bits;
478 __u8 static_rate;
479 __u8 is_global;
480 __u8 port_num;
481 __u8 reserved;
482};
483
484struct ib_uverbs_qp_attr {
485 __u32 qp_attr_mask;
486 __u32 qp_state;
487 __u32 cur_qp_state;
488 __u32 path_mtu;
489 __u32 path_mig_state;
490 __u32 qkey;
491 __u32 rq_psn;
492 __u32 sq_psn;
493 __u32 dest_qp_num;
494 __u32 qp_access_flags;
495
496 struct ib_uverbs_ah_attr ah_attr;
497 struct ib_uverbs_ah_attr alt_ah_attr;
498
499 /* ib_qp_cap */
500 __u32 max_send_wr;
501 __u32 max_recv_wr;
502 __u32 max_send_sge;
503 __u32 max_recv_sge;
504 __u32 max_inline_data;
505
506 __u16 pkey_index;
507 __u16 alt_pkey_index;
508 __u8 en_sqd_async_notify;
509 __u8 sq_draining;
510 __u8 max_rd_atomic;
511 __u8 max_dest_rd_atomic;
512 __u8 min_rnr_timer;
513 __u8 port_num;
514 __u8 timeout;
515 __u8 retry_cnt;
516 __u8 rnr_retry;
517 __u8 alt_port_num;
518 __u8 alt_timeout;
519 __u8 reserved[5];
520};
521
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700522struct ib_uverbs_create_qp {
523 __u64 response;
524 __u64 user_handle;
525 __u32 pd_handle;
526 __u32 send_cq_handle;
527 __u32 recv_cq_handle;
528 __u32 srq_handle;
529 __u32 max_send_wr;
530 __u32 max_recv_wr;
531 __u32 max_send_sge;
532 __u32 max_recv_sge;
533 __u32 max_inline_data;
534 __u8 sq_sig_all;
535 __u8 qp_type;
536 __u8 is_srq;
537 __u8 reserved;
538 __u64 driver_data[0];
539};
540
Yishai Hadasc70285f2016-05-23 15:20:55 +0300541enum ib_uverbs_create_qp_mask {
542 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
543};
544
545enum {
546 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
547};
548
Bodong Wang189aba92016-12-01 13:43:15 +0200549enum {
Leon Romanovsky646ebd42017-02-08 17:04:09 +0200550 /*
551 * This value is equal to IB_QP_DEST_QPN.
552 */
553 IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
Bodong Wang189aba92016-12-01 13:43:15 +0200554};
555
556enum {
Leon Romanovsky646ebd42017-02-08 17:04:09 +0200557 /*
558 * This value is equal to IB_QP_RATE_LIMIT.
559 */
560 IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
Bodong Wang189aba92016-12-01 13:43:15 +0200561};
562
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300563struct ib_uverbs_ex_create_qp {
564 __u64 user_handle;
565 __u32 pd_handle;
566 __u32 send_cq_handle;
567 __u32 recv_cq_handle;
568 __u32 srq_handle;
569 __u32 max_send_wr;
570 __u32 max_recv_wr;
571 __u32 max_send_sge;
572 __u32 max_recv_sge;
573 __u32 max_inline_data;
574 __u8 sq_sig_all;
575 __u8 qp_type;
576 __u8 is_srq;
577 __u8 reserved;
578 __u32 comp_mask;
579 __u32 create_flags;
Yishai Hadasc70285f2016-05-23 15:20:55 +0300580 __u32 rwq_ind_tbl_handle;
581 __u32 reserved1;
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300582};
583
Sean Hefty42849b22011-08-11 13:57:43 -0700584struct ib_uverbs_open_qp {
585 __u64 response;
586 __u64 user_handle;
587 __u32 pd_handle;
588 __u32 qpn;
589 __u8 qp_type;
590 __u8 reserved[7];
591 __u64 driver_data[0];
592};
593
594/* also used for open response */
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700595struct ib_uverbs_create_qp_resp {
596 __u32 qp_handle;
597 __u32 qpn;
Jack Morgenstein77369ed2005-11-09 11:26:07 -0800598 __u32 max_send_wr;
599 __u32 max_recv_wr;
600 __u32 max_send_sge;
601 __u32 max_recv_sge;
602 __u32 max_inline_data;
Roland Dreier4d9781c2006-02-16 09:26:19 -0800603 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700604};
605
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300606struct ib_uverbs_ex_create_qp_resp {
607 struct ib_uverbs_create_qp_resp base;
608 __u32 comp_mask;
609 __u32 response_length;
610};
611
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700612/*
613 * This struct needs to remain a multiple of 8 bytes to keep the
614 * alignment of the modify QP parameters.
615 */
616struct ib_uverbs_qp_dest {
617 __u8 dgid[16];
618 __u32 flow_label;
619 __u16 dlid;
620 __u16 reserved;
621 __u8 sgid_index;
622 __u8 hop_limit;
623 __u8 traffic_class;
624 __u8 sl;
625 __u8 src_path_bits;
626 __u8 static_rate;
627 __u8 is_global;
628 __u8 port_num;
629};
630
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800631struct ib_uverbs_query_qp {
632 __u64 response;
633 __u32 qp_handle;
634 __u32 attr_mask;
635 __u64 driver_data[0];
636};
637
638struct ib_uverbs_query_qp_resp {
639 struct ib_uverbs_qp_dest dest;
640 struct ib_uverbs_qp_dest alt_dest;
641 __u32 max_send_wr;
642 __u32 max_recv_wr;
643 __u32 max_send_sge;
644 __u32 max_recv_sge;
645 __u32 max_inline_data;
646 __u32 qkey;
647 __u32 rq_psn;
648 __u32 sq_psn;
649 __u32 dest_qp_num;
650 __u32 qp_access_flags;
651 __u16 pkey_index;
652 __u16 alt_pkey_index;
653 __u8 qp_state;
654 __u8 cur_qp_state;
655 __u8 path_mtu;
656 __u8 path_mig_state;
Jack Morgenstein0b26c882006-10-25 12:54:20 +0200657 __u8 sq_draining;
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800658 __u8 max_rd_atomic;
659 __u8 max_dest_rd_atomic;
660 __u8 min_rnr_timer;
661 __u8 port_num;
662 __u8 timeout;
663 __u8 retry_cnt;
664 __u8 rnr_retry;
665 __u8 alt_port_num;
666 __u8 alt_timeout;
667 __u8 sq_sig_all;
668 __u8 reserved[5];
669 __u64 driver_data[0];
670};
671
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700672struct ib_uverbs_modify_qp {
673 struct ib_uverbs_qp_dest dest;
674 struct ib_uverbs_qp_dest alt_dest;
675 __u32 qp_handle;
676 __u32 attr_mask;
677 __u32 qkey;
678 __u32 rq_psn;
679 __u32 sq_psn;
680 __u32 dest_qp_num;
681 __u32 qp_access_flags;
682 __u16 pkey_index;
683 __u16 alt_pkey_index;
684 __u8 qp_state;
685 __u8 cur_qp_state;
686 __u8 path_mtu;
687 __u8 path_mig_state;
688 __u8 en_sqd_async_notify;
689 __u8 max_rd_atomic;
690 __u8 max_dest_rd_atomic;
691 __u8 min_rnr_timer;
692 __u8 port_num;
693 __u8 timeout;
694 __u8 retry_cnt;
695 __u8 rnr_retry;
696 __u8 alt_port_num;
697 __u8 alt_timeout;
698 __u8 reserved[2];
699 __u64 driver_data[0];
700};
701
Bodong Wang189aba92016-12-01 13:43:15 +0200702struct ib_uverbs_ex_modify_qp {
703 struct ib_uverbs_modify_qp base;
704 __u32 rate_limit;
705 __u32 reserved;
706};
707
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700708struct ib_uverbs_modify_qp_resp {
709};
710
Bodong Wang189aba92016-12-01 13:43:15 +0200711struct ib_uverbs_ex_modify_qp_resp {
712 __u32 comp_mask;
713 __u32 response_length;
714};
715
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700716struct ib_uverbs_destroy_qp {
Roland Dreier63aaf642005-09-09 15:55:08 -0700717 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700718 __u32 qp_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700719 __u32 reserved;
720};
721
722struct ib_uverbs_destroy_qp_resp {
723 __u32 events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700724};
725
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700726/*
727 * The ib_uverbs_sge structure isn't used anywhere, since we assume
728 * the ib_sge structure is packed the same way on 32-bit and 64-bit
729 * architectures in both kernel and user space. It's just here to
730 * document the ABI.
731 */
732struct ib_uverbs_sge {
733 __u64 addr;
734 __u32 length;
735 __u32 lkey;
736};
737
738struct ib_uverbs_send_wr {
Roland Dreiera74cd4a2006-02-13 16:30:49 -0800739 __u64 wr_id;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700740 __u32 num_sge;
741 __u32 opcode;
742 __u32 send_flags;
Roland Dreier0f39cf32008-04-16 21:09:32 -0700743 union {
744 __u32 imm_data;
745 __u32 invalidate_rkey;
746 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700747 union {
748 struct {
749 __u64 remote_addr;
750 __u32 rkey;
751 __u32 reserved;
752 } rdma;
753 struct {
754 __u64 remote_addr;
755 __u64 compare_add;
756 __u64 swap;
757 __u32 rkey;
758 __u32 reserved;
759 } atomic;
760 struct {
761 __u32 ah;
762 __u32 remote_qpn;
763 __u32 remote_qkey;
764 __u32 reserved;
765 } ud;
766 } wr;
767};
768
769struct ib_uverbs_post_send {
770 __u64 response;
771 __u32 qp_handle;
772 __u32 wr_count;
773 __u32 sge_count;
774 __u32 wqe_size;
775 struct ib_uverbs_send_wr send_wr[0];
776};
777
778struct ib_uverbs_post_send_resp {
779 __u32 bad_wr;
780};
781
782struct ib_uverbs_recv_wr {
783 __u64 wr_id;
784 __u32 num_sge;
785 __u32 reserved;
786};
787
788struct ib_uverbs_post_recv {
789 __u64 response;
790 __u32 qp_handle;
791 __u32 wr_count;
792 __u32 sge_count;
793 __u32 wqe_size;
794 struct ib_uverbs_recv_wr recv_wr[0];
795};
796
797struct ib_uverbs_post_recv_resp {
798 __u32 bad_wr;
799};
800
801struct ib_uverbs_post_srq_recv {
802 __u64 response;
803 __u32 srq_handle;
804 __u32 wr_count;
805 __u32 sge_count;
806 __u32 wqe_size;
807 struct ib_uverbs_recv_wr recv[0];
808};
809
810struct ib_uverbs_post_srq_recv_resp {
811 __u32 bad_wr;
812};
813
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700814struct ib_uverbs_create_ah {
815 __u64 response;
816 __u64 user_handle;
817 __u32 pd_handle;
818 __u32 reserved;
819 struct ib_uverbs_ah_attr attr;
820};
821
822struct ib_uverbs_create_ah_resp {
823 __u32 ah_handle;
824};
825
826struct ib_uverbs_destroy_ah {
827 __u32 ah_handle;
828};
829
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700830struct ib_uverbs_attach_mcast {
831 __u8 gid[16];
832 __u32 qp_handle;
833 __u16 mlid;
834 __u16 reserved;
835 __u64 driver_data[0];
836};
837
838struct ib_uverbs_detach_mcast {
839 __u8 gid[16];
840 __u32 qp_handle;
841 __u16 mlid;
842 __u16 reserved;
843 __u64 driver_data[0];
844};
845
Yann Droneaud58913ef2013-11-06 23:21:47 +0100846struct ib_uverbs_flow_spec_hdr {
847 __u32 type;
848 __u16 size;
849 __u16 reserved;
850 /* followed by flow_spec */
851 __u64 flow_spec_data[0];
852};
853
Yann Droneaudb68c9562013-11-06 23:21:46 +0100854struct ib_uverbs_flow_eth_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300855 __u8 dst_mac[6];
856 __u8 src_mac[6];
857 __be16 ether_type;
858 __be16 vlan_tag;
859};
860
Yann Droneaudb68c9562013-11-06 23:21:46 +0100861struct ib_uverbs_flow_spec_eth {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100862 union {
863 struct ib_uverbs_flow_spec_hdr hdr;
864 struct {
865 __u32 type;
866 __u16 size;
867 __u16 reserved;
868 };
869 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100870 struct ib_uverbs_flow_eth_filter val;
871 struct ib_uverbs_flow_eth_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300872};
873
Yann Droneaudb68c9562013-11-06 23:21:46 +0100874struct ib_uverbs_flow_ipv4_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300875 __be32 src_ip;
876 __be32 dst_ip;
Maor Gottlieb989a3a82016-08-30 16:58:33 +0300877 __u8 proto;
878 __u8 tos;
879 __u8 ttl;
880 __u8 flags;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300881};
882
Yann Droneaudb68c9562013-11-06 23:21:46 +0100883struct ib_uverbs_flow_spec_ipv4 {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100884 union {
885 struct ib_uverbs_flow_spec_hdr hdr;
886 struct {
887 __u32 type;
888 __u16 size;
889 __u16 reserved;
890 };
891 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100892 struct ib_uverbs_flow_ipv4_filter val;
893 struct ib_uverbs_flow_ipv4_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300894};
895
Yann Droneaudb68c9562013-11-06 23:21:46 +0100896struct ib_uverbs_flow_tcp_udp_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300897 __be16 dst_port;
898 __be16 src_port;
899};
900
Yann Droneaudb68c9562013-11-06 23:21:46 +0100901struct ib_uverbs_flow_spec_tcp_udp {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100902 union {
903 struct ib_uverbs_flow_spec_hdr hdr;
904 struct {
905 __u32 type;
906 __u16 size;
907 __u16 reserved;
908 };
909 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100910 struct ib_uverbs_flow_tcp_udp_filter val;
911 struct ib_uverbs_flow_tcp_udp_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300912};
913
Maor Gottlieb4c2aae72016-06-17 15:14:50 +0300914struct ib_uverbs_flow_ipv6_filter {
Maor Gottlieba72c6a22016-08-30 16:58:34 +0300915 __u8 src_ip[16];
916 __u8 dst_ip[16];
917 __be32 flow_label;
918 __u8 next_hdr;
919 __u8 traffic_class;
920 __u8 hop_limit;
921 __u8 reserved;
Maor Gottlieb4c2aae72016-06-17 15:14:50 +0300922};
923
924struct ib_uverbs_flow_spec_ipv6 {
925 union {
926 struct ib_uverbs_flow_spec_hdr hdr;
927 struct {
928 __u32 type;
929 __u16 size;
930 __u16 reserved;
931 };
932 };
933 struct ib_uverbs_flow_ipv6_filter val;
934 struct ib_uverbs_flow_ipv6_filter mask;
935};
936
Moses Reuben94e03f12017-01-18 14:59:49 +0200937struct ib_uverbs_flow_spec_action_tag {
938 union {
939 struct ib_uverbs_flow_spec_hdr hdr;
940 struct {
941 __u32 type;
942 __u16 size;
943 __u16 reserved;
944 };
945 };
946 __u32 tag_id;
947 __u32 reserved1;
948};
949
Slava Shwartsman483a3962017-04-03 13:13:51 +0300950struct ib_uverbs_flow_spec_action_drop {
951 union {
952 struct ib_uverbs_flow_spec_hdr hdr;
953 struct {
954 __u32 type;
955 __u16 size;
956 __u16 reserved;
957 };
958 };
959};
960
Moses Reubena0cb4c72016-11-14 19:04:49 +0200961struct ib_uverbs_flow_tunnel_filter {
962 __be32 tunnel_id;
963};
964
965struct ib_uverbs_flow_spec_tunnel {
966 union {
967 struct ib_uverbs_flow_spec_hdr hdr;
968 struct {
969 __u32 type;
970 __u16 size;
971 __u16 reserved;
972 };
973 };
974 struct ib_uverbs_flow_tunnel_filter val;
975 struct ib_uverbs_flow_tunnel_filter mask;
976};
977
Yann Droneaudd82693d2013-11-06 23:21:45 +0100978struct ib_uverbs_flow_attr {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300979 __u32 type;
980 __u16 size;
981 __u16 priority;
982 __u8 num_of_specs;
983 __u8 reserved[2];
984 __u8 port;
985 __u32 flags;
986 /* Following are the optional layers according to user request
987 * struct ib_flow_spec_xxx
988 * struct ib_flow_spec_yyy
989 */
Yann Droneaud58913ef2013-11-06 23:21:47 +0100990 struct ib_uverbs_flow_spec_hdr flow_specs[0];
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300991};
992
993struct ib_uverbs_create_flow {
994 __u32 comp_mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300995 __u32 qp_handle;
Yann Droneaudd82693d2013-11-06 23:21:45 +0100996 struct ib_uverbs_flow_attr flow_attr;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300997};
998
999struct ib_uverbs_create_flow_resp {
1000 __u32 comp_mask;
1001 __u32 flow_handle;
1002};
1003
1004struct ib_uverbs_destroy_flow {
1005 __u32 comp_mask;
1006 __u32 flow_handle;
1007};
1008
Roland Dreierf520ba52005-08-18 12:24:13 -07001009struct ib_uverbs_create_srq {
1010 __u64 response;
1011 __u64 user_handle;
1012 __u32 pd_handle;
1013 __u32 max_wr;
1014 __u32 max_sge;
1015 __u32 srq_limit;
1016 __u64 driver_data[0];
1017};
1018
Sean Hefty8541f8d2011-05-25 17:08:38 -07001019struct ib_uverbs_create_xsrq {
1020 __u64 response;
1021 __u64 user_handle;
1022 __u32 srq_type;
1023 __u32 pd_handle;
1024 __u32 max_wr;
1025 __u32 max_sge;
1026 __u32 srq_limit;
1027 __u32 reserved;
1028 __u32 xrcd_handle;
1029 __u32 cq_handle;
1030 __u64 driver_data[0];
1031};
1032
Roland Dreierf520ba52005-08-18 12:24:13 -07001033struct ib_uverbs_create_srq_resp {
1034 __u32 srq_handle;
Dotan Barakea88fd12006-02-23 12:36:18 -08001035 __u32 max_wr;
1036 __u32 max_sge;
Sean Hefty8541f8d2011-05-25 17:08:38 -07001037 __u32 srqn;
Roland Dreierf520ba52005-08-18 12:24:13 -07001038};
1039
1040struct ib_uverbs_modify_srq {
1041 __u32 srq_handle;
1042 __u32 attr_mask;
1043 __u32 max_wr;
Roland Dreierf520ba52005-08-18 12:24:13 -07001044 __u32 srq_limit;
Roland Dreierf520ba52005-08-18 12:24:13 -07001045 __u64 driver_data[0];
1046};
1047
Dotan Barak8bdb0e82006-02-13 16:31:57 -08001048struct ib_uverbs_query_srq {
1049 __u64 response;
1050 __u32 srq_handle;
1051 __u32 reserved;
1052 __u64 driver_data[0];
1053};
1054
1055struct ib_uverbs_query_srq_resp {
1056 __u32 max_wr;
1057 __u32 max_sge;
1058 __u32 srq_limit;
1059 __u32 reserved;
1060};
1061
Roland Dreierf520ba52005-08-18 12:24:13 -07001062struct ib_uverbs_destroy_srq {
Roland Dreier63aaf642005-09-09 15:55:08 -07001063 __u64 response;
Roland Dreierf520ba52005-08-18 12:24:13 -07001064 __u32 srq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -07001065 __u32 reserved;
1066};
1067
1068struct ib_uverbs_destroy_srq_resp {
1069 __u32 events_reported;
Roland Dreierf520ba52005-08-18 12:24:13 -07001070};
1071
Yishai Hadasf213c052016-05-23 15:20:49 +03001072struct ib_uverbs_ex_create_wq {
1073 __u32 comp_mask;
1074 __u32 wq_type;
1075 __u64 user_handle;
1076 __u32 pd_handle;
1077 __u32 cq_handle;
1078 __u32 max_wr;
1079 __u32 max_sge;
Noa Osherovichaf1cb952017-01-18 15:39:59 +02001080 __u32 create_flags; /* Use enum ib_wq_flags */
1081 __u32 reserved;
Yishai Hadasf213c052016-05-23 15:20:49 +03001082};
1083
1084struct ib_uverbs_ex_create_wq_resp {
1085 __u32 comp_mask;
1086 __u32 response_length;
1087 __u32 wq_handle;
1088 __u32 max_wr;
1089 __u32 max_sge;
1090 __u32 wqn;
1091};
1092
1093struct ib_uverbs_ex_destroy_wq {
1094 __u32 comp_mask;
1095 __u32 wq_handle;
1096};
1097
1098struct ib_uverbs_ex_destroy_wq_resp {
1099 __u32 comp_mask;
1100 __u32 response_length;
1101 __u32 events_reported;
1102 __u32 reserved;
1103};
1104
1105struct ib_uverbs_ex_modify_wq {
1106 __u32 attr_mask;
1107 __u32 wq_handle;
1108 __u32 wq_state;
1109 __u32 curr_wq_state;
Noa Osherovichaf1cb952017-01-18 15:39:59 +02001110 __u32 flags; /* Use enum ib_wq_flags */
1111 __u32 flags_mask; /* Use enum ib_wq_flags */
Yishai Hadasf213c052016-05-23 15:20:49 +03001112};
1113
Yishai Hadasde019a92016-05-23 15:20:52 +03001114/* Prevent memory allocation rather than max expected size */
1115#define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1116struct ib_uverbs_ex_create_rwq_ind_table {
1117 __u32 comp_mask;
1118 __u32 log_ind_tbl_size;
1119 /* Following are the wq handles according to log_ind_tbl_size
1120 * wq_handle1
1121 * wq_handle2
1122 */
1123 __u32 wq_handles[0];
1124};
1125
1126struct ib_uverbs_ex_create_rwq_ind_table_resp {
1127 __u32 comp_mask;
1128 __u32 response_length;
1129 __u32 ind_tbl_handle;
1130 __u32 ind_tbl_num;
1131};
1132
1133struct ib_uverbs_ex_destroy_rwq_ind_table {
1134 __u32 comp_mask;
1135 __u32 ind_tbl_handle;
1136};
1137
Nicolas Dichtelea6819e2017-03-27 14:20:14 +02001138#define IB_DEVICE_NAME_MAX 64
1139
Roland Dreier8a96b3f2005-07-07 17:57:12 -07001140#endif /* IB_USER_VERBS_H */