patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/enic: fix L4 Rx ptype comparison
       [not found] <20180110091712.32198-1-johndale@cisco.com>
@ 2018-01-10  9:17 ` John Daley
  0 siblings, 0 replies; only message in thread
From: John Daley @ 2018-01-10  9:17 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Hyong Youb Kim, stable

From: Hyong Youb Kim <hyonkim@cisco.com>

For non-UDP/TCP packets, enic may wrongly set PKT_RX_L4_CKSUM_BAD in
ol_flags. The comparison that checks if a packet is UDP or TCP assumes
that RTE_PTYPE_L4 values are bit flags, but they are not. For example,
the following evaluates to true because NONFRAG is 0x600 and UDP is
0x200, and causes the current code to think the packet is UDP.

!!(RTE_PTYPE_L4_NONFRAG & RTE_PTYPE_L4_UDP)

So, fix this by comparing the packet type against UDP and TCP
individually.

Fixes: 453d15059b58 ("net/enic: use new Rx checksum flags")
Cc: stable@dpdk.org

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index a3663d516..831c90a1c 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -285,7 +285,8 @@ enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf)
 			else
 				pkt_flags |= PKT_RX_IP_CKSUM_BAD;
 
-			if (l4_flags & (RTE_PTYPE_L4_UDP | RTE_PTYPE_L4_TCP)) {
+			if (l4_flags == RTE_PTYPE_L4_UDP ||
+			    l4_flags == RTE_PTYPE_L4_TCP) {
 				if (enic_cq_rx_desc_tcp_udp_csum_ok(cqrd))
 					pkt_flags |= PKT_RX_L4_CKSUM_GOOD;
 				else
-- 
2.12.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-10  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20180110091712.32198-1-johndale@cisco.com>
2018-01-10  9:17 ` [dpdk-stable] [PATCH] net/enic: fix L4 Rx ptype comparison John Daley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).