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>
40 #include <rdma/ib_verbs.h>
43 * Increment this value if any changes that break userspace ABI
44 * compatibility are made.
46 #define IB_USER_VERBS_ABI_VERSION 6
47 #define IB_USER_VERBS_CMD_THRESHOLD 50
50 IB_USER_VERBS_CMD_GET_CONTEXT,
51 IB_USER_VERBS_CMD_QUERY_DEVICE,
52 IB_USER_VERBS_CMD_QUERY_PORT,
53 IB_USER_VERBS_CMD_ALLOC_PD,
54 IB_USER_VERBS_CMD_DEALLOC_PD,
55 IB_USER_VERBS_CMD_CREATE_AH,
56 IB_USER_VERBS_CMD_MODIFY_AH,
57 IB_USER_VERBS_CMD_QUERY_AH,
58 IB_USER_VERBS_CMD_DESTROY_AH,
59 IB_USER_VERBS_CMD_REG_MR,
60 IB_USER_VERBS_CMD_REG_SMR,
61 IB_USER_VERBS_CMD_REREG_MR,
62 IB_USER_VERBS_CMD_QUERY_MR,
63 IB_USER_VERBS_CMD_DEREG_MR,
64 IB_USER_VERBS_CMD_ALLOC_MW,
65 IB_USER_VERBS_CMD_BIND_MW,
66 IB_USER_VERBS_CMD_DEALLOC_MW,
67 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
68 IB_USER_VERBS_CMD_CREATE_CQ,
69 IB_USER_VERBS_CMD_RESIZE_CQ,
70 IB_USER_VERBS_CMD_DESTROY_CQ,
71 IB_USER_VERBS_CMD_POLL_CQ,
72 IB_USER_VERBS_CMD_PEEK_CQ,
73 IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
74 IB_USER_VERBS_CMD_CREATE_QP,
75 IB_USER_VERBS_CMD_QUERY_QP,
76 IB_USER_VERBS_CMD_MODIFY_QP,
77 IB_USER_VERBS_CMD_DESTROY_QP,
78 IB_USER_VERBS_CMD_POST_SEND,
79 IB_USER_VERBS_CMD_POST_RECV,
80 IB_USER_VERBS_CMD_ATTACH_MCAST,
81 IB_USER_VERBS_CMD_DETACH_MCAST,
82 IB_USER_VERBS_CMD_CREATE_SRQ,
83 IB_USER_VERBS_CMD_MODIFY_SRQ,
84 IB_USER_VERBS_CMD_QUERY_SRQ,
85 IB_USER_VERBS_CMD_DESTROY_SRQ,
86 IB_USER_VERBS_CMD_POST_SRQ_RECV,
87 IB_USER_VERBS_CMD_OPEN_XRCD,
88 IB_USER_VERBS_CMD_CLOSE_XRCD,
89 IB_USER_VERBS_CMD_CREATE_XSRQ,
90 IB_USER_VERBS_CMD_OPEN_QP,
94 IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
95 IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ,
96 IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP,
97 IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP,
98 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
99 IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
100 IB_USER_VERBS_EX_CMD_CREATE_WQ,
101 IB_USER_VERBS_EX_CMD_MODIFY_WQ,
102 IB_USER_VERBS_EX_CMD_DESTROY_WQ,
103 IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL,
104 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
108 * Make sure that all structs defined in this file remain laid out so
109 * that they pack the same way on 32-bit and 64-bit architectures (to
110 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
112 * - Do not use pointer types -- pass pointers in __u64 instead.
113 * - Make sure that any structure larger than 4 bytes is padded to a
114 * multiple of 8 bytes. Otherwise the structure size will be
115 * different between 32-bit and 64-bit architectures.
118 struct ib_uverbs_async_event_desc {
120 __u32 event_type; /* enum ib_event_type */
124 struct ib_uverbs_comp_event_desc {
129 * All commands from userspace should start with a __u32 command field
130 * followed by __u16 in_words and out_words fields (which give the
131 * length of the command block and response buffer if any in 32-bit
132 * words). The kernel driver will read these fields first and read
133 * the rest of the command struct based on these value.
136 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
137 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
138 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
140 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
142 struct ib_uverbs_cmd_hdr {
148 struct ib_uverbs_ex_cmd_hdr {
150 __u16 provider_in_words;
151 __u16 provider_out_words;
152 __u32 cmd_hdr_reserved;
155 struct ib_uverbs_get_context {
157 __u64 driver_data[0];
160 struct ib_uverbs_get_context_resp {
162 __u32 num_comp_vectors;
165 struct ib_uverbs_query_device {
167 __u64 driver_data[0];
170 struct ib_uverbs_query_device_resp {
173 __be64 sys_image_guid;
177 __u32 vendor_part_id;
181 __u32 device_cap_flags;
188 __u32 max_qp_rd_atom;
189 __u32 max_ee_rd_atom;
190 __u32 max_res_rd_atom;
191 __u32 max_qp_init_rd_atom;
192 __u32 max_ee_init_rd_atom;
197 __u32 max_raw_ipv6_qp;
198 __u32 max_raw_ethy_qp;
200 __u32 max_mcast_qp_attach;
201 __u32 max_total_mcast_qp_attach;
204 __u32 max_map_per_fmr;
209 __u8 local_ca_ack_delay;
214 struct ib_uverbs_ex_query_device {
219 struct ib_uverbs_odp_caps {
225 } per_transport_caps;
229 struct ib_uverbs_rss_caps {
230 /* Corresponding bit will be set if qp type from
231 * 'enum ib_qp_type' is supported, e.g.
232 * supported_qpts |= 1 << IB_QPT_UD
234 __u32 supported_qpts;
235 __u32 max_rwq_indirection_tables;
236 __u32 max_rwq_indirection_table_size;
240 struct ib_uverbs_ex_query_device_resp {
241 struct ib_uverbs_query_device_resp base;
243 __u32 response_length;
244 struct ib_uverbs_odp_caps odp_caps;
245 __u64 timestamp_mask;
246 __u64 hca_core_clock; /* in KHZ */
247 __u64 device_cap_flags_ex;
248 struct ib_uverbs_rss_caps rss_caps;
249 __u32 max_wq_type_rq;
253 struct ib_uverbs_query_port {
257 __u64 driver_data[0];
260 struct ib_uverbs_query_port_resp {
261 __u32 port_cap_flags;
264 __u32 qkey_viol_cntr;
276 __u8 init_type_reply;
284 struct ib_uverbs_alloc_pd {
286 __u64 driver_data[0];
289 struct ib_uverbs_alloc_pd_resp {
293 struct ib_uverbs_dealloc_pd {
297 struct ib_uverbs_open_xrcd {
301 __u64 driver_data[0];
304 struct ib_uverbs_open_xrcd_resp {
308 struct ib_uverbs_close_xrcd {
312 struct ib_uverbs_reg_mr {
319 __u64 driver_data[0];
322 struct ib_uverbs_reg_mr_resp {
328 struct ib_uverbs_rereg_mr {
339 struct ib_uverbs_rereg_mr_resp {
344 struct ib_uverbs_dereg_mr {
348 struct ib_uverbs_alloc_mw {
355 struct ib_uverbs_alloc_mw_resp {
360 struct ib_uverbs_dealloc_mw {
364 struct ib_uverbs_create_comp_channel {
368 struct ib_uverbs_create_comp_channel_resp {
372 struct ib_uverbs_create_cq {
379 __u64 driver_data[0];
382 struct ib_uverbs_ex_create_cq {
392 struct ib_uverbs_create_cq_resp {
397 struct ib_uverbs_ex_create_cq_resp {
398 struct ib_uverbs_create_cq_resp base;
400 __u32 response_length;
403 struct ib_uverbs_resize_cq {
407 __u64 driver_data[0];
410 struct ib_uverbs_resize_cq_resp {
413 __u64 driver_data[0];
416 struct ib_uverbs_poll_cq {
422 struct ib_uverbs_wc {
430 __u32 invalidate_rkey;
443 struct ib_uverbs_poll_cq_resp {
446 struct ib_uverbs_wc wc[0];
449 struct ib_uverbs_req_notify_cq {
451 __u32 solicited_only;
454 struct ib_uverbs_destroy_cq {
460 struct ib_uverbs_destroy_cq_resp {
461 __u32 comp_events_reported;
462 __u32 async_events_reported;
465 struct ib_uverbs_global_route {
474 struct ib_uverbs_ah_attr {
475 struct ib_uverbs_global_route grh;
485 struct ib_uverbs_qp_attr {
490 __u32 path_mig_state;
495 __u32 qp_access_flags;
497 struct ib_uverbs_ah_attr ah_attr;
498 struct ib_uverbs_ah_attr alt_ah_attr;
505 __u32 max_inline_data;
508 __u16 alt_pkey_index;
509 __u8 en_sqd_async_notify;
512 __u8 max_dest_rd_atomic;
523 struct ib_uverbs_create_qp {
527 __u32 send_cq_handle;
528 __u32 recv_cq_handle;
534 __u32 max_inline_data;
539 __u64 driver_data[0];
542 enum ib_uverbs_create_qp_mask {
543 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0,
547 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
551 IB_USER_LEGACY_LAST_QP_ATTR_MASK = IB_QP_DEST_QPN
555 IB_USER_LAST_QP_ATTR_MASK = IB_QP_RATE_LIMIT
558 struct ib_uverbs_ex_create_qp {
561 __u32 send_cq_handle;
562 __u32 recv_cq_handle;
568 __u32 max_inline_data;
575 __u32 rwq_ind_tbl_handle;
579 struct ib_uverbs_open_qp {
586 __u64 driver_data[0];
589 /* also used for open response */
590 struct ib_uverbs_create_qp_resp {
597 __u32 max_inline_data;
601 struct ib_uverbs_ex_create_qp_resp {
602 struct ib_uverbs_create_qp_resp base;
604 __u32 response_length;
608 * This struct needs to remain a multiple of 8 bytes to keep the
609 * alignment of the modify QP parameters.
611 struct ib_uverbs_qp_dest {
626 struct ib_uverbs_query_qp {
630 __u64 driver_data[0];
633 struct ib_uverbs_query_qp_resp {
634 struct ib_uverbs_qp_dest dest;
635 struct ib_uverbs_qp_dest alt_dest;
640 __u32 max_inline_data;
645 __u32 qp_access_flags;
647 __u16 alt_pkey_index;
654 __u8 max_dest_rd_atomic;
664 __u64 driver_data[0];
667 struct ib_uverbs_modify_qp {
668 struct ib_uverbs_qp_dest dest;
669 struct ib_uverbs_qp_dest alt_dest;
676 __u32 qp_access_flags;
678 __u16 alt_pkey_index;
683 __u8 en_sqd_async_notify;
685 __u8 max_dest_rd_atomic;
694 __u64 driver_data[0];
697 struct ib_uverbs_ex_modify_qp {
698 struct ib_uverbs_modify_qp base;
703 struct ib_uverbs_modify_qp_resp {
706 struct ib_uverbs_ex_modify_qp_resp {
708 __u32 response_length;
711 struct ib_uverbs_destroy_qp {
717 struct ib_uverbs_destroy_qp_resp {
718 __u32 events_reported;
722 * The ib_uverbs_sge structure isn't used anywhere, since we assume
723 * the ib_sge structure is packed the same way on 32-bit and 64-bit
724 * architectures in both kernel and user space. It's just here to
727 struct ib_uverbs_sge {
733 struct ib_uverbs_send_wr {
740 __u32 invalidate_rkey;
764 struct ib_uverbs_post_send {
770 struct ib_uverbs_send_wr send_wr[0];
773 struct ib_uverbs_post_send_resp {
777 struct ib_uverbs_recv_wr {
783 struct ib_uverbs_post_recv {
789 struct ib_uverbs_recv_wr recv_wr[0];
792 struct ib_uverbs_post_recv_resp {
796 struct ib_uverbs_post_srq_recv {
802 struct ib_uverbs_recv_wr recv[0];
805 struct ib_uverbs_post_srq_recv_resp {
809 struct ib_uverbs_create_ah {
814 struct ib_uverbs_ah_attr attr;
817 struct ib_uverbs_create_ah_resp {
821 struct ib_uverbs_destroy_ah {
825 struct ib_uverbs_attach_mcast {
830 __u64 driver_data[0];
833 struct ib_uverbs_detach_mcast {
838 __u64 driver_data[0];
841 struct ib_uverbs_flow_spec_hdr {
845 /* followed by flow_spec */
846 __u64 flow_spec_data[0];
849 struct ib_uverbs_flow_eth_filter {
856 struct ib_uverbs_flow_spec_eth {
858 struct ib_uverbs_flow_spec_hdr hdr;
865 struct ib_uverbs_flow_eth_filter val;
866 struct ib_uverbs_flow_eth_filter mask;
869 struct ib_uverbs_flow_ipv4_filter {
878 struct ib_uverbs_flow_spec_ipv4 {
880 struct ib_uverbs_flow_spec_hdr hdr;
887 struct ib_uverbs_flow_ipv4_filter val;
888 struct ib_uverbs_flow_ipv4_filter mask;
891 struct ib_uverbs_flow_tcp_udp_filter {
896 struct ib_uverbs_flow_spec_tcp_udp {
898 struct ib_uverbs_flow_spec_hdr hdr;
905 struct ib_uverbs_flow_tcp_udp_filter val;
906 struct ib_uverbs_flow_tcp_udp_filter mask;
909 struct ib_uverbs_flow_ipv6_filter {
919 struct ib_uverbs_flow_spec_ipv6 {
921 struct ib_uverbs_flow_spec_hdr hdr;
928 struct ib_uverbs_flow_ipv6_filter val;
929 struct ib_uverbs_flow_ipv6_filter mask;
932 struct ib_uverbs_flow_tunnel_filter {
936 struct ib_uverbs_flow_spec_tunnel {
938 struct ib_uverbs_flow_spec_hdr hdr;
945 struct ib_uverbs_flow_tunnel_filter val;
946 struct ib_uverbs_flow_tunnel_filter mask;
949 struct ib_uverbs_flow_attr {
957 /* Following are the optional layers according to user request
958 * struct ib_flow_spec_xxx
959 * struct ib_flow_spec_yyy
961 struct ib_uverbs_flow_spec_hdr flow_specs[0];
964 struct ib_uverbs_create_flow {
967 struct ib_uverbs_flow_attr flow_attr;
970 struct ib_uverbs_create_flow_resp {
975 struct ib_uverbs_destroy_flow {
980 struct ib_uverbs_create_srq {
987 __u64 driver_data[0];
990 struct ib_uverbs_create_xsrq {
1001 __u64 driver_data[0];
1004 struct ib_uverbs_create_srq_resp {
1011 struct ib_uverbs_modify_srq {
1016 __u64 driver_data[0];
1019 struct ib_uverbs_query_srq {
1023 __u64 driver_data[0];
1026 struct ib_uverbs_query_srq_resp {
1033 struct ib_uverbs_destroy_srq {
1039 struct ib_uverbs_destroy_srq_resp {
1040 __u32 events_reported;
1043 struct ib_uverbs_ex_create_wq {
1053 struct ib_uverbs_ex_create_wq_resp {
1055 __u32 response_length;
1062 struct ib_uverbs_ex_destroy_wq {
1067 struct ib_uverbs_ex_destroy_wq_resp {
1069 __u32 response_length;
1070 __u32 events_reported;
1074 struct ib_uverbs_ex_modify_wq {
1078 __u32 curr_wq_state;
1081 /* Prevent memory allocation rather than max expected size */
1082 #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1083 struct ib_uverbs_ex_create_rwq_ind_table {
1085 __u32 log_ind_tbl_size;
1086 /* Following are the wq handles according to log_ind_tbl_size
1090 __u32 wq_handles[0];
1093 struct ib_uverbs_ex_create_rwq_ind_table_resp {
1095 __u32 response_length;
1096 __u32 ind_tbl_handle;
1100 struct ib_uverbs_ex_destroy_rwq_ind_table {
1102 __u32 ind_tbl_handle;
1105 #endif /* IB_USER_VERBS_H */