[13/15] net/ena: fix wrong handling of checksum

Message ID 20240702144626.14545-14-shaibran@amazon.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/ena: driver release 2.10.0 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Brandes, Shai July 2, 2024, 2:46 p.m. UTC
From: Shai Brandes <shaibran@amazon.com>

This change fixes an issue where a non tcp/udp packet can be indicated
to have an invalid csum. If the device erroneously tries to verify the
csum on a non tcp/udp packet it will result in false indication that
there is a csum error. This change make the driver ignore the
indication for csum error on such packets.

Fixes: 84daba9962b5 ("net/ena: add extra Rx checksum related xstats")
Cc: stable@dpdk.org
Signed-off-by: Shai Brandes <shaibran@amazon.com>
---
 doc/guides/rel_notes/release_24_07.rst | 1 +
 drivers/net/ena/ena_ethdev.c           | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/doc/guides/rel_notes/release_24_07.rst b/doc/guides/rel_notes/release_24_07.rst
index 24bb91ad46..ec960d93cc 100644
--- a/doc/guides/rel_notes/release_24_07.rst
+++ b/doc/guides/rel_notes/release_24_07.rst
@@ -80,6 +80,7 @@  New Features
     cleanup and lay the groundwork for hot-unplug support.
   * Removed an obsolete workaround for a false L4 bad Rx checksum indication.
   * Fixed an invalid return value check.
+  * Fixed Rx chcecksum inspection to check only TCP/UDP packets.
 
 * **Update Tap PMD driver.**
 
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 67a1d86f9a..a18c94df28 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -669,7 +669,8 @@  static inline void ena_rx_mbuf_prepare(struct ena_ring *rx_ring,
 		packet_type |= RTE_PTYPE_L3_IPV6;
 	}
 
-	if (!ena_rx_ctx->l4_csum_checked || ena_rx_ctx->frag) {
+	if (!ena_rx_ctx->l4_csum_checked || ena_rx_ctx->frag ||
+		!(packet_type & (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP))) {
 		ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN;
 	} else {
 		if (unlikely(ena_rx_ctx->l4_csum_err)) {