RTE_PTYPE_L4_* values are not independent bits but mutually exclusive
values in a single field. The code set RTE_PTYPE_L4_NONFRAG (0x600)
first then OR'd the specific L4 type on top, corrupting the result:
- TCP: 0x600 | 0x100 = 0x700 (undefined)
- UDP: 0x600 | 0x200 = 0x600 (UDP lost, still NONFRAG)
- SCTP: 0x600 | 0x400 = 0x600 (SCTP lost, still NONFRAG)
- ICMP: 0x600 | 0x500 = 0x700 (undefined)
Move RTE_PTYPE_L4_NONFRAG to the final else fallback so it is only
set when no known L4 protocol is identified, matching how
rte_net_get_ptype() handles L4 classification.
Also remove the L3_IP_UNKNOWN_PROTOCOL check that OR'd
RTE_PTYPE_UNKNOWN (0x0), which was a no-op. That case is now
correctly covered by the NONFRAG fallback.
Not tested, found by code review.
Fixes: 5765e0b7c875 ("net/dpaa2: add parse function for LX2 device")
Cc: [email protected]
Signed-off-by: Maxime Leroy <[email protected]>
---
drivers/net/dpaa2/dpaa2_rxtx.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 0de52cbef2..9c908f87b1 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -212,24 +212,18 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
L3_IP_N_MORE_FRAGMENT)) {
pkt_type |= RTE_PTYPE_L4_FRAG;
goto parse_done;
- } else {
- pkt_type |= RTE_PTYPE_L4_NONFRAG;
}
if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_UDP_PRESENT))
pkt_type |= RTE_PTYPE_L4_UDP;
-
else if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_TCP_PRESENT))
pkt_type |= RTE_PTYPE_L4_TCP;
-
else if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_SCTP_PRESENT))
pkt_type |= RTE_PTYPE_L4_SCTP;
-
else if (BIT_ISSET_AT_POS(annotation->word4, L3_PROTO_ICMP_PRESENT))
pkt_type |= RTE_PTYPE_L4_ICMP;
-
- else if (BIT_ISSET_AT_POS(annotation->word4, L3_IP_UNKNOWN_PROTOCOL))
- pkt_type |= RTE_PTYPE_UNKNOWN;
+ else
+ pkt_type |= RTE_PTYPE_L4_NONFRAG;
parse_done:
return pkt_type;
--
2.43.0