xref: /linux/include/uapi/rdma/bnxt_re-abi.h (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2 /*
3  * Broadcom NetXtreme-E RoCE driver.
4  *
5  * Copyright (c) 2016 - 2017, Broadcom. All rights reserved.  The term
6  * Broadcom refers to Broadcom Limited and/or its subsidiaries.
7  *
8  * This software is available to you under a choice of one of two
9  * licenses.  You may choose to be licensed under the terms of the GNU
10  * General Public License (GPL) Version 2, available from the file
11  * COPYING in the main directory of this source tree, or the
12  * BSD license below:
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  *
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in
22  *    the documentation and/or other materials provided with the
23  *    distribution.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
29  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
35  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * Description: Uverbs ABI header file
38  */
39 
40 #ifndef __BNXT_RE_UVERBS_ABI_H__
41 #define __BNXT_RE_UVERBS_ABI_H__
42 
43 #include <linux/types.h>
44 #include <rdma/ib_user_ioctl_cmds.h>
45 
46 #define BNXT_RE_ABI_VERSION	1
47 
48 #define BNXT_RE_CHIP_ID0_CHIP_NUM_SFT		0x00
49 #define BNXT_RE_CHIP_ID0_CHIP_REV_SFT		0x10
50 #define BNXT_RE_CHIP_ID0_CHIP_MET_SFT		0x18
51 
52 enum {
53 	BNXT_RE_UCNTX_CMASK_HAVE_CCTX = 0x1ULL,
54 	BNXT_RE_UCNTX_CMASK_HAVE_MODE = 0x02ULL,
55 	BNXT_RE_UCNTX_CMASK_WC_DPI_ENABLED = 0x04ULL,
56 	BNXT_RE_UCNTX_CMASK_DBR_PACING_ENABLED = 0x08ULL,
57 	BNXT_RE_UCNTX_CMASK_POW2_DISABLED = 0x10ULL,
58 	BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED = 0x40,
59 };
60 
61 enum bnxt_re_wqe_mode {
62 	BNXT_QPLIB_WQE_MODE_STATIC	= 0x00,
63 	BNXT_QPLIB_WQE_MODE_VARIABLE	= 0x01,
64 	BNXT_QPLIB_WQE_MODE_INVALID	= 0x02,
65 };
66 
67 enum {
68 	BNXT_RE_COMP_MASK_REQ_UCNTX_POW2_SUPPORT = 0x01,
69 	BNXT_RE_COMP_MASK_REQ_UCNTX_VAR_WQE_SUPPORT = 0x02,
70 };
71 
72 struct bnxt_re_uctx_req {
73 	__aligned_u64 comp_mask;
74 };
75 
76 struct bnxt_re_uctx_resp {
77 	__u32 dev_id;
78 	__u32 max_qp;
79 	__u32 pg_size;
80 	__u32 cqe_sz;
81 	__u32 max_cqd;
82 	__u32 rsvd;
83 	__aligned_u64 comp_mask;
84 	__u32 chip_id0;
85 	__u32 chip_id1;
86 	__u32 mode;
87 	__u32 rsvd1; /* padding */
88 };
89 
90 /*
91  * This struct is placed after the ib_uverbs_alloc_pd_resp struct, which is
92  * not 8 byted aligned. To avoid undesired padding in various cases we have to
93  * set this struct to packed.
94  */
95 struct bnxt_re_pd_resp {
96 	__u32 pdid;
97 	__u32 dpi;
98 	__u64 dbr;
99 } __attribute__((packed, aligned(4)));
100 
101 struct bnxt_re_cq_req {
102 	__aligned_u64 cq_va;
103 	__aligned_u64 cq_handle;
104 };
105 
106 enum bnxt_re_cq_mask {
107 	BNXT_RE_CQ_TOGGLE_PAGE_SUPPORT = 0x1,
108 };
109 
110 struct bnxt_re_cq_resp {
111 	__u32 cqid;
112 	__u32 tail;
113 	__u32 phase;
114 	__u32 rsvd;
115 	__aligned_u64 comp_mask;
116 };
117 
118 struct bnxt_re_resize_cq_req {
119 	__aligned_u64 cq_va;
120 };
121 
122 enum bnxt_re_qp_mask {
123 	BNXT_RE_QP_REQ_MASK_VAR_WQE_SQ_SLOTS = 0x1,
124 };
125 
126 struct bnxt_re_qp_req {
127 	__aligned_u64 qpsva;
128 	__aligned_u64 qprva;
129 	__aligned_u64 qp_handle;
130 	__aligned_u64 comp_mask;
131 	__u32 sq_slots;
132 };
133 
134 struct bnxt_re_qp_resp {
135 	__u32 qpid;
136 	__u32 rsvd;
137 };
138 
139 struct bnxt_re_srq_req {
140 	__aligned_u64 srqva;
141 	__aligned_u64 srq_handle;
142 };
143 
144 enum bnxt_re_srq_mask {
145 	BNXT_RE_SRQ_TOGGLE_PAGE_SUPPORT = 0x1,
146 };
147 
148 struct bnxt_re_srq_resp {
149 	__u32 srqid;
150 	__u32 rsvd; /* padding */
151 	__aligned_u64 comp_mask;
152 };
153 
154 enum bnxt_re_shpg_offt {
155 	BNXT_RE_BEG_RESV_OFFT	= 0x00,
156 	BNXT_RE_AVID_OFFT	= 0x10,
157 	BNXT_RE_AVID_SIZE	= 0x04,
158 	BNXT_RE_END_RESV_OFFT	= 0xFF0
159 };
160 
161 enum bnxt_re_objects {
162 	BNXT_RE_OBJECT_ALLOC_PAGE = (1U << UVERBS_ID_NS_SHIFT),
163 	BNXT_RE_OBJECT_NOTIFY_DRV,
164 	BNXT_RE_OBJECT_GET_TOGGLE_MEM,
165 };
166 
167 enum bnxt_re_alloc_page_type {
168 	BNXT_RE_ALLOC_WC_PAGE = 0,
169 	BNXT_RE_ALLOC_DBR_BAR_PAGE,
170 	BNXT_RE_ALLOC_DBR_PAGE,
171 };
172 
173 enum bnxt_re_var_alloc_page_attrs {
174 	BNXT_RE_ALLOC_PAGE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
175 	BNXT_RE_ALLOC_PAGE_TYPE,
176 	BNXT_RE_ALLOC_PAGE_DPI,
177 	BNXT_RE_ALLOC_PAGE_MMAP_OFFSET,
178 	BNXT_RE_ALLOC_PAGE_MMAP_LENGTH,
179 };
180 
181 enum bnxt_re_alloc_page_attrs {
182 	BNXT_RE_DESTROY_PAGE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
183 };
184 
185 enum bnxt_re_alloc_page_methods {
186 	BNXT_RE_METHOD_ALLOC_PAGE = (1U << UVERBS_ID_NS_SHIFT),
187 	BNXT_RE_METHOD_DESTROY_PAGE,
188 };
189 
190 enum bnxt_re_notify_drv_methods {
191 	BNXT_RE_METHOD_NOTIFY_DRV = (1U << UVERBS_ID_NS_SHIFT),
192 };
193 
194 /* Toggle mem */
195 
196 enum bnxt_re_get_toggle_mem_type {
197 	BNXT_RE_CQ_TOGGLE_MEM = 0,
198 	BNXT_RE_SRQ_TOGGLE_MEM,
199 };
200 
201 enum bnxt_re_var_toggle_mem_attrs {
202 	BNXT_RE_TOGGLE_MEM_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
203 	BNXT_RE_TOGGLE_MEM_TYPE,
204 	BNXT_RE_TOGGLE_MEM_RES_ID,
205 	BNXT_RE_TOGGLE_MEM_MMAP_PAGE,
206 	BNXT_RE_TOGGLE_MEM_MMAP_OFFSET,
207 	BNXT_RE_TOGGLE_MEM_MMAP_LENGTH,
208 };
209 
210 enum bnxt_re_toggle_mem_attrs {
211 	BNXT_RE_RELEASE_TOGGLE_MEM_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
212 };
213 
214 enum bnxt_re_toggle_mem_methods {
215 	BNXT_RE_METHOD_GET_TOGGLE_MEM = (1U << UVERBS_ID_NS_SHIFT),
216 	BNXT_RE_METHOD_RELEASE_TOGGLE_MEM,
217 };
218 #endif /* __BNXT_RE_UVERBS_ABI_H__*/
219