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,
93 IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
94 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
95 IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
99 * Make sure that all structs defined in this file remain laid out so
100 * that they pack the same way on 32-bit and 64-bit architectures (to
101 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
103 * - Do not use pointer types -- pass pointers in __u64 instead.
104 * - Make sure that any structure larger than 4 bytes is padded to a
105 * multiple of 8 bytes. Otherwise the structure size will be
106 * different between 32-bit and 64-bit architectures.
109 struct ib_uverbs_async_event_desc {
111 __u32 event_type; /* enum ib_event_type */
115 struct ib_uverbs_comp_event_desc {
120 * All commands from userspace should start with a __u32 command field
121 * followed by __u16 in_words and out_words fields (which give the
122 * length of the command block and response buffer if any in 32-bit
123 * words). The kernel driver will read these fields first and read
124 * the rest of the command struct based on these value.
127 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
128 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
129 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
131 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
133 struct ib_uverbs_cmd_hdr {
139 struct ib_uverbs_ex_cmd_hdr {
141 __u16 provider_in_words;
142 __u16 provider_out_words;
143 __u32 cmd_hdr_reserved;
146 struct ib_uverbs_get_context {
148 __u64 driver_data[0];
151 struct ib_uverbs_get_context_resp {
153 __u32 num_comp_vectors;
156 struct ib_uverbs_query_device {
158 __u64 driver_data[0];
161 struct ib_uverbs_query_device_resp {
164 __be64 sys_image_guid;
168 __u32 vendor_part_id;
172 __u32 device_cap_flags;
179 __u32 max_qp_rd_atom;
180 __u32 max_ee_rd_atom;
181 __u32 max_res_rd_atom;
182 __u32 max_qp_init_rd_atom;
183 __u32 max_ee_init_rd_atom;
188 __u32 max_raw_ipv6_qp;
189 __u32 max_raw_ethy_qp;
191 __u32 max_mcast_qp_attach;
192 __u32 max_total_mcast_qp_attach;
195 __u32 max_map_per_fmr;
200 __u8 local_ca_ack_delay;
206 IB_USER_VERBS_EX_QUERY_DEVICE_ODP = 1ULL << 0,
209 struct ib_uverbs_ex_query_device {
214 struct ib_uverbs_odp_caps {
220 } per_transport_caps;
224 struct ib_uverbs_ex_query_device_resp {
225 struct ib_uverbs_query_device_resp base;
228 struct ib_uverbs_odp_caps odp_caps;
231 struct ib_uverbs_query_port {
235 __u64 driver_data[0];
238 struct ib_uverbs_query_port_resp {
239 __u32 port_cap_flags;
242 __u32 qkey_viol_cntr;
254 __u8 init_type_reply;
262 struct ib_uverbs_alloc_pd {
264 __u64 driver_data[0];
267 struct ib_uverbs_alloc_pd_resp {
271 struct ib_uverbs_dealloc_pd {
275 struct ib_uverbs_open_xrcd {
279 __u64 driver_data[0];
282 struct ib_uverbs_open_xrcd_resp {
286 struct ib_uverbs_close_xrcd {
290 struct ib_uverbs_reg_mr {
297 __u64 driver_data[0];
300 struct ib_uverbs_reg_mr_resp {
306 struct ib_uverbs_rereg_mr {
317 struct ib_uverbs_rereg_mr_resp {
322 struct ib_uverbs_dereg_mr {
326 struct ib_uverbs_alloc_mw {
333 struct ib_uverbs_alloc_mw_resp {
338 struct ib_uverbs_dealloc_mw {
342 struct ib_uverbs_create_comp_channel {
346 struct ib_uverbs_create_comp_channel_resp {
350 struct ib_uverbs_create_cq {
357 __u64 driver_data[0];
360 struct ib_uverbs_create_cq_resp {
365 struct ib_uverbs_resize_cq {
369 __u64 driver_data[0];
372 struct ib_uverbs_resize_cq_resp {
375 __u64 driver_data[0];
378 struct ib_uverbs_poll_cq {
384 struct ib_uverbs_wc {
392 __u32 invalidate_rkey;
405 struct ib_uverbs_poll_cq_resp {
408 struct ib_uverbs_wc wc[0];
411 struct ib_uverbs_req_notify_cq {
413 __u32 solicited_only;
416 struct ib_uverbs_destroy_cq {
422 struct ib_uverbs_destroy_cq_resp {
423 __u32 comp_events_reported;
424 __u32 async_events_reported;
427 struct ib_uverbs_global_route {
436 struct ib_uverbs_ah_attr {
437 struct ib_uverbs_global_route grh;
447 struct ib_uverbs_qp_attr {
452 __u32 path_mig_state;
457 __u32 qp_access_flags;
459 struct ib_uverbs_ah_attr ah_attr;
460 struct ib_uverbs_ah_attr alt_ah_attr;
467 __u32 max_inline_data;
470 __u16 alt_pkey_index;
471 __u8 en_sqd_async_notify;
474 __u8 max_dest_rd_atomic;
485 struct ib_uverbs_create_qp {
489 __u32 send_cq_handle;
490 __u32 recv_cq_handle;
496 __u32 max_inline_data;
501 __u64 driver_data[0];
504 struct ib_uverbs_open_qp {
511 __u64 driver_data[0];
514 /* also used for open response */
515 struct ib_uverbs_create_qp_resp {
522 __u32 max_inline_data;
527 * This struct needs to remain a multiple of 8 bytes to keep the
528 * alignment of the modify QP parameters.
530 struct ib_uverbs_qp_dest {
545 struct ib_uverbs_query_qp {
549 __u64 driver_data[0];
552 struct ib_uverbs_query_qp_resp {
553 struct ib_uverbs_qp_dest dest;
554 struct ib_uverbs_qp_dest alt_dest;
559 __u32 max_inline_data;
564 __u32 qp_access_flags;
566 __u16 alt_pkey_index;
573 __u8 max_dest_rd_atomic;
583 __u64 driver_data[0];
586 struct ib_uverbs_modify_qp {
587 struct ib_uverbs_qp_dest dest;
588 struct ib_uverbs_qp_dest alt_dest;
595 __u32 qp_access_flags;
597 __u16 alt_pkey_index;
602 __u8 en_sqd_async_notify;
604 __u8 max_dest_rd_atomic;
613 __u64 driver_data[0];
616 struct ib_uverbs_modify_qp_resp {
619 struct ib_uverbs_destroy_qp {
625 struct ib_uverbs_destroy_qp_resp {
626 __u32 events_reported;
630 * The ib_uverbs_sge structure isn't used anywhere, since we assume
631 * the ib_sge structure is packed the same way on 32-bit and 64-bit
632 * architectures in both kernel and user space. It's just here to
635 struct ib_uverbs_sge {
641 struct ib_uverbs_send_wr {
648 __u32 invalidate_rkey;
672 struct ib_uverbs_post_send {
678 struct ib_uverbs_send_wr send_wr[0];
681 struct ib_uverbs_post_send_resp {
685 struct ib_uverbs_recv_wr {
691 struct ib_uverbs_post_recv {
697 struct ib_uverbs_recv_wr recv_wr[0];
700 struct ib_uverbs_post_recv_resp {
704 struct ib_uverbs_post_srq_recv {
710 struct ib_uverbs_recv_wr recv[0];
713 struct ib_uverbs_post_srq_recv_resp {
717 struct ib_uverbs_create_ah {
722 struct ib_uverbs_ah_attr attr;
725 struct ib_uverbs_create_ah_resp {
729 struct ib_uverbs_destroy_ah {
733 struct ib_uverbs_attach_mcast {
738 __u64 driver_data[0];
741 struct ib_uverbs_detach_mcast {
746 __u64 driver_data[0];
749 struct ib_uverbs_flow_spec_hdr {
753 /* followed by flow_spec */
754 __u64 flow_spec_data[0];
757 struct ib_uverbs_flow_eth_filter {
764 struct ib_uverbs_flow_spec_eth {
766 struct ib_uverbs_flow_spec_hdr hdr;
773 struct ib_uverbs_flow_eth_filter val;
774 struct ib_uverbs_flow_eth_filter mask;
777 struct ib_uverbs_flow_ipv4_filter {
782 struct ib_uverbs_flow_spec_ipv4 {
784 struct ib_uverbs_flow_spec_hdr hdr;
791 struct ib_uverbs_flow_ipv4_filter val;
792 struct ib_uverbs_flow_ipv4_filter mask;
795 struct ib_uverbs_flow_tcp_udp_filter {
800 struct ib_uverbs_flow_spec_tcp_udp {
802 struct ib_uverbs_flow_spec_hdr hdr;
809 struct ib_uverbs_flow_tcp_udp_filter val;
810 struct ib_uverbs_flow_tcp_udp_filter mask;
813 struct ib_uverbs_flow_attr {
821 /* Following are the optional layers according to user request
822 * struct ib_flow_spec_xxx
823 * struct ib_flow_spec_yyy
825 struct ib_uverbs_flow_spec_hdr flow_specs[0];
828 struct ib_uverbs_create_flow {
831 struct ib_uverbs_flow_attr flow_attr;
834 struct ib_uverbs_create_flow_resp {
839 struct ib_uverbs_destroy_flow {
844 struct ib_uverbs_create_srq {
851 __u64 driver_data[0];
854 struct ib_uverbs_create_xsrq {
865 __u64 driver_data[0];
868 struct ib_uverbs_create_srq_resp {
875 struct ib_uverbs_modify_srq {
880 __u64 driver_data[0];
883 struct ib_uverbs_query_srq {
887 __u64 driver_data[0];
890 struct ib_uverbs_query_srq_resp {
897 struct ib_uverbs_destroy_srq {
903 struct ib_uverbs_destroy_srq_resp {
904 __u32 events_reported;
907 #endif /* IB_USER_VERBS_H */