xref: /openbmc/linux/drivers/infiniband/hw/irdma/defs.h (revision f2c3037811381f9149243828c7eb9a1631df9f9c)
13f49d684SMustafa Ismail /* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB */
23f49d684SMustafa Ismail /* Copyright (c) 2015 - 2021 Intel Corporation */
33f49d684SMustafa Ismail #ifndef IRDMA_DEFS_H
43f49d684SMustafa Ismail #define IRDMA_DEFS_H
53f49d684SMustafa Ismail 
63f49d684SMustafa Ismail #define IRDMA_FIRST_USER_QP_ID	3
73f49d684SMustafa Ismail 
83f49d684SMustafa Ismail #define ECN_CODE_PT_VAL	2
93f49d684SMustafa Ismail 
103f49d684SMustafa Ismail #define IRDMA_PUSH_OFFSET		(8 * 1024 * 1024)
113f49d684SMustafa Ismail #define IRDMA_PF_FIRST_PUSH_PAGE_INDEX	16
123f49d684SMustafa Ismail #define IRDMA_PF_BAR_RSVD		(60 * 1024)
133f49d684SMustafa Ismail 
143f49d684SMustafa Ismail #define IRDMA_PE_DB_SIZE_4M	1
153f49d684SMustafa Ismail #define IRDMA_PE_DB_SIZE_8M	2
163f49d684SMustafa Ismail 
173f49d684SMustafa Ismail #define IRDMA_IRD_HW_SIZE_4	0
183f49d684SMustafa Ismail #define IRDMA_IRD_HW_SIZE_16	1
193f49d684SMustafa Ismail #define IRDMA_IRD_HW_SIZE_64	2
203f49d684SMustafa Ismail #define IRDMA_IRD_HW_SIZE_128	3
213f49d684SMustafa Ismail #define IRDMA_IRD_HW_SIZE_256	4
223f49d684SMustafa Ismail 
233f49d684SMustafa Ismail enum irdma_protocol_used {
243f49d684SMustafa Ismail 	IRDMA_ANY_PROTOCOL = 0,
253f49d684SMustafa Ismail 	IRDMA_IWARP_PROTOCOL_ONLY = 1,
263f49d684SMustafa Ismail 	IRDMA_ROCE_PROTOCOL_ONLY = 2,
273f49d684SMustafa Ismail };
283f49d684SMustafa Ismail 
293f49d684SMustafa Ismail #define IRDMA_QP_STATE_INVALID		0
303f49d684SMustafa Ismail #define IRDMA_QP_STATE_IDLE		1
313f49d684SMustafa Ismail #define IRDMA_QP_STATE_RTS		2
323f49d684SMustafa Ismail #define IRDMA_QP_STATE_CLOSING		3
333f49d684SMustafa Ismail #define IRDMA_QP_STATE_SQD		3
343f49d684SMustafa Ismail #define IRDMA_QP_STATE_RTR		4
353f49d684SMustafa Ismail #define IRDMA_QP_STATE_TERMINATE	5
363f49d684SMustafa Ismail #define IRDMA_QP_STATE_ERROR		6
373f49d684SMustafa Ismail 
383f49d684SMustafa Ismail #define IRDMA_MAX_TRAFFIC_CLASS		8
395a711e58SKrzysztof Czurylo #define	IRDMA_MAX_STATS_COUNT_GEN_1	12
403f49d684SMustafa Ismail #define IRDMA_MAX_USER_PRIORITY		8
413f49d684SMustafa Ismail #define IRDMA_MAX_APPS			8
423f49d684SMustafa Ismail #define IRDMA_MAX_STATS_COUNT		128
433f49d684SMustafa Ismail #define IRDMA_FIRST_NON_PF_STAT		4
443f49d684SMustafa Ismail 
453f49d684SMustafa Ismail #define IRDMA_MIN_MTU_IPV4	576
463f49d684SMustafa Ismail #define IRDMA_MIN_MTU_IPV6	1280
473f49d684SMustafa Ismail #define IRDMA_MTU_TO_MSS_IPV4	40
483f49d684SMustafa Ismail #define IRDMA_MTU_TO_MSS_IPV6	60
493f49d684SMustafa Ismail #define IRDMA_DEFAULT_MTU	1500
503f49d684SMustafa Ismail 
513f49d684SMustafa Ismail #define Q2_FPSN_OFFSET		64
523f49d684SMustafa Ismail #define TERM_DDP_LEN_TAGGED	14
533f49d684SMustafa Ismail #define TERM_DDP_LEN_UNTAGGED	18
543f49d684SMustafa Ismail #define TERM_RDMA_LEN		28
553f49d684SMustafa Ismail #define RDMA_OPCODE_M		0x0f
563f49d684SMustafa Ismail #define RDMA_READ_REQ_OPCODE	1
573f49d684SMustafa Ismail #define Q2_BAD_FRAME_OFFSET	72
583f49d684SMustafa Ismail #define CQE_MAJOR_DRV		0x8000
593f49d684SMustafa Ismail 
603f49d684SMustafa Ismail #define IRDMA_TERM_SENT		1
613f49d684SMustafa Ismail #define IRDMA_TERM_RCVD		2
623f49d684SMustafa Ismail #define IRDMA_TERM_DONE		4
633f49d684SMustafa Ismail #define IRDMA_MAC_HLEN		14
643f49d684SMustafa Ismail 
653f49d684SMustafa Ismail #define IRDMA_CQP_WAIT_POLL_REGS	1
663f49d684SMustafa Ismail #define IRDMA_CQP_WAIT_POLL_CQ		2
673f49d684SMustafa Ismail #define IRDMA_CQP_WAIT_EVENT		3
683f49d684SMustafa Ismail 
693f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_RSVD		0x0
703f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_RQ		0x1
713f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_RQ_0011		0x3
723f49d684SMustafa Ismail 
733f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_CQ		0x2
743f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_CQ_0110		0x6
753f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_CQ_1010		0xa
763f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_CQ_1110		0xe
773f49d684SMustafa Ismail 
783f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_SQ		0x5
793f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_SQ_0111		0x7
803f49d684SMustafa Ismail 
813f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_IN_RR_WR	0x9
823f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_IN_RR_WR_1011	0xb
833f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_OUT_RR		0xd
843f49d684SMustafa Ismail #define IRDMA_AE_SOURCE_OUT_RR_1111	0xf
853f49d684SMustafa Ismail 
863f49d684SMustafa Ismail #define IRDMA_TCP_STATE_NON_EXISTENT	0
873f49d684SMustafa Ismail #define IRDMA_TCP_STATE_CLOSED		1
883f49d684SMustafa Ismail #define IRDMA_TCP_STATE_LISTEN		2
893f49d684SMustafa Ismail #define IRDMA_STATE_SYN_SEND		3
903f49d684SMustafa Ismail #define IRDMA_TCP_STATE_SYN_RECEIVED	4
913f49d684SMustafa Ismail #define IRDMA_TCP_STATE_ESTABLISHED	5
923f49d684SMustafa Ismail #define IRDMA_TCP_STATE_CLOSE_WAIT	6
933f49d684SMustafa Ismail #define IRDMA_TCP_STATE_FIN_WAIT_1	7
943f49d684SMustafa Ismail #define IRDMA_TCP_STATE_CLOSING		8
953f49d684SMustafa Ismail #define IRDMA_TCP_STATE_LAST_ACK	9
963f49d684SMustafa Ismail #define IRDMA_TCP_STATE_FIN_WAIT_2	10
973f49d684SMustafa Ismail #define IRDMA_TCP_STATE_TIME_WAIT	11
983f49d684SMustafa Ismail #define IRDMA_TCP_STATE_RESERVED_1	12
993f49d684SMustafa Ismail #define IRDMA_TCP_STATE_RESERVED_2	13
1003f49d684SMustafa Ismail #define IRDMA_TCP_STATE_RESERVED_3	14
1013f49d684SMustafa Ismail #define IRDMA_TCP_STATE_RESERVED_4	15
1023f49d684SMustafa Ismail 
1033f49d684SMustafa Ismail #define IRDMA_CQP_SW_SQSIZE_4		4
1043f49d684SMustafa Ismail #define IRDMA_CQP_SW_SQSIZE_2048	2048
1053f49d684SMustafa Ismail 
1063f49d684SMustafa Ismail #define IRDMA_CQ_TYPE_IWARP	1
1073f49d684SMustafa Ismail #define IRDMA_CQ_TYPE_ILQ	2
1083f49d684SMustafa Ismail #define IRDMA_CQ_TYPE_IEQ	3
1093f49d684SMustafa Ismail #define IRDMA_CQ_TYPE_CQP	4
1103f49d684SMustafa Ismail 
1113f49d684SMustafa Ismail #define IRDMA_DONE_COUNT	1000
1123f49d684SMustafa Ismail #define IRDMA_SLEEP_COUNT	10
1133f49d684SMustafa Ismail 
1143f49d684SMustafa Ismail #define IRDMA_UPDATE_SD_BUFF_SIZE	128
1153f49d684SMustafa Ismail #define IRDMA_FEATURE_BUF_SIZE		(8 * IRDMA_MAX_FEATURES)
1163f49d684SMustafa Ismail 
1173f49d684SMustafa Ismail #define IRDMA_MAX_QUANTA_PER_WR	8
1183f49d684SMustafa Ismail 
1193f49d684SMustafa Ismail #define IRDMA_QP_SW_MAX_WQ_QUANTA	32768
1203f49d684SMustafa Ismail #define IRDMA_QP_SW_MAX_SQ_QUANTA	32768
1213f49d684SMustafa Ismail #define IRDMA_QP_SW_MAX_RQ_QUANTA	32768
1223f49d684SMustafa Ismail #define IRDMA_MAX_QP_WRS(max_quanta_per_wr) \
1233f49d684SMustafa Ismail 	((IRDMA_QP_SW_MAX_WQ_QUANTA - IRDMA_SQ_RSVD) / (max_quanta_per_wr))
1243f49d684SMustafa Ismail 
1253f49d684SMustafa Ismail #define IRDMAQP_TERM_SEND_TERM_AND_FIN		0
1263f49d684SMustafa Ismail #define IRDMAQP_TERM_SEND_TERM_ONLY		1
1273f49d684SMustafa Ismail #define IRDMAQP_TERM_SEND_FIN_ONLY		2
1283f49d684SMustafa Ismail #define IRDMAQP_TERM_DONOT_SEND_TERM_OR_FIN	3
1293f49d684SMustafa Ismail 
1303f49d684SMustafa Ismail #define IRDMA_QP_TYPE_IWARP	1
1313f49d684SMustafa Ismail #define IRDMA_QP_TYPE_UDA	2
1323f49d684SMustafa Ismail #define IRDMA_QP_TYPE_ROCE_RC	3
1333f49d684SMustafa Ismail #define IRDMA_QP_TYPE_ROCE_UD	4
1343f49d684SMustafa Ismail 
1353f49d684SMustafa Ismail #define IRDMA_HW_PAGE_SIZE	4096
1363f49d684SMustafa Ismail #define IRDMA_HW_PAGE_SHIFT	12
1373f49d684SMustafa Ismail #define IRDMA_CQE_QTYPE_RQ	0
1383f49d684SMustafa Ismail #define IRDMA_CQE_QTYPE_SQ	1
1393f49d684SMustafa Ismail 
1403f49d684SMustafa Ismail #define IRDMA_QP_SW_MIN_WQSIZE	8u /* in WRs*/
1413f49d684SMustafa Ismail #define IRDMA_QP_WQE_MIN_SIZE	32
1423f49d684SMustafa Ismail #define IRDMA_QP_WQE_MAX_SIZE	256
1433f49d684SMustafa Ismail #define IRDMA_QP_WQE_MIN_QUANTA 1
1443f49d684SMustafa Ismail #define IRDMA_MAX_RQ_WQE_SHIFT_GEN1 2
1453f49d684SMustafa Ismail #define IRDMA_MAX_RQ_WQE_SHIFT_GEN2 3
1463f49d684SMustafa Ismail 
1473f49d684SMustafa Ismail #define IRDMA_SQ_RSVD	258
1483f49d684SMustafa Ismail #define IRDMA_RQ_RSVD	1
1493f49d684SMustafa Ismail 
1503f49d684SMustafa Ismail #define IRDMA_FEATURE_RTS_AE			1ULL
1513f49d684SMustafa Ismail #define IRDMA_FEATURE_CQ_RESIZE			2ULL
1523f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_WRITE			0x00
1533f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_READ			0x01
1543f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_SEND			0x03
1553f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_SEND_INV		0x04
1563f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_SEND_SOL_EVENT		0x05
1573f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_SEND_SOL_EVENT_INV	0x06
1583f49d684SMustafa Ismail #define IRDMAQP_OP_BIND_MW			0x08
1593f49d684SMustafa Ismail #define IRDMAQP_OP_FAST_REGISTER		0x09
1603f49d684SMustafa Ismail #define IRDMAQP_OP_LOCAL_INVALIDATE		0x0a
1613f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_READ_LOC_INV		0x0b
1623f49d684SMustafa Ismail #define IRDMAQP_OP_NOP				0x0c
1633f49d684SMustafa Ismail #define IRDMAQP_OP_RDMA_WRITE_SOL		0x0d
1643f49d684SMustafa Ismail #define IRDMAQP_OP_GEN_RTS_AE			0x30
1653f49d684SMustafa Ismail 
1663f49d684SMustafa Ismail enum irdma_cqp_op_type {
1673f49d684SMustafa Ismail 	IRDMA_OP_CEQ_DESTROY			= 1,
1683f49d684SMustafa Ismail 	IRDMA_OP_AEQ_DESTROY			= 2,
1693f49d684SMustafa Ismail 	IRDMA_OP_DELETE_ARP_CACHE_ENTRY		= 3,
1703f49d684SMustafa Ismail 	IRDMA_OP_MANAGE_APBVT_ENTRY		= 4,
1713f49d684SMustafa Ismail 	IRDMA_OP_CEQ_CREATE			= 5,
1723f49d684SMustafa Ismail 	IRDMA_OP_AEQ_CREATE			= 6,
1733f49d684SMustafa Ismail 	IRDMA_OP_MANAGE_QHASH_TABLE_ENTRY	= 7,
1743f49d684SMustafa Ismail 	IRDMA_OP_QP_MODIFY			= 8,
1753f49d684SMustafa Ismail 	IRDMA_OP_QP_UPLOAD_CONTEXT		= 9,
1763f49d684SMustafa Ismail 	IRDMA_OP_CQ_CREATE			= 10,
1773f49d684SMustafa Ismail 	IRDMA_OP_CQ_DESTROY			= 11,
1783f49d684SMustafa Ismail 	IRDMA_OP_QP_CREATE			= 12,
1793f49d684SMustafa Ismail 	IRDMA_OP_QP_DESTROY			= 13,
1803f49d684SMustafa Ismail 	IRDMA_OP_ALLOC_STAG			= 14,
1813f49d684SMustafa Ismail 	IRDMA_OP_MR_REG_NON_SHARED		= 15,
1823f49d684SMustafa Ismail 	IRDMA_OP_DEALLOC_STAG			= 16,
1833f49d684SMustafa Ismail 	IRDMA_OP_MW_ALLOC			= 17,
1843f49d684SMustafa Ismail 	IRDMA_OP_QP_FLUSH_WQES			= 18,
1853f49d684SMustafa Ismail 	IRDMA_OP_ADD_ARP_CACHE_ENTRY		= 19,
1863f49d684SMustafa Ismail 	IRDMA_OP_MANAGE_PUSH_PAGE		= 20,
1873f49d684SMustafa Ismail 	IRDMA_OP_UPDATE_PE_SDS			= 21,
1883f49d684SMustafa Ismail 	IRDMA_OP_MANAGE_HMC_PM_FUNC_TABLE	= 22,
1893f49d684SMustafa Ismail 	IRDMA_OP_SUSPEND			= 23,
1903f49d684SMustafa Ismail 	IRDMA_OP_RESUME				= 24,
1913f49d684SMustafa Ismail 	IRDMA_OP_MANAGE_VF_PBLE_BP		= 25,
1923f49d684SMustafa Ismail 	IRDMA_OP_QUERY_FPM_VAL			= 26,
1933f49d684SMustafa Ismail 	IRDMA_OP_COMMIT_FPM_VAL			= 27,
194*f2c30378SShiraz Saleem 	IRDMA_OP_AH_CREATE			= 28,
195*f2c30378SShiraz Saleem 	IRDMA_OP_AH_MODIFY			= 29,
196*f2c30378SShiraz Saleem 	IRDMA_OP_AH_DESTROY			= 30,
197*f2c30378SShiraz Saleem 	IRDMA_OP_MC_CREATE			= 31,
198*f2c30378SShiraz Saleem 	IRDMA_OP_MC_DESTROY			= 32,
199*f2c30378SShiraz Saleem 	IRDMA_OP_MC_MODIFY			= 33,
200*f2c30378SShiraz Saleem 	IRDMA_OP_STATS_ALLOCATE			= 34,
201*f2c30378SShiraz Saleem 	IRDMA_OP_STATS_FREE			= 35,
202*f2c30378SShiraz Saleem 	IRDMA_OP_STATS_GATHER			= 36,
203*f2c30378SShiraz Saleem 	IRDMA_OP_WS_ADD_NODE			= 37,
204*f2c30378SShiraz Saleem 	IRDMA_OP_WS_MODIFY_NODE			= 38,
205*f2c30378SShiraz Saleem 	IRDMA_OP_WS_DELETE_NODE			= 39,
206*f2c30378SShiraz Saleem 	IRDMA_OP_WS_FAILOVER_START		= 40,
207*f2c30378SShiraz Saleem 	IRDMA_OP_WS_FAILOVER_COMPLETE		= 41,
208*f2c30378SShiraz Saleem 	IRDMA_OP_SET_UP_MAP			= 42,
209*f2c30378SShiraz Saleem 	IRDMA_OP_GEN_AE				= 43,
210*f2c30378SShiraz Saleem 	IRDMA_OP_QUERY_RDMA_FEATURES		= 44,
211*f2c30378SShiraz Saleem 	IRDMA_OP_ALLOC_LOCAL_MAC_ENTRY		= 45,
212*f2c30378SShiraz Saleem 	IRDMA_OP_ADD_LOCAL_MAC_ENTRY		= 46,
213*f2c30378SShiraz Saleem 	IRDMA_OP_DELETE_LOCAL_MAC_ENTRY		= 47,
214*f2c30378SShiraz Saleem 	IRDMA_OP_CQ_MODIFY			= 48,
2153f49d684SMustafa Ismail 
2163f49d684SMustafa Ismail 	/* Must be last entry*/
217*f2c30378SShiraz Saleem 	IRDMA_MAX_CQP_OPS			= 49,
2183f49d684SMustafa Ismail };
2193f49d684SMustafa Ismail 
2203f49d684SMustafa Ismail /* CQP SQ WQES */
2213f49d684SMustafa Ismail #define IRDMA_CQP_OP_CREATE_QP				0
2223f49d684SMustafa Ismail #define IRDMA_CQP_OP_MODIFY_QP				0x1
2233f49d684SMustafa Ismail #define IRDMA_CQP_OP_DESTROY_QP				0x02
2243f49d684SMustafa Ismail #define IRDMA_CQP_OP_CREATE_CQ				0x03
2253f49d684SMustafa Ismail #define IRDMA_CQP_OP_MODIFY_CQ				0x04
2263f49d684SMustafa Ismail #define IRDMA_CQP_OP_DESTROY_CQ				0x05
2273f49d684SMustafa Ismail #define IRDMA_CQP_OP_ALLOC_STAG				0x09
2283f49d684SMustafa Ismail #define IRDMA_CQP_OP_REG_MR				0x0a
2293f49d684SMustafa Ismail #define IRDMA_CQP_OP_QUERY_STAG				0x0b
2303f49d684SMustafa Ismail #define IRDMA_CQP_OP_REG_SMR				0x0c
2313f49d684SMustafa Ismail #define IRDMA_CQP_OP_DEALLOC_STAG			0x0d
2323f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_LOC_MAC_TABLE		0x0e
2333f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_ARP				0x0f
2343f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_VF_PBLE_BP			0x10
2353f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_PUSH_PAGES			0x11
2363f49d684SMustafa Ismail #define IRDMA_CQP_OP_QUERY_RDMA_FEATURES		0x12
2373f49d684SMustafa Ismail #define IRDMA_CQP_OP_UPLOAD_CONTEXT			0x13
2383f49d684SMustafa Ismail #define IRDMA_CQP_OP_ALLOCATE_LOC_MAC_TABLE_ENTRY	0x14
2393f49d684SMustafa Ismail #define IRDMA_CQP_OP_UPLOAD_CONTEXT			0x13
2403f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_HMC_PM_FUNC_TABLE		0x15
2413f49d684SMustafa Ismail #define IRDMA_CQP_OP_CREATE_CEQ				0x16
2423f49d684SMustafa Ismail #define IRDMA_CQP_OP_DESTROY_CEQ			0x18
2433f49d684SMustafa Ismail #define IRDMA_CQP_OP_CREATE_AEQ				0x19
2443f49d684SMustafa Ismail #define IRDMA_CQP_OP_DESTROY_AEQ			0x1b
2453f49d684SMustafa Ismail #define IRDMA_CQP_OP_CREATE_ADDR_HANDLE			0x1c
2463f49d684SMustafa Ismail #define IRDMA_CQP_OP_MODIFY_ADDR_HANDLE			0x1d
2473f49d684SMustafa Ismail #define IRDMA_CQP_OP_DESTROY_ADDR_HANDLE		0x1e
2483f49d684SMustafa Ismail #define IRDMA_CQP_OP_UPDATE_PE_SDS			0x1f
2493f49d684SMustafa Ismail #define IRDMA_CQP_OP_QUERY_FPM_VAL			0x20
2503f49d684SMustafa Ismail #define IRDMA_CQP_OP_COMMIT_FPM_VAL			0x21
2513f49d684SMustafa Ismail #define IRDMA_CQP_OP_FLUSH_WQES				0x22
2523f49d684SMustafa Ismail /* IRDMA_CQP_OP_GEN_AE is the same value as IRDMA_CQP_OP_FLUSH_WQES */
2533f49d684SMustafa Ismail #define IRDMA_CQP_OP_GEN_AE				0x22
2543f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_APBVT			0x23
2553f49d684SMustafa Ismail #define IRDMA_CQP_OP_NOP				0x24
2563f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_QUAD_HASH_TABLE_ENTRY	0x25
2573f49d684SMustafa Ismail #define IRDMA_CQP_OP_CREATE_MCAST_GRP			0x26
2583f49d684SMustafa Ismail #define IRDMA_CQP_OP_MODIFY_MCAST_GRP			0x27
2593f49d684SMustafa Ismail #define IRDMA_CQP_OP_DESTROY_MCAST_GRP			0x28
2603f49d684SMustafa Ismail #define IRDMA_CQP_OP_SUSPEND_QP				0x29
2613f49d684SMustafa Ismail #define IRDMA_CQP_OP_RESUME_QP				0x2a
2623f49d684SMustafa Ismail #define IRDMA_CQP_OP_SHMC_PAGES_ALLOCATED		0x2b
2633f49d684SMustafa Ismail #define IRDMA_CQP_OP_WORK_SCHED_NODE			0x2c
2643f49d684SMustafa Ismail #define IRDMA_CQP_OP_MANAGE_STATS			0x2d
2653f49d684SMustafa Ismail #define IRDMA_CQP_OP_GATHER_STATS			0x2e
2663f49d684SMustafa Ismail #define IRDMA_CQP_OP_UP_MAP				0x2f
2673f49d684SMustafa Ismail 
2683f49d684SMustafa Ismail /* Async Events codes */
2693f49d684SMustafa Ismail #define IRDMA_AE_AMP_UNALLOCATED_STAG					0x0102
2703f49d684SMustafa Ismail #define IRDMA_AE_AMP_INVALID_STAG					0x0103
2713f49d684SMustafa Ismail #define IRDMA_AE_AMP_BAD_QP						0x0104
2723f49d684SMustafa Ismail #define IRDMA_AE_AMP_BAD_PD						0x0105
2733f49d684SMustafa Ismail #define IRDMA_AE_AMP_BAD_STAG_KEY					0x0106
2743f49d684SMustafa Ismail #define IRDMA_AE_AMP_BAD_STAG_INDEX					0x0107
2753f49d684SMustafa Ismail #define IRDMA_AE_AMP_BOUNDS_VIOLATION					0x0108
2763f49d684SMustafa Ismail #define IRDMA_AE_AMP_RIGHTS_VIOLATION					0x0109
2773f49d684SMustafa Ismail #define IRDMA_AE_AMP_TO_WRAP						0x010a
2783f49d684SMustafa Ismail #define IRDMA_AE_AMP_FASTREG_VALID_STAG					0x010c
2793f49d684SMustafa Ismail #define IRDMA_AE_AMP_FASTREG_MW_STAG					0x010d
2803f49d684SMustafa Ismail #define IRDMA_AE_AMP_FASTREG_INVALID_RIGHTS				0x010e
2813f49d684SMustafa Ismail #define IRDMA_AE_AMP_FASTREG_INVALID_LENGTH				0x0110
2823f49d684SMustafa Ismail #define IRDMA_AE_AMP_INVALIDATE_SHARED					0x0111
2833f49d684SMustafa Ismail #define IRDMA_AE_AMP_INVALIDATE_NO_REMOTE_ACCESS_RIGHTS			0x0112
2843f49d684SMustafa Ismail #define IRDMA_AE_AMP_INVALIDATE_MR_WITH_BOUND_WINDOWS			0x0113
2853f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_VALID_STAG					0x0114
2863f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_OF_MR_STAG					0x0115
2873f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_TO_ZERO_BASED_STAG				0x0116
2883f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_TO_MW_STAG					0x0117
2893f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_INVALID_RIGHTS				0x0118
2903f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS				0x0119
2913f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_TO_INVALID_PARENT				0x011a
2923f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_BIND_DISABLED				0x011b
2933f49d684SMustafa Ismail #define IRDMA_AE_PRIV_OPERATION_DENIED					0x011c
2943f49d684SMustafa Ismail #define IRDMA_AE_AMP_INVALIDATE_TYPE1_MW				0x011d
2953f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_ZERO_BASED_TYPE1_MW				0x011e
2963f49d684SMustafa Ismail #define IRDMA_AE_AMP_FASTREG_INVALID_PBL_HPS_CFG			0x011f
2973f49d684SMustafa Ismail #define IRDMA_AE_AMP_MWBIND_WRONG_TYPE					0x0120
2983f49d684SMustafa Ismail #define IRDMA_AE_AMP_FASTREG_PBLE_MISMATCH				0x0121
2993f49d684SMustafa Ismail #define IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG				0x0132
3003f49d684SMustafa Ismail #define IRDMA_AE_UDA_XMIT_BAD_PD					0x0133
3013f49d684SMustafa Ismail #define IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT				0x0134
3023f49d684SMustafa Ismail #define IRDMA_AE_UDA_L4LEN_INVALID					0x0135
3033f49d684SMustafa Ismail #define IRDMA_AE_BAD_CLOSE						0x0201
3043f49d684SMustafa Ismail #define IRDMA_AE_RDMAP_ROE_BAD_LLP_CLOSE				0x0202
3053f49d684SMustafa Ismail #define IRDMA_AE_CQ_OPERATION_ERROR					0x0203
3063f49d684SMustafa Ismail #define IRDMA_AE_RDMA_READ_WHILE_ORD_ZERO				0x0205
3073f49d684SMustafa Ismail #define IRDMA_AE_STAG_ZERO_INVALID					0x0206
3083f49d684SMustafa Ismail #define IRDMA_AE_IB_RREQ_AND_Q1_FULL					0x0207
3093f49d684SMustafa Ismail #define IRDMA_AE_IB_INVALID_REQUEST					0x0208
3103f49d684SMustafa Ismail #define IRDMA_AE_WQE_UNEXPECTED_OPCODE					0x020a
3113f49d684SMustafa Ismail #define IRDMA_AE_WQE_INVALID_PARAMETER					0x020b
3123f49d684SMustafa Ismail #define IRDMA_AE_WQE_INVALID_FRAG_DATA					0x020c
3133f49d684SMustafa Ismail #define IRDMA_AE_IB_REMOTE_ACCESS_ERROR					0x020d
3143f49d684SMustafa Ismail #define IRDMA_AE_IB_REMOTE_OP_ERROR					0x020e
3153f49d684SMustafa Ismail #define IRDMA_AE_WQE_LSMM_TOO_LONG					0x0220
3167f51a961SSindhu-Devale #define IRDMA_AE_INVALID_REQUEST					0x0223
3173f49d684SMustafa Ismail #define IRDMA_AE_DDP_INVALID_MSN_GAP_IN_MSN				0x0301
3183f49d684SMustafa Ismail #define IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER	0x0303
3193f49d684SMustafa Ismail #define IRDMA_AE_DDP_UBE_INVALID_DDP_VERSION				0x0304
3203f49d684SMustafa Ismail #define IRDMA_AE_DDP_UBE_INVALID_MO					0x0305
3213f49d684SMustafa Ismail #define IRDMA_AE_DDP_UBE_INVALID_MSN_NO_BUFFER_AVAILABLE		0x0306
3223f49d684SMustafa Ismail #define IRDMA_AE_DDP_UBE_INVALID_QN					0x0307
3233f49d684SMustafa Ismail #define IRDMA_AE_DDP_NO_L_BIT						0x0308
3243f49d684SMustafa Ismail #define IRDMA_AE_RDMAP_ROE_INVALID_RDMAP_VERSION			0x0311
3253f49d684SMustafa Ismail #define IRDMA_AE_RDMAP_ROE_UNEXPECTED_OPCODE				0x0312
3263f49d684SMustafa Ismail #define IRDMA_AE_ROE_INVALID_RDMA_READ_REQUEST				0x0313
3273f49d684SMustafa Ismail #define IRDMA_AE_ROE_INVALID_RDMA_WRITE_OR_READ_RESP			0x0314
3283f49d684SMustafa Ismail #define IRDMA_AE_ROCE_RSP_LENGTH_ERROR					0x0316
3293f49d684SMustafa Ismail #define IRDMA_AE_ROCE_EMPTY_MCG						0x0380
3303f49d684SMustafa Ismail #define IRDMA_AE_ROCE_BAD_MC_IP_ADDR					0x0381
3313f49d684SMustafa Ismail #define IRDMA_AE_ROCE_BAD_MC_QPID					0x0382
3323f49d684SMustafa Ismail #define IRDMA_AE_MCG_QP_PROTOCOL_MISMATCH				0x0383
3333f49d684SMustafa Ismail #define IRDMA_AE_INVALID_ARP_ENTRY					0x0401
3343f49d684SMustafa Ismail #define IRDMA_AE_INVALID_TCP_OPTION_RCVD				0x0402
3353f49d684SMustafa Ismail #define IRDMA_AE_STALE_ARP_ENTRY					0x0403
3363f49d684SMustafa Ismail #define IRDMA_AE_INVALID_AH_ENTRY					0x0406
3373f49d684SMustafa Ismail #define IRDMA_AE_LLP_CLOSE_COMPLETE					0x0501
3383f49d684SMustafa Ismail #define IRDMA_AE_LLP_CONNECTION_RESET					0x0502
3393f49d684SMustafa Ismail #define IRDMA_AE_LLP_FIN_RECEIVED					0x0503
3403f49d684SMustafa Ismail #define IRDMA_AE_LLP_RECEIVED_MARKER_AND_LENGTH_FIELDS_DONT_MATCH	0x0504
3413f49d684SMustafa Ismail #define IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR				0x0505
3423f49d684SMustafa Ismail #define IRDMA_AE_LLP_SEGMENT_TOO_SMALL					0x0507
3433f49d684SMustafa Ismail #define IRDMA_AE_LLP_SYN_RECEIVED					0x0508
3443f49d684SMustafa Ismail #define IRDMA_AE_LLP_TERMINATE_RECEIVED					0x0509
3453f49d684SMustafa Ismail #define IRDMA_AE_LLP_TOO_MANY_RETRIES					0x050a
3463f49d684SMustafa Ismail #define IRDMA_AE_LLP_TOO_MANY_KEEPALIVE_RETRIES				0x050b
3473f49d684SMustafa Ismail #define IRDMA_AE_LLP_DOUBT_REACHABILITY					0x050c
3483f49d684SMustafa Ismail #define IRDMA_AE_LLP_CONNECTION_ESTABLISHED				0x050e
3493f49d684SMustafa Ismail #define IRDMA_AE_RESOURCE_EXHAUSTION					0x0520
3503f49d684SMustafa Ismail #define IRDMA_AE_RESET_SENT						0x0601
3513f49d684SMustafa Ismail #define IRDMA_AE_TERMINATE_SENT						0x0602
3523f49d684SMustafa Ismail #define IRDMA_AE_RESET_NOT_SENT						0x0603
3533f49d684SMustafa Ismail #define IRDMA_AE_LCE_QP_CATASTROPHIC					0x0700
3543f49d684SMustafa Ismail #define IRDMA_AE_LCE_FUNCTION_CATASTROPHIC				0x0701
3553f49d684SMustafa Ismail #define IRDMA_AE_LCE_CQ_CATASTROPHIC					0x0702
3563f49d684SMustafa Ismail #define IRDMA_AE_QP_SUSPEND_COMPLETE					0x0900
3573f49d684SMustafa Ismail 
3583f49d684SMustafa Ismail #define FLD_LS_64(dev, val, field)	\
3593f49d684SMustafa Ismail 	(((u64)(val) << (dev)->hw_shifts[field ## _S]) & (dev)->hw_masks[field ## _M])
3603f49d684SMustafa Ismail #define FLD_RS_64(dev, val, field)	\
3613f49d684SMustafa Ismail 	((u64)((val) & (dev)->hw_masks[field ## _M]) >> (dev)->hw_shifts[field ## _S])
3623f49d684SMustafa Ismail #define FLD_LS_32(dev, val, field)	\
3633f49d684SMustafa Ismail 	(((val) << (dev)->hw_shifts[field ## _S]) & (dev)->hw_masks[field ## _M])
3643f49d684SMustafa Ismail #define FLD_RS_32(dev, val, field)	\
3653f49d684SMustafa Ismail 	((u64)((val) & (dev)->hw_masks[field ## _M]) >> (dev)->hw_shifts[field ## _S])
3663f49d684SMustafa Ismail 
3675a711e58SKrzysztof Czurylo #define IRDMA_MAX_STATS_24	0xffffffULL
3685a711e58SKrzysztof Czurylo #define IRDMA_MAX_STATS_32	0xffffffffULL
3695a711e58SKrzysztof Czurylo #define IRDMA_MAX_STATS_48	0xffffffffffffULL
3705a711e58SKrzysztof Czurylo #define IRDMA_MAX_STATS_56	0xffffffffffffffULL
3715a711e58SKrzysztof Czurylo #define IRDMA_MAX_STATS_64	0xffffffffffffffffULL
3723f49d684SMustafa Ismail 
3733f49d684SMustafa Ismail #define IRDMA_MAX_CQ_READ_THRESH 0x3FFFF
3743f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_VLANID GENMASK_ULL(43, 32)
3753f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_QPN GENMASK_ULL(49, 32)
3763f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_QS_HANDLE GENMASK_ULL(9, 0)
3773f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_SRC_PORT GENMASK_ULL(31, 16)
3783f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_DEST_PORT GENMASK_ULL(15, 0)
3793f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_ADDR0 GENMASK_ULL(63, 32)
3803f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_ADDR1 GENMASK_ULL(31, 0)
3813f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_ADDR2 GENMASK_ULL(63, 32)
3823f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_ADDR3 GENMASK_ULL(31, 0)
3833f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_WQEVALID BIT_ULL(63)
3843f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_OPCODE GENMASK_ULL(37, 32)
3853f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_MANAGE GENMASK_ULL(62, 61)
3863f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_IPV4VALID BIT_ULL(60)
3873f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_VLANVALID BIT_ULL(59)
3883f49d684SMustafa Ismail #define IRDMA_CQPSQ_QHASH_ENTRYTYPE GENMASK_ULL(44, 42)
3893f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_WQEVALID BIT_ULL(63)
3903f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_ALLOC_INST BIT_ULL(62)
3913f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_USE_HMC_FCN_INDEX BIT_ULL(60)
3923f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_USE_INST BIT_ULL(61)
3933f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_OP GENMASK_ULL(37, 32)
3943f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_INST_INDEX GENMASK_ULL(6, 0)
3953f49d684SMustafa Ismail #define IRDMA_CQPSQ_STATS_HMC_FCN_INDEX GENMASK_ULL(5, 0)
3963f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_WQEVALID BIT_ULL(63)
3973f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_NODEOP GENMASK_ULL(53, 52)
3983f49d684SMustafa Ismail 
3993f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_ENABLENODE BIT_ULL(62)
4003f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_NODETYPE BIT_ULL(61)
4013f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_PRIOTYPE GENMASK_ULL(60, 59)
4023f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_TC GENMASK_ULL(58, 56)
4033f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_VMVFTYPE GENMASK_ULL(55, 54)
4043f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_VMVFNUM GENMASK_ULL(51, 42)
4053f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_OP GENMASK_ULL(37, 32)
4063f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_PARENTID GENMASK_ULL(25, 16)
4073f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_NODEID GENMASK_ULL(9, 0)
4083f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_VSI GENMASK_ULL(57, 48)
4093f49d684SMustafa Ismail #define IRDMA_CQPSQ_WS_WEIGHT GENMASK_ULL(38, 32)
4103f49d684SMustafa Ismail 
4113f49d684SMustafa Ismail #define IRDMA_CQPSQ_UP_WQEVALID BIT_ULL(63)
4123f49d684SMustafa Ismail #define IRDMA_CQPSQ_UP_USEVLAN BIT_ULL(62)
4133f49d684SMustafa Ismail #define IRDMA_CQPSQ_UP_USEOVERRIDE BIT_ULL(61)
4143f49d684SMustafa Ismail #define IRDMA_CQPSQ_UP_OP GENMASK_ULL(37, 32)
4153f49d684SMustafa Ismail #define IRDMA_CQPSQ_UP_HMCFCNIDX GENMASK_ULL(5, 0)
4163f49d684SMustafa Ismail #define IRDMA_CQPSQ_UP_CNPOVERRIDE GENMASK_ULL(37, 32)
4173f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_WQEVALID BIT_ULL(63)
4183f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_BUF_LEN GENMASK_ULL(31, 0)
4193f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_OP GENMASK_ULL(37, 32)
4203f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MODEL_USED GENMASK_ULL(47, 32)
4213f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MAJOR_VERSION GENMASK_ULL(23, 16)
4223f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERY_RDMA_FEATURES_HW_MINOR_VERSION GENMASK_ULL(7, 0)
4233f49d684SMustafa Ismail #define IRDMA_CQPHC_SQSIZE GENMASK_ULL(11, 8)
4243f49d684SMustafa Ismail #define IRDMA_CQPHC_DISABLE_PFPDUS BIT_ULL(1)
4253f49d684SMustafa Ismail #define IRDMA_CQPHC_ROCEV2_RTO_POLICY BIT_ULL(2)
4263f49d684SMustafa Ismail #define IRDMA_CQPHC_PROTOCOL_USED GENMASK_ULL(4, 3)
4273f49d684SMustafa Ismail #define IRDMA_CQPHC_MIN_RATE GENMASK_ULL(51, 48)
4283f49d684SMustafa Ismail #define IRDMA_CQPHC_MIN_DEC_FACTOR GENMASK_ULL(59, 56)
4293f49d684SMustafa Ismail #define IRDMA_CQPHC_DCQCN_T GENMASK_ULL(15, 0)
4303f49d684SMustafa Ismail #define IRDMA_CQPHC_HAI_FACTOR GENMASK_ULL(47, 32)
4313f49d684SMustafa Ismail #define IRDMA_CQPHC_RAI_FACTOR GENMASK_ULL(63, 48)
4323f49d684SMustafa Ismail #define IRDMA_CQPHC_DCQCN_B GENMASK_ULL(24, 0)
4333f49d684SMustafa Ismail #define IRDMA_CQPHC_DCQCN_F GENMASK_ULL(27, 25)
4343f49d684SMustafa Ismail #define IRDMA_CQPHC_CC_CFG_VALID BIT_ULL(31)
4353f49d684SMustafa Ismail #define IRDMA_CQPHC_RREDUCE_MPERIOD GENMASK_ULL(63, 32)
4363f49d684SMustafa Ismail #define IRDMA_CQPHC_HW_MINVER GENMASK_ULL(15, 0)
4373f49d684SMustafa Ismail 
4383f49d684SMustafa Ismail #define IRDMA_CQPHC_HW_MAJVER_GEN_1 0
4393f49d684SMustafa Ismail #define IRDMA_CQPHC_HW_MAJVER_GEN_2 1
4403f49d684SMustafa Ismail #define IRDMA_CQPHC_HW_MAJVER_GEN_3 2
4413f49d684SMustafa Ismail #define IRDMA_CQPHC_HW_MAJVER GENMASK_ULL(31, 16)
4423f49d684SMustafa Ismail #define IRDMA_CQPHC_CEQPERVF GENMASK_ULL(39, 32)
4433f49d684SMustafa Ismail 
4443f49d684SMustafa Ismail #define IRDMA_CQPHC_ENABLED_VFS GENMASK_ULL(37, 32)
4453f49d684SMustafa Ismail 
4463f49d684SMustafa Ismail #define IRDMA_CQPHC_HMC_PROFILE GENMASK_ULL(2, 0)
4473f49d684SMustafa Ismail #define IRDMA_CQPHC_SVER GENMASK_ULL(31, 24)
4483f49d684SMustafa Ismail #define IRDMA_CQPHC_SQBASE GENMASK_ULL(63, 9)
4493f49d684SMustafa Ismail 
4503f49d684SMustafa Ismail #define IRDMA_CQPHC_QPCTX GENMASK_ULL(63, 0)
4513f49d684SMustafa Ismail #define IRDMA_QP_DBSA_HW_SQ_TAIL GENMASK_ULL(14, 0)
4523f49d684SMustafa Ismail #define IRDMA_CQ_DBSA_CQEIDX GENMASK_ULL(19, 0)
4533f49d684SMustafa Ismail #define IRDMA_CQ_DBSA_SW_CQ_SELECT GENMASK_ULL(13, 0)
4543f49d684SMustafa Ismail #define IRDMA_CQ_DBSA_ARM_NEXT BIT_ULL(14)
4553f49d684SMustafa Ismail #define IRDMA_CQ_DBSA_ARM_NEXT_SE BIT_ULL(15)
4563f49d684SMustafa Ismail #define IRDMA_CQ_DBSA_ARM_SEQ_NUM GENMASK_ULL(17, 16)
4573f49d684SMustafa Ismail 
4583f49d684SMustafa Ismail /* CQP and iWARP Completion Queue */
4593f49d684SMustafa Ismail #define IRDMA_CQ_QPCTX IRDMA_CQPHC_QPCTX
4603f49d684SMustafa Ismail 
4613f49d684SMustafa Ismail #define IRDMA_CCQ_OPRETVAL GENMASK_ULL(31, 0)
4623f49d684SMustafa Ismail 
4633f49d684SMustafa Ismail #define IRDMA_CQ_MINERR GENMASK_ULL(15, 0)
4643f49d684SMustafa Ismail #define IRDMA_CQ_MAJERR GENMASK_ULL(31, 16)
4653f49d684SMustafa Ismail #define IRDMA_CQ_WQEIDX GENMASK_ULL(46, 32)
4663f49d684SMustafa Ismail #define IRDMA_CQ_EXTCQE BIT_ULL(50)
4673f49d684SMustafa Ismail #define IRDMA_OOO_CMPL BIT_ULL(54)
4683f49d684SMustafa Ismail #define IRDMA_CQ_ERROR BIT_ULL(55)
4693f49d684SMustafa Ismail #define IRDMA_CQ_SQ BIT_ULL(62)
4703f49d684SMustafa Ismail 
4713f49d684SMustafa Ismail #define IRDMA_CQ_VALID BIT_ULL(63)
4723f49d684SMustafa Ismail #define IRDMA_CQ_IMMVALID BIT_ULL(62)
4733f49d684SMustafa Ismail #define IRDMA_CQ_UDSMACVALID BIT_ULL(61)
4743f49d684SMustafa Ismail #define IRDMA_CQ_UDVLANVALID BIT_ULL(60)
4753f49d684SMustafa Ismail #define IRDMA_CQ_UDSMAC GENMASK_ULL(47, 0)
4763f49d684SMustafa Ismail #define IRDMA_CQ_UDVLAN GENMASK_ULL(63, 48)
4773f49d684SMustafa Ismail 
4783f49d684SMustafa Ismail #define IRDMA_CQ_IMMDATA_S 0
4793f49d684SMustafa Ismail #define IRDMA_CQ_IMMDATA_M (0xffffffffffffffffULL << IRDMA_CQ_IMMVALID_S)
4803f49d684SMustafa Ismail #define IRDMA_CQ_IMMDATALOW32 GENMASK_ULL(31, 0)
4813f49d684SMustafa Ismail #define IRDMA_CQ_IMMDATAUP32 GENMASK_ULL(63, 32)
4823f49d684SMustafa Ismail #define IRDMACQ_PAYLDLEN GENMASK_ULL(31, 0)
4833f49d684SMustafa Ismail #define IRDMACQ_TCPSEQNUMRTT GENMASK_ULL(63, 32)
4843f49d684SMustafa Ismail #define IRDMACQ_INVSTAG GENMASK_ULL(31, 0)
4853f49d684SMustafa Ismail #define IRDMACQ_QPID GENMASK_ULL(55, 32)
4863f49d684SMustafa Ismail 
4873f49d684SMustafa Ismail #define IRDMACQ_UDSRCQPN GENMASK_ULL(31, 0)
4883f49d684SMustafa Ismail #define IRDMACQ_PSHDROP BIT_ULL(51)
4893f49d684SMustafa Ismail #define IRDMACQ_STAG BIT_ULL(53)
4903f49d684SMustafa Ismail #define IRDMACQ_IPV4 BIT_ULL(53)
4913f49d684SMustafa Ismail #define IRDMACQ_SOEVENT BIT_ULL(54)
4923f49d684SMustafa Ismail #define IRDMACQ_OP GENMASK_ULL(61, 56)
4933f49d684SMustafa Ismail 
4943f49d684SMustafa Ismail #define IRDMA_CEQE_CQCTX GENMASK_ULL(62, 0)
4953f49d684SMustafa Ismail #define IRDMA_CEQE_VALID BIT_ULL(63)
4963f49d684SMustafa Ismail 
4973f49d684SMustafa Ismail /* AEQE format */
4983f49d684SMustafa Ismail #define IRDMA_AEQE_COMPCTX IRDMA_CQPHC_QPCTX
4993f49d684SMustafa Ismail #define IRDMA_AEQE_QPCQID_LOW GENMASK_ULL(17, 0)
5003f49d684SMustafa Ismail #define IRDMA_AEQE_QPCQID_HI BIT_ULL(46)
5013f49d684SMustafa Ismail #define IRDMA_AEQE_WQDESCIDX GENMASK_ULL(32, 18)
5023f49d684SMustafa Ismail #define IRDMA_AEQE_OVERFLOW BIT_ULL(33)
5033f49d684SMustafa Ismail #define IRDMA_AEQE_AECODE GENMASK_ULL(45, 34)
5043f49d684SMustafa Ismail #define IRDMA_AEQE_AESRC GENMASK_ULL(53, 50)
5053f49d684SMustafa Ismail #define IRDMA_AEQE_IWSTATE GENMASK_ULL(56, 54)
5063f49d684SMustafa Ismail #define IRDMA_AEQE_TCPSTATE GENMASK_ULL(60, 57)
5073f49d684SMustafa Ismail #define IRDMA_AEQE_Q2DATA GENMASK_ULL(62, 61)
5083f49d684SMustafa Ismail #define IRDMA_AEQE_VALID BIT_ULL(63)
5093f49d684SMustafa Ismail 
5103f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_NEXT_HDR GENMASK_ULL(23, 16)
5113f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_OPCODE GENMASK_ULL(37, 32)
5123f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_L4LEN GENMASK_ULL(45, 42)
5133f49d684SMustafa Ismail #define IRDMA_GEN1_UDA_QPSQ_L4LEN GENMASK_ULL(27, 24)
5143f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_AHIDX GENMASK_ULL(16, 0)
5153f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_VALID BIT_ULL(63)
5163f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_SIGCOMPL BIT_ULL(62)
5173f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_MACLEN GENMASK_ULL(62, 56)
5183f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_IPLEN GENMASK_ULL(54, 48)
5193f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_L4T GENMASK_ULL(31, 30)
5203f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_IIPT GENMASK_ULL(29, 28)
5213f49d684SMustafa Ismail #define IRDMA_UDA_PAYLOADLEN GENMASK_ULL(13, 0)
5223f49d684SMustafa Ismail #define IRDMA_UDA_HDRLEN GENMASK_ULL(24, 16)
5233f49d684SMustafa Ismail #define IRDMA_VLAN_TAG_VALID BIT_ULL(50)
5243f49d684SMustafa Ismail #define IRDMA_UDA_L3PROTO GENMASK_ULL(1, 0)
5253f49d684SMustafa Ismail #define IRDMA_UDA_L4PROTO GENMASK_ULL(17, 16)
5263f49d684SMustafa Ismail #define IRDMA_UDA_QPSQ_DOLOOPBACK BIT_ULL(44)
5273f49d684SMustafa Ismail #define IRDMA_CQPSQ_BUFSIZE GENMASK_ULL(31, 0)
5283f49d684SMustafa Ismail #define IRDMA_CQPSQ_OPCODE GENMASK_ULL(37, 32)
5293f49d684SMustafa Ismail #define IRDMA_CQPSQ_WQEVALID BIT_ULL(63)
5303f49d684SMustafa Ismail #define IRDMA_CQPSQ_TPHVAL GENMASK_ULL(7, 0)
5313f49d684SMustafa Ismail 
5323f49d684SMustafa Ismail #define IRDMA_CQPSQ_VSIIDX GENMASK_ULL(17, 8)
5333f49d684SMustafa Ismail #define IRDMA_CQPSQ_TPHEN BIT_ULL(60)
5343f49d684SMustafa Ismail 
5353f49d684SMustafa Ismail #define IRDMA_CQPSQ_PBUFADDR IRDMA_CQPHC_QPCTX
5363f49d684SMustafa Ismail 
5373f49d684SMustafa Ismail /* Create/Modify/Destroy QP */
5383f49d684SMustafa Ismail 
5393f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_NEWMSS GENMASK_ULL(45, 32)
5403f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_TERMLEN GENMASK_ULL(51, 48)
5413f49d684SMustafa Ismail 
5423f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_QPCTX IRDMA_CQPHC_QPCTX
5433f49d684SMustafa Ismail 
5443f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_QPID_S 0
5453f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_QPID_M (0xFFFFFFUL)
5463f49d684SMustafa Ismail 
5473f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_OP_S 32
5483f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_OP_M IRDMACQ_OP_M
5493f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_ORDVALID BIT_ULL(42)
5503f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_TOECTXVALID BIT_ULL(43)
5513f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_CACHEDVARVALID BIT_ULL(44)
5523f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_VQ BIT_ULL(45)
5533f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_FORCELOOPBACK BIT_ULL(46)
5543f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_CQNUMVALID BIT_ULL(47)
5553f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_QPTYPE GENMASK_ULL(50, 48)
5563f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_MACVALID BIT_ULL(51)
5573f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_MSSCHANGE BIT_ULL(52)
5583f49d684SMustafa Ismail 
5593f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_IGNOREMWBOUND BIT_ULL(54)
5603f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_REMOVEHASHENTRY BIT_ULL(55)
5613f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_TERMACT GENMASK_ULL(57, 56)
5623f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_RESETCON BIT_ULL(58)
5633f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_ARPTABIDXVALID BIT_ULL(59)
5643f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_NEXTIWSTATE GENMASK_ULL(62, 60)
5653f49d684SMustafa Ismail 
5663f49d684SMustafa Ismail #define IRDMA_CQPSQ_QP_DBSHADOWADDR IRDMA_CQPHC_QPCTX
5673f49d684SMustafa Ismail 
5683f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_CQSIZE GENMASK_ULL(20, 0)
5693f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_CQCTX GENMASK_ULL(62, 0)
5703f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_SHADOW_READ_THRESHOLD GENMASK(17, 0)
5713f49d684SMustafa Ismail 
5723f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_OP GENMASK_ULL(37, 32)
5733f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_CQRESIZE BIT_ULL(43)
5743f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_LPBLSIZE GENMASK_ULL(45, 44)
5753f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_CHKOVERFLOW BIT_ULL(46)
5763f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_VIRTMAP BIT_ULL(47)
5773f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_ENCEQEMASK BIT_ULL(48)
5783f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_CEQIDVALID BIT_ULL(49)
5793f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_AVOIDMEMCNFLCT BIT_ULL(61)
5803f49d684SMustafa Ismail #define IRDMA_CQPSQ_CQ_FIRSTPMPBLIDX GENMASK_ULL(27, 0)
5813f49d684SMustafa Ismail 
5823f49d684SMustafa Ismail /* Allocate/Register/Register Shared/Deallocate Stag */
5833f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_VA_FBO IRDMA_CQPHC_QPCTX
5843f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_STAGLEN GENMASK_ULL(45, 0)
5853f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_KEY GENMASK_ULL(7, 0)
5863f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_IDX GENMASK_ULL(31, 8)
5873f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_IDX_S 8
5883f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_PARENTSTAGIDX GENMASK_ULL(55, 32)
5893f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_MR BIT_ULL(43)
5903f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_MWTYPE BIT_ULL(42)
5913f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_MW1_BIND_DONT_VLDT_KEY BIT_ULL(58)
5923f49d684SMustafa Ismail 
5933f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_LPBLSIZE IRDMA_CQPSQ_CQ_LPBLSIZE
5943f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_HPAGESIZE GENMASK_ULL(47, 46)
5953f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_ARIGHTS GENMASK_ULL(52, 48)
5963f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_REMACCENABLED BIT_ULL(53)
5973f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_VABASEDTO BIT_ULL(59)
5983f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_USEHMCFNIDX BIT_ULL(60)
5993f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_USEPFRID BIT_ULL(61)
6003f49d684SMustafa Ismail 
6013f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_PBA IRDMA_CQPHC_QPCTX
6023f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_HMCFNIDX GENMASK_ULL(5, 0)
6033f49d684SMustafa Ismail 
6043f49d684SMustafa Ismail #define IRDMA_CQPSQ_STAG_FIRSTPMPBLIDX GENMASK_ULL(27, 0)
6053f49d684SMustafa Ismail #define IRDMA_CQPSQ_QUERYSTAG_IDX IRDMA_CQPSQ_STAG_IDX
6063f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_TABLEIDX GENMASK_ULL(5, 0)
6073f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_FREEENTRY BIT_ULL(62)
6083f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_IGNORE_REF_CNT BIT_ULL(61)
6093f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_MAC0 GENMASK_ULL(7, 0)
6103f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_MAC1 GENMASK_ULL(15, 8)
6113f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_MAC2 GENMASK_ULL(23, 16)
6123f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_MAC3 GENMASK_ULL(31, 24)
6133f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_MAC4 GENMASK_ULL(39, 32)
6143f49d684SMustafa Ismail #define IRDMA_CQPSQ_MLM_MAC5 GENMASK_ULL(47, 40)
6153f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAT_REACHMAX GENMASK_ULL(31, 0)
6163f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAT_MACADDR GENMASK_ULL(47, 0)
6173f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAT_ARPENTRYIDX GENMASK_ULL(11, 0)
6183f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAT_ENTRYVALID BIT_ULL(42)
6193f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAT_PERMANENT BIT_ULL(43)
6203f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAT_QUERY BIT_ULL(44)
6213f49d684SMustafa Ismail #define IRDMA_CQPSQ_MVPBP_PD_ENTRY_CNT GENMASK_ULL(9, 0)
6223f49d684SMustafa Ismail #define IRDMA_CQPSQ_MVPBP_FIRST_PD_INX GENMASK_ULL(24, 16)
6233f49d684SMustafa Ismail #define IRDMA_CQPSQ_MVPBP_SD_INX GENMASK_ULL(43, 32)
6243f49d684SMustafa Ismail #define IRDMA_CQPSQ_MVPBP_INV_PD_ENT BIT_ULL(62)
6253f49d684SMustafa Ismail #define IRDMA_CQPSQ_MVPBP_PD_PLPBA GENMASK_ULL(63, 3)
6263f49d684SMustafa Ismail 
6273f49d684SMustafa Ismail /* Manage Push Page - MPP */
6283f49d684SMustafa Ismail #define IRDMA_INVALID_PUSH_PAGE_INDEX_GEN_1 0xffff
6293f49d684SMustafa Ismail #define IRDMA_INVALID_PUSH_PAGE_INDEX 0xffffffff
6303f49d684SMustafa Ismail 
6313f49d684SMustafa Ismail #define IRDMA_CQPSQ_MPP_QS_HANDLE GENMASK_ULL(9, 0)
6323f49d684SMustafa Ismail #define IRDMA_CQPSQ_MPP_PPIDX GENMASK_ULL(9, 0)
6333f49d684SMustafa Ismail #define IRDMA_CQPSQ_MPP_PPTYPE GENMASK_ULL(61, 60)
6343f49d684SMustafa Ismail 
6353f49d684SMustafa Ismail #define IRDMA_CQPSQ_MPP_FREE_PAGE BIT_ULL(62)
6363f49d684SMustafa Ismail 
6373f49d684SMustafa Ismail /* Upload Context - UCTX */
6383f49d684SMustafa Ismail #define IRDMA_CQPSQ_UCTX_QPCTXADDR IRDMA_CQPHC_QPCTX
6393f49d684SMustafa Ismail #define IRDMA_CQPSQ_UCTX_QPID GENMASK_ULL(23, 0)
6403f49d684SMustafa Ismail #define IRDMA_CQPSQ_UCTX_QPTYPE GENMASK_ULL(51, 48)
6413f49d684SMustafa Ismail 
6423f49d684SMustafa Ismail #define IRDMA_CQPSQ_UCTX_RAWFORMAT BIT_ULL(61)
6433f49d684SMustafa Ismail #define IRDMA_CQPSQ_UCTX_FREEZEQP BIT_ULL(62)
6443f49d684SMustafa Ismail 
6453f49d684SMustafa Ismail #define IRDMA_CQPSQ_MHMC_VFIDX GENMASK_ULL(15, 0)
6463f49d684SMustafa Ismail #define IRDMA_CQPSQ_MHMC_FREEPMFN BIT_ULL(62)
6473f49d684SMustafa Ismail 
6483f49d684SMustafa Ismail #define IRDMA_CQPSQ_SHMCRP_HMC_PROFILE GENMASK_ULL(2, 0)
6493f49d684SMustafa Ismail #define IRDMA_CQPSQ_SHMCRP_VFNUM GENMASK_ULL(37, 32)
6503f49d684SMustafa Ismail #define IRDMA_CQPSQ_CEQ_CEQSIZE GENMASK_ULL(21, 0)
6513f49d684SMustafa Ismail #define IRDMA_CQPSQ_CEQ_CEQID GENMASK_ULL(9, 0)
6523f49d684SMustafa Ismail 
6533f49d684SMustafa Ismail #define IRDMA_CQPSQ_CEQ_LPBLSIZE IRDMA_CQPSQ_CQ_LPBLSIZE
6543f49d684SMustafa Ismail #define IRDMA_CQPSQ_CEQ_VMAP BIT_ULL(47)
6553f49d684SMustafa Ismail #define IRDMA_CQPSQ_CEQ_ITRNOEXPIRE BIT_ULL(46)
6563f49d684SMustafa Ismail #define IRDMA_CQPSQ_CEQ_FIRSTPMPBLIDX GENMASK_ULL(27, 0)
6573f49d684SMustafa Ismail #define IRDMA_CQPSQ_AEQ_AEQECNT GENMASK_ULL(18, 0)
6583f49d684SMustafa Ismail #define IRDMA_CQPSQ_AEQ_LPBLSIZE IRDMA_CQPSQ_CQ_LPBLSIZE
6593f49d684SMustafa Ismail #define IRDMA_CQPSQ_AEQ_VMAP BIT_ULL(47)
6603f49d684SMustafa Ismail #define IRDMA_CQPSQ_AEQ_FIRSTPMPBLIDX GENMASK_ULL(27, 0)
6613f49d684SMustafa Ismail 
6623f49d684SMustafa Ismail #define IRDMA_COMMIT_FPM_QPCNT GENMASK_ULL(18, 0)
6633f49d684SMustafa Ismail 
6643f49d684SMustafa Ismail #define IRDMA_COMMIT_FPM_BASE_S 32
6653f49d684SMustafa Ismail #define IRDMA_CQPSQ_CFPM_HMCFNID GENMASK_ULL(5, 0)
6663f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_AECODE GENMASK_ULL(15, 0)
6673f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_AESOURCE GENMASK_ULL(19, 16)
6683f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_RQMNERR GENMASK_ULL(15, 0)
6693f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_RQMJERR GENMASK_ULL(31, 16)
6703f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_SQMNERR GENMASK_ULL(47, 32)
6713f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_SQMJERR GENMASK_ULL(63, 48)
6723f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_QPID GENMASK_ULL(23, 0)
6733f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_GENERATE_AE BIT_ULL(59)
6743f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_USERFLCODE BIT_ULL(60)
6753f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_FLUSHSQ BIT_ULL(61)
6763f49d684SMustafa Ismail #define IRDMA_CQPSQ_FWQE_FLUSHRQ BIT_ULL(62)
6773f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAPT_PORT GENMASK_ULL(15, 0)
6783f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAPT_ADDPORT BIT_ULL(62)
6793f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_SDCMD GENMASK_ULL(31, 0)
6803f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_SDDATALOW GENMASK_ULL(31, 0)
6813f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_SDDATAHI GENMASK_ULL(63, 32)
6823f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_HMCFNID GENMASK_ULL(5, 0)
6833f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_ENTRY_VALID BIT_ULL(63)
6843f49d684SMustafa Ismail 
6853f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_BM_PF 0
6863f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_BM_CP_LM 1
6873f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_BM_AXF 2
6883f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_BM_LM 4
6893f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_BM GENMASK_ULL(34, 32)
6903f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_ENTRY_COUNT GENMASK_ULL(3, 0)
6913f49d684SMustafa Ismail #define IRDMA_CQPSQ_UPESD_SKIP_ENTRY BIT_ULL(7)
6923f49d684SMustafa Ismail #define IRDMA_CQPSQ_SUSPENDQP_QPID GENMASK_ULL(23, 0)
6933f49d684SMustafa Ismail #define IRDMA_CQPSQ_RESUMEQP_QSHANDLE GENMASK_ULL(31, 0)
6943f49d684SMustafa Ismail #define IRDMA_CQPSQ_RESUMEQP_QPID GENMASK(23, 0)
6953f49d684SMustafa Ismail 
6963f49d684SMustafa Ismail #define IRDMA_CQPSQ_MIN_STAG_INVALID 0x0001
6973f49d684SMustafa Ismail #define IRDMA_CQPSQ_MIN_SUSPEND_PND 0x0005
6983f49d684SMustafa Ismail 
6993f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAJ_NO_ERROR 0x0000
7003f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAJ_OBJCACHE_ERROR 0xF000
7013f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAJ_CNTXTCACHE_ERROR 0xF001
7023f49d684SMustafa Ismail #define IRDMA_CQPSQ_MAJ_ERROR 0xFFFF
7033f49d684SMustafa Ismail #define IRDMAQPC_DDP_VER GENMASK_ULL(1, 0)
7043f49d684SMustafa Ismail #define IRDMAQPC_IBRDENABLE BIT_ULL(2)
7053f49d684SMustafa Ismail #define IRDMAQPC_IPV4 BIT_ULL(3)
7063f49d684SMustafa Ismail #define IRDMAQPC_NONAGLE BIT_ULL(4)
7073f49d684SMustafa Ismail #define IRDMAQPC_INSERTVLANTAG BIT_ULL(5)
7083f49d684SMustafa Ismail #define IRDMAQPC_ISQP1 BIT_ULL(6)
7093f49d684SMustafa Ismail #define IRDMAQPC_TIMESTAMP BIT_ULL(7)
7103f49d684SMustafa Ismail #define IRDMAQPC_RQWQESIZE GENMASK_ULL(9, 8)
7113f49d684SMustafa Ismail #define IRDMAQPC_INSERTL2TAG2 BIT_ULL(11)
7123f49d684SMustafa Ismail #define IRDMAQPC_LIMIT GENMASK_ULL(13, 12)
7133f49d684SMustafa Ismail 
7143f49d684SMustafa Ismail #define IRDMAQPC_ECN_EN BIT_ULL(14)
7153f49d684SMustafa Ismail #define IRDMAQPC_DROPOOOSEG BIT_ULL(15)
7163f49d684SMustafa Ismail #define IRDMAQPC_DUPACK_THRESH GENMASK_ULL(18, 16)
7173f49d684SMustafa Ismail #define IRDMAQPC_ERR_RQ_IDX_VALID BIT_ULL(19)
7183f49d684SMustafa Ismail #define IRDMAQPC_DIS_VLAN_CHECKS GENMASK_ULL(21, 19)
7193f49d684SMustafa Ismail #define IRDMAQPC_DC_TCP_EN BIT_ULL(25)
7203f49d684SMustafa Ismail #define IRDMAQPC_RCVTPHEN BIT_ULL(28)
7213f49d684SMustafa Ismail #define IRDMAQPC_XMITTPHEN BIT_ULL(29)
7223f49d684SMustafa Ismail #define IRDMAQPC_RQTPHEN BIT_ULL(30)
7233f49d684SMustafa Ismail #define IRDMAQPC_SQTPHEN BIT_ULL(31)
7243f49d684SMustafa Ismail #define IRDMAQPC_PPIDX GENMASK_ULL(41, 32)
7253f49d684SMustafa Ismail #define IRDMAQPC_PMENA BIT_ULL(47)
7263f49d684SMustafa Ismail #define IRDMAQPC_RDMAP_VER GENMASK_ULL(63, 62)
7273f49d684SMustafa Ismail #define IRDMAQPC_ROCE_TVER GENMASK_ULL(63, 60)
7283f49d684SMustafa Ismail 
7293f49d684SMustafa Ismail #define IRDMAQPC_SQADDR IRDMA_CQPHC_QPCTX
7303f49d684SMustafa Ismail #define IRDMAQPC_RQADDR IRDMA_CQPHC_QPCTX
7313f49d684SMustafa Ismail #define IRDMAQPC_TTL GENMASK_ULL(7, 0)
7323f49d684SMustafa Ismail #define IRDMAQPC_RQSIZE GENMASK_ULL(11, 8)
7333f49d684SMustafa Ismail #define IRDMAQPC_SQSIZE GENMASK_ULL(15, 12)
7343f49d684SMustafa Ismail #define IRDMAQPC_GEN1_SRCMACADDRIDX GENMASK(21, 16)
7353f49d684SMustafa Ismail #define IRDMAQPC_AVOIDSTRETCHACK BIT_ULL(23)
7363f49d684SMustafa Ismail #define IRDMAQPC_TOS GENMASK_ULL(31, 24)
7373f49d684SMustafa Ismail #define IRDMAQPC_SRCPORTNUM GENMASK_ULL(47, 32)
7383f49d684SMustafa Ismail #define IRDMAQPC_DESTPORTNUM GENMASK_ULL(63, 48)
7393f49d684SMustafa Ismail #define IRDMAQPC_DESTIPADDR0 GENMASK_ULL(63, 32)
7403f49d684SMustafa Ismail #define IRDMAQPC_DESTIPADDR1 GENMASK_ULL(31, 0)
7413f49d684SMustafa Ismail #define IRDMAQPC_DESTIPADDR2 GENMASK_ULL(63, 32)
7423f49d684SMustafa Ismail #define IRDMAQPC_DESTIPADDR3 GENMASK_ULL(31, 0)
7433f49d684SMustafa Ismail #define IRDMAQPC_SNDMSS GENMASK_ULL(29, 16)
7443f49d684SMustafa Ismail #define IRDMAQPC_SYN_RST_HANDLING GENMASK_ULL(31, 30)
7453f49d684SMustafa Ismail #define IRDMAQPC_VLANTAG GENMASK_ULL(47, 32)
7463f49d684SMustafa Ismail #define IRDMAQPC_ARPIDX GENMASK_ULL(63, 48)
7473f49d684SMustafa Ismail #define IRDMAQPC_FLOWLABEL GENMASK_ULL(19, 0)
7483f49d684SMustafa Ismail #define IRDMAQPC_WSCALE BIT_ULL(20)
7493f49d684SMustafa Ismail #define IRDMAQPC_KEEPALIVE BIT_ULL(21)
7503f49d684SMustafa Ismail #define IRDMAQPC_IGNORE_TCP_OPT BIT_ULL(22)
7513f49d684SMustafa Ismail #define IRDMAQPC_IGNORE_TCP_UNS_OPT BIT_ULL(23)
7523f49d684SMustafa Ismail #define IRDMAQPC_TCPSTATE GENMASK_ULL(31, 28)
7533f49d684SMustafa Ismail #define IRDMAQPC_RCVSCALE GENMASK_ULL(35, 32)
7543f49d684SMustafa Ismail #define IRDMAQPC_SNDSCALE GENMASK_ULL(43, 40)
7553f49d684SMustafa Ismail #define IRDMAQPC_PDIDX GENMASK_ULL(63, 48)
7563f49d684SMustafa Ismail #define IRDMAQPC_PDIDXHI GENMASK_ULL(21, 20)
7573f49d684SMustafa Ismail #define IRDMAQPC_PKEY GENMASK_ULL(47, 32)
7583f49d684SMustafa Ismail #define IRDMAQPC_ACKCREDITS GENMASK_ULL(24, 20)
7593f49d684SMustafa Ismail #define IRDMAQPC_QKEY GENMASK_ULL(63, 32)
7603f49d684SMustafa Ismail #define IRDMAQPC_DESTQP GENMASK_ULL(23, 0)
7613f49d684SMustafa Ismail #define IRDMAQPC_KALIVE_TIMER_MAX_PROBES GENMASK_ULL(23, 16)
7623f49d684SMustafa Ismail #define IRDMAQPC_KEEPALIVE_INTERVAL GENMASK_ULL(31, 24)
7633f49d684SMustafa Ismail #define IRDMAQPC_TIMESTAMP_RECENT GENMASK_ULL(31, 0)
7643f49d684SMustafa Ismail #define IRDMAQPC_TIMESTAMP_AGE GENMASK_ULL(63, 32)
7653f49d684SMustafa Ismail #define IRDMAQPC_SNDNXT GENMASK_ULL(31, 0)
7663f49d684SMustafa Ismail #define IRDMAQPC_ISN GENMASK_ULL(55, 32)
7673f49d684SMustafa Ismail #define IRDMAQPC_PSNNXT GENMASK_ULL(23, 0)
7683f49d684SMustafa Ismail #define IRDMAQPC_LSN GENMASK_ULL(55, 32)
7693f49d684SMustafa Ismail #define IRDMAQPC_SNDWND GENMASK_ULL(63, 32)
7703f49d684SMustafa Ismail #define IRDMAQPC_RCVNXT GENMASK_ULL(31, 0)
7713f49d684SMustafa Ismail #define IRDMAQPC_EPSN GENMASK_ULL(23, 0)
7723f49d684SMustafa Ismail #define IRDMAQPC_RCVWND GENMASK_ULL(63, 32)
7733f49d684SMustafa Ismail #define IRDMAQPC_SNDMAX GENMASK_ULL(31, 0)
7743f49d684SMustafa Ismail #define IRDMAQPC_SNDUNA GENMASK_ULL(63, 32)
7753f49d684SMustafa Ismail #define IRDMAQPC_PSNMAX GENMASK_ULL(23, 0)
7763f49d684SMustafa Ismail #define IRDMAQPC_PSNUNA GENMASK_ULL(55, 32)
7773f49d684SMustafa Ismail #define IRDMAQPC_SRTT GENMASK_ULL(31, 0)
7783f49d684SMustafa Ismail #define IRDMAQPC_RTTVAR GENMASK_ULL(63, 32)
7793f49d684SMustafa Ismail #define IRDMAQPC_SSTHRESH GENMASK_ULL(31, 0)
7803f49d684SMustafa Ismail #define IRDMAQPC_CWND GENMASK_ULL(63, 32)
7813f49d684SMustafa Ismail #define IRDMAQPC_CWNDROCE GENMASK_ULL(55, 32)
7823f49d684SMustafa Ismail #define IRDMAQPC_SNDWL1 GENMASK_ULL(31, 0)
7833f49d684SMustafa Ismail #define IRDMAQPC_SNDWL2 GENMASK_ULL(63, 32)
7843f49d684SMustafa Ismail #define IRDMAQPC_ERR_RQ_IDX GENMASK_ULL(45, 32)
7853f49d684SMustafa Ismail #define IRDMAQPC_RTOMIN GENMASK_ULL(63, 57)
7863f49d684SMustafa Ismail #define IRDMAQPC_MAXSNDWND GENMASK_ULL(31, 0)
7873f49d684SMustafa Ismail #define IRDMAQPC_REXMIT_THRESH GENMASK_ULL(53, 48)
7883f49d684SMustafa Ismail #define IRDMAQPC_RNRNAK_THRESH GENMASK_ULL(56, 54)
7893f49d684SMustafa Ismail #define IRDMAQPC_TXCQNUM GENMASK_ULL(18, 0)
7903f49d684SMustafa Ismail #define IRDMAQPC_RXCQNUM GENMASK_ULL(50, 32)
7913f49d684SMustafa Ismail #define IRDMAQPC_STAT_INDEX GENMASK_ULL(6, 0)
7923f49d684SMustafa Ismail #define IRDMAQPC_Q2ADDR GENMASK_ULL(63, 8)
7933f49d684SMustafa Ismail #define IRDMAQPC_LASTBYTESENT GENMASK_ULL(7, 0)
7943f49d684SMustafa Ismail #define IRDMAQPC_MACADDRESS GENMASK_ULL(63, 16)
7953f49d684SMustafa Ismail #define IRDMAQPC_ORDSIZE GENMASK_ULL(7, 0)
7963f49d684SMustafa Ismail 
7973f49d684SMustafa Ismail #define IRDMAQPC_IRDSIZE GENMASK_ULL(18, 16)
7983f49d684SMustafa Ismail 
7993f49d684SMustafa Ismail #define IRDMAQPC_UDPRIVCQENABLE BIT_ULL(19)
8003f49d684SMustafa Ismail #define IRDMAQPC_WRRDRSPOK BIT_ULL(20)
8013f49d684SMustafa Ismail #define IRDMAQPC_RDOK BIT_ULL(21)
8023f49d684SMustafa Ismail #define IRDMAQPC_SNDMARKERS BIT_ULL(22)
8033f49d684SMustafa Ismail #define IRDMAQPC_DCQCNENABLE BIT_ULL(22)
8043f49d684SMustafa Ismail #define IRDMAQPC_FW_CC_ENABLE BIT_ULL(28)
8053f49d684SMustafa Ismail #define IRDMAQPC_RCVNOICRC BIT_ULL(31)
8063f49d684SMustafa Ismail #define IRDMAQPC_BINDEN BIT_ULL(23)
8073f49d684SMustafa Ismail #define IRDMAQPC_FASTREGEN BIT_ULL(24)
8083f49d684SMustafa Ismail #define IRDMAQPC_PRIVEN BIT_ULL(25)
8093f49d684SMustafa Ismail #define IRDMAQPC_TIMELYENABLE BIT_ULL(27)
8103f49d684SMustafa Ismail #define IRDMAQPC_THIGH GENMASK_ULL(63, 52)
8113f49d684SMustafa Ismail #define IRDMAQPC_TLOW GENMASK_ULL(39, 32)
8123f49d684SMustafa Ismail #define IRDMAQPC_REMENDPOINTIDX GENMASK_ULL(16, 0)
8133f49d684SMustafa Ismail #define IRDMAQPC_USESTATSINSTANCE BIT_ULL(26)
8143f49d684SMustafa Ismail #define IRDMAQPC_IWARPMODE BIT_ULL(28)
8153f49d684SMustafa Ismail #define IRDMAQPC_RCVMARKERS BIT_ULL(29)
8163f49d684SMustafa Ismail #define IRDMAQPC_ALIGNHDRS BIT_ULL(30)
8173f49d684SMustafa Ismail #define IRDMAQPC_RCVNOMPACRC BIT_ULL(31)
8183f49d684SMustafa Ismail #define IRDMAQPC_RCVMARKOFFSET GENMASK_ULL(40, 32)
8193f49d684SMustafa Ismail #define IRDMAQPC_SNDMARKOFFSET GENMASK_ULL(56, 48)
8203f49d684SMustafa Ismail 
8213f49d684SMustafa Ismail #define IRDMAQPC_QPCOMPCTX IRDMA_CQPHC_QPCTX
8223f49d684SMustafa Ismail #define IRDMAQPC_SQTPHVAL GENMASK_ULL(7, 0)
8233f49d684SMustafa Ismail #define IRDMAQPC_RQTPHVAL GENMASK_ULL(15, 8)
8243f49d684SMustafa Ismail #define IRDMAQPC_QSHANDLE GENMASK_ULL(25, 16)
8253f49d684SMustafa Ismail #define IRDMAQPC_EXCEPTION_LAN_QUEUE GENMASK_ULL(43, 32)
8263f49d684SMustafa Ismail #define IRDMAQPC_LOCAL_IPADDR3 GENMASK_ULL(31, 0)
8273f49d684SMustafa Ismail #define IRDMAQPC_LOCAL_IPADDR2 GENMASK_ULL(63, 32)
8283f49d684SMustafa Ismail #define IRDMAQPC_LOCAL_IPADDR1 GENMASK_ULL(31, 0)
8293f49d684SMustafa Ismail #define IRDMAQPC_LOCAL_IPADDR0 GENMASK_ULL(63, 32)
8303f49d684SMustafa Ismail #define IRDMA_FW_VER_MINOR GENMASK_ULL(15, 0)
8313f49d684SMustafa Ismail #define IRDMA_FW_VER_MAJOR GENMASK_ULL(31, 16)
8323f49d684SMustafa Ismail #define IRDMA_FEATURE_INFO GENMASK_ULL(47, 0)
8333f49d684SMustafa Ismail #define IRDMA_FEATURE_CNT GENMASK_ULL(47, 32)
8343f49d684SMustafa Ismail #define IRDMA_FEATURE_TYPE GENMASK_ULL(63, 48)
8353f49d684SMustafa Ismail 
8363f49d684SMustafa Ismail #define IRDMAQPSQ_OPCODE GENMASK_ULL(37, 32)
8373f49d684SMustafa Ismail #define IRDMAQPSQ_COPY_HOST_PBL BIT_ULL(43)
8383f49d684SMustafa Ismail #define IRDMAQPSQ_ADDFRAGCNT GENMASK_ULL(41, 38)
8393f49d684SMustafa Ismail #define IRDMAQPSQ_PUSHWQE BIT_ULL(56)
8403f49d684SMustafa Ismail #define IRDMAQPSQ_STREAMMODE BIT_ULL(58)
8413f49d684SMustafa Ismail #define IRDMAQPSQ_WAITFORRCVPDU BIT_ULL(59)
8423f49d684SMustafa Ismail #define IRDMAQPSQ_READFENCE BIT_ULL(60)
8433f49d684SMustafa Ismail #define IRDMAQPSQ_LOCALFENCE BIT_ULL(61)
8443f49d684SMustafa Ismail #define IRDMAQPSQ_UDPHEADER BIT_ULL(61)
8453f49d684SMustafa Ismail #define IRDMAQPSQ_L4LEN GENMASK_ULL(45, 42)
8463f49d684SMustafa Ismail #define IRDMAQPSQ_SIGCOMPL BIT_ULL(62)
8473f49d684SMustafa Ismail #define IRDMAQPSQ_VALID BIT_ULL(63)
8483f49d684SMustafa Ismail 
8493f49d684SMustafa Ismail #define IRDMAQPSQ_FRAG_TO IRDMA_CQPHC_QPCTX
8503f49d684SMustafa Ismail #define IRDMAQPSQ_FRAG_VALID BIT_ULL(63)
8513f49d684SMustafa Ismail #define IRDMAQPSQ_FRAG_LEN GENMASK_ULL(62, 32)
8523f49d684SMustafa Ismail #define IRDMAQPSQ_FRAG_STAG GENMASK_ULL(31, 0)
8533f49d684SMustafa Ismail #define IRDMAQPSQ_GEN1_FRAG_LEN GENMASK_ULL(31, 0)
8543f49d684SMustafa Ismail #define IRDMAQPSQ_GEN1_FRAG_STAG GENMASK_ULL(63, 32)
8553f49d684SMustafa Ismail #define IRDMAQPSQ_REMSTAGINV GENMASK_ULL(31, 0)
8563f49d684SMustafa Ismail #define IRDMAQPSQ_DESTQKEY GENMASK_ULL(31, 0)
8573f49d684SMustafa Ismail #define IRDMAQPSQ_DESTQPN GENMASK_ULL(55, 32)
8583f49d684SMustafa Ismail #define IRDMAQPSQ_AHID GENMASK_ULL(16, 0)
8593f49d684SMustafa Ismail #define IRDMAQPSQ_INLINEDATAFLAG BIT_ULL(57)
8603f49d684SMustafa Ismail 
8613f49d684SMustafa Ismail #define IRDMA_INLINE_VALID_S 7
8623f49d684SMustafa Ismail #define IRDMAQPSQ_INLINEDATALEN GENMASK_ULL(55, 48)
8633f49d684SMustafa Ismail #define IRDMAQPSQ_IMMDATAFLAG BIT_ULL(47)
8643f49d684SMustafa Ismail #define IRDMAQPSQ_REPORTRTT BIT_ULL(46)
8653f49d684SMustafa Ismail 
8663f49d684SMustafa Ismail #define IRDMAQPSQ_IMMDATA GENMASK_ULL(63, 0)
8673f49d684SMustafa Ismail #define IRDMAQPSQ_REMSTAG GENMASK_ULL(31, 0)
8683f49d684SMustafa Ismail 
8693f49d684SMustafa Ismail #define IRDMAQPSQ_REMTO IRDMA_CQPHC_QPCTX
8703f49d684SMustafa Ismail 
8713f49d684SMustafa Ismail #define IRDMAQPSQ_STAGRIGHTS GENMASK_ULL(52, 48)
8723f49d684SMustafa Ismail #define IRDMAQPSQ_VABASEDTO BIT_ULL(53)
8733f49d684SMustafa Ismail #define IRDMAQPSQ_MEMWINDOWTYPE BIT_ULL(54)
8743f49d684SMustafa Ismail 
8753f49d684SMustafa Ismail #define IRDMAQPSQ_MWLEN IRDMA_CQPHC_QPCTX
8763f49d684SMustafa Ismail #define IRDMAQPSQ_PARENTMRSTAG GENMASK_ULL(63, 32)
8773f49d684SMustafa Ismail #define IRDMAQPSQ_MWSTAG GENMASK_ULL(31, 0)
8783f49d684SMustafa Ismail 
8793f49d684SMustafa Ismail #define IRDMAQPSQ_BASEVA_TO_FBO IRDMA_CQPHC_QPCTX
8803f49d684SMustafa Ismail 
8813f49d684SMustafa Ismail #define IRDMAQPSQ_LOCSTAG GENMASK_ULL(31, 0)
8823f49d684SMustafa Ismail 
8833f49d684SMustafa Ismail #define IRDMAQPSQ_STAGKEY GENMASK_ULL(7, 0)
8843f49d684SMustafa Ismail #define IRDMAQPSQ_STAGINDEX GENMASK_ULL(31, 8)
8853f49d684SMustafa Ismail #define IRDMAQPSQ_COPYHOSTPBLS BIT_ULL(43)
8863f49d684SMustafa Ismail #define IRDMAQPSQ_LPBLSIZE GENMASK_ULL(45, 44)
8873f49d684SMustafa Ismail #define IRDMAQPSQ_HPAGESIZE GENMASK_ULL(47, 46)
8883f49d684SMustafa Ismail #define IRDMAQPSQ_STAGLEN GENMASK_ULL(40, 0)
8893f49d684SMustafa Ismail #define IRDMAQPSQ_FIRSTPMPBLIDXLO GENMASK_ULL(63, 48)
8903f49d684SMustafa Ismail #define IRDMAQPSQ_FIRSTPMPBLIDXHI GENMASK_ULL(11, 0)
8913f49d684SMustafa Ismail #define IRDMAQPSQ_PBLADDR GENMASK_ULL(63, 12)
8923f49d684SMustafa Ismail 
8933f49d684SMustafa Ismail /* iwarp QP RQ WQE common fields */
8943f49d684SMustafa Ismail #define IRDMAQPRQ_ADDFRAGCNT IRDMAQPSQ_ADDFRAGCNT
8953f49d684SMustafa Ismail #define IRDMAQPRQ_VALID IRDMAQPSQ_VALID
8963f49d684SMustafa Ismail #define IRDMAQPRQ_COMPLCTX IRDMA_CQPHC_QPCTX
8973f49d684SMustafa Ismail #define IRDMAQPRQ_FRAG_LEN IRDMAQPSQ_FRAG_LEN
8983f49d684SMustafa Ismail #define IRDMAQPRQ_STAG IRDMAQPSQ_FRAG_STAG
8993f49d684SMustafa Ismail #define IRDMAQPRQ_TO IRDMAQPSQ_FRAG_TO
9003f49d684SMustafa Ismail 
9013f49d684SMustafa Ismail #define IRDMAPFINT_OICR_HMC_ERR_M BIT(26)
9023f49d684SMustafa Ismail #define IRDMAPFINT_OICR_PE_PUSH_M BIT(27)
9033f49d684SMustafa Ismail #define IRDMAPFINT_OICR_PE_CRITERR_M BIT(28)
9043f49d684SMustafa Ismail 
9053f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_MAX_QPS GENMASK_ULL(18, 0)
9063f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_MAX_CQS GENMASK_ULL(19, 0)
9073f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_FIRST_PE_SD_INDEX GENMASK_ULL(13, 0)
9083f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_MAX_PE_SDS GENMASK_ULL(45, 32)
9093f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_MAX_CEQS GENMASK_ULL(9, 0)
9103f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_XFBLOCKSIZE GENMASK_ULL(63, 32)
9113f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_Q1BLOCKSIZE GENMASK_ULL(63, 32)
9123f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_HTMULTIPLIER GENMASK_ULL(19, 16)
9133f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_TIMERBUCKET GENMASK_ULL(47, 32)
9143f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_RRFBLOCKSIZE GENMASK_ULL(63, 32)
9153f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_RRFFLBLOCKSIZE GENMASK_ULL(63, 32)
9163f49d684SMustafa Ismail #define IRDMA_QUERY_FPM_OOISCFBLOCKSIZE GENMASK_ULL(63, 32)
9173f49d684SMustafa Ismail #define IRDMA_SHMC_PAGE_ALLOCATED_HMC_FN_ID GENMASK_ULL(5, 0)
9183f49d684SMustafa Ismail 
9193f49d684SMustafa Ismail #define IRDMA_GET_CURRENT_AEQ_ELEM(_aeq) \
9203f49d684SMustafa Ismail 	( \
9213f49d684SMustafa Ismail 		(_aeq)->aeqe_base[IRDMA_RING_CURRENT_TAIL((_aeq)->aeq_ring)].buf \
9223f49d684SMustafa Ismail 	)
9233f49d684SMustafa Ismail 
9243f49d684SMustafa Ismail #define IRDMA_GET_CURRENT_CEQ_ELEM(_ceq) \
9253f49d684SMustafa Ismail 	( \
9263f49d684SMustafa Ismail 		(_ceq)->ceqe_base[IRDMA_RING_CURRENT_TAIL((_ceq)->ceq_ring)].buf \
9273f49d684SMustafa Ismail 	)
9283f49d684SMustafa Ismail 
9293f49d684SMustafa Ismail #define IRDMA_GET_CEQ_ELEM_AT_POS(_ceq, _pos) \
9303f49d684SMustafa Ismail 	( \
9313f49d684SMustafa Ismail 		(_ceq)->ceqe_base[_pos].buf  \
9323f49d684SMustafa Ismail 	)
9333f49d684SMustafa Ismail 
9343f49d684SMustafa Ismail #define IRDMA_RING_GET_NEXT_TAIL(_ring, _idx) \
9353f49d684SMustafa Ismail 	( \
9363f49d684SMustafa Ismail 		((_ring).tail + (_idx)) % (_ring).size \
9373f49d684SMustafa Ismail 	)
9383f49d684SMustafa Ismail 
9393f49d684SMustafa Ismail #define IRDMA_CQP_INIT_WQE(wqe) memset(wqe, 0, 64)
9403f49d684SMustafa Ismail 
9413f49d684SMustafa Ismail #define IRDMA_GET_CURRENT_CQ_ELEM(_cq) \
9423f49d684SMustafa Ismail 	( \
9433f49d684SMustafa Ismail 		(_cq)->cq_base[IRDMA_RING_CURRENT_HEAD((_cq)->cq_ring)].buf  \
9443f49d684SMustafa Ismail 	)
9453f49d684SMustafa Ismail #define IRDMA_GET_CURRENT_EXTENDED_CQ_ELEM(_cq) \
9463f49d684SMustafa Ismail 	( \
9473f49d684SMustafa Ismail 		((struct irdma_extended_cqe *) \
9483f49d684SMustafa Ismail 		((_cq)->cq_base))[IRDMA_RING_CURRENT_HEAD((_cq)->cq_ring)].buf \
9493f49d684SMustafa Ismail 	)
9503f49d684SMustafa Ismail 
9513f49d684SMustafa Ismail #define IRDMA_RING_INIT(_ring, _size) \
9523f49d684SMustafa Ismail 	{ \
9533f49d684SMustafa Ismail 		(_ring).head = 0; \
9543f49d684SMustafa Ismail 		(_ring).tail = 0; \
9553f49d684SMustafa Ismail 		(_ring).size = (_size); \
9563f49d684SMustafa Ismail 	}
9573f49d684SMustafa Ismail #define IRDMA_RING_SIZE(_ring) ((_ring).size)
9583f49d684SMustafa Ismail #define IRDMA_RING_CURRENT_HEAD(_ring) ((_ring).head)
9593f49d684SMustafa Ismail #define IRDMA_RING_CURRENT_TAIL(_ring) ((_ring).tail)
9603f49d684SMustafa Ismail 
9613f49d684SMustafa Ismail #define IRDMA_RING_MOVE_HEAD(_ring, _retcode) \
9623f49d684SMustafa Ismail 	{ \
9633f49d684SMustafa Ismail 		register u32 size; \
9643f49d684SMustafa Ismail 		size = (_ring).size;  \
9653f49d684SMustafa Ismail 		if (!IRDMA_RING_FULL_ERR(_ring)) { \
9663f49d684SMustafa Ismail 			(_ring).head = ((_ring).head + 1) % size; \
9673f49d684SMustafa Ismail 			(_retcode) = 0; \
9683f49d684SMustafa Ismail 		} else { \
9692c4b14eaSShiraz Saleem 			(_retcode) = -ENOMEM; \
9703f49d684SMustafa Ismail 		} \
9713f49d684SMustafa Ismail 	}
9723f49d684SMustafa Ismail #define IRDMA_RING_MOVE_HEAD_BY_COUNT(_ring, _count, _retcode) \
9733f49d684SMustafa Ismail 	{ \
9743f49d684SMustafa Ismail 		register u32 size; \
9753f49d684SMustafa Ismail 		size = (_ring).size; \
9763f49d684SMustafa Ismail 		if ((IRDMA_RING_USED_QUANTA(_ring) + (_count)) < size) { \
9773f49d684SMustafa Ismail 			(_ring).head = ((_ring).head + (_count)) % size; \
9783f49d684SMustafa Ismail 			(_retcode) = 0; \
9793f49d684SMustafa Ismail 		} else { \
9802c4b14eaSShiraz Saleem 			(_retcode) = -ENOMEM; \
9813f49d684SMustafa Ismail 		} \
9823f49d684SMustafa Ismail 	}
9833f49d684SMustafa Ismail #define IRDMA_SQ_RING_MOVE_HEAD(_ring, _retcode) \
9843f49d684SMustafa Ismail 	{ \
9853f49d684SMustafa Ismail 		register u32 size; \
9863f49d684SMustafa Ismail 		size = (_ring).size;  \
9873f49d684SMustafa Ismail 		if (!IRDMA_SQ_RING_FULL_ERR(_ring)) { \
9883f49d684SMustafa Ismail 			(_ring).head = ((_ring).head + 1) % size; \
9893f49d684SMustafa Ismail 			(_retcode) = 0; \
9903f49d684SMustafa Ismail 		} else { \
9912c4b14eaSShiraz Saleem 			(_retcode) = -ENOMEM; \
9923f49d684SMustafa Ismail 		} \
9933f49d684SMustafa Ismail 	}
9943f49d684SMustafa Ismail #define IRDMA_SQ_RING_MOVE_HEAD_BY_COUNT(_ring, _count, _retcode) \
9953f49d684SMustafa Ismail 	{ \
9963f49d684SMustafa Ismail 		register u32 size; \
9973f49d684SMustafa Ismail 		size = (_ring).size; \
9983f49d684SMustafa Ismail 		if ((IRDMA_RING_USED_QUANTA(_ring) + (_count)) < (size - 256)) { \
9993f49d684SMustafa Ismail 			(_ring).head = ((_ring).head + (_count)) % size; \
10003f49d684SMustafa Ismail 			(_retcode) = 0; \
10013f49d684SMustafa Ismail 		} else { \
10022c4b14eaSShiraz Saleem 			(_retcode) = -ENOMEM; \
10033f49d684SMustafa Ismail 		} \
10043f49d684SMustafa Ismail 	}
10053f49d684SMustafa Ismail #define IRDMA_RING_MOVE_HEAD_BY_COUNT_NOCHECK(_ring, _count) \
10063f49d684SMustafa Ismail 	(_ring).head = ((_ring).head + (_count)) % (_ring).size
10073f49d684SMustafa Ismail 
10083f49d684SMustafa Ismail #define IRDMA_RING_MOVE_TAIL(_ring) \
10093f49d684SMustafa Ismail 	(_ring).tail = ((_ring).tail + 1) % (_ring).size
10103f49d684SMustafa Ismail 
10113f49d684SMustafa Ismail #define IRDMA_RING_MOVE_HEAD_NOCHECK(_ring) \
10123f49d684SMustafa Ismail 	(_ring).head = ((_ring).head + 1) % (_ring).size
10133f49d684SMustafa Ismail 
10143f49d684SMustafa Ismail #define IRDMA_RING_MOVE_TAIL_BY_COUNT(_ring, _count) \
10153f49d684SMustafa Ismail 	(_ring).tail = ((_ring).tail + (_count)) % (_ring).size
10163f49d684SMustafa Ismail 
10173f49d684SMustafa Ismail #define IRDMA_RING_SET_TAIL(_ring, _pos) \
10183f49d684SMustafa Ismail 	(_ring).tail = (_pos) % (_ring).size
10193f49d684SMustafa Ismail 
10203f49d684SMustafa Ismail #define IRDMA_RING_FULL_ERR(_ring) \
10213f49d684SMustafa Ismail 	( \
10223f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 1))  \
10233f49d684SMustafa Ismail 	)
10243f49d684SMustafa Ismail 
10253f49d684SMustafa Ismail #define IRDMA_ERR_RING_FULL2(_ring) \
10263f49d684SMustafa Ismail 	( \
10273f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 2))  \
10283f49d684SMustafa Ismail 	)
10293f49d684SMustafa Ismail 
10303f49d684SMustafa Ismail #define IRDMA_ERR_RING_FULL3(_ring) \
10313f49d684SMustafa Ismail 	( \
10323f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 3))  \
10333f49d684SMustafa Ismail 	)
10343f49d684SMustafa Ismail 
10353f49d684SMustafa Ismail #define IRDMA_SQ_RING_FULL_ERR(_ring) \
10363f49d684SMustafa Ismail 	( \
10373f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 257))  \
10383f49d684SMustafa Ismail 	)
10393f49d684SMustafa Ismail 
10403f49d684SMustafa Ismail #define IRDMA_ERR_SQ_RING_FULL2(_ring) \
10413f49d684SMustafa Ismail 	( \
10423f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 258))  \
10433f49d684SMustafa Ismail 	)
10443f49d684SMustafa Ismail #define IRDMA_ERR_SQ_RING_FULL3(_ring) \
10453f49d684SMustafa Ismail 	( \
10463f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) == ((_ring).size - 259))  \
10473f49d684SMustafa Ismail 	)
10483f49d684SMustafa Ismail #define IRDMA_RING_MORE_WORK(_ring) \
10493f49d684SMustafa Ismail 	( \
10503f49d684SMustafa Ismail 		(IRDMA_RING_USED_QUANTA(_ring) != 0) \
10513f49d684SMustafa Ismail 	)
10523f49d684SMustafa Ismail 
10533f49d684SMustafa Ismail #define IRDMA_RING_USED_QUANTA(_ring) \
10543f49d684SMustafa Ismail 	( \
10553f49d684SMustafa Ismail 		(((_ring).head + (_ring).size - (_ring).tail) % (_ring).size) \
10563f49d684SMustafa Ismail 	)
10573f49d684SMustafa Ismail 
10583f49d684SMustafa Ismail #define IRDMA_RING_FREE_QUANTA(_ring) \
10593f49d684SMustafa Ismail 	( \
10603f49d684SMustafa Ismail 		((_ring).size - IRDMA_RING_USED_QUANTA(_ring) - 1) \
10613f49d684SMustafa Ismail 	)
10623f49d684SMustafa Ismail 
10633f49d684SMustafa Ismail #define IRDMA_SQ_RING_FREE_QUANTA(_ring) \
10643f49d684SMustafa Ismail 	( \
10653f49d684SMustafa Ismail 		((_ring).size - IRDMA_RING_USED_QUANTA(_ring) - 257) \
10663f49d684SMustafa Ismail 	)
10673f49d684SMustafa Ismail 
10683f49d684SMustafa Ismail #define IRDMA_ATOMIC_RING_MOVE_HEAD(_ring, index, _retcode) \
10693f49d684SMustafa Ismail 	{ \
10703f49d684SMustafa Ismail 		index = IRDMA_RING_CURRENT_HEAD(_ring); \
10713f49d684SMustafa Ismail 		IRDMA_RING_MOVE_HEAD(_ring, _retcode); \
10723f49d684SMustafa Ismail 	}
10733f49d684SMustafa Ismail 
10743f49d684SMustafa Ismail enum irdma_qp_wqe_size {
10753f49d684SMustafa Ismail 	IRDMA_WQE_SIZE_32  = 32,
10763f49d684SMustafa Ismail 	IRDMA_WQE_SIZE_64  = 64,
10773f49d684SMustafa Ismail 	IRDMA_WQE_SIZE_96  = 96,
10783f49d684SMustafa Ismail 	IRDMA_WQE_SIZE_128 = 128,
10793f49d684SMustafa Ismail 	IRDMA_WQE_SIZE_256 = 256,
10803f49d684SMustafa Ismail };
10813f49d684SMustafa Ismail 
10823f49d684SMustafa Ismail enum irdma_ws_node_op {
10833f49d684SMustafa Ismail 	IRDMA_ADD_NODE = 0,
10843f49d684SMustafa Ismail 	IRDMA_MODIFY_NODE,
10853f49d684SMustafa Ismail 	IRDMA_DEL_NODE,
10863f49d684SMustafa Ismail };
10873f49d684SMustafa Ismail 
10883f49d684SMustafa Ismail enum {	IRDMA_Q_ALIGNMENT_M		 = (128 - 1),
10893f49d684SMustafa Ismail 	IRDMA_AEQ_ALIGNMENT_M		 = (256 - 1),
10903f49d684SMustafa Ismail 	IRDMA_Q2_ALIGNMENT_M		 = (256 - 1),
10913f49d684SMustafa Ismail 	IRDMA_CEQ_ALIGNMENT_M		 = (256 - 1),
10923f49d684SMustafa Ismail 	IRDMA_CQ0_ALIGNMENT_M		 = (256 - 1),
10933f49d684SMustafa Ismail 	IRDMA_HOST_CTX_ALIGNMENT_M	 = (4 - 1),
10943f49d684SMustafa Ismail 	IRDMA_SHADOWAREA_M		 = (128 - 1),
10953f49d684SMustafa Ismail 	IRDMA_FPM_QUERY_BUF_ALIGNMENT_M	 = (4 - 1),
10963f49d684SMustafa Ismail 	IRDMA_FPM_COMMIT_BUF_ALIGNMENT_M = (4 - 1),
10973f49d684SMustafa Ismail };
10983f49d684SMustafa Ismail 
10993f49d684SMustafa Ismail enum irdma_alignment {
11003f49d684SMustafa Ismail 	IRDMA_CQP_ALIGNMENT	    = 0x200,
11013f49d684SMustafa Ismail 	IRDMA_AEQ_ALIGNMENT	    = 0x100,
11023f49d684SMustafa Ismail 	IRDMA_CEQ_ALIGNMENT	    = 0x100,
11033f49d684SMustafa Ismail 	IRDMA_CQ0_ALIGNMENT	    = 0x100,
11043f49d684SMustafa Ismail 	IRDMA_SD_BUF_ALIGNMENT      = 0x80,
11053f49d684SMustafa Ismail 	IRDMA_FEATURE_BUF_ALIGNMENT = 0x8,
11063f49d684SMustafa Ismail };
11073f49d684SMustafa Ismail 
11083f49d684SMustafa Ismail enum icrdma_protocol_used {
11093f49d684SMustafa Ismail 	ICRDMA_ANY_PROTOCOL	   = 0,
11103f49d684SMustafa Ismail 	ICRDMA_IWARP_PROTOCOL_ONLY = 1,
11113f49d684SMustafa Ismail 	ICRDMA_ROCE_PROTOCOL_ONLY  = 2,
11123f49d684SMustafa Ismail };
11133f49d684SMustafa Ismail 
11143f49d684SMustafa Ismail /**
11153f49d684SMustafa Ismail  * set_64bit_val - set 64 bit value to hw wqe
11163f49d684SMustafa Ismail  * @wqe_words: wqe addr to write
11173f49d684SMustafa Ismail  * @byte_index: index in wqe
11183f49d684SMustafa Ismail  * @val: value to write
11193f49d684SMustafa Ismail  **/
11203f49d684SMustafa Ismail static inline void set_64bit_val(__le64 *wqe_words, u32 byte_index, u64 val)
11213f49d684SMustafa Ismail {
11223f49d684SMustafa Ismail 	wqe_words[byte_index >> 3] = cpu_to_le64(val);
11233f49d684SMustafa Ismail }
11243f49d684SMustafa Ismail 
11253f49d684SMustafa Ismail /**
11263f49d684SMustafa Ismail  * set_32bit_val - set 32 bit value to hw wqe
11273f49d684SMustafa Ismail  * @wqe_words: wqe addr to write
11283f49d684SMustafa Ismail  * @byte_index: index in wqe
11293f49d684SMustafa Ismail  * @val: value to write
11303f49d684SMustafa Ismail  **/
11313f49d684SMustafa Ismail static inline void set_32bit_val(__le32 *wqe_words, u32 byte_index, u32 val)
11323f49d684SMustafa Ismail {
11333f49d684SMustafa Ismail 	wqe_words[byte_index >> 2] = cpu_to_le32(val);
11343f49d684SMustafa Ismail }
11353f49d684SMustafa Ismail 
11363f49d684SMustafa Ismail /**
11373f49d684SMustafa Ismail  * get_64bit_val - read 64 bit value from wqe
11383f49d684SMustafa Ismail  * @wqe_words: wqe addr
11393f49d684SMustafa Ismail  * @byte_index: index to read from
11403f49d684SMustafa Ismail  * @val: read value
11413f49d684SMustafa Ismail  **/
11423f49d684SMustafa Ismail static inline void get_64bit_val(__le64 *wqe_words, u32 byte_index, u64 *val)
11433f49d684SMustafa Ismail {
11443f49d684SMustafa Ismail 	*val = le64_to_cpu(wqe_words[byte_index >> 3]);
11453f49d684SMustafa Ismail }
11463f49d684SMustafa Ismail 
11473f49d684SMustafa Ismail /**
11483f49d684SMustafa Ismail  * get_32bit_val - read 32 bit value from wqe
11493f49d684SMustafa Ismail  * @wqe_words: wqe addr
11503f49d684SMustafa Ismail  * @byte_index: index to reaad from
11513f49d684SMustafa Ismail  * @val: return 32 bit value
11523f49d684SMustafa Ismail  **/
11533f49d684SMustafa Ismail static inline void get_32bit_val(__le32 *wqe_words, u32 byte_index, u32 *val)
11543f49d684SMustafa Ismail {
11553f49d684SMustafa Ismail 	*val = le32_to_cpu(wqe_words[byte_index >> 2]);
11563f49d684SMustafa Ismail }
11573f49d684SMustafa Ismail #endif /* IRDMA_DEFS_H */
1158