From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 329AB606A322 for ; Sat, 5 Dec 2026 02:53:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=3+wIiuSc; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lNO+V9bR DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=R35AcVNmWUvi/GQi1x0KhE+oeg7cC6GP7PAi0TDfQn4=; b=3+wIiuSc+Aj9jVa1A34UM+cOaX W29K3IIrzI+uFmIT5yqJpWunBjVJVr6gcgbis26jJNNeVWXZV5U3qjp4MKq5EASc0IQv/RbUYJybc vvTMzymMHbrXSV++B8rY9ElaeWdq19pMQyanDliFO9gkGzwwzav1OKT/1BYj/EchC87L9bq738S0S XlVIUq2u6+wbfJ1cN8Q/gO/1ra3wBdvcGnm/eDOLLuAKzJQJ7ndWEKckj3ao6lByRRQl1VmMA4eOA f3YtaUPvusChigdmmTSFMTFzEGJ7a7uosYGafFkKKUqT24UdfNqMICv8GD5HXI5K9BC2rNuX2+2E7 J4DbMO7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZftX-00000001vC8-2irU; Sat, 05 Dec 2026 02:53:03 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZftS-00000001vBq-2ogK for linux-arm-kernel@lists.infradead.org; Sat, 05 Dec 2026 02:52:58 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 8184C60DEA; Sat, 5 Dec 2026 02:52:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F20A1F0092B; Sat, 5 Dec 2026 02:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796439177; bh=R35AcVNmWUvi/GQi1x0KhE+oeg7cC6GP7PAi0TDfQn4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=lNO+V9bR7lDVN4FBweAXLTwy12jfAynksxKgpRNSZPBYQbwI20BfBvK95Fjbx64v2 CXhFi8MQgYB/3NCLDPik8mlxJ1DcXT5kgZU8kEfZp+jZRGeqO8MEqetMLbcFpp5brH MjOjzeEnkgMZLAMg9UT2mhmdeZqiLCkBGpYHqiz20GbHyAD6vWFj3eZzdJBnQk1TOP 8z84kGcsWst40SakLPUL5o2LRswESyUicG2p9pGRaEpAYLpqYS4RYVlPV4J+DXZaFi aDCzuCw4upf5g6unUxzU387Xh/ImwiJR5n0yeLiBWLJDrJ372FExu3FVtg8Ome5lN8 2rfFIp7PCwc3A== Subject: Re: [PATCH net-next v4 1/5] 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, willemb@google.com, nbb@tipi-net.de, kuba@kernel.org, o.rempel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Date: Sat, 05 Dec 2026 02:52:55 +0000 Message-ID: <179643917558.3146.3016621462138909746@kernel.org> In-Reply-To: <20261203-submit-sun8i-rxall-v1-v4-1-af22aec6ae13@gmail.com> References: <20261203-submit-sun8i-rxall-v1-v4-1-af22aec6ae13@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 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] This patch carries a Fixes: tag pointing at the 2017 driver addition (9f93ac8d4085, "net-next: stmmac: Add dwmac-sun8i"), so… - [Low] net: stmmac: sun8i_dwmac_rx_status() counts sub-18-byte runts as rx_desc -- net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack This patch sets EMAC_RX_ERR_FRM so the sun8i MAC forwards frames with IP or L4 checksum errors instead of dropping them. It adds a sun8i-specific RX status decoder that both RX paths reach through a new mac_device_info->rx_status hook. It also keeps the hardware checksum checker enabled whenever the receiver is on. > Backports need commit ee0aace5f844 ("net: stmmac: Correctly handle Rx > checksum offload errors") so the skb path honors CHECKSUM_NONE. Trees > with the AF_XDP zero-copy receive path also need commit fcfc52fcf89a > ("net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path"). > > Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i") [Severity: Medium] The Fixes: tag points at the 2017 driver addition. Could stable tooling then pick this patch for trees that have neither ee0aace5f844 nor fcfc52fcf89a? The dependency is described only in prose. There is no prerequisite line in the form stable tooling parses: Cc: # : : Also, ee0aace5f844 has no Fixes: or Cc: stable tag of its own, so it won't be pulled in automatically. In a tree without ee0aace5f844, stmmac_rx() still has: if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb)) skb_checksum_none_assert(skb); else skb->ip_summed = CHECKSUM_UNNECESSARY; sun8i_dwmac_rx_ipc() returns 1, so coe is always set on sun8i. With this patch, sun8i_dwmac_core_init() writes EMAC_RX_ERR_FRM to EMAC_RX_CTL1, so the MAC forwards checksum-error frames it used to drop. sun8i_dwmac_rx_status() returns csum_none for frames with RDES0_IPC_CSUM_ERROR or RDES0_PAYLOAD_CSUM_ERR set, but the older stmmac_rx() never tests that bit. Would those frames then reach the stack marked CHECKSUM_UNNECESSARY? That seems worse than the drop this patch fixes. The AF_XDP zero-copy path, stmmac_dispatch_skb_zc(), has the same dependency on fcfc52fcf89a. For comparison, the similar dwmac4 change fe4042797651 ("net: stmmac: dwmac4: stop hardware from dropping checksum-error packets") was merged without a Fixes: tag and stated that it depends on the error-propagation patches. Would it be safer to either drop the Fixes: tag, or add Cc: stable prerequisite lines for ee0aace5f844 and fcfc52fcf89a? [ ... ] > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > @@ -1081,6 +1078,83 @@ static const struct stmmac_ops sun8i_dwmac_ops = { > .set_mac_loopback = sun8i_dwmac_set_mac_loopback, > }; > > +static void sun8i_dwmac_rx_error_stats(struct stmmac_extra_stats *x, u32 status) > +{ > + if (status & RDES0_DESCRIPTOR_ERROR) > + x->rx_desc++; > + if (status & RDES0_OVERFLOW_ERROR) > + x->overflow_error++; > + if (status & RDES0_RECEIVE_WATCHDOG) > + x->rx_watchdog++; > + if (status & RDES0_SA_FILTER_FAIL) > + x->sa_filter_fail++; > + if ((status & RDES0_FRAME_TYPE) && (status & RDES0_IPC_CSUM_ERROR)) > + x->ipc_csum_error++; > + if (status & RDES0_COLLISION) > + x->rx_collision++; > + if (status & RDES0_CRC_ERROR) > + x->rx_crc_errors++; > + if (status & RDES0_MII_ERROR) > + x->rx_mii++; > + if (status & RDES0_LENGTH_ERROR) > + x->rx_length++; > +} > + > +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; > + u32 status = le32_to_cpu(READ_ONCE(p->des0)); > + u32 len = FIELD_GET(RDES0_FRAME_LEN_MASK, status); > + bool runt = len < ETH_ZLEN + ETH_FCS_LEN; > + > + if (unlikely(status & RDES0_OWN)) > + return dma_own; > + if (unlikely(!(status & RDES0_LAST_DESCRIPTOR))) > + return discard_frame | rx_not_ls; > + if (unlikely(!(status & RDES0_FIRST_DESCRIPTOR))) { > + x->rx_length++; > + return discard_frame; > + } > + > +#ifdef STMMAC_VLAN_TAG_USED > + if (status & RDES0_VLAN_TAG) > + x->vlan_tag++; > +#endif > + if (unlikely(status & RDES0_DRIBBLING)) > + x->dribbling_bit++; > + 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; > + } > + > + /* One buffer per chain descriptor; the reported length includes FCS. */ > + if (unlikely(len < ETH_HLEN + ETH_FCS_LEN || > + len > FIELD_GET(RDES1_BUFFER1_SIZE_MASK, le32_to_cpu(p->des1)))) { > + x->rx_desc++; > + return discard_frame; > + } > + if (unlikely(runt || (status & wire_errors))) { > + if (runt && !(status & RDES0_LENGTH_ERROR)) > + x->rx_length++; > + 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; > +} > + > static int sun8i_dwmac_setup(void *ppriv, struct mac_device_info *mac) > { > struct stmmac_priv *priv = ppriv; [Severity: Low] When len is below ETH_HLEN + ETH_FCS_LEN (18 bytes), this branch increments x->rx_desc and returns before the runt accounting just below it. Is that the intended attribution? Elsewhere x->rx_desc counts RDES0_DESCRIPTOR_ERROR. That holds in sun8i_dwmac_rx_error_stats() and in the norm_desc.c and enh_desc.c decoders. A frame that is too short is not a descriptor error. Two kinds of frame end up here. The first is a collision, CRC or MII error fragment shorter than 18 bytes. EMAC_RX_ERR_FRM now forwards these. Such a fragment falls through the error block because wire_errors is set and dma_errors is not. sun8i_dwmac_rx_error_stats() has already counted it in rx_collision, rx_crc_errors or rx_mii, and this branch then counts it a second time as rx_desc. The second is a runt shorter than 18 bytes without RDES0_LENGTH_ERROR set. It returns here and never reaches the x->rx_length++ in the next block, while an 18..63 byte runt does reach it. stmmac_get_stats64() reports x->rx_length as rx_length_errors. So the shortest runts are missing from rx_length_errors and show up as descriptor errors in ethtool -S instead. The frame is still dropped in both cases, so only the statistics are affected. The same code is still there at the end of the series, after the rx-all patch enables EMAC_RX_RUNT_FRM. Could the two conditions be split? x->rx_desc would be kept for the len > buffer size case. The short-length case would count x->rx_length (when RDES0_LENGTH_ERROR is not already set) and still be discarded unconditionally. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-submit-sun8i-rxall-v1-v4-0-af22aec6ae13%40gmail.com