xref: /freebsd/sys/dev/irdma/irdma_defs.h (revision e3aa18ad71782a73d3dd9dd3d526bbd2b607ca16)
1 /*-
2  * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
3  *
4  * Copyright (c) 2015 - 2021 Intel Corporation
5  *
6  * This software is available to you under a choice of one of two
7  * licenses.  You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenFabrics.org BSD license below:
11  *
12  *   Redistribution and use in source and binary forms, with or
13  *   without modification, are permitted provided that the following
14  *   conditions are met:
15  *
16  *    - Redistributions of source code must retain the above
17  *	copyright notice, this list of conditions and the following
18  *	disclaimer.
19  *
20  *    - Redistributions in binary form must reproduce the above
21  *	copyright notice, this list of conditions and the following
22  *	disclaimer in the documentation and/or other materials
23  *	provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  */
34 /*$FreeBSD$*/
35 
36 #ifndef IRDMA_DEFS_H
37 #define IRDMA_DEFS_H
38 
39 #define IRDMA_FIRST_USER_QP_ID	3
40 
41 #define ECN_CODE_PT_MASK 3
42 #define ECN_CODE_PT_VAL	2
43 
44 #define IRDMA_PUSH_OFFSET		(8 * 1024 * 1024)
45 #define IRDMA_PF_FIRST_PUSH_PAGE_INDEX	16
46 #define IRDMA_PF_BAR_RSVD		(60 * 1024)
47 
48 #define IRDMA_PE_DB_SIZE_4M	1
49 #define IRDMA_PE_DB_SIZE_8M	2
50 
51 #define IRDMA_DDP_VER		1
52 #define IRDMA_RDMAP_VER		1
53 
54 #define IRDMA_RDMA_MODE_RDMAC	0
55 #define IRDMA_RDMA_MODE_IETF	1
56 
57 #define IRDMA_STAG_STATE_INVALID	0
58 #define IRDMA_STAG_STATE_VALID		1
59 #define IRDMA_STAG_TYPE_SHARED		0
60 #define IRDMA_STAG_TYPE_NONSHARED	1
61 
62 #define QS_HANDLE_UNKNOWN	0xffff
63 #define USER_PRI_UNKNOWN	0xff
64 
65 #define IRDMA_INVALID_WQE_INDEX		0xffffffff
66 
67 #define IRDMA_CQP_SW_SQSIZE_8		8
68 #define IRDMA_CQP_SW_SQSIZE_16		16
69 #define IRDMA_CQP_SW_SQSIZE_32		32
70 #define IRDMA_CQP_SW_SQSIZE_64		64
71 #define IRDMA_CQP_SW_SQSIZE_128		128
72 #define IRDMA_CQP_SW_SQSIZE_256		256
73 #define IRDMA_CQP_SW_SQSIZE_512		512
74 #define IRDMA_CQP_SW_SQSIZE_1024	1024
75 
76 #define IRDMA_CQP_HW_SQSIZE_4		1
77 #define IRDMA_CQP_HW_SQSIZE_8		2
78 #define IRDMA_CQP_HW_SQSIZE_16		3
79 #define IRDMA_CQP_HW_SQSIZE_32		4
80 #define IRDMA_CQP_HW_SQSIZE_64		5
81 #define IRDMA_CQP_HW_SQSIZE_128		6
82 #define IRDMA_CQP_HW_SQSIZE_256		7
83 #define IRDMA_CQP_HW_SQSIZE_512		8
84 #define IRDMA_CQP_HW_SQSIZE_1024	9
85 #define IRDMA_CQP_HW_SQSIZE_2048	10
86 
87 /* WQE size considering 32 bytes per WQE*/
88 #define IRDMAQP_SW_WQSIZE_8		8	/* 256 bytes */
89 #define IRDMAQP_SW_WQSIZE_16		16	/* 512 bytes */
90 #define IRDMAQP_SW_WQSIZE_32		32	/* 1024 bytes */
91 #define IRDMAQP_SW_WQSIZE_64		64	/* 2048 bytes */
92 #define IRDMAQP_SW_WQSIZE_128		128	/* 4096 bytes */
93 #define IRDMAQP_SW_WQSIZE_256		256	/* 8192 bytes */
94 #define IRDMAQP_SW_WQSIZE_512		512	/* 16384 bytes */
95 #define IRDMAQP_SW_WQSIZE_1024		1024	/* 32768 bytes */
96 #define IRDMAQP_SW_WQSIZE_2048		2048	/* 65536 bytes */
97 #define IRDMAQP_SW_WQSIZE_4096		4096	/* 131072 bytes */
98 #define IRDMAQP_SW_WQSIZE_8192		8192	/* 262144 bytes */
99 #define IRDMAQP_SW_WQSIZE_16384		16384	/* 524288 bytes */
100 #define IRDMAQP_SW_WQSIZE_32768		32768	/* 1048576 bytes */
101 
102 #define IRDMAQP_HW_WQSIZE_8		1
103 #define IRDMAQP_HW_WQSIZE_16		2
104 #define IRDMAQP_HW_WQSIZE_32		3
105 #define IRDMAQP_HW_WQSIZE_64		4
106 #define IRDMAQP_HW_WQSIZE_128		5
107 #define IRDMAQP_HW_WQSIZE_256		6
108 #define IRDMAQP_HW_WQSIZE_512		7
109 #define IRDMAQP_HW_WQSIZE_1024		8
110 #define IRDMAQP_HW_WQSIZE_2048		9
111 #define IRDMAQP_HW_WQSIZE_4096		10
112 #define IRDMAQP_HW_WQSIZE_8192		11
113 #define IRDMAQP_HW_WQSIZE_16384		12
114 #define IRDMAQP_HW_WQSIZE_32768		13
115 
116 #define IRDMA_IRD_HW_SIZE_4	0
117 #define IRDMA_IRD_HW_SIZE_16	1
118 #define IRDMA_IRD_HW_SIZE_64	2
119 #define IRDMA_IRD_HW_SIZE_128	3
120 #define IRDMA_IRD_HW_SIZE_256	4
121 
122 enum irdma_protocol_used {
123 	IRDMA_ANY_PROTOCOL = 0,
124 	IRDMA_IWARP_PROTOCOL_ONLY = 1,
125 	IRDMA_ROCE_PROTOCOL_ONLY = 2,
126 };
127 
128 #define IRDMA_QP_STATE_INVALID		0
129 #define IRDMA_QP_STATE_IDLE		1
130 #define IRDMA_QP_STATE_RTS		2
131 #define IRDMA_QP_STATE_CLOSING		3
132 #define IRDMA_QP_STATE_SQD		3
133 #define IRDMA_QP_STATE_RTR		4
134 #define IRDMA_QP_STATE_TERMINATE	5
135 #define IRDMA_QP_STATE_ERROR		6
136 
137 #define IRDMA_MAX_USER_PRIORITY		8
138 #define IRDMA_DSCP_NUM_VAL		64
139 #define IRDMA_MAX_TRAFFIC_CLASS		8
140 #define IRDMA_MAX_STATS_COUNT		128
141 #define IRDMA_FIRST_NON_PF_STAT		4
142 
143 #define IRDMA_MIN_MTU_IPV4	576
144 #define IRDMA_MIN_MTU_IPV6	1280
145 #define IRDMA_MTU_TO_MSS_IPV4	40
146 #define IRDMA_MTU_TO_MSS_IPV6	60
147 #define IRDMA_DEFAULT_MTU	1500
148 
149 #define Q2_FPSN_OFFSET		64
150 #define TERM_DDP_LEN_TAGGED	14
151 #define TERM_DDP_LEN_UNTAGGED	18
152 #define TERM_RDMA_LEN		28
153 #define RDMA_OPCODE_M		0x0f
154 #define RDMA_READ_REQ_OPCODE	1
155 #define Q2_BAD_FRAME_OFFSET	72
156 #define CQE_MAJOR_DRV		0x8000
157 
158 #define IRDMA_TERM_SENT		1
159 #define IRDMA_TERM_RCVD		2
160 #define IRDMA_TERM_DONE		4
161 #define IRDMA_MAC_HLEN		14
162 #define IRDMA_BYTE_0		0
163 #define IRDMA_BYTE_8		8
164 #define IRDMA_BYTE_16		16
165 #define IRDMA_BYTE_24		24
166 #define IRDMA_BYTE_32		32
167 #define IRDMA_BYTE_40		40
168 #define IRDMA_BYTE_48		48
169 #define IRDMA_BYTE_56		56
170 #define IRDMA_BYTE_64		64
171 #define IRDMA_BYTE_72		72
172 #define IRDMA_BYTE_80		80
173 #define IRDMA_BYTE_88		88
174 #define IRDMA_BYTE_96		96
175 #define IRDMA_BYTE_104		104
176 #define IRDMA_BYTE_112		112
177 #define IRDMA_BYTE_120		120
178 #define IRDMA_BYTE_128		128
179 #define IRDMA_BYTE_136		136
180 #define IRDMA_BYTE_144		144
181 #define IRDMA_BYTE_152		152
182 #define IRDMA_BYTE_160		160
183 #define IRDMA_BYTE_168		168
184 #define IRDMA_BYTE_176		176
185 #define IRDMA_BYTE_184		184
186 #define IRDMA_BYTE_192		192
187 #define IRDMA_BYTE_200		200
188 #define IRDMA_BYTE_208		208
189 #define IRDMA_BYTE_216		216
190 
191 #define IRDMA_CQP_WAIT_POLL_REGS	1
192 #define IRDMA_CQP_WAIT_POLL_CQ		2
193 #define IRDMA_CQP_WAIT_EVENT		3
194 
195 #define IRDMA_AE_SOURCE_RSVD		0x0
196 #define IRDMA_AE_SOURCE_RQ		0x1
197 #define IRDMA_AE_SOURCE_RQ_0011		0x3
198 
199 #define IRDMA_AE_SOURCE_CQ		0x2
200 #define IRDMA_AE_SOURCE_CQ_0110		0x6
201 #define IRDMA_AE_SOURCE_CQ_1010		0xa
202 #define IRDMA_AE_SOURCE_CQ_1110		0xe
203 
204 #define IRDMA_AE_SOURCE_SQ		0x5
205 #define IRDMA_AE_SOURCE_SQ_0111		0x7
206 
207 #define IRDMA_AE_SOURCE_IN_WR		0x9
208 #define IRDMA_AE_SOURCE_IN_RR		0xb
209 #define IRDMA_AE_SOURCE_OUT_RR		0xd
210 #define IRDMA_AE_SOURCE_OUT_RR_1111	0xf
211 
212 #define IRDMA_TCP_STATE_NON_EXISTENT	0
213 #define IRDMA_TCP_STATE_CLOSED		1
214 #define IRDMA_TCP_STATE_LISTEN		2
215 #define IRDMA_STATE_SYN_SEND		3
216 #define IRDMA_TCP_STATE_SYN_RECEIVED	4
217 #define IRDMA_TCP_STATE_ESTABLISHED	5
218 #define IRDMA_TCP_STATE_CLOSE_WAIT	6
219 #define IRDMA_TCP_STATE_FIN_WAIT_1	7
220 #define IRDMA_TCP_STATE_CLOSING		8
221 #define IRDMA_TCP_STATE_LAST_ACK	9
222 #define IRDMA_TCP_STATE_FIN_WAIT_2	10
223 #define IRDMA_TCP_STATE_TIME_WAIT	11
224 #define IRDMA_TCP_STATE_RESERVED_1	12
225 #define IRDMA_TCP_STATE_RESERVED_2	13
226 #define IRDMA_TCP_STATE_RESERVED_3	14
227 #define IRDMA_TCP_STATE_RESERVED_4	15
228 
229 #define IRDMA_CQP_SW_SQSIZE_4		4
230 #define IRDMA_CQP_SW_SQSIZE_2048	2048
231 
232 #define IRDMA_CQ_TYPE_IWARP	1
233 #define IRDMA_CQ_TYPE_ILQ	2
234 #define IRDMA_CQ_TYPE_IEQ	3
235 #define IRDMA_CQ_TYPE_CQP	4
236 
237 #define IRDMA_DONE_COUNT	1000
238 #define IRDMA_SLEEP_COUNT	10
239 
240 #define IRDMA_UPDATE_SD_BUFF_SIZE	128
241 #define IRDMA_FEATURE_BUF_SIZE		(8 * IRDMA_MAX_FEATURES)
242 
243 #define IRDMA_MAX_QUANTA_PER_WR	8
244 
245 #define IRDMA_QP_SW_MAX_WQ_QUANTA	32768
246 #define IRDMA_QP_SW_MAX_SQ_QUANTA	32768
247 #define IRDMA_QP_SW_MAX_RQ_QUANTA	32768
248 #define IRDMA_MAX_QP_WRS(max_quanta_per_wr) \
249 	((IRDMA_QP_SW_MAX_WQ_QUANTA - IRDMA_SQ_RSVD) / (max_quanta_per_wr))
250 
251 #define IRDMAQP_TERM_SEND_TERM_AND_FIN		0
252 #define IRDMAQP_TERM_SEND_TERM_ONLY		1
253 #define IRDMAQP_TERM_SEND_FIN_ONLY		2
254 #define IRDMAQP_TERM_DONOT_SEND_TERM_OR_FIN	3
255 
256 #define IRDMA_QP_TYPE_IWARP	1
257 #define IRDMA_QP_TYPE_UDA	2
258 #define IRDMA_QP_TYPE_ROCE_RC	3
259 #define IRDMA_QP_TYPE_ROCE_UD	4
260 
261 #define IRDMA_HW_PAGE_SIZE	4096
262 #define IRDMA_HW_PAGE_SHIFT	12
263 #define IRDMA_CQE_QTYPE_RQ	0
264 #define IRDMA_CQE_QTYPE_SQ	1
265 
266 #define IRDMA_QP_SW_MIN_WQSIZE	8u /* in WRs*/
267 #define IRDMA_QP_WQE_MIN_SIZE	32
268 #define IRDMA_QP_WQE_MAX_SIZE	256
269 #define IRDMA_QP_WQE_MIN_QUANTA 1
270 #define IRDMA_MAX_RQ_WQE_SHIFT_GEN1 2
271 #define IRDMA_MAX_RQ_WQE_SHIFT_GEN2 3
272 
273 #define IRDMA_SQ_RSVD	258
274 #define IRDMA_RQ_RSVD	1
275 
276 #define IRDMA_FEATURE_RTS_AE			1ULL
277 #define IRDMA_FEATURE_CQ_RESIZE			2ULL
278 #define IRDMA_FEATURE_RELAX_RQ_ORDER		4ULL
279 #define IRDMAQP_OP_RDMA_WRITE			0x00
280 #define IRDMAQP_OP_RDMA_READ			0x01
281 #define IRDMAQP_OP_RDMA_SEND			0x03
282 #define IRDMAQP_OP_RDMA_SEND_INV		0x04
283 #define IRDMAQP_OP_RDMA_SEND_SOL_EVENT		0x05
284 #define IRDMAQP_OP_RDMA_SEND_SOL_EVENT_INV	0x06
285 #define IRDMAQP_OP_BIND_MW			0x08
286 #define IRDMAQP_OP_FAST_REGISTER		0x09
287 #define IRDMAQP_OP_LOCAL_INVALIDATE		0x0a
288 #define IRDMAQP_OP_RDMA_READ_LOC_INV		0x0b
289 #define IRDMAQP_OP_NOP				0x0c
290 #define IRDMAQP_OP_RDMA_WRITE_SOL		0x0d
291 #define IRDMAQP_OP_GEN_RTS_AE			0x30
292 
293 enum irdma_cqp_op_type {
294 	IRDMA_OP_CEQ_DESTROY			= 1,
295 	IRDMA_OP_AEQ_DESTROY			= 2,
296 	IRDMA_OP_DELETE_ARP_CACHE_ENTRY		= 3,
297 	IRDMA_OP_MANAGE_APBVT_ENTRY		= 4,
298 	IRDMA_OP_CEQ_CREATE			= 5,
299 	IRDMA_OP_AEQ_CREATE			= 6,
300 	IRDMA_OP_MANAGE_QHASH_TABLE_ENTRY	= 7,
301 	IRDMA_OP_QP_MODIFY			= 8,
302 	IRDMA_OP_QP_UPLOAD_CONTEXT		= 9,
303 	IRDMA_OP_CQ_CREATE			= 10,
304 	IRDMA_OP_CQ_DESTROY			= 11,
305 	IRDMA_OP_QP_CREATE			= 12,
306 	IRDMA_OP_QP_DESTROY			= 13,
307 	IRDMA_OP_ALLOC_STAG			= 14,
308 	IRDMA_OP_MR_REG_NON_SHARED		= 15,
309 	IRDMA_OP_DEALLOC_STAG			= 16,
310 	IRDMA_OP_MW_ALLOC			= 17,
311 	IRDMA_OP_QP_FLUSH_WQES			= 18,
312 	IRDMA_OP_ADD_ARP_CACHE_ENTRY		= 19,
313 	IRDMA_OP_MANAGE_PUSH_PAGE		= 20,
314 	IRDMA_OP_UPDATE_PE_SDS			= 21,
315 	IRDMA_OP_MANAGE_HMC_PM_FUNC_TABLE	= 22,
316 	IRDMA_OP_SUSPEND			= 23,
317 	IRDMA_OP_RESUME				= 24,
318 	IRDMA_OP_MANAGE_VF_PBLE_BP		= 25,
319 	IRDMA_OP_QUERY_FPM_VAL			= 26,
320 	IRDMA_OP_COMMIT_FPM_VAL			= 27,
321 	IRDMA_OP_REQ_CMDS			= 28,
322 	IRDMA_OP_CMPL_CMDS			= 29,
323 	IRDMA_OP_AH_CREATE			= 30,
324 	IRDMA_OP_AH_MODIFY			= 31,
325 	IRDMA_OP_AH_DESTROY			= 32,
326 	IRDMA_OP_MC_CREATE			= 33,
327 	IRDMA_OP_MC_DESTROY			= 34,
328 	IRDMA_OP_MC_MODIFY			= 35,
329 	IRDMA_OP_STATS_ALLOCATE			= 36,
330 	IRDMA_OP_STATS_FREE			= 37,
331 	IRDMA_OP_STATS_GATHER			= 38,
332 	IRDMA_OP_WS_ADD_NODE			= 39,
333 	IRDMA_OP_WS_MODIFY_NODE			= 40,
334 	IRDMA_OP_WS_DELETE_NODE			= 41,
335 	IRDMA_OP_WS_FAILOVER_START		= 42,
336 	IRDMA_OP_WS_FAILOVER_COMPLETE		= 43,
337 	IRDMA_OP_SET_UP_MAP			= 44,
338 	IRDMA_OP_GEN_AE				= 45,
339 	IRDMA_OP_QUERY_RDMA_FEATURES		= 46,
340 	IRDMA_OP_ALLOC_LOCAL_MAC_ENTRY		= 47,
341 	IRDMA_OP_ADD_LOCAL_MAC_ENTRY		= 48,
342 	IRDMA_OP_DELETE_LOCAL_MAC_ENTRY		= 49,
343 	IRDMA_OP_CQ_MODIFY			= 50,
344 
345 	/* Must be last entry*/
346 	IRDMA_MAX_CQP_OPS			= 51,
347 };
348 
349 /* CQP SQ WQES */
350 #define IRDMA_CQP_OP_CREATE_QP				0
351 #define IRDMA_CQP_OP_MODIFY_QP				0x1
352 #define IRDMA_CQP_OP_DESTROY_QP				0x02
353 #define IRDMA_CQP_OP_CREATE_CQ				0x03
354 #define IRDMA_CQP_OP_MODIFY_CQ				0x04
355 #define IRDMA_CQP_OP_DESTROY_CQ				0x05
356 #define IRDMA_CQP_OP_ALLOC_STAG				0x09
357 #define IRDMA_CQP_OP_REG_MR				0x0a
358 #define IRDMA_CQP_OP_QUERY_STAG				0x0b
359 #define IRDMA_CQP_OP_REG_SMR				0x0c
360 #define IRDMA_CQP_OP_DEALLOC_STAG			0x0d
361 #define IRDMA_CQP_OP_MANAGE_LOC_MAC_TABLE		0x0e
362 #define IRDMA_CQP_OP_MANAGE_ARP				0x0f
363 #define IRDMA_CQP_OP_MANAGE_VF_PBLE_BP			0x10
364 #define IRDMA_CQP_OP_MANAGE_PUSH_PAGES			0x11
365 #define IRDMA_CQP_OP_QUERY_RDMA_FEATURES		0x12
366 #define IRDMA_CQP_OP_UPLOAD_CONTEXT			0x13
367 #define IRDMA_CQP_OP_ALLOCATE_LOC_MAC_TABLE_ENTRY	0x14
368 #define IRDMA_CQP_OP_UPLOAD_CONTEXT			0x13
369 #define IRDMA_CQP_OP_MANAGE_HMC_PM_FUNC_TABLE		0x15
370 #define IRDMA_CQP_OP_CREATE_CEQ				0x16
371 #define IRDMA_CQP_OP_DESTROY_CEQ			0x18
372 #define IRDMA_CQP_OP_CREATE_AEQ				0x19
373 #define IRDMA_CQP_OP_DESTROY_AEQ			0x1b
374 #define IRDMA_CQP_OP_CREATE_ADDR_HANDLE			0x1c
375 #define IRDMA_CQP_OP_MODIFY_ADDR_HANDLE			0x1d
376 #define IRDMA_CQP_OP_DESTROY_ADDR_HANDLE		0x1e
377 #define IRDMA_CQP_OP_UPDATE_PE_SDS			0x1f
378 #define IRDMA_CQP_OP_QUERY_FPM_VAL			0x20
379 #define IRDMA_CQP_OP_COMMIT_FPM_VAL			0x21
380 #define IRDMA_CQP_OP_FLUSH_WQES				0x22
381 /* IRDMA_CQP_OP_GEN_AE is the same value as IRDMA_CQP_OP_FLUSH_WQES */
382 #define IRDMA_CQP_OP_GEN_AE				0x22
383 #define IRDMA_CQP_OP_MANAGE_APBVT			0x23
384 #define IRDMA_CQP_OP_NOP				0x24
385 #define IRDMA_CQP_OP_MANAGE_QUAD_HASH_TABLE_ENTRY	0x25
386 #define IRDMA_CQP_OP_CREATE_MCAST_GRP			0x26
387 #define IRDMA_CQP_OP_MODIFY_MCAST_GRP			0x27
388 #define IRDMA_CQP_OP_DESTROY_MCAST_GRP			0x28
389 #define IRDMA_CQP_OP_SUSPEND_QP				0x29
390 #define IRDMA_CQP_OP_RESUME_QP				0x2a
391 #define IRDMA_CQP_OP_SHMC_PAGES_ALLOCATED		0x2b
392 #define IRDMA_CQP_OP_WORK_SCHED_NODE			0x2c
393 #define IRDMA_CQP_OP_MANAGE_STATS			0x2d
394 #define IRDMA_CQP_OP_GATHER_STATS			0x2e
395 #define IRDMA_CQP_OP_UP_MAP				0x2f
396 
397 /* Async Events codes */
398 #define IRDMA_AE_AMP_UNALLOCATED_STAG					0x0102
399 #define IRDMA_AE_AMP_INVALID_STAG					0x0103
400 #define IRDMA_AE_AMP_BAD_QP						0x0104
401 #define IRDMA_AE_AMP_BAD_PD						0x0105
402 #define IRDMA_AE_AMP_BAD_STAG_KEY					0x0106
403 #define IRDMA_AE_AMP_BAD_STAG_INDEX					0x0107
404 #define IRDMA_AE_AMP_BOUNDS_VIOLATION					0x0108
405 #define IRDMA_AE_AMP_RIGHTS_VIOLATION					0x0109
406 #define IRDMA_AE_AMP_TO_WRAP						0x010a
407 #define IRDMA_AE_AMP_FASTREG_VALID_STAG					0x010c
408 #define IRDMA_AE_AMP_FASTREG_MW_STAG					0x010d
409 #define IRDMA_AE_AMP_FASTREG_INVALID_RIGHTS				0x010e
410 #define IRDMA_AE_AMP_FASTREG_INVALID_LENGTH				0x0110
411 #define IRDMA_AE_AMP_INVALIDATE_SHARED					0x0111
412 #define IRDMA_AE_AMP_INVALIDATE_NO_REMOTE_ACCESS_RIGHTS			0x0112
413 #define IRDMA_AE_AMP_INVALIDATE_MR_WITH_BOUND_WINDOWS			0x0113
414 #define IRDMA_AE_AMP_MWBIND_VALID_STAG					0x0114
415 #define IRDMA_AE_AMP_MWBIND_OF_MR_STAG					0x0115
416 #define IRDMA_AE_AMP_MWBIND_TO_ZERO_BASED_STAG				0x0116
417 #define IRDMA_AE_AMP_MWBIND_TO_MW_STAG					0x0117
418 #define IRDMA_AE_AMP_MWBIND_INVALID_RIGHTS				0x0118
419 #define IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS				0x0119
420 #define IRDMA_AE_AMP_MWBIND_TO_INVALID_PARENT				0x011a
421 #define IRDMA_AE_AMP_MWBIND_BIND_DISABLED				0x011b
422 #define IRDMA_AE_PRIV_OPERATION_DENIED					0x011c
423 #define IRDMA_AE_AMP_INVALIDATE_TYPE1_MW				0x011d
424 #define IRDMA_AE_AMP_MWBIND_ZERO_BASED_TYPE1_MW				0x011e
425 #define IRDMA_AE_AMP_FASTREG_INVALID_PBL_HPS_CFG			0x011f
426 #define IRDMA_AE_AMP_MWBIND_WRONG_TYPE					0x0120
427 #define IRDMA_AE_AMP_FASTREG_PBLE_MISMATCH				0x0121
428 #define IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG				0x0132
429 #define IRDMA_AE_UDA_XMIT_BAD_PD					0x0133
430 #define IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT				0x0134
431 #define IRDMA_AE_UDA_L4LEN_INVALID					0x0135
432 #define IRDMA_AE_BAD_CLOSE						0x0201
433 #define IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE				0x0202
434 #define IRDMA_AE_CQ_OPERATION_ERROR					0x0203
435 #define IRDMA_AE_RDMA_READ_WHILE_ORD_ZERO				0x0205
436 #define IRDMA_AE_STAG_ZERO_INVALID					0x0206
437 #define IRDMA_AE_IB_RREQ_AND_Q1_FULL					0x0207
438 #define IRDMA_AE_IB_INVALID_REQUEST					0x0208
439 #define IRDMA_AE_WQE_UNEXPECTED_OPCODE					0x020a
440 #define IRDMA_AE_WQE_INVALID_PARAMETER					0x020b
441 #define IRDMA_AE_WQE_INVALID_FRAG_DATA					0x020c
442 #define IRDMA_AE_IB_REMOTE_ACCESS_ERROR					0x020d
443 #define IRDMA_AE_IB_REMOTE_OP_ERROR					0x020e
444 #define IRDMA_AE_WQE_LSMM_TOO_LONG					0x0220
445 #define IRDMA_AE_DDP_INVALID_MSN_GAP_IN_MSN				0x0301
446 #define IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER	0x0303
447 #define IRDMA_AE_DDP_UBE_INVALID_DDP_VERSION				0x0304
448 #define IRDMA_AE_DDP_UBE_INVALID_MO					0x0305
449 #define IRDMA_AE_DDP_UBE_INVALID_MSN_NO_BUFFER_AVAILABLE		0x0306
450 #define IRDMA_AE_DDP_UBE_INVALID_QN					0x0307
451 #define IRDMA_AE_DDP_NO_L_BIT						0x0308
452 #define IRDMA_AE_RDMAP_ROE_INVALID_RDMAP_VERSION			0x0311
453 #define IRDMA_AE_RDMAP_ROE_UNEXPECTED_OPCODE				0x0312
454 #define IRDMA_AE_ROE_INVALID_RDMA_READ_REQUEST				0x0313
455 #define IRDMA_AE_ROE_INVALID_RDMA_WRITE_OR_READ_RESP			0x0314
456 #define IRDMA_AE_ROCE_RSP_LENGTH_ERROR					0x0316
457 #define IRDMA_AE_ROCE_EMPTY_MCG						0x0380
458 #define IRDMA_AE_ROCE_BAD_MC_IP_ADDR					0x0381
459 #define IRDMA_AE_ROCE_BAD_MC_QPID					0x0382
460 #define IRDMA_AE_MCG_QP_PROTOCOL_MISMATCH				0x0383
461 #define IRDMA_AE_INVALID_ARP_ENTRY					0x0401
462 #define IRDMA_AE_INVALID_TCP_OPTION_RCVD				0x0402
463 #define IRDMA_AE_STALE_ARP_ENTRY					0x0403
464 #define IRDMA_AE_INVALID_AH_ENTRY					0x0406
465 #define IRDMA_AE_LLP_CLOSE_COMPLETE					0x0501
466 #define IRDMA_AE_LLP_CONNECTION_RESET					0x0502
467 #define IRDMA_AE_LLP_FIN_RECEIVED					0x0503
468 #define IRDMA_AE_LLP_RECEIVED_MARKER_AND_LENGTH_FIELDS_DONT_MATCH	0x0504
469 #define IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR				0x0505
470 #define IRDMA_AE_LLP_SEGMENT_TOO_SMALL					0x0507
471 #define IRDMA_AE_LLP_SYN_RECEIVED					0x0508
472 #define IRDMA_AE_LLP_TERMINATE_RECEIVED					0x0509
473 #define IRDMA_AE_LLP_TOO_MANY_RETRIES					0x050a
474 #define IRDMA_AE_LLP_TOO_MANY_KEEPALIVE_RETRIES				0x050b
475 #define IRDMA_AE_LLP_DOUBT_REACHABILITY					0x050c
476 #define IRDMA_AE_LLP_CONNECTION_ESTABLISHED				0x050e
477 #define IRDMA_AE_RESOURCE_EXHAUSTION					0x0520
478 #define IRDMA_AE_RESET_SENT						0x0601
479 #define IRDMA_AE_TERMINATE_SENT						0x0602
480 #define IRDMA_AE_RESET_NOT_SENT						0x0603
481 #define IRDMA_AE_LCE_QP_CATASTROPHIC					0x0700
482 #define IRDMA_AE_LCE_FUNCTION_CATASTROPHIC				0x0701
483 #define IRDMA_AE_LCE_CQ_CATASTROPHIC					0x0702
484 #define IRDMA_AE_QP_SUSPEND_COMPLETE					0x0900
485 
486 #ifndef LS_64_1
487 #define LS_64_1(val, bits)	((u64)(uintptr_t)(val) << (bits))
488 #define RS_64_1(val, bits)	((u64)(uintptr_t)(val) >> (bits))
489 #define LS_32_1(val, bits)	((u32)((val) << (bits)))
490 #define RS_32_1(val, bits)	((u32)((val) >> (bits)))
491 #endif
492 #define LS_64(val, field)	(((u64)(val) << field ## _S) & (field ## _M))
493 #define RS_64(val, field)	((u64)((val) & field ## _M) >> field ## _S)
494 #define LS_32(val, field)	(((val) << field ## _S) & (field ## _M))
495 #define RS_32(val, field)	(((val) & field ## _M) >> field ## _S)
496 
497 #define FLD_LS_64(dev, val, field)	\
498 	(((u64)(val) << (dev)->hw_shifts[field ## _S]) & (dev)->hw_masks[field ## _M])
499 #define FLD_RS_64(dev, val, field)	\
500 	((u64)((val) & (dev)->hw_masks[field ## _M]) >> (dev)->hw_shifts[field ## _S])
501 #define FLD_LS_32(dev, val, field)	\
502 	(((val) << (dev)->hw_shifts[field ## _S]) & (dev)->hw_masks[field ## _M])
503 #define FLD_RS_32(dev, val, field)	\
504 	((u64)((val) & (dev)->hw_masks[field ## _M]) >> (dev)->hw_shifts[field ## _S])
505 
506 #define IRDMA_MAX_STATS_16	0xffffULL
507 #define IRDMA_MAX_STATS_24	0xffffffULL
508 #define IRDMA_MAX_STATS_32	0xffffffffULL
509 #define IRDMA_MAX_STATS_48	0xffffffffffffULL
510 #define IRDMA_MAX_STATS_56	0xffffffffffffffULL
511 #define IRDMA_MAX_STATS_64	0xffffffffffffffffULL
512 
513 #define IRDMA_MAX_CQ_READ_THRESH 0x3FFFF
514 /* ILQ CQP hash table fields */
515 #define IRDMA_CQPSQ_QHASH_VLANID_S 32
516 #define IRDMA_CQPSQ_QHASH_VLANID_M \
517 	((u64)0xfff << IRDMA_CQPSQ_QHASH_VLANID_S)
518 
519 #define IRDMA_CQPSQ_QHASH_QPN_S 32
520 #define IRDMA_CQPSQ_QHASH_QPN_M \
521 	((u64)0x3ffff << IRDMA_CQPSQ_QHASH_QPN_S)
522 
523 #define IRDMA_CQPSQ_QHASH_QS_HANDLE_S 0
524 #define IRDMA_CQPSQ_QHASH_QS_HANDLE_M ((u64)0x3ff << IRDMA_CQPSQ_QHASH_QS_HANDLE_S)
525 
526 #define IRDMA_CQPSQ_QHASH_SRC_PORT_S 16
527 #define IRDMA_CQPSQ_QHASH_SRC_PORT_M \
528 	((u64)0xffff << IRDMA_CQPSQ_QHASH_SRC_PORT_S)
529 
530 #define IRDMA_CQPSQ_QHASH_DEST_PORT_S 0
531 #define IRDMA_CQPSQ_QHASH_DEST_PORT_M \
532 	((u64)0xffff << IRDMA_CQPSQ_QHASH_DEST_PORT_S)
533 
534 #define IRDMA_CQPSQ_QHASH_ADDR0_S 32
535 #define IRDMA_CQPSQ_QHASH_ADDR0_M \
536 	((u64)0xffffffff << IRDMA_CQPSQ_QHASH_ADDR0_S)
537 
538 #define IRDMA_CQPSQ_QHASH_ADDR1_S 0
539 #define IRDMA_CQPSQ_QHASH_ADDR1_M \
540 	((u64)0xffffffff << IRDMA_CQPSQ_QHASH_ADDR1_S)
541 
542 #define IRDMA_CQPSQ_QHASH_ADDR2_S 32
543 #define IRDMA_CQPSQ_QHASH_ADDR2_M \
544 	((u64)0xffffffff << IRDMA_CQPSQ_QHASH_ADDR2_S)
545 
546 #define IRDMA_CQPSQ_QHASH_ADDR3_S 0
547 #define IRDMA_CQPSQ_QHASH_ADDR3_M \
548 	((u64)0xffffffff << IRDMA_CQPSQ_QHASH_ADDR3_S)
549 
550 #define IRDMA_CQPSQ_QHASH_WQEVALID_S 63
551 #define IRDMA_CQPSQ_QHASH_WQEVALID_M \
552 	BIT_ULL(IRDMA_CQPSQ_QHASH_WQEVALID_S)
553 #define IRDMA_CQPSQ_QHASH_OPCODE_S 32
554 #define IRDMA_CQPSQ_QHASH_OPCODE_M \
555 	((u64)0x3f << IRDMA_CQPSQ_QHASH_OPCODE_S)
556 
557 #define IRDMA_CQPSQ_QHASH_MANAGE_S 61
558 #define IRDMA_CQPSQ_QHASH_MANAGE_M \
559 	((u64)0x3 << IRDMA_CQPSQ_QHASH_MANAGE_S)
560 
561 #define IRDMA_CQPSQ_QHASH_IPV4VALID_S 60
562 #define IRDMA_CQPSQ_QHASH_IPV4VALID_M \
563 	BIT_ULL(IRDMA_CQPSQ_QHASH_IPV4VALID_S)
564 
565 #define IRDMA_CQPSQ_QHASH_VLANVALID_S 59
566 #define IRDMA_CQPSQ_QHASH_VLANVALID_M \
567 	BIT_ULL(IRDMA_CQPSQ_QHASH_VLANVALID_S)
568 
569 #define IRDMA_CQPSQ_QHASH_ENTRYTYPE_S 42
570 #define IRDMA_CQPSQ_QHASH_ENTRYTYPE_M \
571 	((u64)0x7 << IRDMA_CQPSQ_QHASH_ENTRYTYPE_S)
572 
573 /* Stats */
574 #define IRDMA_CQPSQ_STATS_WQEVALID_S 63
575 #define IRDMA_CQPSQ_STATS_WQEVALID_M \
576 	BIT_ULL(IRDMA_CQPSQ_STATS_WQEVALID_S)
577 
578 #define IRDMA_CQPSQ_STATS_ALLOC_INST_S 62
579 #define IRDMA_CQPSQ_STATS_ALLOC_INST_M \
580 	BIT_ULL(IRDMA_CQPSQ_STATS_ALLOC_INST_S)
581 
582 #define IRDMA_CQPSQ_STATS_USE_HMC_FCN_INDEX_S 60
583 #define IRDMA_CQPSQ_STATS_USE_HMC_FCN_INDEX_M \
584 	BIT_ULL(IRDMA_CQPSQ_STATS_USE_HMC_FCN_INDEX_S)
585 
586 #define IRDMA_CQPSQ_STATS_USE_INST_S 61
587 #define IRDMA_CQPSQ_STATS_USE_INST_M \
588 	BIT_ULL(IRDMA_CQPSQ_STATS_USE_INST_S)
589 
590 #define IRDMA_CQPSQ_STATS_OP_S 32
591 #define IRDMA_CQPSQ_STATS_OP_M \
592 	((u64)0x3f << IRDMA_CQPSQ_STATS_OP_S)
593 
594 #define IRDMA_CQPSQ_STATS_INST_INDEX_S 0
595 #define IRDMA_CQPSQ_STATS_INST_INDEX_M \
596 	((u64)0x7f << IRDMA_CQPSQ_STATS_INST_INDEX_S)
597 
598 #define IRDMA_CQPSQ_STATS_HMC_FCN_INDEX_S 0
599 #define IRDMA_CQPSQ_STATS_HMC_FCN_INDEX_M \
600 	((u64)0x3f << IRDMA_CQPSQ_STATS_HMC_FCN_INDEX_S)
601 
602 /* WS - Work Scheduler */
603 #define IRDMA_CQPSQ_WS_WQEVALID_S 63
604 #define IRDMA_CQPSQ_WS_WQEVALID_M \
605 	BIT_ULL(IRDMA_CQPSQ_WS_WQEVALID_S)
606 
607 #define IRDMA_CQPSQ_WS_NODEOP_S 52
608 #define IRDMA_CQPSQ_WS_NODEOP_M \
609 	((u64)0x3 << IRDMA_CQPSQ_WS_NODEOP_S)
610 
611 #define IRDMA_CQPSQ_WS_ENABLENODE_S 62
612 #define IRDMA_CQPSQ_WS_ENABLENODE_M \
613 	BIT_ULL(IRDMA_CQPSQ_WS_ENABLENODE_S)
614 
615 #define IRDMA_CQPSQ_WS_NODETYPE_S 61
616 #define IRDMA_CQPSQ_WS_NODETYPE_M \
617 	BIT_ULL(IRDMA_CQPSQ_WS_NODETYPE_S)
618 
619 #define IRDMA_CQPSQ_WS_PRIOTYPE_S 59
620 #define IRDMA_CQPSQ_WS_PRIOTYPE_M \
621 	((u64)0x3 << IRDMA_CQPSQ_WS_PRIOTYPE_S)
622 
623 #define IRDMA_CQPSQ_WS_TC_S 56
624 #define IRDMA_CQPSQ_WS_TC_M \
625 	((u64)0x7 << IRDMA_CQPSQ_WS_TC_S)
626 
627 #define IRDMA_CQPSQ_WS_VMVFTYPE_S 54
628 #define IRDMA_CQPSQ_WS_VMVFTYPE_M \
629 	((u64)0x3 << IRDMA_CQPSQ_WS_VMVFTYPE_S)
630 
631 #define IRDMA_CQPSQ_WS_VMVFNUM_S 42
632 #define IRDMA_CQPSQ_WS_VMVFNUM_M \
633 	((u64)0x3ff << IRDMA_CQPSQ_WS_VMVFNUM_S)
634 
635 #define IRDMA_CQPSQ_WS_OP_S 32
636 #define IRDMA_CQPSQ_WS_OP_M \
637 	((u64)0x3f << IRDMA_CQPSQ_WS_OP_S)
638 
639 #define IRDMA_CQPSQ_WS_PARENTID_S 16
640 #define IRDMA_CQPSQ_WS_PARENTID_M \
641 	((u64)0x3ff << IRDMA_CQPSQ_WS_PARENTID_S)
642 
643 #define IRDMA_CQPSQ_WS_NODEID_S 0
644 #define IRDMA_CQPSQ_WS_NODEID_M \
645 	((u64)0x3ff << IRDMA_CQPSQ_WS_NODEID_S)
646 
647 #define IRDMA_CQPSQ_WS_VSI_S 48
648 #define IRDMA_CQPSQ_WS_VSI_M \
649 	((u64)0x3ff << IRDMA_CQPSQ_WS_VSI_S)
650 
651 #define IRDMA_CQPSQ_WS_WEIGHT_S 32
652 #define IRDMA_CQPSQ_WS_WEIGHT_M \
653 	((u64)0x7f << IRDMA_CQPSQ_WS_WEIGHT_S)
654 
655 /* UP to UP mapping */
656 #define IRDMA_CQPSQ_UP_WQEVALID_S 63
657 #define IRDMA_CQPSQ_UP_WQEVALID_M \
658 	BIT_ULL(IRDMA_CQPSQ_UP_WQEVALID_S)
659 
660 #define IRDMA_CQPSQ_UP_USEVLAN_S 62
661 #define IRDMA_CQPSQ_UP_USEVLAN_M \
662 	BIT_ULL(IRDMA_CQPSQ_UP_USEVLAN_S)
663 
664 #define IRDMA_CQPSQ_UP_USEOVERRIDE_S 61
665 #define IRDMA_CQPSQ_UP_USEOVERRIDE_M \
666 	BIT_ULL(IRDMA_CQPSQ_UP_USEOVERRIDE_S)
667 
668 #define IRDMA_CQPSQ_UP_OP_S 32
669 #define IRDMA_CQPSQ_UP_OP_M \
670 	((u64)0x3f << IRDMA_CQPSQ_UP_OP_S)
671 
672 #define IRDMA_CQPSQ_UP_HMCFCNIDX_S 0
673 #define IRDMA_CQPSQ_UP_HMCFCNIDX_M \
674 	((u64)0x3f << IRDMA_CQPSQ_UP_HMCFCNIDX_S)
675 
676 #define IRDMA_CQPSQ_UP_CNPOVERRIDE_S 32
677 #define IRDMA_CQPSQ_UP_CNPOVERRIDE_M \
678 	((u64)0x3f << IRDMA_CQPSQ_UP_CNPOVERRIDE_S)
679 
680 /* Query RDMA features*/
681 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_WQEVALID_S 63
682 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_WQEVALID_M \
683 	BIT_ULL(IRDMA_CQPSQ_QUERY_RDMA_FEATURES_WQEVALID_S)
684 
685 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_BUF_LEN_S 0
686 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_BUF_LEN_M \
687 	((u64)0xffffffff << IRDMA_CQPSQ_QUERY_RDMA_FEATURES_BUF_LEN_S)
688 
689 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_OP_S 32
690 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_OP_M \
691 	((u64)0x3f << IRDMA_CQPSQ_QUERY_RDMA_FEATURES_OP_S)
692 
693 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MODEL_USED_S 32
694 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MODEL_USED_M \
695 	(0xffffULL << IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MODEL_USED_S)
696 
697 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MAJOR_VERSION_S 16
698 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MAJOR_VERSION_M \
699 	(0xffULL << IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MAJOR_VERSION_S)
700 
701 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MINOR_VERSION_S 0
702 #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MINOR_VERSION_M \
703 	(0xffULL << IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MINOR_VERSION_S)
704 
705 /* CQP Host Context */
706 #define IRDMA_CQPHC_SQSIZE_S 8
707 #define IRDMA_CQPHC_SQSIZE_M (0xfULL << IRDMA_CQPHC_SQSIZE_S)
708 
709 #define IRDMA_CQPHC_DISABLE_PFPDUS_S 1
710 #define IRDMA_CQPHC_DISABLE_PFPDUS_M BIT_ULL(IRDMA_CQPHC_DISABLE_PFPDUS_S)
711 
712 #define IRDMA_CQPHC_ROCEV2_RTO_POLICY_S 2
713 #define IRDMA_CQPHC_ROCEV2_RTO_POLICY_M BIT_ULL(IRDMA_CQPHC_ROCEV2_RTO_POLICY_S)
714 
715 #define IRDMA_CQPHC_PROTOCOL_USED_S 3
716 #define IRDMA_CQPHC_PROTOCOL_USED_M (0x3ULL << IRDMA_CQPHC_PROTOCOL_USED_S)
717 
718 #define IRDMA_CQPHC_MIN_RATE_S 48
719 #define IRDMA_CQPHC_MIN_RATE_M (0xfULL << IRDMA_CQPHC_MIN_RATE_S)
720 
721 #define IRDMA_CQPHC_MIN_DEC_FACTOR_S 56
722 #define IRDMA_CQPHC_MIN_DEC_FACTOR_M (0xfULL << IRDMA_CQPHC_MIN_DEC_FACTOR_S)
723 
724 #define IRDMA_CQPHC_DCQCN_T_S 0
725 #define IRDMA_CQPHC_DCQCN_T_M (0xffffULL << IRDMA_CQPHC_DCQCN_T_S)
726 
727 #define IRDMA_CQPHC_HAI_FACTOR_S 32
728 #define IRDMA_CQPHC_HAI_FACTOR_M \
729 	(0xffffULL << IRDMA_CQPHC_HAI_FACTOR_S)
730 
731 #define IRDMA_CQPHC_RAI_FACTOR_S 48
732 #define IRDMA_CQPHC_RAI_FACTOR_M \
733 	(0xffffULL << IRDMA_CQPHC_RAI_FACTOR_S)
734 
735 #define IRDMA_CQPHC_DCQCN_B_S 0
736 #define IRDMA_CQPHC_DCQCN_B_M (0x1ffffffULL << IRDMA_CQPHC_DCQCN_B_S)
737 
738 #define IRDMA_CQPHC_DCQCN_F_S 25
739 #define IRDMA_CQPHC_DCQCN_F_M (0x7ULL << IRDMA_CQPHC_DCQCN_F_S)
740 
741 #define IRDMA_CQPHC_CC_CFG_VALID_S 31
742 #define IRDMA_CQPHC_CC_CFG_VALID_M BIT_ULL(IRDMA_CQPHC_CC_CFG_VALID_S)
743 
744 #define IRDMA_CQPHC_RREDUCE_MPERIOD_S 32
745 #define IRDMA_CQPHC_RREDUCE_MPERIOD_M \
746 	(0xffffffffULL << IRDMA_CQPHC_RREDUCE_MPERIOD_S)
747 
748 #define IRDMA_CQPHC_HW_MINVER_S 0
749 #define IRDMA_CQPHC_HW_MINVER_M (0xffffULL << IRDMA_CQPHC_HW_MINVER_S)
750 
751 #define IRDMA_CQPHC_HW_MAJVER_GEN_1 0
752 #define IRDMA_CQPHC_HW_MAJVER_GEN_2 1
753 #define IRDMA_CQPHC_HW_MAJVER_GEN_3 2
754 
755 #define IRDMA_CQPHC_HW_MAJVER_S 16
756 #define IRDMA_CQPHC_HW_MAJVER_M (0xffffULL << IRDMA_CQPHC_HW_MAJVER_S)
757 
758 #define IRDMA_CQPHC_CEQPERVF_S 32
759 #define IRDMA_CQPHC_CEQPERVF_M (0xffULL << IRDMA_CQPHC_CEQPERVF_S)
760 
761 #define IRDMA_CQPHC_EN_REM_ENDPOINT_TRK_S 3
762 #define IRDMA_CQPHC_EN_REM_ENDPOINT_TRK_M BIT_ULL(IRDMA_CQPHC_EN_REM_ENDPOINT_TRK_S)
763 
764 #define IRDMA_CQPHC_ENABLED_VFS_S 32
765 #define IRDMA_CQPHC_ENABLED_VFS_M (0x3fULL << IRDMA_CQPHC_ENABLED_VFS_S)
766 
767 #define IRDMA_CQPHC_HMC_PROFILE_S 0
768 #define IRDMA_CQPHC_HMC_PROFILE_M (0x7ULL << IRDMA_CQPHC_HMC_PROFILE_S)
769 
770 #define IRDMA_CQPHC_SVER_S 24
771 #define IRDMA_CQPHC_SVER_M (0xffULL << IRDMA_CQPHC_SVER_S)
772 
773 #define IRDMA_CQPHC_SQBASE_S 9
774 #define IRDMA_CQPHC_SQBASE_M \
775 	(0xfffffffffffffeULL << IRDMA_CQPHC_SQBASE_S)
776 
777 #define IRDMA_CQPHC_QPCTX_S 0
778 #define IRDMA_CQPHC_QPCTX_M \
779 	(0xffffffffffffffffULL << IRDMA_CQPHC_QPCTX_S)
780 
781 /* iWARP QP Doorbell shadow area */
782 #define IRDMA_QP_DBSA_HW_SQ_TAIL_S 0
783 #define IRDMA_QP_DBSA_HW_SQ_TAIL_M \
784 	(0x7fffULL << IRDMA_QP_DBSA_HW_SQ_TAIL_S)
785 
786 /* Completion Queue Doorbell shadow area */
787 #define IRDMA_CQ_DBSA_CQEIDX_S 0
788 #define IRDMA_CQ_DBSA_CQEIDX_M (0xfffffULL << IRDMA_CQ_DBSA_CQEIDX_S)
789 
790 #define IRDMA_CQ_DBSA_SW_CQ_SELECT_S 0
791 #define IRDMA_CQ_DBSA_SW_CQ_SELECT_M \
792 	(0x3fffULL << IRDMA_CQ_DBSA_SW_CQ_SELECT_S)
793 
794 #define IRDMA_CQ_DBSA_ARM_NEXT_S 14
795 #define IRDMA_CQ_DBSA_ARM_NEXT_M BIT_ULL(IRDMA_CQ_DBSA_ARM_NEXT_S)
796 
797 #define IRDMA_CQ_DBSA_ARM_NEXT_SE_S 15
798 #define IRDMA_CQ_DBSA_ARM_NEXT_SE_M BIT_ULL(IRDMA_CQ_DBSA_ARM_NEXT_SE_S)
799 
800 #define IRDMA_CQ_DBSA_ARM_SEQ_NUM_S 16
801 #define IRDMA_CQ_DBSA_ARM_SEQ_NUM_M \
802 	(0x3ULL << IRDMA_CQ_DBSA_ARM_SEQ_NUM_S)
803 
804 /* CQP and iWARP Completion Queue */
805 #define IRDMA_CQ_QPCTX_S IRDMA_CQPHC_QPCTX_S
806 #define IRDMA_CQ_QPCTX_M IRDMA_CQPHC_QPCTX_M
807 
808 #define IRDMA_CCQ_OPRETVAL_S 0
809 #define IRDMA_CCQ_OPRETVAL_M (0xffffffffULL << IRDMA_CCQ_OPRETVAL_S)
810 
811 #define IRDMA_CQ_MINERR_S 0
812 #define IRDMA_CQ_MINERR_M (0xffffULL << IRDMA_CQ_MINERR_S)
813 
814 #define IRDMA_CQ_MAJERR_S 16
815 #define IRDMA_CQ_MAJERR_M (0xffffULL << IRDMA_CQ_MAJERR_S)
816 
817 #define IRDMA_CQ_WQEIDX_S 32
818 #define IRDMA_CQ_WQEIDX_M (0x7fffULL << IRDMA_CQ_WQEIDX_S)
819 
820 #define IRDMA_CQ_EXTCQE_S 50
821 #define IRDMA_CQ_EXTCQE_M BIT_ULL(IRDMA_CQ_EXTCQE_S)
822 
823 #define IRDMA_OOO_CMPL_S 54
824 #define IRDMA_OOO_CMPL_M BIT_ULL(IRDMA_OOO_CMPL_S)
825 
826 #define IRDMA_CQ_ERROR_S 55
827 #define IRDMA_CQ_ERROR_M BIT_ULL(IRDMA_CQ_ERROR_S)
828 
829 #define IRDMA_CQ_SQ_S 62
830 #define IRDMA_CQ_SQ_M BIT_ULL(IRDMA_CQ_SQ_S)
831 
832 #define IRDMA_CQ_VALID_S 63
833 #define IRDMA_CQ_VALID_M BIT_ULL(IRDMA_CQ_VALID_S)
834 
835 #define IRDMA_CQ_IMMVALID_S 62
836 #define IRDMA_CQ_IMMVALID_M BIT_ULL(IRDMA_CQ_IMMVALID_S)
837 
838 #define IRDMA_CQ_UDSMACVALID_S 61
839 #define IRDMA_CQ_UDSMACVALID_M BIT_ULL(IRDMA_CQ_UDSMACVALID_S)
840 
841 #define IRDMA_CQ_UDVLANVALID_S 60
842 #define IRDMA_CQ_UDVLANVALID_M BIT_ULL(IRDMA_CQ_UDVLANVALID_S)
843 
844 #define IRDMA_CQ_UDSMAC_S 0
845 #define IRDMA_CQ_UDSMAC_M (0xffffffffffffULL << IRDMA_CQ_UDSMAC_S)
846 
847 #define IRDMA_CQ_UDVLAN_S 48
848 #define IRDMA_CQ_UDVLAN_M (0xffffULL << IRDMA_CQ_UDVLAN_S)
849 
850 #define IRDMA_CQ_IMMDATA_S 0
851 #define IRDMA_CQ_IMMDATA_M (0xffffffffffffffffULL << IRDMA_CQ_IMMVALID_S)
852 
853 #define IRDMA_CQ_IMMDATALOW32_S 0
854 #define IRDMA_CQ_IMMDATALOW32_M (0xffffffffULL << IRDMA_CQ_IMMDATALOW32_S)
855 
856 #define IRDMA_CQ_IMMDATAUP32_S 32
857 #define IRDMA_CQ_IMMDATAUP32_M (0xffffffffULL << IRDMA_CQ_IMMDATAUP32_S)
858 
859 #define IRDMACQ_PAYLDLEN_S 0
860 #define IRDMACQ_PAYLDLEN_M (0xffffffffULL << IRDMACQ_PAYLDLEN_S)
861 
862 #define IRDMACQ_TCPSEQNUMRTT_S 32
863 #define IRDMACQ_TCPSEQNUMRTT_M (0xffffffffULL << IRDMACQ_TCPSEQNUMRTT_S)
864 
865 #define IRDMACQ_INVSTAG_S 0
866 #define IRDMACQ_INVSTAG_M (0xffffffffULL << IRDMACQ_INVSTAG_S)
867 
868 #define IRDMACQ_QPID_S 32
869 #define IRDMACQ_QPID_M (0xffffffULL << IRDMACQ_QPID_S)
870 
871 #define IRDMACQ_UDSRCQPN_S 0
872 #define IRDMACQ_UDSRCQPN_M (0xffffffffULL << IRDMACQ_UDSRCQPN_S)
873 
874 #define IRDMACQ_PSHDROP_S 51
875 #define IRDMACQ_PSHDROP_M BIT_ULL(IRDMACQ_PSHDROP_S)
876 
877 #define IRDMACQ_STAG_S 53
878 #define IRDMACQ_STAG_M BIT_ULL(IRDMACQ_STAG_S)
879 
880 #define IRDMACQ_IPV4_S 53
881 #define IRDMACQ_IPV4_M BIT_ULL(IRDMACQ_IPV4_S)
882 
883 #define IRDMACQ_SOEVENT_S 54
884 #define IRDMACQ_SOEVENT_M BIT_ULL(IRDMACQ_SOEVENT_S)
885 
886 #define IRDMACQ_OP_S 56
887 #define IRDMACQ_OP_M (0x3fULL << IRDMACQ_OP_S)
888 
889 /* CEQE format */
890 #define IRDMA_CEQE_CQCTX_S 0
891 #define IRDMA_CEQE_CQCTX_M \
892 	(0x7fffffffffffffffULL << IRDMA_CEQE_CQCTX_S)
893 
894 #define IRDMA_CEQE_VALID_S 63
895 #define IRDMA_CEQE_VALID_M BIT_ULL(IRDMA_CEQE_VALID_S)
896 
897 /* AEQE format */
898 #define IRDMA_AEQE_COMPCTX_S IRDMA_CQPHC_QPCTX_S
899 #define IRDMA_AEQE_COMPCTX_M IRDMA_CQPHC_QPCTX_M
900 
901 #define IRDMA_AEQE_QPCQID_LOW_S 0
902 #define IRDMA_AEQE_QPCQID_LOW_M (0x3ffffULL << IRDMA_AEQE_QPCQID_LOW_S)
903 
904 #define IRDMA_AEQE_QPCQID_HI_S 46
905 #define IRDMA_AEQE_QPCQID_HI_M BIT_ULL(IRDMA_AEQE_QPCQID_HI_S)
906 
907 #define IRDMA_AEQE_WQDESCIDX_S 18
908 #define IRDMA_AEQE_WQDESCIDX_M (0x7fffULL << IRDMA_AEQE_WQDESCIDX_S)
909 
910 #define IRDMA_AEQE_OVERFLOW_S 33
911 #define IRDMA_AEQE_OVERFLOW_M BIT_ULL(IRDMA_AEQE_OVERFLOW_S)
912 
913 #define IRDMA_AEQE_AECODE_S 34
914 #define IRDMA_AEQE_AECODE_M (0xfffULL << IRDMA_AEQE_AECODE_S)
915 
916 #define IRDMA_AEQE_AESRC_S 50
917 #define IRDMA_AEQE_AESRC_M (0xfULL << IRDMA_AEQE_AESRC_S)
918 
919 #define IRDMA_AEQE_IWSTATE_S 54
920 #define IRDMA_AEQE_IWSTATE_M (0x7ULL << IRDMA_AEQE_IWSTATE_S)
921 
922 #define IRDMA_AEQE_TCPSTATE_S 57
923 #define IRDMA_AEQE_TCPSTATE_M (0xfULL << IRDMA_AEQE_TCPSTATE_S)
924 
925 #define IRDMA_AEQE_Q2DATA_S 61
926 #define IRDMA_AEQE_Q2DATA_M (0x3ULL << IRDMA_AEQE_Q2DATA_S)
927 
928 #define IRDMA_AEQE_VALID_S 63
929 #define IRDMA_AEQE_VALID_M BIT_ULL(IRDMA_AEQE_VALID_S)
930 
931 #define IRDMA_UDA_QPSQ_NEXT_HDR_S 16
932 #define IRDMA_UDA_QPSQ_NEXT_HDR_M ((u64)0xff << IRDMA_UDA_QPSQ_NEXT_HDR_S)
933 
934 #define IRDMA_UDA_QPSQ_OPCODE_S 32
935 #define IRDMA_UDA_QPSQ_OPCODE_M ((u64)0x3f << IRDMA_UDA_QPSQ_OPCODE_S)
936 
937 #define IRDMA_UDA_QPSQ_L4LEN_S 42
938 #define IRDMA_UDA_QPSQ_L4LEN_M ((u64)0xf << IRDMA_UDA_QPSQ_L4LEN_S)
939 
940 #define IRDMA_GEN1_UDA_QPSQ_L4LEN_S 24
941 #define IRDMA_GEN1_UDA_QPSQ_L4LEN_M ((u64)0xf << IRDMA_GEN1_UDA_QPSQ_L4LEN_S)
942 
943 #define IRDMA_UDA_QPSQ_AHIDX_S 0
944 #define IRDMA_UDA_QPSQ_AHIDX_M ((u64)0x1ffff << IRDMA_UDA_QPSQ_AHIDX_S)
945 
946 #define IRDMA_UDA_QPSQ_VALID_S 63
947 #define IRDMA_UDA_QPSQ_VALID_M \
948 	BIT_ULL(IRDMA_UDA_QPSQ_VALID_S)
949 
950 #define IRDMA_UDA_QPSQ_SIGCOMPL_S 62
951 #define IRDMA_UDA_QPSQ_SIGCOMPL_M BIT_ULL(IRDMA_UDA_QPSQ_SIGCOMPL_S)
952 
953 #define IRDMA_UDA_QPSQ_MACLEN_S 56
954 #define IRDMA_UDA_QPSQ_MACLEN_M \
955 	((u64)0x7f << IRDMA_UDA_QPSQ_MACLEN_S)
956 
957 #define IRDMA_UDA_QPSQ_IPLEN_S 48
958 #define IRDMA_UDA_QPSQ_IPLEN_M \
959 	((u64)0x7f << IRDMA_UDA_QPSQ_IPLEN_S)
960 
961 #define IRDMA_UDA_QPSQ_L4T_S 30
962 #define IRDMA_UDA_QPSQ_L4T_M \
963 	((u64)0x3 << IRDMA_UDA_QPSQ_L4T_S)
964 
965 #define IRDMA_UDA_QPSQ_IIPT_S 28
966 #define IRDMA_UDA_QPSQ_IIPT_M \
967 	((u64)0x3 << IRDMA_UDA_QPSQ_IIPT_S)
968 
969 #define IRDMA_UDA_PAYLOADLEN_S 0
970 #define IRDMA_UDA_PAYLOADLEN_M ((u64)0x3fff << IRDMA_UDA_PAYLOADLEN_S)
971 
972 #define IRDMA_UDA_HDRLEN_S 16
973 #define IRDMA_UDA_HDRLEN_M ((u64)0x1ff << IRDMA_UDA_HDRLEN_S)
974 
975 #define IRDMA_VLAN_TAG_VALID_S 50
976 #define IRDMA_VLAN_TAG_VALID_M BIT_ULL(IRDMA_VLAN_TAG_VALID_S)
977 
978 #define IRDMA_UDA_L3PROTO_S 0
979 #define IRDMA_UDA_L3PROTO_M ((u64)0x3 << IRDMA_UDA_L3PROTO_S)
980 
981 #define IRDMA_UDA_L4PROTO_S 16
982 #define IRDMA_UDA_L4PROTO_M ((u64)0x3 << IRDMA_UDA_L4PROTO_S)
983 
984 #define IRDMA_UDA_QPSQ_DOLOOPBACK_S 44
985 #define IRDMA_UDA_QPSQ_DOLOOPBACK_M \
986 	BIT_ULL(IRDMA_UDA_QPSQ_DOLOOPBACK_S)
987 
988 /* CQP SQ WQE common fields */
989 #define IRDMA_CQPSQ_BUFSIZE_S 0
990 #define IRDMA_CQPSQ_BUFSIZE_M (0xffffffffULL << IRDMA_CQPSQ_BUFSIZE_S)
991 
992 #define IRDMA_CQPSQ_OPCODE_S 32
993 #define IRDMA_CQPSQ_OPCODE_M (0x3fULL << IRDMA_CQPSQ_OPCODE_S)
994 
995 #define IRDMA_CQPSQ_WQEVALID_S 63
996 #define IRDMA_CQPSQ_WQEVALID_M BIT_ULL(IRDMA_CQPSQ_WQEVALID_S)
997 
998 #define IRDMA_CQPSQ_TPHVAL_S 0
999 #define IRDMA_CQPSQ_TPHVAL_M (0xffULL << IRDMA_CQPSQ_TPHVAL_S)
1000 
1001 #define IRDMA_CQPSQ_VSIIDX_S 8
1002 #define IRDMA_CQPSQ_VSIIDX_M (0x3ffULL << IRDMA_CQPSQ_VSIIDX_S)
1003 
1004 #define IRDMA_CQPSQ_TPHEN_S 60
1005 #define IRDMA_CQPSQ_TPHEN_M BIT_ULL(IRDMA_CQPSQ_TPHEN_S)
1006 
1007 #define IRDMA_CQPSQ_PBUFADDR_S IRDMA_CQPHC_QPCTX_S
1008 #define IRDMA_CQPSQ_PBUFADDR_M IRDMA_CQPHC_QPCTX_M
1009 
1010 /* Create/Modify/Destroy QP */
1011 
1012 #define IRDMA_CQPSQ_QP_NEWMSS_S 32
1013 #define IRDMA_CQPSQ_QP_NEWMSS_M (0x3fffULL << IRDMA_CQPSQ_QP_NEWMSS_S)
1014 
1015 #define IRDMA_CQPSQ_QP_TERMLEN_S 48
1016 #define IRDMA_CQPSQ_QP_TERMLEN_M (0xfULL << IRDMA_CQPSQ_QP_TERMLEN_S)
1017 
1018 #define IRDMA_CQPSQ_QP_QPCTX_S IRDMA_CQPHC_QPCTX_S
1019 #define IRDMA_CQPSQ_QP_QPCTX_M IRDMA_CQPHC_QPCTX_M
1020 
1021 #define IRDMA_CQPSQ_QP_QPID_S 0
1022 #define IRDMA_CQPSQ_QP_QPID_M (0xFFFFFFUL)
1023 
1024 #define IRDMA_CQPSQ_QP_OP_S 32
1025 #define IRDMA_CQPSQ_QP_OP_M IRDMACQ_OP_M
1026 
1027 #define IRDMA_CQPSQ_QP_ORDVALID_S 42
1028 #define IRDMA_CQPSQ_QP_ORDVALID_M BIT_ULL(IRDMA_CQPSQ_QP_ORDVALID_S)
1029 
1030 #define IRDMA_CQPSQ_QP_TOECTXVALID_S 43
1031 #define IRDMA_CQPSQ_QP_TOECTXVALID_M \
1032 	BIT_ULL(IRDMA_CQPSQ_QP_TOECTXVALID_S)
1033 
1034 #define IRDMA_CQPSQ_QP_CACHEDVARVALID_S 44
1035 #define IRDMA_CQPSQ_QP_CACHEDVARVALID_M \
1036 	BIT_ULL(IRDMA_CQPSQ_QP_CACHEDVARVALID_S)
1037 
1038 #define IRDMA_CQPSQ_QP_VQ_S 45
1039 #define IRDMA_CQPSQ_QP_VQ_M BIT_ULL(IRDMA_CQPSQ_QP_VQ_S)
1040 
1041 #define IRDMA_CQPSQ_QP_FORCELOOPBACK_S 46
1042 #define IRDMA_CQPSQ_QP_FORCELOOPBACK_M \
1043 	BIT_ULL(IRDMA_CQPSQ_QP_FORCELOOPBACK_S)
1044 
1045 #define IRDMA_CQPSQ_QP_CQNUMVALID_S 47
1046 #define IRDMA_CQPSQ_QP_CQNUMVALID_M \
1047 	BIT_ULL(IRDMA_CQPSQ_QP_CQNUMVALID_S)
1048 
1049 #define IRDMA_CQPSQ_QP_QPTYPE_S 48
1050 #define IRDMA_CQPSQ_QP_QPTYPE_M (0x7ULL << IRDMA_CQPSQ_QP_QPTYPE_S)
1051 
1052 #define IRDMA_CQPSQ_QP_MACVALID_S 51
1053 #define IRDMA_CQPSQ_QP_MACVALID_M BIT_ULL(IRDMA_CQPSQ_QP_MACVALID_S)
1054 
1055 #define IRDMA_CQPSQ_QP_MSSCHANGE_S 52
1056 #define IRDMA_CQPSQ_QP_MSSCHANGE_M BIT_ULL(IRDMA_CQPSQ_QP_MSSCHANGE_S)
1057 
1058 #define IRDMA_CQPSQ_QP_IGNOREMWBOUND_S 54
1059 #define IRDMA_CQPSQ_QP_IGNOREMWBOUND_M \
1060 	BIT_ULL(IRDMA_CQPSQ_QP_IGNOREMWBOUND_S)
1061 
1062 #define IRDMA_CQPSQ_QP_REMOVEHASHENTRY_S 55
1063 #define IRDMA_CQPSQ_QP_REMOVEHASHENTRY_M \
1064 	BIT_ULL(IRDMA_CQPSQ_QP_REMOVEHASHENTRY_S)
1065 
1066 #define IRDMA_CQPSQ_QP_TERMACT_S 56
1067 #define IRDMA_CQPSQ_QP_TERMACT_M (0x3ULL << IRDMA_CQPSQ_QP_TERMACT_S)
1068 
1069 #define IRDMA_CQPSQ_QP_RESETCON_S 58
1070 #define IRDMA_CQPSQ_QP_RESETCON_M BIT_ULL(IRDMA_CQPSQ_QP_RESETCON_S)
1071 
1072 #define IRDMA_CQPSQ_QP_ARPTABIDXVALID_S 59
1073 #define IRDMA_CQPSQ_QP_ARPTABIDXVALID_M \
1074 	BIT_ULL(IRDMA_CQPSQ_QP_ARPTABIDXVALID_S)
1075 
1076 #define IRDMA_CQPSQ_QP_NEXTIWSTATE_S 60
1077 #define IRDMA_CQPSQ_QP_NEXTIWSTATE_M \
1078 	(0x7ULL << IRDMA_CQPSQ_QP_NEXTIWSTATE_S)
1079 
1080 #define IRDMA_CQPSQ_QP_DBSHADOWADDR_S IRDMA_CQPHC_QPCTX_S
1081 #define IRDMA_CQPSQ_QP_DBSHADOWADDR_M IRDMA_CQPHC_QPCTX_M
1082 
1083 /* Create/Modify/Destroy CQ */
1084 #define IRDMA_CQPSQ_CQ_CQSIZE_S 0
1085 #define IRDMA_CQPSQ_CQ_CQSIZE_M (0x1fffffULL << IRDMA_CQPSQ_CQ_CQSIZE_S)
1086 
1087 #define IRDMA_CQPSQ_CQ_CQCTX_S 0
1088 #define IRDMA_CQPSQ_CQ_CQCTX_M \
1089 	(0x7fffffffffffffffULL << IRDMA_CQPSQ_CQ_CQCTX_S)
1090 
1091 #define IRDMA_CQPSQ_CQ_SHADOW_READ_THRESHOLD_S 0
1092 #define IRDMA_CQPSQ_CQ_SHADOW_READ_THRESHOLD_M \
1093 	(0x3ffff << IRDMA_CQPSQ_CQ_SHADOW_READ_THRESHOLD_S)
1094 
1095 #define IRDMA_CQPSQ_CQ_OP_S 32
1096 #define IRDMA_CQPSQ_CQ_OP_M (0x3fULL << IRDMA_CQPSQ_CQ_OP_S)
1097 
1098 #define IRDMA_CQPSQ_CQ_CQRESIZE_S 43
1099 #define IRDMA_CQPSQ_CQ_CQRESIZE_M BIT_ULL(IRDMA_CQPSQ_CQ_CQRESIZE_S)
1100 
1101 #define IRDMA_CQPSQ_CQ_LPBLSIZE_S 44
1102 #define IRDMA_CQPSQ_CQ_LPBLSIZE_M (3ULL << IRDMA_CQPSQ_CQ_LPBLSIZE_S)
1103 
1104 #define IRDMA_CQPSQ_CQ_CHKOVERFLOW_S 46
1105 #define IRDMA_CQPSQ_CQ_CHKOVERFLOW_M \
1106 	BIT_ULL(IRDMA_CQPSQ_CQ_CHKOVERFLOW_S)
1107 
1108 #define IRDMA_CQPSQ_CQ_VIRTMAP_S 47
1109 #define IRDMA_CQPSQ_CQ_VIRTMAP_M BIT_ULL(IRDMA_CQPSQ_CQ_VIRTMAP_S)
1110 
1111 #define IRDMA_CQPSQ_CQ_ENCEQEMASK_S 48
1112 #define IRDMA_CQPSQ_CQ_ENCEQEMASK_M \
1113 	BIT_ULL(IRDMA_CQPSQ_CQ_ENCEQEMASK_S)
1114 
1115 #define IRDMA_CQPSQ_CQ_CEQIDVALID_S 49
1116 #define IRDMA_CQPSQ_CQ_CEQIDVALID_M \
1117 	BIT_ULL(IRDMA_CQPSQ_CQ_CEQIDVALID_S)
1118 
1119 #define IRDMA_CQPSQ_CQ_AVOIDMEMCNFLCT_S 61
1120 #define IRDMA_CQPSQ_CQ_AVOIDMEMCNFLCT_M \
1121 	BIT_ULL(IRDMA_CQPSQ_CQ_AVOIDMEMCNFLCT_S)
1122 
1123 #define IRDMA_CQPSQ_CQ_FIRSTPMPBLIDX_S 0
1124 #define IRDMA_CQPSQ_CQ_FIRSTPMPBLIDX_M \
1125 	(0xfffffffULL << IRDMA_CQPSQ_CQ_FIRSTPMPBLIDX_S)
1126 
1127 /* Allocate/Register/Register Shared/Deallocate Stag */
1128 #define IRDMA_CQPSQ_STAG_VA_FBO_S IRDMA_CQPHC_QPCTX_S
1129 #define IRDMA_CQPSQ_STAG_VA_FBO_M IRDMA_CQPHC_QPCTX_M
1130 
1131 #define IRDMA_CQPSQ_STAG_STAGLEN_S 0
1132 #define IRDMA_CQPSQ_STAG_STAGLEN_M \
1133 	(0x3fffffffffffULL << IRDMA_CQPSQ_STAG_STAGLEN_S)
1134 
1135 #define IRDMA_CQPSQ_STAG_KEY_S 0
1136 #define IRDMA_CQPSQ_STAG_KEY_M (0xffULL << IRDMA_CQPSQ_STAG_KEY_S)
1137 
1138 #define IRDMA_CQPSQ_STAG_IDX_S 8
1139 #define IRDMA_CQPSQ_STAG_IDX_M (0xffffffULL << IRDMA_CQPSQ_STAG_IDX_S)
1140 
1141 #define IRDMA_CQPSQ_STAG_PARENTSTAGIDX_S 32
1142 #define IRDMA_CQPSQ_STAG_PARENTSTAGIDX_M \
1143 	(0xffffffULL << IRDMA_CQPSQ_STAG_PARENTSTAGIDX_S)
1144 
1145 #define IRDMA_CQPSQ_STAG_MR_S 43
1146 #define IRDMA_CQPSQ_STAG_MR_M BIT_ULL(IRDMA_CQPSQ_STAG_MR_S)
1147 
1148 #define IRDMA_CQPSQ_STAG_MWTYPE_S 42
1149 #define IRDMA_CQPSQ_STAG_MWTYPE_M BIT_ULL(IRDMA_CQPSQ_STAG_MWTYPE_S)
1150 
1151 #define IRDMA_CQPSQ_STAG_MW1_BIND_DONT_VLDT_KEY_S 58
1152 #define IRDMA_CQPSQ_STAG_MW1_BIND_DONT_VLDT_KEY_M \
1153 	BIT_ULL(IRDMA_CQPSQ_STAG_MW1_BIND_DONT_VLDT_KEY_S)
1154 
1155 #define IRDMA_CQPSQ_STAG_LPBLSIZE_S IRDMA_CQPSQ_CQ_LPBLSIZE_S
1156 #define IRDMA_CQPSQ_STAG_LPBLSIZE_M IRDMA_CQPSQ_CQ_LPBLSIZE_M
1157 
1158 #define IRDMA_CQPSQ_STAG_HPAGESIZE_S 46
1159 #define IRDMA_CQPSQ_STAG_HPAGESIZE_M \
1160 	((u64)3 << IRDMA_CQPSQ_STAG_HPAGESIZE_S)
1161 
1162 #define IRDMA_CQPSQ_STAG_ARIGHTS_S 48
1163 #define IRDMA_CQPSQ_STAG_ARIGHTS_M \
1164 	(0x1fULL << IRDMA_CQPSQ_STAG_ARIGHTS_S)
1165 
1166 #define IRDMA_CQPSQ_STAG_REMACCENABLED_S 53
1167 #define IRDMA_CQPSQ_STAG_REMACCENABLED_M \
1168 	BIT_ULL(IRDMA_CQPSQ_STAG_REMACCENABLED_S)
1169 
1170 #define IRDMA_CQPSQ_STAG_VABASEDTO_S 59
1171 #define IRDMA_CQPSQ_STAG_VABASEDTO_M \
1172 	BIT_ULL(IRDMA_CQPSQ_STAG_VABASEDTO_S)
1173 
1174 #define IRDMA_CQPSQ_STAG_USEHMCFNIDX_S 60
1175 #define IRDMA_CQPSQ_STAG_USEHMCFNIDX_M \
1176 	BIT_ULL(IRDMA_CQPSQ_STAG_USEHMCFNIDX_S)
1177 
1178 #define IRDMA_CQPSQ_STAG_USEPFRID_S 61
1179 #define IRDMA_CQPSQ_STAG_USEPFRID_M \
1180 	BIT_ULL(IRDMA_CQPSQ_STAG_USEPFRID_S)
1181 
1182 #define IRDMA_CQPSQ_STAG_PBA_S IRDMA_CQPHC_QPCTX_S
1183 #define IRDMA_CQPSQ_STAG_PBA_M IRDMA_CQPHC_QPCTX_M
1184 
1185 #define IRDMA_CQPSQ_STAG_HMCFNIDX_S 0
1186 #define IRDMA_CQPSQ_STAG_HMCFNIDX_M \
1187 	(0x3fULL << IRDMA_CQPSQ_STAG_HMCFNIDX_S)
1188 
1189 #define IRDMA_CQPSQ_STAG_FIRSTPMPBLIDX_S 0
1190 #define IRDMA_CQPSQ_STAG_FIRSTPMPBLIDX_M \
1191 	(0xfffffffULL << IRDMA_CQPSQ_STAG_FIRSTPMPBLIDX_S)
1192 
1193 #define IRDMA_CQPSQ_QUERYSTAG_IDX_S IRDMA_CQPSQ_STAG_IDX_S
1194 #define IRDMA_CQPSQ_QUERYSTAG_IDX_M IRDMA_CQPSQ_STAG_IDX_M
1195 
1196 /* Manage Local MAC Table - MLM */
1197 #define IRDMA_CQPSQ_MLM_TABLEIDX_S 0
1198 #define IRDMA_CQPSQ_MLM_TABLEIDX_M \
1199 	(0x3fULL << IRDMA_CQPSQ_MLM_TABLEIDX_S)
1200 
1201 #define IRDMA_CQPSQ_MLM_FREEENTRY_S 62
1202 #define IRDMA_CQPSQ_MLM_FREEENTRY_M \
1203 	BIT_ULL(IRDMA_CQPSQ_MLM_FREEENTRY_S)
1204 
1205 #define IRDMA_CQPSQ_MLM_IGNORE_REF_CNT_S 61
1206 #define IRDMA_CQPSQ_MLM_IGNORE_REF_CNT_M \
1207 	BIT_ULL(IRDMA_CQPSQ_MLM_IGNORE_REF_CNT_S)
1208 
1209 #define IRDMA_CQPSQ_MLM_MAC0_S 0
1210 #define IRDMA_CQPSQ_MLM_MAC0_M (0xffULL << IRDMA_CQPSQ_MLM_MAC0_S)
1211 
1212 #define IRDMA_CQPSQ_MLM_MAC1_S 8
1213 #define IRDMA_CQPSQ_MLM_MAC1_M (0xffULL << IRDMA_CQPSQ_MLM_MAC1_S)
1214 
1215 #define IRDMA_CQPSQ_MLM_MAC2_S 16
1216 #define IRDMA_CQPSQ_MLM_MAC2_M (0xffULL << IRDMA_CQPSQ_MLM_MAC2_S)
1217 
1218 #define IRDMA_CQPSQ_MLM_MAC3_S 24
1219 #define IRDMA_CQPSQ_MLM_MAC3_M (0xffULL << IRDMA_CQPSQ_MLM_MAC3_S)
1220 
1221 #define IRDMA_CQPSQ_MLM_MAC4_S 32
1222 #define IRDMA_CQPSQ_MLM_MAC4_M (0xffULL << IRDMA_CQPSQ_MLM_MAC4_S)
1223 
1224 #define IRDMA_CQPSQ_MLM_MAC5_S 40
1225 #define IRDMA_CQPSQ_MLM_MAC5_M (0xffULL << IRDMA_CQPSQ_MLM_MAC5_S)
1226 
1227 /* Manage ARP Table  - MAT */
1228 #define IRDMA_CQPSQ_MAT_REACHMAX_S 0
1229 #define IRDMA_CQPSQ_MAT_REACHMAX_M \
1230 	(0xffffffffULL << IRDMA_CQPSQ_MAT_REACHMAX_S)
1231 
1232 #define IRDMA_CQPSQ_MAT_MACADDR_S 0
1233 #define IRDMA_CQPSQ_MAT_MACADDR_M \
1234 	(0xffffffffffffULL << IRDMA_CQPSQ_MAT_MACADDR_S)
1235 
1236 #define IRDMA_CQPSQ_MAT_ARPENTRYIDX_S 0
1237 #define IRDMA_CQPSQ_MAT_ARPENTRYIDX_M \
1238 	(0xfffULL << IRDMA_CQPSQ_MAT_ARPENTRYIDX_S)
1239 
1240 #define IRDMA_CQPSQ_MAT_ENTRYVALID_S 42
1241 #define IRDMA_CQPSQ_MAT_ENTRYVALID_M \
1242 	BIT_ULL(IRDMA_CQPSQ_MAT_ENTRYVALID_S)
1243 
1244 #define IRDMA_CQPSQ_MAT_PERMANENT_S 43
1245 #define IRDMA_CQPSQ_MAT_PERMANENT_M \
1246 	BIT_ULL(IRDMA_CQPSQ_MAT_PERMANENT_S)
1247 
1248 #define IRDMA_CQPSQ_MAT_QUERY_S 44
1249 #define IRDMA_CQPSQ_MAT_QUERY_M BIT_ULL(IRDMA_CQPSQ_MAT_QUERY_S)
1250 
1251 /* Manage VF PBLE Backing Pages - MVPBP*/
1252 #define IRDMA_CQPSQ_MVPBP_PD_ENTRY_CNT_S 0
1253 #define IRDMA_CQPSQ_MVPBP_PD_ENTRY_CNT_M \
1254 	(0x3ffULL << IRDMA_CQPSQ_MVPBP_PD_ENTRY_CNT_S)
1255 
1256 #define IRDMA_CQPSQ_MVPBP_FIRST_PD_INX_S 16
1257 #define IRDMA_CQPSQ_MVPBP_FIRST_PD_INX_M \
1258 	(0x1ffULL << IRDMA_CQPSQ_MVPBP_FIRST_PD_INX_S)
1259 
1260 #define IRDMA_CQPSQ_MVPBP_SD_INX_S 32
1261 #define IRDMA_CQPSQ_MVPBP_SD_INX_M \
1262 	(0xfffULL << IRDMA_CQPSQ_MVPBP_SD_INX_S)
1263 
1264 #define IRDMA_CQPSQ_MVPBP_INV_PD_ENT_S 62
1265 #define IRDMA_CQPSQ_MVPBP_INV_PD_ENT_M \
1266 	BIT_ULL(IRDMA_CQPSQ_MVPBP_INV_PD_ENT_S)
1267 
1268 #define IRDMA_CQPSQ_MVPBP_PD_PLPBA_S 3
1269 #define IRDMA_CQPSQ_MVPBP_PD_PLPBA_M \
1270 	(0x1fffffffffffffffULL << IRDMA_CQPSQ_MVPBP_PD_PLPBA_S)
1271 
1272 /* Manage Push Page - MPP */
1273 #define IRDMA_INVALID_PUSH_PAGE_INDEX_GEN_1 0xffff
1274 #define IRDMA_INVALID_PUSH_PAGE_INDEX 0xffffffff
1275 
1276 #define IRDMA_CQPSQ_MPP_QS_HANDLE_S 0
1277 #define IRDMA_CQPSQ_MPP_QS_HANDLE_M \
1278 	(0x3ffULL << IRDMA_CQPSQ_MPP_QS_HANDLE_S)
1279 
1280 #define IRDMA_CQPSQ_MPP_PPIDX_S 0
1281 #define IRDMA_CQPSQ_MPP_PPIDX_M (0x3ffULL << IRDMA_CQPSQ_MPP_PPIDX_S)
1282 
1283 #define IRDMA_CQPSQ_MPP_PPTYPE_S 60
1284 #define IRDMA_CQPSQ_MPP_PPTYPE_M (0x3ULL << IRDMA_CQPSQ_MPP_PPTYPE_S)
1285 
1286 #define IRDMA_CQPSQ_MPP_FREE_PAGE_S 62
1287 #define IRDMA_CQPSQ_MPP_FREE_PAGE_M BIT_ULL(IRDMA_CQPSQ_MPP_FREE_PAGE_S)
1288 
1289 /* Upload Context - UCTX */
1290 #define IRDMA_CQPSQ_UCTX_QPCTXADDR_S IRDMA_CQPHC_QPCTX_S
1291 #define IRDMA_CQPSQ_UCTX_QPCTXADDR_M IRDMA_CQPHC_QPCTX_M
1292 
1293 #define IRDMA_CQPSQ_UCTX_QPID_S 0
1294 #define IRDMA_CQPSQ_UCTX_QPID_M (0xffffffULL << IRDMA_CQPSQ_UCTX_QPID_S)
1295 
1296 #define IRDMA_CQPSQ_UCTX_QPTYPE_S 48
1297 #define IRDMA_CQPSQ_UCTX_QPTYPE_M (0xfULL << IRDMA_CQPSQ_UCTX_QPTYPE_S)
1298 
1299 #define IRDMA_CQPSQ_UCTX_RAWFORMAT_S 61
1300 #define IRDMA_CQPSQ_UCTX_RAWFORMAT_M \
1301 	BIT_ULL(IRDMA_CQPSQ_UCTX_RAWFORMAT_S)
1302 
1303 #define IRDMA_CQPSQ_UCTX_FREEZEQP_S 62
1304 #define IRDMA_CQPSQ_UCTX_FREEZEQP_M \
1305 	BIT_ULL(IRDMA_CQPSQ_UCTX_FREEZEQP_S)
1306 
1307 /* Manage HMC PM Function Table - MHMC */
1308 #define IRDMA_CQPSQ_MHMC_VFIDX_S 0
1309 #define IRDMA_CQPSQ_MHMC_VFIDX_M (0xffffULL << IRDMA_CQPSQ_MHMC_VFIDX_S)
1310 
1311 #define IRDMA_CQPSQ_MHMC_FREEPMFN_S 62
1312 #define IRDMA_CQPSQ_MHMC_FREEPMFN_M \
1313 	BIT_ULL(IRDMA_CQPSQ_MHMC_FREEPMFN_S)
1314 
1315 /* Set HMC Resource Profile - SHMCRP */
1316 #define IRDMA_CQPSQ_SHMCRP_HMC_PROFILE_S 0
1317 #define IRDMA_CQPSQ_SHMCRP_HMC_PROFILE_M \
1318 	(0x7ULL << IRDMA_CQPSQ_SHMCRP_HMC_PROFILE_S)
1319 #define IRDMA_CQPSQ_SHMCRP_VFNUM_S 32
1320 #define IRDMA_CQPSQ_SHMCRP_VFNUM_M (0x3fULL << IRDMA_CQPSQ_SHMCRP_VFNUM_S)
1321 
1322 /* Create/Destroy CEQ */
1323 #define IRDMA_CQPSQ_CEQ_CEQSIZE_S 0
1324 #define IRDMA_CQPSQ_CEQ_CEQSIZE_M \
1325 	(0x3fffffULL << IRDMA_CQPSQ_CEQ_CEQSIZE_S)
1326 
1327 #define IRDMA_CQPSQ_CEQ_CEQID_S 0
1328 #define IRDMA_CQPSQ_CEQ_CEQID_M (0x3ffULL << IRDMA_CQPSQ_CEQ_CEQID_S)
1329 
1330 #define IRDMA_CQPSQ_CEQ_LPBLSIZE_S IRDMA_CQPSQ_CQ_LPBLSIZE_S
1331 #define IRDMA_CQPSQ_CEQ_LPBLSIZE_M IRDMA_CQPSQ_CQ_LPBLSIZE_M
1332 
1333 #define IRDMA_CQPSQ_CEQ_VMAP_S 47
1334 #define IRDMA_CQPSQ_CEQ_VMAP_M BIT_ULL(IRDMA_CQPSQ_CEQ_VMAP_S)
1335 
1336 #define IRDMA_CQPSQ_CEQ_ITRNOEXPIRE_S 46
1337 #define IRDMA_CQPSQ_CEQ_ITRNOEXPIRE_M BIT_ULL(IRDMA_CQPSQ_CEQ_ITRNOEXPIRE_S)
1338 
1339 #define IRDMA_CQPSQ_CEQ_FIRSTPMPBLIDX_S 0
1340 #define IRDMA_CQPSQ_CEQ_FIRSTPMPBLIDX_M \
1341 	(0xfffffffULL << IRDMA_CQPSQ_CEQ_FIRSTPMPBLIDX_S)
1342 
1343 /* Create/Destroy AEQ */
1344 #define IRDMA_CQPSQ_AEQ_AEQECNT_S 0
1345 #define IRDMA_CQPSQ_AEQ_AEQECNT_M \
1346 	(0x7ffffULL << IRDMA_CQPSQ_AEQ_AEQECNT_S)
1347 
1348 #define IRDMA_CQPSQ_AEQ_LPBLSIZE_S IRDMA_CQPSQ_CQ_LPBLSIZE_S
1349 #define IRDMA_CQPSQ_AEQ_LPBLSIZE_M IRDMA_CQPSQ_CQ_LPBLSIZE_M
1350 
1351 #define IRDMA_CQPSQ_AEQ_VMAP_S 47
1352 #define IRDMA_CQPSQ_AEQ_VMAP_M BIT_ULL(IRDMA_CQPSQ_AEQ_VMAP_S)
1353 
1354 #define IRDMA_CQPSQ_AEQ_FIRSTPMPBLIDX_S 0
1355 #define IRDMA_CQPSQ_AEQ_FIRSTPMPBLIDX_M \
1356 	(0xfffffffULL << IRDMA_CQPSQ_AEQ_FIRSTPMPBLIDX_S)
1357 
1358 /* Commit FPM Values - CFPM */
1359 #define IRDMA_COMMIT_FPM_QPCNT_S 0
1360 #define IRDMA_COMMIT_FPM_QPCNT_M (0x7ffffULL << IRDMA_COMMIT_FPM_QPCNT_S)
1361 
1362 #define IRDMA_COMMIT_FPM_BASE_S 32
1363 
1364 #define IRDMA_CQPSQ_CFPM_HMCFNID_S 0
1365 #define IRDMA_CQPSQ_CFPM_HMCFNID_M (0x3fULL << IRDMA_CQPSQ_CFPM_HMCFNID_S)
1366 
1367 /* Flush WQEs - FWQE */
1368 #define IRDMA_CQPSQ_FWQE_AECODE_S 0
1369 #define IRDMA_CQPSQ_FWQE_AECODE_M (0xffffULL << IRDMA_CQPSQ_FWQE_AECODE_S)
1370 
1371 #define IRDMA_CQPSQ_FWQE_AESOURCE_S 16
1372 #define IRDMA_CQPSQ_FWQE_AESOURCE_M \
1373 	(0xfULL << IRDMA_CQPSQ_FWQE_AESOURCE_S)
1374 
1375 #define IRDMA_CQPSQ_FWQE_RQMNERR_S 0
1376 #define IRDMA_CQPSQ_FWQE_RQMNERR_M \
1377 	(0xffffULL << IRDMA_CQPSQ_FWQE_RQMNERR_S)
1378 
1379 #define IRDMA_CQPSQ_FWQE_RQMJERR_S 16
1380 #define IRDMA_CQPSQ_FWQE_RQMJERR_M \
1381 	(0xffffULL << IRDMA_CQPSQ_FWQE_RQMJERR_S)
1382 
1383 #define IRDMA_CQPSQ_FWQE_SQMNERR_S 32
1384 #define IRDMA_CQPSQ_FWQE_SQMNERR_M \
1385 	(0xffffULL << IRDMA_CQPSQ_FWQE_SQMNERR_S)
1386 
1387 #define IRDMA_CQPSQ_FWQE_SQMJERR_S 48
1388 #define IRDMA_CQPSQ_FWQE_SQMJERR_M \
1389 	(0xffffULL << IRDMA_CQPSQ_FWQE_SQMJERR_S)
1390 
1391 #define IRDMA_CQPSQ_FWQE_QPID_S 0
1392 #define IRDMA_CQPSQ_FWQE_QPID_M (0xffffffULL << IRDMA_CQPSQ_FWQE_QPID_S)
1393 
1394 #define IRDMA_CQPSQ_FWQE_GENERATE_AE_S 59
1395 #define IRDMA_CQPSQ_FWQE_GENERATE_AE_M \
1396 	BIT_ULL(IRDMA_CQPSQ_FWQE_GENERATE_AE_S)
1397 
1398 #define IRDMA_CQPSQ_FWQE_USERFLCODE_S 60
1399 #define IRDMA_CQPSQ_FWQE_USERFLCODE_M \
1400 	BIT_ULL(IRDMA_CQPSQ_FWQE_USERFLCODE_S)
1401 
1402 #define IRDMA_CQPSQ_FWQE_FLUSHSQ_S 61
1403 #define IRDMA_CQPSQ_FWQE_FLUSHSQ_M BIT_ULL(IRDMA_CQPSQ_FWQE_FLUSHSQ_S)
1404 
1405 #define IRDMA_CQPSQ_FWQE_FLUSHRQ_S 62
1406 #define IRDMA_CQPSQ_FWQE_FLUSHRQ_M BIT_ULL(IRDMA_CQPSQ_FWQE_FLUSHRQ_S)
1407 
1408 /* Manage Accelerated Port Table - MAPT */
1409 #define IRDMA_CQPSQ_MAPT_PORT_S 0
1410 #define IRDMA_CQPSQ_MAPT_PORT_M (0xffffULL << IRDMA_CQPSQ_MAPT_PORT_S)
1411 
1412 #define IRDMA_CQPSQ_MAPT_ADDPORT_S 62
1413 #define IRDMA_CQPSQ_MAPT_ADDPORT_M BIT_ULL(IRDMA_CQPSQ_MAPT_ADDPORT_S)
1414 
1415 /* Update Protocol Engine SDs */
1416 #define IRDMA_CQPSQ_UPESD_SDCMD_S 0
1417 #define IRDMA_CQPSQ_UPESD_SDCMD_M (0xffffffffULL << IRDMA_CQPSQ_UPESD_SDCMD_S)
1418 
1419 #define IRDMA_CQPSQ_UPESD_SDDATALOW_S 0
1420 #define IRDMA_CQPSQ_UPESD_SDDATALOW_M \
1421 	(0xffffffffULL << IRDMA_CQPSQ_UPESD_SDDATALOW_S)
1422 
1423 #define IRDMA_CQPSQ_UPESD_SDDATAHI_S 32
1424 #define IRDMA_CQPSQ_UPESD_SDDATAHI_M \
1425 	(0xffffffffULL << IRDMA_CQPSQ_UPESD_SDDATAHI_S)
1426 #define IRDMA_CQPSQ_UPESD_HMCFNID_S 0
1427 #define IRDMA_CQPSQ_UPESD_HMCFNID_M \
1428 	(0x3fULL << IRDMA_CQPSQ_UPESD_HMCFNID_S)
1429 
1430 #define IRDMA_CQPSQ_UPESD_ENTRY_VALID_S 63
1431 #define IRDMA_CQPSQ_UPESD_ENTRY_VALID_M \
1432 	BIT_ULL(IRDMA_CQPSQ_UPESD_ENTRY_VALID_S)
1433 
1434 #define IRDMA_CQPSQ_UPESD_BM_PF 0
1435 #define IRDMA_CQPSQ_UPESD_BM_CP_LM 1
1436 #define IRDMA_CQPSQ_UPESD_BM_AXF 2
1437 #define IRDMA_CQPSQ_UPESD_BM_LM 4
1438 
1439 #define IRDMA_CQPSQ_UPESD_BM_S 32
1440 #define IRDMA_CQPSQ_UPESD_BM_M \
1441 	(0x7ULL << IRDMA_CQPSQ_UPESD_BM_S)
1442 
1443 #define IRDMA_CQPSQ_UPESD_ENTRY_COUNT_S 0
1444 #define IRDMA_CQPSQ_UPESD_ENTRY_COUNT_M \
1445 	(0xfULL << IRDMA_CQPSQ_UPESD_ENTRY_COUNT_S)
1446 
1447 #define IRDMA_CQPSQ_UPESD_SKIP_ENTRY_S 7
1448 #define IRDMA_CQPSQ_UPESD_SKIP_ENTRY_M \
1449 	BIT_ULL(IRDMA_CQPSQ_UPESD_SKIP_ENTRY_S)
1450 
1451 /* Suspend QP */
1452 #define IRDMA_CQPSQ_SUSPENDQP_QPID_S 0
1453 #define IRDMA_CQPSQ_SUSPENDQP_QPID_M (0xFFFFFFULL)
1454 
1455 /* Resume QP */
1456 #define IRDMA_CQPSQ_RESUMEQP_QSHANDLE_S 0
1457 #define IRDMA_CQPSQ_RESUMEQP_QSHANDLE_M \
1458 	(0xffffffffULL << IRDMA_CQPSQ_RESUMEQP_QSHANDLE_S)
1459 
1460 #define IRDMA_CQPSQ_RESUMEQP_QPID_S 0
1461 #define IRDMA_CQPSQ_RESUMEQP_QPID_M (0xFFFFFFUL)
1462 
1463 #define IRDMA_CQPSQ_MIN_STAG_INVALID 0x0001
1464 #define IRDMA_CQPSQ_MIN_SUSPEND_PND 0x0005
1465 
1466 #define IRDMA_CQPSQ_MAJ_NO_ERROR 0x0000
1467 #define IRDMA_CQPSQ_MAJ_OBJCACHE_ERROR 0xF000
1468 #define IRDMA_CQPSQ_MAJ_CNTXTCACHE_ERROR 0xF001
1469 #define IRDMA_CQPSQ_MAJ_ERROR 0xFFFF
1470 
1471 /* IW QP Context */
1472 #define IRDMAQPC_DDP_VER_S 0
1473 #define IRDMAQPC_DDP_VER_M (3ULL << IRDMAQPC_DDP_VER_S)
1474 
1475 #define IRDMAQPC_IBRDENABLE_S 2
1476 #define IRDMAQPC_IBRDENABLE_M BIT_ULL(IRDMAQPC_IBRDENABLE_S)
1477 
1478 #define IRDMAQPC_IPV4_S 3
1479 #define IRDMAQPC_IPV4_M BIT_ULL(IRDMAQPC_IPV4_S)
1480 
1481 #define IRDMAQPC_NONAGLE_S 4
1482 #define IRDMAQPC_NONAGLE_M BIT_ULL(IRDMAQPC_NONAGLE_S)
1483 
1484 #define IRDMAQPC_INSERTVLANTAG_S 5
1485 #define IRDMAQPC_INSERTVLANTAG_M BIT_ULL(IRDMAQPC_INSERTVLANTAG_S)
1486 
1487 #define IRDMAQPC_ISQP1_S 6
1488 #define IRDMAQPC_ISQP1_M BIT_ULL(IRDMAQPC_ISQP1_S)
1489 
1490 #define IRDMAQPC_TIMESTAMP_S 7
1491 #define IRDMAQPC_TIMESTAMP_M BIT_ULL(IRDMAQPC_TIMESTAMP_S)
1492 
1493 #define IRDMAQPC_RQWQESIZE_S 8
1494 #define IRDMAQPC_RQWQESIZE_M (3ULL << IRDMAQPC_RQWQESIZE_S)
1495 
1496 #define IRDMAQPC_INSERTL2TAG2_S 11
1497 #define IRDMAQPC_INSERTL2TAG2_M BIT_ULL(IRDMAQPC_INSERTL2TAG2_S)
1498 
1499 #define IRDMAQPC_LIMIT_S 12
1500 #define IRDMAQPC_LIMIT_M (3ULL << IRDMAQPC_LIMIT_S)
1501 
1502 #define IRDMAQPC_ECN_EN_S 14
1503 #define IRDMAQPC_ECN_EN_M BIT_ULL(IRDMAQPC_ECN_EN_S)
1504 
1505 #define IRDMAQPC_DROPOOOSEG_S 15
1506 #define IRDMAQPC_DROPOOOSEG_M BIT_ULL(IRDMAQPC_DROPOOOSEG_S)
1507 
1508 #define IRDMAQPC_DUPACK_THRESH_S 16
1509 #define IRDMAQPC_DUPACK_THRESH_M (7ULL << IRDMAQPC_DUPACK_THRESH_S)
1510 
1511 #define IRDMAQPC_ERR_RQ_IDX_VALID_S 19
1512 #define IRDMAQPC_ERR_RQ_IDX_VALID_M BIT_ULL(IRDMAQPC_ERR_RQ_IDX_VALID_S)
1513 
1514 #define IRDMAQPC_DIS_VLAN_CHECKS_S 19
1515 #define IRDMAQPC_DIS_VLAN_CHECKS_M (7ULL << IRDMAQPC_DIS_VLAN_CHECKS_S)
1516 
1517 #define IRDMAQPC_DC_TCP_EN_S 25
1518 #define IRDMAQPC_DC_TCP_EN_M BIT_ULL(IRDMAQPC_DC_TCP_EN_S)
1519 
1520 #define IRDMAQPC_RCVTPHEN_S 28
1521 #define IRDMAQPC_RCVTPHEN_M BIT_ULL(IRDMAQPC_RCVTPHEN_S)
1522 
1523 #define IRDMAQPC_XMITTPHEN_S 29
1524 #define IRDMAQPC_XMITTPHEN_M BIT_ULL(IRDMAQPC_XMITTPHEN_S)
1525 
1526 #define IRDMAQPC_RQTPHEN_S 30
1527 #define IRDMAQPC_RQTPHEN_M BIT_ULL(IRDMAQPC_RQTPHEN_S)
1528 
1529 #define IRDMAQPC_SQTPHEN_S 31
1530 #define IRDMAQPC_SQTPHEN_M BIT_ULL(IRDMAQPC_SQTPHEN_S)
1531 
1532 #define IRDMAQPC_PPIDX_S 32
1533 #define IRDMAQPC_PPIDX_M (0x3ffULL << IRDMAQPC_PPIDX_S)
1534 
1535 #define IRDMAQPC_PMENA_S 47
1536 #define IRDMAQPC_PMENA_M BIT_ULL(IRDMAQPC_PMENA_S)
1537 
1538 #define IRDMAQPC_RDMAP_VER_S 62
1539 #define IRDMAQPC_RDMAP_VER_M (3ULL << IRDMAQPC_RDMAP_VER_S)
1540 
1541 #define IRDMAQPC_ROCE_TVER_S 60
1542 #define IRDMAQPC_ROCE_TVER_M (0x0fULL << IRDMAQPC_ROCE_TVER_S)
1543 
1544 #define IRDMAQPC_SQADDR_S IRDMA_CQPHC_QPCTX_S
1545 #define IRDMAQPC_SQADDR_M IRDMA_CQPHC_QPCTX_M
1546 
1547 #define IRDMAQPC_RQADDR_S IRDMA_CQPHC_QPCTX_S
1548 #define IRDMAQPC_RQADDR_M IRDMA_CQPHC_QPCTX_M
1549 
1550 #define IRDMAQPC_TTL_S 0
1551 #define IRDMAQPC_TTL_M (0xffULL << IRDMAQPC_TTL_S)
1552 
1553 #define IRDMAQPC_RQSIZE_S 8
1554 #define IRDMAQPC_RQSIZE_M (0xfULL << IRDMAQPC_RQSIZE_S)
1555 
1556 #define IRDMAQPC_SQSIZE_S 12
1557 #define IRDMAQPC_SQSIZE_M (0xfULL << IRDMAQPC_SQSIZE_S)
1558 
1559 #define IRDMAQPC_GEN1_SRCMACADDRIDX_S 16
1560 #define IRDMAQPC_GEN1_SRCMACADDRIDX_M (0x3fUL << IRDMAQPC_GEN1_SRCMACADDRIDX_S)
1561 
1562 #define IRDMAQPC_AVOIDSTRETCHACK_S 23
1563 #define IRDMAQPC_AVOIDSTRETCHACK_M BIT_ULL(IRDMAQPC_AVOIDSTRETCHACK_S)
1564 
1565 #define IRDMAQPC_TOS_S 24
1566 #define IRDMAQPC_TOS_M (0xffULL << IRDMAQPC_TOS_S)
1567 
1568 #define IRDMAQPC_SRCPORTNUM_S 32
1569 #define IRDMAQPC_SRCPORTNUM_M (0xffffULL << IRDMAQPC_SRCPORTNUM_S)
1570 
1571 #define IRDMAQPC_DESTPORTNUM_S 48
1572 #define IRDMAQPC_DESTPORTNUM_M (0xffffULL << IRDMAQPC_DESTPORTNUM_S)
1573 
1574 #define IRDMAQPC_DESTIPADDR0_S 32
1575 #define IRDMAQPC_DESTIPADDR0_M \
1576 	(0xffffffffULL << IRDMAQPC_DESTIPADDR0_S)
1577 
1578 #define IRDMAQPC_DESTIPADDR1_S 0
1579 #define IRDMAQPC_DESTIPADDR1_M \
1580 	(0xffffffffULL << IRDMAQPC_DESTIPADDR1_S)
1581 
1582 #define IRDMAQPC_DESTIPADDR2_S 32
1583 #define IRDMAQPC_DESTIPADDR2_M \
1584 	(0xffffffffULL << IRDMAQPC_DESTIPADDR2_S)
1585 
1586 #define IRDMAQPC_DESTIPADDR3_S 0
1587 #define IRDMAQPC_DESTIPADDR3_M \
1588 	(0xffffffffULL << IRDMAQPC_DESTIPADDR3_S)
1589 
1590 #define IRDMAQPC_SNDMSS_S 16
1591 #define IRDMAQPC_SNDMSS_M (0x3fffULL << IRDMAQPC_SNDMSS_S)
1592 
1593 #define IRDMAQPC_SYN_RST_HANDLING_S 30
1594 #define IRDMAQPC_SYN_RST_HANDLING_M (0x3ULL << IRDMAQPC_SYN_RST_HANDLING_S)
1595 
1596 #define IRDMAQPC_VLANTAG_S 32
1597 #define IRDMAQPC_VLANTAG_M (0xffffULL << IRDMAQPC_VLANTAG_S)
1598 
1599 #define IRDMAQPC_ARPIDX_S 48
1600 #define IRDMAQPC_ARPIDX_M (0xffffULL << IRDMAQPC_ARPIDX_S)
1601 
1602 #define IRDMAQPC_FLOWLABEL_S 0
1603 #define IRDMAQPC_FLOWLABEL_M (0xfffffULL << IRDMAQPC_FLOWLABEL_S)
1604 
1605 #define IRDMAQPC_WSCALE_S 20
1606 #define IRDMAQPC_WSCALE_M BIT_ULL(IRDMAQPC_WSCALE_S)
1607 
1608 #define IRDMAQPC_KEEPALIVE_S 21
1609 #define IRDMAQPC_KEEPALIVE_M BIT_ULL(IRDMAQPC_KEEPALIVE_S)
1610 
1611 #define IRDMAQPC_IGNORE_TCP_OPT_S 22
1612 #define IRDMAQPC_IGNORE_TCP_OPT_M BIT_ULL(IRDMAQPC_IGNORE_TCP_OPT_S)
1613 
1614 #define IRDMAQPC_IGNORE_TCP_UNS_OPT_S 23
1615 #define IRDMAQPC_IGNORE_TCP_UNS_OPT_M \
1616 	BIT_ULL(IRDMAQPC_IGNORE_TCP_UNS_OPT_S)
1617 
1618 #define IRDMAQPC_TCPSTATE_S 28
1619 #define IRDMAQPC_TCPSTATE_M (0xfULL << IRDMAQPC_TCPSTATE_S)
1620 
1621 #define IRDMAQPC_RCVSCALE_S 32
1622 #define IRDMAQPC_RCVSCALE_M (0xfULL << IRDMAQPC_RCVSCALE_S)
1623 
1624 #define IRDMAQPC_SNDSCALE_S 40
1625 #define IRDMAQPC_SNDSCALE_M (0xfULL << IRDMAQPC_SNDSCALE_S)
1626 
1627 #define IRDMAQPC_PDIDX_S 48
1628 #define IRDMAQPC_PDIDX_M (0xffffULL << IRDMAQPC_PDIDX_S)
1629 
1630 #define IRDMAQPC_PDIDXHI_S 20
1631 #define IRDMAQPC_PDIDXHI_M (0x3ULL << IRDMAQPC_PDIDXHI_S)
1632 
1633 #define IRDMAQPC_PKEY_S 32
1634 #define IRDMAQPC_PKEY_M (0xffffULL << IRDMAQPC_PKEY_S)
1635 
1636 #define IRDMAQPC_ACKCREDITS_S 20
1637 #define IRDMAQPC_ACKCREDITS_M (0x1fULL << IRDMAQPC_ACKCREDITS_S)
1638 
1639 #define IRDMAQPC_QKEY_S 32
1640 #define IRDMAQPC_QKEY_M (0xffffffffULL << IRDMAQPC_QKEY_S)
1641 
1642 #define IRDMAQPC_DESTQP_S 0
1643 #define IRDMAQPC_DESTQP_M (0xffffffULL << IRDMAQPC_DESTQP_S)
1644 
1645 #define IRDMAQPC_KALIVE_TIMER_MAX_PROBES_S 16
1646 #define IRDMAQPC_KALIVE_TIMER_MAX_PROBES_M \
1647 	(0xffULL << IRDMAQPC_KALIVE_TIMER_MAX_PROBES_S)
1648 
1649 #define IRDMAQPC_KEEPALIVE_INTERVAL_S 24
1650 #define IRDMAQPC_KEEPALIVE_INTERVAL_M \
1651 	(0xffULL << IRDMAQPC_KEEPALIVE_INTERVAL_S)
1652 
1653 #define IRDMAQPC_TIMESTAMP_RECENT_S 0
1654 #define IRDMAQPC_TIMESTAMP_RECENT_M \
1655 	(0xffffffffULL << IRDMAQPC_TIMESTAMP_RECENT_S)
1656 
1657 #define IRDMAQPC_TIMESTAMP_AGE_S 32
1658 #define IRDMAQPC_TIMESTAMP_AGE_M \
1659 	(0xffffffffULL << IRDMAQPC_TIMESTAMP_AGE_S)
1660 
1661 #define IRDMAQPC_SNDNXT_S 0
1662 #define IRDMAQPC_SNDNXT_M (0xffffffffULL << IRDMAQPC_SNDNXT_S)
1663 
1664 #define IRDMAQPC_ISN_S 32
1665 #define IRDMAQPC_ISN_M (0x00ffffffULL << IRDMAQPC_ISN_S)
1666 
1667 #define IRDMAQPC_PSNNXT_S 0
1668 #define IRDMAQPC_PSNNXT_M (0x00ffffffULL << IRDMAQPC_PSNNXT_S)
1669 
1670 #define IRDMAQPC_LSN_S 32
1671 #define IRDMAQPC_LSN_M (0x00ffffffULL << IRDMAQPC_LSN_S)
1672 
1673 #define IRDMAQPC_SNDWND_S 32
1674 #define IRDMAQPC_SNDWND_M (0xffffffffULL << IRDMAQPC_SNDWND_S)
1675 
1676 #define IRDMAQPC_RCVNXT_S 0
1677 #define IRDMAQPC_RCVNXT_M (0xffffffffULL << IRDMAQPC_RCVNXT_S)
1678 
1679 #define IRDMAQPC_EPSN_S 0
1680 #define IRDMAQPC_EPSN_M (0x00ffffffULL << IRDMAQPC_EPSN_S)
1681 
1682 #define IRDMAQPC_RCVWND_S 32
1683 #define IRDMAQPC_RCVWND_M (0xffffffffULL << IRDMAQPC_RCVWND_S)
1684 
1685 #define IRDMAQPC_SNDMAX_S 0
1686 #define IRDMAQPC_SNDMAX_M (0xffffffffULL << IRDMAQPC_SNDMAX_S)
1687 
1688 #define IRDMAQPC_SNDUNA_S 32
1689 #define IRDMAQPC_SNDUNA_M (0xffffffffULL << IRDMAQPC_SNDUNA_S)
1690 
1691 #define IRDMAQPC_PSNMAX_S 0
1692 #define IRDMAQPC_PSNMAX_M (0x00ffffffULL << IRDMAQPC_PSNMAX_S)
1693 #define IRDMAQPC_PSNUNA_S 32
1694 #define IRDMAQPC_PSNUNA_M (0xffffffULL << IRDMAQPC_PSNUNA_S)
1695 
1696 #define IRDMAQPC_SRTT_S 0
1697 #define IRDMAQPC_SRTT_M (0xffffffffULL << IRDMAQPC_SRTT_S)
1698 
1699 #define IRDMAQPC_RTTVAR_S 32
1700 #define IRDMAQPC_RTTVAR_M (0xffffffffULL << IRDMAQPC_RTTVAR_S)
1701 
1702 #define IRDMAQPC_SSTHRESH_S 0
1703 #define IRDMAQPC_SSTHRESH_M (0xffffffffULL << IRDMAQPC_SSTHRESH_S)
1704 
1705 #define IRDMAQPC_CWND_S 32
1706 #define IRDMAQPC_CWND_M (0xffffffffULL << IRDMAQPC_CWND_S)
1707 
1708 #define IRDMAQPC_CWNDROCE_S 32
1709 #define IRDMAQPC_CWNDROCE_M (0xffffffULL << IRDMAQPC_CWNDROCE_S)
1710 
1711 #define IRDMAQPC_SNDWL1_S 0
1712 #define IRDMAQPC_SNDWL1_M (0xffffffffULL << IRDMAQPC_SNDWL1_S)
1713 
1714 #define IRDMAQPC_SNDWL2_S 32
1715 #define IRDMAQPC_SNDWL2_M (0xffffffffULL << IRDMAQPC_SNDWL2_S)
1716 
1717 #define IRDMAQPC_ERR_RQ_IDX_S 32
1718 #define IRDMAQPC_ERR_RQ_IDX_M (0x3fffULL << IRDMAQPC_ERR_RQ_IDX_S)
1719 
1720 #define IRDMAQPC_RTOMIN_S 57
1721 #define IRDMAQPC_RTOMIN_M (0x7fULL << IRDMAQPC_RTOMIN_S)
1722 
1723 #define IRDMAQPC_MAXSNDWND_S 0
1724 #define IRDMAQPC_MAXSNDWND_M (0xffffffffULL << IRDMAQPC_MAXSNDWND_S)
1725 
1726 #define IRDMAQPC_REXMIT_THRESH_S 48
1727 #define IRDMAQPC_REXMIT_THRESH_M (0x3fULL << IRDMAQPC_REXMIT_THRESH_S)
1728 
1729 #define IRDMAQPC_RNRNAK_THRESH_S 54
1730 #define IRDMAQPC_RNRNAK_THRESH_M (0x7ULL << IRDMAQPC_RNRNAK_THRESH_S)
1731 
1732 #define IRDMAQPC_TXCQNUM_S 0
1733 #define IRDMAQPC_TXCQNUM_M (0x7ffffULL << IRDMAQPC_TXCQNUM_S)
1734 
1735 #define IRDMAQPC_RXCQNUM_S 32
1736 #define IRDMAQPC_RXCQNUM_M (0x7ffffULL << IRDMAQPC_RXCQNUM_S)
1737 
1738 #define IRDMAQPC_STAT_INDEX_S 0
1739 #define IRDMAQPC_STAT_INDEX_M (0x7fULL << IRDMAQPC_STAT_INDEX_S)
1740 
1741 #define IRDMAQPC_Q2ADDR_S 8
1742 #define IRDMAQPC_Q2ADDR_M (0xffffffffffffffULL << IRDMAQPC_Q2ADDR_S)
1743 
1744 #define IRDMAQPC_LASTBYTESENT_S 0
1745 #define IRDMAQPC_LASTBYTESENT_M (0xffULL << IRDMAQPC_LASTBYTESENT_S)
1746 
1747 #define IRDMAQPC_MACADDRESS_S 16
1748 #define IRDMAQPC_MACADDRESS_M (0xffffffffffffULL << IRDMAQPC_MACADDRESS_S)
1749 
1750 #define IRDMAQPC_ORDSIZE_S 0
1751 #define IRDMAQPC_ORDSIZE_M (0xffULL << IRDMAQPC_ORDSIZE_S)
1752 
1753 #define IRDMAQPC_IRDSIZE_S 16
1754 #define IRDMAQPC_IRDSIZE_M (0x7ULL << IRDMAQPC_IRDSIZE_S)
1755 
1756 #define IRDMAQPC_UDPRIVCQENABLE_S 19
1757 #define IRDMAQPC_UDPRIVCQENABLE_M BIT_ULL(IRDMAQPC_UDPRIVCQENABLE_S)
1758 
1759 #define IRDMAQPC_WRRDRSPOK_S 20
1760 #define IRDMAQPC_WRRDRSPOK_M BIT_ULL(IRDMAQPC_WRRDRSPOK_S)
1761 
1762 #define IRDMAQPC_RDOK_S 21
1763 #define IRDMAQPC_RDOK_M BIT_ULL(IRDMAQPC_RDOK_S)
1764 
1765 #define IRDMAQPC_SNDMARKERS_S 22
1766 #define IRDMAQPC_SNDMARKERS_M BIT_ULL(IRDMAQPC_SNDMARKERS_S)
1767 
1768 #define IRDMAQPC_DCQCNENABLE_S 22
1769 #define IRDMAQPC_DCQCNENABLE_M BIT_ULL(IRDMAQPC_DCQCNENABLE_S)
1770 
1771 #define IRDMAQPC_FW_CC_ENABLE_S 28
1772 #define IRDMAQPC_FW_CC_ENABLE_M BIT_ULL(IRDMAQPC_FW_CC_ENABLE_S)
1773 
1774 #define IRDMAQPC_RCVNOICRC_S 31
1775 #define IRDMAQPC_RCVNOICRC_M BIT_ULL(IRDMAQPC_RCVNOICRC_S)
1776 
1777 #define IRDMAQPC_BINDEN_S 23
1778 #define IRDMAQPC_BINDEN_M BIT_ULL(IRDMAQPC_BINDEN_S)
1779 
1780 #define IRDMAQPC_FASTREGEN_S 24
1781 #define IRDMAQPC_FASTREGEN_M BIT_ULL(IRDMAQPC_FASTREGEN_S)
1782 
1783 #define IRDMAQPC_PRIVEN_S 25
1784 #define IRDMAQPC_PRIVEN_M BIT_ULL(IRDMAQPC_PRIVEN_S)
1785 
1786 #define IRDMAQPC_TIMELYENABLE_S 27
1787 #define IRDMAQPC_TIMELYENABLE_M BIT_ULL(IRDMAQPC_TIMELYENABLE_S)
1788 
1789 #define IRDMAQPC_THIGH_S 52
1790 #define IRDMAQPC_THIGH_M ((u64)0xfff << IRDMAQPC_THIGH_S)
1791 
1792 #define IRDMAQPC_TLOW_S 32
1793 #define IRDMAQPC_TLOW_M ((u64)0xFF << IRDMAQPC_TLOW_S)
1794 
1795 #define IRDMAQPC_REMENDPOINTIDX_S 0
1796 #define IRDMAQPC_REMENDPOINTIDX_M ((u64)0x1FFFF << IRDMAQPC_REMENDPOINTIDX_S)
1797 
1798 #define IRDMAQPC_USESTATSINSTANCE_S 26
1799 #define IRDMAQPC_USESTATSINSTANCE_M BIT_ULL(IRDMAQPC_USESTATSINSTANCE_S)
1800 
1801 #define IRDMAQPC_IWARPMODE_S 28
1802 #define IRDMAQPC_IWARPMODE_M BIT_ULL(IRDMAQPC_IWARPMODE_S)
1803 
1804 #define IRDMAQPC_RCVMARKERS_S 29
1805 #define IRDMAQPC_RCVMARKERS_M BIT_ULL(IRDMAQPC_RCVMARKERS_S)
1806 
1807 #define IRDMAQPC_ALIGNHDRS_S 30
1808 #define IRDMAQPC_ALIGNHDRS_M BIT_ULL(IRDMAQPC_ALIGNHDRS_S)
1809 
1810 #define IRDMAQPC_RCVNOMPACRC_S 31
1811 #define IRDMAQPC_RCVNOMPACRC_M BIT_ULL(IRDMAQPC_RCVNOMPACRC_S)
1812 
1813 #define IRDMAQPC_RCVMARKOFFSET_S 32
1814 #define IRDMAQPC_RCVMARKOFFSET_M (0x1ffULL << IRDMAQPC_RCVMARKOFFSET_S)
1815 
1816 #define IRDMAQPC_SNDMARKOFFSET_S 48
1817 #define IRDMAQPC_SNDMARKOFFSET_M (0x1ffULL << IRDMAQPC_SNDMARKOFFSET_S)
1818 
1819 #define IRDMAQPC_QPCOMPCTX_S IRDMA_CQPHC_QPCTX_S
1820 #define IRDMAQPC_QPCOMPCTX_M IRDMA_CQPHC_QPCTX_M
1821 
1822 #define IRDMAQPC_SQTPHVAL_S 0
1823 #define IRDMAQPC_SQTPHVAL_M (0xffULL << IRDMAQPC_SQTPHVAL_S)
1824 
1825 #define IRDMAQPC_RQTPHVAL_S 8
1826 #define IRDMAQPC_RQTPHVAL_M (0xffULL << IRDMAQPC_RQTPHVAL_S)
1827 
1828 #define IRDMAQPC_QSHANDLE_S 16
1829 #define IRDMAQPC_QSHANDLE_M (0x3ffULL << IRDMAQPC_QSHANDLE_S)
1830 
1831 #define IRDMAQPC_EXCEPTION_LAN_QUEUE_S 32
1832 #define IRDMAQPC_EXCEPTION_LAN_QUEUE_M \
1833 	(0xfffULL << IRDMAQPC_EXCEPTION_LAN_QUEUE_S)
1834 
1835 #define IRDMAQPC_LOCAL_IPADDR3_S 0
1836 #define IRDMAQPC_LOCAL_IPADDR3_M \
1837 	(0xffffffffULL << IRDMAQPC_LOCAL_IPADDR3_S)
1838 
1839 #define IRDMAQPC_LOCAL_IPADDR2_S 32
1840 #define IRDMAQPC_LOCAL_IPADDR2_M \
1841 	(0xffffffffULL << IRDMAQPC_LOCAL_IPADDR2_S)
1842 
1843 #define IRDMAQPC_LOCAL_IPADDR1_S 0
1844 #define IRDMAQPC_LOCAL_IPADDR1_M \
1845 	(0xffffffffULL << IRDMAQPC_LOCAL_IPADDR1_S)
1846 
1847 #define IRDMAQPC_LOCAL_IPADDR0_S 32
1848 #define IRDMAQPC_LOCAL_IPADDR0_M \
1849 	(0xffffffffULL << IRDMAQPC_LOCAL_IPADDR0_S)
1850 
1851 #define IRDMA_FW_VER_MINOR_S 0
1852 #define IRDMA_FW_VER_MINOR_M \
1853 	(0xffffULL << IRDMA_FW_VER_MINOR_S)
1854 
1855 #define IRDMA_FW_VER_MAJOR_S 16
1856 #define IRDMA_FW_VER_MAJOR_M \
1857 	(0xffffULL << IRDMA_FW_VER_MAJOR_S)
1858 
1859 #define IRDMA_FEATURE_INFO_S 0
1860 #define IRDMA_FEATURE_INFO_M \
1861 	(0xffffffffffffULL << IRDMA_FEATURE_INFO_S)
1862 
1863 #define IRDMA_FEATURE_CNT_S 32
1864 #define IRDMA_FEATURE_CNT_M \
1865 	(0xffffULL << IRDMA_FEATURE_CNT_S)
1866 
1867 #define IRDMA_FEATURE_TYPE_S 48
1868 #define IRDMA_FEATURE_TYPE_M \
1869 	(0xffffULL << IRDMA_FEATURE_TYPE_S)
1870 
1871 #define IRDMA_RSVD_S 41
1872 #define IRDMA_RSVD_M (0x7fffULL << IRDMA_RSVD_S)
1873 
1874 /* iwarp QP SQ WQE common fields */
1875 #define IRDMAQPSQ_OPCODE_S 32
1876 #define IRDMAQPSQ_OPCODE_M (0x3fULL << IRDMAQPSQ_OPCODE_S)
1877 
1878 #define IRDMAQPSQ_COPY_HOST_PBL_S 43
1879 #define IRDMAQPSQ_COPY_HOST_PBL_M BIT_ULL(IRDMAQPSQ_COPY_HOST_PBL_S)
1880 
1881 #define IRDMAQPSQ_ADDFRAGCNT_S 38
1882 #define IRDMAQPSQ_ADDFRAGCNT_M (0xfULL << IRDMAQPSQ_ADDFRAGCNT_S)
1883 
1884 #define IRDMAQPSQ_PUSHWQE_S 56
1885 #define IRDMAQPSQ_PUSHWQE_M BIT_ULL(IRDMAQPSQ_PUSHWQE_S)
1886 
1887 #define IRDMAQPSQ_STREAMMODE_S 58
1888 #define IRDMAQPSQ_STREAMMODE_M BIT_ULL(IRDMAQPSQ_STREAMMODE_S)
1889 
1890 #define IRDMAQPSQ_WAITFORRCVPDU_S 59
1891 #define IRDMAQPSQ_WAITFORRCVPDU_M BIT_ULL(IRDMAQPSQ_WAITFORRCVPDU_S)
1892 
1893 #define IRDMAQPSQ_READFENCE_S 60
1894 #define IRDMAQPSQ_READFENCE_M BIT_ULL(IRDMAQPSQ_READFENCE_S)
1895 
1896 #define IRDMAQPSQ_LOCALFENCE_S 61
1897 #define IRDMAQPSQ_LOCALFENCE_M BIT_ULL(IRDMAQPSQ_LOCALFENCE_S)
1898 
1899 #define IRDMAQPSQ_UDPHEADER_S 61
1900 #define IRDMAQPSQ_UDPHEADER_M BIT_ULL(IRDMAQPSQ_UDPHEADER_S)
1901 
1902 #define IRDMAQPSQ_L4LEN_S 42
1903 #define IRDMAQPSQ_L4LEN_M ((u64)0xF << IRDMAQPSQ_L4LEN_S)
1904 
1905 #define IRDMAQPSQ_SIGCOMPL_S 62
1906 #define IRDMAQPSQ_SIGCOMPL_M BIT_ULL(IRDMAQPSQ_SIGCOMPL_S)
1907 
1908 #define IRDMAQPSQ_VALID_S 63
1909 #define IRDMAQPSQ_VALID_M BIT_ULL(IRDMAQPSQ_VALID_S)
1910 
1911 #define IRDMAQPSQ_FRAG_TO_S IRDMA_CQPHC_QPCTX_S
1912 #define IRDMAQPSQ_FRAG_TO_M IRDMA_CQPHC_QPCTX_M
1913 
1914 #define IRDMAQPSQ_FRAG_VALID_S 63
1915 #define IRDMAQPSQ_FRAG_VALID_M BIT_ULL(IRDMAQPSQ_FRAG_VALID_S)
1916 
1917 #define IRDMAQPSQ_FRAG_LEN_S 32
1918 #define IRDMAQPSQ_FRAG_LEN_M (0x7fffffffULL << IRDMAQPSQ_FRAG_LEN_S)
1919 
1920 #define IRDMAQPSQ_FRAG_STAG_S 0
1921 #define IRDMAQPSQ_FRAG_STAG_M (0xffffffffULL << IRDMAQPSQ_FRAG_STAG_S)
1922 
1923 #define IRDMAQPSQ_GEN1_FRAG_LEN_S 0
1924 #define IRDMAQPSQ_GEN1_FRAG_LEN_M (0xffffffffULL << IRDMAQPSQ_GEN1_FRAG_LEN_S)
1925 
1926 #define IRDMAQPSQ_GEN1_FRAG_STAG_S 32
1927 #define IRDMAQPSQ_GEN1_FRAG_STAG_M (0xffffffffULL << IRDMAQPSQ_GEN1_FRAG_STAG_S)
1928 
1929 #define IRDMAQPSQ_REMSTAGINV_S 0
1930 #define IRDMAQPSQ_REMSTAGINV_M (0xffffffffULL << IRDMAQPSQ_REMSTAGINV_S)
1931 
1932 #define IRDMAQPSQ_DESTQKEY_S 0
1933 #define IRDMAQPSQ_DESTQKEY_M (0xffffffffULL << IRDMAQPSQ_DESTQKEY_S)
1934 
1935 #define IRDMAQPSQ_DESTQPN_S 32
1936 #define IRDMAQPSQ_DESTQPN_M (0x00ffffffULL << IRDMAQPSQ_DESTQPN_S)
1937 
1938 #define IRDMAQPSQ_AHID_S 0
1939 #define IRDMAQPSQ_AHID_M (0x0001ffffULL << IRDMAQPSQ_AHID_S)
1940 
1941 #define IRDMAQPSQ_INLINEDATAFLAG_S 57
1942 #define IRDMAQPSQ_INLINEDATAFLAG_M BIT_ULL(IRDMAQPSQ_INLINEDATAFLAG_S)
1943 
1944 #define IRDMA_INLINE_VALID_S 7
1945 
1946 #define IRDMAQPSQ_INLINEDATALEN_S 48
1947 #define IRDMAQPSQ_INLINEDATALEN_M \
1948 	(0xffULL << IRDMAQPSQ_INLINEDATALEN_S)
1949 #define IRDMAQPSQ_IMMDATAFLAG_S 47
1950 #define IRDMAQPSQ_IMMDATAFLAG_M \
1951 	BIT_ULL(IRDMAQPSQ_IMMDATAFLAG_S)
1952 #define IRDMAQPSQ_REPORTRTT_S 46
1953 #define IRDMAQPSQ_REPORTRTT_M \
1954 	BIT_ULL(IRDMAQPSQ_REPORTRTT_S)
1955 
1956 #define IRDMAQPSQ_IMMDATA_S 0
1957 #define IRDMAQPSQ_IMMDATA_M \
1958 	(0xffffffffffffffffULL << IRDMAQPSQ_IMMDATA_S)
1959 
1960 /* rdma write */
1961 #define IRDMAQPSQ_REMSTAG_S 0
1962 #define IRDMAQPSQ_REMSTAG_M (0xffffffffULL << IRDMAQPSQ_REMSTAG_S)
1963 
1964 #define IRDMAQPSQ_REMTO_S IRDMA_CQPHC_QPCTX_S
1965 #define IRDMAQPSQ_REMTO_M IRDMA_CQPHC_QPCTX_M
1966 
1967 /* memory window */
1968 #define IRDMAQPSQ_STAGRIGHTS_S 48
1969 #define IRDMAQPSQ_STAGRIGHTS_M (0x1fULL << IRDMAQPSQ_STAGRIGHTS_S)
1970 
1971 #define IRDMAQPSQ_VABASEDTO_S 53
1972 #define IRDMAQPSQ_VABASEDTO_M BIT_ULL(IRDMAQPSQ_VABASEDTO_S)
1973 
1974 #define IRDMAQPSQ_MEMWINDOWTYPE_S 54
1975 #define IRDMAQPSQ_MEMWINDOWTYPE_M BIT_ULL(IRDMAQPSQ_MEMWINDOWTYPE_S)
1976 
1977 #define IRDMAQPSQ_MWLEN_S IRDMA_CQPHC_QPCTX_S
1978 #define IRDMAQPSQ_MWLEN_M IRDMA_CQPHC_QPCTX_M
1979 
1980 #define IRDMAQPSQ_PARENTMRSTAG_S 32
1981 #define IRDMAQPSQ_PARENTMRSTAG_M \
1982 	(0xffffffffULL << IRDMAQPSQ_PARENTMRSTAG_S)
1983 
1984 #define IRDMAQPSQ_MWSTAG_S 0
1985 #define IRDMAQPSQ_MWSTAG_M (0xffffffffULL << IRDMAQPSQ_MWSTAG_S)
1986 
1987 #define IRDMAQPSQ_BASEVA_TO_FBO_S IRDMA_CQPHC_QPCTX_S
1988 #define IRDMAQPSQ_BASEVA_TO_FBO_M IRDMA_CQPHC_QPCTX_M
1989 
1990 /* Local Invalidate */
1991 #define IRDMAQPSQ_LOCSTAG_S 0
1992 #define IRDMAQPSQ_LOCSTAG_M (0xffffffffULL << IRDMAQPSQ_LOCSTAG_S)
1993 
1994 /* Fast Register */
1995 #define IRDMAQPSQ_STAGKEY_S 0
1996 #define IRDMAQPSQ_STAGKEY_M (0xffULL << IRDMAQPSQ_STAGKEY_S)
1997 
1998 #define IRDMAQPSQ_STAGINDEX_S 8
1999 #define IRDMAQPSQ_STAGINDEX_M (0xffffffULL << IRDMAQPSQ_STAGINDEX_S)
2000 
2001 #define IRDMAQPSQ_COPYHOSTPBLS_S 43
2002 #define IRDMAQPSQ_COPYHOSTPBLS_M BIT_ULL(IRDMAQPSQ_COPYHOSTPBLS_S)
2003 
2004 #define IRDMAQPSQ_LPBLSIZE_S 44
2005 #define IRDMAQPSQ_LPBLSIZE_M (3ULL << IRDMAQPSQ_LPBLSIZE_S)
2006 
2007 #define IRDMAQPSQ_HPAGESIZE_S 46
2008 #define IRDMAQPSQ_HPAGESIZE_M (3ULL << IRDMAQPSQ_HPAGESIZE_S)
2009 
2010 #define IRDMAQPSQ_STAGLEN_S 0
2011 #define IRDMAQPSQ_STAGLEN_M (0x1ffffffffffULL << IRDMAQPSQ_STAGLEN_S)
2012 
2013 #define IRDMAQPSQ_FIRSTPMPBLIDXLO_S 48
2014 #define IRDMAQPSQ_FIRSTPMPBLIDXLO_M \
2015 	(0xffffULL << IRDMAQPSQ_FIRSTPMPBLIDXLO_S)
2016 
2017 #define IRDMAQPSQ_FIRSTPMPBLIDXHI_S 0
2018 #define IRDMAQPSQ_FIRSTPMPBLIDXHI_M \
2019 	(0xfffULL << IRDMAQPSQ_FIRSTPMPBLIDXHI_S)
2020 
2021 #define IRDMAQPSQ_PBLADDR_S 12
2022 #define IRDMAQPSQ_PBLADDR_M (0xfffffffffffffULL << IRDMAQPSQ_PBLADDR_S)
2023 
2024 /* iwarp QP RQ WQE common fields */
2025 #define IRDMAQPRQ_ADDFRAGCNT_S IRDMAQPSQ_ADDFRAGCNT_S
2026 #define IRDMAQPRQ_ADDFRAGCNT_M IRDMAQPSQ_ADDFRAGCNT_M
2027 
2028 #define IRDMAQPRQ_VALID_S IRDMAQPSQ_VALID_S
2029 #define IRDMAQPRQ_VALID_M IRDMAQPSQ_VALID_M
2030 
2031 #define IRDMAQPRQ_COMPLCTX_S IRDMA_CQPHC_QPCTX_S
2032 #define IRDMAQPRQ_COMPLCTX_M IRDMA_CQPHC_QPCTX_M
2033 
2034 #define IRDMAQPRQ_FRAG_LEN_S IRDMAQPSQ_FRAG_LEN_S
2035 #define IRDMAQPRQ_FRAG_LEN_M IRDMAQPSQ_FRAG_LEN_M
2036 
2037 #define IRDMAQPRQ_STAG_S IRDMAQPSQ_FRAG_STAG_S
2038 #define IRDMAQPRQ_STAG_M IRDMAQPSQ_FRAG_STAG_M
2039 
2040 #define IRDMAQPRQ_TO_S IRDMAQPSQ_FRAG_TO_S
2041 #define IRDMAQPRQ_TO_M IRDMAQPSQ_FRAG_TO_M
2042 
2043 #define IRDMAPFINT_OICR_HMC_ERR_M BIT(26)
2044 #define IRDMAPFINT_OICR_PE_PUSH_M BIT(27)
2045 #define IRDMAPFINT_OICR_PE_CRITERR_M BIT(28)
2046 
2047 /* Query FPM CQP buf */
2048 #define IRDMA_QUERY_FPM_MAX_QPS_S 0
2049 #define IRDMA_QUERY_FPM_MAX_QPS_M \
2050 	(0x7ffffULL << IRDMA_QUERY_FPM_MAX_QPS_S)
2051 
2052 #define IRDMA_QUERY_FPM_MAX_CQS_S 0
2053 #define IRDMA_QUERY_FPM_MAX_CQS_M \
2054 	(0xfffffULL << IRDMA_QUERY_FPM_MAX_CQS_S)
2055 
2056 #define IRDMA_QUERY_FPM_FIRST_PE_SD_INDEX_S 0
2057 #define IRDMA_QUERY_FPM_FIRST_PE_SD_INDEX_M \
2058 	(0x3fffULL << IRDMA_QUERY_FPM_FIRST_PE_SD_INDEX_S)
2059 
2060 #define IRDMA_QUERY_FPM_MAX_PE_SDS_S 32
2061 #define IRDMA_QUERY_FPM_MAX_PE_SDS_M \
2062 	(0x3fffULL << IRDMA_QUERY_FPM_MAX_PE_SDS_S)
2063 
2064 #define IRDMA_QUERY_FPM_MAX_CEQS_S 0
2065 #define IRDMA_QUERY_FPM_MAX_CEQS_M \
2066 	(0x3ffULL << IRDMA_QUERY_FPM_MAX_CEQS_S)
2067 
2068 #define IRDMA_QUERY_FPM_XFBLOCKSIZE_S 32
2069 #define IRDMA_QUERY_FPM_XFBLOCKSIZE_M \
2070 	(0xffffffffULL << IRDMA_QUERY_FPM_XFBLOCKSIZE_S)
2071 
2072 #define IRDMA_QUERY_FPM_Q1BLOCKSIZE_S 32
2073 #define IRDMA_QUERY_FPM_Q1BLOCKSIZE_M \
2074 	(0xffffffffULL << IRDMA_QUERY_FPM_Q1BLOCKSIZE_S)
2075 
2076 #define IRDMA_QUERY_FPM_HTMULTIPLIER_S 16
2077 #define IRDMA_QUERY_FPM_HTMULTIPLIER_M \
2078 	(0xfULL << IRDMA_QUERY_FPM_HTMULTIPLIER_S)
2079 
2080 #define IRDMA_QUERY_FPM_TIMERBUCKET_S 32
2081 #define IRDMA_QUERY_FPM_TIMERBUCKET_M \
2082 	(0xffFFULL << IRDMA_QUERY_FPM_TIMERBUCKET_S)
2083 
2084 #define IRDMA_QUERY_FPM_RRFBLOCKSIZE_S 32
2085 #define IRDMA_QUERY_FPM_RRFBLOCKSIZE_M \
2086 	(0xffffffffULL << IRDMA_QUERY_FPM_RRFBLOCKSIZE_S)
2087 
2088 #define IRDMA_QUERY_FPM_RRFFLBLOCKSIZE_S 32
2089 #define IRDMA_QUERY_FPM_RRFFLBLOCKSIZE_M \
2090 	(0xffffffffULL << IRDMA_QUERY_FPM_RRFFLBLOCKSIZE_S)
2091 
2092 #define IRDMA_QUERY_FPM_OOISCFBLOCKSIZE_S 32
2093 #define IRDMA_QUERY_FPM_OOISCFBLOCKSIZE_M \
2094 	(0xffffffffULL << IRDMA_QUERY_FPM_OOISCFBLOCKSIZE_S)
2095 
2096 /* Static HMC pages allocated buf */
2097 #define IRDMA_SHMC_PAGE_ALLOCATED_HMC_FN_ID_S 0
2098 #define IRDMA_SHMC_PAGE_ALLOCATED_HMC_FN_ID_M \
2099 	(0x3fULL << IRDMA_SHMC_PAGE_ALLOCATED_HMC_FN_ID_S)
2100 
2101 #define IRDMA_GET_CURRENT_AEQ_ELEM(_aeq) \
2102 	( \
2103 		(_aeq)->aeqe_base[IRDMA_RING_CURRENT_TAIL((_aeq)->aeq_ring)].buf \
2104 	)
2105 
2106 #define IRDMA_GET_CURRENT_CEQ_ELEM(_ceq) \
2107 	( \
2108 		(_ceq)->ceqe_base[IRDMA_RING_CURRENT_TAIL((_ceq)->ceq_ring)].buf \
2109 	)
2110 
2111 #define IRDMA_GET_CEQ_ELEM_AT_POS(_ceq, _pos) \
2112 	( \
2113 		(_ceq)->ceqe_base[_pos].buf  \
2114 	)
2115 
2116 #define IRDMA_RING_GET_NEXT_TAIL(_ring, _idx) \
2117 	( \
2118 		((_ring).tail + (_idx)) % (_ring).size \
2119 	)
2120 
2121 #define IRDMA_GET_CURRENT_CQ_ELEM(_cq) \
2122 	( \
2123 		(_cq)->cq_base[IRDMA_RING_CURRENT_HEAD((_cq)->cq_ring)].buf  \
2124 	)
2125 #define IRDMA_GET_CURRENT_EXTENDED_CQ_ELEM(_cq) \
2126 	( \
2127 		((struct irdma_extended_cqe *) \
2128 		((_cq)->cq_base))[IRDMA_RING_CURRENT_HEAD((_cq)->cq_ring)].buf \
2129 	)
2130 
2131 #define IRDMA_RING_INIT(_ring, _size) \
2132 	{ \
2133 		(_ring).head = 0; \
2134 		(_ring).tail = 0; \
2135 		(_ring).size = (_size); \
2136 	}
2137 #define IRDMA_RING_SIZE(_ring) ((_ring).size)
2138 #define IRDMA_RING_CURRENT_HEAD(_ring) ((_ring).head)
2139 #define IRDMA_RING_CURRENT_TAIL(_ring) ((_ring).tail)
2140 
2141 #define IRDMA_RING_MOVE_HEAD(_ring, _retcode) \
2142 	{ \
2143 		register u32 size; \
2144 		size = (_ring).size;  \
2145 		if (!IRDMA_RING_FULL_ERR(_ring)) { \
2146 			(_ring).head = ((_ring).head + 1) % size; \
2147 			(_retcode) = 0; \
2148 		} else { \
2149 			(_retcode) = -ENOSPC; \
2150 		} \
2151 	}
2152 #define IRDMA_RING_MOVE_HEAD_BY_COUNT(_ring, _count, _retcode) \
2153 	{ \
2154 		register u32 size; \
2155 		size = (_ring).size; \
2156 		if ((IRDMA_RING_USED_QUANTA(_ring) + (_count)) < size) { \
2157 			(_ring).head = ((_ring).head + (_count)) % size; \
2158 			(_retcode) = 0; \
2159 		} else { \
2160 			(_retcode) = -ENOSPC; \
2161 		} \
2162 	}
2163 #define IRDMA_SQ_RING_MOVE_HEAD(_ring, _retcode) \
2164 	{ \
2165 		register u32 size; \
2166 		size = (_ring).size;  \
2167 		if (!IRDMA_SQ_RING_FULL_ERR(_ring)) { \
2168 			(_ring).head = ((_ring).head + 1) % size; \
2169 			(_retcode) = 0; \
2170 		} else { \
2171 			(_retcode) = -ENOSPC; \
2172 		} \
2173 	}
2174 #define IRDMA_SQ_RING_MOVE_HEAD_BY_COUNT(_ring, _count, _retcode) \
2175 	{ \
2176 		register u32 size; \
2177 		size = (_ring).size; \
2178 		if ((IRDMA_RING_USED_QUANTA(_ring) + (_count)) < (size - 256)) { \
2179 			(_ring).head = ((_ring).head + (_count)) % size; \
2180 			(_retcode) = 0; \
2181 		} else { \
2182 			(_retcode) = -ENOSPC; \
2183 		} \
2184 	}
2185 #define IRDMA_RING_MOVE_HEAD_BY_COUNT_NOCHECK(_ring, _count) \
2186 	(_ring).head = ((_ring).head + (_count)) % (_ring).size
2187 
2188 #define IRDMA_RING_MOVE_TAIL(_ring) \
2189 	(_ring).tail = ((_ring).tail + 1) % (_ring).size
2190 
2191 #define IRDMA_RING_MOVE_HEAD_NOCHECK(_ring) \
2192 	(_ring).head = ((_ring).head + 1) % (_ring).size
2193 
2194 #define IRDMA_RING_MOVE_TAIL_BY_COUNT(_ring, _count) \
2195 	(_ring).tail = ((_ring).tail + (_count)) % (_ring).size
2196 
2197 #define IRDMA_RING_SET_TAIL(_ring, _pos) \
2198 	(_ring).tail = (_pos) % (_ring).size
2199 
2200 #define IRDMA_RING_FULL_ERR(_ring) \
2201 	( \
2202 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 1))  \
2203 	)
2204 
2205 #define IRDMA_ERR_RING_FULL2(_ring) \
2206 	( \
2207 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 2))  \
2208 	)
2209 
2210 #define IRDMA_ERR_RING_FULL3(_ring) \
2211 	( \
2212 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 3))  \
2213 	)
2214 
2215 #define IRDMA_SQ_RING_FULL_ERR(_ring) \
2216 	( \
2217 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 257))  \
2218 	)
2219 
2220 #define IRDMA_ERR_SQ_RING_FULL2(_ring) \
2221 	( \
2222 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 258))  \
2223 	)
2224 #define IRDMA_ERR_SQ_RING_FULL3(_ring) \
2225 	( \
2226 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 259))  \
2227 	)
2228 #define IRDMA_RING_MORE_WORK(_ring) \
2229 	( \
2230 		(IRDMA_RING_USED_QUANTA(_ring) != 0) \
2231 	)
2232 
2233 #define IRDMA_RING_USED_QUANTA(_ring) \
2234 	( \
2235 		(((_ring).head + (_ring).size - (_ring).tail) % (_ring).size) \
2236 	)
2237 
2238 #define IRDMA_RING_FREE_QUANTA(_ring) \
2239 	( \
2240 		((_ring).size - IRDMA_RING_USED_QUANTA(_ring) - 1) \
2241 	)
2242 
2243 #define IRDMA_SQ_RING_FREE_QUANTA(_ring) \
2244 	( \
2245 		((_ring).size - IRDMA_RING_USED_QUANTA(_ring) - 257) \
2246 	)
2247 
2248 #define IRDMA_ATOMIC_RING_MOVE_HEAD(_ring, index, _retcode) \
2249 	{ \
2250 		index = IRDMA_RING_CURRENT_HEAD(_ring); \
2251 		IRDMA_RING_MOVE_HEAD(_ring, _retcode); \
2252 	}
2253 
2254 enum irdma_qp_wqe_size {
2255 	IRDMA_WQE_SIZE_32  = 32,
2256 	IRDMA_WQE_SIZE_64  = 64,
2257 	IRDMA_WQE_SIZE_96  = 96,
2258 	IRDMA_WQE_SIZE_128 = 128,
2259 	IRDMA_WQE_SIZE_256 = 256,
2260 };
2261 
2262 enum irdma_ws_node_op {
2263 	IRDMA_ADD_NODE = 0,
2264 	IRDMA_MODIFY_NODE,
2265 	IRDMA_DEL_NODE,
2266 };
2267 
2268 enum {	IRDMA_Q_ALIGNMENT_M		 = (128 - 1),
2269 	IRDMA_AEQ_ALIGNMENT_M		 = (256 - 1),
2270 	IRDMA_Q2_ALIGNMENT_M		 = (256 - 1),
2271 	IRDMA_CEQ_ALIGNMENT_M		 = (256 - 1),
2272 	IRDMA_CQ0_ALIGNMENT_M		 = (256 - 1),
2273 	IRDMA_HOST_CTX_ALIGNMENT_M	 = (4 - 1),
2274 	IRDMA_SHADOWAREA_M		 = (128 - 1),
2275 	IRDMA_FPM_QUERY_BUF_ALIGNMENT_M	 = (4 - 1),
2276 	IRDMA_FPM_COMMIT_BUF_ALIGNMENT_M = (4 - 1),
2277 };
2278 
2279 enum irdma_alignment {
2280 	IRDMA_CQP_ALIGNMENT	    = 0x200,
2281 	IRDMA_AEQ_ALIGNMENT	    = 0x100,
2282 	IRDMA_CEQ_ALIGNMENT	    = 0x100,
2283 	IRDMA_CQ0_ALIGNMENT	    = 0x100,
2284 	IRDMA_SD_BUF_ALIGNMENT      = 0x80,
2285 	IRDMA_FEATURE_BUF_ALIGNMENT = 0x10,
2286 };
2287 
2288 enum icrdma_protocol_used {
2289 	ICRDMA_ANY_PROTOCOL	   = 0,
2290 	ICRDMA_IWARP_PROTOCOL_ONLY = 1,
2291 	ICRDMA_ROCE_PROTOCOL_ONLY  = 2,
2292 };
2293 
2294 /**
2295  * set_64bit_val - set 64 bit value to hw wqe
2296  * @wqe_words: wqe addr to write
2297  * @byte_index: index in wqe
2298  * @val: value to write
2299  **/
2300 static inline void set_64bit_val(__le64 *wqe_words, u32 byte_index, u64 val)
2301 {
2302 	wqe_words[byte_index >> 3] = cpu_to_le64(val);
2303 }
2304 
2305 /**
2306  * set_32bit_val - set 32 bit value to hw wqe
2307  * @wqe_words: wqe addr to write
2308  * @byte_index: index in wqe
2309  * @val: value to write
2310  **/
2311 static inline void set_32bit_val(__le32 *wqe_words, u32 byte_index, u32 val)
2312 {
2313 	wqe_words[byte_index >> 2] = cpu_to_le32(val);
2314 }
2315 
2316 /**
2317  * get_64bit_val - read 64 bit value from wqe
2318  * @wqe_words: wqe addr
2319  * @byte_index: index to read from
2320  * @val: read value
2321  **/
2322 static inline void get_64bit_val(__le64 *wqe_words, u32 byte_index, u64 *val)
2323 {
2324 	*val = le64_to_cpu(wqe_words[byte_index >> 3]);
2325 }
2326 
2327 /**
2328  * get_32bit_val - read 32 bit value from wqe
2329  * @wqe_words: wqe addr
2330  * @byte_index: index to reaad from
2331  * @val: return 32 bit value
2332  **/
2333 static inline void get_32bit_val(__le32 *wqe_words, u32 byte_index, u32 *val)
2334 {
2335 	*val = le32_to_cpu(wqe_words[byte_index >> 2]);
2336 }
2337 #endif /* IRDMA_DEFS_H */
2338