DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@arknetworks.am>
To: dev@dpdk.org
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Andy Moreton <andy.moreton@amd.com>,
	Pieter Jansen Van Vuuren <pieter.jansen-van-vuuren@amd.com>,
	Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
Subject: [PATCH 5/9] common/sfc_efx/base: count Rx TRUNC ERR as CRC errors on X4
Date: Tue, 30 Dec 2025 01:35:23 +0400	[thread overview]
Message-ID: <20251229213527.37907-6-ivan.malov@arknetworks.am> (raw)
In-Reply-To: <20251229213527.37907-1-ivan.malov@arknetworks.am>

From: Andy Moreton <andy.moreton@amd.com>

On X4 the MAC hardware reports both over-size packets and CRC errors
in the RX event flag RX_TRUNC_ERR. Over-size packets are only likely
as a result of a misconfigured network, so count the RX_TRUNC_ERR
events as CRC errors.
This workaround is only needed for the per-queue counters maintained
by the driver. The DMA statistics counters maintained by firmware
are not affected.

Signed-off-by: Andy Moreton <andy.moreton@amd.com>
Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>
---
 drivers/common/sfc_efx/base/ef10_ev.c | 41 +++++++++++++++++++++------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/common/sfc_efx/base/ef10_ev.c b/drivers/common/sfc_efx/base/ef10_ev.c
index a97c1bf43e..ea430d0d5f 100644
--- a/drivers/common/sfc_efx/base/ef10_ev.c
+++ b/drivers/common/sfc_efx/base/ef10_ev.c
@@ -418,6 +418,7 @@ ef10_ev_rx_packed_stream(
 	__in		const efx_ev_callbacks_t *eecp,
 	__in_opt	void *arg)
 {
+	efx_nic_t *enp = eep->ee_enp;
 	uint32_t label;
 	uint32_t pkt_count_lbits;
 	uint16_t flags;
@@ -466,10 +467,22 @@ ef10_ev_rx_packed_stream(
 
 	/* Check for errors that invalidate checksum and L3/L4 fields */
 	if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_TRUNC_ERR) != 0) {
-		/* RX frame truncated */
-		EFX_EV_QSTAT_INCR(eep, EV_RX_FRM_TRUNC);
-		flags |= EFX_DISCARD;
-		goto deliver;
+		/*
+		 * X4 uses RX_TRUNC_ERR for packet size and CRC errors. Count
+		 * these as CRC errors (as over-size packets are only likely in
+		 * a misconfigured network).
+		 */
+		if (enp->en_family == EFX_FAMILY_MEDFORD4) {
+			/* Bad Ethernet frame CRC */
+			EFX_EV_QSTAT_INCR(eep, EV_RX_ETH_CRC_ERR);
+			flags |= EFX_DISCARD;
+			goto deliver;
+		} else {
+			/* RX frame truncated */
+			EFX_EV_QSTAT_INCR(eep, EV_RX_FRM_TRUNC);
+			flags |= EFX_DISCARD;
+			goto deliver;
+		}
 	}
 	if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_ECRC_ERR) != 0) {
 		/* Bad Ethernet frame CRC */
@@ -630,10 +643,22 @@ ef10_ev_rx(
 
 	/* Check for errors that invalidate checksum and L3/L4 fields */
 	if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_TRUNC_ERR) != 0) {
-		/* RX frame truncated */
-		EFX_EV_QSTAT_INCR(eep, EV_RX_FRM_TRUNC);
-		flags |= EFX_DISCARD;
-		goto deliver;
+		/*
+		 * X4 uses RX_TRUNC_ERR for packet size and CRC errors. Count
+		 * these as CRC errors (as over-size packets are only likely in
+		 * a misconfigured network).
+		 */
+		if (enp->en_family == EFX_FAMILY_MEDFORD4) {
+			/* Bad Ethernet frame CRC */
+			EFX_EV_QSTAT_INCR(eep, EV_RX_ETH_CRC_ERR);
+			flags |= EFX_DISCARD;
+			goto deliver;
+		} else {
+			/* RX frame truncated */
+			EFX_EV_QSTAT_INCR(eep, EV_RX_FRM_TRUNC);
+			flags |= EFX_DISCARD;
+			goto deliver;
+		}
 	}
 	if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_ECRC_ERR) != 0) {
 		/* Bad Ethernet frame CRC */
-- 
2.47.3


  parent reply	other threads:[~2025-12-29 21:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29 21:35 [PATCH 0/9] net/sfc: SFN7xxx deprecation and Medford fixes Ivan Malov
2025-12-29 21:35 ` [PATCH 1/9] doc: remove support for AMD Solarflare SFN7xxx family boards Ivan Malov
2025-12-29 21:35 ` [PATCH 2/9] common/sfc_efx/base: fix flow control setting on legacy MCDI Ivan Malov
2025-12-29 21:35 ` [PATCH 3/9] common/sfc_efx/base: fix indication of requestable FEC flags Ivan Malov
2025-12-29 21:35 ` [PATCH 4/9] common/sfc_efx/base: define mask for pause mode capabilities Ivan Malov
2025-12-29 21:35 ` Ivan Malov [this message]
2025-12-29 21:35 ` [PATCH 6/9] net/sfc: avoid speed reset when setting FEC in started state Ivan Malov
2025-12-29 21:35 ` [PATCH 7/9] net/sfc: rework the capability check that is done on FEC set Ivan Malov
2025-12-29 21:35 ` [PATCH 8/9] net/sfc: drop AUTO from FEC capabilities and fix the comment Ivan Malov
2025-12-29 21:35 ` [PATCH 9/9] net/sfc: fix reporting status of autonegotiation to the user Ivan Malov
2025-12-31 19:13 ` [PATCH 0/9] net/sfc: SFN7xxx deprecation and Medford fixes Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251229213527.37907-6-ivan.malov@arknetworks.am \
    --to=ivan.malov@arknetworks.am \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=andy.moreton@amd.com \
    --cc=dev@dpdk.org \
    --cc=pieter.jansen-van-vuuren@amd.com \
    --cc=viacheslav.galaktionov@arknetworks.am \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).