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.
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:
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
17 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
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.
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
36 #ifndef IB_USER_VERBS_H
37 #define IB_USER_VERBS_H
39 #include <linux/types.h>
42 * Increment this value if any changes that break userspace ABI
43 * compatibility are made.
45 #define IB_USER_VERBS_ABI_VERSION 6
46 #define IB_USER_VERBS_CMD_THRESHOLD 50
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 IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
91 IB_USER_VERBS_CMD_DESTROY_FLOW
95 * Make sure that all structs defined in this file remain laid out so
96 * that they pack the same way on 32-bit and 64-bit architectures (to
97 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
99 * - Do not use pointer types -- pass pointers in __u64 instead.
100 * - Make sure that any structure larger than 4 bytes is padded to a
101 * multiple of 8 bytes. Otherwise the structure size will be
102 * different between 32-bit and 64-bit architectures.
105 struct ib_uverbs_async_event_desc {
107 __u32 event_type; /* enum ib_event_type */
111 struct ib_uverbs_comp_event_desc {
116 * All commands from userspace should start with a __u32 command field
117 * followed by __u16 in_words and out_words fields (which give the
118 * length of the command block and response buffer if any in 32-bit
119 * words). The kernel driver will read these fields first and read
120 * the rest of the command struct based on these value.
123 struct ib_uverbs_cmd_hdr {
129 struct ib_uverbs_cmd_hdr_ex {
133 __u16 provider_in_words;
134 __u16 provider_out_words;
135 __u32 cmd_hdr_reserved;
138 struct ib_uverbs_get_context {
140 __u64 driver_data[0];
143 struct ib_uverbs_get_context_resp {
145 __u32 num_comp_vectors;
148 struct ib_uverbs_query_device {
150 __u64 driver_data[0];
153 struct ib_uverbs_query_device_resp {
156 __be64 sys_image_guid;
160 __u32 vendor_part_id;
164 __u32 device_cap_flags;
171 __u32 max_qp_rd_atom;
172 __u32 max_ee_rd_atom;
173 __u32 max_res_rd_atom;
174 __u32 max_qp_init_rd_atom;
175 __u32 max_ee_init_rd_atom;
180 __u32 max_raw_ipv6_qp;
181 __u32 max_raw_ethy_qp;
183 __u32 max_mcast_qp_attach;
184 __u32 max_total_mcast_qp_attach;
187 __u32 max_map_per_fmr;
192 __u8 local_ca_ack_delay;
197 struct ib_uverbs_query_port {
201 __u64 driver_data[0];
204 struct ib_uverbs_query_port_resp {
205 __u32 port_cap_flags;
208 __u32 qkey_viol_cntr;
220 __u8 init_type_reply;
228 struct ib_uverbs_alloc_pd {
230 __u64 driver_data[0];
233 struct ib_uverbs_alloc_pd_resp {
237 struct ib_uverbs_dealloc_pd {
241 struct ib_uverbs_open_xrcd {
245 __u64 driver_data[0];
248 struct ib_uverbs_open_xrcd_resp {
252 struct ib_uverbs_close_xrcd {
256 struct ib_uverbs_reg_mr {
263 __u64 driver_data[0];
266 struct ib_uverbs_reg_mr_resp {
272 struct ib_uverbs_dereg_mr {
276 struct ib_uverbs_alloc_mw {
283 struct ib_uverbs_alloc_mw_resp {
288 struct ib_uverbs_dealloc_mw {
292 struct ib_uverbs_create_comp_channel {
296 struct ib_uverbs_create_comp_channel_resp {
300 struct ib_uverbs_create_cq {
307 __u64 driver_data[0];
310 struct ib_uverbs_create_cq_resp {
315 struct ib_uverbs_resize_cq {
319 __u64 driver_data[0];
322 struct ib_uverbs_resize_cq_resp {
325 __u64 driver_data[0];
328 struct ib_uverbs_poll_cq {
334 struct ib_uverbs_wc {
342 __u32 invalidate_rkey;
355 struct ib_uverbs_poll_cq_resp {
358 struct ib_uverbs_wc wc[0];
361 struct ib_uverbs_req_notify_cq {
363 __u32 solicited_only;
366 struct ib_uverbs_destroy_cq {
372 struct ib_uverbs_destroy_cq_resp {
373 __u32 comp_events_reported;
374 __u32 async_events_reported;
377 struct ib_uverbs_global_route {
386 struct ib_uverbs_ah_attr {
387 struct ib_uverbs_global_route grh;
397 struct ib_uverbs_qp_attr {
402 __u32 path_mig_state;
407 __u32 qp_access_flags;
409 struct ib_uverbs_ah_attr ah_attr;
410 struct ib_uverbs_ah_attr alt_ah_attr;
417 __u32 max_inline_data;
420 __u16 alt_pkey_index;
421 __u8 en_sqd_async_notify;
424 __u8 max_dest_rd_atomic;
435 struct ib_uverbs_create_qp {
439 __u32 send_cq_handle;
440 __u32 recv_cq_handle;
446 __u32 max_inline_data;
451 __u64 driver_data[0];
454 struct ib_uverbs_open_qp {
461 __u64 driver_data[0];
464 /* also used for open response */
465 struct ib_uverbs_create_qp_resp {
472 __u32 max_inline_data;
477 * This struct needs to remain a multiple of 8 bytes to keep the
478 * alignment of the modify QP parameters.
480 struct ib_uverbs_qp_dest {
495 struct ib_uverbs_query_qp {
499 __u64 driver_data[0];
502 struct ib_uverbs_query_qp_resp {
503 struct ib_uverbs_qp_dest dest;
504 struct ib_uverbs_qp_dest alt_dest;
509 __u32 max_inline_data;
514 __u32 qp_access_flags;
516 __u16 alt_pkey_index;
523 __u8 max_dest_rd_atomic;
533 __u64 driver_data[0];
536 struct ib_uverbs_modify_qp {
537 struct ib_uverbs_qp_dest dest;
538 struct ib_uverbs_qp_dest alt_dest;
545 __u32 qp_access_flags;
547 __u16 alt_pkey_index;
552 __u8 en_sqd_async_notify;
554 __u8 max_dest_rd_atomic;
563 __u64 driver_data[0];
566 struct ib_uverbs_modify_qp_resp {
569 struct ib_uverbs_destroy_qp {
575 struct ib_uverbs_destroy_qp_resp {
576 __u32 events_reported;
580 * The ib_uverbs_sge structure isn't used anywhere, since we assume
581 * the ib_sge structure is packed the same way on 32-bit and 64-bit
582 * architectures in both kernel and user space. It's just here to
585 struct ib_uverbs_sge {
591 struct ib_uverbs_send_wr {
598 __u32 invalidate_rkey;
622 struct ib_uverbs_post_send {
628 struct ib_uverbs_send_wr send_wr[0];
631 struct ib_uverbs_post_send_resp {
635 struct ib_uverbs_recv_wr {
641 struct ib_uverbs_post_recv {
647 struct ib_uverbs_recv_wr recv_wr[0];
650 struct ib_uverbs_post_recv_resp {
654 struct ib_uverbs_post_srq_recv {
660 struct ib_uverbs_recv_wr recv[0];
663 struct ib_uverbs_post_srq_recv_resp {
667 struct ib_uverbs_create_ah {
672 struct ib_uverbs_ah_attr attr;
675 struct ib_uverbs_create_ah_resp {
679 struct ib_uverbs_destroy_ah {
683 struct ib_uverbs_attach_mcast {
688 __u64 driver_data[0];
691 struct ib_uverbs_detach_mcast {
696 __u64 driver_data[0];
699 struct ib_kern_eth_filter {
706 struct ib_kern_spec_eth {
710 struct ib_kern_eth_filter val;
711 struct ib_kern_eth_filter mask;
714 struct ib_kern_ipv4_filter {
719 struct ib_kern_spec_ipv4 {
723 struct ib_kern_ipv4_filter val;
724 struct ib_kern_ipv4_filter mask;
727 struct ib_kern_tcp_udp_filter {
732 struct ib_kern_spec_tcp_udp {
736 struct ib_kern_tcp_udp_filter val;
737 struct ib_kern_tcp_udp_filter mask;
740 struct ib_kern_spec {
747 struct ib_kern_spec_eth eth;
748 struct ib_kern_spec_ipv4 ipv4;
749 struct ib_kern_spec_tcp_udp tcp_udp;
753 struct ib_kern_flow_attr {
761 /* Following are the optional layers according to user request
762 * struct ib_flow_spec_xxx
763 * struct ib_flow_spec_yyy
767 struct ib_uverbs_create_flow {
771 struct ib_kern_flow_attr flow_attr;
774 struct ib_uverbs_create_flow_resp {
779 struct ib_uverbs_destroy_flow {
784 struct ib_uverbs_create_srq {
791 __u64 driver_data[0];
794 struct ib_uverbs_create_xsrq {
805 __u64 driver_data[0];
808 struct ib_uverbs_create_srq_resp {
815 struct ib_uverbs_modify_srq {
820 __u64 driver_data[0];
823 struct ib_uverbs_query_srq {
827 __u64 driver_data[0];
830 struct ib_uverbs_query_srq_resp {
837 struct ib_uverbs_destroy_srq {
843 struct ib_uverbs_destroy_srq_resp {
844 __u32 events_reported;
847 #endif /* IB_USER_VERBS_H */