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 E5E75606A32C for ; Thu, 3 Dec 2026 07:28: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=ZlssY7ff; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XeDhny6c 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=LUvxKGPvSL6JAhA+cMmU5iOnzXU0jbHhFaRHH5oO0Ek=; b=ZlssY7ffwkT3JSO+KkHlCqvVo5 VX+HvQ8/LIUWg7EYw08KMtLQAVgPxJM3lZLMYJvLBW0I2LgGNLVcEpnK0cN2u4/eD3AeZqFYr9/bG qfcOVq/Y5aVggL1kTC4wVbCTLncQ3Oh8O56fKuunHH26LwguZlEF1K6CXmLPLaPX+6NrUqnCbIwCX Pq179iiMPNdmoRTZosN105ZU+vmJyhEM68Cv2dUak0WSKYjqnIdQ7FPBYg7bgv842BawUzl8vgAPQ VpROrNY9v4qLihe9Lk46DjQ8pFQeSFHYjnaOtBJbT22lcTxPC/PQhXaU42Z/E2AOMRMYopJ+6RV6+ xPLweiOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ1Ek-0000000DkWW-0K20; Thu, 03 Dec 2026 07:28:14 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ1Eh-0000000DkVm-3Axt for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 07:28:11 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 8350244173; Thu, 3 Dec 2026 07:28:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A03F1F00896; Thu, 3 Dec 2026 07:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796282891; bh=LUvxKGPvSL6JAhA+cMmU5iOnzXU0jbHhFaRHH5oO0Ek=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=XeDhny6cG31IwHwIGLGmbQTwAdy7iPEI7mevhO3fs2yb1m0p3mLUdNZX26opxGvZr As+sKnFBFQQEzBbxV363TQy31T8BWB0LuRnWdrQMF6v8KqRzGT5TY3/VeZ+bZHCjxp //my7e1wqZcR1ICU2k94Ko+tGq25bvdNr4kT4Geu5FTZJShvqKwm4J6H+65fSOoouK 8K9zvHO3ttXdEhwkV8g0jG2tw5H/MMBK1WT5uGpJ/HFMOyjZeoVUnUin7L6v6rnD66 8M5nFaQjSHloNxs8mwfl4kbtN5Dwyxs6yL4it5hMNEix7/0Lz6b/NLQGnLgQrLi7nM zQh4cIT/eZWPw== Subject: Re: [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all 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:10 +0000 Message-ID: <179628289003.3146.14023443061034999351@kernel.org> In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-4-01aa6280e6ae@gmail.com> References: <20261201-submit-sun8i-rxall-v1-v3-4-01aa6280e6ae@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=-10.9 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 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · 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] sun8i_dwmac_set_rx_all() (drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c:665-674) does an… -- net: stmmac: dwmac-sun8i: support ethtool rx-all This patch adds rx-all support to dwmac-sun8i. Runt forwarding in EMAC_RX_CTL1 is set from NETIF_F_RXALL at core init, and a new set_rx_all op updates the bit on a running interface. Frames with complete wire errors, runts included, are now returned as rx_error_frame | csum_none instead of discard_frame. > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > index 8377dc7985377..c1c5ab38022ac 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c [ ... ] > +static void sun8i_dwmac_set_rx_all(struct stmmac_priv *priv, bool enable) > +{ > + u32 v = readl(priv->ioaddr + EMAC_RX_CTL1); > + > + if (enable) > + v |= EMAC_RX_RUNT_FRM; > + else > + v &= ~EMAC_RX_RUNT_FRM; > + writel(v, priv->ioaddr + EMAC_RX_CTL1); > } [Severity: Medium] Can this read-modify-write of EMAC_RX_CTL1 race with sun8i_dwmac_flow_ctrl()? The commit message says: "RX_CTL1 also controls DMA, but RTNL serializes the ethtool update with open, close and reset. ... The setter can therefore update the register directly." sun8i_dwmac_flow_ctrl() also does a read-modify-write of the same register: drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c:sun8i_dwmac_flow_ctrl() { ... v = readl(ioaddr + EMAC_RX_CTL1); v &= ~(EMAC_RX_FIFO_FLOW_CTL | EMAC_RX_FLOW_CTL_TH_ACT | EMAC_RX_FLOW_CTL_TH_DEACT); if (fc & FLOW_TX) v |= EMAC_RX_FIFO_FLOW_CTL | ... writel(v, ioaddr + EMAC_RX_CTL1); ... } It runs on every link-up from the phylink resolve worker: phylink_resolve() phylink_link_up() stmmac_mac_link_up() stmmac_mac_flow_ctrl() sun8i_dwmac_flow_ctrl() phylink_resolve() takes pl->phydev_mutex, phy->lock and pl->state_mutex. It never takes RTNL. The new setter is only protected by RTNL in stmmac_set_features(): if (((netdev->features ^ features) & NETIF_F_RXALL) && netif_running(netdev) && netif_device_present(netdev) && priv->hw->mac->set_rx_all) priv->hw->mac->set_rx_all(priv, features & NETIF_F_RXALL); Close and reset go through phylink_stop(), which stops the resolve work, so their RX_CTL1 writes are safe. The ethtool path does not stop it. So "ethtool -K ethX rx-all on" can overlap with a link-up resolve. If the worker reads RX_CTL1, the setter then writes RUNT_FRM, and the worker writes back its stale value, RUNT_FRM is lost. NETIF_F_RXALL then reports on while the MAC still drops runts. The opposite order can also happen. The setter reads, the worker programs the negotiated EMAC_RX_FIFO_FLOW_CTL and threshold bits, and the setter writes back its stale value. The flow-control setup is then lost until the next link change. Would some locking between the two paths be needed here? If not, could the commit message be updated to cover the phylink resolve worker? [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-submit-sun8i-rxall-v1-v3-0-01aa6280e6ae%40gmail.com