All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Christian Schmidbauer <opensource@grische.xyz>, netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	stable@vger.kernel.org,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Aaro Koskinen <aaro.koskinen@nokia.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error
Date: Tue, 17 Nov 2026 15:56:49 +0100	[thread overview]
Message-ID: <5231b964-215d-481d-87b3-86ff99829eba@bootlin.com> (raw)
In-Reply-To: <20261114133640.3285413-3-opensource@grische.xyz>

Hi,

On 11/14/26 14:36, Christian Schmidbauer wrote:
> On dwmac1000 with enhanced descriptors, the hardware sets the Error
> Summary (ES) bit of the Rx descriptor not only for L2 errors but also
> for an L3/L4 checksum error. enh_desc_get_rx_status() returns
> discard_frame whenever ES is set, and since commit 1b746ce8b397 ("net:
> stmmac: don't overwrite discard_frame status") the checksum status is
> only evaluated for good frames.
> 
> Return discard_frame only when ES comes with one of the L2 error bits.
> A frame with only a checksum error is then reported as csum_none and
> reaches the stack as CHECKSUM_NONE, so the stack verifies the checksum
> itself. This matches dwmac4, whose Error Summary bit does not cover
> checksum errors.
> 
> RDES0 bit 7 is not in the mask, because depending on the core and on
> Rx checksum offload it reports a timestamp, an IP header checksum error
> or a giant frame, and enh_desc_get_rx_status() cannot tell which. In
> threshold Rx mode, a giant frame that fits one buffer therefore reaches
> the stack with a verified FCS.
> 
> Also remove the pr_err that enh_desc_get_rx_status() prints when bit 7
> is set. Once the MAC stops dropping checksum-error frames, any host on
> the link can flood the kernel log by sending frames with a bad IPv4
> header checksum.
> 
> This prepares for setting DMA_CONTROL_DT, which makes the MAC deliver
> checksum-error frames instead of dropping them in its Rx FIFO.
> 
> Fixes: 1b746ce8b397 ("net: stmmac: don't overwrite discard_frame status")
> Cc: <stable@vger.kernel.org> # 6.6.x: ee0aace5f844: net: stmmac: Correctly handle Rx checksum offload errors
> Cc: <stable@vger.kernel.org> # 6.6.x
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Christian Schmidbauer <opensource@grische.xyz>

I was able to test that on Altera Cyclone V, and it works. 

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Thanks,

Maxime

> ---
> v2:
> - Drop RDES0_LENGTH_ERROR from the mask of Error Summary bits. The
>   length check further down already discards such a frame.
> - Explain in the commit message why RDES0 bit 7 is not treated as an
>   L2 error.
> v1: https://lore.kernel.org/netdev/20261020190319.884375-1-opensource@grische.xyz/
>  drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> index 7ece8d4157a8..d0622f2605aa 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
> @@ -216,9 +216,6 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
>  		if (unlikely(rdes0 & RDES0_OVERFLOW_ERROR))
>  			x->rx_gmac_overflow++;
>  
> -		if (unlikely(rdes0 & RDES0_IPC_CSUM_ERROR))
> -			pr_err("\tIPC Csum Error/Giant frame\n");
> -
>  		if (unlikely(rdes0 & RDES0_COLLISION))
>  			x->rx_collision++;
>  		if (unlikely(rdes0 & RDES0_RECEIVE_WATCHDOG))
> @@ -230,7 +227,10 @@ static int enh_desc_get_rx_status(struct stmmac_extra_stats *x,
>  		if (unlikely(rdes0 & RDES0_CRC_ERROR)) {
>  			x->rx_crc_errors++;
>  		}
> -		ret = discard_frame;
> +		if (rdes0 & (RDES0_DESCRIPTOR_ERROR | RDES0_OVERFLOW_ERROR |
> +			     RDES0_COLLISION | RDES0_RECEIVE_WATCHDOG |
> +			     RDES0_MII_ERROR | RDES0_CRC_ERROR))
> +			ret = discard_frame;
>  	}
>  
>  	/* After a payload csum error, the ES bit is set.


  reply	other threads:[~2026-11-17 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 13:36 [PATCH net v3 0/3] net: stmmac: deliver frames with Rx checksum errors to the stack Christian Schmidbauer
2026-11-14 13:36 ` [PATCH net v3 1/3] net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path Christian Schmidbauer
2026-11-17 14:54   ` Maxime Chevallier
2026-11-14 13:36 ` [PATCH net v3 2/3] net: stmmac: dwmac1000: don't discard frames with only a checksum error Christian Schmidbauer
2026-11-17 14:56   ` Maxime Chevallier [this message]
2026-11-14 13:36 ` [PATCH net v3 3/3] net: stmmac: dwmac1000: stop hardware from dropping checksum-error packets Christian Schmidbauer
2026-11-17 14:58   ` Maxime Chevallier

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=5231b964-215d-481d-87b3-86ff99829eba@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=aaro.koskinen@nokia.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=opensource@grische.xyz \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.