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 * To support 6 legacy commands using the old extension style
51 #define IB_USER_VERBS_LEGACY_CMD_FIRST 52
52 #define IB_USER_VERBS_LEGACY_EX_CMD_LAST 56
55 IB_USER_VERBS_CMD_GET_CONTEXT,
56 IB_USER_VERBS_CMD_QUERY_DEVICE,
57 IB_USER_VERBS_CMD_QUERY_PORT,
58 IB_USER_VERBS_CMD_ALLOC_PD,
59 IB_USER_VERBS_CMD_DEALLOC_PD,
60 IB_USER_VERBS_CMD_CREATE_AH,
61 IB_USER_VERBS_CMD_MODIFY_AH,
62 IB_USER_VERBS_CMD_QUERY_AH,
63 IB_USER_VERBS_CMD_DESTROY_AH,
64 IB_USER_VERBS_CMD_REG_MR,
65 IB_USER_VERBS_CMD_REG_SMR,
66 IB_USER_VERBS_CMD_REREG_MR,
67 IB_USER_VERBS_CMD_QUERY_MR,
68 IB_USER_VERBS_CMD_DEREG_MR,
69 IB_USER_VERBS_CMD_ALLOC_MW,
70 IB_USER_VERBS_CMD_BIND_MW,
71 IB_USER_VERBS_CMD_DEALLOC_MW,
72 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
73 IB_USER_VERBS_CMD_CREATE_CQ,
74 IB_USER_VERBS_CMD_RESIZE_CQ,
75 IB_USER_VERBS_CMD_DESTROY_CQ,
76 IB_USER_VERBS_CMD_POLL_CQ,
77 IB_USER_VERBS_CMD_PEEK_CQ,
78 IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
79 IB_USER_VERBS_CMD_CREATE_QP,
80 IB_USER_VERBS_CMD_QUERY_QP,
81 IB_USER_VERBS_CMD_MODIFY_QP,
82 IB_USER_VERBS_CMD_DESTROY_QP,
83 IB_USER_VERBS_CMD_POST_SEND,
84 IB_USER_VERBS_CMD_POST_RECV,
85 IB_USER_VERBS_CMD_ATTACH_MCAST,
86 IB_USER_VERBS_CMD_DETACH_MCAST,
87 IB_USER_VERBS_CMD_CREATE_SRQ,
88 IB_USER_VERBS_CMD_MODIFY_SRQ,
89 IB_USER_VERBS_CMD_QUERY_SRQ,
90 IB_USER_VERBS_CMD_DESTROY_SRQ,
91 IB_USER_VERBS_CMD_POST_SRQ_RECV,
92 IB_USER_VERBS_CMD_OPEN_XRCD,
93 IB_USER_VERBS_CMD_CLOSE_XRCD,
94 IB_USER_VERBS_CMD_CREATE_XSRQ,
95 IB_USER_VERBS_CMD_OPEN_QP
99 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
100 IB_USER_VERBS_EX_CMD_DESTROY_FLOW
105 * Make sure that all structs defined in this file remain laid out so
106 * that they pack the same way on 32-bit and 64-bit architectures (to
107 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
109 * - Do not use pointer types -- pass pointers in __u64 instead.
110 * - Make sure that any structure larger than 4 bytes is padded to a
111 * multiple of 8 bytes. Otherwise the structure size will be
112 * different between 32-bit and 64-bit architectures.
115 struct ib_uverbs_async_event_desc {
117 __u32 event_type; /* enum ib_event_type */
121 struct ib_uverbs_comp_event_desc {
126 * All commands from userspace should start with a __u32 command field
127 * followed by __u16 in_words and out_words fields (which give the
128 * length of the command block and response buffer if any in 32-bit
129 * words). The kernel driver will read these fields first and read
130 * the rest of the command struct based on these value.
133 #define IBV_RESP_TO_VERBS_RESP_EX_RAW(ex_ptr, ex_type, ibv_type, field) \
134 ((ibv_type *)((void *)(ex_ptr) + offsetof(ex_type, \
135 field) + sizeof((ex_ptr)->field)))
137 #define IBV_RESP_TO_VERBS_RESP_EX(ex_ptr, ex_type, ibv_type) \
138 IBV_RESP_TO_VERBS_RESP_EX_RAW(ex_ptr, ex_type, ibv_type, comp_mask)
141 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
142 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
143 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
145 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
147 struct ib_uverbs_cmd_hdr {
153 struct ib_uverbs_ex_cmd_hdr {
155 __u16 provider_in_words;
156 __u16 provider_out_words;
157 __u32 cmd_hdr_reserved;
160 struct ib_uverbs_get_context {
162 __u64 driver_data[0];
165 struct ib_uverbs_get_context_resp {
167 __u32 num_comp_vectors;
170 struct ib_uverbs_query_device {
172 __u64 driver_data[0];
175 struct ib_uverbs_query_device_ex {
177 __u64 driver_data[0];
180 struct ib_uverbs_query_device_resp {
183 __be64 sys_image_guid;
187 __u32 vendor_part_id;
191 __u32 device_cap_flags;
198 __u32 max_qp_rd_atom;
199 __u32 max_ee_rd_atom;
200 __u32 max_res_rd_atom;
201 __u32 max_qp_init_rd_atom;
202 __u32 max_ee_init_rd_atom;
207 __u32 max_raw_ipv6_qp;
208 __u32 max_raw_ethy_qp;
210 __u32 max_mcast_qp_attach;
211 __u32 max_total_mcast_qp_attach;
214 __u32 max_map_per_fmr;
219 __u8 local_ca_ack_delay;
224 struct ib_uverbs_query_port {
228 __u64 driver_data[0];
231 struct ib_uverbs_query_port_resp {
232 __u32 port_cap_flags;
235 __u32 qkey_viol_cntr;
247 __u8 init_type_reply;
255 struct ib_uverbs_alloc_pd {
257 __u64 driver_data[0];
260 struct ib_uverbs_alloc_pd_resp {
264 struct ib_uverbs_dealloc_pd {
268 struct ib_uverbs_open_xrcd {
272 __u64 driver_data[0];
275 struct ib_uverbs_open_xrcd_resp {
279 struct ib_uverbs_close_xrcd {
283 struct ib_uverbs_reg_mr {
290 __u64 driver_data[0];
293 struct ib_uverbs_reg_mr_resp {
299 struct ib_uverbs_dereg_mr {
303 struct ib_uverbs_alloc_mw {
310 struct ib_uverbs_alloc_mw_resp {
315 struct ib_uverbs_dealloc_mw {
319 struct ib_uverbs_create_comp_channel {
323 struct ib_uverbs_create_comp_channel_resp {
327 struct ib_uverbs_create_cq {
334 __u64 driver_data[0];
337 struct ib_uverbs_create_cq_resp {
342 enum ib_uverbs_create_cq_ex_comp_mask {
343 IB_UVERBS_CREATE_CQ_EX_CAP_FLAGS = (u64)1 << 0,
346 struct ib_uverbs_create_cq_ex {
354 __u64 driver_data[0];
357 struct ib_uverbs_modify_cq_ex {
366 struct ib_uverbs_resize_cq {
370 __u64 driver_data[0];
373 struct ib_uverbs_resize_cq_resp {
376 __u64 driver_data[0];
379 struct ib_uverbs_poll_cq {
385 struct ib_uverbs_wc {
393 __u32 invalidate_rkey;
406 struct ib_uverbs_poll_cq_resp {
409 struct ib_uverbs_wc wc[0];
412 struct ib_uverbs_req_notify_cq {
414 __u32 solicited_only;
417 struct ib_uverbs_destroy_cq {
423 struct ib_uverbs_destroy_cq_resp {
424 __u32 comp_events_reported;
425 __u32 async_events_reported;
428 struct ib_uverbs_global_route {
437 struct ib_uverbs_ah_attr {
438 struct ib_uverbs_global_route grh;
448 struct ib_uverbs_qp_attr {
453 __u32 path_mig_state;
458 __u32 qp_access_flags;
460 struct ib_uverbs_ah_attr ah_attr;
461 struct ib_uverbs_ah_attr alt_ah_attr;
468 __u32 max_inline_data;
471 __u16 alt_pkey_index;
472 __u8 en_sqd_async_notify;
475 __u8 max_dest_rd_atomic;
486 struct ib_uverbs_create_qp {
490 __u32 send_cq_handle;
491 __u32 recv_cq_handle;
497 __u32 max_inline_data;
502 __u64 driver_data[0];
505 struct ib_uverbs_open_qp {
512 __u64 driver_data[0];
515 /* also used for open response */
516 struct ib_uverbs_create_qp_resp {
523 __u32 max_inline_data;
528 * This struct needs to remain a multiple of 8 bytes to keep the
529 * alignment of the modify QP parameters.
531 struct ib_uverbs_qp_dest {
546 struct ib_uverbs_query_qp {
550 __u64 driver_data[0];
553 struct ib_uverbs_query_qp_resp {
554 struct ib_uverbs_qp_dest dest;
555 struct ib_uverbs_qp_dest alt_dest;
560 __u32 max_inline_data;
565 __u32 qp_access_flags;
567 __u16 alt_pkey_index;
574 __u8 max_dest_rd_atomic;
584 __u64 driver_data[0];
587 struct ib_uverbs_modify_qp {
588 struct ib_uverbs_qp_dest dest;
589 struct ib_uverbs_qp_dest alt_dest;
596 __u32 qp_access_flags;
598 __u16 alt_pkey_index;
603 __u8 en_sqd_async_notify;
605 __u8 max_dest_rd_atomic;
614 __u64 driver_data[0];
617 enum ib_uverbs_modify_qp_ex_comp_mask {
618 IB_UVERBS_QP_ATTR_DCT_KEY = 1ULL << 0,
621 struct ib_uverbs_modify_qp_ex {
623 struct ib_uverbs_qp_dest dest;
624 struct ib_uverbs_qp_dest alt_dest;
631 __u32 qp_access_flags;
633 __u16 alt_pkey_index;
638 __u8 en_sqd_async_notify;
640 __u8 max_dest_rd_atomic;
650 __u64 driver_data[0];
653 struct ib_uverbs_modify_qp_resp {
656 struct ib_uverbs_destroy_qp {
662 struct ib_uverbs_destroy_qp_resp {
663 __u32 events_reported;
667 * The ib_uverbs_sge structure isn't used anywhere, since we assume
668 * the ib_sge structure is packed the same way on 32-bit and 64-bit
669 * architectures in both kernel and user space. It's just here to
672 struct ib_uverbs_sge {
678 struct ib_uverbs_send_wr {
685 __u32 invalidate_rkey;
709 struct ib_uverbs_post_send {
715 struct ib_uverbs_send_wr send_wr[0];
718 struct ib_uverbs_post_send_resp {
722 struct ib_uverbs_recv_wr {
728 struct ib_uverbs_post_recv {
734 struct ib_uverbs_recv_wr recv_wr[0];
737 struct ib_uverbs_post_recv_resp {
741 struct ib_uverbs_post_srq_recv {
747 struct ib_uverbs_recv_wr recv[0];
750 struct ib_uverbs_post_srq_recv_resp {
754 struct ib_uverbs_create_ah {
759 struct ib_uverbs_ah_attr attr;
762 struct ib_uverbs_create_ah_resp {
766 struct ib_uverbs_destroy_ah {
770 struct ib_uverbs_attach_mcast {
775 __u64 driver_data[0];
778 struct ib_uverbs_detach_mcast {
783 __u64 driver_data[0];
786 struct ib_uverbs_flow_spec_hdr {
790 /* followed by flow_spec */
791 __u64 flow_spec_data[0];
794 struct ib_kern_eth_filter {
801 struct ib_uverbs_flow_spec_eth {
803 struct ib_uverbs_flow_spec_hdr hdr;
810 struct ib_kern_eth_filter val;
811 struct ib_kern_eth_filter mask;
814 struct ib_kern_ib_filter {
819 struct ib_uverbs_flow_spec_ib {
821 struct ib_uverbs_flow_spec_hdr hdr;
828 struct ib_kern_ib_filter val;
829 struct ib_kern_ib_filter mask;
832 struct ib_kern_ipv4_filter {
837 struct ib_uverbs_flow_spec_ipv4 {
839 struct ib_uverbs_flow_spec_hdr hdr;
846 struct ib_kern_ipv4_filter val;
847 struct ib_kern_ipv4_filter mask;
850 struct ib_kern_tcp_udp_filter {
855 struct ib_uverbs_flow_spec_tcp_udp {
857 struct ib_uverbs_flow_spec_hdr hdr;
864 struct ib_kern_tcp_udp_filter val;
865 struct ib_kern_tcp_udp_filter mask;
868 struct ib_uverbs_flow_attr {
876 /* Following are the optional layers according to user request
877 * struct ib_flow_spec_xxx
878 * struct ib_flow_spec_yyy
880 struct ib_uverbs_flow_spec_hdr flow_specs[0];
883 struct ib_uverbs_create_flow {
886 struct ib_uverbs_flow_attr flow_attr;
889 struct ib_uverbs_create_flow_resp {
894 struct ib_uverbs_destroy_flow {
899 struct ib_uverbs_create_srq {
906 __u64 driver_data[0];
909 struct ib_uverbs_create_xsrq {
920 __u64 driver_data[0];
923 struct ib_uverbs_create_srq_resp {
930 struct ib_uverbs_modify_srq {
935 __u64 driver_data[0];
938 struct ib_uverbs_query_srq {
942 __u64 driver_data[0];
945 struct ib_uverbs_query_srq_resp {
952 struct ib_uverbs_destroy_srq {
958 struct ib_uverbs_destroy_srq_resp {
959 __u32 events_reported;
964 * Legacy extended verbs related structures
966 struct ib_uverbs_ex_cmd_hdr_legacy {
970 __u16 provider_in_words;
971 __u16 provider_out_words;
972 __u32 cmd_hdr_reserved;
975 struct ib_uverbs_ex_cmd_resp1_legacy {
980 #endif /* IB_USER_VERBS_H */