blob: 0db9e646edd3e7f5308e5e64633ba61f04640482 [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>
Bodong Wang189aba92016-12-01 13:43:15 +020040#include <rdma/ib_verbs.h>
Roland Dreier8a96b3f2005-07-07 17:57:12 -070041
42/*
43 * Increment this value if any changes that break userspace ABI
44 * compatibility are made.
45 */
Dotan Barakea88fd12006-02-23 12:36:18 -080046#define IB_USER_VERBS_ABI_VERSION 6
Igor Ivanov400dbc92013-08-14 13:58:29 +030047#define IB_USER_VERBS_CMD_THRESHOLD 50
Roland Dreier8a96b3f2005-07-07 17:57:12 -070048
49enum {
Roland Dreier8a96b3f2005-07-07 17:57:12 -070050 IB_USER_VERBS_CMD_GET_CONTEXT,
51 IB_USER_VERBS_CMD_QUERY_DEVICE,
52 IB_USER_VERBS_CMD_QUERY_PORT,
Roland Dreier8a96b3f2005-07-07 17:57:12 -070053 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,
Roland Dreier6b73597e2005-09-26 13:53:25 -070067 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
Roland Dreier8a96b3f2005-07-07 17:57:12 -070068 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,
Roland Dreierf520ba52005-08-18 12:24:13 -070081 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,
Sean Hefty53d0bd12011-05-24 08:33:46 -070086 IB_USER_VERBS_CMD_POST_SRQ_RECV,
87 IB_USER_VERBS_CMD_OPEN_XRCD,
Sean Hefty8541f8d2011-05-25 17:08:38 -070088 IB_USER_VERBS_CMD_CLOSE_XRCD,
Sean Hefty42849b22011-08-11 13:57:43 -070089 IB_USER_VERBS_CMD_CREATE_XSRQ,
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +030090 IB_USER_VERBS_CMD_OPEN_QP,
Roland Dreier8a96b3f2005-07-07 17:57:12 -070091};
92
Yann Droneaudf21519b2013-11-06 23:21:49 +010093enum {
Eli Cohen02d1aa72015-02-08 13:28:50 +020094 IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
Matan Barak565197d2015-06-11 16:35:23 +030095 IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +030096 IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP,
Bodong Wang189aba92016-12-01 13:43:15 +020097 IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
Yann Droneaudf21519b2013-11-06 23:21:49 +010098 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
Eli Cohen5a77abf2014-12-11 17:04:15 +020099 IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
Yishai Hadasf213c052016-05-23 15:20:49 +0300100 IB_USER_VERBS_EX_CMD_CREATE_WQ,
101 IB_USER_VERBS_EX_CMD_MODIFY_WQ,
102 IB_USER_VERBS_EX_CMD_DESTROY_WQ,
Yishai Hadasde019a92016-05-23 15:20:52 +0300103 IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
104 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
Yann Droneaudf21519b2013-11-06 23:21:49 +0100105};
Yann Droneaudf21519b2013-11-06 23:21:49 +0100106
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700107/*
108 * Make sure that all structs defined in this file remain laid out so
109 * that they pack the same way on 32-bit and 64-bit architectures (to
110 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700111 * Specifically:
112 * - Do not use pointer types -- pass pointers in __u64 instead.
113 * - Make sure that any structure larger than 4 bytes is padded to a
114 * multiple of 8 bytes. Otherwise the structure size will be
115 * different between 32-bit and 64-bit architectures.
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700116 */
117
118struct ib_uverbs_async_event_desc {
119 __u64 element;
120 __u32 event_type; /* enum ib_event_type */
121 __u32 reserved;
122};
123
124struct ib_uverbs_comp_event_desc {
125 __u64 cq_handle;
126};
127
128/*
129 * All commands from userspace should start with a __u32 command field
130 * followed by __u16 in_words and out_words fields (which give the
131 * length of the command block and response buffer if any in 32-bit
132 * words). The kernel driver will read these fields first and read
133 * the rest of the command struct based on these value.
134 */
135
Yann Droneaudf21519b2013-11-06 23:21:49 +0100136#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
137#define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
138#define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
139
140#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
141
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700142struct ib_uverbs_cmd_hdr {
143 __u32 command;
144 __u16 in_words;
145 __u16 out_words;
146};
147
Yann Droneaudf21519b2013-11-06 23:21:49 +0100148struct ib_uverbs_ex_cmd_hdr {
149 __u64 response;
Igor Ivanov400dbc92013-08-14 13:58:29 +0300150 __u16 provider_in_words;
151 __u16 provider_out_words;
152 __u32 cmd_hdr_reserved;
153};
154
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700155struct ib_uverbs_get_context {
156 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700157 __u64 driver_data[0];
158};
159
160struct ib_uverbs_get_context_resp {
161 __u32 async_fd;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700162 __u32 num_comp_vectors;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700163};
164
165struct ib_uverbs_query_device {
166 __u64 response;
167 __u64 driver_data[0];
168};
169
170struct ib_uverbs_query_device_resp {
171 __u64 fw_ver;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700172 __be64 node_guid;
173 __be64 sys_image_guid;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700174 __u64 max_mr_size;
175 __u64 page_size_cap;
176 __u32 vendor_id;
177 __u32 vendor_part_id;
178 __u32 hw_ver;
179 __u32 max_qp;
180 __u32 max_qp_wr;
181 __u32 device_cap_flags;
182 __u32 max_sge;
183 __u32 max_sge_rd;
184 __u32 max_cq;
185 __u32 max_cqe;
186 __u32 max_mr;
187 __u32 max_pd;
188 __u32 max_qp_rd_atom;
189 __u32 max_ee_rd_atom;
190 __u32 max_res_rd_atom;
191 __u32 max_qp_init_rd_atom;
192 __u32 max_ee_init_rd_atom;
193 __u32 atomic_cap;
194 __u32 max_ee;
195 __u32 max_rdd;
196 __u32 max_mw;
197 __u32 max_raw_ipv6_qp;
198 __u32 max_raw_ethy_qp;
199 __u32 max_mcast_grp;
200 __u32 max_mcast_qp_attach;
201 __u32 max_total_mcast_qp_attach;
202 __u32 max_ah;
203 __u32 max_fmr;
204 __u32 max_map_per_fmr;
205 __u32 max_srq;
206 __u32 max_srq_wr;
207 __u32 max_srq_sge;
208 __u16 max_pkeys;
209 __u8 local_ca_ack_delay;
210 __u8 phys_port_cnt;
211 __u8 reserved[4];
212};
213
Eli Cohen02d1aa72015-02-08 13:28:50 +0200214struct ib_uverbs_ex_query_device {
215 __u32 comp_mask;
216 __u32 reserved;
217};
218
Haggai Eranf4056bf2015-02-08 13:28:51 +0200219struct ib_uverbs_odp_caps {
220 __u64 general_caps;
221 struct {
222 __u32 rc_odp_caps;
223 __u32 uc_odp_caps;
224 __u32 ud_odp_caps;
225 } per_transport_caps;
226 __u32 reserved;
227};
228
Yishai Hadas47adf2f2016-08-28 11:28:44 +0300229struct ib_uverbs_rss_caps {
230 /* Corresponding bit will be set if qp type from
231 * 'enum ib_qp_type' is supported, e.g.
232 * supported_qpts |= 1 << IB_QPT_UD
233 */
234 __u32 supported_qpts;
235 __u32 max_rwq_indirection_tables;
236 __u32 max_rwq_indirection_table_size;
237 __u32 reserved;
238};
239
Eli Cohen02d1aa72015-02-08 13:28:50 +0200240struct ib_uverbs_ex_query_device_resp {
241 struct ib_uverbs_query_device_resp base;
242 __u32 comp_mask;
243 __u32 response_length;
Haggai Eranf4056bf2015-02-08 13:28:51 +0200244 struct ib_uverbs_odp_caps odp_caps;
Matan Barak24306dc2015-06-11 16:35:24 +0300245 __u64 timestamp_mask;
246 __u64 hca_core_clock; /* in KHZ */
Majd Dibbiny0b24e5a2016-04-17 17:19:34 +0300247 __u64 device_cap_flags_ex;
Yishai Hadas47adf2f2016-08-28 11:28:44 +0300248 struct ib_uverbs_rss_caps rss_caps;
249 __u32 max_wq_type_rq;
Noa Osherovich5f23d422017-01-18 15:39:58 +0200250 __u32 raw_packet_caps;
Eli Cohen02d1aa72015-02-08 13:28:50 +0200251};
252
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700253struct ib_uverbs_query_port {
254 __u64 response;
255 __u8 port_num;
256 __u8 reserved[7];
257 __u64 driver_data[0];
258};
259
260struct ib_uverbs_query_port_resp {
261 __u32 port_cap_flags;
262 __u32 max_msg_sz;
263 __u32 bad_pkey_cntr;
264 __u32 qkey_viol_cntr;
265 __u32 gid_tbl_len;
266 __u16 pkey_tbl_len;
267 __u16 lid;
268 __u16 sm_lid;
269 __u8 state;
270 __u8 max_mtu;
271 __u8 active_mtu;
272 __u8 lmc;
273 __u8 max_vl_num;
274 __u8 sm_sl;
275 __u8 subnet_timeout;
276 __u8 init_type_reply;
277 __u8 active_width;
278 __u8 active_speed;
279 __u8 phys_state;
Eli Cohen2420b602010-10-18 14:45:20 -0700280 __u8 link_layer;
281 __u8 reserved[2];
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700282};
283
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700284struct ib_uverbs_alloc_pd {
285 __u64 response;
286 __u64 driver_data[0];
287};
288
289struct ib_uverbs_alloc_pd_resp {
290 __u32 pd_handle;
291};
292
293struct ib_uverbs_dealloc_pd {
294 __u32 pd_handle;
295};
296
Sean Hefty53d0bd12011-05-24 08:33:46 -0700297struct ib_uverbs_open_xrcd {
298 __u64 response;
299 __u32 fd;
300 __u32 oflags;
301 __u64 driver_data[0];
302};
303
304struct ib_uverbs_open_xrcd_resp {
305 __u32 xrcd_handle;
306};
307
308struct ib_uverbs_close_xrcd {
309 __u32 xrcd_handle;
310};
311
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700312struct ib_uverbs_reg_mr {
313 __u64 response;
314 __u64 start;
315 __u64 length;
316 __u64 hca_va;
317 __u32 pd_handle;
318 __u32 access_flags;
319 __u64 driver_data[0];
320};
321
322struct ib_uverbs_reg_mr_resp {
323 __u32 mr_handle;
324 __u32 lkey;
325 __u32 rkey;
326};
327
Matan Barak7e6edb92014-07-31 11:01:28 +0300328struct ib_uverbs_rereg_mr {
329 __u64 response;
330 __u32 mr_handle;
331 __u32 flags;
332 __u64 start;
333 __u64 length;
334 __u64 hca_va;
335 __u32 pd_handle;
336 __u32 access_flags;
337};
338
339struct ib_uverbs_rereg_mr_resp {
340 __u32 lkey;
341 __u32 rkey;
342};
343
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700344struct ib_uverbs_dereg_mr {
345 __u32 mr_handle;
346};
347
Shani Michaeli6b52a122013-02-06 16:19:13 +0000348struct ib_uverbs_alloc_mw {
349 __u64 response;
350 __u32 pd_handle;
351 __u8 mw_type;
352 __u8 reserved[3];
353};
354
355struct ib_uverbs_alloc_mw_resp {
356 __u32 mw_handle;
357 __u32 rkey;
358};
359
360struct ib_uverbs_dealloc_mw {
361 __u32 mw_handle;
362};
363
Roland Dreier6b73597e2005-09-26 13:53:25 -0700364struct ib_uverbs_create_comp_channel {
365 __u64 response;
366};
367
368struct ib_uverbs_create_comp_channel_resp {
369 __u32 fd;
370};
371
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700372struct ib_uverbs_create_cq {
373 __u64 response;
374 __u64 user_handle;
375 __u32 cqe;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700376 __u32 comp_vector;
377 __s32 comp_channel;
378 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700379 __u64 driver_data[0];
380};
381
Matan Barak565197d2015-06-11 16:35:23 +0300382struct ib_uverbs_ex_create_cq {
383 __u64 user_handle;
384 __u32 cqe;
385 __u32 comp_vector;
386 __s32 comp_channel;
387 __u32 comp_mask;
388 __u32 flags;
389 __u32 reserved;
390};
391
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700392struct ib_uverbs_create_cq_resp {
393 __u32 cq_handle;
394 __u32 cqe;
395};
396
Matan Barak565197d2015-06-11 16:35:23 +0300397struct ib_uverbs_ex_create_cq_resp {
398 struct ib_uverbs_create_cq_resp base;
399 __u32 comp_mask;
400 __u32 response_length;
401};
402
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800403struct ib_uverbs_resize_cq {
404 __u64 response;
405 __u32 cq_handle;
406 __u32 cqe;
407 __u64 driver_data[0];
408};
409
410struct ib_uverbs_resize_cq_resp {
411 __u32 cqe;
Ralph Campbell64f817b2006-09-22 15:22:24 -0700412 __u32 reserved;
413 __u64 driver_data[0];
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800414};
415
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700416struct ib_uverbs_poll_cq {
417 __u64 response;
418 __u32 cq_handle;
419 __u32 ne;
420};
421
422struct ib_uverbs_wc {
423 __u64 wr_id;
424 __u32 status;
425 __u32 opcode;
426 __u32 vendor_err;
427 __u32 byte_len;
Steve Wise00f7ec32008-07-14 23:48:45 -0700428 union {
429 __u32 imm_data;
430 __u32 invalidate_rkey;
431 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700432 __u32 qp_num;
433 __u32 src_qp;
434 __u32 wc_flags;
435 __u16 pkey_index;
436 __u16 slid;
437 __u8 sl;
438 __u8 dlid_path_bits;
439 __u8 port_num;
440 __u8 reserved;
441};
442
443struct ib_uverbs_poll_cq_resp {
444 __u32 count;
445 __u32 reserved;
446 struct ib_uverbs_wc wc[0];
447};
448
449struct ib_uverbs_req_notify_cq {
450 __u32 cq_handle;
451 __u32 solicited_only;
452};
453
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700454struct ib_uverbs_destroy_cq {
Roland Dreier63aaf642005-09-09 15:55:08 -0700455 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700456 __u32 cq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700457 __u32 reserved;
458};
459
460struct ib_uverbs_destroy_cq_resp {
461 __u32 comp_events_reported;
462 __u32 async_events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700463};
464
Sean Hefty6a9af2e2006-06-17 20:37:27 -0700465struct ib_uverbs_global_route {
466 __u8 dgid[16];
467 __u32 flow_label;
468 __u8 sgid_index;
469 __u8 hop_limit;
470 __u8 traffic_class;
471 __u8 reserved;
472};
473
474struct ib_uverbs_ah_attr {
475 struct ib_uverbs_global_route grh;
476 __u16 dlid;
477 __u8 sl;
478 __u8 src_path_bits;
479 __u8 static_rate;
480 __u8 is_global;
481 __u8 port_num;
482 __u8 reserved;
483};
484
485struct ib_uverbs_qp_attr {
486 __u32 qp_attr_mask;
487 __u32 qp_state;
488 __u32 cur_qp_state;
489 __u32 path_mtu;
490 __u32 path_mig_state;
491 __u32 qkey;
492 __u32 rq_psn;
493 __u32 sq_psn;
494 __u32 dest_qp_num;
495 __u32 qp_access_flags;
496
497 struct ib_uverbs_ah_attr ah_attr;
498 struct ib_uverbs_ah_attr alt_ah_attr;
499
500 /* ib_qp_cap */
501 __u32 max_send_wr;
502 __u32 max_recv_wr;
503 __u32 max_send_sge;
504 __u32 max_recv_sge;
505 __u32 max_inline_data;
506
507 __u16 pkey_index;
508 __u16 alt_pkey_index;
509 __u8 en_sqd_async_notify;
510 __u8 sq_draining;
511 __u8 max_rd_atomic;
512 __u8 max_dest_rd_atomic;
513 __u8 min_rnr_timer;
514 __u8 port_num;
515 __u8 timeout;
516 __u8 retry_cnt;
517 __u8 rnr_retry;
518 __u8 alt_port_num;
519 __u8 alt_timeout;
520 __u8 reserved[5];
521};
522
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700523struct ib_uverbs_create_qp {
524 __u64 response;
525 __u64 user_handle;
526 __u32 pd_handle;
527 __u32 send_cq_handle;
528 __u32 recv_cq_handle;
529 __u32 srq_handle;
530 __u32 max_send_wr;
531 __u32 max_recv_wr;
532 __u32 max_send_sge;
533 __u32 max_recv_sge;
534 __u32 max_inline_data;
535 __u8 sq_sig_all;
536 __u8 qp_type;
537 __u8 is_srq;
538 __u8 reserved;
539 __u64 driver_data[0];
540};
541
Yishai Hadasc70285f2016-05-23 15:20:55 +0300542enum ib_uverbs_create_qp_mask {
543 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
544};
545
546enum {
547 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
548};
549
Bodong Wang189aba92016-12-01 13:43:15 +0200550enum {
551 IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
552};
553
554enum {
555 IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
556};
557
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300558struct ib_uverbs_ex_create_qp {
559 __u64 user_handle;
560 __u32 pd_handle;
561 __u32 send_cq_handle;
562 __u32 recv_cq_handle;
563 __u32 srq_handle;
564 __u32 max_send_wr;
565 __u32 max_recv_wr;
566 __u32 max_send_sge;
567 __u32 max_recv_sge;
568 __u32 max_inline_data;
569 __u8 sq_sig_all;
570 __u8 qp_type;
571 __u8 is_srq;
572 __u8 reserved;
573 __u32 comp_mask;
574 __u32 create_flags;
Yishai Hadasc70285f2016-05-23 15:20:55 +0300575 __u32 rwq_ind_tbl_handle;
576 __u32 reserved1;
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300577};
578
Sean Hefty42849b22011-08-11 13:57:43 -0700579struct ib_uverbs_open_qp {
580 __u64 response;
581 __u64 user_handle;
582 __u32 pd_handle;
583 __u32 qpn;
584 __u8 qp_type;
585 __u8 reserved[7];
586 __u64 driver_data[0];
587};
588
589/* also used for open response */
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700590struct ib_uverbs_create_qp_resp {
591 __u32 qp_handle;
592 __u32 qpn;
Jack Morgenstein77369ed2005-11-09 11:26:07 -0800593 __u32 max_send_wr;
594 __u32 max_recv_wr;
595 __u32 max_send_sge;
596 __u32 max_recv_sge;
597 __u32 max_inline_data;
Roland Dreier4d9781c2006-02-16 09:26:19 -0800598 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700599};
600
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300601struct ib_uverbs_ex_create_qp_resp {
602 struct ib_uverbs_create_qp_resp base;
603 __u32 comp_mask;
604 __u32 response_length;
605};
606
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700607/*
608 * This struct needs to remain a multiple of 8 bytes to keep the
609 * alignment of the modify QP parameters.
610 */
611struct ib_uverbs_qp_dest {
612 __u8 dgid[16];
613 __u32 flow_label;
614 __u16 dlid;
615 __u16 reserved;
616 __u8 sgid_index;
617 __u8 hop_limit;
618 __u8 traffic_class;
619 __u8 sl;
620 __u8 src_path_bits;
621 __u8 static_rate;
622 __u8 is_global;
623 __u8 port_num;
624};
625
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800626struct ib_uverbs_query_qp {
627 __u64 response;
628 __u32 qp_handle;
629 __u32 attr_mask;
630 __u64 driver_data[0];
631};
632
633struct ib_uverbs_query_qp_resp {
634 struct ib_uverbs_qp_dest dest;
635 struct ib_uverbs_qp_dest alt_dest;
636 __u32 max_send_wr;
637 __u32 max_recv_wr;
638 __u32 max_send_sge;
639 __u32 max_recv_sge;
640 __u32 max_inline_data;
641 __u32 qkey;
642 __u32 rq_psn;
643 __u32 sq_psn;
644 __u32 dest_qp_num;
645 __u32 qp_access_flags;
646 __u16 pkey_index;
647 __u16 alt_pkey_index;
648 __u8 qp_state;
649 __u8 cur_qp_state;
650 __u8 path_mtu;
651 __u8 path_mig_state;
Jack Morgenstein0b26c882006-10-25 12:54:20 +0200652 __u8 sq_draining;
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800653 __u8 max_rd_atomic;
654 __u8 max_dest_rd_atomic;
655 __u8 min_rnr_timer;
656 __u8 port_num;
657 __u8 timeout;
658 __u8 retry_cnt;
659 __u8 rnr_retry;
660 __u8 alt_port_num;
661 __u8 alt_timeout;
662 __u8 sq_sig_all;
663 __u8 reserved[5];
664 __u64 driver_data[0];
665};
666
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700667struct ib_uverbs_modify_qp {
668 struct ib_uverbs_qp_dest dest;
669 struct ib_uverbs_qp_dest alt_dest;
670 __u32 qp_handle;
671 __u32 attr_mask;
672 __u32 qkey;
673 __u32 rq_psn;
674 __u32 sq_psn;
675 __u32 dest_qp_num;
676 __u32 qp_access_flags;
677 __u16 pkey_index;
678 __u16 alt_pkey_index;
679 __u8 qp_state;
680 __u8 cur_qp_state;
681 __u8 path_mtu;
682 __u8 path_mig_state;
683 __u8 en_sqd_async_notify;
684 __u8 max_rd_atomic;
685 __u8 max_dest_rd_atomic;
686 __u8 min_rnr_timer;
687 __u8 port_num;
688 __u8 timeout;
689 __u8 retry_cnt;
690 __u8 rnr_retry;
691 __u8 alt_port_num;
692 __u8 alt_timeout;
693 __u8 reserved[2];
694 __u64 driver_data[0];
695};
696
Bodong Wang189aba92016-12-01 13:43:15 +0200697struct ib_uverbs_ex_modify_qp {
698 struct ib_uverbs_modify_qp base;
699 __u32 rate_limit;
700 __u32 reserved;
701};
702
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700703struct ib_uverbs_modify_qp_resp {
704};
705
Bodong Wang189aba92016-12-01 13:43:15 +0200706struct ib_uverbs_ex_modify_qp_resp {
707 __u32 comp_mask;
708 __u32 response_length;
709};
710
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700711struct ib_uverbs_destroy_qp {
Roland Dreier63aaf642005-09-09 15:55:08 -0700712 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700713 __u32 qp_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700714 __u32 reserved;
715};
716
717struct ib_uverbs_destroy_qp_resp {
718 __u32 events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700719};
720
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700721/*
722 * The ib_uverbs_sge structure isn't used anywhere, since we assume
723 * the ib_sge structure is packed the same way on 32-bit and 64-bit
724 * architectures in both kernel and user space. It's just here to
725 * document the ABI.
726 */
727struct ib_uverbs_sge {
728 __u64 addr;
729 __u32 length;
730 __u32 lkey;
731};
732
733struct ib_uverbs_send_wr {
Roland Dreiera74cd4a2006-02-13 16:30:49 -0800734 __u64 wr_id;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700735 __u32 num_sge;
736 __u32 opcode;
737 __u32 send_flags;
Roland Dreier0f39cf32008-04-16 21:09:32 -0700738 union {
739 __u32 imm_data;
740 __u32 invalidate_rkey;
741 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700742 union {
743 struct {
744 __u64 remote_addr;
745 __u32 rkey;
746 __u32 reserved;
747 } rdma;
748 struct {
749 __u64 remote_addr;
750 __u64 compare_add;
751 __u64 swap;
752 __u32 rkey;
753 __u32 reserved;
754 } atomic;
755 struct {
756 __u32 ah;
757 __u32 remote_qpn;
758 __u32 remote_qkey;
759 __u32 reserved;
760 } ud;
761 } wr;
762};
763
764struct ib_uverbs_post_send {
765 __u64 response;
766 __u32 qp_handle;
767 __u32 wr_count;
768 __u32 sge_count;
769 __u32 wqe_size;
770 struct ib_uverbs_send_wr send_wr[0];
771};
772
773struct ib_uverbs_post_send_resp {
774 __u32 bad_wr;
775};
776
777struct ib_uverbs_recv_wr {
778 __u64 wr_id;
779 __u32 num_sge;
780 __u32 reserved;
781};
782
783struct ib_uverbs_post_recv {
784 __u64 response;
785 __u32 qp_handle;
786 __u32 wr_count;
787 __u32 sge_count;
788 __u32 wqe_size;
789 struct ib_uverbs_recv_wr recv_wr[0];
790};
791
792struct ib_uverbs_post_recv_resp {
793 __u32 bad_wr;
794};
795
796struct ib_uverbs_post_srq_recv {
797 __u64 response;
798 __u32 srq_handle;
799 __u32 wr_count;
800 __u32 sge_count;
801 __u32 wqe_size;
802 struct ib_uverbs_recv_wr recv[0];
803};
804
805struct ib_uverbs_post_srq_recv_resp {
806 __u32 bad_wr;
807};
808
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700809struct ib_uverbs_create_ah {
810 __u64 response;
811 __u64 user_handle;
812 __u32 pd_handle;
813 __u32 reserved;
814 struct ib_uverbs_ah_attr attr;
815};
816
817struct ib_uverbs_create_ah_resp {
818 __u32 ah_handle;
819};
820
821struct ib_uverbs_destroy_ah {
822 __u32 ah_handle;
823};
824
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700825struct ib_uverbs_attach_mcast {
826 __u8 gid[16];
827 __u32 qp_handle;
828 __u16 mlid;
829 __u16 reserved;
830 __u64 driver_data[0];
831};
832
833struct ib_uverbs_detach_mcast {
834 __u8 gid[16];
835 __u32 qp_handle;
836 __u16 mlid;
837 __u16 reserved;
838 __u64 driver_data[0];
839};
840
Yann Droneaud58913ef2013-11-06 23:21:47 +0100841struct ib_uverbs_flow_spec_hdr {
842 __u32 type;
843 __u16 size;
844 __u16 reserved;
845 /* followed by flow_spec */
846 __u64 flow_spec_data[0];
847};
848
Yann Droneaudb68c9562013-11-06 23:21:46 +0100849struct ib_uverbs_flow_eth_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300850 __u8 dst_mac[6];
851 __u8 src_mac[6];
852 __be16 ether_type;
853 __be16 vlan_tag;
854};
855
Yann Droneaudb68c9562013-11-06 23:21:46 +0100856struct ib_uverbs_flow_spec_eth {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100857 union {
858 struct ib_uverbs_flow_spec_hdr hdr;
859 struct {
860 __u32 type;
861 __u16 size;
862 __u16 reserved;
863 };
864 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100865 struct ib_uverbs_flow_eth_filter val;
866 struct ib_uverbs_flow_eth_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300867};
868
Yann Droneaudb68c9562013-11-06 23:21:46 +0100869struct ib_uverbs_flow_ipv4_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300870 __be32 src_ip;
871 __be32 dst_ip;
Maor Gottlieb989a3a82016-08-30 16:58:33 +0300872 __u8 proto;
873 __u8 tos;
874 __u8 ttl;
875 __u8 flags;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300876};
877
Yann Droneaudb68c9562013-11-06 23:21:46 +0100878struct ib_uverbs_flow_spec_ipv4 {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100879 union {
880 struct ib_uverbs_flow_spec_hdr hdr;
881 struct {
882 __u32 type;
883 __u16 size;
884 __u16 reserved;
885 };
886 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100887 struct ib_uverbs_flow_ipv4_filter val;
888 struct ib_uverbs_flow_ipv4_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300889};
890
Yann Droneaudb68c9562013-11-06 23:21:46 +0100891struct ib_uverbs_flow_tcp_udp_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300892 __be16 dst_port;
893 __be16 src_port;
894};
895
Yann Droneaudb68c9562013-11-06 23:21:46 +0100896struct ib_uverbs_flow_spec_tcp_udp {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100897 union {
898 struct ib_uverbs_flow_spec_hdr hdr;
899 struct {
900 __u32 type;
901 __u16 size;
902 __u16 reserved;
903 };
904 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100905 struct ib_uverbs_flow_tcp_udp_filter val;
906 struct ib_uverbs_flow_tcp_udp_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300907};
908
Maor Gottlieb4c2aae72016-06-17 15:14:50 +0300909struct ib_uverbs_flow_ipv6_filter {
Maor Gottlieba72c6a22016-08-30 16:58:34 +0300910 __u8 src_ip[16];
911 __u8 dst_ip[16];
912 __be32 flow_label;
913 __u8 next_hdr;
914 __u8 traffic_class;
915 __u8 hop_limit;
916 __u8 reserved;
Maor Gottlieb4c2aae72016-06-17 15:14:50 +0300917};
918
919struct ib_uverbs_flow_spec_ipv6 {
920 union {
921 struct ib_uverbs_flow_spec_hdr hdr;
922 struct {
923 __u32 type;
924 __u16 size;
925 __u16 reserved;
926 };
927 };
928 struct ib_uverbs_flow_ipv6_filter val;
929 struct ib_uverbs_flow_ipv6_filter mask;
930};
931
Moses Reuben94e03f12017-01-18 14:59:49 +0200932struct ib_uverbs_flow_spec_action_tag {
933 union {
934 struct ib_uverbs_flow_spec_hdr hdr;
935 struct {
936 __u32 type;
937 __u16 size;
938 __u16 reserved;
939 };
940 };
941 __u32 tag_id;
942 __u32 reserved1;
943};
944
Moses Reubena0cb4c72016-11-14 19:04:49 +0200945struct ib_uverbs_flow_tunnel_filter {
946 __be32 tunnel_id;
947};
948
949struct ib_uverbs_flow_spec_tunnel {
950 union {
951 struct ib_uverbs_flow_spec_hdr hdr;
952 struct {
953 __u32 type;
954 __u16 size;
955 __u16 reserved;
956 };
957 };
958 struct ib_uverbs_flow_tunnel_filter val;
959 struct ib_uverbs_flow_tunnel_filter mask;
960};
961
Yann Droneaudd82693d2013-11-06 23:21:45 +0100962struct ib_uverbs_flow_attr {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300963 __u32 type;
964 __u16 size;
965 __u16 priority;
966 __u8 num_of_specs;
967 __u8 reserved[2];
968 __u8 port;
969 __u32 flags;
970 /* Following are the optional layers according to user request
971 * struct ib_flow_spec_xxx
972 * struct ib_flow_spec_yyy
973 */
Yann Droneaud58913ef2013-11-06 23:21:47 +0100974 struct ib_uverbs_flow_spec_hdr flow_specs[0];
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300975};
976
977struct ib_uverbs_create_flow {
978 __u32 comp_mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300979 __u32 qp_handle;
Yann Droneaudd82693d2013-11-06 23:21:45 +0100980 struct ib_uverbs_flow_attr flow_attr;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300981};
982
983struct ib_uverbs_create_flow_resp {
984 __u32 comp_mask;
985 __u32 flow_handle;
986};
987
988struct ib_uverbs_destroy_flow {
989 __u32 comp_mask;
990 __u32 flow_handle;
991};
992
Roland Dreierf520ba52005-08-18 12:24:13 -0700993struct ib_uverbs_create_srq {
994 __u64 response;
995 __u64 user_handle;
996 __u32 pd_handle;
997 __u32 max_wr;
998 __u32 max_sge;
999 __u32 srq_limit;
1000 __u64 driver_data[0];
1001};
1002
Sean Hefty8541f8d2011-05-25 17:08:38 -07001003struct ib_uverbs_create_xsrq {
1004 __u64 response;
1005 __u64 user_handle;
1006 __u32 srq_type;
1007 __u32 pd_handle;
1008 __u32 max_wr;
1009 __u32 max_sge;
1010 __u32 srq_limit;
1011 __u32 reserved;
1012 __u32 xrcd_handle;
1013 __u32 cq_handle;
1014 __u64 driver_data[0];
1015};
1016
Roland Dreierf520ba52005-08-18 12:24:13 -07001017struct ib_uverbs_create_srq_resp {
1018 __u32 srq_handle;
Dotan Barakea88fd12006-02-23 12:36:18 -08001019 __u32 max_wr;
1020 __u32 max_sge;
Sean Hefty8541f8d2011-05-25 17:08:38 -07001021 __u32 srqn;
Roland Dreierf520ba52005-08-18 12:24:13 -07001022};
1023
1024struct ib_uverbs_modify_srq {
1025 __u32 srq_handle;
1026 __u32 attr_mask;
1027 __u32 max_wr;
Roland Dreierf520ba52005-08-18 12:24:13 -07001028 __u32 srq_limit;
Roland Dreierf520ba52005-08-18 12:24:13 -07001029 __u64 driver_data[0];
1030};
1031
Dotan Barak8bdb0e82006-02-13 16:31:57 -08001032struct ib_uverbs_query_srq {
1033 __u64 response;
1034 __u32 srq_handle;
1035 __u32 reserved;
1036 __u64 driver_data[0];
1037};
1038
1039struct ib_uverbs_query_srq_resp {
1040 __u32 max_wr;
1041 __u32 max_sge;
1042 __u32 srq_limit;
1043 __u32 reserved;
1044};
1045
Roland Dreierf520ba52005-08-18 12:24:13 -07001046struct ib_uverbs_destroy_srq {
Roland Dreier63aaf642005-09-09 15:55:08 -07001047 __u64 response;
Roland Dreierf520ba52005-08-18 12:24:13 -07001048 __u32 srq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -07001049 __u32 reserved;
1050};
1051
1052struct ib_uverbs_destroy_srq_resp {
1053 __u32 events_reported;
Roland Dreierf520ba52005-08-18 12:24:13 -07001054};
1055
Yishai Hadasf213c052016-05-23 15:20:49 +03001056struct ib_uverbs_ex_create_wq {
1057 __u32 comp_mask;
1058 __u32 wq_type;
1059 __u64 user_handle;
1060 __u32 pd_handle;
1061 __u32 cq_handle;
1062 __u32 max_wr;
1063 __u32 max_sge;
1064};
1065
1066struct ib_uverbs_ex_create_wq_resp {
1067 __u32 comp_mask;
1068 __u32 response_length;
1069 __u32 wq_handle;
1070 __u32 max_wr;
1071 __u32 max_sge;
1072 __u32 wqn;
1073};
1074
1075struct ib_uverbs_ex_destroy_wq {
1076 __u32 comp_mask;
1077 __u32 wq_handle;
1078};
1079
1080struct ib_uverbs_ex_destroy_wq_resp {
1081 __u32 comp_mask;
1082 __u32 response_length;
1083 __u32 events_reported;
1084 __u32 reserved;
1085};
1086
1087struct ib_uverbs_ex_modify_wq {
1088 __u32 attr_mask;
1089 __u32 wq_handle;
1090 __u32 wq_state;
1091 __u32 curr_wq_state;
1092};
1093
Yishai Hadasde019a92016-05-23 15:20:52 +03001094/* Prevent memory allocation rather than max expected size */
1095#define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1096struct ib_uverbs_ex_create_rwq_ind_table {
1097 __u32 comp_mask;
1098 __u32 log_ind_tbl_size;
1099 /* Following are the wq handles according to log_ind_tbl_size
1100 * wq_handle1
1101 * wq_handle2
1102 */
1103 __u32 wq_handles[0];
1104};
1105
1106struct ib_uverbs_ex_create_rwq_ind_table_resp {
1107 __u32 comp_mask;
1108 __u32 response_length;
1109 __u32 ind_tbl_handle;
1110 __u32 ind_tbl_num;
1111};
1112
1113struct ib_uverbs_ex_destroy_rwq_ind_table {
1114 __u32 comp_mask;
1115 __u32 ind_tbl_handle;
1116};
1117
Roland Dreier8a96b3f2005-07-07 17:57:12 -07001118#endif /* IB_USER_VERBS_H */