Skip to content

Commit b50e00d

Browse files
author
Shani Peretz
committed
Revert "net: fix packet type for stacked VLAN"
This reverts commit 7668bf3.
1 parent a5b7345 commit b50e00d

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

lib/net/rte_net.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ rte_net_skip_ip6_ext(uint16_t proto, const struct rte_mbuf *m, uint32_t *off,
218218
return -1;
219219
}
220220

221-
/* limit number of supported VLAN headers */
222-
#define RTE_NET_VLAN_MAX_DEPTH 8
223-
224221
/* parse mbuf data to get packet type */
225222
uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
226223
struct rte_net_hdr_lens *hdr_lens, uint32_t layers)
@@ -229,7 +226,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
229226
const struct rte_ether_hdr *eh;
230227
struct rte_ether_hdr eh_copy;
231228
uint32_t pkt_type = RTE_PTYPE_L2_ETHER;
232-
uint32_t off = 0, vlan_depth = 0;
229+
uint32_t off = 0;
233230
uint16_t proto;
234231
int ret;
235232

@@ -249,26 +246,30 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
249246
if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4))
250247
goto l3; /* fast path if packet is IPv4 */
251248

252-
while (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ||
253-
proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) {
249+
if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
254250
const struct rte_vlan_hdr *vh;
255251
struct rte_vlan_hdr vh_copy;
256252

257-
if (++vlan_depth > RTE_NET_VLAN_MAX_DEPTH)
258-
return 0;
259-
pkt_type |=
260-
proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ?
261-
RTE_PTYPE_L2_ETHER_VLAN :
262-
RTE_PTYPE_L2_ETHER_QINQ;
253+
pkt_type = RTE_PTYPE_L2_ETHER_VLAN;
263254
vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy);
264255
if (unlikely(vh == NULL))
265256
return pkt_type;
266257
off += sizeof(*vh);
267258
hdr_lens->l2_len += sizeof(*vh);
268259
proto = vh->eth_proto;
269-
}
260+
} else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) {
261+
const struct rte_vlan_hdr *vh;
262+
struct rte_vlan_hdr vh_copy;
270263

271-
if ((proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) ||
264+
pkt_type = RTE_PTYPE_L2_ETHER_QINQ;
265+
vh = rte_pktmbuf_read(m, off + sizeof(*vh), sizeof(*vh),
266+
&vh_copy);
267+
if (unlikely(vh == NULL))
268+
return pkt_type;
269+
off += 2 * sizeof(*vh);
270+
hdr_lens->l2_len += 2 * sizeof(*vh);
271+
proto = vh->eth_proto;
272+
} else if ((proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLS)) ||
272273
(proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_MPLSM))) {
273274
unsigned int i;
274275
const struct rte_mpls_hdr *mh;

0 commit comments

Comments
 (0)