xref: /linux/drivers/net/ethernet/intel/idpf/virtchnl2_lan_desc.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*0d7502a9SPavan Kumar Linga /* SPDX-License-Identifier: GPL-2.0-only */
2*0d7502a9SPavan Kumar Linga /* Copyright (C) 2023 Intel Corporation */
3*0d7502a9SPavan Kumar Linga 
4*0d7502a9SPavan Kumar Linga #ifndef _VIRTCHNL2_LAN_DESC_H_
5*0d7502a9SPavan Kumar Linga #define _VIRTCHNL2_LAN_DESC_H_
6*0d7502a9SPavan Kumar Linga 
7*0d7502a9SPavan Kumar Linga #include <linux/bits.h>
8*0d7502a9SPavan Kumar Linga 
9*0d7502a9SPavan Kumar Linga /* This is an interface definition file where existing enums and their values
10*0d7502a9SPavan Kumar Linga  * must remain unchanged over time, so we specify explicit values for all enums.
11*0d7502a9SPavan Kumar Linga  */
12*0d7502a9SPavan Kumar Linga 
13*0d7502a9SPavan Kumar Linga /* Transmit descriptor ID flags
14*0d7502a9SPavan Kumar Linga  */
15*0d7502a9SPavan Kumar Linga enum virtchnl2_tx_desc_ids {
16*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_TXDID_DATA				= BIT(0),
17*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_TXDID_CTX				= BIT(1),
18*0d7502a9SPavan Kumar Linga 	/* TXDID bit 2 is reserved
19*0d7502a9SPavan Kumar Linga 	 * TXDID bit 3 is free for future use
20*0d7502a9SPavan Kumar Linga 	 * TXDID bit 4 is reserved
21*0d7502a9SPavan Kumar Linga 	 */
22*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_TXDID_FLEX_TSO_CTX			= BIT(5),
23*0d7502a9SPavan Kumar Linga 	/* TXDID bit 6 is reserved */
24*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_TXDID_FLEX_L2TAG1_L2TAG2		= BIT(7),
25*0d7502a9SPavan Kumar Linga 	/* TXDID bits 8 and 9 are free for future use
26*0d7502a9SPavan Kumar Linga 	 * TXDID bit 10 is reserved
27*0d7502a9SPavan Kumar Linga 	 * TXDID bit 11 is free for future use
28*0d7502a9SPavan Kumar Linga 	 */
29*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_TXDID_FLEX_FLOW_SCHED			= BIT(12),
30*0d7502a9SPavan Kumar Linga 	/* TXDID bits 13 and 14 are free for future use */
31*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_TXDID_DESC_DONE			= BIT(15),
32*0d7502a9SPavan Kumar Linga };
33*0d7502a9SPavan Kumar Linga 
34*0d7502a9SPavan Kumar Linga /* Receive descriptor IDs */
35*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_desc_ids {
36*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_1_32B_BASE	= 1,
37*0d7502a9SPavan Kumar Linga 	/* FLEX_SQ_NIC and FLEX_SPLITQ share desc ids because they can be
38*0d7502a9SPavan Kumar Linga 	 * differentiated based on queue model; e.g. single queue model can
39*0d7502a9SPavan Kumar Linga 	 * only use FLEX_SQ_NIC and split queue model can only use FLEX_SPLITQ
40*0d7502a9SPavan Kumar Linga 	 * for DID 2.
41*0d7502a9SPavan Kumar Linga 	 */
42*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_2_FLEX_SPLITQ	= 2,
43*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_2_FLEX_SQ_NIC	= VIRTCHNL2_RXDID_2_FLEX_SPLITQ,
44*0d7502a9SPavan Kumar Linga 	/* 3 through 6 are reserved */
45*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_7_HW_RSVD	= 7,
46*0d7502a9SPavan Kumar Linga 	/* 8 through 15 are free */
47*0d7502a9SPavan Kumar Linga };
48*0d7502a9SPavan Kumar Linga 
49*0d7502a9SPavan Kumar Linga /* Receive descriptor ID bitmasks */
50*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RXDID_M(bit)			BIT_ULL(VIRTCHNL2_RXDID_##bit)
51*0d7502a9SPavan Kumar Linga 
52*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_desc_id_bitmasks {
53*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_1_32B_BASE_M	= VIRTCHNL2_RXDID_M(1_32B_BASE),
54*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M	= VIRTCHNL2_RXDID_M(2_FLEX_SPLITQ),
55*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M	= VIRTCHNL2_RXDID_M(2_FLEX_SQ_NIC),
56*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RXDID_7_HW_RSVD_M	= VIRTCHNL2_RXDID_M(7_HW_RSVD),
57*0d7502a9SPavan Kumar Linga };
58*0d7502a9SPavan Kumar Linga 
59*0d7502a9SPavan Kumar Linga /* For splitq virtchnl2_rx_flex_desc_adv_nic_3 desc members */
60*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_RXDID_M		GENMASK(3, 0)
61*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_UMBCAST_M		GENMASK(7, 6)
62*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M		GENMASK(9, 0)
63*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_RAW_CSUM_INV_S	12
64*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_RAW_CSUM_INV_M	\
65*0d7502a9SPavan Kumar Linga 	BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_RAW_CSUM_INV_S)
66*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_FF0_M		GENMASK(15, 13)
67*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_LEN_PBUF_M		GENMASK(13, 0)
68*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_GEN_S		14
69*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_GEN_M		\
70*0d7502a9SPavan Kumar Linga 	BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_GEN_S)
71*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_BUFQ_ID_S		15
72*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_BUFQ_ID_M		\
73*0d7502a9SPavan Kumar Linga 	BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_BUFQ_ID_S)
74*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_LEN_HDR_M		GENMASK(9, 0)
75*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_S		10
76*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_M		\
77*0d7502a9SPavan Kumar Linga 	BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_S)
78*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_SPH_S		11
79*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_SPH_M		\
80*0d7502a9SPavan Kumar Linga 	BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_SPH_S)
81*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_S		12
82*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_FF1_M		GENMASK(14, 12)
83*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_MISS_S		15
84*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_ADV_MISS_M		\
85*0d7502a9SPavan Kumar Linga 	BIT_ULL(VIRTCHNL2_RX_FLEX_DESC_ADV_MISS_S)
86*0d7502a9SPavan Kumar Linga 
87*0d7502a9SPavan Kumar Linga /* Bitmasks for splitq virtchnl2_rx_flex_desc_adv_nic_3 */
88*0d7502a9SPavan Kumar Linga enum virtchl2_rx_flex_desc_adv_status_error_0_qw1_bits {
89*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_DD_M			= BIT(0),
90*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_EOF_M		= BIT(1),
91*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_HBO_M		= BIT(2),
92*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_L3L4P_M		= BIT(3),
93*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_XSUM_IPE_M		= BIT(4),
94*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_XSUM_L4E_M		= BIT(5),
95*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_XSUM_EIPE_M		= BIT(6),
96*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_XSUM_EUDPE_M		= BIT(7),
97*0d7502a9SPavan Kumar Linga };
98*0d7502a9SPavan Kumar Linga 
99*0d7502a9SPavan Kumar Linga /* Bitmasks for splitq virtchnl2_rx_flex_desc_adv_nic_3 */
100*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_flex_desc_adv_status_error_0_qw0_bits {
101*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_LPBK_M		= BIT(0),
102*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_IPV6EXADD_M		= BIT(1),
103*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_RXE_M		= BIT(2),
104*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_CRCP_M		= BIT(3),
105*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_RSS_VALID_M		= BIT(4),
106*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_L2TAG1P_M		= BIT(5),
107*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_XTRMD0_VALID_M	= BIT(6),
108*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_XTRMD1_VALID_M	= BIT(7),
109*0d7502a9SPavan Kumar Linga };
110*0d7502a9SPavan Kumar Linga 
111*0d7502a9SPavan Kumar Linga /* Bitmasks for splitq virtchnl2_rx_flex_desc_adv_nic_3 */
112*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_flex_desc_adv_status_error_1_bits {
113*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_RSVD_M		= GENMASK(1, 0),
114*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_ATRAEFAIL_M		= BIT(2),
115*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_L2TAG2P_M		= BIT(3),
116*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_XTRMD2_VALID_M	= BIT(4),
117*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_XTRMD3_VALID_M	= BIT(5),
118*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_XTRMD4_VALID_M	= BIT(6),
119*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS1_XTRMD5_VALID_M	= BIT(7),
120*0d7502a9SPavan Kumar Linga };
121*0d7502a9SPavan Kumar Linga 
122*0d7502a9SPavan Kumar Linga /* For singleq (flex) virtchnl2_rx_flex_desc fields
123*0d7502a9SPavan Kumar Linga  * For virtchnl2_rx_flex_desc.ptype_flex_flags0 member
124*0d7502a9SPavan Kumar Linga  */
125*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_PTYPE_M				GENMASK(9, 0)
126*0d7502a9SPavan Kumar Linga 
127*0d7502a9SPavan Kumar Linga /* For virtchnl2_rx_flex_desc.pkt_len member */
128*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_DESC_PKT_LEN_M			GENMASK(13, 0)
129*0d7502a9SPavan Kumar Linga 
130*0d7502a9SPavan Kumar Linga /* Bitmasks for singleq (flex) virtchnl2_rx_flex_desc */
131*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_flex_desc_status_error_0_bits {
132*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_DD_M			= BIT(0),
133*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_EOF_M			= BIT(1),
134*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_HBO_M			= BIT(2),
135*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_L3L4P_M			= BIT(3),
136*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_XSUM_IPE_M		= BIT(4),
137*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_XSUM_L4E_M		= BIT(5),
138*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_XSUM_EIPE_M		= BIT(6),
139*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_M		= BIT(7),
140*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_LPBK_M			= BIT(8),
141*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_IPV6EXADD_M		= BIT(9),
142*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_RXE_M			= BIT(10),
143*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_CRCP_M			= BIT(11),
144*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_RSS_VALID_M		= BIT(12),
145*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_L2TAG1P_M		= BIT(13),
146*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_XTRMD0_VALID_M		= BIT(14),
147*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS0_XTRMD1_VALID_M		= BIT(15),
148*0d7502a9SPavan Kumar Linga };
149*0d7502a9SPavan Kumar Linga 
150*0d7502a9SPavan Kumar Linga /* Bitmasks for singleq (flex) virtchnl2_rx_flex_desc */
151*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_flex_desc_status_error_1_bits {
152*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_CPM_M			= GENMASK(3, 0),
153*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_NAT_M			= BIT(4),
154*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_CRYPTO_M			= BIT(5),
155*0d7502a9SPavan Kumar Linga 	/* [10:6] reserved */
156*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_L2TAG2P_M		= BIT(11),
157*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_XTRMD2_VALID_M		= BIT(12),
158*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_XTRMD3_VALID_M		= BIT(13),
159*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_XTRMD4_VALID_M		= BIT(14),
160*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_FLEX_DESC_STATUS1_XTRMD5_VALID_M		= BIT(15),
161*0d7502a9SPavan Kumar Linga };
162*0d7502a9SPavan Kumar Linga 
163*0d7502a9SPavan Kumar Linga /* For virtchnl2_rx_flex_desc.ts_low member */
164*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_FLEX_TSTAMP_VALID				BIT(0)
165*0d7502a9SPavan Kumar Linga 
166*0d7502a9SPavan Kumar Linga /* For singleq (non flex) virtchnl2_singleq_base_rx_desc legacy desc members */
167*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_BASE_DESC_QW1_LEN_PBUF_M		GENMASK_ULL(51, 38)
168*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_BASE_DESC_QW1_PTYPE_M		GENMASK_ULL(37, 30)
169*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_BASE_DESC_QW1_ERROR_M		GENMASK_ULL(26, 19)
170*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_BASE_DESC_QW1_STATUS_M		GENMASK_ULL(18, 0)
171*0d7502a9SPavan Kumar Linga 
172*0d7502a9SPavan Kumar Linga /* Bitmasks for singleq (base) virtchnl2_rx_base_desc */
173*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_base_desc_status_bits {
174*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_DD_M		= BIT(0),
175*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_EOF_M		= BIT(1),
176*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_L2TAG1P_M		= BIT(2),
177*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_L3L4P_M		= BIT(3),
178*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_CRCP_M		= BIT(4),
179*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_RSVD_M		= GENMASK(7, 5),
180*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_EXT_UDP_0_M	= BIT(8),
181*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_UMBCAST_M		= GENMASK(10, 9),
182*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_FLM_M		= BIT(11),
183*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_FLTSTAT_M		= GENMASK(13, 12),
184*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_LPBK_M		= BIT(14),
185*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_IPV6EXADD_M	= BIT(15),
186*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_RSVD1_M		= GENMASK(17, 16),
187*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_STATUS_INT_UDP_0_M	= BIT(18),
188*0d7502a9SPavan Kumar Linga };
189*0d7502a9SPavan Kumar Linga 
190*0d7502a9SPavan Kumar Linga /* Bitmasks for singleq (base) virtchnl2_rx_base_desc */
191*0d7502a9SPavan Kumar Linga enum virtchnl2_rx_base_desc_error_bits {
192*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_RXE_M		= BIT(0),
193*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_ATRAEFAIL_M	= BIT(1),
194*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_HBO_M		= BIT(2),
195*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_L3L4E_M		= GENMASK(5, 3),
196*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_IPE_M		= BIT(3),
197*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_L4E_M		= BIT(4),
198*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_EIPE_M		= BIT(5),
199*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_OVERSIZE_M		= BIT(6),
200*0d7502a9SPavan Kumar Linga 	VIRTCHNL2_RX_BASE_DESC_ERROR_PPRS_M		= BIT(7),
201*0d7502a9SPavan Kumar Linga };
202*0d7502a9SPavan Kumar Linga 
203*0d7502a9SPavan Kumar Linga /* Bitmasks for singleq (base) virtchnl2_rx_base_desc */
204*0d7502a9SPavan Kumar Linga #define VIRTCHNL2_RX_BASE_DESC_FLTSTAT_RSS_HASH_M	GENMASK(13, 12)
205*0d7502a9SPavan Kumar Linga 
206*0d7502a9SPavan Kumar Linga /**
207*0d7502a9SPavan Kumar Linga  * struct virtchnl2_splitq_rx_buf_desc - SplitQ RX buffer descriptor format
208*0d7502a9SPavan Kumar Linga  * @qword0: RX buffer struct.
209*0d7502a9SPavan Kumar Linga  * @qword0.buf_id: Buffer identifier.
210*0d7502a9SPavan Kumar Linga  * @qword0.rsvd0: Reserved.
211*0d7502a9SPavan Kumar Linga  * @qword0.rsvd1: Reserved.
212*0d7502a9SPavan Kumar Linga  * @pkt_addr: Packet buffer address.
213*0d7502a9SPavan Kumar Linga  * @hdr_addr: Header buffer address.
214*0d7502a9SPavan Kumar Linga  * @rsvd2: Rerserved.
215*0d7502a9SPavan Kumar Linga  *
216*0d7502a9SPavan Kumar Linga  * Receive Descriptors
217*0d7502a9SPavan Kumar Linga  * SplitQ buffer
218*0d7502a9SPavan Kumar Linga  * |                                       16|                   0|
219*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
220*0d7502a9SPavan Kumar Linga  * | RSV                                     | Buffer ID          |
221*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
222*0d7502a9SPavan Kumar Linga  * | Rx packet buffer address                                     |
223*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
224*0d7502a9SPavan Kumar Linga  * | Rx header buffer address                                     |
225*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
226*0d7502a9SPavan Kumar Linga  * | RSV                                                          |
227*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
228*0d7502a9SPavan Kumar Linga  * |                                                             0|
229*0d7502a9SPavan Kumar Linga  */
230*0d7502a9SPavan Kumar Linga struct virtchnl2_splitq_rx_buf_desc {
231*0d7502a9SPavan Kumar Linga 	struct {
232*0d7502a9SPavan Kumar Linga 		__le16  buf_id;
233*0d7502a9SPavan Kumar Linga 		__le16  rsvd0;
234*0d7502a9SPavan Kumar Linga 		__le32  rsvd1;
235*0d7502a9SPavan Kumar Linga 	} qword0;
236*0d7502a9SPavan Kumar Linga 	__le64  pkt_addr;
237*0d7502a9SPavan Kumar Linga 	__le64  hdr_addr;
238*0d7502a9SPavan Kumar Linga 	__le64  rsvd2;
239*0d7502a9SPavan Kumar Linga };
240*0d7502a9SPavan Kumar Linga 
241*0d7502a9SPavan Kumar Linga /**
242*0d7502a9SPavan Kumar Linga  * struct virtchnl2_singleq_rx_buf_desc - SingleQ RX buffer descriptor format.
243*0d7502a9SPavan Kumar Linga  * @pkt_addr: Packet buffer address.
244*0d7502a9SPavan Kumar Linga  * @hdr_addr: Header buffer address.
245*0d7502a9SPavan Kumar Linga  * @rsvd1: Reserved.
246*0d7502a9SPavan Kumar Linga  * @rsvd2: Reserved.
247*0d7502a9SPavan Kumar Linga  *
248*0d7502a9SPavan Kumar Linga  * SingleQ buffer
249*0d7502a9SPavan Kumar Linga  * |                                                             0|
250*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
251*0d7502a9SPavan Kumar Linga  * | Rx packet buffer address                                     |
252*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
253*0d7502a9SPavan Kumar Linga  * | Rx header buffer address                                     |
254*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
255*0d7502a9SPavan Kumar Linga  * | RSV                                                          |
256*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
257*0d7502a9SPavan Kumar Linga  * | RSV                                                          |
258*0d7502a9SPavan Kumar Linga  * ----------------------------------------------------------------
259*0d7502a9SPavan Kumar Linga  * |                                                             0|
260*0d7502a9SPavan Kumar Linga  */
261*0d7502a9SPavan Kumar Linga struct virtchnl2_singleq_rx_buf_desc {
262*0d7502a9SPavan Kumar Linga 	__le64  pkt_addr;
263*0d7502a9SPavan Kumar Linga 	__le64  hdr_addr;
264*0d7502a9SPavan Kumar Linga 	__le64  rsvd1;
265*0d7502a9SPavan Kumar Linga 	__le64  rsvd2;
266*0d7502a9SPavan Kumar Linga };
267*0d7502a9SPavan Kumar Linga 
268*0d7502a9SPavan Kumar Linga /**
269*0d7502a9SPavan Kumar Linga  * struct virtchnl2_singleq_base_rx_desc - RX descriptor writeback format.
270*0d7502a9SPavan Kumar Linga  * @qword0: First quad word struct.
271*0d7502a9SPavan Kumar Linga  * @qword0.lo_dword: Lower dual word struct.
272*0d7502a9SPavan Kumar Linga  * @qword0.lo_dword.mirroring_status: Mirrored packet status.
273*0d7502a9SPavan Kumar Linga  * @qword0.lo_dword.l2tag1: Stripped L2 tag from the received packet.
274*0d7502a9SPavan Kumar Linga  * @qword0.hi_dword: High dual word union.
275*0d7502a9SPavan Kumar Linga  * @qword0.hi_dword.rss: RSS hash.
276*0d7502a9SPavan Kumar Linga  * @qword0.hi_dword.fd_id: Flow director filter id.
277*0d7502a9SPavan Kumar Linga  * @qword1: Second quad word struct.
278*0d7502a9SPavan Kumar Linga  * @qword1.status_error_ptype_len: Status/error/PTYPE/length.
279*0d7502a9SPavan Kumar Linga  * @qword2: Third quad word struct.
280*0d7502a9SPavan Kumar Linga  * @qword2.ext_status: Extended status.
281*0d7502a9SPavan Kumar Linga  * @qword2.rsvd: Reserved.
282*0d7502a9SPavan Kumar Linga  * @qword2.l2tag2_1: Extracted L2 tag 2 from the packet.
283*0d7502a9SPavan Kumar Linga  * @qword2.l2tag2_2: Reserved.
284*0d7502a9SPavan Kumar Linga  * @qword3: Fourth quad word struct.
285*0d7502a9SPavan Kumar Linga  * @qword3.reserved: Reserved.
286*0d7502a9SPavan Kumar Linga  * @qword3.fd_id: Flow director filter id.
287*0d7502a9SPavan Kumar Linga  *
288*0d7502a9SPavan Kumar Linga  * Profile ID 0x1, SingleQ, base writeback format
289*0d7502a9SPavan Kumar Linga  */
290*0d7502a9SPavan Kumar Linga struct virtchnl2_singleq_base_rx_desc {
291*0d7502a9SPavan Kumar Linga 	struct {
292*0d7502a9SPavan Kumar Linga 		struct {
293*0d7502a9SPavan Kumar Linga 			__le16 mirroring_status;
294*0d7502a9SPavan Kumar Linga 			__le16 l2tag1;
295*0d7502a9SPavan Kumar Linga 		} lo_dword;
296*0d7502a9SPavan Kumar Linga 		union {
297*0d7502a9SPavan Kumar Linga 			__le32 rss;
298*0d7502a9SPavan Kumar Linga 			__le32 fd_id;
299*0d7502a9SPavan Kumar Linga 		} hi_dword;
300*0d7502a9SPavan Kumar Linga 	} qword0;
301*0d7502a9SPavan Kumar Linga 	struct {
302*0d7502a9SPavan Kumar Linga 		__le64 status_error_ptype_len;
303*0d7502a9SPavan Kumar Linga 	} qword1;
304*0d7502a9SPavan Kumar Linga 	struct {
305*0d7502a9SPavan Kumar Linga 		__le16 ext_status;
306*0d7502a9SPavan Kumar Linga 		__le16 rsvd;
307*0d7502a9SPavan Kumar Linga 		__le16 l2tag2_1;
308*0d7502a9SPavan Kumar Linga 		__le16 l2tag2_2;
309*0d7502a9SPavan Kumar Linga 	} qword2;
310*0d7502a9SPavan Kumar Linga 	struct {
311*0d7502a9SPavan Kumar Linga 		__le32 reserved;
312*0d7502a9SPavan Kumar Linga 		__le32 fd_id;
313*0d7502a9SPavan Kumar Linga 	} qword3;
314*0d7502a9SPavan Kumar Linga };
315*0d7502a9SPavan Kumar Linga 
316*0d7502a9SPavan Kumar Linga /**
317*0d7502a9SPavan Kumar Linga  * struct virtchnl2_rx_flex_desc_nic - RX descriptor writeback format.
318*0d7502a9SPavan Kumar Linga  *
319*0d7502a9SPavan Kumar Linga  * @rxdid: Descriptor builder profile id.
320*0d7502a9SPavan Kumar Linga  * @mir_id_umb_cast: umb_cast=[7:6], mirror=[5:0]
321*0d7502a9SPavan Kumar Linga  * @ptype_flex_flags0: ff0=[15:10], ptype=[9:0]
322*0d7502a9SPavan Kumar Linga  * @pkt_len: Packet length, [15:14] are reserved.
323*0d7502a9SPavan Kumar Linga  * @hdr_len_sph_flex_flags1: ff1/ext=[15:12], sph=[11], header=[10:0].
324*0d7502a9SPavan Kumar Linga  * @status_error0: Status/Error section 0.
325*0d7502a9SPavan Kumar Linga  * @l2tag1: Stripped L2 tag from the received packet
326*0d7502a9SPavan Kumar Linga  * @rss_hash: RSS hash.
327*0d7502a9SPavan Kumar Linga  * @status_error1: Status/Error section 1.
328*0d7502a9SPavan Kumar Linga  * @flexi_flags2: Flexible flags section 2.
329*0d7502a9SPavan Kumar Linga  * @ts_low: Lower word of timestamp value.
330*0d7502a9SPavan Kumar Linga  * @l2tag2_1st: First L2TAG2.
331*0d7502a9SPavan Kumar Linga  * @l2tag2_2nd: Second L2TAG2.
332*0d7502a9SPavan Kumar Linga  * @flow_id: Flow id.
333*0d7502a9SPavan Kumar Linga  * @flex_ts: Timestamp and flexible flow id union.
334*0d7502a9SPavan Kumar Linga  * @flex_ts.ts_high: Timestamp higher word of the timestamp value.
335*0d7502a9SPavan Kumar Linga  * @flex_ts.flex.rsvd: Reserved.
336*0d7502a9SPavan Kumar Linga  * @flex_ts.flex.flow_id_ipv6: IPv6 flow id.
337*0d7502a9SPavan Kumar Linga  *
338*0d7502a9SPavan Kumar Linga  * Profile ID 0x2, SingleQ, flex writeback format
339*0d7502a9SPavan Kumar Linga  */
340*0d7502a9SPavan Kumar Linga struct virtchnl2_rx_flex_desc_nic {
341*0d7502a9SPavan Kumar Linga 	/* Qword 0 */
342*0d7502a9SPavan Kumar Linga 	u8 rxdid;
343*0d7502a9SPavan Kumar Linga 	u8 mir_id_umb_cast;
344*0d7502a9SPavan Kumar Linga 	__le16 ptype_flex_flags0;
345*0d7502a9SPavan Kumar Linga 	__le16 pkt_len;
346*0d7502a9SPavan Kumar Linga 	__le16 hdr_len_sph_flex_flags1;
347*0d7502a9SPavan Kumar Linga 	/* Qword 1 */
348*0d7502a9SPavan Kumar Linga 	__le16 status_error0;
349*0d7502a9SPavan Kumar Linga 	__le16 l2tag1;
350*0d7502a9SPavan Kumar Linga 	__le32 rss_hash;
351*0d7502a9SPavan Kumar Linga 	/* Qword 2 */
352*0d7502a9SPavan Kumar Linga 	__le16 status_error1;
353*0d7502a9SPavan Kumar Linga 	u8 flexi_flags2;
354*0d7502a9SPavan Kumar Linga 	u8 ts_low;
355*0d7502a9SPavan Kumar Linga 	__le16 l2tag2_1st;
356*0d7502a9SPavan Kumar Linga 	__le16 l2tag2_2nd;
357*0d7502a9SPavan Kumar Linga 	/* Qword 3 */
358*0d7502a9SPavan Kumar Linga 	__le32 flow_id;
359*0d7502a9SPavan Kumar Linga 	union {
360*0d7502a9SPavan Kumar Linga 		struct {
361*0d7502a9SPavan Kumar Linga 			__le16 rsvd;
362*0d7502a9SPavan Kumar Linga 			__le16 flow_id_ipv6;
363*0d7502a9SPavan Kumar Linga 		} flex;
364*0d7502a9SPavan Kumar Linga 		__le32 ts_high;
365*0d7502a9SPavan Kumar Linga 	} flex_ts;
366*0d7502a9SPavan Kumar Linga };
367*0d7502a9SPavan Kumar Linga 
368*0d7502a9SPavan Kumar Linga /**
369*0d7502a9SPavan Kumar Linga  * struct virtchnl2_rx_flex_desc_adv_nic_3 - RX descriptor writeback format.
370*0d7502a9SPavan Kumar Linga  * @rxdid_ucast: ucast=[7:6], rsvd=[5:4], profile_id=[3:0].
371*0d7502a9SPavan Kumar Linga  * @status_err0_qw0: Status/Error section 0 in quad word 0.
372*0d7502a9SPavan Kumar Linga  * @ptype_err_fflags0: ff0=[15:12], udp_len_err=[11], ip_hdr_err=[10],
373*0d7502a9SPavan Kumar Linga  *		       ptype=[9:0].
374*0d7502a9SPavan Kumar Linga  * @pktlen_gen_bufq_id: bufq_id=[15] only in splitq, gen=[14] only in splitq,
375*0d7502a9SPavan Kumar Linga  *			plen=[13:0].
376*0d7502a9SPavan Kumar Linga  * @hdrlen_flags: miss_prepend=[15], trunc_mirr=[14], int_udp_0=[13],
377*0d7502a9SPavan Kumar Linga  *		  ext_udp0=[12], sph=[11] only in splitq, rsc=[10]
378*0d7502a9SPavan Kumar Linga  *		  only in splitq, header=[9:0].
379*0d7502a9SPavan Kumar Linga  * @status_err0_qw1: Status/Error section 0 in quad word 1.
380*0d7502a9SPavan Kumar Linga  * @status_err1: Status/Error section 1.
381*0d7502a9SPavan Kumar Linga  * @fflags1: Flexible flags section 1.
382*0d7502a9SPavan Kumar Linga  * @ts_low: Lower word of timestamp value.
383*0d7502a9SPavan Kumar Linga  * @buf_id: Buffer identifier. Only in splitq mode.
384*0d7502a9SPavan Kumar Linga  * @misc: Union.
385*0d7502a9SPavan Kumar Linga  * @misc.raw_cs: Raw checksum.
386*0d7502a9SPavan Kumar Linga  * @misc.l2tag1: Stripped L2 tag from the received packet
387*0d7502a9SPavan Kumar Linga  * @misc.rscseglen:
388*0d7502a9SPavan Kumar Linga  * @hash1: Lower bits of Rx hash value.
389*0d7502a9SPavan Kumar Linga  * @ff2_mirrid_hash2: Union.
390*0d7502a9SPavan Kumar Linga  * @ff2_mirrid_hash2.fflags2: Flexible flags section 2.
391*0d7502a9SPavan Kumar Linga  * @ff2_mirrid_hash2.mirrorid: Mirror id.
392*0d7502a9SPavan Kumar Linga  * @ff2_mirrid_hash2.rscseglen: RSC segment length.
393*0d7502a9SPavan Kumar Linga  * @hash3: Upper bits of Rx hash value.
394*0d7502a9SPavan Kumar Linga  * @l2tag2: Extracted L2 tag 2 from the packet.
395*0d7502a9SPavan Kumar Linga  * @fmd4: Flexible metadata container 4.
396*0d7502a9SPavan Kumar Linga  * @l2tag1: Stripped L2 tag from the received packet
397*0d7502a9SPavan Kumar Linga  * @fmd6: Flexible metadata container 6.
398*0d7502a9SPavan Kumar Linga  * @ts_high: Timestamp higher word of the timestamp value.
399*0d7502a9SPavan Kumar Linga  *
400*0d7502a9SPavan Kumar Linga  * Profile ID 0x2, SplitQ, flex writeback format
401*0d7502a9SPavan Kumar Linga  *
402*0d7502a9SPavan Kumar Linga  * Flex-field 0: BufferID
403*0d7502a9SPavan Kumar Linga  * Flex-field 1: Raw checksum/L2TAG1/RSC Seg Len (determined by HW)
404*0d7502a9SPavan Kumar Linga  * Flex-field 2: Hash[15:0]
405*0d7502a9SPavan Kumar Linga  * Flex-flags 2: Hash[23:16]
406*0d7502a9SPavan Kumar Linga  * Flex-field 3: L2TAG2
407*0d7502a9SPavan Kumar Linga  * Flex-field 5: L2TAG1
408*0d7502a9SPavan Kumar Linga  * Flex-field 7: Timestamp (upper 32 bits)
409*0d7502a9SPavan Kumar Linga  */
410*0d7502a9SPavan Kumar Linga struct virtchnl2_rx_flex_desc_adv_nic_3 {
411*0d7502a9SPavan Kumar Linga 	/* Qword 0 */
412*0d7502a9SPavan Kumar Linga 	u8 rxdid_ucast;
413*0d7502a9SPavan Kumar Linga 	u8 status_err0_qw0;
414*0d7502a9SPavan Kumar Linga 	__le16 ptype_err_fflags0;
415*0d7502a9SPavan Kumar Linga 	__le16 pktlen_gen_bufq_id;
416*0d7502a9SPavan Kumar Linga 	__le16 hdrlen_flags;
417*0d7502a9SPavan Kumar Linga 	/* Qword 1 */
418*0d7502a9SPavan Kumar Linga 	u8 status_err0_qw1;
419*0d7502a9SPavan Kumar Linga 	u8 status_err1;
420*0d7502a9SPavan Kumar Linga 	u8 fflags1;
421*0d7502a9SPavan Kumar Linga 	u8 ts_low;
422*0d7502a9SPavan Kumar Linga 	__le16 buf_id;
423*0d7502a9SPavan Kumar Linga 	union {
424*0d7502a9SPavan Kumar Linga 		__le16 raw_cs;
425*0d7502a9SPavan Kumar Linga 		__le16 l2tag1;
426*0d7502a9SPavan Kumar Linga 		__le16 rscseglen;
427*0d7502a9SPavan Kumar Linga 	} misc;
428*0d7502a9SPavan Kumar Linga 	/* Qword 2 */
429*0d7502a9SPavan Kumar Linga 	__le16 hash1;
430*0d7502a9SPavan Kumar Linga 	union {
431*0d7502a9SPavan Kumar Linga 		u8 fflags2;
432*0d7502a9SPavan Kumar Linga 		u8 mirrorid;
433*0d7502a9SPavan Kumar Linga 		u8 hash2;
434*0d7502a9SPavan Kumar Linga 	} ff2_mirrid_hash2;
435*0d7502a9SPavan Kumar Linga 	u8 hash3;
436*0d7502a9SPavan Kumar Linga 	__le16 l2tag2;
437*0d7502a9SPavan Kumar Linga 	__le16 fmd4;
438*0d7502a9SPavan Kumar Linga 	/* Qword 3 */
439*0d7502a9SPavan Kumar Linga 	__le16 l2tag1;
440*0d7502a9SPavan Kumar Linga 	__le16 fmd6;
441*0d7502a9SPavan Kumar Linga 	__le32 ts_high;
442*0d7502a9SPavan Kumar Linga };
443*0d7502a9SPavan Kumar Linga 
444*0d7502a9SPavan Kumar Linga /* Common union for accessing descriptor format structs */
445*0d7502a9SPavan Kumar Linga union virtchnl2_rx_desc {
446*0d7502a9SPavan Kumar Linga 	struct virtchnl2_singleq_base_rx_desc		base_wb;
447*0d7502a9SPavan Kumar Linga 	struct virtchnl2_rx_flex_desc_nic		flex_nic_wb;
448*0d7502a9SPavan Kumar Linga 	struct virtchnl2_rx_flex_desc_adv_nic_3		flex_adv_nic_3_wb;
449*0d7502a9SPavan Kumar Linga };
450*0d7502a9SPavan Kumar Linga 
451*0d7502a9SPavan Kumar Linga #endif /* _VIRTCHNL_LAN_DESC_H_ */
452