1
2
3
4
5#ifndef _NGBE_PTYPE_H_
6#define _NGBE_PTYPE_H_
7
8
9
10
11
12
13
14#define NGBE_PTID_NULL 0
15#define NGBE_PTID_MAX 256
16#define NGBE_PTID_MASK 0xFF
17#define NGBE_PTID_MASK_TUNNEL 0x7F
18
19
20#define NGBE_PTID_TUN_IPV6 0x40
21#define NGBE_PTID_TUN_EI 0x00
22#define NGBE_PTID_TUN_EIG 0x10
23#define NGBE_PTID_TUN_EIGM 0x20
24#define NGBE_PTID_TUN_EIGMV 0x30
25
26
27#define NGBE_PTID_PKT_TUN (0x80)
28#define NGBE_PTID_PKT_MAC (0x10)
29#define NGBE_PTID_PKT_IP (0x20)
30
31
32#define NGBE_PTID_TYP_MAC (0x01)
33#define NGBE_PTID_TYP_TS (0x02)
34#define NGBE_PTID_TYP_FIP (0x03)
35#define NGBE_PTID_TYP_LLDP (0x04)
36#define NGBE_PTID_TYP_CNM (0x05)
37#define NGBE_PTID_TYP_EAPOL (0x06)
38#define NGBE_PTID_TYP_ARP (0x07)
39#define NGBE_PTID_TYP_ETF (0x08)
40
41
42#define NGBE_PTID_PKT_IPV6 (0x08)
43#define NGBE_PTID_TYP_IPFRAG (0x01)
44#define NGBE_PTID_TYP_IPDATA (0x02)
45#define NGBE_PTID_TYP_UDP (0x03)
46#define NGBE_PTID_TYP_TCP (0x04)
47#define NGBE_PTID_TYP_SCTP (0x05)
48
49
50enum ngbe_l2_ptids {
51 NGBE_PTID_L2_ABORTED = (NGBE_PTID_PKT_MAC),
52 NGBE_PTID_L2_MAC = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_MAC),
53 NGBE_PTID_L2_TMST = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_TS),
54 NGBE_PTID_L2_FIP = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_FIP),
55 NGBE_PTID_L2_LLDP = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_LLDP),
56 NGBE_PTID_L2_CNM = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_CNM),
57 NGBE_PTID_L2_EAPOL = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_EAPOL),
58 NGBE_PTID_L2_ARP = (NGBE_PTID_PKT_MAC | NGBE_PTID_TYP_ARP),
59
60 NGBE_PTID_L2_IPV4_FRAG = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_IPFRAG),
61 NGBE_PTID_L2_IPV4 = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_IPDATA),
62 NGBE_PTID_L2_IPV4_UDP = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_UDP),
63 NGBE_PTID_L2_IPV4_TCP = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_TCP),
64 NGBE_PTID_L2_IPV4_SCTP = (NGBE_PTID_PKT_IP | NGBE_PTID_TYP_SCTP),
65 NGBE_PTID_L2_IPV6_FRAG = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
66 NGBE_PTID_TYP_IPFRAG),
67 NGBE_PTID_L2_IPV6 = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
68 NGBE_PTID_TYP_IPDATA),
69 NGBE_PTID_L2_IPV6_UDP = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
70 NGBE_PTID_TYP_UDP),
71 NGBE_PTID_L2_IPV6_TCP = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
72 NGBE_PTID_TYP_TCP),
73 NGBE_PTID_L2_IPV6_SCTP = (NGBE_PTID_PKT_IP | NGBE_PTID_PKT_IPV6 |
74 NGBE_PTID_TYP_SCTP),
75
76 NGBE_PTID_L2_TUN4_MAC = (NGBE_PTID_PKT_TUN |
77 NGBE_PTID_TUN_EIGM),
78 NGBE_PTID_L2_TUN6_MAC = (NGBE_PTID_PKT_TUN |
79 NGBE_PTID_TUN_IPV6 | NGBE_PTID_TUN_EIGM),
80};
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95struct rte_ngbe_ptype {
96 u32 l2:4;
97 u32 l3:4;
98 u32 l4:4;
99 u32 tun:4;
100
101 u32 el2:4;
102 u32 el3:4;
103 u32 el4:4;
104 u32 rsv:3;
105 u32 known:1;
106};
107
108#define RTE_PTYPE_L2_ETHER_FIP RTE_PTYPE_L2_ETHER
109#define RTE_PTYPE_L2_ETHER_CNM RTE_PTYPE_L2_ETHER
110#define RTE_PTYPE_L2_ETHER_EAPOL RTE_PTYPE_L2_ETHER
111#define RTE_PTYPE_L2_ETHER_FILTER RTE_PTYPE_L2_ETHER
112
113u32 *ngbe_get_supported_ptypes(void);
114u32 ngbe_decode_ptype(u8 ptid);
115u8 ngbe_encode_ptype(u32 ptype);
116
117
118
119
120
121
122
123
124
125
126
127
128
129#define NGBE_PT_ETHER 0x00
130#define NGBE_PT_IPV4 0x01
131#define NGBE_PT_IPV4_TCP 0x11
132#define NGBE_PT_IPV4_UDP 0x21
133#define NGBE_PT_IPV4_SCTP 0x41
134#define NGBE_PT_IPV4_EXT 0x03
135#define NGBE_PT_IPV4_EXT_TCP 0x13
136#define NGBE_PT_IPV4_EXT_UDP 0x23
137#define NGBE_PT_IPV4_EXT_SCTP 0x43
138#define NGBE_PT_IPV6 0x04
139#define NGBE_PT_IPV6_TCP 0x14
140#define NGBE_PT_IPV6_UDP 0x24
141#define NGBE_PT_IPV6_SCTP 0x44
142#define NGBE_PT_IPV6_EXT 0x0C
143#define NGBE_PT_IPV6_EXT_TCP 0x1C
144#define NGBE_PT_IPV6_EXT_UDP 0x2C
145#define NGBE_PT_IPV6_EXT_SCTP 0x4C
146#define NGBE_PT_IPV4_IPV6 0x05
147#define NGBE_PT_IPV4_IPV6_TCP 0x15
148#define NGBE_PT_IPV4_IPV6_UDP 0x25
149#define NGBE_PT_IPV4_IPV6_SCTP 0x45
150#define NGBE_PT_IPV4_EXT_IPV6 0x07
151#define NGBE_PT_IPV4_EXT_IPV6_TCP 0x17
152#define NGBE_PT_IPV4_EXT_IPV6_UDP 0x27
153#define NGBE_PT_IPV4_EXT_IPV6_SCTP 0x47
154#define NGBE_PT_IPV4_IPV6_EXT 0x0D
155#define NGBE_PT_IPV4_IPV6_EXT_TCP 0x1D
156#define NGBE_PT_IPV4_IPV6_EXT_UDP 0x2D
157#define NGBE_PT_IPV4_IPV6_EXT_SCTP 0x4D
158#define NGBE_PT_IPV4_EXT_IPV6_EXT 0x0F
159#define NGBE_PT_IPV4_EXT_IPV6_EXT_TCP 0x1F
160#define NGBE_PT_IPV4_EXT_IPV6_EXT_UDP 0x2F
161#define NGBE_PT_IPV4_EXT_IPV6_EXT_SCTP 0x4F
162
163#define NGBE_PT_MAX 256
164
165
166
167
168
169
170
171
172
173
174
175
176#define NGBE_ETF_ID_EAPOL 0
177#define NGBE_ETF_ID_FCOE 2
178#define NGBE_ETF_ID_1588 3
179#define NGBE_ETF_ID_FIP 4
180#define NGBE_ETF_ID_LLDP 5
181#define NGBE_ETF_ID_LACP 6
182#define NGBE_ETF_ID_FC 7
183#define NGBE_ETF_ID_MAX 8
184
185#define NGBE_PTID_ETF_MIN 0x18
186#define NGBE_PTID_ETF_MAX 0x1F
187static inline int ngbe_etflt_id(u8 ptid)
188{
189 if (ptid >= NGBE_PTID_ETF_MIN && ptid <= NGBE_PTID_ETF_MAX)
190 return ptid - NGBE_PTID_ETF_MIN;
191 else
192 return -1;
193}
194
195#endif
196