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 F14B5606A322 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=Z09sR2BS; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KyLwkemW 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=APbqEUduzgiRWSSaLxfxEFMwn4kgGIzUAyb2m3ufC8Y=; b=Z09sR2BSUDiPOkQIeWai7mrdhQ aD5zsJxmscpypY4V3hhqtbMf9rNmvPTDsOaltY4GUsmDlDRJG+ETsOFbrYzwYYLg1GkueT9ajT2iB 7BaLldlo1E754l7T1XCceFdV9SJzrdAiMOXXT23SQ4XtVOA5aZYLGtVsEzyjRI6l2ThgW0VGkCzpc 26S4TauaGR6CVZ87m8NTjtEZ7HfYFKmeX3HHWn9jJU+t3hV3mFxEIqio2k6B1jQJbftzoVDhTwESR Hz/PtX5fml7lriZQGIili7wTZHplWuE/JmdzqV6EELFEUqJfy1JXRQHOzq4uCjIJwZoeiff+IbL44 pDuNGwPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ1Ej-0000000DkWM-48dw; Thu, 03 Dec 2026 07:28:13 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ1Eg-0000000DkVe-22um 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 EFA5C44741; Thu, 3 Dec 2026 07:28:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8D5B1F00898; Thu, 3 Dec 2026 07:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796282889; bh=APbqEUduzgiRWSSaLxfxEFMwn4kgGIzUAyb2m3ufC8Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=KyLwkemWY0um/Sdoyq1kP2yNuM9S6lCdm5zn5K27N3CTJ4ufnnBR9DsKSRCLQunu7 QTpiSPmcidaPAHHWmnsVx2bc0vuPfgJlVwwXvtKPki7EPAw89K3HxO6lXmTp16geNN VIOgl6wQ1/+glZf8VwBnENehWIeS0bgyWcSti+AVa71vyqOTddDwGRyrNJ1DCDZaMy jLbdiG+C4PQyLaog9mfTqj/7qRruAyl8gEpRcdvwY7ydp1xqpydmBsnt50ebIW5ARR XgRY0rN6X0koOYcZCUJL0fnOYIf6ciZ6nBcJ7qoqFP0g0sHy3Mv77+Bc58eMMOph8Z /yTD/N0kl0nWQ== Subject: Re: [PATCH net-next v3 3/4] net: stmmac: add common RXALL handling 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:08 +0000 Message-ID: <179628288840.3146.15996822646593537048@kernel.org> In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-3-01aa6280e6ae@gmail.com> References: <20261201-submit-sun8i-rxall-v1-v3-3-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] The new stmops->set_rx_all() hook is called from stmmac_set_features() holding only RTNL and the netdev ops lock. -- net: stmmac: add common RXALL handling This adds an rx_error_frame status so a MAC can mark complete frames with wire errors separately from descriptors that must always be discarded. With NETIF_F_RXALL enabled, those frames are delivered without being counted as good packets. A new set_rx_all() stmmac_ops hook is called from stmmac_set_features(), and rx-all is advertised only when the MAC provides that hook. > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 70157efc22559..8102a72c52c5d 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c [ ... ] > @@ -6462,6 +6475,11 @@ static int stmmac_set_features(struct net_device *netdev, > stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan); > } > > + 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); > + [Severity: Medium] Is anything serializing set_rx_all() against other writers of the same MAC register that run without RTNL? stmmac_set_features() calls the hook while holding only RTNL and the netdev ops lock. The new set_rx_all member in struct stmmac_ops does not document any locking or context rules for implementers. The only implementation in the series is sun8i_dwmac_set_rx_all(), from "net: stmmac: dwmac-sun8i: support ethtool rx-all". It does a plain read-modify-write of EMAC_RX_CTL1: dwmac-sun8i.c:sun8i_dwmac_set_rx_all() { 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); } sun8i_dwmac_flow_ctrl() also does a read-modify-write of EMAC_RX_CTL1: 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); ... writel(v, ioaddr + EMAC_RX_CTL1); } That second function runs from the phylink resolve work item: phylink_resolve() phylink_link_up() stmmac_mac_link_up() stmmac_mac_flow_ctrl() sun8i_dwmac_flow_ctrl() phylink_resolve() holds pl->phydev_mutex, phydev->lock and pl->state_mutex, but not RTNL. If "ethtool -K ethX rx-all on" runs while a link-up is being resolved, can the two read-modify-writes interleave and lose one of the updates? One outcome is that the EMAC_RX_RUNT_FRM change is undone. Then dev->features shows rx-all on while the MAC still drops runts, or the reverse. The other outcome is that the negotiated RX FIFO flow-control and threshold bits are cleared while phylink believes TX pause is active. The sun8i commit message says the direct register update is safe because RTNL serializes it with open, close and reset, and because the IRQ handler does not touch the RX threshold. Does that reasoning cover the phylink link-up path? > if (features & NETIF_F_HW_VLAN_CTAG_RX) > priv->hw->hw_vlan_en = true; > else [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-submit-sun8i-rxall-v1-v3-0-01aa6280e6ae%40gmail.com