xref: /linux/include/uapi/rdma/ib_user_verbs.h (revision c0e297dc61f8d4453e07afbea1fa8d0e67cd4a34)
1 /*
2  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
3  * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
4  * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
5  * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
6  *
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.
34  */
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  */
45 #define IB_USER_VERBS_ABI_VERSION	6
46 #define IB_USER_VERBS_CMD_THRESHOLD    50
47 
48 enum {
49 	IB_USER_VERBS_CMD_GET_CONTEXT,
50 	IB_USER_VERBS_CMD_QUERY_DEVICE,
51 	IB_USER_VERBS_CMD_QUERY_PORT,
52 	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,
66 	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
67 	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,
80 	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,
85 	IB_USER_VERBS_CMD_POST_SRQ_RECV,
86 	IB_USER_VERBS_CMD_OPEN_XRCD,
87 	IB_USER_VERBS_CMD_CLOSE_XRCD,
88 	IB_USER_VERBS_CMD_CREATE_XSRQ,
89 	IB_USER_VERBS_CMD_OPEN_QP,
90 };
91 
92 enum {
93 	IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
94 	IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
95 	IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
96 	IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
97 };
98 
99 /*
100  * Make sure that all structs defined in this file remain laid out so
101  * that they pack the same way on 32-bit and 64-bit architectures (to
102  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
103  * Specifically:
104  *  - Do not use pointer types -- pass pointers in __u64 instead.
105  *  - Make sure that any structure larger than 4 bytes is padded to a
106  *    multiple of 8 bytes.  Otherwise the structure size will be
107  *    different between 32-bit and 64-bit architectures.
108  */
109 
110 struct ib_uverbs_async_event_desc {
111 	__u64 element;
112 	__u32 event_type;	/* enum ib_event_type */
113 	__u32 reserved;
114 };
115 
116 struct ib_uverbs_comp_event_desc {
117 	__u64 cq_handle;
118 };
119 
120 /*
121  * All commands from userspace should start with a __u32 command field
122  * followed by __u16 in_words and out_words fields (which give the
123  * length of the command block and response buffer if any in 32-bit
124  * words).  The kernel driver will read these fields first and read
125  * the rest of the command struct based on these value.
126  */
127 
128 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
129 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
130 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
131 
132 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
133 
134 struct ib_uverbs_cmd_hdr {
135 	__u32 command;
136 	__u16 in_words;
137 	__u16 out_words;
138 };
139 
140 struct ib_uverbs_ex_cmd_hdr {
141 	__u64 response;
142 	__u16 provider_in_words;
143 	__u16 provider_out_words;
144 	__u32 cmd_hdr_reserved;
145 };
146 
147 struct ib_uverbs_get_context {
148 	__u64 response;
149 	__u64 driver_data[0];
150 };
151 
152 struct ib_uverbs_get_context_resp {
153 	__u32 async_fd;
154 	__u32 num_comp_vectors;
155 };
156 
157 struct ib_uverbs_query_device {
158 	__u64 response;
159 	__u64 driver_data[0];
160 };
161 
162 struct ib_uverbs_query_device_resp {
163 	__u64 fw_ver;
164 	__be64 node_guid;
165 	__be64 sys_image_guid;
166 	__u64 max_mr_size;
167 	__u64 page_size_cap;
168 	__u32 vendor_id;
169 	__u32 vendor_part_id;
170 	__u32 hw_ver;
171 	__u32 max_qp;
172 	__u32 max_qp_wr;
173 	__u32 device_cap_flags;
174 	__u32 max_sge;
175 	__u32 max_sge_rd;
176 	__u32 max_cq;
177 	__u32 max_cqe;
178 	__u32 max_mr;
179 	__u32 max_pd;
180 	__u32 max_qp_rd_atom;
181 	__u32 max_ee_rd_atom;
182 	__u32 max_res_rd_atom;
183 	__u32 max_qp_init_rd_atom;
184 	__u32 max_ee_init_rd_atom;
185 	__u32 atomic_cap;
186 	__u32 max_ee;
187 	__u32 max_rdd;
188 	__u32 max_mw;
189 	__u32 max_raw_ipv6_qp;
190 	__u32 max_raw_ethy_qp;
191 	__u32 max_mcast_grp;
192 	__u32 max_mcast_qp_attach;
193 	__u32 max_total_mcast_qp_attach;
194 	__u32 max_ah;
195 	__u32 max_fmr;
196 	__u32 max_map_per_fmr;
197 	__u32 max_srq;
198 	__u32 max_srq_wr;
199 	__u32 max_srq_sge;
200 	__u16 max_pkeys;
201 	__u8  local_ca_ack_delay;
202 	__u8  phys_port_cnt;
203 	__u8  reserved[4];
204 };
205 
206 struct ib_uverbs_ex_query_device {
207 	__u32 comp_mask;
208 	__u32 reserved;
209 };
210 
211 struct ib_uverbs_odp_caps {
212 	__u64 general_caps;
213 	struct {
214 		__u32 rc_odp_caps;
215 		__u32 uc_odp_caps;
216 		__u32 ud_odp_caps;
217 	} per_transport_caps;
218 	__u32 reserved;
219 };
220 
221 struct ib_uverbs_ex_query_device_resp {
222 	struct ib_uverbs_query_device_resp base;
223 	__u32 comp_mask;
224 	__u32 response_length;
225 	struct ib_uverbs_odp_caps odp_caps;
226 	__u64 timestamp_mask;
227 	__u64 hca_core_clock; /* in KHZ */
228 };
229 
230 struct ib_uverbs_query_port {
231 	__u64 response;
232 	__u8  port_num;
233 	__u8  reserved[7];
234 	__u64 driver_data[0];
235 };
236 
237 struct ib_uverbs_query_port_resp {
238 	__u32 port_cap_flags;
239 	__u32 max_msg_sz;
240 	__u32 bad_pkey_cntr;
241 	__u32 qkey_viol_cntr;
242 	__u32 gid_tbl_len;
243 	__u16 pkey_tbl_len;
244 	__u16 lid;
245 	__u16 sm_lid;
246 	__u8  state;
247 	__u8  max_mtu;
248 	__u8  active_mtu;
249 	__u8  lmc;
250 	__u8  max_vl_num;
251 	__u8  sm_sl;
252 	__u8  subnet_timeout;
253 	__u8  init_type_reply;
254 	__u8  active_width;
255 	__u8  active_speed;
256 	__u8  phys_state;
257 	__u8  link_layer;
258 	__u8  reserved[2];
259 };
260 
261 struct ib_uverbs_alloc_pd {
262 	__u64 response;
263 	__u64 driver_data[0];
264 };
265 
266 struct ib_uverbs_alloc_pd_resp {
267 	__u32 pd_handle;
268 };
269 
270 struct ib_uverbs_dealloc_pd {
271 	__u32 pd_handle;
272 };
273 
274 struct ib_uverbs_open_xrcd {
275 	__u64 response;
276 	__u32 fd;
277 	__u32 oflags;
278 	__u64 driver_data[0];
279 };
280 
281 struct ib_uverbs_open_xrcd_resp {
282 	__u32 xrcd_handle;
283 };
284 
285 struct ib_uverbs_close_xrcd {
286 	__u32 xrcd_handle;
287 };
288 
289 struct ib_uverbs_reg_mr {
290 	__u64 response;
291 	__u64 start;
292 	__u64 length;
293 	__u64 hca_va;
294 	__u32 pd_handle;
295 	__u32 access_flags;
296 	__u64 driver_data[0];
297 };
298 
299 struct ib_uverbs_reg_mr_resp {
300 	__u32 mr_handle;
301 	__u32 lkey;
302 	__u32 rkey;
303 };
304 
305 struct ib_uverbs_rereg_mr {
306 	__u64 response;
307 	__u32 mr_handle;
308 	__u32 flags;
309 	__u64 start;
310 	__u64 length;
311 	__u64 hca_va;
312 	__u32 pd_handle;
313 	__u32 access_flags;
314 };
315 
316 struct ib_uverbs_rereg_mr_resp {
317 	__u32 lkey;
318 	__u32 rkey;
319 };
320 
321 struct ib_uverbs_dereg_mr {
322 	__u32 mr_handle;
323 };
324 
325 struct ib_uverbs_alloc_mw {
326 	__u64 response;
327 	__u32 pd_handle;
328 	__u8  mw_type;
329 	__u8  reserved[3];
330 };
331 
332 struct ib_uverbs_alloc_mw_resp {
333 	__u32 mw_handle;
334 	__u32 rkey;
335 };
336 
337 struct ib_uverbs_dealloc_mw {
338 	__u32 mw_handle;
339 };
340 
341 struct ib_uverbs_create_comp_channel {
342 	__u64 response;
343 };
344 
345 struct ib_uverbs_create_comp_channel_resp {
346 	__u32 fd;
347 };
348 
349 struct ib_uverbs_create_cq {
350 	__u64 response;
351 	__u64 user_handle;
352 	__u32 cqe;
353 	__u32 comp_vector;
354 	__s32 comp_channel;
355 	__u32 reserved;
356 	__u64 driver_data[0];
357 };
358 
359 struct ib_uverbs_ex_create_cq {
360 	__u64 user_handle;
361 	__u32 cqe;
362 	__u32 comp_vector;
363 	__s32 comp_channel;
364 	__u32 comp_mask;
365 	__u32 flags;
366 	__u32 reserved;
367 };
368 
369 struct ib_uverbs_create_cq_resp {
370 	__u32 cq_handle;
371 	__u32 cqe;
372 };
373 
374 struct ib_uverbs_ex_create_cq_resp {
375 	struct ib_uverbs_create_cq_resp base;
376 	__u32 comp_mask;
377 	__u32 response_length;
378 };
379 
380 struct ib_uverbs_resize_cq {
381 	__u64 response;
382 	__u32 cq_handle;
383 	__u32 cqe;
384 	__u64 driver_data[0];
385 };
386 
387 struct ib_uverbs_resize_cq_resp {
388 	__u32 cqe;
389 	__u32 reserved;
390 	__u64 driver_data[0];
391 };
392 
393 struct ib_uverbs_poll_cq {
394 	__u64 response;
395 	__u32 cq_handle;
396 	__u32 ne;
397 };
398 
399 struct ib_uverbs_wc {
400 	__u64 wr_id;
401 	__u32 status;
402 	__u32 opcode;
403 	__u32 vendor_err;
404 	__u32 byte_len;
405 	union {
406 		__u32 imm_data;
407 		__u32 invalidate_rkey;
408 	} ex;
409 	__u32 qp_num;
410 	__u32 src_qp;
411 	__u32 wc_flags;
412 	__u16 pkey_index;
413 	__u16 slid;
414 	__u8 sl;
415 	__u8 dlid_path_bits;
416 	__u8 port_num;
417 	__u8 reserved;
418 };
419 
420 struct ib_uverbs_poll_cq_resp {
421 	__u32 count;
422 	__u32 reserved;
423 	struct ib_uverbs_wc wc[0];
424 };
425 
426 struct ib_uverbs_req_notify_cq {
427 	__u32 cq_handle;
428 	__u32 solicited_only;
429 };
430 
431 struct ib_uverbs_destroy_cq {
432 	__u64 response;
433 	__u32 cq_handle;
434 	__u32 reserved;
435 };
436 
437 struct ib_uverbs_destroy_cq_resp {
438 	__u32 comp_events_reported;
439 	__u32 async_events_reported;
440 };
441 
442 struct ib_uverbs_global_route {
443 	__u8  dgid[16];
444 	__u32 flow_label;
445 	__u8  sgid_index;
446 	__u8  hop_limit;
447 	__u8  traffic_class;
448 	__u8  reserved;
449 };
450 
451 struct ib_uverbs_ah_attr {
452 	struct ib_uverbs_global_route grh;
453 	__u16 dlid;
454 	__u8  sl;
455 	__u8  src_path_bits;
456 	__u8  static_rate;
457 	__u8  is_global;
458 	__u8  port_num;
459 	__u8  reserved;
460 };
461 
462 struct ib_uverbs_qp_attr {
463 	__u32	qp_attr_mask;
464 	__u32	qp_state;
465 	__u32	cur_qp_state;
466 	__u32	path_mtu;
467 	__u32	path_mig_state;
468 	__u32	qkey;
469 	__u32	rq_psn;
470 	__u32	sq_psn;
471 	__u32	dest_qp_num;
472 	__u32	qp_access_flags;
473 
474 	struct ib_uverbs_ah_attr ah_attr;
475 	struct ib_uverbs_ah_attr alt_ah_attr;
476 
477 	/* ib_qp_cap */
478 	__u32	max_send_wr;
479 	__u32	max_recv_wr;
480 	__u32	max_send_sge;
481 	__u32	max_recv_sge;
482 	__u32	max_inline_data;
483 
484 	__u16	pkey_index;
485 	__u16	alt_pkey_index;
486 	__u8	en_sqd_async_notify;
487 	__u8	sq_draining;
488 	__u8	max_rd_atomic;
489 	__u8	max_dest_rd_atomic;
490 	__u8	min_rnr_timer;
491 	__u8	port_num;
492 	__u8	timeout;
493 	__u8	retry_cnt;
494 	__u8	rnr_retry;
495 	__u8	alt_port_num;
496 	__u8	alt_timeout;
497 	__u8	reserved[5];
498 };
499 
500 struct ib_uverbs_create_qp {
501 	__u64 response;
502 	__u64 user_handle;
503 	__u32 pd_handle;
504 	__u32 send_cq_handle;
505 	__u32 recv_cq_handle;
506 	__u32 srq_handle;
507 	__u32 max_send_wr;
508 	__u32 max_recv_wr;
509 	__u32 max_send_sge;
510 	__u32 max_recv_sge;
511 	__u32 max_inline_data;
512 	__u8  sq_sig_all;
513 	__u8  qp_type;
514 	__u8  is_srq;
515 	__u8  reserved;
516 	__u64 driver_data[0];
517 };
518 
519 struct ib_uverbs_open_qp {
520 	__u64 response;
521 	__u64 user_handle;
522 	__u32 pd_handle;
523 	__u32 qpn;
524 	__u8  qp_type;
525 	__u8  reserved[7];
526 	__u64 driver_data[0];
527 };
528 
529 /* also used for open response */
530 struct ib_uverbs_create_qp_resp {
531 	__u32 qp_handle;
532 	__u32 qpn;
533 	__u32 max_send_wr;
534 	__u32 max_recv_wr;
535 	__u32 max_send_sge;
536 	__u32 max_recv_sge;
537 	__u32 max_inline_data;
538 	__u32 reserved;
539 };
540 
541 /*
542  * This struct needs to remain a multiple of 8 bytes to keep the
543  * alignment of the modify QP parameters.
544  */
545 struct ib_uverbs_qp_dest {
546 	__u8  dgid[16];
547 	__u32 flow_label;
548 	__u16 dlid;
549 	__u16 reserved;
550 	__u8  sgid_index;
551 	__u8  hop_limit;
552 	__u8  traffic_class;
553 	__u8  sl;
554 	__u8  src_path_bits;
555 	__u8  static_rate;
556 	__u8  is_global;
557 	__u8  port_num;
558 };
559 
560 struct ib_uverbs_query_qp {
561 	__u64 response;
562 	__u32 qp_handle;
563 	__u32 attr_mask;
564 	__u64 driver_data[0];
565 };
566 
567 struct ib_uverbs_query_qp_resp {
568 	struct ib_uverbs_qp_dest dest;
569 	struct ib_uverbs_qp_dest alt_dest;
570 	__u32 max_send_wr;
571 	__u32 max_recv_wr;
572 	__u32 max_send_sge;
573 	__u32 max_recv_sge;
574 	__u32 max_inline_data;
575 	__u32 qkey;
576 	__u32 rq_psn;
577 	__u32 sq_psn;
578 	__u32 dest_qp_num;
579 	__u32 qp_access_flags;
580 	__u16 pkey_index;
581 	__u16 alt_pkey_index;
582 	__u8  qp_state;
583 	__u8  cur_qp_state;
584 	__u8  path_mtu;
585 	__u8  path_mig_state;
586 	__u8  sq_draining;
587 	__u8  max_rd_atomic;
588 	__u8  max_dest_rd_atomic;
589 	__u8  min_rnr_timer;
590 	__u8  port_num;
591 	__u8  timeout;
592 	__u8  retry_cnt;
593 	__u8  rnr_retry;
594 	__u8  alt_port_num;
595 	__u8  alt_timeout;
596 	__u8  sq_sig_all;
597 	__u8  reserved[5];
598 	__u64 driver_data[0];
599 };
600 
601 struct ib_uverbs_modify_qp {
602 	struct ib_uverbs_qp_dest dest;
603 	struct ib_uverbs_qp_dest alt_dest;
604 	__u32 qp_handle;
605 	__u32 attr_mask;
606 	__u32 qkey;
607 	__u32 rq_psn;
608 	__u32 sq_psn;
609 	__u32 dest_qp_num;
610 	__u32 qp_access_flags;
611 	__u16 pkey_index;
612 	__u16 alt_pkey_index;
613 	__u8  qp_state;
614 	__u8  cur_qp_state;
615 	__u8  path_mtu;
616 	__u8  path_mig_state;
617 	__u8  en_sqd_async_notify;
618 	__u8  max_rd_atomic;
619 	__u8  max_dest_rd_atomic;
620 	__u8  min_rnr_timer;
621 	__u8  port_num;
622 	__u8  timeout;
623 	__u8  retry_cnt;
624 	__u8  rnr_retry;
625 	__u8  alt_port_num;
626 	__u8  alt_timeout;
627 	__u8  reserved[2];
628 	__u64 driver_data[0];
629 };
630 
631 struct ib_uverbs_modify_qp_resp {
632 };
633 
634 struct ib_uverbs_destroy_qp {
635 	__u64 response;
636 	__u32 qp_handle;
637 	__u32 reserved;
638 };
639 
640 struct ib_uverbs_destroy_qp_resp {
641 	__u32 events_reported;
642 };
643 
644 /*
645  * The ib_uverbs_sge structure isn't used anywhere, since we assume
646  * the ib_sge structure is packed the same way on 32-bit and 64-bit
647  * architectures in both kernel and user space.  It's just here to
648  * document the ABI.
649  */
650 struct ib_uverbs_sge {
651 	__u64 addr;
652 	__u32 length;
653 	__u32 lkey;
654 };
655 
656 struct ib_uverbs_send_wr {
657 	__u64 wr_id;
658 	__u32 num_sge;
659 	__u32 opcode;
660 	__u32 send_flags;
661 	union {
662 		__u32 imm_data;
663 		__u32 invalidate_rkey;
664 	} ex;
665 	union {
666 		struct {
667 			__u64 remote_addr;
668 			__u32 rkey;
669 			__u32 reserved;
670 		} rdma;
671 		struct {
672 			__u64 remote_addr;
673 			__u64 compare_add;
674 			__u64 swap;
675 			__u32 rkey;
676 			__u32 reserved;
677 		} atomic;
678 		struct {
679 			__u32 ah;
680 			__u32 remote_qpn;
681 			__u32 remote_qkey;
682 			__u32 reserved;
683 		} ud;
684 	} wr;
685 };
686 
687 struct ib_uverbs_post_send {
688 	__u64 response;
689 	__u32 qp_handle;
690 	__u32 wr_count;
691 	__u32 sge_count;
692 	__u32 wqe_size;
693 	struct ib_uverbs_send_wr send_wr[0];
694 };
695 
696 struct ib_uverbs_post_send_resp {
697 	__u32 bad_wr;
698 };
699 
700 struct ib_uverbs_recv_wr {
701 	__u64 wr_id;
702 	__u32 num_sge;
703 	__u32 reserved;
704 };
705 
706 struct ib_uverbs_post_recv {
707 	__u64 response;
708 	__u32 qp_handle;
709 	__u32 wr_count;
710 	__u32 sge_count;
711 	__u32 wqe_size;
712 	struct ib_uverbs_recv_wr recv_wr[0];
713 };
714 
715 struct ib_uverbs_post_recv_resp {
716 	__u32 bad_wr;
717 };
718 
719 struct ib_uverbs_post_srq_recv {
720 	__u64 response;
721 	__u32 srq_handle;
722 	__u32 wr_count;
723 	__u32 sge_count;
724 	__u32 wqe_size;
725 	struct ib_uverbs_recv_wr recv[0];
726 };
727 
728 struct ib_uverbs_post_srq_recv_resp {
729 	__u32 bad_wr;
730 };
731 
732 struct ib_uverbs_create_ah {
733 	__u64 response;
734 	__u64 user_handle;
735 	__u32 pd_handle;
736 	__u32 reserved;
737 	struct ib_uverbs_ah_attr attr;
738 };
739 
740 struct ib_uverbs_create_ah_resp {
741 	__u32 ah_handle;
742 };
743 
744 struct ib_uverbs_destroy_ah {
745 	__u32 ah_handle;
746 };
747 
748 struct ib_uverbs_attach_mcast {
749 	__u8  gid[16];
750 	__u32 qp_handle;
751 	__u16 mlid;
752 	__u16 reserved;
753 	__u64 driver_data[0];
754 };
755 
756 struct ib_uverbs_detach_mcast {
757 	__u8  gid[16];
758 	__u32 qp_handle;
759 	__u16 mlid;
760 	__u16 reserved;
761 	__u64 driver_data[0];
762 };
763 
764 struct ib_uverbs_flow_spec_hdr {
765 	__u32 type;
766 	__u16 size;
767 	__u16 reserved;
768 	/* followed by flow_spec */
769 	__u64 flow_spec_data[0];
770 };
771 
772 struct ib_uverbs_flow_eth_filter {
773 	__u8  dst_mac[6];
774 	__u8  src_mac[6];
775 	__be16 ether_type;
776 	__be16 vlan_tag;
777 };
778 
779 struct ib_uverbs_flow_spec_eth {
780 	union {
781 		struct ib_uverbs_flow_spec_hdr hdr;
782 		struct {
783 			__u32 type;
784 			__u16 size;
785 			__u16 reserved;
786 		};
787 	};
788 	struct ib_uverbs_flow_eth_filter val;
789 	struct ib_uverbs_flow_eth_filter mask;
790 };
791 
792 struct ib_uverbs_flow_ipv4_filter {
793 	__be32 src_ip;
794 	__be32 dst_ip;
795 };
796 
797 struct ib_uverbs_flow_spec_ipv4 {
798 	union {
799 		struct ib_uverbs_flow_spec_hdr hdr;
800 		struct {
801 			__u32 type;
802 			__u16 size;
803 			__u16 reserved;
804 		};
805 	};
806 	struct ib_uverbs_flow_ipv4_filter val;
807 	struct ib_uverbs_flow_ipv4_filter mask;
808 };
809 
810 struct ib_uverbs_flow_tcp_udp_filter {
811 	__be16 dst_port;
812 	__be16 src_port;
813 };
814 
815 struct ib_uverbs_flow_spec_tcp_udp {
816 	union {
817 		struct ib_uverbs_flow_spec_hdr hdr;
818 		struct {
819 			__u32 type;
820 			__u16 size;
821 			__u16 reserved;
822 		};
823 	};
824 	struct ib_uverbs_flow_tcp_udp_filter val;
825 	struct ib_uverbs_flow_tcp_udp_filter mask;
826 };
827 
828 struct ib_uverbs_flow_attr {
829 	__u32 type;
830 	__u16 size;
831 	__u16 priority;
832 	__u8  num_of_specs;
833 	__u8  reserved[2];
834 	__u8  port;
835 	__u32 flags;
836 	/* Following are the optional layers according to user request
837 	 * struct ib_flow_spec_xxx
838 	 * struct ib_flow_spec_yyy
839 	 */
840 	struct ib_uverbs_flow_spec_hdr flow_specs[0];
841 };
842 
843 struct ib_uverbs_create_flow  {
844 	__u32 comp_mask;
845 	__u32 qp_handle;
846 	struct ib_uverbs_flow_attr flow_attr;
847 };
848 
849 struct ib_uverbs_create_flow_resp {
850 	__u32 comp_mask;
851 	__u32 flow_handle;
852 };
853 
854 struct ib_uverbs_destroy_flow  {
855 	__u32 comp_mask;
856 	__u32 flow_handle;
857 };
858 
859 struct ib_uverbs_create_srq {
860 	__u64 response;
861 	__u64 user_handle;
862 	__u32 pd_handle;
863 	__u32 max_wr;
864 	__u32 max_sge;
865 	__u32 srq_limit;
866 	__u64 driver_data[0];
867 };
868 
869 struct ib_uverbs_create_xsrq {
870 	__u64 response;
871 	__u64 user_handle;
872 	__u32 srq_type;
873 	__u32 pd_handle;
874 	__u32 max_wr;
875 	__u32 max_sge;
876 	__u32 srq_limit;
877 	__u32 reserved;
878 	__u32 xrcd_handle;
879 	__u32 cq_handle;
880 	__u64 driver_data[0];
881 };
882 
883 struct ib_uverbs_create_srq_resp {
884 	__u32 srq_handle;
885 	__u32 max_wr;
886 	__u32 max_sge;
887 	__u32 srqn;
888 };
889 
890 struct ib_uverbs_modify_srq {
891 	__u32 srq_handle;
892 	__u32 attr_mask;
893 	__u32 max_wr;
894 	__u32 srq_limit;
895 	__u64 driver_data[0];
896 };
897 
898 struct ib_uverbs_query_srq {
899 	__u64 response;
900 	__u32 srq_handle;
901 	__u32 reserved;
902 	__u64 driver_data[0];
903 };
904 
905 struct ib_uverbs_query_srq_resp {
906 	__u32 max_wr;
907 	__u32 max_sge;
908 	__u32 srq_limit;
909 	__u32 reserved;
910 };
911 
912 struct ib_uverbs_destroy_srq {
913 	__u64 response;
914 	__u32 srq_handle;
915 	__u32 reserved;
916 };
917 
918 struct ib_uverbs_destroy_srq_resp {
919 	__u32 events_reported;
920 };
921 
922 #endif /* IB_USER_VERBS_H */
923