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.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 #include <infiniband/types.h>
41 * This file must be kept in sync with the kernel's version of
42 * drivers/infiniband/include/ib_user_verbs.h
46 * The minimum and maximum kernel ABI that we can handle.
48 #define IB_USER_VERBS_MIN_ABI_VERSION 3
49 #define IB_USER_VERBS_MAX_ABI_VERSION 6
51 #define IB_USER_VERBS_CMD_THRESHOLD 50
54 IB_USER_VERBS_CMD_GET_CONTEXT,
55 IB_USER_VERBS_CMD_QUERY_DEVICE,
56 IB_USER_VERBS_CMD_QUERY_PORT,
57 IB_USER_VERBS_CMD_ALLOC_PD,
58 IB_USER_VERBS_CMD_DEALLOC_PD,
59 IB_USER_VERBS_CMD_CREATE_AH,
60 IB_USER_VERBS_CMD_MODIFY_AH,
61 IB_USER_VERBS_CMD_QUERY_AH,
62 IB_USER_VERBS_CMD_DESTROY_AH,
63 IB_USER_VERBS_CMD_REG_MR,
64 IB_USER_VERBS_CMD_REG_SMR,
65 IB_USER_VERBS_CMD_REREG_MR,
66 IB_USER_VERBS_CMD_QUERY_MR,
67 IB_USER_VERBS_CMD_DEREG_MR,
68 IB_USER_VERBS_CMD_ALLOC_MW,
69 IB_USER_VERBS_CMD_BIND_MW,
70 IB_USER_VERBS_CMD_DEALLOC_MW,
71 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
72 IB_USER_VERBS_CMD_CREATE_CQ,
73 IB_USER_VERBS_CMD_RESIZE_CQ,
74 IB_USER_VERBS_CMD_DESTROY_CQ,
75 IB_USER_VERBS_CMD_POLL_CQ,
76 IB_USER_VERBS_CMD_PEEK_CQ,
77 IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
78 IB_USER_VERBS_CMD_CREATE_QP,
79 IB_USER_VERBS_CMD_QUERY_QP,
80 IB_USER_VERBS_CMD_MODIFY_QP,
81 IB_USER_VERBS_CMD_DESTROY_QP,
82 IB_USER_VERBS_CMD_POST_SEND,
83 IB_USER_VERBS_CMD_POST_RECV,
84 IB_USER_VERBS_CMD_ATTACH_MCAST,
85 IB_USER_VERBS_CMD_DETACH_MCAST,
86 IB_USER_VERBS_CMD_CREATE_SRQ,
87 IB_USER_VERBS_CMD_MODIFY_SRQ,
88 IB_USER_VERBS_CMD_QUERY_SRQ,
89 IB_USER_VERBS_CMD_DESTROY_SRQ,
90 IB_USER_VERBS_CMD_POST_SRQ_RECV,
91 IB_USER_VERBS_CMD_OPEN_XRCD,
92 IB_USER_VERBS_CMD_CLOSE_XRCD,
93 IB_USER_VERBS_CMD_CREATE_XSRQ,
94 IB_USER_VERBS_CMD_OPEN_QP
97 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
98 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
99 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
102 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80ul
104 /* use this mask for creating extended commands */
105 #define IB_USER_VERBS_CMD_EXTENDED_MASK \
106 (IB_USER_VERBS_CMD_FLAG_EXTENDED << \
107 IB_USER_VERBS_CMD_FLAGS_SHIFT)
111 IB_USER_VERBS_CMD_QUERY_DEVICE_EX = IB_USER_VERBS_CMD_EXTENDED_MASK |
112 IB_USER_VERBS_CMD_QUERY_DEVICE,
113 IB_USER_VERBS_CMD_CREATE_QP_EX = IB_USER_VERBS_CMD_EXTENDED_MASK |
114 IB_USER_VERBS_CMD_CREATE_QP,
115 IB_USER_VERBS_CMD_CREATE_CQ_EX = IB_USER_VERBS_CMD_EXTENDED_MASK |
116 IB_USER_VERBS_CMD_CREATE_CQ,
117 IB_USER_VERBS_CMD_MODIFY_QP_EX = IB_USER_VERBS_CMD_EXTENDED_MASK |
118 IB_USER_VERBS_CMD_MODIFY_QP,
119 IB_USER_VERBS_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_EXTENDED_MASK +
120 IB_USER_VERBS_CMD_THRESHOLD,
121 IB_USER_VERBS_CMD_DESTROY_FLOW,
122 IB_USER_VERBS_CMD_CREATE_WQ,
123 IB_USER_VERBS_CMD_MODIFY_WQ,
124 IB_USER_VERBS_CMD_DESTROY_WQ,
125 IB_USER_VERBS_CMD_CREATE_RWQ_IND_TBL,
126 IB_USER_VERBS_CMD_DESTROY_RWQ_IND_TBL,
130 * Make sure that all structs defined in this file remain laid out so
131 * that they pack the same way on 32-bit and 64-bit architectures (to
132 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
134 * - Do not use pointer types -- pass pointers in __u64 instead.
135 * - Make sure that any structure larger than 4 bytes is padded to a
136 * multiple of 8 bytes. Otherwise the structure size will be
137 * different between 32-bit and 64-bit architectures.
146 struct response_hdr {
160 __u16 provider_in_words;
161 __u16 provider_out_words;
166 struct ibv_kern_async_event {
172 struct ibv_comp_event {
177 * All commands from userspace should start with a __u32 command field
178 * followed by __u16 in_words and out_words fields (which give the
179 * length of the command block and response buffer if any in 32-bit
180 * words). The kernel driver will read these fields first and read
181 * the rest of the command struct based on these value.
184 struct ibv_query_params {
191 struct ibv_query_params_resp {
195 struct ibv_get_context {
200 __u64 driver_data[0];
203 struct ibv_get_context_resp {
205 __u32 num_comp_vectors;
208 struct ibv_query_device {
213 __u64 driver_data[0];
216 struct ibv_query_device_resp {
219 __be64 sys_image_guid;
223 __u32 vendor_part_id;
227 __u32 device_cap_flags;
234 __u32 max_qp_rd_atom;
235 __u32 max_ee_rd_atom;
236 __u32 max_res_rd_atom;
237 __u32 max_qp_init_rd_atom;
238 __u32 max_ee_init_rd_atom;
243 __u32 max_raw_ipv6_qp;
244 __u32 max_raw_ethy_qp;
246 __u32 max_mcast_qp_attach;
247 __u32 max_total_mcast_qp_attach;
250 __u32 max_map_per_fmr;
255 __u8 local_ca_ack_delay;
260 struct ibv_query_device_ex {
266 struct ibv_odp_caps_resp {
272 } per_transport_caps;
276 struct ibv_rss_caps_resp {
277 __u32 supported_qpts;
278 __u32 max_rwq_indirection_tables;
279 __u32 max_rwq_indirection_table_size;
283 struct ibv_query_device_resp_ex {
284 struct ibv_query_device_resp base;
286 __u32 response_length;
287 struct ibv_odp_caps_resp odp_caps;
288 __u64 timestamp_mask;
289 __u64 hca_core_clock;
290 __u64 device_cap_flags_ex;
291 struct ibv_rss_caps_resp rss_caps;
292 __u32 max_wq_type_rq;
293 __u32 raw_packet_caps;
296 struct ibv_query_port {
303 __u64 driver_data[0];
306 struct ibv_query_port_resp {
307 __u32 port_cap_flags;
310 __u32 qkey_viol_cntr;
322 __u8 init_type_reply;
330 struct ibv_alloc_pd {
335 __u64 driver_data[0];
338 struct ibv_alloc_pd_resp {
342 struct ibv_dealloc_pd {
349 struct ibv_open_xrcd {
356 __u64 driver_data[0];
359 struct ibv_open_xrcd_resp {
363 struct ibv_close_xrcd {
380 __u64 driver_data[0];
383 struct ibv_reg_mr_resp {
389 struct ibv_rereg_mr {
401 __u64 driver_data[0];
404 struct ibv_rereg_mr_resp {
409 struct ibv_dereg_mr {
416 struct ibv_alloc_mw {
426 struct ibv_alloc_mw_resp {
431 struct ibv_dealloc_mw {
439 struct ibv_create_comp_channel {
446 struct ibv_create_comp_channel_resp {
450 struct ibv_create_cq {
460 __u64 driver_data[0];
463 struct ibv_create_cq_resp {
468 enum ibv_create_cq_ex_kernel_flags {
469 IBV_CREATE_CQ_EX_KERNEL_FLAG_COMPLETION_TIMESTAMP = 1 << 0,
472 struct ibv_create_cq_ex {
483 struct ibv_create_cq_resp_ex {
484 struct ibv_create_cq_resp base;
486 __u32 response_length;
516 struct ibv_poll_cq_resp {
519 struct ibv_kern_wc wc[0];
522 struct ibv_req_notify_cq {
530 struct ibv_resize_cq {
537 __u64 driver_data[0];
540 struct ibv_resize_cq_resp {
543 __u64 driver_data[0];
546 struct ibv_destroy_cq {
555 struct ibv_destroy_cq_resp {
556 __u32 comp_events_reported;
557 __u32 async_events_reported;
560 struct ibv_kern_global_route {
569 struct ibv_kern_ah_attr {
570 struct ibv_kern_global_route grh;
580 struct ibv_kern_qp_attr {
585 __u32 path_mig_state;
590 __u32 qp_access_flags;
592 struct ibv_kern_ah_attr ah_attr;
593 struct ibv_kern_ah_attr alt_ah_attr;
600 __u32 max_inline_data;
603 __u16 alt_pkey_index;
604 __u8 en_sqd_async_notify;
607 __u8 max_dest_rd_atomic;
618 #define IBV_CREATE_QP_COMMON \
621 __u32 send_cq_handle; \
622 __u32 recv_cq_handle; \
626 __u32 max_send_sge; \
627 __u32 max_recv_sge; \
628 __u32 max_inline_data; \
634 struct ibv_create_qp {
639 IBV_CREATE_QP_COMMON;
640 __u64 driver_data[0];
643 struct ibv_create_qp_common {
644 IBV_CREATE_QP_COMMON;
657 __u64 driver_data[0];
660 /* also used for open response */
661 struct ibv_create_qp_resp {
668 __u32 max_inline_data;
672 enum ibv_create_qp_ex_kernel_mask {
673 IBV_CREATE_QP_EX_KERNEL_MASK_IND_TABLE = 1 << 0,
676 struct ibv_create_qp_ex {
678 struct ibv_create_qp_common base;
681 __u32 ind_tbl_handle;
685 struct ibv_create_qp_resp_ex {
686 struct ibv_create_qp_resp base;
688 __u32 response_length;
706 struct ibv_query_qp {
713 __u64 driver_data[0];
716 struct ibv_query_qp_resp {
717 struct ibv_qp_dest dest;
718 struct ibv_qp_dest alt_dest;
723 __u32 max_inline_data;
728 __u32 qp_access_flags;
730 __u16 alt_pkey_index;
737 __u8 max_dest_rd_atomic;
747 __u64 driver_data[0];
750 struct ibv_modify_qp_common {
751 struct ibv_qp_dest dest;
752 struct ibv_qp_dest alt_dest;
759 __u32 qp_access_flags;
761 __u16 alt_pkey_index;
766 __u8 en_sqd_async_notify;
768 __u8 max_dest_rd_atomic;
779 struct ibv_modify_qp {
783 struct ibv_modify_qp_common base;
784 __u64 driver_data[0];
787 struct ibv_modify_qp_ex {
789 struct ibv_modify_qp_common base;
794 struct ibv_modify_qp_resp_ex {
796 __u32 response_length;
799 struct ibv_destroy_qp {
808 struct ibv_destroy_qp_resp {
809 __u32 events_reported;
812 struct ibv_kern_send_wr {
845 struct ibv_kern_eth_filter {
852 struct ibv_kern_spec_eth {
856 struct ibv_kern_eth_filter val;
857 struct ibv_kern_eth_filter mask;
860 struct ibv_kern_ipv4_filter {
865 struct ibv_kern_spec_ipv4 {
869 struct ibv_kern_ipv4_filter val;
870 struct ibv_kern_ipv4_filter mask;
873 struct ibv_kern_ipv4_ext_filter {
882 struct ibv_kern_spec_ipv4_ext {
886 struct ibv_kern_ipv4_ext_filter val;
887 struct ibv_kern_ipv4_ext_filter mask;
890 struct ibv_kern_ipv6_filter {
900 struct ibv_kern_spec_ipv6 {
904 struct ibv_kern_ipv6_filter val;
905 struct ibv_kern_ipv6_filter mask;
908 struct ibv_kern_tcp_udp_filter {
913 struct ibv_kern_spec_tcp_udp {
917 struct ibv_kern_tcp_udp_filter val;
918 struct ibv_kern_tcp_udp_filter mask;
921 struct ibv_kern_spec_action_tag {
929 struct ibv_kern_tunnel_filter {
933 struct ibv_kern_spec_tunnel {
937 struct ibv_kern_tunnel_filter val;
938 struct ibv_kern_tunnel_filter mask;
941 struct ibv_kern_spec_action_drop {
947 struct ibv_kern_spec {
954 struct ibv_kern_spec_eth eth;
955 struct ibv_kern_spec_ipv4 ipv4;
956 struct ibv_kern_spec_ipv4_ext ipv4_ext;
957 struct ibv_kern_spec_tcp_udp tcp_udp;
958 struct ibv_kern_spec_ipv6 ipv6;
959 struct ibv_kern_spec_tunnel tunnel;
960 struct ibv_kern_spec_action_tag flow_tag;
961 struct ibv_kern_spec_action_drop drop;
965 struct ibv_kern_flow_attr {
973 /* Following are the optional layers according to user request
974 * struct ibv_kern_flow_spec_xxx
975 * struct ibv_kern_flow_spec_yyy
979 struct ibv_post_send {
988 struct ibv_kern_send_wr send_wr[0];
991 struct ibv_post_send_resp {
995 struct ibv_kern_recv_wr {
1001 struct ibv_post_recv {
1010 struct ibv_kern_recv_wr recv_wr[0];
1013 struct ibv_post_recv_resp {
1017 struct ibv_post_srq_recv {
1026 struct ibv_kern_recv_wr recv_wr[0];
1029 struct ibv_post_srq_recv_resp {
1033 struct ibv_create_ah {
1041 struct ibv_kern_ah_attr attr;
1044 struct ibv_create_ah_resp {
1048 struct ibv_destroy_ah {
1055 struct ibv_attach_mcast {
1063 __u64 driver_data[0];
1066 struct ibv_create_flow {
1070 struct ibv_kern_flow_attr flow_attr;
1073 struct ibv_create_flow_resp {
1078 struct ibv_destroy_flow {
1084 struct ibv_detach_mcast {
1092 __u64 driver_data[0];
1095 struct ibv_create_srq {
1105 __u64 driver_data[0];
1108 struct ibv_create_xsrq {
1122 __u64 driver_data[0];
1125 struct ibv_create_srq_resp {
1132 struct ibv_modify_srq {
1140 __u64 driver_data[0];
1143 struct ibv_query_srq {
1150 __u64 driver_data[0];
1153 struct ibv_query_srq_resp {
1160 struct ibv_destroy_srq {
1169 struct ibv_destroy_srq_resp {
1170 __u32 events_reported;
1174 * Compatibility with older ABI versions
1178 IB_USER_VERBS_CMD_QUERY_PARAMS_V2,
1179 IB_USER_VERBS_CMD_GET_CONTEXT_V2,
1180 IB_USER_VERBS_CMD_QUERY_DEVICE_V2,
1181 IB_USER_VERBS_CMD_QUERY_PORT_V2,
1182 IB_USER_VERBS_CMD_QUERY_GID_V2,
1183 IB_USER_VERBS_CMD_QUERY_PKEY_V2,
1184 IB_USER_VERBS_CMD_ALLOC_PD_V2,
1185 IB_USER_VERBS_CMD_DEALLOC_PD_V2,
1186 IB_USER_VERBS_CMD_CREATE_AH_V2,
1187 IB_USER_VERBS_CMD_MODIFY_AH_V2,
1188 IB_USER_VERBS_CMD_QUERY_AH_V2,
1189 IB_USER_VERBS_CMD_DESTROY_AH_V2,
1190 IB_USER_VERBS_CMD_REG_MR_V2,
1191 IB_USER_VERBS_CMD_REG_SMR_V2,
1192 IB_USER_VERBS_CMD_REREG_MR_V2,
1193 IB_USER_VERBS_CMD_QUERY_MR_V2,
1194 IB_USER_VERBS_CMD_DEREG_MR_V2,
1195 IB_USER_VERBS_CMD_ALLOC_MW_V2,
1196 IB_USER_VERBS_CMD_BIND_MW_V2,
1197 IB_USER_VERBS_CMD_DEALLOC_MW_V2,
1198 IB_USER_VERBS_CMD_CREATE_CQ_V2,
1199 IB_USER_VERBS_CMD_RESIZE_CQ_V2,
1200 IB_USER_VERBS_CMD_DESTROY_CQ_V2,
1201 IB_USER_VERBS_CMD_POLL_CQ_V2,
1202 IB_USER_VERBS_CMD_PEEK_CQ_V2,
1203 IB_USER_VERBS_CMD_REQ_NOTIFY_CQ_V2,
1204 IB_USER_VERBS_CMD_CREATE_QP_V2,
1205 IB_USER_VERBS_CMD_QUERY_QP_V2,
1206 IB_USER_VERBS_CMD_MODIFY_QP_V2,
1207 IB_USER_VERBS_CMD_DESTROY_QP_V2,
1208 IB_USER_VERBS_CMD_POST_SEND_V2,
1209 IB_USER_VERBS_CMD_POST_RECV_V2,
1210 IB_USER_VERBS_CMD_ATTACH_MCAST_V2,
1211 IB_USER_VERBS_CMD_DETACH_MCAST_V2,
1212 IB_USER_VERBS_CMD_CREATE_SRQ_V2,
1213 IB_USER_VERBS_CMD_MODIFY_SRQ_V2,
1214 IB_USER_VERBS_CMD_QUERY_SRQ_V2,
1215 IB_USER_VERBS_CMD_DESTROY_SRQ_V2,
1216 IB_USER_VERBS_CMD_POST_SRQ_RECV_V2,
1218 * Set commands that didn't exist to -1 so our compile-time
1219 * trick opcodes in IBV_INIT_CMD() doesn't break.
1221 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 = -1,
1222 IB_USER_VERBS_CMD_OPEN_XRCD_V2 = -1,
1223 IB_USER_VERBS_CMD_CLOSE_XRCD_V2 = -1,
1224 IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1,
1225 IB_USER_VERBS_CMD_OPEN_QP_V2 = -1,
1226 IB_USER_VERBS_CMD_CREATE_FLOW_V2 = -1,
1227 IB_USER_VERBS_CMD_DESTROY_FLOW_V2 = -1,
1228 IB_USER_VERBS_CMD_QUERY_DEVICE_EX_V2 = -1,
1229 IB_USER_VERBS_CMD_CREATE_QP_EX_V2 = -1,
1230 IB_USER_VERBS_CMD_CREATE_CQ_EX_V2 = -1,
1231 IB_USER_VERBS_CMD_CREATE_WQ_V2 = -1,
1232 IB_USER_VERBS_CMD_MODIFY_WQ_V2 = -1,
1233 IB_USER_VERBS_CMD_DESTROY_WQ_V2 = -1,
1234 IB_USER_VERBS_CMD_CREATE_RWQ_IND_TBL_V2 = -1,
1235 IB_USER_VERBS_CMD_DESTROY_RWQ_IND_TBL_V2 = -1,
1236 IB_USER_VERBS_CMD_MODIFY_QP_EX_V2 = -1,
1239 struct ibv_modify_srq_v3 {
1249 __u64 driver_data[0];
1252 struct ibv_create_qp_resp_v3 {
1257 struct ibv_create_qp_resp_v4 {
1264 __u32 max_inline_data;
1267 struct ibv_create_srq_resp_v5 {
1271 struct ibv_create_wq {
1284 struct ibv_create_wq_resp {
1286 __u32 response_length;
1293 struct ibv_destroy_wq {
1299 struct ibv_destroy_wq_resp {
1301 __u32 response_length;
1302 __u32 events_reported;
1306 struct ibv_modify_wq {
1311 __u32 curr_wq_state;
1316 struct ibv_create_rwq_ind_table {
1319 __u32 log_ind_tbl_size;
1320 /* Following are wq handles based on log_ind_tbl_size, must be 64 bytes aligned.
1326 struct ibv_create_rwq_ind_table_resp {
1328 __u32 response_length;
1329 __u32 ind_tbl_handle;
1333 struct ibv_destroy_rwq_ind_table {
1336 __u32 ind_tbl_handle;
1339 #endif /* KERN_ABI_H */