🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26190

Re: [PATCH net-next v3 1/4] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack

#26190
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 07:28
145 lines
13849 bytes
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
Technical Details
Message-ID: <179628288695.3146.18296897628799263771@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376370-linux-kernel-netdev=dewy.ru
References: <20261201-submit-sun8i-rxall-v1-v3-1-01aa6280e6ae@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376370-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179628288695.3146.18296897628799263771@kernel.org>
References: <20261201-submit-sun8i-rxall-v1-v3-1-01aa6280e6ae@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2404818"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:vIhDv2v2ThJ7m6yXYHxyRWjQRhk= sha256:/vsVYsHyUzz3QVofSdnvemXW2UUqxEecTdiYRxJ3xHE=
	sha1:gaB8MKIOAIdnyMpVuX2gyZZez24= sha256:ruGi1v+d4f5rPqglJzhVVP+VnIhtLOxt3EhKVKxvfzY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 2F306117868; Thu,  3 Dec 2026 10:28:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VwZc6_UA0vZX;
	Thu,  3 Dec 2026 10:28:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376370-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id AE14E117862; Thu,  3 Dec 2026 10:28:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 69E1927785; Thu,  3 Dec 2026 07:28:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796282889;
	b=LFlKZR6UlJ0A7z2I3x1XBBOHRYeSp4foabLW1Oi4EjSdkk3NXFImFXB2gzfKrgeAMq4M
	 V0PHoQkVX09zkVkQ3S7vBqAusTViW4Ppf/qtN0dHiQ8bgjyLK1oXEd58SXu8RDIRHmgP8
	 rPE0xTo6vR1k3fMSAF2ArgratiO6i9k49EZkKyUeCiICtoKFYHPNguH2I6a0l5stM3iAR
	 kxRRyInpJj5MU2sDxoSX4agOBuNe8KsyPAle5uEGoxdCOXjK0534BKlMizITgyGqszzJJ
	 Zo5SqSD+Y4AeXuuJeGbt6icNieORGuPNrZRynaeVpVz13GfnAyo6xgzcmf2hIdd9k6A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796282889;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=bFymkuuerjPp9dD9+OXYdWjgAeSBrpUlDnfjC10CMEo=;
	b=UEmufzFVwPD9O7u/YKqgpU+X+5gkzuZIal5Zyl6cm45YTeO9A1x7PDCA41Sn8Y0vjcIm
	 Ae7ASpL9bYoNCxSvhITBmiIM5FJlaa2UAtF1ZqxVNib9976HLtTIRrDIxF0mAujmjhbVk
	 /H92PdK7QNMUM0nry8msVo6Ee+hl1dzjQMiJZkRXZYBIj4XZqZsvXUJIH3NYZRqpybmAQ
	 Op8iS4Tpx3UucjboAiHaQalUBszlvbPiy2kAUyLLbEweIN/HmN+A4cxkN7RP5j3k2KBcD
	 xDIJ4/989TUZSXQbpOB8PeSchsKg3kLhEs9ZQvjPqov2mcQ1l7KG4L1/gbmVvVtXzkg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fFv6gRW4;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 42A34606A335;
	Thu,  3 Dec 2026 07:28:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fFv6gRW4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796282888;
	b=mg+EkHVXRFbYKQliXxrWY0EJ5NKrrMhVeAP//JzMmEYooen7P0VeXHX3VdTom1r0UmPg
	 QfOLRo9b5I+ioSHZfI7Q3kbJBv6BmlVKb0gbC02zvFU8IGGH281VVjdRaSw8zbWcHj9py
	 DNf18LQrMkzVYYX6l5UOE4s72ddPuQFIdG/yPWce6Xp64F3cnpz5xRndfLh+rFo9bZGNd
	 rUw3kJcZ/5DLArkwRHNLN7jCgmVF1ACUxtn3nL7EkTFinR/lsmKK5W+UJaw6gNxUB3NSF
	 NK+gZ8OXxBuyBRIyOqvmwKPU54m8zxDSmzFts9jNvE8l1fS+o7i+M1x8AwXX0/ouMEQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796282888;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=bFymkuuerjPp9dD9+OXYdWjgAeSBrpUlDnfjC10CMEo=;
	b=h3OidsrIMtGTx4vm+5ZL2MAqA7wxAkrdAiHFjEyiQ/Av+2/m34Ff3S8N67ID/ro7H4WW
	 ZSGzguuUi3uLurMiig6/3+JM/X+QGs99xCyGk6VHnKp3/K1w6JsfnPW1MmxUKOIYRch6j
	 pcdsFZGcyv9vRfwr2NW50fnvpyy3g64btfYBe1cR8mIbaWcCRV3C56f+z1Rvu36EfK4z+
	 oY6l3VQQ1Nnwb7bdfnBD9+OJgpLBGz9MqoQlzMRnkT8ToFTBEOM12miCfddGEewNtKUxd
	 ofxX/Jlf7hqzKiQLIa5VM/753CS1i8xSD8RVolBkJcFIJqwcfAXjtjxGFQ0HAvPdA/A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fFv6gRW4;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FF77606A32C;
	Thu,  3 Dec 2026 07:28:08 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66B721F00893;
	Thu,  3 Dec 2026 07:28:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796282888;
	bh=bFymkuuerjPp9dD9+OXYdWjgAeSBrpUlDnfjC10CMEo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=fFv6gRW4Kj4mdF/NbwfajOUsnEdbyLucjdJCNgj+9x/9LPK/rfq/I4DmbQD3nPrax
	 huu9agq6nNh/H3+CIWtBHPw8SNAfbckeme7RAmta9/So9KxNSb/ypJByvSFQIPcaSV
	 11xAS8OTD+ubQ2li6spp73omiipLJlv+49JXnLg927FdfWijMFxkFnKzmNd457l3si
	 Yy3e7G/bG4oI4AY7Ji5TVp+7h2whKUHI9GV4siXm5AAyC8tL2rKmW8LD2ir8BFl5FW
	 LvpUiZR+cf3ksfPqTaYDNowkycrhMLi1u5zJ225xwGJE1Ip2tx1YefGrRHSLyZhIw7
	 PufmhM69xHFrg==
X-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
X-In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-1-01aa6280e6ae@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list