1/* SPDX-License-Identifier: GPL-2.0+ */
2
3#ifndef __LAN966X_IFH_H__
4#define __LAN966X_IFH_H__
5
6/* Fields with description (*) should just be cleared upon injection
7 * IFH is transmitted MSByte first (Highest bit pos sent as MSB of first byte)
8 */
9
10#define IFH_LEN                      7
11#define IFH_LEN_BYTES                (IFH_LEN * sizeof(u32))
12
13/* Timestamp for frame */
14#define IFH_POS_TIMESTAMP            192
15
16/* Bypass analyzer with a prefilled IFH */
17#define IFH_POS_BYPASS               191
18
19/* Masqueraded injection with masq_port defining logical source port */
20#define IFH_POS_MASQ                 190
21
22/* Masqueraded port number for injection */
23#define IFH_POS_MASQ_PORT            186
24
25/* Frame length (*) */
26#define IFH_POS_LEN                  178
27
28/* Cell filling mode. Full(0),Etype(1), LlctOpt(2), Llct(3) */
29#define IFH_POS_WRDMODE              176
30
31/* Frame has 16 bits rtag removed compared to line data */
32#define IFH_POS_RTAG48               175
33
34/* Frame has a redundancy tag */
35#define IFH_POS_HAS_RED_TAG          174
36
37/* Frame has been cut through forwarded (*) */
38#define IFH_POS_CUTTHRU              173
39
40/* Rewriter command */
41#define IFH_POS_REW_CMD              163
42
43/* Enable OAM-related rewriting. PDU_TYPE encodes OAM type. */
44#define IFH_POS_REW_OAM              162
45
46/* PDU type. Encoding: (0-NONE, 1-Y1731_CCM, 2-MRP_TST, 3-MRP_ITST, 4-DLR_BCN,
47 * 5-DLR_ADV, 6-RTE_NULL_INJ, 7-IPV4, 8-IPV6, 9-Y1731_NON_CCM).
48 */
49#define IFH_POS_PDU_TYPE             158
50
51/* Update FCS before transmission */
52#define IFH_POS_FCS_UPD              157
53
54/* Classified DSCP value of frame */
55#define IFH_POS_DSCP                 151
56
57/* Yellow indication */
58#define IFH_POS_DP                   150
59
60/* Process in RTE/inbound */
61#define IFH_POS_RTE_INB_UPDATE       149
62
63/* Number of tags to pop from frame */
64#define IFH_POS_POP_CNT              147
65
66/* Number of tags in front of the ethertype */
67#define IFH_POS_ETYPE_OFS            145
68
69/* Logical source port of frame (*) */
70#define IFH_POS_SRCPORT              141
71
72/* Sequence number in redundancy tag */
73#define IFH_POS_SEQ_NUM              120
74
75/* Stagd flag and classified TCI of frame (PCP/DEI/VID) */
76#define IFH_POS_TCI                  103
77
78/* Classified internal priority for queuing */
79#define IFH_POS_QOS_CLASS            100
80
81/* Bit mask with eight cpu copy classses */
82#define IFH_POS_CPUQ                 92
83
84/* Relearn + learn flags (*) */
85#define IFH_POS_LEARN_FLAGS          90
86
87/* SFLOW identifier for frame (0-8: Tx port, 9: Rx sampling, 15: No sampling) */
88#define IFH_POS_SFLOW_ID             86
89
90/* Set if an ACL/S2 rule was hit (*).
91 * Super priority: acl_hit=0 and acl_hit(4)=1.
92 */
93#define IFH_POS_ACL_HIT              85
94
95/* S2 rule index hit (*) */
96#define IFH_POS_ACL_IDX              79
97
98/* ISDX as classified by S1 */
99#define IFH_POS_ISDX                 71
100
101/* Destination ports for frame */
102#define IFH_POS_DSTS                 62
103
104/* Storm policer to be applied: None/Uni/Multi/Broad (*) */
105#define IFH_POS_FLOOD                60
106
107/* Redundancy tag operation */
108#define IFH_POS_SEQ_OP               58
109
110/* Classified internal priority for resourcemgt, tagging etc */
111#define IFH_POS_IPV                  55
112
113/* Frame is for AFI use */
114#define IFH_POS_AFI                  54
115
116/* Internal aging value (*) */
117#define IFH_POS_AGED                 52
118
119/* RTP Identifier */
120#define IFH_POS_RTP_ID               42
121
122/* RTP MRPD flow */
123#define IFH_POS_RTP_SUBID            41
124
125/* Profinet DataStatus or opcua GroupVersion MSB */
126#define IFH_POS_PN_DATA_STATUS       33
127
128/* Profinet transfer status (1 iff the status is 0) */
129#define IFH_POS_PN_TRANSF_STATUS_ZERO 32
130
131/* Profinet cycle counter or opcua NetworkMessageNumber */
132#define IFH_POS_PN_CC                16
133
134#define IFH_WID_TIMESTAMP            32
135#define IFH_WID_BYPASS               1
136#define IFH_WID_MASQ                 1
137#define IFH_WID_MASQ_PORT            4
138#define IFH_WID_LEN                  14
139#define IFH_WID_WRDMODE              2
140#define IFH_WID_RTAG48               1
141#define IFH_WID_HAS_RED_TAG          1
142#define IFH_WID_CUTTHRU              1
143#define IFH_WID_REW_CMD              10
144#define IFH_WID_REW_OAM              1
145#define IFH_WID_PDU_TYPE             4
146#define IFH_WID_FCS_UPD              1
147#define IFH_WID_DSCP                 6
148#define IFH_WID_DP                   1
149#define IFH_WID_RTE_INB_UPDATE       1
150#define IFH_WID_POP_CNT              2
151#define IFH_WID_ETYPE_OFS            2
152#define IFH_WID_SRCPORT              4
153#define IFH_WID_SEQ_NUM              16
154#define IFH_WID_TCI                  17
155#define IFH_WID_QOS_CLASS            3
156#define IFH_WID_CPUQ                 8
157#define IFH_WID_LEARN_FLAGS          2
158#define IFH_WID_SFLOW_ID             4
159#define IFH_WID_ACL_HIT              1
160#define IFH_WID_ACL_IDX              6
161#define IFH_WID_ISDX                 8
162#define IFH_WID_DSTS                 9
163#define IFH_WID_FLOOD                2
164#define IFH_WID_SEQ_OP               2
165#define IFH_WID_IPV                  3
166#define IFH_WID_AFI                  1
167#define IFH_WID_AGED                 2
168#define IFH_WID_RTP_ID               10
169#define IFH_WID_RTP_SUBID            1
170#define IFH_WID_PN_DATA_STATUS       8
171#define IFH_WID_PN_TRANSF_STATUS_ZERO 1
172#define IFH_WID_PN_CC                16
173
174#endif /* __LAN966X_IFH_H__ */
175