Article View: linux.kernel.netdev
Article #26192Re: [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 07:28
Date: Thu, 03 Dec 2026 07:28
106 lines
11684 bytes
11684 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] 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
Technical Details
Message-ID:
<179628289003.3146.14023443061034999351@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.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-376372-linux-kernel-netdev=dewy.ruReferences:
<20261201-submit-sun8i-rxall-v1-v3-4-01aa6280e6ae@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.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-376372-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all Date: Thu, 03 Dec 2026 07:28:10 +0000 Organization: Usenet Network Message-ID: <179628289003.3146.14023443061034999351@kernel.org> References: <20261201-submit-sun8i-rxall-v1-v3-4-01aa6280e6ae@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2404918"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:qQSBa/W0gLZusZan82yBt0rNUJQ= sha256:GHhS/abxwHtk+ZwVMRy0rgcz0AfXIgLYsuyRUL4rUhY= sha1:BZWFtikR8946+Vn5qjadngXzzO0= sha256:Wz1HvhW7AQp8I3rPqXPUIUeoZwRCWogaxmfQQnvAWlQ= 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 B6920117862; Thu, 3 Dec 2026 10:28:31 +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 aC_0qVfwzvF7; Thu, 3 Dec 2026 10:28:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376372-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 F0508117866; Thu, 3 Dec 2026 10:28:19 +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 9BC9C221C9; Thu, 3 Dec 2026 07:28:12 +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=1796282892; b=GF8w+1Yr3T0YOmZPyeRhMtAqmint+MazJmGzH0pc4v0E/jzeeKhtpudqAEoT/QDu/vuz EiBe46BQersT4aIlaCxY+ZvcwhS96pws4fiXvkYs5wWbqExgOZ14GWz0OpR64upOPu0bs QBKuQQfUCs+AA6XihuaHsnD05o7u+fR0O5sqOjuIFTSczyry1qFBdZNeAoCSv/nRS10jS XyWxjsI91lX9Fh/ci4OzZ8Q9XEJmsvjlmxEtRmNloOk/sYmb0O46oxed3BNF1RgnbN50W PpvU06zdi3BkVH++/W6puQOO6Acha7DetyC+IoEp2QHnQJJBmynTIIFz+gAYuE1ewGg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796282892; 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=LUvxKGPvSL6JAhA+cMmU5iOnzXU0jbHhFaRHH5oO0Ek=; b=ih/vXzNA3BcphrYC/EsVz06uU3Ia5tW2Q74CGKX9suBh7GOPWuYun4o4aLvf+e8m5aoG PZm6yCUDpQkePuVS6gVTt7yNIJp6PM3sRIp5ZakWYNd4HDNkDIRp1CvIpe6I5Cr60jDcW 7rUegAN5Iyw12hbJB8zjLFoFEzPHM7PJ2jQK5VKQUmGUrHmhfQeDzdsclA6T7r4AsMm92 kgbXWR4nZTo7tzP+URmuo15H0MS5ksGCw1rtqKWNKiaw63m7EyWMIOP8B3s91yDZK6vd3 4A8Mq1fP7IoKMQzxYrZcYtRpIfUX8TGNlxdGBWFgMbVitqK3qjnxMwa/Vwws9LemAlQ== 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=XeDhny6c; 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 6DBB5606A333; Thu, 3 Dec 2026 07:28:12 +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=XeDhny6c 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=1796282891; b=RMYh8lZn65zbhqfawl/l82bABEcVY7MjeIsHaMfQ82ZXeDZbc/jeMd/9RqkVk/lX8ElG lsCv36DxNjhLG7ofrZuKj0+Txm/2ypZQ3n+FQ2f3v8++u6I8TKRU/1k1o4vrDZjlAgdq7 jxmvG9BxZ4+NN//gSm0RBrLSVNVlBCwSIXvY9XytbRa813816pu9Wxd9kHkhAf7dzWRtZ AEDQnc2HR49bIp0eAJBN8nwW9wkrnhBGM/vMaSR1m7ZjmDToABuNOn3oBBs8CRPTGXY5n h0K2/616JC/vBOdn2OBwpBDKJ1z1za5NiovOsIsm/CvFqBGRbkMatplOXaNkKD60WGw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796282891; 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=LUvxKGPvSL6JAhA+cMmU5iOnzXU0jbHhFaRHH5oO0Ek=; b=FfnhvK3lhoIdKkLy6uk1mmE3zPL+ZsGR0RbyvhzhJNK7zOlt/pVKqrL+ElJVhnUotQmh kauU/1EO93GDL2CoWWH0AoNmjhTf0jr27QzmgMdIC4/wxHFf6PDLzOWoxosEFHPlIivvO I76n5eGO92XfOuwUTE11M/sKnqapblPRU6EylyMf8846QnGL0RAqtVbb1/ySgxGL8keFb OSIdyP/OVwpKHhNNd4sIfHd7R6UdVQRrKnR0H0v8dXY8x1yURT0/sN533wTEkXUB3kIHl 3HY3/Tz7kEuuIzWtICjJqVUkAS9dhHmRdNP+GzirzwS3RNjMXnVFiM4c8l6SeDzdloQ== 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=XeDhny6c; 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 8D678606A330; Thu, 3 Dec 2026 07:28:11 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A03F1F00896; Thu, 3 Dec 2026 07:28:10 +0000 (UTC) X-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== 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-4-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: 11487