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