From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66B721F00893; Thu, 3 Dec 2026 07:28:07 +0000 (UTC) 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== Subject: Re: [PATCH net-next v3 1/4] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack 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 Date: Thu, 03 Dec 2026 07:28:06 +0000 Message-ID: <179628288695.3146.18296897628799263771@kernel.org> In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-1-01aa6280e6ae@gmail.com> References: <20261201-submit-sun8i-rxall-v1-v3-1-01aa6280e6ae@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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