Article View: linux.kernel.netdev
Article #26191Re: [PATCH net-next v3 3/4] net: stmmac: add common RXALL handling
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 07:28
Date: Thu, 03 Dec 2026 07:28
110 lines
11909 bytes
11909 bytes
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
Technical Details
Message-ID:
<179628288840.3146.15996822646593537048@kernel.org>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376371-linux-kernel-netdev=dewy.ruReferences:
<20261201-submit-sun8i-rxall-v1-v3-3-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!peer03.iad!feed-me.highwinds-media.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376371-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 3/4] net: stmmac: add common RXALL handling Date: Thu, 03 Dec 2026 07:28:08 +0000 Organization: Usenet Network Message-ID: <179628288840.3146.15996822646593537048@kernel.org> References: <20261201-submit-sun8i-rxall-v1-v3-3-01aa6280e6ae@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2404867"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:If39pWP395V9X94ll3SpT7kn1Dc= sha256:tkPWjnYnvguQ65tvrn1Ili941u80BwZNqKjycRqVJLg= sha1:TIu8UoEq9/vlFKVNMttr6+iZ/HA= sha256:KJu5rWr4wqckOVvmK8sQEoI9Vk2xNxYe9wM/Jpi3H2g= 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 E46D3117862; Thu, 3 Dec 2026 10:28:27 +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 lX-eDJdqmj2h; Thu, 3 Dec 2026 10:28:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376371-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 3894311783A; Thu, 3 Dec 2026 10:28:15 +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 14A192157B; Thu, 3 Dec 2026 07:28:11 +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=1796282890; b=BhQQm6kYKV8QCWEnk6jTtmvoDLAoXWDCsKO1RtJmtpHaj66SN0DQKEqFI2r/UPKrE/fU UM5+uBWsbjD9ez9yTNPGSfWSvDdLQ0uUg1pcIcMoIWjp3dE9gUJJH6ctfGCckuWK74QNO CAe1uKWAiLEmAEWe4xCJbKC4gHgIfxbDOPjfZjmz5dzkvVxUx6+bXVVTnMjE0DSmIHXNx K8qlWBdGPrULuxg6Jjrycy7vjbD2aPLnZ14T87BhIaANZWZCzB4mCztuZXepReZDXBk+K 2IwnMTqlOeOiM8dDMn4qTxuB2eiObP5RDBxSdGHmj7UJHAow/5Hr6mxhj8eP7wEkARw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796282890; 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=APbqEUduzgiRWSSaLxfxEFMwn4kgGIzUAyb2m3ufC8Y=; b=v5n1Tl+G/cNDjfZaFZRZHztlYDbw1mnC281Zq0Vya27uJosQCYZcwn+m4odSS/d4cCDk /Ib69mklGpLpLCb4u3dCff+2UJRruuaE5HpzHDIGyPPBxcwqGOhy/sEXtk5imMJ1u4AZA 5vOcQC3aJE6Gu+ZOUPGHt3ydvamvvOLrMhCS1j95Ts6/2xUcjTBuCRJl+hAQXlx7nkxID DY5RJ1CmVwKIvjMOW6wJa+NBvVeeUimgeBOLrUqMQFB2jY8hX15lQpMR2GBzEmqqZIq2/ +honGquBxnLWdNP2Nnl3TUI7mHXwLWKotcZLuI00GGDk+5Ny/S+eRdTwXcmkf8Ap8CQ== 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=KyLwkemW; 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 D9B39606A32C; Thu, 3 Dec 2026 07:28:10 +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=KyLwkemW 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=1796282890; b=QbRtMv1HlOlqNc4rHkSOF0SehptMdkCAdjZa0GT6JZcfC+69+qTc8OBYvcNGxp7ldv5o gSZ1KmZ/f8vXdYt0V+Uud3KqDtTOrjMufmYeWkQ5Hjrh0J9FDBogW3FPl2oYbk3oH8PwA s2v9oMHjpjuo5jPrMj9Mn0n/dCnfVnqwkXSXipW2AtY1jUQ3qR65uDrZK/1CDfdkGmIAU EjtvNBRT0BPNM3NzhGBp5nBt96zfiA+wwC79SlqeJIQJBHgSrwNys3bDUvW8gOuGYLurn WhoW6yeQ9OHOxuwB5JtPTofed5qP6N6tbZ17QmOdy+OGg7cj4w0HCet2Z5ooLFhKkqQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796282890; 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=APbqEUduzgiRWSSaLxfxEFMwn4kgGIzUAyb2m3ufC8Y=; b=uD1PZLgLDEsxSmilgArzqLWosrxkIXrePzQVn+1qyHtP4kedAOBygs9tg6LPmmsu47mo +IVTMelZ5rSUH0A66UtakPvcTAexWQxEw9cjO9ua+CqSEs8TdgxybgWhL0bAH5+Rxs1X8 BAHHX+rCeZUpdButAfMsFwPS5pw0dlrEq9G7Ct2k1RPza5I3axQCa1ZNdtNwJ2chpHDrw pcKuQVKYm5wBSJJuSVl6apXFkgqkhKCaSkbQoHC0j0Us1oZieJuPML+qgrvIt1miwLCim YKdfgrQl5TbAXBiFoBoxIFC6IrNAhD4po9z5lOpaKcuHaPeqJWXXwgzDnxBIWE9C7hg== 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=KyLwkemW; 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 01C24606A32F; Thu, 3 Dec 2026 07:28:10 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8D5B1F00898; Thu, 3 Dec 2026 07:28:08 +0000 (UTC) X-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== 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-3-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 X-Received-Bytes: 11712