]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sys/dev/mlx5/mlx5_ib/user.h
MFC r322810 and r322830:
[FreeBSD/stable/10.git] / sys / dev / mlx5 / mlx5_ib / user.h
1 /*-
2  * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND
14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23  * SUCH DAMAGE.
24  *
25  * $FreeBSD$
26  */
27
28 #ifndef MLX5_IB_USER_H
29 #define MLX5_IB_USER_H
30
31 #include <linux/types.h>
32
33 enum {
34         MLX5_QP_FLAG_SIGNATURE          = 1 << 0,
35 };
36
37 enum {
38         MLX5_SRQ_FLAG_SIGNATURE         = 1 << 0,
39 };
40
41 enum {
42         MLX5_WQ_FLAG_SIGNATURE          = 1 << 0,
43 };
44
45
46 /* Increment this value if any changes that break userspace ABI
47  * compatibility are made.
48  */
49 #define MLX5_IB_UVERBS_ABI_VERSION      1
50
51 /* Make sure that all structs defined in this file remain laid out so
52  * that they pack the same way on 32-bit and 64-bit architectures (to
53  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
54  * In particular do not use pointer types -- pass pointers in __u64
55  * instead.
56  */
57
58 struct mlx5_ib_alloc_ucontext_req {
59         __u32   total_num_uuars;
60         __u32   num_low_latency_uuars;
61 };
62
63 struct mlx5_ib_alloc_ucontext_req_v2 {
64         __u32   total_num_uuars;
65         __u32   num_low_latency_uuars;
66         __u32   flags;
67         __u32   reserved;
68 };
69
70 struct mlx5_ib_alloc_ucontext_resp {
71         __u32   qp_tab_size;
72         __u32   bf_reg_size;
73         __u32   tot_uuars;
74         __u32   cache_line_size;
75         __u16   max_sq_desc_sz;
76         __u16   max_rq_desc_sz;
77         __u32   max_send_wqebb;
78         __u32   max_recv_wr;
79         __u32   max_srq_recv_wr;
80         __u16   num_ports;
81         __u16   reserved;
82         __u32   max_desc_sz_sq_dc;
83         __u32   atomic_arg_sizes_dc;
84         __u32   reserved1;
85         __u32   flags;
86         __u32   reserved2[5];
87 };
88
89 enum mlx5_exp_ib_alloc_ucontext_data_resp_mask {
90         MLX5_EXP_ALLOC_CTX_RESP_MASK_CQE_COMP_MAX_NUM           = 1 << 0,
91         MLX5_EXP_ALLOC_CTX_RESP_MASK_CQE_VERSION                = 1 << 1,
92         MLX5_EXP_ALLOC_CTX_RESP_MASK_RROCE_UDP_SPORT_MIN        = 1 << 2,
93         MLX5_EXP_ALLOC_CTX_RESP_MASK_RROCE_UDP_SPORT_MAX        = 1 << 3,
94         MLX5_EXP_ALLOC_CTX_RESP_MASK_HCA_CORE_CLOCK_OFFSET      = 1 << 4,
95 };
96
97 struct mlx5_exp_ib_alloc_ucontext_data_resp {
98         __u32   comp_mask; /* use mlx5_ib_exp_alloc_ucontext_data_resp_mask */
99         __u16   cqe_comp_max_num;
100         __u8    cqe_version;
101         __u8    reserved;
102         __u16   rroce_udp_sport_min;
103         __u16   rroce_udp_sport_max;
104         __u32   hca_core_clock_offset;
105 };
106
107 struct mlx5_exp_ib_alloc_ucontext_resp {
108         __u32                                           qp_tab_size;
109         __u32                                           bf_reg_size;
110         __u32                                           tot_uuars;
111         __u32                                           cache_line_size;
112         __u16                                           max_sq_desc_sz;
113         __u16                                           max_rq_desc_sz;
114         __u32                                           max_send_wqebb;
115         __u32                                           max_recv_wr;
116         __u32                                           max_srq_recv_wr;
117         __u16                                           num_ports;
118         __u16                                           reserved;
119         __u32                                           max_desc_sz_sq_dc;
120         __u32                                           atomic_arg_sizes_dc;
121         __u32                                           reserved1;
122         __u32                                           flags;
123         __u32                                           reserved2[5];
124         /* Some more reserved fields for
125          * future growth of mlx5_ib_alloc_ucontext_resp */
126         __u64                                           prefix_reserved[8];
127         struct mlx5_exp_ib_alloc_ucontext_data_resp     exp_data;
128 };
129
130 struct mlx5_ib_alloc_pd_resp {
131         __u32   pdn;
132 };
133
134 struct mlx5_ib_create_cq {
135         __u64   buf_addr;
136         __u64   db_addr;
137         __u32   cqe_size;
138         __u32   reserved; /* explicit padding (optional on i386) */
139 };
140
141 enum mlx5_exp_ib_create_cq_mask {
142         MLX5_EXP_CREATE_CQ_MASK_CQE_COMP_EN             = 1 << 0,
143         MLX5_EXP_CREATE_CQ_MASK_CQE_COMP_RECV_TYPE      = 1 << 1,
144         MLX5_EXP_CREATE_CQ_MASK_RESERVED                = 1 << 2,
145 };
146
147 enum mlx5_exp_cqe_comp_recv_type {
148         MLX5_IB_CQE_FORMAT_HASH,
149         MLX5_IB_CQE_FORMAT_CSUM,
150 };
151
152 struct mlx5_exp_ib_create_cq_data {
153         __u32   comp_mask; /* use mlx5_exp_ib_creaet_cq_mask */
154         __u8    cqe_comp_en;
155         __u8    cqe_comp_recv_type; /* use mlx5_exp_cqe_comp_recv_type */
156         __u16   reserved;
157 };
158
159 struct mlx5_exp_ib_create_cq {
160         __u64                                   buf_addr;
161         __u64                                   db_addr;
162         __u32                                   cqe_size;
163         __u32                                   reserved; /* explicit padding (optional on i386) */
164
165         /* Some more reserved fields for future growth of mlx5_ib_create_cq */
166         __u64                                   prefix_reserved[8];
167
168         /* sizeof prefix aligned with mlx5_ib_create_cq */
169         __u64                                   size_of_prefix;
170         struct mlx5_exp_ib_create_cq_data       exp_data;
171 };
172
173 struct mlx5_ib_create_cq_resp {
174         __u32   cqn;
175         __u32   reserved;
176 };
177
178 struct mlx5_ib_resize_cq {
179         __u64   buf_addr;
180         __u16   cqe_size;
181         __u16   reserved0;
182         __u32   reserved1;
183 };
184
185 struct mlx5_ib_create_srq {
186         __u64   buf_addr;
187         __u64   db_addr;
188         __u32   flags;
189         __u32   reserved; /* explicit padding (optional on i386) */
190         __u32   uidx;
191         __u32   reserved1;
192 };
193
194 struct mlx5_ib_create_srq_resp {
195         __u32   srqn;
196         __u32   reserved;
197 };
198
199 struct mlx5_ib_create_qp {
200         __u64   buf_addr;
201         __u64   db_addr;
202         __u32   sq_wqe_count;
203         __u32   rq_wqe_count;
204         __u32   rq_wqe_shift;
205         __u32   flags;
206 };
207
208 enum mlx5_exp_ib_create_qp_mask {
209         MLX5_EXP_CREATE_QP_MASK_UIDX            = 1 << 0,
210         MLX5_EXP_CREATE_QP_MASK_SQ_BUFF_ADD     = 1 << 1,
211         MLX5_EXP_CREATE_QP_MASK_WC_UAR_IDX      = 1 << 2,
212         MLX5_EXP_CREATE_QP_MASK_FLAGS_IDX       = 1 << 3,
213         MLX5_EXP_CREATE_QP_MASK_RESERVED        = 1 << 4,
214 };
215
216 enum mlx5_exp_create_qp_flags {
217         MLX5_EXP_CREATE_QP_MULTI_PACKET_WQE_REQ_FLAG = 1 << 0,
218 };
219
220 enum mlx5_exp_drv_create_qp_uar_idx {
221         MLX5_EXP_CREATE_QP_DB_ONLY_UUAR = -1
222 };
223
224 struct mlx5_exp_ib_create_qp_data {
225         __u32   comp_mask; /* use mlx5_exp_ib_create_qp_mask */
226         __u32   uidx;
227         __u64   sq_buf_addr;
228         __u32   wc_uar_index;
229         __u32   flags; /* use mlx5_exp_create_qp_flags */
230 };
231
232 struct mlx5_exp_ib_create_qp {
233         /* To allow casting to mlx5_ib_create_qp the prefix is the same as
234          * struct mlx5_ib_create_qp prefix
235          */
236         __u64   buf_addr;
237         __u64   db_addr;
238         __u32   sq_wqe_count;
239         __u32   rq_wqe_count;
240         __u32   rq_wqe_shift;
241         __u32   flags;
242
243         /* Some more reserved fields for future growth of mlx5_ib_create_qp */
244         __u64   prefix_reserved[8];
245
246         /* sizeof prefix aligned with mlx5_ib_create_qp */
247         __u64   size_of_prefix;
248
249         /* Experimental data
250          * Add new experimental data only inside the exp struct
251          */
252         struct mlx5_exp_ib_create_qp_data exp;
253 };
254
255 enum {
256         MLX5_EXP_INVALID_UUAR = -1,
257 };
258
259 struct mlx5_ib_create_qp_resp {
260         __u32   uuar_index;
261         __u32   rsvd;
262 };
263
264 enum mlx5_exp_ib_create_qp_resp_mask {
265         MLX5_EXP_CREATE_QP_RESP_MASK_FLAGS_IDX  = 1 << 0,
266         MLX5_EXP_CREATE_QP_RESP_MASK_RESERVED   = 1 << 1,
267 };
268
269 enum mlx5_exp_create_qp_resp_flags {
270         MLX5_EXP_CREATE_QP_RESP_MULTI_PACKET_WQE_FLAG = 1 << 0,
271 };
272
273 struct mlx5_exp_ib_create_qp_resp_data {
274         __u32   comp_mask; /* use mlx5_exp_ib_create_qp_resp_mask */
275         __u32   flags; /* use mlx5_exp_create_qp_resp_flags */
276 };
277
278 struct mlx5_exp_ib_create_qp_resp {
279         __u32   uuar_index;
280         __u32   rsvd;
281
282         /* Some more reserved fields for future growth of mlx5_ib_create_qp_resp */
283         __u64   prefix_reserved[8];
284
285         /* sizeof prefix aligned with mlx5_ib_create_qp_resp */
286         __u64   size_of_prefix;
287
288         /* Experimental data
289          * Add new experimental data only inside the exp struct
290          */
291         struct mlx5_exp_ib_create_qp_resp_data exp;
292 };
293
294 struct mlx5_ib_create_dct {
295         __u32   uidx;
296         __u32   reserved;
297 };
298
299 struct mlx5_ib_arm_dct {
300         __u64   reserved0;
301         __u64   reserved1;
302 };
303
304 struct mlx5_ib_arm_dct_resp {
305         __u64   reserved0;
306         __u64   reserved1;
307 };
308
309 struct mlx5_ib_create_wq {
310         __u64   buf_addr;
311         __u64   db_addr;
312         __u32   rq_wqe_count;
313         __u32   rq_wqe_shift;
314         __u32   user_index;
315         __u32   flags;
316 };
317
318 #endif /* MLX5_IB_USER_H */