xref: /linux/drivers/infiniband/hw/bnxt_re/roce_hsi.h (revision 95298d63c67673c654c08952672d016212b26054)
1 /*
2  * Broadcom NetXtreme-E RoCE driver.
3  *
4  * Copyright (c) 2016 - 2017, Broadcom. All rights reserved.  The term
5  * Broadcom refers to Broadcom Limited and/or its subsidiaries.
6  *
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  * BSD license below:
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  *
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in
21  *    the documentation and/or other materials provided with the
22  *    distribution.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
28  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  * Description: RoCE HSI File - Autogenerated
37  */
38 
39 #ifndef __BNXT_RE_HSI_H__
40 #define __BNXT_RE_HSI_H__
41 
42 /* include bnxt_hsi.h from bnxt_en driver */
43 #include "bnxt_hsi.h"
44 
45 /* CMP Door Bell Format (4 bytes) */
46 struct cmpl_doorbell {
47 	__le32 key_mask_valid_idx;
48 	#define CMPL_DOORBELL_IDX_MASK				    0xffffffUL
49 	#define CMPL_DOORBELL_IDX_SFT				    0
50 	#define CMPL_DOORBELL_RESERVED_MASK			    0x3000000UL
51 	#define CMPL_DOORBELL_RESERVED_SFT			    24
52 	#define CMPL_DOORBELL_IDX_VALID				    0x4000000UL
53 	#define CMPL_DOORBELL_MASK				    0x8000000UL
54 	#define CMPL_DOORBELL_KEY_MASK				    0xf0000000UL
55 	#define CMPL_DOORBELL_KEY_SFT				    28
56 	#define CMPL_DOORBELL_KEY_CMPL				(0x2UL << 28)
57 };
58 
59 /* Status Door Bell Format (4 bytes) */
60 struct status_doorbell {
61 	__le32 key_idx;
62 	#define STATUS_DOORBELL_IDX_MASK			    0xffffffUL
63 	#define STATUS_DOORBELL_IDX_SFT			    0
64 	#define STATUS_DOORBELL_RESERVED_MASK			    0xf000000UL
65 	#define STATUS_DOORBELL_RESERVED_SFT			    24
66 	#define STATUS_DOORBELL_KEY_MASK			    0xf0000000UL
67 	#define STATUS_DOORBELL_KEY_SFT			    28
68 	#define STATUS_DOORBELL_KEY_STAT			   (0x3UL << 28)
69 };
70 
71 /* RoCE Host Structures */
72 
73 /* Doorbell Structures */
74 /* dbc_dbc (size:64b/8B) */
75 struct dbc_dbc {
76 	__le32  index;
77 	#define DBC_DBC_INDEX_MASK		0xffffffUL
78 	#define DBC_DBC_INDEX_SFT		0
79 	__le32  type_path_xid;
80 	#define DBC_DBC_XID_MASK		0xfffffUL
81 	#define DBC_DBC_XID_SFT			0
82 	#define DBC_DBC_PATH_MASK		0x3000000UL
83 	#define DBC_DBC_PATH_SFT		24
84 	#define DBC_DBC_PATH_ROCE		(0x0UL << 24)
85 	#define DBC_DBC_PATH_L2			(0x1UL << 24)
86 	#define DBC_DBC_PATH_ENGINE		(0x2UL << 24)
87 	#define DBC_DBC_PATH_LAST		DBC_DBC_PATH_ENGINE
88 	#define DBC_DBC_DEBUG_TRACE		0x8000000UL
89 	#define DBC_DBC_TYPE_MASK		0xf0000000UL
90 	#define DBC_DBC_TYPE_SFT		28
91 	#define DBC_DBC_TYPE_SQ			(0x0UL << 28)
92 	#define DBC_DBC_TYPE_RQ			(0x1UL << 28)
93 	#define DBC_DBC_TYPE_SRQ		(0x2UL << 28)
94 	#define DBC_DBC_TYPE_SRQ_ARM		(0x3UL << 28)
95 	#define DBC_DBC_TYPE_CQ			(0x4UL << 28)
96 	#define DBC_DBC_TYPE_CQ_ARMSE		(0x5UL << 28)
97 	#define DBC_DBC_TYPE_CQ_ARMALL		(0x6UL << 28)
98 	#define DBC_DBC_TYPE_CQ_ARMENA		(0x7UL << 28)
99 	#define DBC_DBC_TYPE_SRQ_ARMENA		(0x8UL << 28)
100 	#define DBC_DBC_TYPE_CQ_CUTOFF_ACK	(0x9UL << 28)
101 	#define DBC_DBC_TYPE_NQ			(0xaUL << 28)
102 	#define DBC_DBC_TYPE_NQ_ARM		(0xbUL << 28)
103 	#define DBC_DBC_TYPE_NULL		(0xfUL << 28)
104 	#define DBC_DBC_TYPE_LAST		DBC_DBC_TYPE_NULL
105 };
106 
107 /* dbc_dbc32 (size:32b/4B) */
108 struct dbc_dbc32 {
109 	__le32  type_abs_incr_xid;
110 	#define DBC_DBC32_XID_MASK		0xfffffUL
111 	#define DBC_DBC32_XID_SFT		0
112 	#define DBC_DBC32_PATH_MASK		0xc00000UL
113 	#define DBC_DBC32_PATH_SFT		22
114 	#define DBC_DBC32_PATH_ROCE		(0x0UL << 22)
115 	#define DBC_DBC32_PATH_L2		(0x1UL << 22)
116 	#define DBC_DBC32_PATH_LAST		DBC_DBC32_PATH_L2
117 	#define DBC_DBC32_INCR_MASK		0xf000000UL
118 	#define DBC_DBC32_INCR_SFT		24
119 	#define DBC_DBC32_ABS			0x10000000UL
120 	#define DBC_DBC32_TYPE_MASK		0xe0000000UL
121 	#define DBC_DBC32_TYPE_SFT		29
122 	#define DBC_DBC32_TYPE_SQ		(0x0UL << 29)
123 	#define DBC_DBC32_TYPE_LAST		DBC_DBC32_TYPE_SQ
124 };
125 
126 /* SQ WQE Structures */
127 /* Base SQ WQE (8 bytes) */
128 struct sq_base {
129 	u8 wqe_type;
130 	#define SQ_BASE_WQE_TYPE_SEND				   0x0UL
131 	#define SQ_BASE_WQE_TYPE_SEND_W_IMMEAD			   0x1UL
132 	#define SQ_BASE_WQE_TYPE_SEND_W_INVALID		   0x2UL
133 	#define SQ_BASE_WQE_TYPE_WRITE_WQE			   0x4UL
134 	#define SQ_BASE_WQE_TYPE_WRITE_W_IMMEAD		   0x5UL
135 	#define SQ_BASE_WQE_TYPE_READ_WQE			   0x6UL
136 	#define SQ_BASE_WQE_TYPE_ATOMIC_CS			   0x8UL
137 	#define SQ_BASE_WQE_TYPE_ATOMIC_FA			   0xbUL
138 	#define SQ_BASE_WQE_TYPE_LOCAL_INVALID			   0xcUL
139 	#define SQ_BASE_WQE_TYPE_FR_PMR			   0xdUL
140 	#define SQ_BASE_WQE_TYPE_BIND				   0xeUL
141 	u8 unused_0[7];
142 };
143 
144 /* WQE SGE (16 bytes) */
145 struct sq_sge {
146 	__le64 va_or_pa;
147 	__le32 l_key;
148 	__le32 size;
149 };
150 
151 /* PSN Search Structure (8 bytes) */
152 struct sq_psn_search {
153 	__le32 opcode_start_psn;
154 	#define SQ_PSN_SEARCH_START_PSN_MASK			    0xffffffUL
155 	#define SQ_PSN_SEARCH_START_PSN_SFT			    0
156 	#define SQ_PSN_SEARCH_OPCODE_MASK			    0xff000000UL
157 	#define SQ_PSN_SEARCH_OPCODE_SFT			    24
158 	__le32 flags_next_psn;
159 	#define SQ_PSN_SEARCH_NEXT_PSN_MASK			    0xffffffUL
160 	#define SQ_PSN_SEARCH_NEXT_PSN_SFT			    0
161 	#define SQ_PSN_SEARCH_FLAGS_MASK			    0xff000000UL
162 	#define SQ_PSN_SEARCH_FLAGS_SFT				    24
163 };
164 
165 /* sq_psn_search_ext (size:128b/16B) */
166 struct sq_psn_search_ext {
167 	__le32  opcode_start_psn;
168 	#define SQ_PSN_SEARCH_EXT_START_PSN_MASK		    0xffffffUL
169 	#define SQ_PSN_SEARCH_EXT_START_PSN_SFT			    0
170 	#define SQ_PSN_SEARCH_EXT_OPCODE_MASK			    0xff000000UL
171 	#define SQ_PSN_SEARCH_EXT_OPCODE_SFT			    24
172 	__le32  flags_next_psn;
173 	#define SQ_PSN_SEARCH_EXT_NEXT_PSN_MASK			    0xffffffUL
174 	#define SQ_PSN_SEARCH_EXT_NEXT_PSN_SFT			    0
175 	#define SQ_PSN_SEARCH_EXT_FLAGS_MASK			    0xff000000UL
176 	#define SQ_PSN_SEARCH_EXT_FLAGS_SFT			    24
177 	__le16  start_slot_idx;
178 	__le16  reserved16;
179 	__le32  reserved32;
180 };
181 
182 /* Send SQ WQE (40 bytes) */
183 struct sq_send {
184 	u8 wqe_type;
185 	#define SQ_SEND_WQE_TYPE_SEND				   0x0UL
186 	#define SQ_SEND_WQE_TYPE_SEND_W_IMMEAD			   0x1UL
187 	#define SQ_SEND_WQE_TYPE_SEND_W_INVALID		   0x2UL
188 	u8 flags;
189 	#define SQ_SEND_FLAGS_SIGNAL_COMP			    0x1UL
190 	#define SQ_SEND_FLAGS_RD_OR_ATOMIC_FENCE		    0x2UL
191 	#define SQ_SEND_FLAGS_UC_FENCE				    0x4UL
192 	#define SQ_SEND_FLAGS_SE				    0x8UL
193 	#define SQ_SEND_FLAGS_INLINE				    0x10UL
194 	u8 wqe_size;
195 	u8 reserved8_1;
196 	__le32 inv_key_or_imm_data;
197 	__le32 length;
198 	__le32 q_key;
199 	__le32 dst_qp;
200 	#define SQ_SEND_DST_QP_MASK				    0xffffffUL
201 	#define SQ_SEND_DST_QP_SFT				    0
202 	#define SQ_SEND_RESERVED8_2_MASK			    0xff000000UL
203 	#define SQ_SEND_RESERVED8_2_SFT			    24
204 	__le32 avid;
205 	#define SQ_SEND_AVID_MASK				    0xfffffUL
206 	#define SQ_SEND_AVID_SFT				    0
207 	#define SQ_SEND_RESERVED_AVID_MASK			    0xfff00000UL
208 	#define SQ_SEND_RESERVED_AVID_SFT			    20
209 	__le64 reserved64;
210 	__le32 data[24];
211 };
212 
213 /* sq_send_hdr (size:256b/32B) */
214 struct sq_send_hdr {
215 	u8	wqe_type;
216 	u8	flags;
217 	u8	wqe_size;
218 	u8	reserved8_1;
219 	__le32	inv_key_or_imm_data;
220 	__le32	length;
221 	__le32	q_key;
222 	__le32	dst_qp;
223 	__le32	avid;
224 	__le64	reserved64;
225 };
226 
227 /* Send Raw Ethernet and QP1 SQ WQE (40 bytes) */
228 struct sq_send_raweth_qp1 {
229 	u8 wqe_type;
230 	#define SQ_SEND_RAWETH_QP1_WQE_TYPE_SEND		   0x0UL
231 	u8 flags;
232 	#define SQ_SEND_RAWETH_QP1_FLAGS_SIGNAL_COMP		    0x1UL
233 	#define SQ_SEND_RAWETH_QP1_FLAGS_RD_OR_ATOMIC_FENCE	    0x2UL
234 	#define SQ_SEND_RAWETH_QP1_FLAGS_UC_FENCE		    0x4UL
235 	#define SQ_SEND_RAWETH_QP1_FLAGS_SE			    0x8UL
236 	#define SQ_SEND_RAWETH_QP1_FLAGS_INLINE		    0x10UL
237 	u8 wqe_size;
238 	u8 reserved8;
239 	__le16 lflags;
240 	#define SQ_SEND_RAWETH_QP1_LFLAGS_TCP_UDP_CHKSUM	    0x1UL
241 	#define SQ_SEND_RAWETH_QP1_LFLAGS_IP_CHKSUM		    0x2UL
242 	#define SQ_SEND_RAWETH_QP1_LFLAGS_NOCRC		    0x4UL
243 	#define SQ_SEND_RAWETH_QP1_LFLAGS_STAMP		    0x8UL
244 	#define SQ_SEND_RAWETH_QP1_LFLAGS_T_IP_CHKSUM		    0x10UL
245 	#define SQ_SEND_RAWETH_QP1_LFLAGS_RESERVED1_1		    0x20UL
246 	#define SQ_SEND_RAWETH_QP1_LFLAGS_RESERVED1_2		    0x40UL
247 	#define SQ_SEND_RAWETH_QP1_LFLAGS_RESERVED1_3		    0x80UL
248 	#define SQ_SEND_RAWETH_QP1_LFLAGS_ROCE_CRC		    0x100UL
249 	#define SQ_SEND_RAWETH_QP1_LFLAGS_FCOE_CRC		    0x200UL
250 	__le16 cfa_action;
251 	__le32 length;
252 	__le32 reserved32_1;
253 	__le32 cfa_meta;
254 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_VID_MASK	    0xfffUL
255 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_VID_SFT	    0
256 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_DE		    0x1000UL
257 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_PRI_MASK	    0xe000UL
258 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_PRI_SFT	    13
259 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_MASK	    0x70000UL
260 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_SFT	    16
261 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPID88A8    (0x0UL << 16)
262 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPID8100    (0x1UL << 16)
263 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPID9100    (0x2UL << 16)
264 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPID9200    (0x3UL << 16)
265 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPID9300    (0x4UL << 16)
266 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPIDCFG     (0x5UL << 16)
267 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_LAST	\
268 				SQ_SEND_RAWETH_QP1_CFA_META_VLAN_TPID_TPIDCFG
269 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_RESERVED_MASK     0xff80000UL
270 	#define SQ_SEND_RAWETH_QP1_CFA_META_VLAN_RESERVED_SFT      19
271 	#define SQ_SEND_RAWETH_QP1_CFA_META_KEY_MASK		    0xf0000000UL
272 	#define SQ_SEND_RAWETH_QP1_CFA_META_KEY_SFT		    28
273 	#define SQ_SEND_RAWETH_QP1_CFA_META_KEY_NONE		   (0x0UL << 28)
274 	#define SQ_SEND_RAWETH_QP1_CFA_META_KEY_VLAN_TAG	   (0x1UL << 28)
275 	#define SQ_SEND_RAWETH_QP1_CFA_META_KEY_LAST		\
276 				SQ_SEND_RAWETH_QP1_CFA_META_KEY_VLAN_TAG
277 	__le32 reserved32_2;
278 	__le64 reserved64;
279 	__le32 data[24];
280 };
281 
282 /* sq_send_raweth_qp1_hdr (size:256b/32B) */
283 struct sq_send_raweth_qp1_hdr {
284 	u8	wqe_type;
285 	u8	flags;
286 	u8	wqe_size;
287 	u8	reserved8;
288 	__le16	lflags;
289 	__le16	cfa_action;
290 	__le32	length;
291 	__le32	reserved32_1;
292 	__le32	cfa_meta;
293 	__le32	reserved32_2;
294 	__le64	reserved64;
295 };
296 
297 /* RDMA SQ WQE (40 bytes) */
298 struct sq_rdma {
299 	u8 wqe_type;
300 	#define SQ_RDMA_WQE_TYPE_WRITE_WQE			   0x4UL
301 	#define SQ_RDMA_WQE_TYPE_WRITE_W_IMMEAD		   0x5UL
302 	#define SQ_RDMA_WQE_TYPE_READ_WQE			   0x6UL
303 	u8 flags;
304 	#define SQ_RDMA_FLAGS_SIGNAL_COMP			    0x1UL
305 	#define SQ_RDMA_FLAGS_RD_OR_ATOMIC_FENCE		    0x2UL
306 	#define SQ_RDMA_FLAGS_UC_FENCE				    0x4UL
307 	#define SQ_RDMA_FLAGS_SE				    0x8UL
308 	#define SQ_RDMA_FLAGS_INLINE				    0x10UL
309 	u8 wqe_size;
310 	u8 reserved8;
311 	__le32 imm_data;
312 	__le32 length;
313 	__le32 reserved32_1;
314 	__le64 remote_va;
315 	__le32 remote_key;
316 	__le32 reserved32_2;
317 	__le32 data[24];
318 };
319 
320 /* sq_rdma_hdr (size:256b/32B) */
321 struct sq_rdma_hdr {
322 	u8	wqe_type;
323 	u8	flags;
324 	u8	wqe_size;
325 	u8	reserved8;
326 	__le32	imm_data;
327 	__le32	length;
328 	__le32	reserved32_1;
329 	__le64	remote_va;
330 	__le32	remote_key;
331 	__le32	reserved32_2;
332 };
333 
334 /* Atomic SQ WQE (40 bytes) */
335 struct sq_atomic {
336 	u8 wqe_type;
337 	#define SQ_ATOMIC_WQE_TYPE_ATOMIC_CS			   0x8UL
338 	#define SQ_ATOMIC_WQE_TYPE_ATOMIC_FA			   0xbUL
339 	u8 flags;
340 	#define SQ_ATOMIC_FLAGS_SIGNAL_COMP			    0x1UL
341 	#define SQ_ATOMIC_FLAGS_RD_OR_ATOMIC_FENCE		    0x2UL
342 	#define SQ_ATOMIC_FLAGS_UC_FENCE			    0x4UL
343 	#define SQ_ATOMIC_FLAGS_SE				    0x8UL
344 	#define SQ_ATOMIC_FLAGS_INLINE				    0x10UL
345 	__le16 reserved16;
346 	__le32 remote_key;
347 	__le64 remote_va;
348 	__le64 swap_data;
349 	__le64 cmp_data;
350 	__le32 data[24];
351 };
352 
353 /* sq_atomic_hdr (size:256b/32B) */
354 struct sq_atomic_hdr {
355 	u8	wqe_type;
356 	u8	flags;
357 	__le16	reserved16;
358 	__le32	remote_key;
359 	__le64	remote_va;
360 	__le64	swap_data;
361 	__le64	cmp_data;
362 };
363 
364 /* Local Invalidate SQ WQE (40 bytes) */
365 struct sq_localinvalidate {
366 	u8 wqe_type;
367 	#define SQ_LOCALINVALIDATE_WQE_TYPE_LOCAL_INVALID	   0xcUL
368 	u8 flags;
369 	#define SQ_LOCALINVALIDATE_FLAGS_SIGNAL_COMP		    0x1UL
370 	#define SQ_LOCALINVALIDATE_FLAGS_RD_OR_ATOMIC_FENCE	    0x2UL
371 	#define SQ_LOCALINVALIDATE_FLAGS_UC_FENCE		    0x4UL
372 	#define SQ_LOCALINVALIDATE_FLAGS_SE			    0x8UL
373 	#define SQ_LOCALINVALIDATE_FLAGS_INLINE		    0x10UL
374 	__le16 reserved16;
375 	__le32 inv_l_key;
376 	__le64 reserved64;
377 	__le32 reserved128[4];
378 	__le32 data[24];
379 };
380 
381 /* sq_localinvalidate_hdr (size:256b/32B) */
382 struct sq_localinvalidate_hdr {
383 	u8	wqe_type;
384 	u8	flags;
385 	__le16	reserved16;
386 	__le32	inv_l_key;
387 	__le64	reserved64;
388 	u8	reserved128[16];
389 };
390 
391 /* FR-PMR SQ WQE (40 bytes) */
392 struct sq_fr_pmr {
393 	u8 wqe_type;
394 	#define SQ_FR_PMR_WQE_TYPE_FR_PMR			   0xdUL
395 	u8 flags;
396 	#define SQ_FR_PMR_FLAGS_SIGNAL_COMP			    0x1UL
397 	#define SQ_FR_PMR_FLAGS_RD_OR_ATOMIC_FENCE		    0x2UL
398 	#define SQ_FR_PMR_FLAGS_UC_FENCE			    0x4UL
399 	#define SQ_FR_PMR_FLAGS_SE				    0x8UL
400 	#define SQ_FR_PMR_FLAGS_INLINE				    0x10UL
401 	u8 access_cntl;
402 	#define SQ_FR_PMR_ACCESS_CNTL_LOCAL_WRITE		    0x1UL
403 	#define SQ_FR_PMR_ACCESS_CNTL_REMOTE_READ		    0x2UL
404 	#define SQ_FR_PMR_ACCESS_CNTL_REMOTE_WRITE		    0x4UL
405 	#define SQ_FR_PMR_ACCESS_CNTL_REMOTE_ATOMIC		    0x8UL
406 	#define SQ_FR_PMR_ACCESS_CNTL_WINDOW_BIND		    0x10UL
407 	u8 zero_based_page_size_log;
408 	#define SQ_FR_PMR_PAGE_SIZE_LOG_MASK			    0x1fUL
409 	#define SQ_FR_PMR_PAGE_SIZE_LOG_SFT			    0
410 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_4K		   0x0UL
411 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_8K		   0x1UL
412 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_64K		   0x4UL
413 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_256K		   0x6UL
414 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_1M		   0x8UL
415 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_2M		   0x9UL
416 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_4M		   0xaUL
417 	#define SQ_FR_PMR_PAGE_SIZE_LOG_PGSZ_1G		   0x12UL
418 	#define SQ_FR_PMR_ZERO_BASED				    0x20UL
419 	#define SQ_FR_PMR_RESERVED2_MASK			    0xc0UL
420 	#define SQ_FR_PMR_RESERVED2_SFT			    6
421 	__le32 l_key;
422 	u8 length[5];
423 	u8 reserved8_1;
424 	u8 reserved8_2;
425 	u8 numlevels_pbl_page_size_log;
426 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_MASK		    0x1fUL
427 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_SFT		    0
428 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_4K		   0x0UL
429 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_8K		   0x1UL
430 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_64K		   0x4UL
431 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_256K		   0x6UL
432 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_1M		   0x8UL
433 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_2M		   0x9UL
434 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_4M		   0xaUL
435 	#define SQ_FR_PMR_PBL_PAGE_SIZE_LOG_PGSZ_1G		   0x12UL
436 	#define SQ_FR_PMR_RESERVED1				    0x20UL
437 	#define SQ_FR_PMR_NUMLEVELS_MASK			    0xc0UL
438 	#define SQ_FR_PMR_NUMLEVELS_SFT			    6
439 	#define SQ_FR_PMR_NUMLEVELS_PHYSICAL			   (0x0UL << 6)
440 	#define SQ_FR_PMR_NUMLEVELS_LAYER1			   (0x1UL << 6)
441 	#define SQ_FR_PMR_NUMLEVELS_LAYER2			   (0x2UL << 6)
442 	__le64 pblptr;
443 	__le64 va;
444 	__le32 data[24];
445 };
446 
447 /* sq_fr_pmr_hdr (size:256b/32B) */
448 struct sq_fr_pmr_hdr {
449 	u8	wqe_type;
450 	u8	flags;
451 	u8	access_cntl;
452 	u8	zero_based_page_size_log;
453 	__le32	l_key;
454 	u8	length[5];
455 	u8	reserved8_1;
456 	u8	reserved8_2;
457 	u8	numlevels_pbl_page_size_log;
458 	__le64	pblptr;
459 	__le64	va;
460 };
461 
462 /* Bind SQ WQE (40 bytes) */
463 struct sq_bind {
464 	u8 wqe_type;
465 	#define SQ_BIND_WQE_TYPE_BIND				   0xeUL
466 	u8 flags;
467 	#define SQ_BIND_FLAGS_SIGNAL_COMP			    0x1UL
468 	#define SQ_BIND_FLAGS_RD_OR_ATOMIC_FENCE		    0x2UL
469 	#define SQ_BIND_FLAGS_UC_FENCE				    0x4UL
470 	#define SQ_BIND_FLAGS_SE				    0x8UL
471 	#define SQ_BIND_FLAGS_INLINE				    0x10UL
472 	u8 access_cntl;
473 	#define SQ_BIND_ACCESS_CNTL_LOCAL_WRITE		    0x1UL
474 	#define SQ_BIND_ACCESS_CNTL_REMOTE_READ		    0x2UL
475 	#define SQ_BIND_ACCESS_CNTL_REMOTE_WRITE		    0x4UL
476 	#define SQ_BIND_ACCESS_CNTL_REMOTE_ATOMIC		    0x8UL
477 	#define SQ_BIND_ACCESS_CNTL_WINDOW_BIND		    0x10UL
478 	u8 reserved8_1;
479 	u8 mw_type_zero_based;
480 	#define SQ_BIND_ZERO_BASED				    0x1UL
481 	#define SQ_BIND_MW_TYPE				    0x2UL
482 	#define SQ_BIND_MW_TYPE_TYPE1				   (0x0UL << 1)
483 	#define SQ_BIND_MW_TYPE_TYPE2				   (0x1UL << 1)
484 	#define SQ_BIND_RESERVED6_MASK				    0xfcUL
485 	#define SQ_BIND_RESERVED6_SFT				    2
486 	u8 reserved8_2;
487 	__le16 reserved16;
488 	__le32 parent_l_key;
489 	__le32 l_key;
490 	__le64 va;
491 	u8 length[5];
492 	u8 data_reserved24[99];
493 	#define SQ_BIND_RESERVED24_MASK			    0xffffff00UL
494 	#define SQ_BIND_RESERVED24_SFT				    8
495 	#define SQ_BIND_DATA_MASK				    0xffffffffUL
496 	#define SQ_BIND_DATA_SFT				    0
497 };
498 
499 /* sq_bind_hdr (size:256b/32B) */
500 struct sq_bind_hdr {
501 	u8	wqe_type;
502 	u8	flags;
503 	u8	access_cntl;
504 	u8	reserved8_1;
505 	u8	mw_type_zero_based;
506 	u8	reserved8_2;
507 	__le16	reserved16;
508 	__le32	parent_l_key;
509 	__le32	l_key;
510 	__le64	va;
511 	u8	length[5];
512 	u8	reserved24[3];
513 };
514 
515 /* RQ/SRQ WQE Structures */
516 /* RQ/SRQ WQE (40 bytes) */
517 struct rq_wqe {
518 	u8 wqe_type;
519 	#define RQ_WQE_WQE_TYPE_RCV				   0x80UL
520 	u8 flags;
521 	u8 wqe_size;
522 	u8 reserved8;
523 	__le32 reserved32;
524 	__le32 wr_id[2];
525 	#define RQ_WQE_WR_ID_MASK				    0xfffffUL
526 	#define RQ_WQE_WR_ID_SFT				    0
527 	#define RQ_WQE_RESERVED44_MASK				    0xfff00000UL
528 	#define RQ_WQE_RESERVED44_SFT				    20
529 	__le32 reserved128[4];
530 	__le32 data[24];
531 };
532 
533 /* rq_wqe_hdr (size:256b/32B) */
534 struct rq_wqe_hdr {
535 	u8	wqe_type;
536 	u8	flags;
537 	u8	wqe_size;
538 	u8	reserved8;
539 	__le32	reserved32;
540 	__le32	wr_id[2];
541 	u8	reserved128[16];
542 };
543 
544 /* CQ CQE Structures */
545 /* Base CQE (32 bytes) */
546 struct cq_base {
547 	__le64 reserved64_1;
548 	__le64 reserved64_2;
549 	__le64 reserved64_3;
550 	u8 cqe_type_toggle;
551 	#define CQ_BASE_TOGGLE					    0x1UL
552 	#define CQ_BASE_CQE_TYPE_MASK				    0x1eUL
553 	#define CQ_BASE_CQE_TYPE_SFT				    1
554 	#define CQ_BASE_CQE_TYPE_REQ				   (0x0UL << 1)
555 	#define CQ_BASE_CQE_TYPE_RES_RC			   (0x1UL << 1)
556 	#define CQ_BASE_CQE_TYPE_RES_UD			   (0x2UL << 1)
557 	#define CQ_BASE_CQE_TYPE_RES_RAWETH_QP1		   (0x3UL << 1)
558 	#define CQ_BASE_CQE_TYPE_TERMINAL			   (0xeUL << 1)
559 	#define CQ_BASE_CQE_TYPE_CUT_OFF			   (0xfUL << 1)
560 	#define CQ_BASE_RESERVED3_MASK				    0xe0UL
561 	#define CQ_BASE_RESERVED3_SFT				    5
562 	u8 status;
563 	__le16 reserved16;
564 	__le32 reserved32;
565 };
566 
567 /* Requester CQ CQE (32 bytes) */
568 struct cq_req {
569 	__le64 qp_handle;
570 	__le16 sq_cons_idx;
571 	__le16 reserved16_1;
572 	__le32 reserved32_2;
573 	__le64 reserved64;
574 	u8 cqe_type_toggle;
575 	#define CQ_REQ_TOGGLE					    0x1UL
576 	#define CQ_REQ_CQE_TYPE_MASK				    0x1eUL
577 	#define CQ_REQ_CQE_TYPE_SFT				    1
578 	#define CQ_REQ_CQE_TYPE_REQ				   (0x0UL << 1)
579 	#define CQ_REQ_RESERVED3_MASK				    0xe0UL
580 	#define CQ_REQ_RESERVED3_SFT				    5
581 	u8 status;
582 	#define CQ_REQ_STATUS_OK				   0x0UL
583 	#define CQ_REQ_STATUS_BAD_RESPONSE_ERR			   0x1UL
584 	#define CQ_REQ_STATUS_LOCAL_LENGTH_ERR			   0x2UL
585 	#define CQ_REQ_STATUS_LOCAL_QP_OPERATION_ERR		   0x3UL
586 	#define CQ_REQ_STATUS_LOCAL_PROTECTION_ERR		   0x4UL
587 	#define CQ_REQ_STATUS_MEMORY_MGT_OPERATION_ERR		   0x5UL
588 	#define CQ_REQ_STATUS_REMOTE_INVALID_REQUEST_ERR	   0x6UL
589 	#define CQ_REQ_STATUS_REMOTE_ACCESS_ERR		   0x7UL
590 	#define CQ_REQ_STATUS_REMOTE_OPERATION_ERR		   0x8UL
591 	#define CQ_REQ_STATUS_RNR_NAK_RETRY_CNT_ERR		   0x9UL
592 	#define CQ_REQ_STATUS_TRANSPORT_RETRY_CNT_ERR		   0xaUL
593 	#define CQ_REQ_STATUS_WORK_REQUEST_FLUSHED_ERR		   0xbUL
594 	__le16 reserved16_2;
595 	__le32 reserved32_1;
596 };
597 
598 /* Responder RC CQE (32 bytes) */
599 struct cq_res_rc {
600 	__le32 length;
601 	__le32 imm_data_or_inv_r_key;
602 	__le64 qp_handle;
603 	__le64 mr_handle;
604 	u8 cqe_type_toggle;
605 	#define CQ_RES_RC_TOGGLE				    0x1UL
606 	#define CQ_RES_RC_CQE_TYPE_MASK			    0x1eUL
607 	#define CQ_RES_RC_CQE_TYPE_SFT				    1
608 	#define CQ_RES_RC_CQE_TYPE_RES_RC			   (0x1UL << 1)
609 	#define CQ_RES_RC_RESERVED3_MASK			    0xe0UL
610 	#define CQ_RES_RC_RESERVED3_SFT			    5
611 	u8 status;
612 	#define CQ_RES_RC_STATUS_OK				   0x0UL
613 	#define CQ_RES_RC_STATUS_LOCAL_ACCESS_ERROR		   0x1UL
614 	#define CQ_RES_RC_STATUS_LOCAL_LENGTH_ERR		   0x2UL
615 	#define CQ_RES_RC_STATUS_LOCAL_PROTECTION_ERR		   0x3UL
616 	#define CQ_RES_RC_STATUS_LOCAL_QP_OPERATION_ERR	   0x4UL
617 	#define CQ_RES_RC_STATUS_MEMORY_MGT_OPERATION_ERR	   0x5UL
618 	#define CQ_RES_RC_STATUS_REMOTE_INVALID_REQUEST_ERR       0x6UL
619 	#define CQ_RES_RC_STATUS_WORK_REQUEST_FLUSHED_ERR	   0x7UL
620 	#define CQ_RES_RC_STATUS_HW_FLUSH_ERR			   0x8UL
621 	__le16 flags;
622 	#define CQ_RES_RC_FLAGS_SRQ				    0x1UL
623 	#define CQ_RES_RC_FLAGS_SRQ_RQ				   (0x0UL << 0)
624 	#define CQ_RES_RC_FLAGS_SRQ_SRQ			   (0x1UL << 0)
625 	#define CQ_RES_RC_FLAGS_SRQ_LAST    CQ_RES_RC_FLAGS_SRQ_SRQ
626 	#define CQ_RES_RC_FLAGS_IMM				    0x2UL
627 	#define CQ_RES_RC_FLAGS_INV				    0x4UL
628 	#define CQ_RES_RC_FLAGS_RDMA				    0x8UL
629 	#define CQ_RES_RC_FLAGS_RDMA_SEND			   (0x0UL << 3)
630 	#define CQ_RES_RC_FLAGS_RDMA_RDMA_WRITE		   (0x1UL << 3)
631 	#define CQ_RES_RC_FLAGS_RDMA_LAST    CQ_RES_RC_FLAGS_RDMA_RDMA_WRITE
632 	__le32 srq_or_rq_wr_id;
633 	#define CQ_RES_RC_SRQ_OR_RQ_WR_ID_MASK			    0xfffffUL
634 	#define CQ_RES_RC_SRQ_OR_RQ_WR_ID_SFT			    0
635 	#define CQ_RES_RC_RESERVED12_MASK			    0xfff00000UL
636 	#define CQ_RES_RC_RESERVED12_SFT			    20
637 };
638 
639 /* Responder UD CQE (32 bytes) */
640 struct cq_res_ud {
641 	__le16 length;
642 	#define CQ_RES_UD_LENGTH_MASK				    0x3fffUL
643 	#define CQ_RES_UD_LENGTH_SFT				    0
644 	__le16 cfa_metadata;
645 	#define CQ_RES_UD_CFA_METADATA_VID_MASK			0xfffUL
646 	#define CQ_RES_UD_CFA_METADATA_VID_SFT			0
647 	#define CQ_RES_UD_CFA_METADATA_DE			0x1000UL
648 	#define CQ_RES_UD_CFA_METADATA_PRI_MASK			0xe000UL
649 	#define CQ_RES_UD_CFA_METADATA_PRI_SFT			13
650 	__le32 imm_data;
651 	__le64 qp_handle;
652 	__le16 src_mac[3];
653 	__le16 src_qp_low;
654 	u8 cqe_type_toggle;
655 	#define CQ_RES_UD_TOGGLE				   0x1UL
656 	#define CQ_RES_UD_CQE_TYPE_MASK				   0x1eUL
657 	#define CQ_RES_UD_CQE_TYPE_SFT				   1
658 	#define CQ_RES_UD_CQE_TYPE_RES_UD			   (0x2UL << 1)
659 	u8 status;
660 	#define CQ_RES_UD_STATUS_OK				   0x0UL
661 	#define CQ_RES_UD_STATUS_LOCAL_ACCESS_ERROR		   0x1UL
662 	#define CQ_RES_UD_STATUS_HW_LOCAL_LENGTH_ERR		   0x2UL
663 	#define CQ_RES_UD_STATUS_LOCAL_PROTECTION_ERR		   0x3UL
664 	#define CQ_RES_UD_STATUS_LOCAL_QP_OPERATION_ERR	   0x4UL
665 	#define CQ_RES_UD_STATUS_MEMORY_MGT_OPERATION_ERR	   0x5UL
666 	#define CQ_RES_UD_STATUS_WORK_REQUEST_FLUSHED_ERR	   0x7UL
667 	#define CQ_RES_UD_STATUS_HW_FLUSH_ERR			   0x8UL
668 	__le16 flags;
669 	#define CQ_RES_UD_FLAGS_SRQ				    0x1UL
670 	#define CQ_RES_UD_FLAGS_SRQ_RQ				   (0x0UL << 0)
671 	#define CQ_RES_UD_FLAGS_SRQ_SRQ			   (0x1UL << 0)
672 	#define CQ_RES_UD_FLAGS_SRQ_LAST    CQ_RES_UD_FLAGS_SRQ_SRQ
673 	#define CQ_RES_UD_FLAGS_IMM				    0x2UL
674 	#define CQ_RES_UD_FLAGS_UNUSED_MASK			0xcUL
675 	#define CQ_RES_UD_FLAGS_UNUSED_SFT			2
676 	#define CQ_RES_UD_FLAGS_ROCE_IP_VER_MASK		0x30UL
677 	#define CQ_RES_UD_FLAGS_ROCE_IP_VER_SFT			4
678 	#define CQ_RES_UD_FLAGS_ROCE_IP_VER_V1			(0x0UL << 4)
679 	#define CQ_RES_UD_FLAGS_ROCE_IP_VER_V2IPV4		(0x2UL << 4)
680 	#define CQ_RES_UD_FLAGS_ROCE_IP_VER_V2IPV6		(0x3UL << 4)
681 	#define CQ_RES_UD_FLAGS_ROCE_IP_VER_LAST		\
682 					CQ_RES_UD_FLAGS_ROCE_IP_VER_V2IPV6
683 	#define CQ_RES_UD_FLAGS_META_FORMAT_MASK		0x3c0UL
684 	#define CQ_RES_UD_FLAGS_META_FORMAT_SFT			6
685 	#define CQ_RES_UD_FLAGS_META_FORMAT_NONE		(0x0UL << 6)
686 	#define CQ_RES_UD_FLAGS_META_FORMAT_VLAN		(0x1UL << 6)
687 	#define CQ_RES_UD_FLAGS_META_FORMAT_TUNNEL_ID		(0x2UL << 6)
688 	#define CQ_RES_UD_FLAGS_META_FORMAT_CHDR_DATA		(0x3UL << 6)
689 	#define CQ_RES_UD_FLAGS_META_FORMAT_HDR_OFFSET		(0x4UL << 6)
690 	#define CQ_RES_UD_FLAGS_META_FORMAT_LAST		\
691 					CQ_RES_UD_FLAGS_META_FORMAT_HDR_OFFSET
692 	#define CQ_RES_UD_FLAGS_EXT_META_FORMAT_MASK		0xc00UL
693 	#define CQ_RES_UD_FLAGS_EXT_META_FORMAT_SFT		10
694 
695 	__le32 src_qp_high_srq_or_rq_wr_id;
696 	#define CQ_RES_UD_SRQ_OR_RQ_WR_ID_MASK			    0xfffffUL
697 	#define CQ_RES_UD_SRQ_OR_RQ_WR_ID_SFT			    0
698 	#define CQ_RES_UD_SRC_QP_HIGH_MASK			    0xff000000UL
699 	#define CQ_RES_UD_SRC_QP_HIGH_SFT			    24
700 };
701 
702 /* Responder RawEth and QP1 CQE (32 bytes) */
703 struct cq_res_raweth_qp1 {
704 	__le16 length;
705 	#define CQ_RES_RAWETH_QP1_LENGTH_MASK			    0x3fffUL
706 	#define CQ_RES_RAWETH_QP1_LENGTH_SFT			    0
707 	#define CQ_RES_RAWETH_QP1_RESERVED2_MASK		    0xc000UL
708 	#define CQ_RES_RAWETH_QP1_RESERVED2_SFT		    14
709 	__le16 raweth_qp1_flags;
710 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ERROR	    0x1UL
711 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_RESERVED5_1_MASK 0x3eUL
712 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_RESERVED5_1_SFT 1
713 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_MASK      0x3c0UL
714 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_SFT       6
715 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_NOT_KNOWN (0x0UL << 6)
716 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_IP       (0x1UL << 6)
717 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_TCP      (0x2UL << 6)
718 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_UDP      (0x3UL << 6)
719 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_FCOE     (0x4UL << 6)
720 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_ROCE     (0x5UL << 6)
721 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_ICMP     (0x7UL << 6)
722 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_PTP_WO_TIMESTAMP \
723 								 (0x8UL << 6)
724 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_PTP_W_TIMESTAMP \
725 								 (0x9UL << 6)
726 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_LAST	\
727 		CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_ITYPE_PTP_W_TIMESTAMP
728 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_MASK	    0x3ffUL
729 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS_SFT		    0
730 	#define CQ_RES_RAWETH_QP1_RESERVED6_MASK		    0xfc00UL
731 	#define CQ_RES_RAWETH_QP1_RESERVED6_SFT		    10
732 	__le16 raweth_qp1_errors;
733 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_RESERVED4_MASK 0xfUL
734 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_RESERVED4_SFT  0
735 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_IP_CS_ERROR    0x10UL
736 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_L4_CS_ERROR    0x20UL
737 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_IP_CS_ERROR  0x40UL
738 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_L4_CS_ERROR  0x80UL
739 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_CRC_ERROR      0x100UL
740 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_MASK 0xe00UL
741 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_SFT 9
742 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_NO_ERROR \
743 								(0x0UL << 9)
744 	#define \
745 	   CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_T_L3_BAD_VERSION \
746 								(0x1UL << 9)
747 	#define \
748 	   CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_T_L3_BAD_HDR_LEN \
749 								(0x2UL << 9)
750 	#define \
751 	   CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_TUNNEL_TOTAL_ERROR \
752 								(0x3UL << 9)
753 	#define \
754 	   CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_T_IP_TOTAL_ERROR \
755 								(0x4UL << 9)
756 	#define \
757 	   CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_T_UDP_TOTAL_ERROR \
758 								(0x5UL << 9)
759 	#define \
760 	   CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL \
761 								(0x6UL << 9)
762 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_LAST \
763 		CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_T_PKT_ERROR_T_L3_BAD_TTL
764 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_MASK 0xf000UL
765 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_SFT  12
766 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_NO_ERROR \
767 								(0x0UL << 12)
768 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L3_BAD_VERSION \
769 								(0x1UL << 12)
770 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L3_BAD_HDR_LEN \
771 								 (0x2UL << 12)
772 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L3_BAD_TTL \
773 								 (0x3UL << 12)
774 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_IP_TOTAL_ERROR \
775 								 (0x4UL << 12)
776 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_UDP_TOTAL_ERROR \
777 								 (0x5UL << 12)
778 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN \
779 								 (0x6UL << 12)
780 	#define \
781 	 CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L4_BAD_HDR_LEN_TOO_SMALL\
782 								 (0x7UL << 12)
783 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN \
784 								 (0x8UL << 12)
785 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_LAST \
786 		CQ_RES_RAWETH_QP1_RAWETH_QP1_ERRORS_PKT_ERROR_L4_BAD_OPT_LEN
787 	__le16 raweth_qp1_cfa_code;
788 	__le64 qp_handle;
789 	__le32 raweth_qp1_flags2;
790 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_IP_CS_CALC     0x1UL
791 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_L4_CS_CALC     0x2UL
792 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_T_IP_CS_CALC   0x4UL
793 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_T_L4_CS_CALC   0x8UL
794 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_META_FORMAT_MASK 0xf0UL
795 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_META_FORMAT_SFT 4
796 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_META_FORMAT_NONE \
797 								(0x0UL << 4)
798 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_META_FORMAT_VLAN \
799 								(0x1UL << 4)
800 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_META_FORMAT_LAST\
801 			CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_META_FORMAT_VLAN
802 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_FLAGS2_IP_TYPE	    0x100UL
803 	__le32 raweth_qp1_metadata;
804 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_VID_MASK     0xfffUL
805 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_VID_SFT      0
806 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_DE	    0x1000UL
807 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_PRI_MASK     0xe000UL
808 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_PRI_SFT      13
809 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_TPID_MASK    0xffff0000UL
810 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_METADATA_TPID_SFT     16
811 	u8 cqe_type_toggle;
812 	#define CQ_RES_RAWETH_QP1_TOGGLE			    0x1UL
813 	#define CQ_RES_RAWETH_QP1_CQE_TYPE_MASK		    0x1eUL
814 	#define CQ_RES_RAWETH_QP1_CQE_TYPE_SFT			    1
815 	#define CQ_RES_RAWETH_QP1_CQE_TYPE_RES_RAWETH_QP1	   (0x3UL << 1)
816 	#define CQ_RES_RAWETH_QP1_RESERVED3_MASK		    0xe0UL
817 	#define CQ_RES_RAWETH_QP1_RESERVED3_SFT		    5
818 	u8 status;
819 	#define CQ_RES_RAWETH_QP1_STATUS_OK			   0x0UL
820 	#define CQ_RES_RAWETH_QP1_STATUS_LOCAL_ACCESS_ERROR       0x1UL
821 	#define CQ_RES_RAWETH_QP1_STATUS_HW_LOCAL_LENGTH_ERR      0x2UL
822 	#define CQ_RES_RAWETH_QP1_STATUS_LOCAL_PROTECTION_ERR     0x3UL
823 	#define CQ_RES_RAWETH_QP1_STATUS_LOCAL_QP_OPERATION_ERR   0x4UL
824 	#define CQ_RES_RAWETH_QP1_STATUS_MEMORY_MGT_OPERATION_ERR 0x5UL
825 	#define CQ_RES_RAWETH_QP1_STATUS_WORK_REQUEST_FLUSHED_ERR 0x7UL
826 	#define CQ_RES_RAWETH_QP1_STATUS_HW_FLUSH_ERR		   0x8UL
827 	__le16 flags;
828 	#define CQ_RES_RAWETH_QP1_FLAGS_SRQ			    0x1UL
829 	#define CQ_RES_RAWETH_QP1_FLAGS_SRQ_RQ			   0x0UL
830 	#define CQ_RES_RAWETH_QP1_FLAGS_SRQ_SRQ		   0x1UL
831 	#define CQ_RES_RAWETH_QP1_FLAGS_SRQ_LAST \
832 					CQ_RES_RAWETH_QP1_FLAGS_SRQ_SRQ
833 	__le32 raweth_qp1_payload_offset_srq_or_rq_wr_id;
834 	#define CQ_RES_RAWETH_QP1_SRQ_OR_RQ_WR_ID_MASK		    0xfffffUL
835 	#define CQ_RES_RAWETH_QP1_SRQ_OR_RQ_WR_ID_SFT		    0
836 	#define CQ_RES_RAWETH_QP1_RESERVED4_MASK		    0xf00000UL
837 	#define CQ_RES_RAWETH_QP1_RESERVED4_SFT		    20
838 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_PAYLOAD_OFFSET_MASK   0xff000000UL
839 	#define CQ_RES_RAWETH_QP1_RAWETH_QP1_PAYLOAD_OFFSET_SFT    24
840 };
841 
842 /* Terminal CQE (32 bytes) */
843 struct cq_terminal {
844 	__le64 qp_handle;
845 	__le16 sq_cons_idx;
846 	__le16 rq_cons_idx;
847 	__le32 reserved32_1;
848 	__le64 reserved64_3;
849 	u8 cqe_type_toggle;
850 	#define CQ_TERMINAL_TOGGLE				    0x1UL
851 	#define CQ_TERMINAL_CQE_TYPE_MASK			    0x1eUL
852 	#define CQ_TERMINAL_CQE_TYPE_SFT			    1
853 	#define CQ_TERMINAL_CQE_TYPE_TERMINAL			   (0xeUL << 1)
854 	#define CQ_TERMINAL_RESERVED3_MASK			    0xe0UL
855 	#define CQ_TERMINAL_RESERVED3_SFT			    5
856 	u8 status;
857 	#define CQ_TERMINAL_STATUS_OK				   0x0UL
858 	__le16 reserved16;
859 	__le32 reserved32_2;
860 };
861 
862 /* Cutoff CQE (32 bytes) */
863 struct cq_cutoff {
864 	__le64 reserved64_1;
865 	__le64 reserved64_2;
866 	__le64 reserved64_3;
867 	u8 cqe_type_toggle;
868 	#define CQ_CUTOFF_TOGGLE				    0x1UL
869 	#define CQ_CUTOFF_CQE_TYPE_MASK			    0x1eUL
870 	#define CQ_CUTOFF_CQE_TYPE_SFT				    1
871 	#define CQ_CUTOFF_CQE_TYPE_CUT_OFF			   (0xfUL << 1)
872 	#define CQ_CUTOFF_RESERVED3_MASK			    0xe0UL
873 	#define CQ_CUTOFF_RESERVED3_SFT			    5
874 	u8 status;
875 	#define CQ_CUTOFF_STATUS_OK				   0x0UL
876 	__le16 reserved16;
877 	__le32 reserved32;
878 };
879 
880 /* Notification Queue (NQ) Structures */
881 /* Base NQ Record (16 bytes) */
882 struct nq_base {
883 	__le16 info10_type;
884 	#define NQ_BASE_TYPE_MASK				    0x3fUL
885 	#define NQ_BASE_TYPE_SFT				    0
886 	#define NQ_BASE_TYPE_CQ_NOTIFICATION			   0x30UL
887 	#define NQ_BASE_TYPE_SRQ_EVENT				   0x32UL
888 	#define NQ_BASE_TYPE_DBQ_EVENT				   0x34UL
889 	#define NQ_BASE_TYPE_QP_EVENT				   0x38UL
890 	#define NQ_BASE_TYPE_FUNC_EVENT			   0x3aUL
891 	#define NQ_BASE_INFO10_MASK				    0xffc0UL
892 	#define NQ_BASE_INFO10_SFT				    6
893 	__le16 info16;
894 	__le32 info32;
895 	__le32 info63_v[2];
896 	#define NQ_BASE_V					    0x1UL
897 	#define NQ_BASE_INFO63_MASK				    0xfffffffeUL
898 	#define NQ_BASE_INFO63_SFT				    1
899 };
900 
901 /* Completion Queue Notification (16 bytes) */
902 struct nq_cn {
903 	__le16 type;
904 	#define NQ_CN_TYPE_MASK				    0x3fUL
905 	#define NQ_CN_TYPE_SFT					    0
906 	#define NQ_CN_TYPE_CQ_NOTIFICATION			   0x30UL
907 	#define NQ_CN_RESERVED9_MASK				    0xffc0UL
908 	#define NQ_CN_RESERVED9_SFT				    6
909 	__le16 reserved16;
910 	__le32 cq_handle_low;
911 	__le32 v;
912 	#define NQ_CN_V					    0x1UL
913 	#define NQ_CN_RESERVED31_MASK				    0xfffffffeUL
914 	#define NQ_CN_RESERVED31_SFT				    1
915 	__le32 cq_handle_high;
916 };
917 
918 /* SRQ Event Notification (16 bytes) */
919 struct nq_srq_event {
920 	u8 type;
921 	#define NQ_SRQ_EVENT_TYPE_MASK				    0x3fUL
922 	#define NQ_SRQ_EVENT_TYPE_SFT				    0
923 	#define NQ_SRQ_EVENT_TYPE_SRQ_EVENT			   0x32UL
924 	#define NQ_SRQ_EVENT_RESERVED1_MASK			    0xc0UL
925 	#define NQ_SRQ_EVENT_RESERVED1_SFT			    6
926 	u8 event;
927 	#define NQ_SRQ_EVENT_EVENT_SRQ_THRESHOLD_EVENT		   0x1UL
928 	__le16 reserved16;
929 	__le32 srq_handle_low;
930 	__le32 v;
931 	#define NQ_SRQ_EVENT_V					    0x1UL
932 	#define NQ_SRQ_EVENT_RESERVED31_MASK			    0xfffffffeUL
933 	#define NQ_SRQ_EVENT_RESERVED31_SFT			    1
934 	__le32 srq_handle_high;
935 };
936 
937 /* DBQ Async Event Notification (16 bytes) */
938 struct nq_dbq_event {
939 	u8 type;
940 	#define NQ_DBQ_EVENT_TYPE_MASK				    0x3fUL
941 	#define NQ_DBQ_EVENT_TYPE_SFT				    0
942 	#define NQ_DBQ_EVENT_TYPE_DBQ_EVENT			   0x34UL
943 	#define NQ_DBQ_EVENT_RESERVED1_MASK			    0xc0UL
944 	#define NQ_DBQ_EVENT_RESERVED1_SFT			    6
945 	u8 event;
946 	#define NQ_DBQ_EVENT_EVENT_DBQ_THRESHOLD_EVENT		   0x1UL
947 	__le16 db_pfid;
948 	#define NQ_DBQ_EVENT_DB_PFID_MASK			    0xfUL
949 	#define NQ_DBQ_EVENT_DB_PFID_SFT			    0
950 	#define NQ_DBQ_EVENT_RESERVED12_MASK			    0xfff0UL
951 	#define NQ_DBQ_EVENT_RESERVED12_SFT			    4
952 	__le32 db_dpi;
953 	#define NQ_DBQ_EVENT_DB_DPI_MASK			    0xfffffUL
954 	#define NQ_DBQ_EVENT_DB_DPI_SFT			    0
955 	#define NQ_DBQ_EVENT_RESERVED12_2_MASK			    0xfff00000UL
956 	#define NQ_DBQ_EVENT_RESERVED12_2_SFT			    20
957 	__le32 v;
958 	#define NQ_DBQ_EVENT_V					    0x1UL
959 	#define NQ_DBQ_EVENT_RESERVED32_MASK			    0xfffffffeUL
960 	#define NQ_DBQ_EVENT_RESERVED32_SFT			    1
961 	__le32 db_type_db_xid;
962 	#define NQ_DBQ_EVENT_DB_XID_MASK			    0xfffffUL
963 	#define NQ_DBQ_EVENT_DB_XID_SFT			    0
964 	#define NQ_DBQ_EVENT_RESERVED8_MASK			    0xff00000UL
965 	#define NQ_DBQ_EVENT_RESERVED8_SFT			    20
966 	#define NQ_DBQ_EVENT_DB_TYPE_MASK			    0xf0000000UL
967 	#define NQ_DBQ_EVENT_DB_TYPE_SFT			    28
968 };
969 
970 /* Read Request/Response Queue Structures */
971 /* Input Read Request Queue (IRRQ) Message (32 bytes) */
972 struct xrrq_irrq {
973 	__le16 credits_type;
974 	#define XRRQ_IRRQ_TYPE					    0x1UL
975 	#define XRRQ_IRRQ_TYPE_READ_REQ			   0x0UL
976 	#define XRRQ_IRRQ_TYPE_ATOMIC_REQ			   0x1UL
977 	#define XRRQ_IRRQ_RESERVED10_MASK			    0x7feUL
978 	#define XRRQ_IRRQ_RESERVED10_SFT			    1
979 	#define XRRQ_IRRQ_CREDITS_MASK				    0xf800UL
980 	#define XRRQ_IRRQ_CREDITS_SFT				    11
981 	__le16 reserved16;
982 	__le32 reserved32;
983 	__le32 psn;
984 	#define XRRQ_IRRQ_PSN_MASK				    0xffffffUL
985 	#define XRRQ_IRRQ_PSN_SFT				    0
986 	#define XRRQ_IRRQ_RESERVED8_1_MASK			    0xff000000UL
987 	#define XRRQ_IRRQ_RESERVED8_1_SFT			    24
988 	__le32 msn;
989 	#define XRRQ_IRRQ_MSN_MASK				    0xffffffUL
990 	#define XRRQ_IRRQ_MSN_SFT				    0
991 	#define XRRQ_IRRQ_RESERVED8_2_MASK			    0xff000000UL
992 	#define XRRQ_IRRQ_RESERVED8_2_SFT			    24
993 	__le64 va_or_atomic_result;
994 	__le32 rdma_r_key;
995 	__le32 length;
996 };
997 
998 /* Output Read Request Queue (ORRQ) Message (32 bytes) */
999 struct xrrq_orrq {
1000 	__le16 num_sges_type;
1001 	#define XRRQ_ORRQ_TYPE					    0x1UL
1002 	#define XRRQ_ORRQ_TYPE_READ_REQ			   0x0UL
1003 	#define XRRQ_ORRQ_TYPE_ATOMIC_REQ			   0x1UL
1004 	#define XRRQ_ORRQ_RESERVED10_MASK			    0x7feUL
1005 	#define XRRQ_ORRQ_RESERVED10_SFT			    1
1006 	#define XRRQ_ORRQ_NUM_SGES_MASK			    0xf800UL
1007 	#define XRRQ_ORRQ_NUM_SGES_SFT				    11
1008 	__le16 reserved16;
1009 	__le32 length;
1010 	__le32 psn;
1011 	#define XRRQ_ORRQ_PSN_MASK				    0xffffffUL
1012 	#define XRRQ_ORRQ_PSN_SFT				    0
1013 	#define XRRQ_ORRQ_RESERVED8_1_MASK			    0xff000000UL
1014 	#define XRRQ_ORRQ_RESERVED8_1_SFT			    24
1015 	__le32 end_psn;
1016 	#define XRRQ_ORRQ_END_PSN_MASK				    0xffffffUL
1017 	#define XRRQ_ORRQ_END_PSN_SFT				    0
1018 	#define XRRQ_ORRQ_RESERVED8_2_MASK			    0xff000000UL
1019 	#define XRRQ_ORRQ_RESERVED8_2_SFT			    24
1020 	__le64 first_sge_phy_or_sing_sge_va;
1021 	__le32 single_sge_l_key;
1022 	__le32 single_sge_size;
1023 };
1024 
1025 /* Page Buffer List Memory Structures (PBL) */
1026 /* Page Table Entry (PTE) (8 bytes) */
1027 struct ptu_pte {
1028 	__le32 page_next_to_last_last_valid[2];
1029 	#define PTU_PTE_VALID					    0x1UL
1030 	#define PTU_PTE_LAST					    0x2UL
1031 	#define PTU_PTE_NEXT_TO_LAST				    0x4UL
1032 	#define PTU_PTE_PAGE_MASK				    0xfffff000UL
1033 	#define PTU_PTE_PAGE_SFT				    12
1034 };
1035 
1036 /* Page Directory Entry (PDE) (8 bytes) */
1037 struct ptu_pde {
1038 	__le32 page_valid[2];
1039 	#define PTU_PDE_VALID					    0x1UL
1040 	#define PTU_PDE_PAGE_MASK				    0xfffff000UL
1041 	#define PTU_PDE_PAGE_SFT				    12
1042 };
1043 
1044 /* RoCE Fastpath Host Structures */
1045 /* Command Queue (CMDQ) Interface */
1046 /* Init CMDQ (16 bytes) */
1047 struct cmdq_init {
1048 	__le64 cmdq_pbl;
1049 	__le16 cmdq_size_cmdq_lvl;
1050 	#define CMDQ_INIT_CMDQ_LVL_MASK			    0x3UL
1051 	#define CMDQ_INIT_CMDQ_LVL_SFT				    0
1052 	#define CMDQ_INIT_CMDQ_SIZE_MASK			    0xfffcUL
1053 	#define CMDQ_INIT_CMDQ_SIZE_SFT			    2
1054 	__le16 creq_ring_id;
1055 	__le32 prod_idx;
1056 };
1057 
1058 /* Update CMDQ producer index (16 bytes) */
1059 struct cmdq_update {
1060 	__le64 reserved64;
1061 	__le32 reserved32;
1062 	__le32 prod_idx;
1063 };
1064 
1065 /* CMDQ common header structure (16 bytes) */
1066 struct cmdq_base {
1067 	u8 opcode;
1068 	#define CMDQ_BASE_OPCODE_CREATE_QP			   0x1UL
1069 	#define CMDQ_BASE_OPCODE_DESTROY_QP			   0x2UL
1070 	#define CMDQ_BASE_OPCODE_MODIFY_QP			   0x3UL
1071 	#define CMDQ_BASE_OPCODE_QUERY_QP			   0x4UL
1072 	#define CMDQ_BASE_OPCODE_CREATE_SRQ			   0x5UL
1073 	#define CMDQ_BASE_OPCODE_DESTROY_SRQ			   0x6UL
1074 	#define CMDQ_BASE_OPCODE_QUERY_SRQ			   0x8UL
1075 	#define CMDQ_BASE_OPCODE_CREATE_CQ			   0x9UL
1076 	#define CMDQ_BASE_OPCODE_DESTROY_CQ			   0xaUL
1077 	#define CMDQ_BASE_OPCODE_RESIZE_CQ			   0xcUL
1078 	#define CMDQ_BASE_OPCODE_ALLOCATE_MRW			   0xdUL
1079 	#define CMDQ_BASE_OPCODE_DEALLOCATE_KEY		   0xeUL
1080 	#define CMDQ_BASE_OPCODE_REGISTER_MR			   0xfUL
1081 	#define CMDQ_BASE_OPCODE_DEREGISTER_MR			   0x10UL
1082 	#define CMDQ_BASE_OPCODE_ADD_GID			   0x11UL
1083 	#define CMDQ_BASE_OPCODE_DELETE_GID			   0x12UL
1084 	#define CMDQ_BASE_OPCODE_MODIFY_GID			   0x17UL
1085 	#define CMDQ_BASE_OPCODE_QUERY_GID			   0x18UL
1086 	#define CMDQ_BASE_OPCODE_CREATE_QP1			   0x13UL
1087 	#define CMDQ_BASE_OPCODE_DESTROY_QP1			   0x14UL
1088 	#define CMDQ_BASE_OPCODE_CREATE_AH			   0x15UL
1089 	#define CMDQ_BASE_OPCODE_DESTROY_AH			   0x16UL
1090 	#define CMDQ_BASE_OPCODE_INITIALIZE_FW			   0x80UL
1091 	#define CMDQ_BASE_OPCODE_DEINITIALIZE_FW		   0x81UL
1092 	#define CMDQ_BASE_OPCODE_STOP_FUNC			   0x82UL
1093 	#define CMDQ_BASE_OPCODE_QUERY_FUNC			   0x83UL
1094 	#define CMDQ_BASE_OPCODE_SET_FUNC_RESOURCES		   0x84UL
1095 	#define CMDQ_BASE_OPCODE_READ_CONTEXT			   0x85UL
1096 	#define CMDQ_BASE_OPCODE_VF_BACKCHANNEL_REQUEST	   0x86UL
1097 	#define CMDQ_BASE_OPCODE_READ_VF_MEMORY		   0x87UL
1098 	#define CMDQ_BASE_OPCODE_COMPLETE_VF_REQUEST		   0x88UL
1099 	#define CMDQ_BASE_OPCODE_EXTEND_CONTEXT_ARRRAY		   0x89UL
1100 	#define CMDQ_BASE_OPCODE_MAP_TC_TO_COS			   0x8aUL
1101 	#define CMDQ_BASE_OPCODE_QUERY_VERSION			   0x8bUL
1102 	#define CMDQ_BASE_OPCODE_MODIFY_CC			   0x8cUL
1103 	#define CMDQ_BASE_OPCODE_QUERY_CC			   0x8dUL
1104 	#define CMDQ_BASE_OPCODE_QUERY_ROCE_STATS	   0x8eUL
1105 	u8 cmd_size;
1106 	__le16 flags;
1107 	__le16 cookie;
1108 	u8 resp_size;
1109 	u8 reserved8;
1110 	__le64 resp_addr;
1111 };
1112 
1113 /* Create QP command (96 bytes) */
1114 struct cmdq_create_qp {
1115 	u8 opcode;
1116 	#define CMDQ_CREATE_QP_OPCODE_CREATE_QP		   0x1UL
1117 	u8 cmd_size;
1118 	__le16 flags;
1119 	__le16 cookie;
1120 	u8 resp_size;
1121 	u8 reserved8;
1122 	__le64 resp_addr;
1123 	__le64 qp_handle;
1124 	__le32 qp_flags;
1125 	#define CMDQ_CREATE_QP_QP_FLAGS_SRQ_USED		   0x1UL
1126 	#define CMDQ_CREATE_QP_QP_FLAGS_FORCE_COMPLETION	   0x2UL
1127 	#define CMDQ_CREATE_QP_QP_FLAGS_RESERVED_LKEY_ENABLE      0x4UL
1128 	#define CMDQ_CREATE_QP_QP_FLAGS_FR_PMR_ENABLED		   0x8UL
1129 	u8 type;
1130 	#define CMDQ_CREATE_QP_TYPE_RC				   0x2UL
1131 	#define CMDQ_CREATE_QP_TYPE_UD				   0x4UL
1132 	#define CMDQ_CREATE_QP_TYPE_RAW_ETHERTYPE		   0x6UL
1133 	#define CMDQ_CREATE_QP_TYPE_GSI				   0x7UL
1134 	u8 sq_pg_size_sq_lvl;
1135 	#define CMDQ_CREATE_QP_SQ_LVL_MASK			    0xfUL
1136 	#define CMDQ_CREATE_QP_SQ_LVL_SFT			    0
1137 	#define CMDQ_CREATE_QP_SQ_LVL_LVL_0			   0x0UL
1138 	#define CMDQ_CREATE_QP_SQ_LVL_LVL_1			   0x1UL
1139 	#define CMDQ_CREATE_QP_SQ_LVL_LVL_2			   0x2UL
1140 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_MASK			    0xf0UL
1141 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_SFT			    4
1142 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_PG_4K		   (0x0UL << 4)
1143 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_PG_8K		   (0x1UL << 4)
1144 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_PG_64K		   (0x2UL << 4)
1145 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_PG_2M		   (0x3UL << 4)
1146 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_PG_8M		   (0x4UL << 4)
1147 	#define CMDQ_CREATE_QP_SQ_PG_SIZE_PG_1G		   (0x5UL << 4)
1148 	u8 rq_pg_size_rq_lvl;
1149 	#define CMDQ_CREATE_QP_RQ_LVL_MASK			    0xfUL
1150 	#define CMDQ_CREATE_QP_RQ_LVL_SFT			    0
1151 	#define CMDQ_CREATE_QP_RQ_LVL_LVL_0			   0x0UL
1152 	#define CMDQ_CREATE_QP_RQ_LVL_LVL_1			   0x1UL
1153 	#define CMDQ_CREATE_QP_RQ_LVL_LVL_2			   0x2UL
1154 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_MASK			    0xf0UL
1155 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_SFT			    4
1156 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_PG_4K		   (0x0UL << 4)
1157 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_PG_8K		   (0x1UL << 4)
1158 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_PG_64K		   (0x2UL << 4)
1159 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_PG_2M		   (0x3UL << 4)
1160 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_PG_8M		   (0x4UL << 4)
1161 	#define CMDQ_CREATE_QP_RQ_PG_SIZE_PG_1G		   (0x5UL << 4)
1162 	u8 unused_0;
1163 	__le32 dpi;
1164 	__le32 sq_size;
1165 	__le32 rq_size;
1166 	__le16 sq_fwo_sq_sge;
1167 	#define CMDQ_CREATE_QP_SQ_SGE_MASK			    0xfUL
1168 	#define CMDQ_CREATE_QP_SQ_SGE_SFT			    0
1169 	#define CMDQ_CREATE_QP_SQ_FWO_MASK			    0xfff0UL
1170 	#define CMDQ_CREATE_QP_SQ_FWO_SFT			    4
1171 	__le16 rq_fwo_rq_sge;
1172 	#define CMDQ_CREATE_QP_RQ_SGE_MASK			    0xfUL
1173 	#define CMDQ_CREATE_QP_RQ_SGE_SFT			    0
1174 	#define CMDQ_CREATE_QP_RQ_FWO_MASK			    0xfff0UL
1175 	#define CMDQ_CREATE_QP_RQ_FWO_SFT			    4
1176 	__le32 scq_cid;
1177 	__le32 rcq_cid;
1178 	__le32 srq_cid;
1179 	__le32 pd_id;
1180 	__le64 sq_pbl;
1181 	__le64 rq_pbl;
1182 	__le64 irrq_addr;
1183 	__le64 orrq_addr;
1184 };
1185 
1186 /* Destroy QP command (24 bytes) */
1187 struct cmdq_destroy_qp {
1188 	u8 opcode;
1189 	#define CMDQ_DESTROY_QP_OPCODE_DESTROY_QP		   0x2UL
1190 	u8 cmd_size;
1191 	__le16 flags;
1192 	__le16 cookie;
1193 	u8 resp_size;
1194 	u8 reserved8;
1195 	__le64 resp_addr;
1196 	__le32 qp_cid;
1197 	__le32 unused_0;
1198 };
1199 
1200 /* Modify QP command (112 bytes) */
1201 struct cmdq_modify_qp {
1202 	u8 opcode;
1203 	#define CMDQ_MODIFY_QP_OPCODE_MODIFY_QP		   0x3UL
1204 	u8 cmd_size;
1205 	__le16 flags;
1206 	__le16 cookie;
1207 	u8 resp_size;
1208 	u8 reserved8;
1209 	__le64 resp_addr;
1210 	__le32 modify_mask;
1211 	#define CMDQ_MODIFY_QP_MODIFY_MASK_STATE		    0x1UL
1212 	#define CMDQ_MODIFY_QP_MODIFY_MASK_EN_SQD_ASYNC_NOTIFY     0x2UL
1213 	#define CMDQ_MODIFY_QP_MODIFY_MASK_ACCESS		    0x4UL
1214 	#define CMDQ_MODIFY_QP_MODIFY_MASK_PKEY		    0x8UL
1215 	#define CMDQ_MODIFY_QP_MODIFY_MASK_QKEY		    0x10UL
1216 	#define CMDQ_MODIFY_QP_MODIFY_MASK_DGID		    0x20UL
1217 	#define CMDQ_MODIFY_QP_MODIFY_MASK_FLOW_LABEL		    0x40UL
1218 	#define CMDQ_MODIFY_QP_MODIFY_MASK_SGID_INDEX		    0x80UL
1219 	#define CMDQ_MODIFY_QP_MODIFY_MASK_HOP_LIMIT		    0x100UL
1220 	#define CMDQ_MODIFY_QP_MODIFY_MASK_TRAFFIC_CLASS	    0x200UL
1221 	#define CMDQ_MODIFY_QP_MODIFY_MASK_DEST_MAC		    0x400UL
1222 	#define CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU		    0x1000UL
1223 	#define CMDQ_MODIFY_QP_MODIFY_MASK_TIMEOUT		    0x2000UL
1224 	#define CMDQ_MODIFY_QP_MODIFY_MASK_RETRY_CNT		    0x4000UL
1225 	#define CMDQ_MODIFY_QP_MODIFY_MASK_RNR_RETRY		    0x8000UL
1226 	#define CMDQ_MODIFY_QP_MODIFY_MASK_RQ_PSN		    0x10000UL
1227 	#define CMDQ_MODIFY_QP_MODIFY_MASK_MAX_RD_ATOMIC	    0x20000UL
1228 	#define CMDQ_MODIFY_QP_MODIFY_MASK_MIN_RNR_TIMER	    0x40000UL
1229 	#define CMDQ_MODIFY_QP_MODIFY_MASK_SQ_PSN		    0x80000UL
1230 	#define CMDQ_MODIFY_QP_MODIFY_MASK_MAX_DEST_RD_ATOMIC      0x100000UL
1231 	#define CMDQ_MODIFY_QP_MODIFY_MASK_SQ_SIZE		    0x200000UL
1232 	#define CMDQ_MODIFY_QP_MODIFY_MASK_RQ_SIZE		    0x400000UL
1233 	#define CMDQ_MODIFY_QP_MODIFY_MASK_SQ_SGE		    0x800000UL
1234 	#define CMDQ_MODIFY_QP_MODIFY_MASK_RQ_SGE		    0x1000000UL
1235 	#define CMDQ_MODIFY_QP_MODIFY_MASK_MAX_INLINE_DATA	    0x2000000UL
1236 	#define CMDQ_MODIFY_QP_MODIFY_MASK_DEST_QP_ID		    0x4000000UL
1237 	#define CMDQ_MODIFY_QP_MODIFY_MASK_SRC_MAC		    0x8000000UL
1238 	#define CMDQ_MODIFY_QP_MODIFY_MASK_VLAN_ID		    0x10000000UL
1239 	#define CMDQ_MODIFY_QP_MODIFY_MASK_ENABLE_CC		    0x20000000UL
1240 	#define CMDQ_MODIFY_QP_MODIFY_MASK_TOS_ECN		    0x40000000UL
1241 	#define CMDQ_MODIFY_QP_MODIFY_MASK_TOS_DSCP		    0x80000000UL
1242 	__le32 qp_cid;
1243 	u8 network_type_en_sqd_async_notify_new_state;
1244 	#define CMDQ_MODIFY_QP_NEW_STATE_MASK			    0xfUL
1245 	#define CMDQ_MODIFY_QP_NEW_STATE_SFT			    0
1246 	#define CMDQ_MODIFY_QP_NEW_STATE_RESET			   0x0UL
1247 	#define CMDQ_MODIFY_QP_NEW_STATE_INIT			   0x1UL
1248 	#define CMDQ_MODIFY_QP_NEW_STATE_RTR			   0x2UL
1249 	#define CMDQ_MODIFY_QP_NEW_STATE_RTS			   0x3UL
1250 	#define CMDQ_MODIFY_QP_NEW_STATE_SQD			   0x4UL
1251 	#define CMDQ_MODIFY_QP_NEW_STATE_SQE			   0x5UL
1252 	#define CMDQ_MODIFY_QP_NEW_STATE_ERR			   0x6UL
1253 	#define CMDQ_MODIFY_QP_EN_SQD_ASYNC_NOTIFY		    0x10UL
1254 	#define CMDQ_MODIFY_QP_NETWORK_TYPE_MASK		    0xc0UL
1255 	#define CMDQ_MODIFY_QP_NETWORK_TYPE_SFT		    6
1256 	#define CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV1		   (0x0UL << 6)
1257 	#define CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV2_IPV4	   (0x2UL << 6)
1258 	#define CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV2_IPV6	   (0x3UL << 6)
1259 	u8 access;
1260 	#define CMDQ_MODIFY_QP_ACCESS_LOCAL_WRITE		    0x1UL
1261 	#define CMDQ_MODIFY_QP_ACCESS_REMOTE_WRITE		    0x2UL
1262 	#define CMDQ_MODIFY_QP_ACCESS_REMOTE_READ		    0x4UL
1263 	#define CMDQ_MODIFY_QP_ACCESS_REMOTE_ATOMIC		    0x8UL
1264 	__le16 pkey;
1265 	__le32 qkey;
1266 	__le32 dgid[4];
1267 	__le32 flow_label;
1268 	__le16 sgid_index;
1269 	u8 hop_limit;
1270 	u8 traffic_class;
1271 	__le16 dest_mac[3];
1272 	u8 tos_dscp_tos_ecn;
1273 	#define CMDQ_MODIFY_QP_TOS_ECN_MASK			    0x3UL
1274 	#define CMDQ_MODIFY_QP_TOS_ECN_SFT			    0
1275 	#define CMDQ_MODIFY_QP_TOS_DSCP_MASK			    0xfcUL
1276 	#define CMDQ_MODIFY_QP_TOS_DSCP_SFT			    2
1277 	u8 path_mtu;
1278 	#define CMDQ_MODIFY_QP_PATH_MTU_MASK			    0xf0UL
1279 	#define CMDQ_MODIFY_QP_PATH_MTU_SFT			    4
1280 	#define CMDQ_MODIFY_QP_PATH_MTU_MTU_256		   (0x0UL << 4)
1281 	#define CMDQ_MODIFY_QP_PATH_MTU_MTU_512		   (0x1UL << 4)
1282 	#define CMDQ_MODIFY_QP_PATH_MTU_MTU_1024		   (0x2UL << 4)
1283 	#define CMDQ_MODIFY_QP_PATH_MTU_MTU_2048		   (0x3UL << 4)
1284 	#define CMDQ_MODIFY_QP_PATH_MTU_MTU_4096		   (0x4UL << 4)
1285 	#define CMDQ_MODIFY_QP_PATH_MTU_MTU_8192		   (0x5UL << 4)
1286 	u8 timeout;
1287 	u8 retry_cnt;
1288 	u8 rnr_retry;
1289 	u8 min_rnr_timer;
1290 	__le32 rq_psn;
1291 	__le32 sq_psn;
1292 	u8 max_rd_atomic;
1293 	u8 max_dest_rd_atomic;
1294 	__le16 enable_cc;
1295 	#define CMDQ_MODIFY_QP_ENABLE_CC			    0x1UL
1296 	__le32 sq_size;
1297 	__le32 rq_size;
1298 	__le16 sq_sge;
1299 	__le16 rq_sge;
1300 	__le32 max_inline_data;
1301 	__le32 dest_qp_id;
1302 	__le32 unused_3;
1303 	__le16 src_mac[3];
1304 	__le16 vlan_pcp_vlan_dei_vlan_id;
1305 	#define CMDQ_MODIFY_QP_VLAN_ID_MASK			    0xfffUL
1306 	#define CMDQ_MODIFY_QP_VLAN_ID_SFT			    0
1307 	#define CMDQ_MODIFY_QP_VLAN_DEI			    0x1000UL
1308 	#define CMDQ_MODIFY_QP_VLAN_PCP_MASK			    0xe000UL
1309 	#define CMDQ_MODIFY_QP_VLAN_PCP_SFT			    13
1310 };
1311 
1312 /* Query QP command (24 bytes) */
1313 struct cmdq_query_qp {
1314 	u8 opcode;
1315 	#define CMDQ_QUERY_QP_OPCODE_QUERY_QP			   0x4UL
1316 	u8 cmd_size;
1317 	__le16 flags;
1318 	__le16 cookie;
1319 	u8 resp_size;
1320 	u8 reserved8;
1321 	__le64 resp_addr;
1322 	__le32 qp_cid;
1323 	__le32 unused_0;
1324 };
1325 
1326 /* Create SRQ command (48 bytes) */
1327 struct cmdq_create_srq {
1328 	u8 opcode;
1329 	#define CMDQ_CREATE_SRQ_OPCODE_CREATE_SRQ		   0x5UL
1330 	u8 cmd_size;
1331 	__le16 flags;
1332 	__le16 cookie;
1333 	u8 resp_size;
1334 	u8 reserved8;
1335 	__le64 resp_addr;
1336 	__le64 srq_handle;
1337 	__le16 pg_size_lvl;
1338 	#define CMDQ_CREATE_SRQ_LVL_MASK			    0x3UL
1339 	#define CMDQ_CREATE_SRQ_LVL_SFT			    0
1340 	#define CMDQ_CREATE_SRQ_LVL_LVL_0			   0x0UL
1341 	#define CMDQ_CREATE_SRQ_LVL_LVL_1			   0x1UL
1342 	#define CMDQ_CREATE_SRQ_LVL_LVL_2			   0x2UL
1343 	#define CMDQ_CREATE_SRQ_PG_SIZE_MASK			    0x1cUL
1344 	#define CMDQ_CREATE_SRQ_PG_SIZE_SFT			    2
1345 	#define CMDQ_CREATE_SRQ_PG_SIZE_PG_4K			   (0x0UL << 2)
1346 	#define CMDQ_CREATE_SRQ_PG_SIZE_PG_8K			   (0x1UL << 2)
1347 	#define CMDQ_CREATE_SRQ_PG_SIZE_PG_64K			   (0x2UL << 2)
1348 	#define CMDQ_CREATE_SRQ_PG_SIZE_PG_2M			   (0x3UL << 2)
1349 	#define CMDQ_CREATE_SRQ_PG_SIZE_PG_8M			   (0x4UL << 2)
1350 	#define CMDQ_CREATE_SRQ_PG_SIZE_PG_1G			   (0x5UL << 2)
1351 	__le16 eventq_id;
1352 	#define CMDQ_CREATE_SRQ_EVENTQ_ID_MASK			    0xfffUL
1353 	#define CMDQ_CREATE_SRQ_EVENTQ_ID_SFT			    0
1354 	__le16 srq_size;
1355 	__le16 srq_fwo;
1356 	__le32 dpi;
1357 	__le32 pd_id;
1358 	__le64 pbl;
1359 };
1360 
1361 /* Destroy SRQ command (24 bytes) */
1362 struct cmdq_destroy_srq {
1363 	u8 opcode;
1364 	#define CMDQ_DESTROY_SRQ_OPCODE_DESTROY_SRQ		   0x6UL
1365 	u8 cmd_size;
1366 	__le16 flags;
1367 	__le16 cookie;
1368 	u8 resp_size;
1369 	u8 reserved8;
1370 	__le64 resp_addr;
1371 	__le32 srq_cid;
1372 	__le32 unused_0;
1373 };
1374 
1375 /* Query SRQ command (24 bytes) */
1376 struct cmdq_query_srq {
1377 	u8 opcode;
1378 	#define CMDQ_QUERY_SRQ_OPCODE_QUERY_SRQ		   0x8UL
1379 	u8 cmd_size;
1380 	__le16 flags;
1381 	__le16 cookie;
1382 	u8 resp_size;
1383 	u8 reserved8;
1384 	__le64 resp_addr;
1385 	__le32 srq_cid;
1386 	__le32 unused_0;
1387 };
1388 
1389 /* Create CQ command (48 bytes) */
1390 struct cmdq_create_cq {
1391 	u8 opcode;
1392 	#define CMDQ_CREATE_CQ_OPCODE_CREATE_CQ		   0x9UL
1393 	u8 cmd_size;
1394 	__le16 flags;
1395 	__le16 cookie;
1396 	u8 resp_size;
1397 	u8 reserved8;
1398 	__le64 resp_addr;
1399 	__le64 cq_handle;
1400 	__le32 pg_size_lvl;
1401 	#define CMDQ_CREATE_CQ_LVL_MASK			    0x3UL
1402 	#define CMDQ_CREATE_CQ_LVL_SFT				    0
1403 	#define CMDQ_CREATE_CQ_LVL_LVL_0			   0x0UL
1404 	#define CMDQ_CREATE_CQ_LVL_LVL_1			   0x1UL
1405 	#define CMDQ_CREATE_CQ_LVL_LVL_2			   0x2UL
1406 	#define CMDQ_CREATE_CQ_PG_SIZE_MASK			    0x1cUL
1407 	#define CMDQ_CREATE_CQ_PG_SIZE_SFT			    2
1408 	#define CMDQ_CREATE_CQ_PG_SIZE_PG_4K			   (0x0UL << 2)
1409 	#define CMDQ_CREATE_CQ_PG_SIZE_PG_8K			   (0x1UL << 2)
1410 	#define CMDQ_CREATE_CQ_PG_SIZE_PG_64K			   (0x2UL << 2)
1411 	#define CMDQ_CREATE_CQ_PG_SIZE_PG_2M			   (0x3UL << 2)
1412 	#define CMDQ_CREATE_CQ_PG_SIZE_PG_8M			   (0x4UL << 2)
1413 	#define CMDQ_CREATE_CQ_PG_SIZE_PG_1G			   (0x5UL << 2)
1414 	__le32 cq_fco_cnq_id;
1415 	#define CMDQ_CREATE_CQ_CNQ_ID_MASK			    0xfffUL
1416 	#define CMDQ_CREATE_CQ_CNQ_ID_SFT			    0
1417 	#define CMDQ_CREATE_CQ_CQ_FCO_MASK			    0xfffff000UL
1418 	#define CMDQ_CREATE_CQ_CQ_FCO_SFT			    12
1419 	__le32 dpi;
1420 	__le32 cq_size;
1421 	__le64 pbl;
1422 };
1423 
1424 /* Destroy CQ command (24 bytes) */
1425 struct cmdq_destroy_cq {
1426 	u8 opcode;
1427 	#define CMDQ_DESTROY_CQ_OPCODE_DESTROY_CQ		   0xaUL
1428 	u8 cmd_size;
1429 	__le16 flags;
1430 	__le16 cookie;
1431 	u8 resp_size;
1432 	u8 reserved8;
1433 	__le64 resp_addr;
1434 	__le32 cq_cid;
1435 	__le32 unused_0;
1436 };
1437 
1438 /* Resize CQ command (40 bytes) */
1439 struct cmdq_resize_cq {
1440 	u8 opcode;
1441 	#define CMDQ_RESIZE_CQ_OPCODE_RESIZE_CQ		   0xcUL
1442 	u8 cmd_size;
1443 	__le16 flags;
1444 	__le16 cookie;
1445 	u8 resp_size;
1446 	u8 reserved8;
1447 	__le64 resp_addr;
1448 	__le32 cq_cid;
1449 	__le32 new_cq_size_pg_size_lvl;
1450 	#define CMDQ_RESIZE_CQ_LVL_MASK			    0x3UL
1451 	#define CMDQ_RESIZE_CQ_LVL_SFT				    0
1452 	#define CMDQ_RESIZE_CQ_LVL_LVL_0			   0x0UL
1453 	#define CMDQ_RESIZE_CQ_LVL_LVL_1			   0x1UL
1454 	#define CMDQ_RESIZE_CQ_LVL_LVL_2			   0x2UL
1455 	#define CMDQ_RESIZE_CQ_PG_SIZE_MASK			    0x1cUL
1456 	#define CMDQ_RESIZE_CQ_PG_SIZE_SFT			    2
1457 	#define CMDQ_RESIZE_CQ_PG_SIZE_PG_4K			   (0x0UL << 2)
1458 	#define CMDQ_RESIZE_CQ_PG_SIZE_PG_8K			   (0x1UL << 2)
1459 	#define CMDQ_RESIZE_CQ_PG_SIZE_PG_64K			   (0x2UL << 2)
1460 	#define CMDQ_RESIZE_CQ_PG_SIZE_PG_2M			   (0x3UL << 2)
1461 	#define CMDQ_RESIZE_CQ_PG_SIZE_PG_8M			   (0x4UL << 2)
1462 	#define CMDQ_RESIZE_CQ_PG_SIZE_PG_1G			   (0x5UL << 2)
1463 	#define CMDQ_RESIZE_CQ_NEW_CQ_SIZE_MASK		    0x1fffe0UL
1464 	#define CMDQ_RESIZE_CQ_NEW_CQ_SIZE_SFT			    5
1465 	__le64 new_pbl;
1466 	__le32 new_cq_fco;
1467 	__le32 unused_2;
1468 };
1469 
1470 /* Allocate MRW command (32 bytes) */
1471 struct cmdq_allocate_mrw {
1472 	u8 opcode;
1473 	#define CMDQ_ALLOCATE_MRW_OPCODE_ALLOCATE_MRW		   0xdUL
1474 	u8 cmd_size;
1475 	__le16 flags;
1476 	__le16 cookie;
1477 	u8 resp_size;
1478 	u8 reserved8;
1479 	__le64 resp_addr;
1480 	__le64 mrw_handle;
1481 	u8 mrw_flags;
1482 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_MASK		    0xfUL
1483 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_SFT		    0
1484 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_MR			   0x0UL
1485 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR		   0x1UL
1486 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1		   0x2UL
1487 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A		   0x3UL
1488 	#define CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B		   0x4UL
1489 	u8 access;
1490 	#define CMDQ_ALLOCATE_MRW_ACCESS_RESERVED_MASK		    0x1fUL
1491 	#define CMDQ_ALLOCATE_MRW_ACCESS_RESERVED_SFT		    0
1492 	#define CMDQ_ALLOCATE_MRW_ACCESS_CONSUMER_OWNED_KEY	    0x20UL
1493 	__le16 unused_1;
1494 	__le32 pd_id;
1495 };
1496 
1497 /* De-allocate key command (24 bytes) */
1498 struct cmdq_deallocate_key {
1499 	u8 opcode;
1500 	#define CMDQ_DEALLOCATE_KEY_OPCODE_DEALLOCATE_KEY	   0xeUL
1501 	u8 cmd_size;
1502 	__le16 flags;
1503 	__le16 cookie;
1504 	u8 resp_size;
1505 	u8 reserved8;
1506 	__le64 resp_addr;
1507 	u8 mrw_flags;
1508 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_MASK		    0xfUL
1509 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_SFT		    0
1510 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_MR		   0x0UL
1511 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_PMR		   0x1UL
1512 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_MW_TYPE1		   0x2UL
1513 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_MW_TYPE2A	   0x3UL
1514 	#define CMDQ_DEALLOCATE_KEY_MRW_FLAGS_MW_TYPE2B	   0x4UL
1515 	u8 unused_1[3];
1516 	__le32 key;
1517 };
1518 
1519 /* Register MR command (48 bytes) */
1520 struct cmdq_register_mr {
1521 	u8 opcode;
1522 	#define CMDQ_REGISTER_MR_OPCODE_REGISTER_MR		   0xfUL
1523 	u8 cmd_size;
1524 	__le16 flags;
1525 	__le16 cookie;
1526 	u8 resp_size;
1527 	u8 reserved8;
1528 	__le64 resp_addr;
1529 	u8 log2_pg_size_lvl;
1530 	#define CMDQ_REGISTER_MR_LVL_MASK			    0x3UL
1531 	#define CMDQ_REGISTER_MR_LVL_SFT			    0
1532 	#define CMDQ_REGISTER_MR_LVL_LVL_0			   0x0UL
1533 	#define CMDQ_REGISTER_MR_LVL_LVL_1			   0x1UL
1534 	#define CMDQ_REGISTER_MR_LVL_LVL_2			   0x2UL
1535 	#define CMDQ_REGISTER_MR_LVL_LAST             CMDQ_REGISTER_MR_LVL_LVL_2
1536 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_MASK		    0x7cUL
1537 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_SFT		    2
1538 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_4K    (0xcUL << 2)
1539 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_8K    (0xdUL << 2)
1540 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_64K   (0x10UL << 2)
1541 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_256K  (0x12UL << 2)
1542 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_1M    (0x14UL << 2)
1543 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_2M    (0x15UL << 2)
1544 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_4M    (0x16UL << 2)
1545 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_1G    (0x1eUL << 2)
1546 	#define CMDQ_REGISTER_MR_LOG2_PG_SIZE_LAST	\
1547 					CMDQ_REGISTER_MR_LOG2_PG_SIZE_PG_1G
1548 	#define CMDQ_REGISTER_MR_UNUSED1             0x80UL
1549 	u8 access;
1550 	#define CMDQ_REGISTER_MR_ACCESS_LOCAL_WRITE		    0x1UL
1551 	#define CMDQ_REGISTER_MR_ACCESS_REMOTE_READ		    0x2UL
1552 	#define CMDQ_REGISTER_MR_ACCESS_REMOTE_WRITE		    0x4UL
1553 	#define CMDQ_REGISTER_MR_ACCESS_REMOTE_ATOMIC		    0x8UL
1554 	#define CMDQ_REGISTER_MR_ACCESS_MW_BIND		    0x10UL
1555 	#define CMDQ_REGISTER_MR_ACCESS_ZERO_BASED		    0x20UL
1556 	__le16	log2_pbl_pg_size;
1557 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_MASK   0x1fUL
1558 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_SFT    0
1559 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_4K    0xcUL
1560 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_8K    0xdUL
1561 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_64K   0x10UL
1562 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_256K  0x12UL
1563 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_1M    0x14UL
1564 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_2M    0x15UL
1565 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_4M    0x16UL
1566 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_1G    0x1eUL
1567 	#define CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_LAST    \
1568 				CMDQ_REGISTER_MR_LOG2_PBL_PG_SIZE_PG_1G
1569 	#define CMDQ_REGISTER_MR_UNUSED11_MASK           0xffe0UL
1570 	#define CMDQ_REGISTER_MR_UNUSED11_SFT            5
1571 	__le32 key;
1572 	__le64 pbl;
1573 	__le64 va;
1574 	__le64 mr_size;
1575 };
1576 
1577 /* Deregister MR command (24 bytes) */
1578 struct cmdq_deregister_mr {
1579 	u8 opcode;
1580 	#define CMDQ_DEREGISTER_MR_OPCODE_DEREGISTER_MR	   0x10UL
1581 	u8 cmd_size;
1582 	__le16 flags;
1583 	__le16 cookie;
1584 	u8 resp_size;
1585 	u8 reserved8;
1586 	__le64 resp_addr;
1587 	__le32 lkey;
1588 	__le32 unused_0;
1589 };
1590 
1591 /* Add GID command (48 bytes) */
1592 struct cmdq_add_gid {
1593 	u8 opcode;
1594 	#define CMDQ_ADD_GID_OPCODE_ADD_GID			   0x11UL
1595 	u8 cmd_size;
1596 	__le16 flags;
1597 	__le16 cookie;
1598 	u8 resp_size;
1599 	u8 reserved8;
1600 	__le64 resp_addr;
1601 	__be32 gid[4];
1602 	__be16 src_mac[3];
1603 	__le16 vlan;
1604 	#define CMDQ_ADD_GID_VLAN_VLAN_ID_MASK			    0xfffUL
1605 	#define CMDQ_ADD_GID_VLAN_VLAN_ID_SFT			    0
1606 	#define CMDQ_ADD_GID_VLAN_TPID_MASK			    0x7000UL
1607 	#define CMDQ_ADD_GID_VLAN_TPID_SFT			    12
1608 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_88A8		   (0x0UL << 12)
1609 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_8100		   (0x1UL << 12)
1610 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_9100		   (0x2UL << 12)
1611 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_9200		   (0x3UL << 12)
1612 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_9300		   (0x4UL << 12)
1613 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_CFG1		   (0x5UL << 12)
1614 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_CFG2		   (0x6UL << 12)
1615 	#define CMDQ_ADD_GID_VLAN_TPID_TPID_CFG3		   (0x7UL << 12)
1616 	#define CMDQ_ADD_GID_VLAN_TPID_LAST    CMDQ_ADD_GID_VLAN_TPID_TPID_CFG3
1617 	#define CMDQ_ADD_GID_VLAN_VLAN_EN			    0x8000UL
1618 	__le16 ipid;
1619 	__le16 stats_ctx;
1620 	#define CMDQ_ADD_GID_STATS_CTX_STATS_CTX_ID_MASK	    0x7fffUL
1621 	#define CMDQ_ADD_GID_STATS_CTX_STATS_CTX_ID_SFT	    0
1622 	#define CMDQ_ADD_GID_STATS_CTX_STATS_CTX_VALID		    0x8000UL
1623 	__le32 unused_0;
1624 };
1625 
1626 /* Delete GID command (24 bytes) */
1627 struct cmdq_delete_gid {
1628 	u8 opcode;
1629 	#define CMDQ_DELETE_GID_OPCODE_DELETE_GID		   0x12UL
1630 	u8 cmd_size;
1631 	__le16 flags;
1632 	__le16 cookie;
1633 	u8 resp_size;
1634 	u8 reserved8;
1635 	__le64 resp_addr;
1636 	__le16 gid_index;
1637 	__le16 unused_0;
1638 	__le32 unused_1;
1639 };
1640 
1641 /* Modify GID command (48 bytes) */
1642 struct cmdq_modify_gid {
1643 	u8 opcode;
1644 	#define CMDQ_MODIFY_GID_OPCODE_MODIFY_GID		   0x17UL
1645 	u8 cmd_size;
1646 	__le16 flags;
1647 	__le16 cookie;
1648 	u8 resp_size;
1649 	u8 reserved8;
1650 	__le64 resp_addr;
1651 	__be32 gid[4];
1652 	__be16 src_mac[3];
1653 	__le16 vlan;
1654 	#define CMDQ_MODIFY_GID_VLAN_VLAN_ID_MASK		    0xfffUL
1655 	#define CMDQ_MODIFY_GID_VLAN_VLAN_ID_SFT		    0
1656 	#define CMDQ_MODIFY_GID_VLAN_TPID_MASK			    0x7000UL
1657 	#define CMDQ_MODIFY_GID_VLAN_TPID_SFT			    12
1658 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_88A8		   (0x0UL << 12)
1659 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_8100		   (0x1UL << 12)
1660 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_9100		   (0x2UL << 12)
1661 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_9200		   (0x3UL << 12)
1662 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_9300		   (0x4UL << 12)
1663 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_CFG1		   (0x5UL << 12)
1664 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_CFG2		   (0x6UL << 12)
1665 	#define CMDQ_MODIFY_GID_VLAN_TPID_TPID_CFG3		   (0x7UL << 12)
1666 	#define CMDQ_MODIFY_GID_VLAN_TPID_LAST		\
1667 					CMDQ_MODIFY_GID_VLAN_TPID_TPID_CFG3
1668 	#define CMDQ_MODIFY_GID_VLAN_VLAN_EN			    0x8000UL
1669 	__le16 ipid;
1670 	__le16 gid_index;
1671 	__le16 stats_ctx;
1672 	#define CMDQ_MODIFY_GID_STATS_CTX_STATS_CTX_ID_MASK	    0x7fffUL
1673 	#define CMDQ_MODIFY_GID_STATS_CTX_STATS_CTX_ID_SFT	    0
1674 	#define CMDQ_MODIFY_GID_STATS_CTX_STATS_CTX_VALID	    0x8000UL
1675 	__le16 unused_0;
1676 };
1677 
1678 /* Query GID command (24 bytes) */
1679 struct cmdq_query_gid {
1680 	u8 opcode;
1681 	#define CMDQ_QUERY_GID_OPCODE_QUERY_GID		   0x18UL
1682 	u8 cmd_size;
1683 	__le16 flags;
1684 	__le16 cookie;
1685 	u8 resp_size;
1686 	u8 reserved8;
1687 	__le64 resp_addr;
1688 	__le16 gid_index;
1689 	__le16 unused_0;
1690 	__le32 unused_1;
1691 };
1692 
1693 /* Create QP1 command (80 bytes) */
1694 struct cmdq_create_qp1 {
1695 	u8 opcode;
1696 	#define CMDQ_CREATE_QP1_OPCODE_CREATE_QP1		   0x13UL
1697 	u8 cmd_size;
1698 	__le16 flags;
1699 	__le16 cookie;
1700 	u8 resp_size;
1701 	u8 reserved8;
1702 	__le64 resp_addr;
1703 	__le64 qp_handle;
1704 	__le32 qp_flags;
1705 	#define CMDQ_CREATE_QP1_QP_FLAGS_SRQ_USED		   0x1UL
1706 	#define CMDQ_CREATE_QP1_QP_FLAGS_FORCE_COMPLETION	   0x2UL
1707 	#define CMDQ_CREATE_QP1_QP_FLAGS_RESERVED_LKEY_ENABLE     0x4UL
1708 	u8 type;
1709 	#define CMDQ_CREATE_QP1_TYPE_GSI			   0x1UL
1710 	u8 sq_pg_size_sq_lvl;
1711 	#define CMDQ_CREATE_QP1_SQ_LVL_MASK			    0xfUL
1712 	#define CMDQ_CREATE_QP1_SQ_LVL_SFT			    0
1713 	#define CMDQ_CREATE_QP1_SQ_LVL_LVL_0			   0x0UL
1714 	#define CMDQ_CREATE_QP1_SQ_LVL_LVL_1			   0x1UL
1715 	#define CMDQ_CREATE_QP1_SQ_LVL_LVL_2			   0x2UL
1716 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_MASK		    0xf0UL
1717 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_SFT			    4
1718 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_PG_4K		   (0x0UL << 4)
1719 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_PG_8K		   (0x1UL << 4)
1720 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_PG_64K		   (0x2UL << 4)
1721 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_PG_2M		   (0x3UL << 4)
1722 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_PG_8M		   (0x4UL << 4)
1723 	#define CMDQ_CREATE_QP1_SQ_PG_SIZE_PG_1G		   (0x5UL << 4)
1724 	u8 rq_pg_size_rq_lvl;
1725 	#define CMDQ_CREATE_QP1_RQ_LVL_MASK			    0xfUL
1726 	#define CMDQ_CREATE_QP1_RQ_LVL_SFT			    0
1727 	#define CMDQ_CREATE_QP1_RQ_LVL_LVL_0			   0x0UL
1728 	#define CMDQ_CREATE_QP1_RQ_LVL_LVL_1			   0x1UL
1729 	#define CMDQ_CREATE_QP1_RQ_LVL_LVL_2			   0x2UL
1730 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_MASK		    0xf0UL
1731 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_SFT			    4
1732 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_PG_4K		   (0x0UL << 4)
1733 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_PG_8K		   (0x1UL << 4)
1734 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_PG_64K		   (0x2UL << 4)
1735 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_PG_2M		   (0x3UL << 4)
1736 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_PG_8M		   (0x4UL << 4)
1737 	#define CMDQ_CREATE_QP1_RQ_PG_SIZE_PG_1G		   (0x5UL << 4)
1738 	u8 unused_0;
1739 	__le32 dpi;
1740 	__le32 sq_size;
1741 	__le32 rq_size;
1742 	__le16 sq_fwo_sq_sge;
1743 	#define CMDQ_CREATE_QP1_SQ_SGE_MASK			    0xfUL
1744 	#define CMDQ_CREATE_QP1_SQ_SGE_SFT			    0
1745 	#define CMDQ_CREATE_QP1_SQ_FWO_MASK			    0xfff0UL
1746 	#define CMDQ_CREATE_QP1_SQ_FWO_SFT			    4
1747 	__le16 rq_fwo_rq_sge;
1748 	#define CMDQ_CREATE_QP1_RQ_SGE_MASK			    0xfUL
1749 	#define CMDQ_CREATE_QP1_RQ_SGE_SFT			    0
1750 	#define CMDQ_CREATE_QP1_RQ_FWO_MASK			    0xfff0UL
1751 	#define CMDQ_CREATE_QP1_RQ_FWO_SFT			    4
1752 	__le32 scq_cid;
1753 	__le32 rcq_cid;
1754 	__le32 srq_cid;
1755 	__le32 pd_id;
1756 	__le64 sq_pbl;
1757 	__le64 rq_pbl;
1758 };
1759 
1760 /* Destroy QP1 command (24 bytes) */
1761 struct cmdq_destroy_qp1 {
1762 	u8 opcode;
1763 	#define CMDQ_DESTROY_QP1_OPCODE_DESTROY_QP1		   0x14UL
1764 	u8 cmd_size;
1765 	__le16 flags;
1766 	__le16 cookie;
1767 	u8 resp_size;
1768 	u8 reserved8;
1769 	__le64 resp_addr;
1770 	__le32 qp1_cid;
1771 	__le32 unused_0;
1772 };
1773 
1774 /* Create AH command (64 bytes) */
1775 struct cmdq_create_ah {
1776 	u8 opcode;
1777 	#define CMDQ_CREATE_AH_OPCODE_CREATE_AH		   0x15UL
1778 	u8 cmd_size;
1779 	__le16 flags;
1780 	__le16 cookie;
1781 	u8 resp_size;
1782 	u8 reserved8;
1783 	__le64 resp_addr;
1784 	__le64 ah_handle;
1785 	__le32 dgid[4];
1786 	u8 type;
1787 	#define CMDQ_CREATE_AH_TYPE_V1				   0x0UL
1788 	#define CMDQ_CREATE_AH_TYPE_V2IPV4			   0x2UL
1789 	#define CMDQ_CREATE_AH_TYPE_V2IPV6			   0x3UL
1790 	u8 hop_limit;
1791 	__le16 sgid_index;
1792 	__le32 dest_vlan_id_flow_label;
1793 	#define CMDQ_CREATE_AH_FLOW_LABEL_MASK			    0xfffffUL
1794 	#define CMDQ_CREATE_AH_FLOW_LABEL_SFT			    0
1795 	#define CMDQ_CREATE_AH_DEST_VLAN_ID_MASK		    0xfff00000UL
1796 	#define CMDQ_CREATE_AH_DEST_VLAN_ID_SFT		    20
1797 	__le32 pd_id;
1798 	__le32 unused_0;
1799 	__le16 dest_mac[3];
1800 	u8 traffic_class;
1801 	u8 unused_1;
1802 };
1803 
1804 /* Destroy AH command (24 bytes) */
1805 struct cmdq_destroy_ah {
1806 	u8 opcode;
1807 	#define CMDQ_DESTROY_AH_OPCODE_DESTROY_AH		   0x16UL
1808 	u8 cmd_size;
1809 	__le16 flags;
1810 	__le16 cookie;
1811 	u8 resp_size;
1812 	u8 reserved8;
1813 	__le64 resp_addr;
1814 	__le32 ah_cid;
1815 	__le32 unused_0;
1816 };
1817 
1818 /* Initialize Firmware command (112 bytes) */
1819 struct cmdq_initialize_fw {
1820 	u8 opcode;
1821 	#define CMDQ_INITIALIZE_FW_OPCODE_INITIALIZE_FW	   0x80UL
1822 	u8 cmd_size;
1823 	__le16 flags;
1824 	__le16 cookie;
1825 	u8 resp_size;
1826 	u8 reserved8;
1827 	__le64 resp_addr;
1828 	u8 qpc_pg_size_qpc_lvl;
1829 	#define CMDQ_INITIALIZE_FW_QPC_LVL_MASK		    0xfUL
1830 	#define CMDQ_INITIALIZE_FW_QPC_LVL_SFT			    0
1831 	#define CMDQ_INITIALIZE_FW_QPC_LVL_LVL_0		   0x0UL
1832 	#define CMDQ_INITIALIZE_FW_QPC_LVL_LVL_1		   0x1UL
1833 	#define CMDQ_INITIALIZE_FW_QPC_LVL_LVL_2		   0x2UL
1834 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_MASK		    0xf0UL
1835 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_SFT		    4
1836 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_PG_4K		   (0x0UL << 4)
1837 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_PG_8K		   (0x1UL << 4)
1838 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_PG_64K		   (0x2UL << 4)
1839 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_PG_2M		   (0x3UL << 4)
1840 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_PG_8M		   (0x4UL << 4)
1841 	#define CMDQ_INITIALIZE_FW_QPC_PG_SIZE_PG_1G		   (0x5UL << 4)
1842 	u8 mrw_pg_size_mrw_lvl;
1843 	#define CMDQ_INITIALIZE_FW_MRW_LVL_MASK		    0xfUL
1844 	#define CMDQ_INITIALIZE_FW_MRW_LVL_SFT			    0
1845 	#define CMDQ_INITIALIZE_FW_MRW_LVL_LVL_0		   0x0UL
1846 	#define CMDQ_INITIALIZE_FW_MRW_LVL_LVL_1		   0x1UL
1847 	#define CMDQ_INITIALIZE_FW_MRW_LVL_LVL_2		   0x2UL
1848 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_MASK		    0xf0UL
1849 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_SFT		    4
1850 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_PG_4K		   (0x0UL << 4)
1851 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_PG_8K		   (0x1UL << 4)
1852 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_PG_64K		   (0x2UL << 4)
1853 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_PG_2M		   (0x3UL << 4)
1854 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_PG_8M		   (0x4UL << 4)
1855 	#define CMDQ_INITIALIZE_FW_MRW_PG_SIZE_PG_1G		   (0x5UL << 4)
1856 	u8 srq_pg_size_srq_lvl;
1857 	#define CMDQ_INITIALIZE_FW_SRQ_LVL_MASK		    0xfUL
1858 	#define CMDQ_INITIALIZE_FW_SRQ_LVL_SFT			    0
1859 	#define CMDQ_INITIALIZE_FW_SRQ_LVL_LVL_0		   0x0UL
1860 	#define CMDQ_INITIALIZE_FW_SRQ_LVL_LVL_1		   0x1UL
1861 	#define CMDQ_INITIALIZE_FW_SRQ_LVL_LVL_2		   0x2UL
1862 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_MASK		    0xf0UL
1863 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_SFT		    4
1864 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_PG_4K		   (0x0UL << 4)
1865 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_PG_8K		   (0x1UL << 4)
1866 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_PG_64K		   (0x2UL << 4)
1867 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_PG_2M		   (0x3UL << 4)
1868 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_PG_8M		   (0x4UL << 4)
1869 	#define CMDQ_INITIALIZE_FW_SRQ_PG_SIZE_PG_1G		   (0x5UL << 4)
1870 	u8 cq_pg_size_cq_lvl;
1871 	#define CMDQ_INITIALIZE_FW_CQ_LVL_MASK			    0xfUL
1872 	#define CMDQ_INITIALIZE_FW_CQ_LVL_SFT			    0
1873 	#define CMDQ_INITIALIZE_FW_CQ_LVL_LVL_0		   0x0UL
1874 	#define CMDQ_INITIALIZE_FW_CQ_LVL_LVL_1		   0x1UL
1875 	#define CMDQ_INITIALIZE_FW_CQ_LVL_LVL_2		   0x2UL
1876 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_MASK		    0xf0UL
1877 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_SFT		    4
1878 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_PG_4K		   (0x0UL << 4)
1879 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_PG_8K		   (0x1UL << 4)
1880 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_PG_64K		   (0x2UL << 4)
1881 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_PG_2M		   (0x3UL << 4)
1882 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_PG_8M		   (0x4UL << 4)
1883 	#define CMDQ_INITIALIZE_FW_CQ_PG_SIZE_PG_1G		   (0x5UL << 4)
1884 	u8 tqm_pg_size_tqm_lvl;
1885 	#define CMDQ_INITIALIZE_FW_TQM_LVL_MASK		    0xfUL
1886 	#define CMDQ_INITIALIZE_FW_TQM_LVL_SFT			    0
1887 	#define CMDQ_INITIALIZE_FW_TQM_LVL_LVL_0		   0x0UL
1888 	#define CMDQ_INITIALIZE_FW_TQM_LVL_LVL_1		   0x1UL
1889 	#define CMDQ_INITIALIZE_FW_TQM_LVL_LVL_2		   0x2UL
1890 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_MASK		    0xf0UL
1891 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_SFT		    4
1892 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_PG_4K		   (0x0UL << 4)
1893 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_PG_8K		   (0x1UL << 4)
1894 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_PG_64K		   (0x2UL << 4)
1895 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_PG_2M		   (0x3UL << 4)
1896 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_PG_8M		   (0x4UL << 4)
1897 	#define CMDQ_INITIALIZE_FW_TQM_PG_SIZE_PG_1G		   (0x5UL << 4)
1898 	u8 tim_pg_size_tim_lvl;
1899 	#define CMDQ_INITIALIZE_FW_TIM_LVL_MASK		    0xfUL
1900 	#define CMDQ_INITIALIZE_FW_TIM_LVL_SFT			    0
1901 	#define CMDQ_INITIALIZE_FW_TIM_LVL_LVL_0		   0x0UL
1902 	#define CMDQ_INITIALIZE_FW_TIM_LVL_LVL_1		   0x1UL
1903 	#define CMDQ_INITIALIZE_FW_TIM_LVL_LVL_2		   0x2UL
1904 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_MASK		    0xf0UL
1905 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_SFT		    4
1906 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_4K		   (0x0UL << 4)
1907 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_8K		   (0x1UL << 4)
1908 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_64K		   (0x2UL << 4)
1909 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_2M		   (0x3UL << 4)
1910 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_8M		   (0x4UL << 4)
1911 	#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_1G		   (0x5UL << 4)
1912 	/* This value is (log-base-2-of-DBR-page-size - 12).
1913 	 * 0 for 4KB. HW supported values are enumerated below.
1914 	 */
1915 	__le16  log2_dbr_pg_size;
1916 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_MASK	0xfUL
1917 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_SFT		0
1918 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_4K	0x0UL
1919 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_8K	0x1UL
1920 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_16K	0x2UL
1921 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_32K	0x3UL
1922 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_64K	0x4UL
1923 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128K	0x5UL
1924 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_256K	0x6UL
1925 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_512K	0x7UL
1926 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_1M	0x8UL
1927 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_2M	0x9UL
1928 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_4M	0xaUL
1929 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_8M	0xbUL
1930 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_16M	0xcUL
1931 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_32M	0xdUL
1932 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_64M	0xeUL
1933 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128M	0xfUL
1934 	#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_LAST		\
1935 			CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128M
1936 	__le64 qpc_page_dir;
1937 	__le64 mrw_page_dir;
1938 	__le64 srq_page_dir;
1939 	__le64 cq_page_dir;
1940 	__le64 tqm_page_dir;
1941 	__le64 tim_page_dir;
1942 	__le32 number_of_qp;
1943 	__le32 number_of_mrw;
1944 	__le32 number_of_srq;
1945 	__le32 number_of_cq;
1946 	__le32 max_qp_per_vf;
1947 	__le32 max_mrw_per_vf;
1948 	__le32 max_srq_per_vf;
1949 	__le32 max_cq_per_vf;
1950 	__le32 max_gid_per_vf;
1951 	__le32 stat_ctx_id;
1952 };
1953 
1954 /* De-initialize Firmware command (16 bytes) */
1955 struct cmdq_deinitialize_fw {
1956 	u8 opcode;
1957 	#define CMDQ_DEINITIALIZE_FW_OPCODE_DEINITIALIZE_FW       0x81UL
1958 	u8 cmd_size;
1959 	__le16 flags;
1960 	__le16 cookie;
1961 	u8 resp_size;
1962 	u8 reserved8;
1963 	__le64 resp_addr;
1964 };
1965 
1966 /* Stop function command (16 bytes) */
1967 struct cmdq_stop_func {
1968 	u8 opcode;
1969 	#define CMDQ_STOP_FUNC_OPCODE_STOP_FUNC		   0x82UL
1970 	u8 cmd_size;
1971 	__le16 flags;
1972 	__le16 cookie;
1973 	u8 resp_size;
1974 	u8 reserved8;
1975 	__le64 resp_addr;
1976 };
1977 
1978 /* Query function command (16 bytes) */
1979 struct cmdq_query_func {
1980 	u8 opcode;
1981 	#define CMDQ_QUERY_FUNC_OPCODE_QUERY_FUNC		   0x83UL
1982 	u8 cmd_size;
1983 	__le16 flags;
1984 	__le16 cookie;
1985 	u8 resp_size;
1986 	u8 reserved8;
1987 	__le64 resp_addr;
1988 };
1989 
1990 /* Set function resources command (16 bytes) */
1991 struct cmdq_set_func_resources {
1992 	u8 opcode;
1993 	#define CMDQ_SET_FUNC_RESOURCES_OPCODE_SET_FUNC_RESOURCES 0x84UL
1994 	u8 cmd_size;
1995 	__le16 flags;
1996 	__le16 cookie;
1997 	u8 resp_size;
1998 	u8 reserved8;
1999 	__le64 resp_addr;
2000 	__le32 number_of_qp;
2001 	__le32 number_of_mrw;
2002 	__le32 number_of_srq;
2003 	__le32 number_of_cq;
2004 	__le32 max_qp_per_vf;
2005 	__le32 max_mrw_per_vf;
2006 	__le32 max_srq_per_vf;
2007 	__le32 max_cq_per_vf;
2008 	__le32 max_gid_per_vf;
2009 	__le32 stat_ctx_id;
2010 };
2011 
2012 /* Read hardware resource context command (24 bytes) */
2013 struct cmdq_read_context {
2014 	u8 opcode;
2015 	#define CMDQ_READ_CONTEXT_OPCODE_READ_CONTEXT		   0x85UL
2016 	u8 cmd_size;
2017 	__le16 flags;
2018 	__le16 cookie;
2019 	u8 resp_size;
2020 	u8 reserved8;
2021 	__le64 resp_addr;
2022 	__le32 type_xid;
2023 	#define CMDQ_READ_CONTEXT_XID_MASK			    0xffffffUL
2024 	#define CMDQ_READ_CONTEXT_XID_SFT			    0
2025 	#define CMDQ_READ_CONTEXT_TYPE_MASK			    0xff000000UL
2026 	#define CMDQ_READ_CONTEXT_TYPE_SFT			    24
2027 	#define CMDQ_READ_CONTEXT_TYPE_QPC			   (0x0UL << 24)
2028 	#define CMDQ_READ_CONTEXT_TYPE_CQ			   (0x1UL << 24)
2029 	#define CMDQ_READ_CONTEXT_TYPE_MRW			   (0x2UL << 24)
2030 	#define CMDQ_READ_CONTEXT_TYPE_SRQ			   (0x3UL << 24)
2031 	__le32 unused_0;
2032 };
2033 
2034 /* Map TC to COS. Can only be issued from a PF (24 bytes) */
2035 struct cmdq_map_tc_to_cos {
2036 	u8 opcode;
2037 	#define CMDQ_MAP_TC_TO_COS_OPCODE_MAP_TC_TO_COS	   0x8aUL
2038 	u8 cmd_size;
2039 	__le16 flags;
2040 	__le16 cookie;
2041 	u8 resp_size;
2042 	u8 reserved8;
2043 	__le64 resp_addr;
2044 	__le16 cos0;
2045 	#define CMDQ_MAP_TC_TO_COS_COS0_NO_CHANGE		   0xffffUL
2046 	__le16 cos1;
2047 	#define CMDQ_MAP_TC_TO_COS_COS1_DISABLE		   0x8000UL
2048 	#define CMDQ_MAP_TC_TO_COS_COS1_NO_CHANGE		   0xffffUL
2049 	__le32 unused_0;
2050 };
2051 
2052 /* Query version command (16 bytes) */
2053 struct cmdq_query_version {
2054 	u8 opcode;
2055 	#define CMDQ_QUERY_VERSION_OPCODE_QUERY_VERSION	   0x8bUL
2056 	u8 cmd_size;
2057 	__le16 flags;
2058 	__le16 cookie;
2059 	u8 resp_size;
2060 	u8 reserved8;
2061 	__le64 resp_addr;
2062 };
2063 
2064 /* Command-Response Event Queue (CREQ) Structures */
2065 /* Base CREQ Record (16 bytes) */
2066 struct creq_base {
2067 	u8 type;
2068 	#define CREQ_BASE_TYPE_MASK				    0x3fUL
2069 	#define CREQ_BASE_TYPE_SFT				    0
2070 	#define CREQ_BASE_TYPE_QP_EVENT			   0x38UL
2071 	#define CREQ_BASE_TYPE_FUNC_EVENT			   0x3aUL
2072 	#define CREQ_BASE_RESERVED2_MASK			    0xc0UL
2073 	#define CREQ_BASE_RESERVED2_SFT			    6
2074 	u8 reserved56[7];
2075 	u8 v;
2076 	#define CREQ_BASE_V					    0x1UL
2077 	#define CREQ_BASE_RESERVED7_MASK			    0xfeUL
2078 	#define CREQ_BASE_RESERVED7_SFT			    1
2079 	u8 event;
2080 	__le16 reserved48[3];
2081 };
2082 
2083 /* RoCE Function Async Event Notification (16 bytes) */
2084 struct creq_func_event {
2085 	u8 type;
2086 	#define CREQ_FUNC_EVENT_TYPE_MASK			    0x3fUL
2087 	#define CREQ_FUNC_EVENT_TYPE_SFT			    0
2088 	#define CREQ_FUNC_EVENT_TYPE_FUNC_EVENT		   0x3aUL
2089 	#define CREQ_FUNC_EVENT_RESERVED2_MASK			    0xc0UL
2090 	#define CREQ_FUNC_EVENT_RESERVED2_SFT			    6
2091 	u8 reserved56[7];
2092 	u8 v;
2093 	#define CREQ_FUNC_EVENT_V				    0x1UL
2094 	#define CREQ_FUNC_EVENT_RESERVED7_MASK			    0xfeUL
2095 	#define CREQ_FUNC_EVENT_RESERVED7_SFT			    1
2096 	u8 event;
2097 	#define CREQ_FUNC_EVENT_EVENT_TX_WQE_ERROR		   0x1UL
2098 	#define CREQ_FUNC_EVENT_EVENT_TX_DATA_ERROR		   0x2UL
2099 	#define CREQ_FUNC_EVENT_EVENT_RX_WQE_ERROR		   0x3UL
2100 	#define CREQ_FUNC_EVENT_EVENT_RX_DATA_ERROR		   0x4UL
2101 	#define CREQ_FUNC_EVENT_EVENT_CQ_ERROR			   0x5UL
2102 	#define CREQ_FUNC_EVENT_EVENT_TQM_ERROR		   0x6UL
2103 	#define CREQ_FUNC_EVENT_EVENT_CFCQ_ERROR		   0x7UL
2104 	#define CREQ_FUNC_EVENT_EVENT_CFCS_ERROR		   0x8UL
2105 	#define CREQ_FUNC_EVENT_EVENT_CFCC_ERROR		   0x9UL
2106 	#define CREQ_FUNC_EVENT_EVENT_CFCM_ERROR		   0xaUL
2107 	#define CREQ_FUNC_EVENT_EVENT_TIM_ERROR		   0xbUL
2108 	#define CREQ_FUNC_EVENT_EVENT_VF_COMM_REQUEST		   0x80UL
2109 	#define CREQ_FUNC_EVENT_EVENT_RESOURCE_EXHAUSTED	   0x81UL
2110 	__le16 reserved48[3];
2111 };
2112 
2113 /* RoCE Slowpath Command Completion (16 bytes) */
2114 struct creq_qp_event {
2115 	u8 type;
2116 	#define CREQ_QP_EVENT_TYPE_MASK			    0x3fUL
2117 	#define CREQ_QP_EVENT_TYPE_SFT				    0
2118 	#define CREQ_QP_EVENT_TYPE_QP_EVENT			   0x38UL
2119 	#define CREQ_QP_EVENT_RESERVED2_MASK			    0xc0UL
2120 	#define CREQ_QP_EVENT_RESERVED2_SFT			    6
2121 	u8 status;
2122 	__le16 cookie;
2123 	__le32 reserved32;
2124 	u8 v;
2125 	#define CREQ_QP_EVENT_V				    0x1UL
2126 	#define CREQ_QP_EVENT_RESERVED7_MASK			    0xfeUL
2127 	#define CREQ_QP_EVENT_RESERVED7_SFT			    1
2128 	u8 event;
2129 	#define CREQ_QP_EVENT_EVENT_CREATE_QP			   0x1UL
2130 	#define CREQ_QP_EVENT_EVENT_DESTROY_QP			   0x2UL
2131 	#define CREQ_QP_EVENT_EVENT_MODIFY_QP			   0x3UL
2132 	#define CREQ_QP_EVENT_EVENT_QUERY_QP			   0x4UL
2133 	#define CREQ_QP_EVENT_EVENT_CREATE_SRQ			   0x5UL
2134 	#define CREQ_QP_EVENT_EVENT_DESTROY_SRQ		   0x6UL
2135 	#define CREQ_QP_EVENT_EVENT_QUERY_SRQ			   0x8UL
2136 	#define CREQ_QP_EVENT_EVENT_CREATE_CQ			   0x9UL
2137 	#define CREQ_QP_EVENT_EVENT_DESTROY_CQ			   0xaUL
2138 	#define CREQ_QP_EVENT_EVENT_RESIZE_CQ			   0xcUL
2139 	#define CREQ_QP_EVENT_EVENT_ALLOCATE_MRW		   0xdUL
2140 	#define CREQ_QP_EVENT_EVENT_DEALLOCATE_KEY		   0xeUL
2141 	#define CREQ_QP_EVENT_EVENT_REGISTER_MR		   0xfUL
2142 	#define CREQ_QP_EVENT_EVENT_DEREGISTER_MR		   0x10UL
2143 	#define CREQ_QP_EVENT_EVENT_ADD_GID			   0x11UL
2144 	#define CREQ_QP_EVENT_EVENT_DELETE_GID			   0x12UL
2145 	#define CREQ_QP_EVENT_EVENT_MODIFY_GID			   0x17UL
2146 	#define CREQ_QP_EVENT_EVENT_QUERY_GID			   0x18UL
2147 	#define CREQ_QP_EVENT_EVENT_CREATE_QP1			   0x13UL
2148 	#define CREQ_QP_EVENT_EVENT_DESTROY_QP1		   0x14UL
2149 	#define CREQ_QP_EVENT_EVENT_CREATE_AH			   0x15UL
2150 	#define CREQ_QP_EVENT_EVENT_DESTROY_AH			   0x16UL
2151 	#define CREQ_QP_EVENT_EVENT_INITIALIZE_FW		   0x80UL
2152 	#define CREQ_QP_EVENT_EVENT_DEINITIALIZE_FW		   0x81UL
2153 	#define CREQ_QP_EVENT_EVENT_STOP_FUNC			   0x82UL
2154 	#define CREQ_QP_EVENT_EVENT_QUERY_FUNC			   0x83UL
2155 	#define CREQ_QP_EVENT_EVENT_SET_FUNC_RESOURCES		   0x84UL
2156 	#define CREQ_QP_EVENT_EVENT_MAP_TC_TO_COS		   0x8aUL
2157 	#define CREQ_QP_EVENT_EVENT_QUERY_VERSION		   0x8bUL
2158 	#define CREQ_QP_EVENT_EVENT_MODIFY_CC			   0x8cUL
2159 	#define CREQ_QP_EVENT_EVENT_QUERY_CC			   0x8dUL
2160 	#define CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION	   0xc0UL
2161 	__le16 reserved48[3];
2162 };
2163 
2164 /* Create QP command response (16 bytes) */
2165 struct creq_create_qp_resp {
2166 	u8 type;
2167 	#define CREQ_CREATE_QP_RESP_TYPE_MASK			    0x3fUL
2168 	#define CREQ_CREATE_QP_RESP_TYPE_SFT			    0
2169 	#define CREQ_CREATE_QP_RESP_TYPE_QP_EVENT		   0x38UL
2170 	#define CREQ_CREATE_QP_RESP_RESERVED2_MASK		    0xc0UL
2171 	#define CREQ_CREATE_QP_RESP_RESERVED2_SFT		    6
2172 	u8 status;
2173 	__le16 cookie;
2174 	__le32 xid;
2175 	u8 v;
2176 	#define CREQ_CREATE_QP_RESP_V				    0x1UL
2177 	#define CREQ_CREATE_QP_RESP_RESERVED7_MASK		    0xfeUL
2178 	#define CREQ_CREATE_QP_RESP_RESERVED7_SFT		    1
2179 	u8 event;
2180 	#define CREQ_CREATE_QP_RESP_EVENT_CREATE_QP		   0x1UL
2181 	__le16 reserved48[3];
2182 };
2183 
2184 /* Destroy QP command response (16 bytes) */
2185 struct creq_destroy_qp_resp {
2186 	u8 type;
2187 	#define CREQ_DESTROY_QP_RESP_TYPE_MASK			    0x3fUL
2188 	#define CREQ_DESTROY_QP_RESP_TYPE_SFT			    0
2189 	#define CREQ_DESTROY_QP_RESP_TYPE_QP_EVENT		   0x38UL
2190 	#define CREQ_DESTROY_QP_RESP_RESERVED2_MASK		    0xc0UL
2191 	#define CREQ_DESTROY_QP_RESP_RESERVED2_SFT		    6
2192 	u8 status;
2193 	__le16 cookie;
2194 	__le32 xid;
2195 	u8 v;
2196 	#define CREQ_DESTROY_QP_RESP_V				    0x1UL
2197 	#define CREQ_DESTROY_QP_RESP_RESERVED7_MASK		    0xfeUL
2198 	#define CREQ_DESTROY_QP_RESP_RESERVED7_SFT		    1
2199 	u8 event;
2200 	#define CREQ_DESTROY_QP_RESP_EVENT_DESTROY_QP		   0x2UL
2201 	__le16 reserved48[3];
2202 };
2203 
2204 /* Modify QP command response (16 bytes) */
2205 struct creq_modify_qp_resp {
2206 	u8 type;
2207 	#define CREQ_MODIFY_QP_RESP_TYPE_MASK			    0x3fUL
2208 	#define CREQ_MODIFY_QP_RESP_TYPE_SFT			    0
2209 	#define CREQ_MODIFY_QP_RESP_TYPE_QP_EVENT		   0x38UL
2210 	#define CREQ_MODIFY_QP_RESP_RESERVED2_MASK		    0xc0UL
2211 	#define CREQ_MODIFY_QP_RESP_RESERVED2_SFT		    6
2212 	u8 status;
2213 	__le16 cookie;
2214 	__le32 xid;
2215 	u8 v;
2216 	#define CREQ_MODIFY_QP_RESP_V				    0x1UL
2217 	#define CREQ_MODIFY_QP_RESP_RESERVED7_MASK		    0xfeUL
2218 	#define CREQ_MODIFY_QP_RESP_RESERVED7_SFT		    1
2219 	u8 event;
2220 	#define CREQ_MODIFY_QP_RESP_EVENT_MODIFY_QP		   0x3UL
2221 	__le16 reserved48[3];
2222 };
2223 
2224 /* cmdq_query_roce_stats (size:128b/16B) */
2225 struct cmdq_query_roce_stats {
2226 	u8	opcode;
2227 	#define CMDQ_QUERY_ROCE_STATS_OPCODE_QUERY_ROCE_STATS 0x8eUL
2228 	#define CMDQ_QUERY_ROCE_STATS_OPCODE_LAST	\
2229 				CMDQ_QUERY_ROCE_STATS_OPCODE_QUERY_ROCE_STATS
2230 	u8	cmd_size;
2231 	__le16	flags;
2232 	__le16	cookie;
2233 	u8	resp_size;
2234 	u8	reserved8;
2235 	__le64	resp_addr;
2236 };
2237 
2238 /* Query QP command response (16 bytes) */
2239 struct creq_query_qp_resp {
2240 	u8 type;
2241 	#define CREQ_QUERY_QP_RESP_TYPE_MASK			    0x3fUL
2242 	#define CREQ_QUERY_QP_RESP_TYPE_SFT			    0
2243 	#define CREQ_QUERY_QP_RESP_TYPE_QP_EVENT		   0x38UL
2244 	#define CREQ_QUERY_QP_RESP_RESERVED2_MASK		    0xc0UL
2245 	#define CREQ_QUERY_QP_RESP_RESERVED2_SFT		    6
2246 	u8 status;
2247 	__le16 cookie;
2248 	__le32 size;
2249 	u8 v;
2250 	#define CREQ_QUERY_QP_RESP_V				    0x1UL
2251 	#define CREQ_QUERY_QP_RESP_RESERVED7_MASK		    0xfeUL
2252 	#define CREQ_QUERY_QP_RESP_RESERVED7_SFT		    1
2253 	u8 event;
2254 	#define CREQ_QUERY_QP_RESP_EVENT_QUERY_QP		   0x4UL
2255 	__le16 reserved48[3];
2256 };
2257 
2258 /* Query QP command response side buffer structure (104 bytes) */
2259 struct creq_query_qp_resp_sb {
2260 	u8 opcode;
2261 	#define CREQ_QUERY_QP_RESP_SB_OPCODE_QUERY_QP		   0x4UL
2262 	u8 status;
2263 	__le16 cookie;
2264 	__le16 flags;
2265 	u8 resp_size;
2266 	u8 reserved8;
2267 	__le32 xid;
2268 	u8 en_sqd_async_notify_state;
2269 	#define CREQ_QUERY_QP_RESP_SB_STATE_MASK		    0xfUL
2270 	#define CREQ_QUERY_QP_RESP_SB_STATE_SFT		    0
2271 	#define CREQ_QUERY_QP_RESP_SB_STATE_RESET		   0x0UL
2272 	#define CREQ_QUERY_QP_RESP_SB_STATE_INIT		   0x1UL
2273 	#define CREQ_QUERY_QP_RESP_SB_STATE_RTR		   0x2UL
2274 	#define CREQ_QUERY_QP_RESP_SB_STATE_RTS		   0x3UL
2275 	#define CREQ_QUERY_QP_RESP_SB_STATE_SQD		   0x4UL
2276 	#define CREQ_QUERY_QP_RESP_SB_STATE_SQE		   0x5UL
2277 	#define CREQ_QUERY_QP_RESP_SB_STATE_ERR		   0x6UL
2278 	#define CREQ_QUERY_QP_RESP_SB_EN_SQD_ASYNC_NOTIFY	    0x10UL
2279 	u8 access;
2280 	#define CREQ_QUERY_QP_RESP_SB_ACCESS_LOCAL_WRITE	    0x1UL
2281 	#define CREQ_QUERY_QP_RESP_SB_ACCESS_REMOTE_WRITE	    0x2UL
2282 	#define CREQ_QUERY_QP_RESP_SB_ACCESS_REMOTE_READ	    0x4UL
2283 	#define CREQ_QUERY_QP_RESP_SB_ACCESS_REMOTE_ATOMIC	    0x8UL
2284 	__le16 pkey;
2285 	__le32 qkey;
2286 	__le32 reserved32;
2287 	__le32 dgid[4];
2288 	__le32 flow_label;
2289 	__le16 sgid_index;
2290 	u8 hop_limit;
2291 	u8 traffic_class;
2292 	__le16 dest_mac[3];
2293 	__le16 path_mtu_dest_vlan_id;
2294 	#define CREQ_QUERY_QP_RESP_SB_DEST_VLAN_ID_MASK	    0xfffUL
2295 	#define CREQ_QUERY_QP_RESP_SB_DEST_VLAN_ID_SFT		    0
2296 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MASK		    0xf000UL
2297 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_SFT		    12
2298 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MTU_256		   (0x0UL << 12)
2299 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MTU_512		   (0x1UL << 12)
2300 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MTU_1024	   (0x2UL << 12)
2301 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MTU_2048	   (0x3UL << 12)
2302 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MTU_4096	   (0x4UL << 12)
2303 	#define CREQ_QUERY_QP_RESP_SB_PATH_MTU_MTU_8192	   (0x5UL << 12)
2304 	u8 timeout;
2305 	u8 retry_cnt;
2306 	u8 rnr_retry;
2307 	u8 min_rnr_timer;
2308 	__le32 rq_psn;
2309 	__le32 sq_psn;
2310 	u8 max_rd_atomic;
2311 	u8 max_dest_rd_atomic;
2312 	u8 tos_dscp_tos_ecn;
2313 	#define CREQ_QUERY_QP_RESP_SB_TOS_ECN_MASK		    0x3UL
2314 	#define CREQ_QUERY_QP_RESP_SB_TOS_ECN_SFT		    0
2315 	#define CREQ_QUERY_QP_RESP_SB_TOS_DSCP_MASK		    0xfcUL
2316 	#define CREQ_QUERY_QP_RESP_SB_TOS_DSCP_SFT		    2
2317 	u8 enable_cc;
2318 	#define CREQ_QUERY_QP_RESP_SB_ENABLE_CC		    0x1UL
2319 	#define CREQ_QUERY_QP_RESP_SB_RESERVED7_MASK		    0xfeUL
2320 	#define CREQ_QUERY_QP_RESP_SB_RESERVED7_SFT		    1
2321 	__le32 sq_size;
2322 	__le32 rq_size;
2323 	__le16 sq_sge;
2324 	__le16 rq_sge;
2325 	__le32 max_inline_data;
2326 	__le32 dest_qp_id;
2327 	__le32 unused_1;
2328 	__le16 src_mac[3];
2329 	__le16 vlan_pcp_vlan_dei_vlan_id;
2330 	#define CREQ_QUERY_QP_RESP_SB_VLAN_ID_MASK		    0xfffUL
2331 	#define CREQ_QUERY_QP_RESP_SB_VLAN_ID_SFT		    0
2332 	#define CREQ_QUERY_QP_RESP_SB_VLAN_DEI			    0x1000UL
2333 	#define CREQ_QUERY_QP_RESP_SB_VLAN_PCP_MASK		    0xe000UL
2334 	#define CREQ_QUERY_QP_RESP_SB_VLAN_PCP_SFT		    13
2335 };
2336 
2337 /* Create SRQ command response (16 bytes) */
2338 struct creq_create_srq_resp {
2339 	u8 type;
2340 	#define CREQ_CREATE_SRQ_RESP_TYPE_MASK			    0x3fUL
2341 	#define CREQ_CREATE_SRQ_RESP_TYPE_SFT			    0
2342 	#define CREQ_CREATE_SRQ_RESP_TYPE_QP_EVENT		   0x38UL
2343 	#define CREQ_CREATE_SRQ_RESP_RESERVED2_MASK		    0xc0UL
2344 	#define CREQ_CREATE_SRQ_RESP_RESERVED2_SFT		    6
2345 	u8 status;
2346 	__le16 cookie;
2347 	__le32 xid;
2348 	u8 v;
2349 	#define CREQ_CREATE_SRQ_RESP_V				    0x1UL
2350 	#define CREQ_CREATE_SRQ_RESP_RESERVED7_MASK		    0xfeUL
2351 	#define CREQ_CREATE_SRQ_RESP_RESERVED7_SFT		    1
2352 	u8 event;
2353 	#define CREQ_CREATE_SRQ_RESP_EVENT_CREATE_SRQ		   0x5UL
2354 	__le16 reserved48[3];
2355 };
2356 
2357 /* Destroy SRQ command response (16 bytes) */
2358 struct creq_destroy_srq_resp {
2359 	u8 type;
2360 	#define CREQ_DESTROY_SRQ_RESP_TYPE_MASK		    0x3fUL
2361 	#define CREQ_DESTROY_SRQ_RESP_TYPE_SFT			    0
2362 	#define CREQ_DESTROY_SRQ_RESP_TYPE_QP_EVENT		   0x38UL
2363 	#define CREQ_DESTROY_SRQ_RESP_RESERVED2_MASK		    0xc0UL
2364 	#define CREQ_DESTROY_SRQ_RESP_RESERVED2_SFT		    6
2365 	u8 status;
2366 	__le16 cookie;
2367 	__le32 xid;
2368 	u8 v;
2369 	#define CREQ_DESTROY_SRQ_RESP_V			    0x1UL
2370 	#define CREQ_DESTROY_SRQ_RESP_RESERVED7_MASK		    0xfeUL
2371 	#define CREQ_DESTROY_SRQ_RESP_RESERVED7_SFT		    1
2372 	u8 event;
2373 	#define CREQ_DESTROY_SRQ_RESP_EVENT_DESTROY_SRQ	   0x6UL
2374 	__le16 enable_for_arm[3];
2375 	#define CREQ_DESTROY_SRQ_RESP_ENABLE_FOR_ARM_MASK	    0x30000UL
2376 	#define CREQ_DESTROY_SRQ_RESP_ENABLE_FOR_ARM_SFT	    16
2377 	#define CREQ_DESTROY_SRQ_RESP_RESERVED46_MASK		    0xfffc0000UL
2378 	#define CREQ_DESTROY_SRQ_RESP_RESERVED46_SFT		    18
2379 };
2380 
2381 /* Query SRQ command response (16 bytes) */
2382 struct creq_query_srq_resp {
2383 	u8 type;
2384 	#define CREQ_QUERY_SRQ_RESP_TYPE_MASK			    0x3fUL
2385 	#define CREQ_QUERY_SRQ_RESP_TYPE_SFT			    0
2386 	#define CREQ_QUERY_SRQ_RESP_TYPE_QP_EVENT		   0x38UL
2387 	#define CREQ_QUERY_SRQ_RESP_RESERVED2_MASK		    0xc0UL
2388 	#define CREQ_QUERY_SRQ_RESP_RESERVED2_SFT		    6
2389 	u8 status;
2390 	__le16 cookie;
2391 	__le32 size;
2392 	u8 v;
2393 	#define CREQ_QUERY_SRQ_RESP_V				    0x1UL
2394 	#define CREQ_QUERY_SRQ_RESP_RESERVED7_MASK		    0xfeUL
2395 	#define CREQ_QUERY_SRQ_RESP_RESERVED7_SFT		    1
2396 	u8 event;
2397 	#define CREQ_QUERY_SRQ_RESP_EVENT_QUERY_SRQ		   0x8UL
2398 	__le16 reserved48[3];
2399 };
2400 
2401 /* Query SRQ command response side buffer structure (24 bytes) */
2402 struct creq_query_srq_resp_sb {
2403 	u8 opcode;
2404 	#define CREQ_QUERY_SRQ_RESP_SB_OPCODE_QUERY_SRQ	   0x8UL
2405 	u8 status;
2406 	__le16 cookie;
2407 	__le16 flags;
2408 	u8 resp_size;
2409 	u8 reserved8;
2410 	__le32 xid;
2411 	__le16 srq_limit;
2412 	__le16 reserved16;
2413 	__le32 data[4];
2414 };
2415 
2416 /* Create CQ command Response (16 bytes) */
2417 struct creq_create_cq_resp {
2418 	u8 type;
2419 	#define CREQ_CREATE_CQ_RESP_TYPE_MASK			    0x3fUL
2420 	#define CREQ_CREATE_CQ_RESP_TYPE_SFT			    0
2421 	#define CREQ_CREATE_CQ_RESP_TYPE_QP_EVENT		   0x38UL
2422 	#define CREQ_CREATE_CQ_RESP_RESERVED2_MASK		    0xc0UL
2423 	#define CREQ_CREATE_CQ_RESP_RESERVED2_SFT		    6
2424 	u8 status;
2425 	__le16 cookie;
2426 	__le32 xid;
2427 	u8 v;
2428 	#define CREQ_CREATE_CQ_RESP_V				    0x1UL
2429 	#define CREQ_CREATE_CQ_RESP_RESERVED7_MASK		    0xfeUL
2430 	#define CREQ_CREATE_CQ_RESP_RESERVED7_SFT		    1
2431 	u8 event;
2432 	#define CREQ_CREATE_CQ_RESP_EVENT_CREATE_CQ		   0x9UL
2433 	__le16 reserved48[3];
2434 };
2435 
2436 /* Destroy CQ command response (16 bytes) */
2437 struct creq_destroy_cq_resp {
2438 	u8 type;
2439 	#define CREQ_DESTROY_CQ_RESP_TYPE_MASK			    0x3fUL
2440 	#define CREQ_DESTROY_CQ_RESP_TYPE_SFT			    0
2441 	#define CREQ_DESTROY_CQ_RESP_TYPE_QP_EVENT		   0x38UL
2442 	#define CREQ_DESTROY_CQ_RESP_RESERVED2_MASK		    0xc0UL
2443 	#define CREQ_DESTROY_CQ_RESP_RESERVED2_SFT		    6
2444 	u8 status;
2445 	__le16 cookie;
2446 	__le32 xid;
2447 	u8 v;
2448 	#define CREQ_DESTROY_CQ_RESP_V				    0x1UL
2449 	#define CREQ_DESTROY_CQ_RESP_RESERVED7_MASK		    0xfeUL
2450 	#define CREQ_DESTROY_CQ_RESP_RESERVED7_SFT		    1
2451 	u8 event;
2452 	#define CREQ_DESTROY_CQ_RESP_EVENT_DESTROY_CQ		   0xaUL
2453 	__le16 cq_arm_lvl;
2454 	#define CREQ_DESTROY_CQ_RESP_CQ_ARM_LVL_MASK		    0x3UL
2455 	#define CREQ_DESTROY_CQ_RESP_CQ_ARM_LVL_SFT		    0
2456 	#define CREQ_DESTROY_CQ_RESP_RESERVED14_MASK		    0xfffcUL
2457 	#define CREQ_DESTROY_CQ_RESP_RESERVED14_SFT		    2
2458 	__le16 total_cnq_events;
2459 	__le16 reserved16;
2460 };
2461 
2462 /* Resize CQ command response (16 bytes) */
2463 struct creq_resize_cq_resp {
2464 	u8 type;
2465 	#define CREQ_RESIZE_CQ_RESP_TYPE_MASK			    0x3fUL
2466 	#define CREQ_RESIZE_CQ_RESP_TYPE_SFT			    0
2467 	#define CREQ_RESIZE_CQ_RESP_TYPE_QP_EVENT		   0x38UL
2468 	#define CREQ_RESIZE_CQ_RESP_RESERVED2_MASK		    0xc0UL
2469 	#define CREQ_RESIZE_CQ_RESP_RESERVED2_SFT		    6
2470 	u8 status;
2471 	__le16 cookie;
2472 	__le32 xid;
2473 	u8 v;
2474 	#define CREQ_RESIZE_CQ_RESP_V				    0x1UL
2475 	#define CREQ_RESIZE_CQ_RESP_RESERVED7_MASK		    0xfeUL
2476 	#define CREQ_RESIZE_CQ_RESP_RESERVED7_SFT		    1
2477 	u8 event;
2478 	#define CREQ_RESIZE_CQ_RESP_EVENT_RESIZE_CQ		   0xcUL
2479 	__le16 reserved48[3];
2480 };
2481 
2482 /* Allocate MRW command response (16 bytes) */
2483 struct creq_allocate_mrw_resp {
2484 	u8 type;
2485 	#define CREQ_ALLOCATE_MRW_RESP_TYPE_MASK		    0x3fUL
2486 	#define CREQ_ALLOCATE_MRW_RESP_TYPE_SFT		    0
2487 	#define CREQ_ALLOCATE_MRW_RESP_TYPE_QP_EVENT		   0x38UL
2488 	#define CREQ_ALLOCATE_MRW_RESP_RESERVED2_MASK		    0xc0UL
2489 	#define CREQ_ALLOCATE_MRW_RESP_RESERVED2_SFT		    6
2490 	u8 status;
2491 	__le16 cookie;
2492 	__le32 xid;
2493 	u8 v;
2494 	#define CREQ_ALLOCATE_MRW_RESP_V			    0x1UL
2495 	#define CREQ_ALLOCATE_MRW_RESP_RESERVED7_MASK		    0xfeUL
2496 	#define CREQ_ALLOCATE_MRW_RESP_RESERVED7_SFT		    1
2497 	u8 event;
2498 	#define CREQ_ALLOCATE_MRW_RESP_EVENT_ALLOCATE_MRW	   0xdUL
2499 	__le16 reserved48[3];
2500 };
2501 
2502 /* De-allocate key command response (16 bytes) */
2503 struct creq_deallocate_key_resp {
2504 	u8 type;
2505 	#define CREQ_DEALLOCATE_KEY_RESP_TYPE_MASK		    0x3fUL
2506 	#define CREQ_DEALLOCATE_KEY_RESP_TYPE_SFT		    0
2507 	#define CREQ_DEALLOCATE_KEY_RESP_TYPE_QP_EVENT		   0x38UL
2508 	#define CREQ_DEALLOCATE_KEY_RESP_RESERVED2_MASK	    0xc0UL
2509 	#define CREQ_DEALLOCATE_KEY_RESP_RESERVED2_SFT		    6
2510 	u8 status;
2511 	__le16 cookie;
2512 	__le32 xid;
2513 	u8 v;
2514 	#define CREQ_DEALLOCATE_KEY_RESP_V			    0x1UL
2515 	#define CREQ_DEALLOCATE_KEY_RESP_RESERVED7_MASK	    0xfeUL
2516 	#define CREQ_DEALLOCATE_KEY_RESP_RESERVED7_SFT		    1
2517 	u8 event;
2518 	#define CREQ_DEALLOCATE_KEY_RESP_EVENT_DEALLOCATE_KEY     0xeUL
2519 	__le16 reserved16;
2520 	__le32 bound_window_info;
2521 };
2522 
2523 /* Register MR command response (16 bytes) */
2524 struct creq_register_mr_resp {
2525 	u8 type;
2526 	#define CREQ_REGISTER_MR_RESP_TYPE_MASK		    0x3fUL
2527 	#define CREQ_REGISTER_MR_RESP_TYPE_SFT			    0
2528 	#define CREQ_REGISTER_MR_RESP_TYPE_QP_EVENT		   0x38UL
2529 	#define CREQ_REGISTER_MR_RESP_RESERVED2_MASK		    0xc0UL
2530 	#define CREQ_REGISTER_MR_RESP_RESERVED2_SFT		    6
2531 	u8 status;
2532 	__le16 cookie;
2533 	__le32 xid;
2534 	u8 v;
2535 	#define CREQ_REGISTER_MR_RESP_V			    0x1UL
2536 	#define CREQ_REGISTER_MR_RESP_RESERVED7_MASK		    0xfeUL
2537 	#define CREQ_REGISTER_MR_RESP_RESERVED7_SFT		    1
2538 	u8 event;
2539 	#define CREQ_REGISTER_MR_RESP_EVENT_REGISTER_MR	   0xfUL
2540 	__le16 reserved48[3];
2541 };
2542 
2543 /* Deregister MR command response (16 bytes) */
2544 struct creq_deregister_mr_resp {
2545 	u8 type;
2546 	#define CREQ_DEREGISTER_MR_RESP_TYPE_MASK		    0x3fUL
2547 	#define CREQ_DEREGISTER_MR_RESP_TYPE_SFT		    0
2548 	#define CREQ_DEREGISTER_MR_RESP_TYPE_QP_EVENT		   0x38UL
2549 	#define CREQ_DEREGISTER_MR_RESP_RESERVED2_MASK		    0xc0UL
2550 	#define CREQ_DEREGISTER_MR_RESP_RESERVED2_SFT		    6
2551 	u8 status;
2552 	__le16 cookie;
2553 	__le32 xid;
2554 	u8 v;
2555 	#define CREQ_DEREGISTER_MR_RESP_V			    0x1UL
2556 	#define CREQ_DEREGISTER_MR_RESP_RESERVED7_MASK		    0xfeUL
2557 	#define CREQ_DEREGISTER_MR_RESP_RESERVED7_SFT		    1
2558 	u8 event;
2559 	#define CREQ_DEREGISTER_MR_RESP_EVENT_DEREGISTER_MR       0x10UL
2560 	__le16 reserved16;
2561 	__le32 bound_windows;
2562 };
2563 
2564 /* Add GID command response (16 bytes) */
2565 struct creq_add_gid_resp {
2566 	u8 type;
2567 	#define CREQ_ADD_GID_RESP_TYPE_MASK			    0x3fUL
2568 	#define CREQ_ADD_GID_RESP_TYPE_SFT			    0
2569 	#define CREQ_ADD_GID_RESP_TYPE_QP_EVENT		   0x38UL
2570 	#define CREQ_ADD_GID_RESP_RESERVED2_MASK		    0xc0UL
2571 	#define CREQ_ADD_GID_RESP_RESERVED2_SFT		    6
2572 	u8 status;
2573 	__le16 cookie;
2574 	__le32 xid;
2575 	u8 v;
2576 	#define CREQ_ADD_GID_RESP_V				    0x1UL
2577 	#define CREQ_ADD_GID_RESP_RESERVED7_MASK		    0xfeUL
2578 	#define CREQ_ADD_GID_RESP_RESERVED7_SFT		    1
2579 	u8 event;
2580 	#define CREQ_ADD_GID_RESP_EVENT_ADD_GID		   0x11UL
2581 	__le16 reserved48[3];
2582 };
2583 
2584 /* Delete GID command response (16 bytes) */
2585 struct creq_delete_gid_resp {
2586 	u8 type;
2587 	#define CREQ_DELETE_GID_RESP_TYPE_MASK			    0x3fUL
2588 	#define CREQ_DELETE_GID_RESP_TYPE_SFT			    0
2589 	#define CREQ_DELETE_GID_RESP_TYPE_QP_EVENT		   0x38UL
2590 	#define CREQ_DELETE_GID_RESP_RESERVED2_MASK		    0xc0UL
2591 	#define CREQ_DELETE_GID_RESP_RESERVED2_SFT		    6
2592 	u8 status;
2593 	__le16 cookie;
2594 	__le32 xid;
2595 	u8 v;
2596 	#define CREQ_DELETE_GID_RESP_V				    0x1UL
2597 	#define CREQ_DELETE_GID_RESP_RESERVED7_MASK		    0xfeUL
2598 	#define CREQ_DELETE_GID_RESP_RESERVED7_SFT		    1
2599 	u8 event;
2600 	#define CREQ_DELETE_GID_RESP_EVENT_DELETE_GID		   0x12UL
2601 	__le16 reserved48[3];
2602 };
2603 
2604 /* Modify GID command response (16 bytes) */
2605 struct creq_modify_gid_resp {
2606 	u8 type;
2607 	#define CREQ_MODIFY_GID_RESP_TYPE_MASK			    0x3fUL
2608 	#define CREQ_MODIFY_GID_RESP_TYPE_SFT			    0
2609 	#define CREQ_MODIFY_GID_RESP_TYPE_QP_EVENT		   0x38UL
2610 	#define CREQ_MODIFY_GID_RESP_RESERVED2_MASK		    0xc0UL
2611 	#define CREQ_MODIFY_GID_RESP_RESERVED2_SFT		    6
2612 	u8 status;
2613 	__le16 cookie;
2614 	__le32 xid;
2615 	u8 v;
2616 	#define CREQ_MODIFY_GID_RESP_V				    0x1UL
2617 	#define CREQ_MODIFY_GID_RESP_RESERVED7_MASK		    0xfeUL
2618 	#define CREQ_MODIFY_GID_RESP_RESERVED7_SFT		    1
2619 	u8 event;
2620 	#define CREQ_MODIFY_GID_RESP_EVENT_ADD_GID		   0x11UL
2621 	__le16 reserved48[3];
2622 };
2623 
2624 /* Query GID command response (16 bytes) */
2625 struct creq_query_gid_resp {
2626 	u8 type;
2627 	#define CREQ_QUERY_GID_RESP_TYPE_MASK			    0x3fUL
2628 	#define CREQ_QUERY_GID_RESP_TYPE_SFT			    0
2629 	#define CREQ_QUERY_GID_RESP_TYPE_QP_EVENT		   0x38UL
2630 	#define CREQ_QUERY_GID_RESP_RESERVED2_MASK		    0xc0UL
2631 	#define CREQ_QUERY_GID_RESP_RESERVED2_SFT		    6
2632 	u8 status;
2633 	__le16 cookie;
2634 	__le32 size;
2635 	u8 v;
2636 	#define CREQ_QUERY_GID_RESP_V				    0x1UL
2637 	#define CREQ_QUERY_GID_RESP_RESERVED7_MASK		    0xfeUL
2638 	#define CREQ_QUERY_GID_RESP_RESERVED7_SFT		    1
2639 	u8 event;
2640 	#define CREQ_QUERY_GID_RESP_EVENT_QUERY_GID		   0x18UL
2641 	__le16 reserved48[3];
2642 };
2643 
2644 /* Query GID command response side buffer structure (40 bytes) */
2645 struct creq_query_gid_resp_sb {
2646 	u8 opcode;
2647 	#define CREQ_QUERY_GID_RESP_SB_OPCODE_QUERY_GID	   0x18UL
2648 	u8 status;
2649 	__le16 cookie;
2650 	__le16 flags;
2651 	u8 resp_size;
2652 	u8 reserved8;
2653 	__le32 gid[4];
2654 	__le16 src_mac[3];
2655 	__le16 vlan;
2656 	#define CREQ_QUERY_GID_RESP_SB_VLAN_VLAN_ID_MASK	    0xfffUL
2657 	#define CREQ_QUERY_GID_RESP_SB_VLAN_VLAN_ID_SFT	    0
2658 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_MASK		    0x7000UL
2659 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_SFT		    12
2660 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_88A8	   (0x0UL << 12)
2661 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_8100	   (0x1UL << 12)
2662 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_9100	   (0x2UL << 12)
2663 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_9200	   (0x3UL << 12)
2664 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_9300	   (0x4UL << 12)
2665 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_CFG1	   (0x5UL << 12)
2666 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_CFG2	   (0x6UL << 12)
2667 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_CFG3	   (0x7UL << 12)
2668 	#define CREQ_QUERY_GID_RESP_SB_VLAN_TPID_LAST	\
2669 				CREQ_QUERY_GID_RESP_SB_VLAN_TPID_TPID_CFG3
2670 	#define CREQ_QUERY_GID_RESP_SB_VLAN_VLAN_EN		    0x8000UL
2671 	__le16 ipid;
2672 	__le16 gid_index;
2673 	__le32 unused_0;
2674 };
2675 
2676 /* Create QP1 command response (16 bytes) */
2677 struct creq_create_qp1_resp {
2678 	u8 type;
2679 	#define CREQ_CREATE_QP1_RESP_TYPE_MASK			    0x3fUL
2680 	#define CREQ_CREATE_QP1_RESP_TYPE_SFT			    0
2681 	#define CREQ_CREATE_QP1_RESP_TYPE_QP_EVENT		   0x38UL
2682 	#define CREQ_CREATE_QP1_RESP_RESERVED2_MASK		    0xc0UL
2683 	#define CREQ_CREATE_QP1_RESP_RESERVED2_SFT		    6
2684 	u8 status;
2685 	__le16 cookie;
2686 	__le32 xid;
2687 	u8 v;
2688 	#define CREQ_CREATE_QP1_RESP_V				    0x1UL
2689 	#define CREQ_CREATE_QP1_RESP_RESERVED7_MASK		    0xfeUL
2690 	#define CREQ_CREATE_QP1_RESP_RESERVED7_SFT		    1
2691 	u8 event;
2692 	#define CREQ_CREATE_QP1_RESP_EVENT_CREATE_QP1		   0x13UL
2693 	__le16 reserved48[3];
2694 };
2695 
2696 /* Destroy QP1 command response (16 bytes) */
2697 struct creq_destroy_qp1_resp {
2698 	u8 type;
2699 	#define CREQ_DESTROY_QP1_RESP_TYPE_MASK		    0x3fUL
2700 	#define CREQ_DESTROY_QP1_RESP_TYPE_SFT			    0
2701 	#define CREQ_DESTROY_QP1_RESP_TYPE_QP_EVENT		   0x38UL
2702 	#define CREQ_DESTROY_QP1_RESP_RESERVED2_MASK		    0xc0UL
2703 	#define CREQ_DESTROY_QP1_RESP_RESERVED2_SFT		    6
2704 	u8 status;
2705 	__le16 cookie;
2706 	__le32 xid;
2707 	u8 v;
2708 	#define CREQ_DESTROY_QP1_RESP_V			    0x1UL
2709 	#define CREQ_DESTROY_QP1_RESP_RESERVED7_MASK		    0xfeUL
2710 	#define CREQ_DESTROY_QP1_RESP_RESERVED7_SFT		    1
2711 	u8 event;
2712 	#define CREQ_DESTROY_QP1_RESP_EVENT_DESTROY_QP1	   0x14UL
2713 	__le16 reserved48[3];
2714 };
2715 
2716 /* Create AH command response (16 bytes) */
2717 struct creq_create_ah_resp {
2718 	u8 type;
2719 	#define CREQ_CREATE_AH_RESP_TYPE_MASK			    0x3fUL
2720 	#define CREQ_CREATE_AH_RESP_TYPE_SFT			    0
2721 	#define CREQ_CREATE_AH_RESP_TYPE_QP_EVENT		   0x38UL
2722 	#define CREQ_CREATE_AH_RESP_RESERVED2_MASK		    0xc0UL
2723 	#define CREQ_CREATE_AH_RESP_RESERVED2_SFT		    6
2724 	u8 status;
2725 	__le16 cookie;
2726 	__le32 xid;
2727 	u8 v;
2728 	#define CREQ_CREATE_AH_RESP_V				    0x1UL
2729 	#define CREQ_CREATE_AH_RESP_RESERVED7_MASK		    0xfeUL
2730 	#define CREQ_CREATE_AH_RESP_RESERVED7_SFT		    1
2731 	u8 event;
2732 	#define CREQ_CREATE_AH_RESP_EVENT_CREATE_AH		   0x15UL
2733 	__le16 reserved48[3];
2734 };
2735 
2736 /* Destroy AH command response (16 bytes) */
2737 struct creq_destroy_ah_resp {
2738 	u8 type;
2739 	#define CREQ_DESTROY_AH_RESP_TYPE_MASK			    0x3fUL
2740 	#define CREQ_DESTROY_AH_RESP_TYPE_SFT			    0
2741 	#define CREQ_DESTROY_AH_RESP_TYPE_QP_EVENT		   0x38UL
2742 	#define CREQ_DESTROY_AH_RESP_RESERVED2_MASK		    0xc0UL
2743 	#define CREQ_DESTROY_AH_RESP_RESERVED2_SFT		    6
2744 	u8 status;
2745 	__le16 cookie;
2746 	__le32 xid;
2747 	u8 v;
2748 	#define CREQ_DESTROY_AH_RESP_V				    0x1UL
2749 	#define CREQ_DESTROY_AH_RESP_RESERVED7_MASK		    0xfeUL
2750 	#define CREQ_DESTROY_AH_RESP_RESERVED7_SFT		    1
2751 	u8 event;
2752 	#define CREQ_DESTROY_AH_RESP_EVENT_DESTROY_AH		   0x16UL
2753 	__le16 reserved48[3];
2754 };
2755 
2756 /* Initialize Firmware command response (16 bytes) */
2757 struct creq_initialize_fw_resp {
2758 	u8 type;
2759 	#define CREQ_INITIALIZE_FW_RESP_TYPE_MASK		    0x3fUL
2760 	#define CREQ_INITIALIZE_FW_RESP_TYPE_SFT		    0
2761 	#define CREQ_INITIALIZE_FW_RESP_TYPE_QP_EVENT		   0x38UL
2762 	#define CREQ_INITIALIZE_FW_RESP_RESERVED2_MASK		    0xc0UL
2763 	#define CREQ_INITIALIZE_FW_RESP_RESERVED2_SFT		    6
2764 	u8 status;
2765 	__le16 cookie;
2766 	__le32 reserved32;
2767 	u8 v;
2768 	#define CREQ_INITIALIZE_FW_RESP_V			    0x1UL
2769 	#define CREQ_INITIALIZE_FW_RESP_RESERVED7_MASK		    0xfeUL
2770 	#define CREQ_INITIALIZE_FW_RESP_RESERVED7_SFT		    1
2771 	u8 event;
2772 	#define CREQ_INITIALIZE_FW_RESP_EVENT_INITIALIZE_FW       0x80UL
2773 	__le16 reserved48[3];
2774 };
2775 
2776 /* De-initialize Firmware command response (16 bytes) */
2777 struct creq_deinitialize_fw_resp {
2778 	u8 type;
2779 	#define CREQ_DEINITIALIZE_FW_RESP_TYPE_MASK		    0x3fUL
2780 	#define CREQ_DEINITIALIZE_FW_RESP_TYPE_SFT		    0
2781 	#define CREQ_DEINITIALIZE_FW_RESP_TYPE_QP_EVENT	   0x38UL
2782 	#define CREQ_DEINITIALIZE_FW_RESP_RESERVED2_MASK	    0xc0UL
2783 	#define CREQ_DEINITIALIZE_FW_RESP_RESERVED2_SFT	    6
2784 	u8 status;
2785 	__le16 cookie;
2786 	__le32 reserved32;
2787 	u8 v;
2788 	#define CREQ_DEINITIALIZE_FW_RESP_V			    0x1UL
2789 	#define CREQ_DEINITIALIZE_FW_RESP_RESERVED7_MASK	    0xfeUL
2790 	#define CREQ_DEINITIALIZE_FW_RESP_RESERVED7_SFT	    1
2791 	u8 event;
2792 	#define CREQ_DEINITIALIZE_FW_RESP_EVENT_DEINITIALIZE_FW   0x81UL
2793 	__le16 reserved48[3];
2794 };
2795 
2796 /* Stop function command response (16 bytes) */
2797 struct creq_stop_func_resp {
2798 	u8 type;
2799 	#define CREQ_STOP_FUNC_RESP_TYPE_MASK			    0x3fUL
2800 	#define CREQ_STOP_FUNC_RESP_TYPE_SFT			    0
2801 	#define CREQ_STOP_FUNC_RESP_TYPE_QP_EVENT		   0x38UL
2802 	#define CREQ_STOP_FUNC_RESP_RESERVED2_MASK		    0xc0UL
2803 	#define CREQ_STOP_FUNC_RESP_RESERVED2_SFT		    6
2804 	u8 status;
2805 	__le16 cookie;
2806 	__le32 reserved32;
2807 	u8 v;
2808 	#define CREQ_STOP_FUNC_RESP_V				    0x1UL
2809 	#define CREQ_STOP_FUNC_RESP_RESERVED7_MASK		    0xfeUL
2810 	#define CREQ_STOP_FUNC_RESP_RESERVED7_SFT		    1
2811 	u8 event;
2812 	#define CREQ_STOP_FUNC_RESP_EVENT_STOP_FUNC		   0x82UL
2813 	__le16 reserved48[3];
2814 };
2815 
2816 /* Query function command response (16 bytes) */
2817 struct creq_query_func_resp {
2818 	u8 type;
2819 	#define CREQ_QUERY_FUNC_RESP_TYPE_MASK			    0x3fUL
2820 	#define CREQ_QUERY_FUNC_RESP_TYPE_SFT			    0
2821 	#define CREQ_QUERY_FUNC_RESP_TYPE_QP_EVENT		   0x38UL
2822 	#define CREQ_QUERY_FUNC_RESP_RESERVED2_MASK		    0xc0UL
2823 	#define CREQ_QUERY_FUNC_RESP_RESERVED2_SFT		    6
2824 	u8 status;
2825 	__le16 cookie;
2826 	__le32 size;
2827 	u8 v;
2828 	#define CREQ_QUERY_FUNC_RESP_V				    0x1UL
2829 	#define CREQ_QUERY_FUNC_RESP_RESERVED7_MASK		    0xfeUL
2830 	#define CREQ_QUERY_FUNC_RESP_RESERVED7_SFT		    1
2831 	u8 event;
2832 	#define CREQ_QUERY_FUNC_RESP_EVENT_QUERY_FUNC		   0x83UL
2833 	__le16 reserved48[3];
2834 };
2835 
2836 /* Query function command response side buffer structure (88 bytes) */
2837 struct creq_query_func_resp_sb {
2838 	u8 opcode;
2839 	#define CREQ_QUERY_FUNC_RESP_SB_OPCODE_QUERY_FUNC	   0x83UL
2840 	u8 status;
2841 	__le16 cookie;
2842 	__le16 flags;
2843 	u8 resp_size;
2844 	u8 reserved8;
2845 	__le64 max_mr_size;
2846 	__le32 max_qp;
2847 	__le16 max_qp_wr;
2848 	__le16 dev_cap_flags;
2849 	#define CREQ_QUERY_FUNC_RESP_SB_DEV_CAP_FLAGS_RESIZE_QP   0x1UL
2850 	__le32 max_cq;
2851 	__le32 max_cqe;
2852 	__le32 max_pd;
2853 	u8 max_sge;
2854 	u8 max_srq_sge;
2855 	u8 max_qp_rd_atom;
2856 	u8 max_qp_init_rd_atom;
2857 	__le32 max_mr;
2858 	__le32 max_mw;
2859 	__le32 max_raw_eth_qp;
2860 	__le32 max_ah;
2861 	__le32 max_fmr;
2862 	__le32 max_srq_wr;
2863 	__le32 max_pkeys;
2864 	__le32 max_inline_data;
2865 	u8 max_map_per_fmr;
2866 	u8 l2_db_space_size;
2867 	__le16 max_srq;
2868 	__le32 max_gid;
2869 	__le32 tqm_alloc_reqs[12];
2870 	__le32 max_dpi;
2871 	__le32 reserved_32;
2872 };
2873 
2874 /* Set resources command response (16 bytes) */
2875 struct creq_set_func_resources_resp {
2876 	u8 type;
2877 	#define CREQ_SET_FUNC_RESOURCES_RESP_TYPE_MASK		    0x3fUL
2878 	#define CREQ_SET_FUNC_RESOURCES_RESP_TYPE_SFT		    0
2879 	#define CREQ_SET_FUNC_RESOURCES_RESP_TYPE_QP_EVENT	   0x38UL
2880 	#define CREQ_SET_FUNC_RESOURCES_RESP_RESERVED2_MASK	    0xc0UL
2881 	#define CREQ_SET_FUNC_RESOURCES_RESP_RESERVED2_SFT	    6
2882 	u8 status;
2883 	__le16 cookie;
2884 	__le32 reserved32;
2885 	u8 v;
2886 	#define CREQ_SET_FUNC_RESOURCES_RESP_V			    0x1UL
2887 	#define CREQ_SET_FUNC_RESOURCES_RESP_RESERVED7_MASK	    0xfeUL
2888 	#define CREQ_SET_FUNC_RESOURCES_RESP_RESERVED7_SFT	    1
2889 	u8 event;
2890 	#define CREQ_SET_FUNC_RESOURCES_RESP_EVENT_SET_FUNC_RESOURCES 0x84UL
2891 	__le16 reserved48[3];
2892 };
2893 
2894 /* Map TC to COS response (16 bytes) */
2895 struct creq_map_tc_to_cos_resp {
2896 	u8 type;
2897 	#define CREQ_MAP_TC_TO_COS_RESP_TYPE_MASK		    0x3fUL
2898 	#define CREQ_MAP_TC_TO_COS_RESP_TYPE_SFT		    0
2899 	#define CREQ_MAP_TC_TO_COS_RESP_TYPE_QP_EVENT		   0x38UL
2900 	#define CREQ_MAP_TC_TO_COS_RESP_RESERVED2_MASK		    0xc0UL
2901 	#define CREQ_MAP_TC_TO_COS_RESP_RESERVED2_SFT		    6
2902 	u8 status;
2903 	__le16 cookie;
2904 	__le32 reserved32;
2905 	u8 v;
2906 	#define CREQ_MAP_TC_TO_COS_RESP_V			    0x1UL
2907 	#define CREQ_MAP_TC_TO_COS_RESP_RESERVED7_MASK		    0xfeUL
2908 	#define CREQ_MAP_TC_TO_COS_RESP_RESERVED7_SFT		    1
2909 	u8 event;
2910 	#define CREQ_MAP_TC_TO_COS_RESP_EVENT_MAP_TC_TO_COS       0x8aUL
2911 	__le16 reserved48[3];
2912 };
2913 
2914 /* Query version response (16 bytes) */
2915 struct creq_query_version_resp {
2916 	u8 type;
2917 	#define CREQ_QUERY_VERSION_RESP_TYPE_MASK		    0x3fUL
2918 	#define CREQ_QUERY_VERSION_RESP_TYPE_SFT		    0
2919 	#define CREQ_QUERY_VERSION_RESP_TYPE_QP_EVENT		   0x38UL
2920 	#define CREQ_QUERY_VERSION_RESP_RESERVED2_MASK		    0xc0UL
2921 	#define CREQ_QUERY_VERSION_RESP_RESERVED2_SFT		    6
2922 	u8 status;
2923 	__le16 cookie;
2924 	u8 fw_maj;
2925 	u8 fw_minor;
2926 	u8 fw_bld;
2927 	u8 fw_rsvd;
2928 	u8 v;
2929 	#define CREQ_QUERY_VERSION_RESP_V			    0x1UL
2930 	#define CREQ_QUERY_VERSION_RESP_RESERVED7_MASK		    0xfeUL
2931 	#define CREQ_QUERY_VERSION_RESP_RESERVED7_SFT		    1
2932 	u8 event;
2933 	#define CREQ_QUERY_VERSION_RESP_EVENT_QUERY_VERSION       0x8bUL
2934 	__le16 reserved16;
2935 	u8 intf_maj;
2936 	u8 intf_minor;
2937 	u8 intf_bld;
2938 	u8 intf_rsvd;
2939 };
2940 
2941 /* Modify congestion control command response (16 bytes) */
2942 struct creq_modify_cc_resp {
2943 	u8 type;
2944 	#define CREQ_MODIFY_CC_RESP_TYPE_MASK			    0x3fUL
2945 	#define CREQ_MODIFY_CC_RESP_TYPE_SFT			    0
2946 	#define CREQ_MODIFY_CC_RESP_TYPE_QP_EVENT		   0x38UL
2947 	#define CREQ_MODIFY_CC_RESP_RESERVED2_MASK		    0xc0UL
2948 	#define CREQ_MODIFY_CC_RESP_RESERVED2_SFT		    6
2949 	u8 status;
2950 	__le16 cookie;
2951 	__le32 reserved32;
2952 	u8 v;
2953 	#define CREQ_MODIFY_CC_RESP_V				    0x1UL
2954 	#define CREQ_MODIFY_CC_RESP_RESERVED7_MASK		    0xfeUL
2955 	#define CREQ_MODIFY_CC_RESP_RESERVED7_SFT		    1
2956 	u8 event;
2957 	#define CREQ_MODIFY_CC_RESP_EVENT_MODIFY_CC		   0x8cUL
2958 	__le16 reserved48[3];
2959 };
2960 
2961 /* Query congestion control command response (16 bytes) */
2962 struct creq_query_cc_resp {
2963 	u8 type;
2964 	#define CREQ_QUERY_CC_RESP_TYPE_MASK			    0x3fUL
2965 	#define CREQ_QUERY_CC_RESP_TYPE_SFT			    0
2966 	#define CREQ_QUERY_CC_RESP_TYPE_QP_EVENT		   0x38UL
2967 	#define CREQ_QUERY_CC_RESP_RESERVED2_MASK		    0xc0UL
2968 	#define CREQ_QUERY_CC_RESP_RESERVED2_SFT		    6
2969 	u8 status;
2970 	__le16 cookie;
2971 	__le32 size;
2972 	u8 v;
2973 	#define CREQ_QUERY_CC_RESP_V				    0x1UL
2974 	#define CREQ_QUERY_CC_RESP_RESERVED7_MASK		    0xfeUL
2975 	#define CREQ_QUERY_CC_RESP_RESERVED7_SFT		    1
2976 	u8 event;
2977 	#define CREQ_QUERY_CC_RESP_EVENT_QUERY_CC		   0x8dUL
2978 	__le16 reserved48[3];
2979 };
2980 
2981 /* Query congestion control command response side buffer structure (32 bytes) */
2982 struct creq_query_cc_resp_sb {
2983 	u8 opcode;
2984 	#define CREQ_QUERY_CC_RESP_SB_OPCODE_QUERY_CC		   0x8dUL
2985 	u8 status;
2986 	__le16 cookie;
2987 	__le16 flags;
2988 	u8 resp_size;
2989 	u8 reserved8;
2990 	u8 enable_cc;
2991 	#define CREQ_QUERY_CC_RESP_SB_ENABLE_CC		    0x1UL
2992 	u8 g;
2993 	#define CREQ_QUERY_CC_RESP_SB_G_MASK			    0x7UL
2994 	#define CREQ_QUERY_CC_RESP_SB_G_SFT			    0
2995 	u8 num_phases_per_state;
2996 	__le16 init_cr;
2997 	u8 unused_2;
2998 	__le16 unused_3;
2999 	u8 unused_4;
3000 	__le16 init_tr;
3001 	u8 tos_dscp_tos_ecn;
3002 	#define CREQ_QUERY_CC_RESP_SB_TOS_ECN_MASK		    0x3UL
3003 	#define CREQ_QUERY_CC_RESP_SB_TOS_ECN_SFT		    0
3004 	#define CREQ_QUERY_CC_RESP_SB_TOS_DSCP_MASK		    0xfcUL
3005 	#define CREQ_QUERY_CC_RESP_SB_TOS_DSCP_SFT		    2
3006 	__le64 reserved64;
3007 	__le64 reserved64_1;
3008 };
3009 
3010 /* creq_query_roce_stats_resp (size:128b/16B) */
3011 struct creq_query_roce_stats_resp {
3012 	u8	type;
3013 	#define CREQ_QUERY_ROCE_STATS_RESP_TYPE_MASK    0x3fUL
3014 	#define CREQ_QUERY_ROCE_STATS_RESP_TYPE_SFT     0
3015 	#define CREQ_QUERY_ROCE_STATS_RESP_TYPE_QP_EVENT  0x38UL
3016 	#define CREQ_QUERY_ROCE_STATS_RESP_TYPE_LAST	\
3017 				CREQ_QUERY_ROCE_STATS_RESP_TYPE_QP_EVENT
3018 	u8	status;
3019 	__le16	cookie;
3020 	__le32	size;
3021 	u8	v;
3022 	#define CREQ_QUERY_ROCE_STATS_RESP_V     0x1UL
3023 	u8	event;
3024 	#define CREQ_QUERY_ROCE_STATS_RESP_EVENT_QUERY_ROCE_STATS 0x8eUL
3025 	#define CREQ_QUERY_ROCE_STATS_RESP_EVENT_LAST	\
3026 			CREQ_QUERY_ROCE_STATS_RESP_EVENT_QUERY_ROCE_STATS
3027 	u8	reserved48[6];
3028 };
3029 
3030 /* creq_query_roce_stats_resp_sb (size:2624b/328B) */
3031 struct creq_query_roce_stats_resp_sb {
3032 	u8	opcode;
3033 	#define CREQ_QUERY_ROCE_STATS_RESP_SB_OPCODE_QUERY_ROCE_STATS 0x8eUL
3034 	#define CREQ_QUERY_ROCE_STATS_RESP_SB_OPCODE_LAST \
3035 			CREQ_QUERY_ROCE_STATS_RESP_SB_OPCODE_QUERY_ROCE_STATS
3036 	u8	status;
3037 	__le16	cookie;
3038 	__le16	flags;
3039 	u8	resp_size;
3040 	u8	rsvd;
3041 	__le32	num_counters;
3042 	__le32	rsvd1;
3043 	__le64	to_retransmits;
3044 	__le64	seq_err_naks_rcvd;
3045 	__le64	max_retry_exceeded;
3046 	__le64	rnr_naks_rcvd;
3047 	__le64	missing_resp;
3048 	__le64	unrecoverable_err;
3049 	__le64	bad_resp_err;
3050 	__le64	local_qp_op_err;
3051 	__le64	local_protection_err;
3052 	__le64	mem_mgmt_op_err;
3053 	__le64	remote_invalid_req_err;
3054 	__le64	remote_access_err;
3055 	__le64	remote_op_err;
3056 	__le64	dup_req;
3057 	__le64	res_exceed_max;
3058 	__le64	res_length_mismatch;
3059 	__le64	res_exceeds_wqe;
3060 	__le64	res_opcode_err;
3061 	__le64	res_rx_invalid_rkey;
3062 	__le64	res_rx_domain_err;
3063 	__le64	res_rx_no_perm;
3064 	__le64	res_rx_range_err;
3065 	__le64	res_tx_invalid_rkey;
3066 	__le64	res_tx_domain_err;
3067 	__le64	res_tx_no_perm;
3068 	__le64	res_tx_range_err;
3069 	__le64	res_irrq_oflow;
3070 	__le64	res_unsup_opcode;
3071 	__le64	res_unaligned_atomic;
3072 	__le64	res_rem_inv_err;
3073 	__le64	res_mem_error;
3074 	__le64	res_srq_err;
3075 	__le64	res_cmp_err;
3076 	__le64	res_invalid_dup_rkey;
3077 	__le64	res_wqe_format_err;
3078 	__le64	res_cq_load_err;
3079 	__le64	res_srq_load_err;
3080 	__le64	res_tx_pci_err;
3081 	__le64	res_rx_pci_err;
3082 	__le64  res_oos_drop_count;
3083 	__le64  active_qp_count_p0;
3084 	__le64  active_qp_count_p1;
3085 	__le64  active_qp_count_p2;
3086 	__le64  active_qp_count_p3;
3087 };
3088 
3089 /* QP error notification event (16 bytes) */
3090 struct creq_qp_error_notification {
3091 	u8 type;
3092 	#define CREQ_QP_ERROR_NOTIFICATION_TYPE_MASK		    0x3fUL
3093 	#define CREQ_QP_ERROR_NOTIFICATION_TYPE_SFT		    0
3094 	#define CREQ_QP_ERROR_NOTIFICATION_TYPE_QP_EVENT	   0x38UL
3095 	#define CREQ_QP_ERROR_NOTIFICATION_RESERVED2_MASK	    0xc0UL
3096 	#define CREQ_QP_ERROR_NOTIFICATION_RESERVED2_SFT	    6
3097 	u8 status;
3098 	u8 req_slow_path_state;
3099 	u8 req_err_state_reason;
3100 	__le32 xid;
3101 	u8 v;
3102 	#define CREQ_QP_ERROR_NOTIFICATION_V			    0x1UL
3103 	#define CREQ_QP_ERROR_NOTIFICATION_RESERVED7_MASK	    0xfeUL
3104 	#define CREQ_QP_ERROR_NOTIFICATION_RESERVED7_SFT	    1
3105 	u8 event;
3106 	#define CREQ_QP_ERROR_NOTIFICATION_EVENT_QP_ERROR_NOTIFICATION 0xc0UL
3107 	u8 res_slow_path_state;
3108 	u8 res_err_state_reason;
3109 	__le16 sq_cons_idx;
3110 	__le16 rq_cons_idx;
3111 };
3112 
3113 /* RoCE Slowpath HSI Specification 1.6.0 */
3114 #define ROCE_SP_HSI_VERSION_MAJOR	1
3115 #define ROCE_SP_HSI_VERSION_MINOR	6
3116 #define ROCE_SP_HSI_VERSION_UPDATE	0
3117 
3118 #define ROCE_SP_HSI_VERSION_STR	"1.6.0"
3119 /*
3120  * Following is the signature for ROCE_SP_HSI message field that indicates not
3121  * applicable (All F's). Need to cast it the size of the field if needed.
3122  */
3123 #define ROCE_SP_HSI_NA_SIGNATURE	((__le32)(-1))
3124 #endif /* __BNXT_RE_HSI_H__ */
3125