Blame SOURCES/0001-net-enic-fix-L4-Rx-ptype-comparison.patch

a6040a
From f596cb198e65ff6839d35763d824399eb407adab Mon Sep 17 00:00:00 2001
a6040a
From: Hyong Youb Kim <hyonkim@cisco.com>
a6040a
Date: Wed, 10 Jan 2018 01:17:04 -0800
a6040a
Subject: [PATCH] net/enic: fix L4 Rx ptype comparison
a6040a
a6040a
[ upstream commit 5dbff3af25a4a68980992f5040246e1d7f20b4cd ]
a6040a
a6040a
For non-UDP/TCP packets, enic may wrongly set PKT_RX_L4_CKSUM_BAD in
a6040a
ol_flags. The comparison that checks if a packet is UDP or TCP assumes
a6040a
that RTE_PTYPE_L4 values are bit flags, but they are not. For example,
a6040a
the following evaluates to true because NONFRAG is 0x600 and UDP is
a6040a
0x200, and causes the current code to think the packet is UDP.
a6040a
a6040a
!!(RTE_PTYPE_L4_NONFRAG & RTE_PTYPE_L4_UDP)
a6040a
a6040a
So, fix this by comparing the packet type against UDP and TCP
a6040a
individually.
a6040a
a6040a
Fixes: 453d15059b58 ("net/enic: use new Rx checksum flags")
a6040a
a6040a
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
a6040a
Reviewed-by: John Daley <johndale@cisco.com>
a6040a
---
a6040a
 drivers/net/enic/enic_rxtx.c | 3 ++-
a6040a
 1 file changed, 2 insertions(+), 1 deletion(-)
a6040a
a6040a
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
a6040a
index a3663d516..831c90a1c 100644
a6040a
--- a/drivers/net/enic/enic_rxtx.c
a6040a
+++ b/drivers/net/enic/enic_rxtx.c
a6040a
@@ -285,7 +285,8 @@ enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf)
a6040a
 			else
a6040a
 				pkt_flags |= PKT_RX_IP_CKSUM_BAD;
a6040a
 
a6040a
-			if (l4_flags & (RTE_PTYPE_L4_UDP | RTE_PTYPE_L4_TCP)) {
a6040a
+			if (l4_flags == RTE_PTYPE_L4_UDP ||
a6040a
+			    l4_flags == RTE_PTYPE_L4_TCP) {
a6040a
 				if (enic_cq_rx_desc_tcp_udp_csum_ok(cqrd))
a6040a
 					pkt_flags |= PKT_RX_L4_CKSUM_GOOD;
a6040a
 				else
a6040a
-- 
a6040a
2.14.3
a6040a