blob: 25225ebbc7d5255625a0f5abffdf9605c17dcf81 [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,
Yann Droneaudf21519b2013-11-06 23:21:49 +010096 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
Eli Cohen5a77abf2014-12-11 17:04:15 +020097 IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
Yishai Hadasf213c052016-05-23 15:20:49 +030098 IB_USER_VERBS_EX_CMD_CREATE_WQ,
99 IB_USER_VERBS_EX_CMD_MODIFY_WQ,
100 IB_USER_VERBS_EX_CMD_DESTROY_WQ,
Yishai Hadasde019a92016-05-23 15:20:52 +0300101 IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
102 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
Yann Droneaudf21519b2013-11-06 23:21:49 +0100103};
Yann Droneaudf21519b2013-11-06 23:21:49 +0100104
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700105/*
106 * Make sure that all structs defined in this file remain laid out so
107 * that they pack the same way on 32-bit and 64-bit architectures (to
108 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700109 * Specifically:
110 * - Do not use pointer types -- pass pointers in __u64 instead.
111 * - Make sure that any structure larger than 4 bytes is padded to a
112 * multiple of 8 bytes. Otherwise the structure size will be
113 * different between 32-bit and 64-bit architectures.
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700114 */
115
116struct ib_uverbs_async_event_desc {
117 __u64 element;
118 __u32 event_type; /* enum ib_event_type */
119 __u32 reserved;
120};
121
122struct ib_uverbs_comp_event_desc {
123 __u64 cq_handle;
124};
125
126/*
127 * All commands from userspace should start with a __u32 command field
128 * followed by __u16 in_words and out_words fields (which give the
129 * length of the command block and response buffer if any in 32-bit
130 * words). The kernel driver will read these fields first and read
131 * the rest of the command struct based on these value.
132 */
133
Yann Droneaudf21519b2013-11-06 23:21:49 +0100134#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
135#define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
136#define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
137
138#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
139
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700140struct ib_uverbs_cmd_hdr {
141 __u32 command;
142 __u16 in_words;
143 __u16 out_words;
144};
145
Yann Droneaudf21519b2013-11-06 23:21:49 +0100146struct ib_uverbs_ex_cmd_hdr {
147 __u64 response;
Igor Ivanov400dbc92013-08-14 13:58:29 +0300148 __u16 provider_in_words;
149 __u16 provider_out_words;
150 __u32 cmd_hdr_reserved;
151};
152
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700153struct ib_uverbs_get_context {
154 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700155 __u64 driver_data[0];
156};
157
158struct ib_uverbs_get_context_resp {
159 __u32 async_fd;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700160 __u32 num_comp_vectors;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700161};
162
163struct ib_uverbs_query_device {
164 __u64 response;
165 __u64 driver_data[0];
166};
167
168struct ib_uverbs_query_device_resp {
169 __u64 fw_ver;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700170 __be64 node_guid;
171 __be64 sys_image_guid;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700172 __u64 max_mr_size;
173 __u64 page_size_cap;
174 __u32 vendor_id;
175 __u32 vendor_part_id;
176 __u32 hw_ver;
177 __u32 max_qp;
178 __u32 max_qp_wr;
179 __u32 device_cap_flags;
180 __u32 max_sge;
181 __u32 max_sge_rd;
182 __u32 max_cq;
183 __u32 max_cqe;
184 __u32 max_mr;
185 __u32 max_pd;
186 __u32 max_qp_rd_atom;
187 __u32 max_ee_rd_atom;
188 __u32 max_res_rd_atom;
189 __u32 max_qp_init_rd_atom;
190 __u32 max_ee_init_rd_atom;
191 __u32 atomic_cap;
192 __u32 max_ee;
193 __u32 max_rdd;
194 __u32 max_mw;
195 __u32 max_raw_ipv6_qp;
196 __u32 max_raw_ethy_qp;
197 __u32 max_mcast_grp;
198 __u32 max_mcast_qp_attach;
199 __u32 max_total_mcast_qp_attach;
200 __u32 max_ah;
201 __u32 max_fmr;
202 __u32 max_map_per_fmr;
203 __u32 max_srq;
204 __u32 max_srq_wr;
205 __u32 max_srq_sge;
206 __u16 max_pkeys;
207 __u8 local_ca_ack_delay;
208 __u8 phys_port_cnt;
209 __u8 reserved[4];
210};
211
Eli Cohen02d1aa72015-02-08 13:28:50 +0200212struct ib_uverbs_ex_query_device {
213 __u32 comp_mask;
214 __u32 reserved;
215};
216
Haggai Eranf4056bf2015-02-08 13:28:51 +0200217struct ib_uverbs_odp_caps {
218 __u64 general_caps;
219 struct {
220 __u32 rc_odp_caps;
221 __u32 uc_odp_caps;
222 __u32 ud_odp_caps;
223 } per_transport_caps;
224 __u32 reserved;
225};
226
Yishai Hadas47adf2f2016-08-28 11:28:44 +0300227struct ib_uverbs_rss_caps {
228 /* Corresponding bit will be set if qp type from
229 * 'enum ib_qp_type' is supported, e.g.
230 * supported_qpts |= 1 << IB_QPT_UD
231 */
232 __u32 supported_qpts;
233 __u32 max_rwq_indirection_tables;
234 __u32 max_rwq_indirection_table_size;
235 __u32 reserved;
236};
237
Eli Cohen02d1aa72015-02-08 13:28:50 +0200238struct ib_uverbs_ex_query_device_resp {
239 struct ib_uverbs_query_device_resp base;
240 __u32 comp_mask;
241 __u32 response_length;
Haggai Eranf4056bf2015-02-08 13:28:51 +0200242 struct ib_uverbs_odp_caps odp_caps;
Matan Barak24306dc2015-06-11 16:35:24 +0300243 __u64 timestamp_mask;
244 __u64 hca_core_clock; /* in KHZ */
Majd Dibbiny0b24e5a2016-04-17 17:19:34 +0300245 __u64 device_cap_flags_ex;
Yishai Hadas47adf2f2016-08-28 11:28:44 +0300246 struct ib_uverbs_rss_caps rss_caps;
247 __u32 max_wq_type_rq;
248 __u32 reserved;
Eli Cohen02d1aa72015-02-08 13:28:50 +0200249};
250
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700251struct ib_uverbs_query_port {
252 __u64 response;
253 __u8 port_num;
254 __u8 reserved[7];
255 __u64 driver_data[0];
256};
257
258struct ib_uverbs_query_port_resp {
259 __u32 port_cap_flags;
260 __u32 max_msg_sz;
261 __u32 bad_pkey_cntr;
262 __u32 qkey_viol_cntr;
263 __u32 gid_tbl_len;
264 __u16 pkey_tbl_len;
265 __u16 lid;
266 __u16 sm_lid;
267 __u8 state;
268 __u8 max_mtu;
269 __u8 active_mtu;
270 __u8 lmc;
271 __u8 max_vl_num;
272 __u8 sm_sl;
273 __u8 subnet_timeout;
274 __u8 init_type_reply;
275 __u8 active_width;
276 __u8 active_speed;
277 __u8 phys_state;
Eli Cohen2420b602010-10-18 14:45:20 -0700278 __u8 link_layer;
279 __u8 reserved[2];
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700280};
281
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700282struct ib_uverbs_alloc_pd {
283 __u64 response;
284 __u64 driver_data[0];
285};
286
287struct ib_uverbs_alloc_pd_resp {
288 __u32 pd_handle;
289};
290
291struct ib_uverbs_dealloc_pd {
292 __u32 pd_handle;
293};
294
Sean Hefty53d0bd12011-05-24 08:33:46 -0700295struct ib_uverbs_open_xrcd {
296 __u64 response;
297 __u32 fd;
298 __u32 oflags;
299 __u64 driver_data[0];
300};
301
302struct ib_uverbs_open_xrcd_resp {
303 __u32 xrcd_handle;
304};
305
306struct ib_uverbs_close_xrcd {
307 __u32 xrcd_handle;
308};
309
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700310struct ib_uverbs_reg_mr {
311 __u64 response;
312 __u64 start;
313 __u64 length;
314 __u64 hca_va;
315 __u32 pd_handle;
316 __u32 access_flags;
317 __u64 driver_data[0];
318};
319
320struct ib_uverbs_reg_mr_resp {
321 __u32 mr_handle;
322 __u32 lkey;
323 __u32 rkey;
324};
325
Matan Barak7e6edb92014-07-31 11:01:28 +0300326struct ib_uverbs_rereg_mr {
327 __u64 response;
328 __u32 mr_handle;
329 __u32 flags;
330 __u64 start;
331 __u64 length;
332 __u64 hca_va;
333 __u32 pd_handle;
334 __u32 access_flags;
335};
336
337struct ib_uverbs_rereg_mr_resp {
338 __u32 lkey;
339 __u32 rkey;
340};
341
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700342struct ib_uverbs_dereg_mr {
343 __u32 mr_handle;
344};
345
Shani Michaeli6b52a122013-02-06 16:19:13 +0000346struct ib_uverbs_alloc_mw {
347 __u64 response;
348 __u32 pd_handle;
349 __u8 mw_type;
350 __u8 reserved[3];
351};
352
353struct ib_uverbs_alloc_mw_resp {
354 __u32 mw_handle;
355 __u32 rkey;
356};
357
358struct ib_uverbs_dealloc_mw {
359 __u32 mw_handle;
360};
361
Roland Dreier6b73597e2005-09-26 13:53:25 -0700362struct ib_uverbs_create_comp_channel {
363 __u64 response;
364};
365
366struct ib_uverbs_create_comp_channel_resp {
367 __u32 fd;
368};
369
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700370struct ib_uverbs_create_cq {
371 __u64 response;
372 __u64 user_handle;
373 __u32 cqe;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700374 __u32 comp_vector;
375 __s32 comp_channel;
376 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700377 __u64 driver_data[0];
378};
379
Matan Barak565197d2015-06-11 16:35:23 +0300380struct ib_uverbs_ex_create_cq {
381 __u64 user_handle;
382 __u32 cqe;
383 __u32 comp_vector;
384 __s32 comp_channel;
385 __u32 comp_mask;
386 __u32 flags;
387 __u32 reserved;
388};
389
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700390struct ib_uverbs_create_cq_resp {
391 __u32 cq_handle;
392 __u32 cqe;
393};
394
Matan Barak565197d2015-06-11 16:35:23 +0300395struct ib_uverbs_ex_create_cq_resp {
396 struct ib_uverbs_create_cq_resp base;
397 __u32 comp_mask;
398 __u32 response_length;
399};
400
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800401struct ib_uverbs_resize_cq {
402 __u64 response;
403 __u32 cq_handle;
404 __u32 cqe;
405 __u64 driver_data[0];
406};
407
408struct ib_uverbs_resize_cq_resp {
409 __u32 cqe;
Ralph Campbell64f817b2006-09-22 15:22:24 -0700410 __u32 reserved;
411 __u64 driver_data[0];
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800412};
413
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700414struct ib_uverbs_poll_cq {
415 __u64 response;
416 __u32 cq_handle;
417 __u32 ne;
418};
419
420struct ib_uverbs_wc {
421 __u64 wr_id;
422 __u32 status;
423 __u32 opcode;
424 __u32 vendor_err;
425 __u32 byte_len;
Steve Wise00f7ec32008-07-14 23:48:45 -0700426 union {
427 __u32 imm_data;
428 __u32 invalidate_rkey;
429 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700430 __u32 qp_num;
431 __u32 src_qp;
432 __u32 wc_flags;
433 __u16 pkey_index;
434 __u16 slid;
435 __u8 sl;
436 __u8 dlid_path_bits;
437 __u8 port_num;
438 __u8 reserved;
439};
440
441struct ib_uverbs_poll_cq_resp {
442 __u32 count;
443 __u32 reserved;
444 struct ib_uverbs_wc wc[0];
445};
446
447struct ib_uverbs_req_notify_cq {
448 __u32 cq_handle;
449 __u32 solicited_only;
450};
451
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700452struct ib_uverbs_destroy_cq {
Roland Dreier63aaf642005-09-09 15:55:08 -0700453 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700454 __u32 cq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700455 __u32 reserved;
456};
457
458struct ib_uverbs_destroy_cq_resp {
459 __u32 comp_events_reported;
460 __u32 async_events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700461};
462
Sean Hefty6a9af2e2006-06-17 20:37:27 -0700463struct ib_uverbs_global_route {
464 __u8 dgid[16];
465 __u32 flow_label;
466 __u8 sgid_index;
467 __u8 hop_limit;
468 __u8 traffic_class;
469 __u8 reserved;
470};
471
472struct ib_uverbs_ah_attr {
473 struct ib_uverbs_global_route grh;
474 __u16 dlid;
475 __u8 sl;
476 __u8 src_path_bits;
477 __u8 static_rate;
478 __u8 is_global;
479 __u8 port_num;
480 __u8 reserved;
481};
482
483struct ib_uverbs_qp_attr {
484 __u32 qp_attr_mask;
485 __u32 qp_state;
486 __u32 cur_qp_state;
487 __u32 path_mtu;
488 __u32 path_mig_state;
489 __u32 qkey;
490 __u32 rq_psn;
491 __u32 sq_psn;
492 __u32 dest_qp_num;
493 __u32 qp_access_flags;
494
495 struct ib_uverbs_ah_attr ah_attr;
496 struct ib_uverbs_ah_attr alt_ah_attr;
497
498 /* ib_qp_cap */
499 __u32 max_send_wr;
500 __u32 max_recv_wr;
501 __u32 max_send_sge;
502 __u32 max_recv_sge;
503 __u32 max_inline_data;
504
505 __u16 pkey_index;
506 __u16 alt_pkey_index;
507 __u8 en_sqd_async_notify;
508 __u8 sq_draining;
509 __u8 max_rd_atomic;
510 __u8 max_dest_rd_atomic;
511 __u8 min_rnr_timer;
512 __u8 port_num;
513 __u8 timeout;
514 __u8 retry_cnt;
515 __u8 rnr_retry;
516 __u8 alt_port_num;
517 __u8 alt_timeout;
518 __u8 reserved[5];
519};
520
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700521struct ib_uverbs_create_qp {
522 __u64 response;
523 __u64 user_handle;
524 __u32 pd_handle;
525 __u32 send_cq_handle;
526 __u32 recv_cq_handle;
527 __u32 srq_handle;
528 __u32 max_send_wr;
529 __u32 max_recv_wr;
530 __u32 max_send_sge;
531 __u32 max_recv_sge;
532 __u32 max_inline_data;
533 __u8 sq_sig_all;
534 __u8 qp_type;
535 __u8 is_srq;
536 __u8 reserved;
537 __u64 driver_data[0];
538};
539
Yishai Hadasc70285f2016-05-23 15:20:55 +0300540enum ib_uverbs_create_qp_mask {
541 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
542};
543
544enum {
545 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
546};
547
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300548struct ib_uverbs_ex_create_qp {
549 __u64 user_handle;
550 __u32 pd_handle;
551 __u32 send_cq_handle;
552 __u32 recv_cq_handle;
553 __u32 srq_handle;
554 __u32 max_send_wr;
555 __u32 max_recv_wr;
556 __u32 max_send_sge;
557 __u32 max_recv_sge;
558 __u32 max_inline_data;
559 __u8 sq_sig_all;
560 __u8 qp_type;
561 __u8 is_srq;
562 __u8 reserved;
563 __u32 comp_mask;
564 __u32 create_flags;
Yishai Hadasc70285f2016-05-23 15:20:55 +0300565 __u32 rwq_ind_tbl_handle;
566 __u32 reserved1;
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300567};
568
Sean Hefty42849b22011-08-11 13:57:43 -0700569struct ib_uverbs_open_qp {
570 __u64 response;
571 __u64 user_handle;
572 __u32 pd_handle;
573 __u32 qpn;
574 __u8 qp_type;
575 __u8 reserved[7];
576 __u64 driver_data[0];
577};
578
579/* also used for open response */
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700580struct ib_uverbs_create_qp_resp {
581 __u32 qp_handle;
582 __u32 qpn;
Jack Morgenstein77369ed2005-11-09 11:26:07 -0800583 __u32 max_send_wr;
584 __u32 max_recv_wr;
585 __u32 max_send_sge;
586 __u32 max_recv_sge;
587 __u32 max_inline_data;
Roland Dreier4d9781c2006-02-16 09:26:19 -0800588 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700589};
590
Eran Ben Elisha6d8a7492015-10-21 17:00:42 +0300591struct ib_uverbs_ex_create_qp_resp {
592 struct ib_uverbs_create_qp_resp base;
593 __u32 comp_mask;
594 __u32 response_length;
595};
596
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700597/*
598 * This struct needs to remain a multiple of 8 bytes to keep the
599 * alignment of the modify QP parameters.
600 */
601struct ib_uverbs_qp_dest {
602 __u8 dgid[16];
603 __u32 flow_label;
604 __u16 dlid;
605 __u16 reserved;
606 __u8 sgid_index;
607 __u8 hop_limit;
608 __u8 traffic_class;
609 __u8 sl;
610 __u8 src_path_bits;
611 __u8 static_rate;
612 __u8 is_global;
613 __u8 port_num;
614};
615
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800616struct ib_uverbs_query_qp {
617 __u64 response;
618 __u32 qp_handle;
619 __u32 attr_mask;
620 __u64 driver_data[0];
621};
622
623struct ib_uverbs_query_qp_resp {
624 struct ib_uverbs_qp_dest dest;
625 struct ib_uverbs_qp_dest alt_dest;
626 __u32 max_send_wr;
627 __u32 max_recv_wr;
628 __u32 max_send_sge;
629 __u32 max_recv_sge;
630 __u32 max_inline_data;
631 __u32 qkey;
632 __u32 rq_psn;
633 __u32 sq_psn;
634 __u32 dest_qp_num;
635 __u32 qp_access_flags;
636 __u16 pkey_index;
637 __u16 alt_pkey_index;
638 __u8 qp_state;
639 __u8 cur_qp_state;
640 __u8 path_mtu;
641 __u8 path_mig_state;
Jack Morgenstein0b26c882006-10-25 12:54:20 +0200642 __u8 sq_draining;
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800643 __u8 max_rd_atomic;
644 __u8 max_dest_rd_atomic;
645 __u8 min_rnr_timer;
646 __u8 port_num;
647 __u8 timeout;
648 __u8 retry_cnt;
649 __u8 rnr_retry;
650 __u8 alt_port_num;
651 __u8 alt_timeout;
652 __u8 sq_sig_all;
653 __u8 reserved[5];
654 __u64 driver_data[0];
655};
656
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700657struct ib_uverbs_modify_qp {
658 struct ib_uverbs_qp_dest dest;
659 struct ib_uverbs_qp_dest alt_dest;
660 __u32 qp_handle;
661 __u32 attr_mask;
662 __u32 qkey;
663 __u32 rq_psn;
664 __u32 sq_psn;
665 __u32 dest_qp_num;
666 __u32 qp_access_flags;
667 __u16 pkey_index;
668 __u16 alt_pkey_index;
669 __u8 qp_state;
670 __u8 cur_qp_state;
671 __u8 path_mtu;
672 __u8 path_mig_state;
673 __u8 en_sqd_async_notify;
674 __u8 max_rd_atomic;
675 __u8 max_dest_rd_atomic;
676 __u8 min_rnr_timer;
677 __u8 port_num;
678 __u8 timeout;
679 __u8 retry_cnt;
680 __u8 rnr_retry;
681 __u8 alt_port_num;
682 __u8 alt_timeout;
683 __u8 reserved[2];
684 __u64 driver_data[0];
685};
686
687struct ib_uverbs_modify_qp_resp {
688};
689
690struct ib_uverbs_destroy_qp {
Roland Dreier63aaf642005-09-09 15:55:08 -0700691 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700692 __u32 qp_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700693 __u32 reserved;
694};
695
696struct ib_uverbs_destroy_qp_resp {
697 __u32 events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700698};
699
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700700/*
701 * The ib_uverbs_sge structure isn't used anywhere, since we assume
702 * the ib_sge structure is packed the same way on 32-bit and 64-bit
703 * architectures in both kernel and user space. It's just here to
704 * document the ABI.
705 */
706struct ib_uverbs_sge {
707 __u64 addr;
708 __u32 length;
709 __u32 lkey;
710};
711
712struct ib_uverbs_send_wr {
Roland Dreiera74cd4a2006-02-13 16:30:49 -0800713 __u64 wr_id;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700714 __u32 num_sge;
715 __u32 opcode;
716 __u32 send_flags;
Roland Dreier0f39cf32008-04-16 21:09:32 -0700717 union {
718 __u32 imm_data;
719 __u32 invalidate_rkey;
720 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700721 union {
722 struct {
723 __u64 remote_addr;
724 __u32 rkey;
725 __u32 reserved;
726 } rdma;
727 struct {
728 __u64 remote_addr;
729 __u64 compare_add;
730 __u64 swap;
731 __u32 rkey;
732 __u32 reserved;
733 } atomic;
734 struct {
735 __u32 ah;
736 __u32 remote_qpn;
737 __u32 remote_qkey;
738 __u32 reserved;
739 } ud;
740 } wr;
741};
742
743struct ib_uverbs_post_send {
744 __u64 response;
745 __u32 qp_handle;
746 __u32 wr_count;
747 __u32 sge_count;
748 __u32 wqe_size;
749 struct ib_uverbs_send_wr send_wr[0];
750};
751
752struct ib_uverbs_post_send_resp {
753 __u32 bad_wr;
754};
755
756struct ib_uverbs_recv_wr {
757 __u64 wr_id;
758 __u32 num_sge;
759 __u32 reserved;
760};
761
762struct ib_uverbs_post_recv {
763 __u64 response;
764 __u32 qp_handle;
765 __u32 wr_count;
766 __u32 sge_count;
767 __u32 wqe_size;
768 struct ib_uverbs_recv_wr recv_wr[0];
769};
770
771struct ib_uverbs_post_recv_resp {
772 __u32 bad_wr;
773};
774
775struct ib_uverbs_post_srq_recv {
776 __u64 response;
777 __u32 srq_handle;
778 __u32 wr_count;
779 __u32 sge_count;
780 __u32 wqe_size;
781 struct ib_uverbs_recv_wr recv[0];
782};
783
784struct ib_uverbs_post_srq_recv_resp {
785 __u32 bad_wr;
786};
787
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700788struct ib_uverbs_create_ah {
789 __u64 response;
790 __u64 user_handle;
791 __u32 pd_handle;
792 __u32 reserved;
793 struct ib_uverbs_ah_attr attr;
794};
795
796struct ib_uverbs_create_ah_resp {
797 __u32 ah_handle;
798};
799
800struct ib_uverbs_destroy_ah {
801 __u32 ah_handle;
802};
803
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700804struct ib_uverbs_attach_mcast {
805 __u8 gid[16];
806 __u32 qp_handle;
807 __u16 mlid;
808 __u16 reserved;
809 __u64 driver_data[0];
810};
811
812struct ib_uverbs_detach_mcast {
813 __u8 gid[16];
814 __u32 qp_handle;
815 __u16 mlid;
816 __u16 reserved;
817 __u64 driver_data[0];
818};
819
Yann Droneaud58913ef2013-11-06 23:21:47 +0100820struct ib_uverbs_flow_spec_hdr {
821 __u32 type;
822 __u16 size;
823 __u16 reserved;
824 /* followed by flow_spec */
825 __u64 flow_spec_data[0];
826};
827
Yann Droneaudb68c9562013-11-06 23:21:46 +0100828struct ib_uverbs_flow_eth_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300829 __u8 dst_mac[6];
830 __u8 src_mac[6];
831 __be16 ether_type;
832 __be16 vlan_tag;
833};
834
Yann Droneaudb68c9562013-11-06 23:21:46 +0100835struct ib_uverbs_flow_spec_eth {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100836 union {
837 struct ib_uverbs_flow_spec_hdr hdr;
838 struct {
839 __u32 type;
840 __u16 size;
841 __u16 reserved;
842 };
843 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100844 struct ib_uverbs_flow_eth_filter val;
845 struct ib_uverbs_flow_eth_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300846};
847
Yann Droneaudb68c9562013-11-06 23:21:46 +0100848struct ib_uverbs_flow_ipv4_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300849 __be32 src_ip;
850 __be32 dst_ip;
Maor Gottlieb989a3a82016-08-30 16:58:33 +0300851 __u8 proto;
852 __u8 tos;
853 __u8 ttl;
854 __u8 flags;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300855};
856
Yann Droneaudb68c9562013-11-06 23:21:46 +0100857struct ib_uverbs_flow_spec_ipv4 {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100858 union {
859 struct ib_uverbs_flow_spec_hdr hdr;
860 struct {
861 __u32 type;
862 __u16 size;
863 __u16 reserved;
864 };
865 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100866 struct ib_uverbs_flow_ipv4_filter val;
867 struct ib_uverbs_flow_ipv4_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300868};
869
Yann Droneaudb68c9562013-11-06 23:21:46 +0100870struct ib_uverbs_flow_tcp_udp_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300871 __be16 dst_port;
872 __be16 src_port;
873};
874
Yann Droneaudb68c9562013-11-06 23:21:46 +0100875struct ib_uverbs_flow_spec_tcp_udp {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100876 union {
877 struct ib_uverbs_flow_spec_hdr hdr;
878 struct {
879 __u32 type;
880 __u16 size;
881 __u16 reserved;
882 };
883 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100884 struct ib_uverbs_flow_tcp_udp_filter val;
885 struct ib_uverbs_flow_tcp_udp_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300886};
887
Maor Gottlieb4c2aae72016-06-17 15:14:50 +0300888struct ib_uverbs_flow_ipv6_filter {
Maor Gottlieba72c6a22016-08-30 16:58:34 +0300889 __u8 src_ip[16];
890 __u8 dst_ip[16];
891 __be32 flow_label;
892 __u8 next_hdr;
893 __u8 traffic_class;
894 __u8 hop_limit;
895 __u8 reserved;
Maor Gottlieb4c2aae72016-06-17 15:14:50 +0300896};
897
898struct ib_uverbs_flow_spec_ipv6 {
899 union {
900 struct ib_uverbs_flow_spec_hdr hdr;
901 struct {
902 __u32 type;
903 __u16 size;
904 __u16 reserved;
905 };
906 };
907 struct ib_uverbs_flow_ipv6_filter val;
908 struct ib_uverbs_flow_ipv6_filter mask;
909};
910
Yann Droneaudd82693d2013-11-06 23:21:45 +0100911struct ib_uverbs_flow_attr {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300912 __u32 type;
913 __u16 size;
914 __u16 priority;
915 __u8 num_of_specs;
916 __u8 reserved[2];
917 __u8 port;
918 __u32 flags;
919 /* Following are the optional layers according to user request
920 * struct ib_flow_spec_xxx
921 * struct ib_flow_spec_yyy
922 */
Yann Droneaud58913ef2013-11-06 23:21:47 +0100923 struct ib_uverbs_flow_spec_hdr flow_specs[0];
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300924};
925
926struct ib_uverbs_create_flow {
927 __u32 comp_mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300928 __u32 qp_handle;
Yann Droneaudd82693d2013-11-06 23:21:45 +0100929 struct ib_uverbs_flow_attr flow_attr;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300930};
931
932struct ib_uverbs_create_flow_resp {
933 __u32 comp_mask;
934 __u32 flow_handle;
935};
936
937struct ib_uverbs_destroy_flow {
938 __u32 comp_mask;
939 __u32 flow_handle;
940};
941
Roland Dreierf520ba52005-08-18 12:24:13 -0700942struct ib_uverbs_create_srq {
943 __u64 response;
944 __u64 user_handle;
945 __u32 pd_handle;
946 __u32 max_wr;
947 __u32 max_sge;
948 __u32 srq_limit;
949 __u64 driver_data[0];
950};
951
Sean Hefty8541f8d2011-05-25 17:08:38 -0700952struct ib_uverbs_create_xsrq {
953 __u64 response;
954 __u64 user_handle;
955 __u32 srq_type;
956 __u32 pd_handle;
957 __u32 max_wr;
958 __u32 max_sge;
959 __u32 srq_limit;
960 __u32 reserved;
961 __u32 xrcd_handle;
962 __u32 cq_handle;
963 __u64 driver_data[0];
964};
965
Roland Dreierf520ba52005-08-18 12:24:13 -0700966struct ib_uverbs_create_srq_resp {
967 __u32 srq_handle;
Dotan Barakea88fd12006-02-23 12:36:18 -0800968 __u32 max_wr;
969 __u32 max_sge;
Sean Hefty8541f8d2011-05-25 17:08:38 -0700970 __u32 srqn;
Roland Dreierf520ba52005-08-18 12:24:13 -0700971};
972
973struct ib_uverbs_modify_srq {
974 __u32 srq_handle;
975 __u32 attr_mask;
976 __u32 max_wr;
Roland Dreierf520ba52005-08-18 12:24:13 -0700977 __u32 srq_limit;
Roland Dreierf520ba52005-08-18 12:24:13 -0700978 __u64 driver_data[0];
979};
980
Dotan Barak8bdb0e82006-02-13 16:31:57 -0800981struct ib_uverbs_query_srq {
982 __u64 response;
983 __u32 srq_handle;
984 __u32 reserved;
985 __u64 driver_data[0];
986};
987
988struct ib_uverbs_query_srq_resp {
989 __u32 max_wr;
990 __u32 max_sge;
991 __u32 srq_limit;
992 __u32 reserved;
993};
994
Roland Dreierf520ba52005-08-18 12:24:13 -0700995struct ib_uverbs_destroy_srq {
Roland Dreier63aaf642005-09-09 15:55:08 -0700996 __u64 response;
Roland Dreierf520ba52005-08-18 12:24:13 -0700997 __u32 srq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700998 __u32 reserved;
999};
1000
1001struct ib_uverbs_destroy_srq_resp {
1002 __u32 events_reported;
Roland Dreierf520ba52005-08-18 12:24:13 -07001003};
1004
Yishai Hadasf213c052016-05-23 15:20:49 +03001005struct ib_uverbs_ex_create_wq {
1006 __u32 comp_mask;
1007 __u32 wq_type;
1008 __u64 user_handle;
1009 __u32 pd_handle;
1010 __u32 cq_handle;
1011 __u32 max_wr;
1012 __u32 max_sge;
1013};
1014
1015struct ib_uverbs_ex_create_wq_resp {
1016 __u32 comp_mask;
1017 __u32 response_length;
1018 __u32 wq_handle;
1019 __u32 max_wr;
1020 __u32 max_sge;
1021 __u32 wqn;
1022};
1023
1024struct ib_uverbs_ex_destroy_wq {
1025 __u32 comp_mask;
1026 __u32 wq_handle;
1027};
1028
1029struct ib_uverbs_ex_destroy_wq_resp {
1030 __u32 comp_mask;
1031 __u32 response_length;
1032 __u32 events_reported;
1033 __u32 reserved;
1034};
1035
1036struct ib_uverbs_ex_modify_wq {
1037 __u32 attr_mask;
1038 __u32 wq_handle;
1039 __u32 wq_state;
1040 __u32 curr_wq_state;
1041};
1042
Yishai Hadasde019a92016-05-23 15:20:52 +03001043/* Prevent memory allocation rather than max expected size */
1044#define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1045struct ib_uverbs_ex_create_rwq_ind_table {
1046 __u32 comp_mask;
1047 __u32 log_ind_tbl_size;
1048 /* Following are the wq handles according to log_ind_tbl_size
1049 * wq_handle1
1050 * wq_handle2
1051 */
1052 __u32 wq_handles[0];
1053};
1054
1055struct ib_uverbs_ex_create_rwq_ind_table_resp {
1056 __u32 comp_mask;
1057 __u32 response_length;
1058 __u32 ind_tbl_handle;
1059 __u32 ind_tbl_num;
1060};
1061
1062struct ib_uverbs_ex_destroy_rwq_ind_table {
1063 __u32 comp_mask;
1064 __u32 ind_tbl_handle;
1065};
1066
Roland Dreier8a96b3f2005-07-07 17:57:12 -07001067#endif /* IB_USER_VERBS_H */