blob: 26daf55ff76ead65f47801620d4697b10e17151c [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 {
93 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
94 IB_USER_VERBS_EX_CMD_DESTROY_FLOW
95};
Yann Droneaudf21519b2013-11-06 23:21:49 +010096
Roland Dreier8a96b3f2005-07-07 17:57:12 -070097/*
98 * Make sure that all structs defined in this file remain laid out so
99 * that they pack the same way on 32-bit and 64-bit architectures (to
100 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700101 * Specifically:
102 * - Do not use pointer types -- pass pointers in __u64 instead.
103 * - Make sure that any structure larger than 4 bytes is padded to a
104 * multiple of 8 bytes. Otherwise the structure size will be
105 * different between 32-bit and 64-bit architectures.
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700106 */
107
108struct ib_uverbs_async_event_desc {
109 __u64 element;
110 __u32 event_type; /* enum ib_event_type */
111 __u32 reserved;
112};
113
114struct ib_uverbs_comp_event_desc {
115 __u64 cq_handle;
116};
117
118/*
119 * All commands from userspace should start with a __u32 command field
120 * followed by __u16 in_words and out_words fields (which give the
121 * length of the command block and response buffer if any in 32-bit
122 * words). The kernel driver will read these fields first and read
123 * the rest of the command struct based on these value.
124 */
125
Yann Droneaudf21519b2013-11-06 23:21:49 +0100126#define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
127#define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
128#define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
129
130#define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
131
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700132struct ib_uverbs_cmd_hdr {
133 __u32 command;
134 __u16 in_words;
135 __u16 out_words;
136};
137
Yann Droneaudf21519b2013-11-06 23:21:49 +0100138struct ib_uverbs_ex_cmd_hdr {
139 __u64 response;
Igor Ivanov400dbc92013-08-14 13:58:29 +0300140 __u16 provider_in_words;
141 __u16 provider_out_words;
142 __u32 cmd_hdr_reserved;
143};
144
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700145struct ib_uverbs_get_context {
146 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700147 __u64 driver_data[0];
148};
149
150struct ib_uverbs_get_context_resp {
151 __u32 async_fd;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700152 __u32 num_comp_vectors;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700153};
154
155struct ib_uverbs_query_device {
156 __u64 response;
157 __u64 driver_data[0];
158};
159
160struct ib_uverbs_query_device_resp {
161 __u64 fw_ver;
Sean Hefty97f52eb2005-08-13 21:05:57 -0700162 __be64 node_guid;
163 __be64 sys_image_guid;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700164 __u64 max_mr_size;
165 __u64 page_size_cap;
166 __u32 vendor_id;
167 __u32 vendor_part_id;
168 __u32 hw_ver;
169 __u32 max_qp;
170 __u32 max_qp_wr;
171 __u32 device_cap_flags;
172 __u32 max_sge;
173 __u32 max_sge_rd;
174 __u32 max_cq;
175 __u32 max_cqe;
176 __u32 max_mr;
177 __u32 max_pd;
178 __u32 max_qp_rd_atom;
179 __u32 max_ee_rd_atom;
180 __u32 max_res_rd_atom;
181 __u32 max_qp_init_rd_atom;
182 __u32 max_ee_init_rd_atom;
183 __u32 atomic_cap;
184 __u32 max_ee;
185 __u32 max_rdd;
186 __u32 max_mw;
187 __u32 max_raw_ipv6_qp;
188 __u32 max_raw_ethy_qp;
189 __u32 max_mcast_grp;
190 __u32 max_mcast_qp_attach;
191 __u32 max_total_mcast_qp_attach;
192 __u32 max_ah;
193 __u32 max_fmr;
194 __u32 max_map_per_fmr;
195 __u32 max_srq;
196 __u32 max_srq_wr;
197 __u32 max_srq_sge;
198 __u16 max_pkeys;
199 __u8 local_ca_ack_delay;
200 __u8 phys_port_cnt;
201 __u8 reserved[4];
202};
203
204struct ib_uverbs_query_port {
205 __u64 response;
206 __u8 port_num;
207 __u8 reserved[7];
208 __u64 driver_data[0];
209};
210
211struct ib_uverbs_query_port_resp {
212 __u32 port_cap_flags;
213 __u32 max_msg_sz;
214 __u32 bad_pkey_cntr;
215 __u32 qkey_viol_cntr;
216 __u32 gid_tbl_len;
217 __u16 pkey_tbl_len;
218 __u16 lid;
219 __u16 sm_lid;
220 __u8 state;
221 __u8 max_mtu;
222 __u8 active_mtu;
223 __u8 lmc;
224 __u8 max_vl_num;
225 __u8 sm_sl;
226 __u8 subnet_timeout;
227 __u8 init_type_reply;
228 __u8 active_width;
229 __u8 active_speed;
230 __u8 phys_state;
Eli Cohen2420b602010-10-18 14:45:20 -0700231 __u8 link_layer;
232 __u8 reserved[2];
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700233};
234
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700235struct ib_uverbs_alloc_pd {
236 __u64 response;
237 __u64 driver_data[0];
238};
239
240struct ib_uverbs_alloc_pd_resp {
241 __u32 pd_handle;
242};
243
244struct ib_uverbs_dealloc_pd {
245 __u32 pd_handle;
246};
247
Sean Hefty53d0bd12011-05-24 08:33:46 -0700248struct ib_uverbs_open_xrcd {
249 __u64 response;
250 __u32 fd;
251 __u32 oflags;
252 __u64 driver_data[0];
253};
254
255struct ib_uverbs_open_xrcd_resp {
256 __u32 xrcd_handle;
257};
258
259struct ib_uverbs_close_xrcd {
260 __u32 xrcd_handle;
261};
262
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700263struct ib_uverbs_reg_mr {
264 __u64 response;
265 __u64 start;
266 __u64 length;
267 __u64 hca_va;
268 __u32 pd_handle;
269 __u32 access_flags;
270 __u64 driver_data[0];
271};
272
273struct ib_uverbs_reg_mr_resp {
274 __u32 mr_handle;
275 __u32 lkey;
276 __u32 rkey;
277};
278
Matan Barak7e6edb92014-07-31 11:01:28 +0300279struct ib_uverbs_rereg_mr {
280 __u64 response;
281 __u32 mr_handle;
282 __u32 flags;
283 __u64 start;
284 __u64 length;
285 __u64 hca_va;
286 __u32 pd_handle;
287 __u32 access_flags;
288};
289
290struct ib_uverbs_rereg_mr_resp {
291 __u32 lkey;
292 __u32 rkey;
293};
294
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700295struct ib_uverbs_dereg_mr {
296 __u32 mr_handle;
297};
298
Shani Michaeli6b52a122013-02-06 16:19:13 +0000299struct ib_uverbs_alloc_mw {
300 __u64 response;
301 __u32 pd_handle;
302 __u8 mw_type;
303 __u8 reserved[3];
304};
305
306struct ib_uverbs_alloc_mw_resp {
307 __u32 mw_handle;
308 __u32 rkey;
309};
310
311struct ib_uverbs_dealloc_mw {
312 __u32 mw_handle;
313};
314
Roland Dreier6b73597e2005-09-26 13:53:25 -0700315struct ib_uverbs_create_comp_channel {
316 __u64 response;
317};
318
319struct ib_uverbs_create_comp_channel_resp {
320 __u32 fd;
321};
322
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700323struct ib_uverbs_create_cq {
324 __u64 response;
325 __u64 user_handle;
326 __u32 cqe;
Roland Dreier6b73597e2005-09-26 13:53:25 -0700327 __u32 comp_vector;
328 __s32 comp_channel;
329 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700330 __u64 driver_data[0];
331};
332
333struct ib_uverbs_create_cq_resp {
334 __u32 cq_handle;
335 __u32 cqe;
336};
337
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800338struct ib_uverbs_resize_cq {
339 __u64 response;
340 __u32 cq_handle;
341 __u32 cqe;
342 __u64 driver_data[0];
343};
344
345struct ib_uverbs_resize_cq_resp {
346 __u32 cqe;
Ralph Campbell64f817b2006-09-22 15:22:24 -0700347 __u32 reserved;
348 __u64 driver_data[0];
Roland Dreier33b9b3e2006-01-30 14:29:21 -0800349};
350
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700351struct ib_uverbs_poll_cq {
352 __u64 response;
353 __u32 cq_handle;
354 __u32 ne;
355};
356
357struct ib_uverbs_wc {
358 __u64 wr_id;
359 __u32 status;
360 __u32 opcode;
361 __u32 vendor_err;
362 __u32 byte_len;
Steve Wise00f7ec32008-07-14 23:48:45 -0700363 union {
364 __u32 imm_data;
365 __u32 invalidate_rkey;
366 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700367 __u32 qp_num;
368 __u32 src_qp;
369 __u32 wc_flags;
370 __u16 pkey_index;
371 __u16 slid;
372 __u8 sl;
373 __u8 dlid_path_bits;
374 __u8 port_num;
375 __u8 reserved;
376};
377
378struct ib_uverbs_poll_cq_resp {
379 __u32 count;
380 __u32 reserved;
381 struct ib_uverbs_wc wc[0];
382};
383
384struct ib_uverbs_req_notify_cq {
385 __u32 cq_handle;
386 __u32 solicited_only;
387};
388
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700389struct ib_uverbs_destroy_cq {
Roland Dreier63aaf642005-09-09 15:55:08 -0700390 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700391 __u32 cq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700392 __u32 reserved;
393};
394
395struct ib_uverbs_destroy_cq_resp {
396 __u32 comp_events_reported;
397 __u32 async_events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700398};
399
Sean Hefty6a9af2e2006-06-17 20:37:27 -0700400struct ib_uverbs_global_route {
401 __u8 dgid[16];
402 __u32 flow_label;
403 __u8 sgid_index;
404 __u8 hop_limit;
405 __u8 traffic_class;
406 __u8 reserved;
407};
408
409struct ib_uverbs_ah_attr {
410 struct ib_uverbs_global_route grh;
411 __u16 dlid;
412 __u8 sl;
413 __u8 src_path_bits;
414 __u8 static_rate;
415 __u8 is_global;
416 __u8 port_num;
417 __u8 reserved;
418};
419
420struct ib_uverbs_qp_attr {
421 __u32 qp_attr_mask;
422 __u32 qp_state;
423 __u32 cur_qp_state;
424 __u32 path_mtu;
425 __u32 path_mig_state;
426 __u32 qkey;
427 __u32 rq_psn;
428 __u32 sq_psn;
429 __u32 dest_qp_num;
430 __u32 qp_access_flags;
431
432 struct ib_uverbs_ah_attr ah_attr;
433 struct ib_uverbs_ah_attr alt_ah_attr;
434
435 /* ib_qp_cap */
436 __u32 max_send_wr;
437 __u32 max_recv_wr;
438 __u32 max_send_sge;
439 __u32 max_recv_sge;
440 __u32 max_inline_data;
441
442 __u16 pkey_index;
443 __u16 alt_pkey_index;
444 __u8 en_sqd_async_notify;
445 __u8 sq_draining;
446 __u8 max_rd_atomic;
447 __u8 max_dest_rd_atomic;
448 __u8 min_rnr_timer;
449 __u8 port_num;
450 __u8 timeout;
451 __u8 retry_cnt;
452 __u8 rnr_retry;
453 __u8 alt_port_num;
454 __u8 alt_timeout;
455 __u8 reserved[5];
456};
457
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700458struct ib_uverbs_create_qp {
459 __u64 response;
460 __u64 user_handle;
461 __u32 pd_handle;
462 __u32 send_cq_handle;
463 __u32 recv_cq_handle;
464 __u32 srq_handle;
465 __u32 max_send_wr;
466 __u32 max_recv_wr;
467 __u32 max_send_sge;
468 __u32 max_recv_sge;
469 __u32 max_inline_data;
470 __u8 sq_sig_all;
471 __u8 qp_type;
472 __u8 is_srq;
473 __u8 reserved;
474 __u64 driver_data[0];
475};
476
Sean Hefty42849b22011-08-11 13:57:43 -0700477struct ib_uverbs_open_qp {
478 __u64 response;
479 __u64 user_handle;
480 __u32 pd_handle;
481 __u32 qpn;
482 __u8 qp_type;
483 __u8 reserved[7];
484 __u64 driver_data[0];
485};
486
487/* also used for open response */
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700488struct ib_uverbs_create_qp_resp {
489 __u32 qp_handle;
490 __u32 qpn;
Jack Morgenstein77369ed2005-11-09 11:26:07 -0800491 __u32 max_send_wr;
492 __u32 max_recv_wr;
493 __u32 max_send_sge;
494 __u32 max_recv_sge;
495 __u32 max_inline_data;
Roland Dreier4d9781c2006-02-16 09:26:19 -0800496 __u32 reserved;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700497};
498
499/*
500 * This struct needs to remain a multiple of 8 bytes to keep the
501 * alignment of the modify QP parameters.
502 */
503struct ib_uverbs_qp_dest {
504 __u8 dgid[16];
505 __u32 flow_label;
506 __u16 dlid;
507 __u16 reserved;
508 __u8 sgid_index;
509 __u8 hop_limit;
510 __u8 traffic_class;
511 __u8 sl;
512 __u8 src_path_bits;
513 __u8 static_rate;
514 __u8 is_global;
515 __u8 port_num;
516};
517
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800518struct ib_uverbs_query_qp {
519 __u64 response;
520 __u32 qp_handle;
521 __u32 attr_mask;
522 __u64 driver_data[0];
523};
524
525struct ib_uverbs_query_qp_resp {
526 struct ib_uverbs_qp_dest dest;
527 struct ib_uverbs_qp_dest alt_dest;
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 __u32 qkey;
534 __u32 rq_psn;
535 __u32 sq_psn;
536 __u32 dest_qp_num;
537 __u32 qp_access_flags;
538 __u16 pkey_index;
539 __u16 alt_pkey_index;
540 __u8 qp_state;
541 __u8 cur_qp_state;
542 __u8 path_mtu;
543 __u8 path_mig_state;
Jack Morgenstein0b26c882006-10-25 12:54:20 +0200544 __u8 sq_draining;
Dotan Barak7ccc9a22006-02-13 16:31:25 -0800545 __u8 max_rd_atomic;
546 __u8 max_dest_rd_atomic;
547 __u8 min_rnr_timer;
548 __u8 port_num;
549 __u8 timeout;
550 __u8 retry_cnt;
551 __u8 rnr_retry;
552 __u8 alt_port_num;
553 __u8 alt_timeout;
554 __u8 sq_sig_all;
555 __u8 reserved[5];
556 __u64 driver_data[0];
557};
558
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700559struct ib_uverbs_modify_qp {
560 struct ib_uverbs_qp_dest dest;
561 struct ib_uverbs_qp_dest alt_dest;
562 __u32 qp_handle;
563 __u32 attr_mask;
564 __u32 qkey;
565 __u32 rq_psn;
566 __u32 sq_psn;
567 __u32 dest_qp_num;
568 __u32 qp_access_flags;
569 __u16 pkey_index;
570 __u16 alt_pkey_index;
571 __u8 qp_state;
572 __u8 cur_qp_state;
573 __u8 path_mtu;
574 __u8 path_mig_state;
575 __u8 en_sqd_async_notify;
576 __u8 max_rd_atomic;
577 __u8 max_dest_rd_atomic;
578 __u8 min_rnr_timer;
579 __u8 port_num;
580 __u8 timeout;
581 __u8 retry_cnt;
582 __u8 rnr_retry;
583 __u8 alt_port_num;
584 __u8 alt_timeout;
585 __u8 reserved[2];
586 __u64 driver_data[0];
587};
588
589struct ib_uverbs_modify_qp_resp {
590};
591
592struct ib_uverbs_destroy_qp {
Roland Dreier63aaf642005-09-09 15:55:08 -0700593 __u64 response;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700594 __u32 qp_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700595 __u32 reserved;
596};
597
598struct ib_uverbs_destroy_qp_resp {
599 __u32 events_reported;
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700600};
601
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700602/*
603 * The ib_uverbs_sge structure isn't used anywhere, since we assume
604 * the ib_sge structure is packed the same way on 32-bit and 64-bit
605 * architectures in both kernel and user space. It's just here to
606 * document the ABI.
607 */
608struct ib_uverbs_sge {
609 __u64 addr;
610 __u32 length;
611 __u32 lkey;
612};
613
614struct ib_uverbs_send_wr {
Roland Dreiera74cd4a2006-02-13 16:30:49 -0800615 __u64 wr_id;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700616 __u32 num_sge;
617 __u32 opcode;
618 __u32 send_flags;
Roland Dreier0f39cf32008-04-16 21:09:32 -0700619 union {
620 __u32 imm_data;
621 __u32 invalidate_rkey;
622 } ex;
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700623 union {
624 struct {
625 __u64 remote_addr;
626 __u32 rkey;
627 __u32 reserved;
628 } rdma;
629 struct {
630 __u64 remote_addr;
631 __u64 compare_add;
632 __u64 swap;
633 __u32 rkey;
634 __u32 reserved;
635 } atomic;
636 struct {
637 __u32 ah;
638 __u32 remote_qpn;
639 __u32 remote_qkey;
640 __u32 reserved;
641 } ud;
642 } wr;
643};
644
645struct ib_uverbs_post_send {
646 __u64 response;
647 __u32 qp_handle;
648 __u32 wr_count;
649 __u32 sge_count;
650 __u32 wqe_size;
651 struct ib_uverbs_send_wr send_wr[0];
652};
653
654struct ib_uverbs_post_send_resp {
655 __u32 bad_wr;
656};
657
658struct ib_uverbs_recv_wr {
659 __u64 wr_id;
660 __u32 num_sge;
661 __u32 reserved;
662};
663
664struct ib_uverbs_post_recv {
665 __u64 response;
666 __u32 qp_handle;
667 __u32 wr_count;
668 __u32 sge_count;
669 __u32 wqe_size;
670 struct ib_uverbs_recv_wr recv_wr[0];
671};
672
673struct ib_uverbs_post_recv_resp {
674 __u32 bad_wr;
675};
676
677struct ib_uverbs_post_srq_recv {
678 __u64 response;
679 __u32 srq_handle;
680 __u32 wr_count;
681 __u32 sge_count;
682 __u32 wqe_size;
683 struct ib_uverbs_recv_wr recv[0];
684};
685
686struct ib_uverbs_post_srq_recv_resp {
687 __u32 bad_wr;
688};
689
Roland Dreier91ecd4a2005-10-14 15:21:44 -0700690struct ib_uverbs_create_ah {
691 __u64 response;
692 __u64 user_handle;
693 __u32 pd_handle;
694 __u32 reserved;
695 struct ib_uverbs_ah_attr attr;
696};
697
698struct ib_uverbs_create_ah_resp {
699 __u32 ah_handle;
700};
701
702struct ib_uverbs_destroy_ah {
703 __u32 ah_handle;
704};
705
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700706struct ib_uverbs_attach_mcast {
707 __u8 gid[16];
708 __u32 qp_handle;
709 __u16 mlid;
710 __u16 reserved;
711 __u64 driver_data[0];
712};
713
714struct ib_uverbs_detach_mcast {
715 __u8 gid[16];
716 __u32 qp_handle;
717 __u16 mlid;
718 __u16 reserved;
719 __u64 driver_data[0];
720};
721
Yann Droneaud58913ef2013-11-06 23:21:47 +0100722struct ib_uverbs_flow_spec_hdr {
723 __u32 type;
724 __u16 size;
725 __u16 reserved;
726 /* followed by flow_spec */
727 __u64 flow_spec_data[0];
728};
729
Yann Droneaudb68c9562013-11-06 23:21:46 +0100730struct ib_uverbs_flow_eth_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300731 __u8 dst_mac[6];
732 __u8 src_mac[6];
733 __be16 ether_type;
734 __be16 vlan_tag;
735};
736
Yann Droneaudb68c9562013-11-06 23:21:46 +0100737struct ib_uverbs_flow_spec_eth {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100738 union {
739 struct ib_uverbs_flow_spec_hdr hdr;
740 struct {
741 __u32 type;
742 __u16 size;
743 __u16 reserved;
744 };
745 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100746 struct ib_uverbs_flow_eth_filter val;
747 struct ib_uverbs_flow_eth_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300748};
749
Yann Droneaudb68c9562013-11-06 23:21:46 +0100750struct ib_uverbs_flow_ipv4_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300751 __be32 src_ip;
752 __be32 dst_ip;
753};
754
Yann Droneaudb68c9562013-11-06 23:21:46 +0100755struct ib_uverbs_flow_spec_ipv4 {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100756 union {
757 struct ib_uverbs_flow_spec_hdr hdr;
758 struct {
759 __u32 type;
760 __u16 size;
761 __u16 reserved;
762 };
763 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100764 struct ib_uverbs_flow_ipv4_filter val;
765 struct ib_uverbs_flow_ipv4_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300766};
767
Yann Droneaudb68c9562013-11-06 23:21:46 +0100768struct ib_uverbs_flow_tcp_udp_filter {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300769 __be16 dst_port;
770 __be16 src_port;
771};
772
Yann Droneaudb68c9562013-11-06 23:21:46 +0100773struct ib_uverbs_flow_spec_tcp_udp {
Yann Droneaud58913ef2013-11-06 23:21:47 +0100774 union {
775 struct ib_uverbs_flow_spec_hdr hdr;
776 struct {
777 __u32 type;
778 __u16 size;
779 __u16 reserved;
780 };
781 };
Yann Droneaudb68c9562013-11-06 23:21:46 +0100782 struct ib_uverbs_flow_tcp_udp_filter val;
783 struct ib_uverbs_flow_tcp_udp_filter mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300784};
785
Yann Droneaudd82693d2013-11-06 23:21:45 +0100786struct ib_uverbs_flow_attr {
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300787 __u32 type;
788 __u16 size;
789 __u16 priority;
790 __u8 num_of_specs;
791 __u8 reserved[2];
792 __u8 port;
793 __u32 flags;
794 /* Following are the optional layers according to user request
795 * struct ib_flow_spec_xxx
796 * struct ib_flow_spec_yyy
797 */
Yann Droneaud58913ef2013-11-06 23:21:47 +0100798 struct ib_uverbs_flow_spec_hdr flow_specs[0];
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300799};
800
801struct ib_uverbs_create_flow {
802 __u32 comp_mask;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300803 __u32 qp_handle;
Yann Droneaudd82693d2013-11-06 23:21:45 +0100804 struct ib_uverbs_flow_attr flow_attr;
Hadar Hen Zion436f2ad2013-08-14 13:58:30 +0300805};
806
807struct ib_uverbs_create_flow_resp {
808 __u32 comp_mask;
809 __u32 flow_handle;
810};
811
812struct ib_uverbs_destroy_flow {
813 __u32 comp_mask;
814 __u32 flow_handle;
815};
816
Roland Dreierf520ba52005-08-18 12:24:13 -0700817struct ib_uverbs_create_srq {
818 __u64 response;
819 __u64 user_handle;
820 __u32 pd_handle;
821 __u32 max_wr;
822 __u32 max_sge;
823 __u32 srq_limit;
824 __u64 driver_data[0];
825};
826
Sean Hefty8541f8d2011-05-25 17:08:38 -0700827struct ib_uverbs_create_xsrq {
828 __u64 response;
829 __u64 user_handle;
830 __u32 srq_type;
831 __u32 pd_handle;
832 __u32 max_wr;
833 __u32 max_sge;
834 __u32 srq_limit;
835 __u32 reserved;
836 __u32 xrcd_handle;
837 __u32 cq_handle;
838 __u64 driver_data[0];
839};
840
Roland Dreierf520ba52005-08-18 12:24:13 -0700841struct ib_uverbs_create_srq_resp {
842 __u32 srq_handle;
Dotan Barakea88fd12006-02-23 12:36:18 -0800843 __u32 max_wr;
844 __u32 max_sge;
Sean Hefty8541f8d2011-05-25 17:08:38 -0700845 __u32 srqn;
Roland Dreierf520ba52005-08-18 12:24:13 -0700846};
847
848struct ib_uverbs_modify_srq {
849 __u32 srq_handle;
850 __u32 attr_mask;
851 __u32 max_wr;
Roland Dreierf520ba52005-08-18 12:24:13 -0700852 __u32 srq_limit;
Roland Dreierf520ba52005-08-18 12:24:13 -0700853 __u64 driver_data[0];
854};
855
Dotan Barak8bdb0e82006-02-13 16:31:57 -0800856struct ib_uverbs_query_srq {
857 __u64 response;
858 __u32 srq_handle;
859 __u32 reserved;
860 __u64 driver_data[0];
861};
862
863struct ib_uverbs_query_srq_resp {
864 __u32 max_wr;
865 __u32 max_sge;
866 __u32 srq_limit;
867 __u32 reserved;
868};
869
Roland Dreierf520ba52005-08-18 12:24:13 -0700870struct ib_uverbs_destroy_srq {
Roland Dreier63aaf642005-09-09 15:55:08 -0700871 __u64 response;
Roland Dreierf520ba52005-08-18 12:24:13 -0700872 __u32 srq_handle;
Roland Dreier63aaf642005-09-09 15:55:08 -0700873 __u32 reserved;
874};
875
876struct ib_uverbs_destroy_srq_resp {
877 __u32 events_reported;
Roland Dreierf520ba52005-08-18 12:24:13 -0700878};
879
Roland Dreier8a96b3f2005-07-07 17:57:12 -0700880#endif /* IB_USER_VERBS_H */