ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: james.hilliard1@gmail.com
Cc: netdev@vger.kernel.org, maxime.chevallier@bootlin.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	pabeni@redhat.com, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com, wens@kernel.org,
	jernej.skrabec@gmail.com, samuel@sholland.org,
	clabbe.montjoie@gmail.com, kuba@kernel.org,
	o.rempel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev
Subject: Re: [PATCH net-next v3 1/4] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack
Date: Thu, 03 Dec 2026 07:28:06 +0000	[thread overview]
Message-ID: <179628288695.3146.18296897628799263771@kernel.org> (raw)
In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-1-01aa6280e6ae@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Undocumented stable-backport prerequisite.
- [Medium] The new sun8i_dwmac_rx_status()
  (drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c) assumes the…

--

net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack

This patch sets the sun8i EMAC error-forwarding bit, so frames with bad IP
or transport checksums now reach the stack. It also adds a sun8i-specific
RX status decoder that both stmmac_rx() and stmmac_rx_zc() use. The
hardware checksum checker now stays enabled whenever the receiver is on,
and checksum failures and unchecked frames are returned as csum_none.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 613199da57c1b..a7e4fca50141f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c

[ ... ]

> @@ -652,6 +653,9 @@ static void sun8i_dwmac_core_init(struct mac_device_info *hw,
>  
>  	v = (8 << EMAC_BURSTLEN_SHIFT); /* burst len */
>  	writel(v, ioaddr + EMAC_BASIC_CTL1);
> +
> +	/* Forward checksum failures to software before starting RX. */
> +	writel(EMAC_RX_ERR_FRM, ioaddr + EMAC_RX_CTL1);
>  }

[Severity: Medium]
With EMAC_RX_ERR_FRM set, the MAC now passes frames with bad IP/TCP/UDP
checksums up instead of dropping them. This patch never sets
skb->ip_summed itself. These frames only end up as CHECKSUM_NONE because
the common RX paths check csum_none:

stmmac_rx():
		if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) ||
		    (status & csum_none))
			skb_checksum_none_assert(skb);
		else
			skb->ip_summed = CHECKSUM_UNNECESSARY;

In stmmac_rx(), the csum_none test came from ee0aace5f844 ("net: stmmac:
Correctly handle Rx checksum offload errors"), which has no Fixes: or
Cc: stable tag. In stmmac_dispatch_skb_zc(), it came from fcfc52fcf89a
("net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path").

This patch carries Fixes: 9f93ac8d4085, so stable may pick it up for every
tree back to the original dwmac-sun8i addition. In a tree without
ee0aace5f844, stmmac_rx() marks a frame CHECKSUM_UNNECESSARY whenever coe
is set and the ethertype is IP. sun8i uses STMMAC_RX_COE_TYPE2, and RXCSUM
is on by default.

In such a tree, would a backport cause frames with corrupted TCP/UDP
payloads to be accepted by the stack as already verified?

The v3 notes say:

  - Document the checksum-status requirements for stable backports.

However, the commit message does not mention any prerequisite, and the
notes below the --- line are dropped when the patch is applied. Could the
dependencies on ee0aace5f844 and fcfc52fcf89a be recorded in the commit
message, for example as prerequisite annotations on Cc: stable lines?

[ ... ]

> @@ -1081,6 +1078,83 @@ static const struct stmmac_ops sun8i_dwmac_ops = {
>  	.set_mac_loopback = sun8i_dwmac_set_mac_loopback,
>  };
>  

[ ... ]

> +static int sun8i_dwmac_rx_status(struct stmmac_extra_stats *x, struct dma_desc *p)
> +{
> +	const u32 csum_mask = RDES0_IPC_CSUM_ERROR | RDES0_PAYLOAD_CSUM_ERR;
> +	const u32 dma_errors = RDES0_DESCRIPTOR_ERROR | RDES0_OVERFLOW_ERROR;
> +	const u32 wire_errors = RDES0_CRC_ERROR | RDES0_MII_ERROR |
> +				RDES0_RECEIVE_WATCHDOG | RDES0_COLLISION |
> +				RDES0_LENGTH_ERROR;

[ ... ]

> +	if (unlikely(status & (RDES0_ERROR_SUMMARY | wire_errors | dma_errors))) {
> +		sun8i_dwmac_rx_error_stats(x, status);
> +		if (status & dma_errors)
> +			return discard_frame;
> +		/* An unexplained error summary is not a checksum verdict. */
> +		if (!(status & wire_errors) &&
> +		    (!(status & RDES0_FRAME_TYPE) || !(status & csum_mask)))
> +			return discard_frame;
> +	}

[ ... ]

> +	/* Only a checked IP frame is eligible for CHECKSUM_UNNECESSARY. */
> +	if (!(status & RDES0_FRAME_TYPE) || (status & (csum_mask | RDES0_DRIBBLING)))
> +		return csum_none;
> +
> +	return good_frame;
> +}

[Severity: Medium]
Is it known that the Allwinner EMAC fills RDES0 bits 5, 7 and 0
(RDES0_FRAME_TYPE, RDES0_IPC_CSUM_ERROR, RDES0_PAYLOAD_CSUM_ERR) using the
Synopsys Type-2 COE encoding?

The previous sun8i decoder, ndesc_get_rx_status() in norm_desc.c, never
read RDES0_FRAME_TYPE. Only enh_desc_coe_rdes0() decodes these three bits,
and sun8i does not use enhanced descriptors. The probe code only says the
rx_coe TYPE2 setting was copied from the Allwinner drivers.

If the hardware does not set bit 5 for checked IPv4/IPv6 frames, every
frame would return csum_none in sun8i_dwmac_rx_status(). Would that
silently disable RX checksum offload on all sun8i/H6/H616 boards?

The test in the commit message shows that frames with a bad UDP checksum
are delivered. It does not show that good frames still get
CHECKSUM_UNNECESSARY.

Bits 7 and 0 might also mean something else when the error summary is set,
for example the giant frame or Rx MAC address meanings in the Synopsys
layout. In that case, could the error summary branch treat non-checksum
error frames as checksum failures and deliver them? Those frames would
still get CHECKSUM_NONE and go through the buffer length check.

Is there a datasheet reference, or a test with good frames, that confirms
this encoding?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-submit-sun8i-rxall-v1-v3-0-01aa6280e6ae%40gmail.com

  reply	other threads:[~2026-12-03  7:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  6:25 [PATCH net-next v3 0/4] net: stmmac: support ethtool rx-all on sun8i James Hilliard
2026-12-02  6:25 ` [PATCH net-next v3 1/4] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack James Hilliard
2026-12-03  7:28   ` netdev-bot+sashiko [this message]
2026-12-02  6:25 ` [PATCH net-next v3 2/4] net: stmmac: dwmac-sun8i: align EMAC_RX_MD with tabs James Hilliard
2026-12-02  6:25 ` [PATCH net-next v3 3/4] net: stmmac: add common RXALL handling James Hilliard
2026-12-03  7:28   ` netdev-bot+sashiko
2026-12-02  6:25 ` [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all James Hilliard
2026-12-03  6:29   ` sashiko-bot
2026-12-03  7:28   ` netdev-bot+sashiko

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=179628288695.3146.18296897628799263771@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=samuel@sholland.org \
    --cc=wens@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox