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 };
230 
231 struct ib_uverbs_query_port {
232 	__u64 response;
233 	__u8  port_num;
234 	__u8  reserved[7];
235 	__u64 driver_data[0];
236 };
237 
238 struct ib_uverbs_query_port_resp {
239 	__u32 port_cap_flags;
240 	__u32 max_msg_sz;
241 	__u32 bad_pkey_cntr;
242 	__u32 qkey_viol_cntr;
243 	__u32 gid_tbl_len;
244 	__u16 pkey_tbl_len;
245 	__u16 lid;
246 	__u16 sm_lid;
247 	__u8  state;
248 	__u8  max_mtu;
249 	__u8  active_mtu;
250 	__u8  lmc;
251 	__u8  max_vl_num;
252 	__u8  sm_sl;
253 	__u8  subnet_timeout;
254 	__u8  init_type_reply;
255 	__u8  active_width;
256 	__u8  active_speed;
257 	__u8  phys_state;
258 	__u8  link_layer;
259 	__u8  reserved[2];
260 };
261 
262 struct ib_uverbs_alloc_pd {
263 	__u64 response;
264 	__u64 driver_data[0];
265 };
266 
267 struct ib_uverbs_alloc_pd_resp {
268 	__u32 pd_handle;
269 };
270 
271 struct ib_uverbs_dealloc_pd {
272 	__u32 pd_handle;
273 };
274 
275 struct ib_uverbs_open_xrcd {
276 	__u64 response;
277 	__u32 fd;
278 	__u32 oflags;
279 	__u64 driver_data[0];
280 };
281 
282 struct ib_uverbs_open_xrcd_resp {
283 	__u32 xrcd_handle;
284 };
285 
286 struct ib_uverbs_close_xrcd {
287 	__u32 xrcd_handle;
288 };
289 
290 struct ib_uverbs_reg_mr {
291 	__u64 response;
292 	__u64 start;
293 	__u64 length;
294 	__u64 hca_va;
295 	__u32 pd_handle;
296 	__u32 access_flags;
297 	__u64 driver_data[0];
298 };
299 
300 struct ib_uverbs_reg_mr_resp {
301 	__u32 mr_handle;
302 	__u32 lkey;
303 	__u32 rkey;
304 };
305 
306 struct ib_uverbs_rereg_mr {
307 	__u64 response;
308 	__u32 mr_handle;
309 	__u32 flags;
310 	__u64 start;
311 	__u64 length;
312 	__u64 hca_va;
313 	__u32 pd_handle;
314 	__u32 access_flags;
315 };
316 
317 struct ib_uverbs_rereg_mr_resp {
318 	__u32 lkey;
319 	__u32 rkey;
320 };
321 
322 struct ib_uverbs_dereg_mr {
323 	__u32 mr_handle;
324 };
325 
326 struct ib_uverbs_alloc_mw {
327 	__u64 response;
328 	__u32 pd_handle;
329 	__u8  mw_type;
330 	__u8  reserved[3];
331 };
332 
333 struct ib_uverbs_alloc_mw_resp {
334 	__u32 mw_handle;
335 	__u32 rkey;
336 };
337 
338 struct ib_uverbs_dealloc_mw {
339 	__u32 mw_handle;
340 };
341 
342 struct ib_uverbs_create_comp_channel {
343 	__u64 response;
344 };
345 
346 struct ib_uverbs_create_comp_channel_resp {
347 	__u32 fd;
348 };
349 
350 struct ib_uverbs_create_cq {
351 	__u64 response;
352 	__u64 user_handle;
353 	__u32 cqe;
354 	__u32 comp_vector;
355 	__s32 comp_channel;
356 	__u32 reserved;
357 	__u64 driver_data[0];
358 };
359 
360 struct ib_uverbs_ex_create_cq {
361 	__u64 user_handle;
362 	__u32 cqe;
363 	__u32 comp_vector;
364 	__s32 comp_channel;
365 	__u32 comp_mask;
366 	__u32 flags;
367 	__u32 reserved;
368 };
369 
370 struct ib_uverbs_create_cq_resp {
371 	__u32 cq_handle;
372 	__u32 cqe;
373 };
374 
375 struct ib_uverbs_ex_create_cq_resp {
376 	struct ib_uverbs_create_cq_resp base;
377 	__u32 comp_mask;
378 	__u32 response_length;
379 };
380 
381 struct ib_uverbs_resize_cq {
382 	__u64 response;
383 	__u32 cq_handle;
384 	__u32 cqe;
385 	__u64 driver_data[0];
386 };
387 
388 struct ib_uverbs_resize_cq_resp {
389 	__u32 cqe;
390 	__u32 reserved;
391 	__u64 driver_data[0];
392 };
393 
394 struct ib_uverbs_poll_cq {
395 	__u64 response;
396 	__u32 cq_handle;
397 	__u32 ne;
398 };
399 
400 struct ib_uverbs_wc {
401 	__u64 wr_id;
402 	__u32 status;
403 	__u32 opcode;
404 	__u32 vendor_err;
405 	__u32 byte_len;
406 	union {
407 		__u32 imm_data;
408 		__u32 invalidate_rkey;
409 	} ex;
410 	__u32 qp_num;
411 	__u32 src_qp;
412 	__u32 wc_flags;
413 	__u16 pkey_index;
414 	__u16 slid;
415 	__u8 sl;
416 	__u8 dlid_path_bits;
417 	__u8 port_num;
418 	__u8 reserved;
419 };
420 
421 struct ib_uverbs_poll_cq_resp {
422 	__u32 count;
423 	__u32 reserved;
424 	struct ib_uverbs_wc wc[0];
425 };
426 
427 struct ib_uverbs_req_notify_cq {
428 	__u32 cq_handle;
429 	__u32 solicited_only;
430 };
431 
432 struct ib_uverbs_destroy_cq {
433 	__u64 response;
434 	__u32 cq_handle;
435 	__u32 reserved;
436 };
437 
438 struct ib_uverbs_destroy_cq_resp {
439 	__u32 comp_events_reported;
440 	__u32 async_events_reported;
441 };
442 
443 struct ib_uverbs_global_route {
444 	__u8  dgid[16];
445 	__u32 flow_label;
446 	__u8  sgid_index;
447 	__u8  hop_limit;
448 	__u8  traffic_class;
449 	__u8  reserved;
450 };
451 
452 struct ib_uverbs_ah_attr {
453 	struct ib_uverbs_global_route grh;
454 	__u16 dlid;
455 	__u8  sl;
456 	__u8  src_path_bits;
457 	__u8  static_rate;
458 	__u8  is_global;
459 	__u8  port_num;
460 	__u8  reserved;
461 };
462 
463 struct ib_uverbs_qp_attr {
464 	__u32	qp_attr_mask;
465 	__u32	qp_state;
466 	__u32	cur_qp_state;
467 	__u32	path_mtu;
468 	__u32	path_mig_state;
469 	__u32	qkey;
470 	__u32	rq_psn;
471 	__u32	sq_psn;
472 	__u32	dest_qp_num;
473 	__u32	qp_access_flags;
474 
475 	struct ib_uverbs_ah_attr ah_attr;
476 	struct ib_uverbs_ah_attr alt_ah_attr;
477 
478 	/* ib_qp_cap */
479 	__u32	max_send_wr;
480 	__u32	max_recv_wr;
481 	__u32	max_send_sge;
482 	__u32	max_recv_sge;
483 	__u32	max_inline_data;
484 
485 	__u16	pkey_index;
486 	__u16	alt_pkey_index;
487 	__u8	en_sqd_async_notify;
488 	__u8	sq_draining;
489 	__u8	max_rd_atomic;
490 	__u8	max_dest_rd_atomic;
491 	__u8	min_rnr_timer;
492 	__u8	port_num;
493 	__u8	timeout;
494 	__u8	retry_cnt;
495 	__u8	rnr_retry;
496 	__u8	alt_port_num;
497 	__u8	alt_timeout;
498 	__u8	reserved[5];
499 };
500 
501 struct ib_uverbs_create_qp {
502 	__u64 response;
503 	__u64 user_handle;
504 	__u32 pd_handle;
505 	__u32 send_cq_handle;
506 	__u32 recv_cq_handle;
507 	__u32 srq_handle;
508 	__u32 max_send_wr;
509 	__u32 max_recv_wr;
510 	__u32 max_send_sge;
511 	__u32 max_recv_sge;
512 	__u32 max_inline_data;
513 	__u8  sq_sig_all;
514 	__u8  qp_type;
515 	__u8  is_srq;
516 	__u8  reserved;
517 	__u64 driver_data[0];
518 };
519 
520 struct ib_uverbs_ex_create_qp {
521 	__u64 user_handle;
522 	__u32 pd_handle;
523 	__u32 send_cq_handle;
524 	__u32 recv_cq_handle;
525 	__u32 srq_handle;
526 	__u32 max_send_wr;
527 	__u32 max_recv_wr;
528 	__u32 max_send_sge;
529 	__u32 max_recv_sge;
530 	__u32 max_inline_data;
531 	__u8  sq_sig_all;
532 	__u8  qp_type;
533 	__u8  is_srq;
534 	__u8 reserved;
535 	__u32 comp_mask;
536 	__u32 create_flags;
537 };
538 
539 struct ib_uverbs_open_qp {
540 	__u64 response;
541 	__u64 user_handle;
542 	__u32 pd_handle;
543 	__u32 qpn;
544 	__u8  qp_type;
545 	__u8  reserved[7];
546 	__u64 driver_data[0];
547 };
548 
549 /* also used for open response */
550 struct ib_uverbs_create_qp_resp {
551 	__u32 qp_handle;
552 	__u32 qpn;
553 	__u32 max_send_wr;
554 	__u32 max_recv_wr;
555 	__u32 max_send_sge;
556 	__u32 max_recv_sge;
557 	__u32 max_inline_data;
558 	__u32 reserved;
559 };
560 
561 struct ib_uverbs_ex_create_qp_resp {
562 	struct ib_uverbs_create_qp_resp base;
563 	__u32 comp_mask;
564 	__u32 response_length;
565 };
566 
567 /*
568  * This struct needs to remain a multiple of 8 bytes to keep the
569  * alignment of the modify QP parameters.
570  */
571 struct ib_uverbs_qp_dest {
572 	__u8  dgid[16];
573 	__u32 flow_label;
574 	__u16 dlid;
575 	__u16 reserved;
576 	__u8  sgid_index;
577 	__u8  hop_limit;
578 	__u8  traffic_class;
579 	__u8  sl;
580 	__u8  src_path_bits;
581 	__u8  static_rate;
582 	__u8  is_global;
583 	__u8  port_num;
584 };
585 
586 struct ib_uverbs_query_qp {
587 	__u64 response;
588 	__u32 qp_handle;
589 	__u32 attr_mask;
590 	__u64 driver_data[0];
591 };
592 
593 struct ib_uverbs_query_qp_resp {
594 	struct ib_uverbs_qp_dest dest;
595 	struct ib_uverbs_qp_dest alt_dest;
596 	__u32 max_send_wr;
597 	__u32 max_recv_wr;
598 	__u32 max_send_sge;
599 	__u32 max_recv_sge;
600 	__u32 max_inline_data;
601 	__u32 qkey;
602 	__u32 rq_psn;
603 	__u32 sq_psn;
604 	__u32 dest_qp_num;
605 	__u32 qp_access_flags;
606 	__u16 pkey_index;
607 	__u16 alt_pkey_index;
608 	__u8  qp_state;
609 	__u8  cur_qp_state;
610 	__u8  path_mtu;
611 	__u8  path_mig_state;
612 	__u8  sq_draining;
613 	__u8  max_rd_atomic;
614 	__u8  max_dest_rd_atomic;
615 	__u8  min_rnr_timer;
616 	__u8  port_num;
617 	__u8  timeout;
618 	__u8  retry_cnt;
619 	__u8  rnr_retry;
620 	__u8  alt_port_num;
621 	__u8  alt_timeout;
622 	__u8  sq_sig_all;
623 	__u8  reserved[5];
624 	__u64 driver_data[0];
625 };
626 
627 struct ib_uverbs_modify_qp {
628 	struct ib_uverbs_qp_dest dest;
629 	struct ib_uverbs_qp_dest alt_dest;
630 	__u32 qp_handle;
631 	__u32 attr_mask;
632 	__u32 qkey;
633 	__u32 rq_psn;
634 	__u32 sq_psn;
635 	__u32 dest_qp_num;
636 	__u32 qp_access_flags;
637 	__u16 pkey_index;
638 	__u16 alt_pkey_index;
639 	__u8  qp_state;
640 	__u8  cur_qp_state;
641 	__u8  path_mtu;
642 	__u8  path_mig_state;
643 	__u8  en_sqd_async_notify;
644 	__u8  max_rd_atomic;
645 	__u8  max_dest_rd_atomic;
646 	__u8  min_rnr_timer;
647 	__u8  port_num;
648 	__u8  timeout;
649 	__u8  retry_cnt;
650 	__u8  rnr_retry;
651 	__u8  alt_port_num;
652 	__u8  alt_timeout;
653 	__u8  reserved[2];
654 	__u64 driver_data[0];
655 };
656 
657 struct ib_uverbs_modify_qp_resp {
658 };
659 
660 struct ib_uverbs_destroy_qp {
661 	__u64 response;
662 	__u32 qp_handle;
663 	__u32 reserved;
664 };
665 
666 struct ib_uverbs_destroy_qp_resp {
667 	__u32 events_reported;
668 };
669 
670 /*
671  * The ib_uverbs_sge structure isn't used anywhere, since we assume
672  * the ib_sge structure is packed the same way on 32-bit and 64-bit
673  * architectures in both kernel and user space.  It's just here to
674  * document the ABI.
675  */
676 struct ib_uverbs_sge {
677 	__u64 addr;
678 	__u32 length;
679 	__u32 lkey;
680 };
681 
682 struct ib_uverbs_send_wr {
683 	__u64 wr_id;
684 	__u32 num_sge;
685 	__u32 opcode;
686 	__u32 send_flags;
687 	union {
688 		__u32 imm_data;
689 		__u32 invalidate_rkey;
690 	} ex;
691 	union {
692 		struct {
693 			__u64 remote_addr;
694 			__u32 rkey;
695 			__u32 reserved;
696 		} rdma;
697 		struct {
698 			__u64 remote_addr;
699 			__u64 compare_add;
700 			__u64 swap;
701 			__u32 rkey;
702 			__u32 reserved;
703 		} atomic;
704 		struct {
705 			__u32 ah;
706 			__u32 remote_qpn;
707 			__u32 remote_qkey;
708 			__u32 reserved;
709 		} ud;
710 	} wr;
711 };
712 
713 struct ib_uverbs_post_send {
714 	__u64 response;
715 	__u32 qp_handle;
716 	__u32 wr_count;
717 	__u32 sge_count;
718 	__u32 wqe_size;
719 	struct ib_uverbs_send_wr send_wr[0];
720 };
721 
722 struct ib_uverbs_post_send_resp {
723 	__u32 bad_wr;
724 };
725 
726 struct ib_uverbs_recv_wr {
727 	__u64 wr_id;
728 	__u32 num_sge;
729 	__u32 reserved;
730 };
731 
732 struct ib_uverbs_post_recv {
733 	__u64 response;
734 	__u32 qp_handle;
735 	__u32 wr_count;
736 	__u32 sge_count;
737 	__u32 wqe_size;
738 	struct ib_uverbs_recv_wr recv_wr[0];
739 };
740 
741 struct ib_uverbs_post_recv_resp {
742 	__u32 bad_wr;
743 };
744 
745 struct ib_uverbs_post_srq_recv {
746 	__u64 response;
747 	__u32 srq_handle;
748 	__u32 wr_count;
749 	__u32 sge_count;
750 	__u32 wqe_size;
751 	struct ib_uverbs_recv_wr recv[0];
752 };
753 
754 struct ib_uverbs_post_srq_recv_resp {
755 	__u32 bad_wr;
756 };
757 
758 struct ib_uverbs_create_ah {
759 	__u64 response;
760 	__u64 user_handle;
761 	__u32 pd_handle;
762 	__u32 reserved;
763 	struct ib_uverbs_ah_attr attr;
764 };
765 
766 struct ib_uverbs_create_ah_resp {
767 	__u32 ah_handle;
768 };
769 
770 struct ib_uverbs_destroy_ah {
771 	__u32 ah_handle;
772 };
773 
774 struct ib_uverbs_attach_mcast {
775 	__u8  gid[16];
776 	__u32 qp_handle;
777 	__u16 mlid;
778 	__u16 reserved;
779 	__u64 driver_data[0];
780 };
781 
782 struct ib_uverbs_detach_mcast {
783 	__u8  gid[16];
784 	__u32 qp_handle;
785 	__u16 mlid;
786 	__u16 reserved;
787 	__u64 driver_data[0];
788 };
789 
790 struct ib_uverbs_flow_spec_hdr {
791 	__u32 type;
792 	__u16 size;
793 	__u16 reserved;
794 	/* followed by flow_spec */
795 	__u64 flow_spec_data[0];
796 };
797 
798 struct ib_uverbs_flow_eth_filter {
799 	__u8  dst_mac[6];
800 	__u8  src_mac[6];
801 	__be16 ether_type;
802 	__be16 vlan_tag;
803 };
804 
805 struct ib_uverbs_flow_spec_eth {
806 	union {
807 		struct ib_uverbs_flow_spec_hdr hdr;
808 		struct {
809 			__u32 type;
810 			__u16 size;
811 			__u16 reserved;
812 		};
813 	};
814 	struct ib_uverbs_flow_eth_filter val;
815 	struct ib_uverbs_flow_eth_filter mask;
816 };
817 
818 struct ib_uverbs_flow_ipv4_filter {
819 	__be32 src_ip;
820 	__be32 dst_ip;
821 };
822 
823 struct ib_uverbs_flow_spec_ipv4 {
824 	union {
825 		struct ib_uverbs_flow_spec_hdr hdr;
826 		struct {
827 			__u32 type;
828 			__u16 size;
829 			__u16 reserved;
830 		};
831 	};
832 	struct ib_uverbs_flow_ipv4_filter val;
833 	struct ib_uverbs_flow_ipv4_filter mask;
834 };
835 
836 struct ib_uverbs_flow_tcp_udp_filter {
837 	__be16 dst_port;
838 	__be16 src_port;
839 };
840 
841 struct ib_uverbs_flow_spec_tcp_udp {
842 	union {
843 		struct ib_uverbs_flow_spec_hdr hdr;
844 		struct {
845 			__u32 type;
846 			__u16 size;
847 			__u16 reserved;
848 		};
849 	};
850 	struct ib_uverbs_flow_tcp_udp_filter val;
851 	struct ib_uverbs_flow_tcp_udp_filter mask;
852 };
853 
854 struct ib_uverbs_flow_attr {
855 	__u32 type;
856 	__u16 size;
857 	__u16 priority;
858 	__u8  num_of_specs;
859 	__u8  reserved[2];
860 	__u8  port;
861 	__u32 flags;
862 	/* Following are the optional layers according to user request
863 	 * struct ib_flow_spec_xxx
864 	 * struct ib_flow_spec_yyy
865 	 */
866 	struct ib_uverbs_flow_spec_hdr flow_specs[0];
867 };
868 
869 struct ib_uverbs_create_flow  {
870 	__u32 comp_mask;
871 	__u32 qp_handle;
872 	struct ib_uverbs_flow_attr flow_attr;
873 };
874 
875 struct ib_uverbs_create_flow_resp {
876 	__u32 comp_mask;
877 	__u32 flow_handle;
878 };
879 
880 struct ib_uverbs_destroy_flow  {
881 	__u32 comp_mask;
882 	__u32 flow_handle;
883 };
884 
885 struct ib_uverbs_create_srq {
886 	__u64 response;
887 	__u64 user_handle;
888 	__u32 pd_handle;
889 	__u32 max_wr;
890 	__u32 max_sge;
891 	__u32 srq_limit;
892 	__u64 driver_data[0];
893 };
894 
895 struct ib_uverbs_create_xsrq {
896 	__u64 response;
897 	__u64 user_handle;
898 	__u32 srq_type;
899 	__u32 pd_handle;
900 	__u32 max_wr;
901 	__u32 max_sge;
902 	__u32 srq_limit;
903 	__u32 reserved;
904 	__u32 xrcd_handle;
905 	__u32 cq_handle;
906 	__u64 driver_data[0];
907 };
908 
909 struct ib_uverbs_create_srq_resp {
910 	__u32 srq_handle;
911 	__u32 max_wr;
912 	__u32 max_sge;
913 	__u32 srqn;
914 };
915 
916 struct ib_uverbs_modify_srq {
917 	__u32 srq_handle;
918 	__u32 attr_mask;
919 	__u32 max_wr;
920 	__u32 srq_limit;
921 	__u64 driver_data[0];
922 };
923 
924 struct ib_uverbs_query_srq {
925 	__u64 response;
926 	__u32 srq_handle;
927 	__u32 reserved;
928 	__u64 driver_data[0];
929 };
930 
931 struct ib_uverbs_query_srq_resp {
932 	__u32 max_wr;
933 	__u32 max_sge;
934 	__u32 srq_limit;
935 	__u32 reserved;
936 };
937 
938 struct ib_uverbs_destroy_srq {
939 	__u64 response;
940 	__u32 srq_handle;
941 	__u32 reserved;
942 };
943 
944 struct ib_uverbs_destroy_srq_resp {
945 	__u32 events_reported;
946 };
947 
948 #endif /* IB_USER_VERBS_H */
949