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

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