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_CQ
= IB_USER_VERBS_CMD_CREATE_CQ
,
95 IB_USER_VERBS_EX_CMD_CREATE_QP
= IB_USER_VERBS_CMD_CREATE_QP
,
96 IB_USER_VERBS_EX_CMD_MODIFY_QP
= IB_USER_VERBS_CMD_MODIFY_QP
,
97 IB_USER_VERBS_EX_CMD_CREATE_FLOW
= IB_USER_VERBS_CMD_THRESHOLD
,
98 IB_USER_VERBS_EX_CMD_DESTROY_FLOW
,
99 IB_USER_VERBS_EX_CMD_CREATE_WQ
,
100 IB_USER_VERBS_EX_CMD_MODIFY_WQ
,
101 IB_USER_VERBS_EX_CMD_DESTROY_WQ
,
102 IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL
,
103 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL
107 * Make sure that all structs defined in this file remain laid out so
108 * that they pack the same way on 32-bit and 64-bit architectures (to
109 * avoid incompatibility between 32-bit userspace and 64-bit kernels).
111 * - Do not use pointer types -- pass pointers in __u64 instead.
112 * - Make sure that any structure larger than 4 bytes is padded to a
113 * multiple of 8 bytes. Otherwise the structure size will be
114 * different between 32-bit and 64-bit architectures.
117 struct ib_uverbs_async_event_desc
{
119 __u32 event_type
; /* enum ib_event_type */
123 struct ib_uverbs_comp_event_desc
{
128 * All commands from userspace should start with a __u32 command field
129 * followed by __u16 in_words and out_words fields (which give the
130 * length of the command block and response buffer if any in 32-bit
131 * words). The kernel driver will read these fields first and read
132 * the rest of the command struct based on these value.
135 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff
136 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u
137 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24
139 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80
141 struct ib_uverbs_cmd_hdr
{
147 struct ib_uverbs_ex_cmd_hdr
{
149 __u16 provider_in_words
;
150 __u16 provider_out_words
;
151 __u32 cmd_hdr_reserved
;
154 struct ib_uverbs_get_context
{
156 __u64 driver_data
[0];
159 struct ib_uverbs_get_context_resp
{
161 __u32 num_comp_vectors
;
164 struct ib_uverbs_query_device
{
166 __u64 driver_data
[0];
169 struct ib_uverbs_query_device_resp
{
172 __be64 sys_image_guid
;
176 __u32 vendor_part_id
;
180 __u32 device_cap_flags
;
187 __u32 max_qp_rd_atom
;
188 __u32 max_ee_rd_atom
;
189 __u32 max_res_rd_atom
;
190 __u32 max_qp_init_rd_atom
;
191 __u32 max_ee_init_rd_atom
;
196 __u32 max_raw_ipv6_qp
;
197 __u32 max_raw_ethy_qp
;
199 __u32 max_mcast_qp_attach
;
200 __u32 max_total_mcast_qp_attach
;
203 __u32 max_map_per_fmr
;
208 __u8 local_ca_ack_delay
;
213 struct ib_uverbs_ex_query_device
{
218 struct ib_uverbs_odp_caps
{
224 } per_transport_caps
;
228 struct ib_uverbs_rss_caps
{
229 /* Corresponding bit will be set if qp type from
230 * 'enum ib_qp_type' is supported, e.g.
231 * supported_qpts |= 1 << IB_QPT_UD
233 __u32 supported_qpts
;
234 __u32 max_rwq_indirection_tables
;
235 __u32 max_rwq_indirection_table_size
;
239 struct ib_uverbs_ex_query_device_resp
{
240 struct ib_uverbs_query_device_resp base
;
242 __u32 response_length
;
243 struct ib_uverbs_odp_caps odp_caps
;
244 __u64 timestamp_mask
;
245 __u64 hca_core_clock
; /* in KHZ */
246 __u64 device_cap_flags_ex
;
247 struct ib_uverbs_rss_caps rss_caps
;
248 __u32 max_wq_type_rq
;
249 __u32 raw_packet_caps
;
252 struct ib_uverbs_query_port
{
256 __u64 driver_data
[0];
259 struct ib_uverbs_query_port_resp
{
260 __u32 port_cap_flags
;
263 __u32 qkey_viol_cntr
;
275 __u8 init_type_reply
;
283 struct ib_uverbs_alloc_pd
{
285 __u64 driver_data
[0];
288 struct ib_uverbs_alloc_pd_resp
{
292 struct ib_uverbs_dealloc_pd
{
296 struct ib_uverbs_open_xrcd
{
300 __u64 driver_data
[0];
303 struct ib_uverbs_open_xrcd_resp
{
307 struct ib_uverbs_close_xrcd
{
311 struct ib_uverbs_reg_mr
{
318 __u64 driver_data
[0];
321 struct ib_uverbs_reg_mr_resp
{
327 struct ib_uverbs_rereg_mr
{
338 struct ib_uverbs_rereg_mr_resp
{
343 struct ib_uverbs_dereg_mr
{
347 struct ib_uverbs_alloc_mw
{
354 struct ib_uverbs_alloc_mw_resp
{
359 struct ib_uverbs_dealloc_mw
{
363 struct ib_uverbs_create_comp_channel
{
367 struct ib_uverbs_create_comp_channel_resp
{
371 struct ib_uverbs_create_cq
{
378 __u64 driver_data
[0];
381 struct ib_uverbs_ex_create_cq
{
391 struct ib_uverbs_create_cq_resp
{
396 struct ib_uverbs_ex_create_cq_resp
{
397 struct ib_uverbs_create_cq_resp base
;
399 __u32 response_length
;
402 struct ib_uverbs_resize_cq
{
406 __u64 driver_data
[0];
409 struct ib_uverbs_resize_cq_resp
{
412 __u64 driver_data
[0];
415 struct ib_uverbs_poll_cq
{
421 struct ib_uverbs_wc
{
429 __u32 invalidate_rkey
;
442 struct ib_uverbs_poll_cq_resp
{
445 struct ib_uverbs_wc wc
[0];
448 struct ib_uverbs_req_notify_cq
{
450 __u32 solicited_only
;
453 struct ib_uverbs_destroy_cq
{
459 struct ib_uverbs_destroy_cq_resp
{
460 __u32 comp_events_reported
;
461 __u32 async_events_reported
;
464 struct ib_uverbs_global_route
{
473 struct ib_uverbs_ah_attr
{
474 struct ib_uverbs_global_route grh
;
484 struct ib_uverbs_qp_attr
{
489 __u32 path_mig_state
;
494 __u32 qp_access_flags
;
496 struct ib_uverbs_ah_attr ah_attr
;
497 struct ib_uverbs_ah_attr alt_ah_attr
;
504 __u32 max_inline_data
;
507 __u16 alt_pkey_index
;
508 __u8 en_sqd_async_notify
;
511 __u8 max_dest_rd_atomic
;
522 struct ib_uverbs_create_qp
{
526 __u32 send_cq_handle
;
527 __u32 recv_cq_handle
;
533 __u32 max_inline_data
;
538 __u64 driver_data
[0];
541 enum ib_uverbs_create_qp_mask
{
542 IB_UVERBS_CREATE_QP_MASK_IND_TABLE
= 1UL << 0,
546 IB_UVERBS_CREATE_QP_SUP_COMP_MASK
= IB_UVERBS_CREATE_QP_MASK_IND_TABLE
,
551 * This value is equal to IB_QP_DEST_QPN.
553 IB_USER_LEGACY_LAST_QP_ATTR_MASK
= 1ULL << 20,
558 * This value is equal to IB_QP_RATE_LIMIT.
560 IB_USER_LAST_QP_ATTR_MASK
= 1ULL << 25,
563 struct ib_uverbs_ex_create_qp
{
566 __u32 send_cq_handle
;
567 __u32 recv_cq_handle
;
573 __u32 max_inline_data
;
580 __u32 rwq_ind_tbl_handle
;
584 struct ib_uverbs_open_qp
{
591 __u64 driver_data
[0];
594 /* also used for open response */
595 struct ib_uverbs_create_qp_resp
{
602 __u32 max_inline_data
;
606 struct ib_uverbs_ex_create_qp_resp
{
607 struct ib_uverbs_create_qp_resp base
;
609 __u32 response_length
;
613 * This struct needs to remain a multiple of 8 bytes to keep the
614 * alignment of the modify QP parameters.
616 struct ib_uverbs_qp_dest
{
631 struct ib_uverbs_query_qp
{
635 __u64 driver_data
[0];
638 struct ib_uverbs_query_qp_resp
{
639 struct ib_uverbs_qp_dest dest
;
640 struct ib_uverbs_qp_dest alt_dest
;
645 __u32 max_inline_data
;
650 __u32 qp_access_flags
;
652 __u16 alt_pkey_index
;
659 __u8 max_dest_rd_atomic
;
669 __u64 driver_data
[0];
672 struct ib_uverbs_modify_qp
{
673 struct ib_uverbs_qp_dest dest
;
674 struct ib_uverbs_qp_dest alt_dest
;
681 __u32 qp_access_flags
;
683 __u16 alt_pkey_index
;
688 __u8 en_sqd_async_notify
;
690 __u8 max_dest_rd_atomic
;
699 __u64 driver_data
[0];
702 struct ib_uverbs_ex_modify_qp
{
703 struct ib_uverbs_modify_qp base
;
708 struct ib_uverbs_modify_qp_resp
{
711 struct ib_uverbs_ex_modify_qp_resp
{
713 __u32 response_length
;
716 struct ib_uverbs_destroy_qp
{
722 struct ib_uverbs_destroy_qp_resp
{
723 __u32 events_reported
;
727 * The ib_uverbs_sge structure isn't used anywhere, since we assume
728 * the ib_sge structure is packed the same way on 32-bit and 64-bit
729 * architectures in both kernel and user space. It's just here to
732 struct ib_uverbs_sge
{
738 struct ib_uverbs_send_wr
{
745 __u32 invalidate_rkey
;
769 struct ib_uverbs_post_send
{
775 struct ib_uverbs_send_wr send_wr
[0];
778 struct ib_uverbs_post_send_resp
{
782 struct ib_uverbs_recv_wr
{
788 struct ib_uverbs_post_recv
{
794 struct ib_uverbs_recv_wr recv_wr
[0];
797 struct ib_uverbs_post_recv_resp
{
801 struct ib_uverbs_post_srq_recv
{
807 struct ib_uverbs_recv_wr recv
[0];
810 struct ib_uverbs_post_srq_recv_resp
{
814 struct ib_uverbs_create_ah
{
819 struct ib_uverbs_ah_attr attr
;
822 struct ib_uverbs_create_ah_resp
{
826 struct ib_uverbs_destroy_ah
{
830 struct ib_uverbs_attach_mcast
{
835 __u64 driver_data
[0];
838 struct ib_uverbs_detach_mcast
{
843 __u64 driver_data
[0];
846 struct ib_uverbs_flow_spec_hdr
{
850 /* followed by flow_spec */
851 __u64 flow_spec_data
[0];
854 struct ib_uverbs_flow_eth_filter
{
861 struct ib_uverbs_flow_spec_eth
{
863 struct ib_uverbs_flow_spec_hdr hdr
;
870 struct ib_uverbs_flow_eth_filter val
;
871 struct ib_uverbs_flow_eth_filter mask
;
874 struct ib_uverbs_flow_ipv4_filter
{
883 struct ib_uverbs_flow_spec_ipv4
{
885 struct ib_uverbs_flow_spec_hdr hdr
;
892 struct ib_uverbs_flow_ipv4_filter val
;
893 struct ib_uverbs_flow_ipv4_filter mask
;
896 struct ib_uverbs_flow_tcp_udp_filter
{
901 struct ib_uverbs_flow_spec_tcp_udp
{
903 struct ib_uverbs_flow_spec_hdr hdr
;
910 struct ib_uverbs_flow_tcp_udp_filter val
;
911 struct ib_uverbs_flow_tcp_udp_filter mask
;
914 struct ib_uverbs_flow_ipv6_filter
{
924 struct ib_uverbs_flow_spec_ipv6
{
926 struct ib_uverbs_flow_spec_hdr hdr
;
933 struct ib_uverbs_flow_ipv6_filter val
;
934 struct ib_uverbs_flow_ipv6_filter mask
;
937 struct ib_uverbs_flow_spec_action_tag
{
939 struct ib_uverbs_flow_spec_hdr hdr
;
950 struct ib_uverbs_flow_tunnel_filter
{
954 struct ib_uverbs_flow_spec_tunnel
{
956 struct ib_uverbs_flow_spec_hdr hdr
;
963 struct ib_uverbs_flow_tunnel_filter val
;
964 struct ib_uverbs_flow_tunnel_filter mask
;
967 struct ib_uverbs_flow_attr
{
975 /* Following are the optional layers according to user request
976 * struct ib_flow_spec_xxx
977 * struct ib_flow_spec_yyy
979 struct ib_uverbs_flow_spec_hdr flow_specs
[0];
982 struct ib_uverbs_create_flow
{
985 struct ib_uverbs_flow_attr flow_attr
;
988 struct ib_uverbs_create_flow_resp
{
993 struct ib_uverbs_destroy_flow
{
998 struct ib_uverbs_create_srq
{
1005 __u64 driver_data
[0];
1008 struct ib_uverbs_create_xsrq
{
1019 __u64 driver_data
[0];
1022 struct ib_uverbs_create_srq_resp
{
1029 struct ib_uverbs_modify_srq
{
1034 __u64 driver_data
[0];
1037 struct ib_uverbs_query_srq
{
1041 __u64 driver_data
[0];
1044 struct ib_uverbs_query_srq_resp
{
1051 struct ib_uverbs_destroy_srq
{
1057 struct ib_uverbs_destroy_srq_resp
{
1058 __u32 events_reported
;
1061 struct ib_uverbs_ex_create_wq
{
1069 __u32 create_flags
; /* Use enum ib_wq_flags */
1073 struct ib_uverbs_ex_create_wq_resp
{
1075 __u32 response_length
;
1082 struct ib_uverbs_ex_destroy_wq
{
1087 struct ib_uverbs_ex_destroy_wq_resp
{
1089 __u32 response_length
;
1090 __u32 events_reported
;
1094 struct ib_uverbs_ex_modify_wq
{
1098 __u32 curr_wq_state
;
1099 __u32 flags
; /* Use enum ib_wq_flags */
1100 __u32 flags_mask
; /* Use enum ib_wq_flags */
1103 /* Prevent memory allocation rather than max expected size */
1104 #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d
1105 struct ib_uverbs_ex_create_rwq_ind_table
{
1107 __u32 log_ind_tbl_size
;
1108 /* Following are the wq handles according to log_ind_tbl_size
1112 __u32 wq_handles
[0];
1115 struct ib_uverbs_ex_create_rwq_ind_table_resp
{
1117 __u32 response_length
;
1118 __u32 ind_tbl_handle
;
1122 struct ib_uverbs_ex_destroy_rwq_ind_table
{
1124 __u32 ind_tbl_handle
;
1127 #endif /* IB_USER_VERBS_H */