Article View: linux.kernel.netdev
Article #27544Re: [PATCH net-next 2/2] net: bcmgenet: add support for NETIF_F_RXFCS
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 23:30
Date: Sat, 05 Dec 2026 23:30
173 lines
14562 bytes
14562 bytes
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] If NETIF_F_RXFCS is changed on a running interface,
bcmgenet_set_features()…
- [Low] net: bcmgenet: NETIF_F_RXCSUM stays reported active when
NETIF_F_RXFCS is on
--
net: bcmgenet: add support for NETIF_F_RXFCS
This commit adds NETIF_F_RXFCS support to bcmgenet. CMD_CRC_FWD and
RBUF_SKIP_FCS are programmed from bcmgenet_set_features(), and the FCS
trim in bcmgenet_desc_rx() is skipped when the feature is on. Changing
rx-fcs on a running interface is refused with -EBUSY and is applied later
by a netdev_update_features() call in bcmgenet_close().
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 93a773d0ccf34..35a0fe425acdf 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -814,14 +814,40 @@ static int bcmgenet_set_features(struct net_device *dev,
> u32 reg;
> int ret;
>
> + /* Frames already queued in the RX rings were written with the old FCS
> + * setting and cannot be told apart from new ones, so refuse a live
> + * change. The request stays in wanted_features and is applied by
> + * bcmgenet_close(). Re-applying the current features from open and
> + * resume does not change the flag and is not affected.
> + */
> + if (netif_running(dev) && ((features ^ dev->features) & NETIF_F_RXFCS))
> + return -EBUSY;
[Severity: Medium]
Does this block every other feature change on the device while an rx-fcs
request is pending?
The comment says the refused RXFCS bit stays in dev->wanted_features.
__netdev_update_features() rebuilds the candidate set from wanted_features
on every call and passes the whole set to ndo_set_features. On error it
leaves dev->features alone for every bit:
net/core/dev.c:__netdev_update_features() {
...
if (dev->netdev_ops->ndo_set_features)
err = dev->netdev_ops->ndo_set_features(dev, features);
...
if (unlikely(err < 0)) {
netdev_err(dev,
"set_features() failed (%d); wanted %pNF, left %pNF\n",
err, &features, &dev->features);
...
return -1;
}
...
}
So after "ethtool -K eth0 rx-fcs on" on a running eth0, every later update
carries the same RXFCS difference and gets -EBUSY here as well. That
includes user toggles such as "ethtool -K eth0 gro off", "sg off",
"rx off" and "tx off". It also includes updates the stack makes itself,
for example:
netif_disable_lro()
dev->wanted_features &= ~NETIF_F_LRO;
netdev_update_features(dev);
which runs on bridge enslavement or when IP forwarding is enabled, and the
upper/lower feature syncs.
None of these take effect until bcmgenet_close() runs, or until the
rx-fcs request is withdrawn. Each attempt logs "set_features() failed
(-16)" through netdev_err. The -1 return also makes
netdev_update_features() send a spurious NETDEV_FEAT_CHANGE.
The commit message says:
so a change on a running
interface is refused with -EBUSY.
Userspace never sees -EBUSY here. ethtool just reports requested and
active features that do not match.
Would it work better to pin NETIF_F_RXFCS to its current dev->features
value in an ndo_fix_features callback while netif_running()? Other bits
would still apply, no error would be logged, and the deferred change
would still be picked up by the netdev_update_features() call in
bcmgenet_close().
> +
> ret = clk_prepare_enable(priv->clk);
> if (ret)
> return ret;
[ ... ]
> @@ -3552,6 +3581,11 @@ static int bcmgenet_close(struct net_device *dev)
>
> clk_disable_unprepare(priv->clk);
>
> + /* Apply a feature change, e.g. NETIF_F_RXFCS, that was refused while
> + * the interface was running. The device is not running anymore.
> + */
> + netdev_update_features(dev);
> +
> return ret;
> }
[ ... ]
> @@ -2461,12 +2487,15 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
> skb_reserve(skb, GENET_RSB_PAD);
> __skb_put(skb, len - GENET_RSB_PAD);
>
> - if (priv->crc_fwd_en) {
> + /* Strip the FCS unless the user asked to receive it */
> + if (priv->crc_fwd_en && !(dev->features & NETIF_F_RXFCS))
> skb_trim(skb, skb->len - ETH_FCS_LEN);
> - }
>
> - /* Set up checksum offload */
> - if (dev->features & NETIF_F_RXCSUM) {
> + /* Set up checksum offload. The hardware checksum excludes the
> + * FCS, so it cannot be used when the FCS is passed up.
> + */
> + if ((dev->features & NETIF_F_RXCSUM) &&
> + !(dev->features & NETIF_F_RXFCS)) {
> rx_csum = (__force __be16)(status->rx_csum & 0xffff);
> if (rx_csum) {
> skb->csum = (__force __wsum)ntohs(rx_csum);
[Severity: Low]
With rx-fcs on, this branch is never taken, so no frame is handed up
with CHECKSUM_COMPLETE. NETIF_F_RXCSUM is still set in dev->features,
though, so "ethtool -k" keeps reporting rx-checksumming: on while the
offload is in fact disabled for every received frame.
The core does not resolve this for the driver. netdev_fix_features()
only drops NETIF_F_LRO and NETIF_F_GRO_HW when NETIF_F_RXFCS is
requested and leaves NETIF_F_RXCSUM alone. bcmgenet_netdev_ops has no
ndo_fix_features, so nothing else clears it either.
Documentation/networking/netdev-features.rst says this kind of
dependency between features belongs in ndo_fix_features.
Reception still works because the stack verifies the checksum in
software. The feature state shown to userspace is wrong, and nothing
tells the user that turning on rx-fcs also costs them RX checksum
offload.
Could NETIF_F_RXCSUM be cleared in an ndo_fix_features callback
whenever NETIF_F_RXFCS is set? That keeps ethtool -k accurate. The bit
comes back from dev->wanted_features on its own once rx-fcs is turned
off, and the extra NETIF_F_RXFCS test in bcmgenet_desc_rx() can go
away. That callback could also be where the live NETIF_F_RXFCS change
is held back, instead of the -EBUSY in bcmgenet_set_features().
If you would rather keep the offload with rx-fcs on, is it practical
to fold the four trailing FCS bytes into skb->csum before setting
CHECKSUM_COMPLETE?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204230048.3554713-1-florian.fainelli%40broadcom.com
Technical Details
Message-ID:
<179651344418.3148.7595047173402615204@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.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-378179-linux-kernel-netdev=dewy.ruReferences:
<20261204230048.3554713-3-florian.fainelli@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.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-378179-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 2/2] net: bcmgenet: add support for NETIF_F_RXFCS Date: Sat, 05 Dec 2026 23:30:44 +0000 Organization: Usenet Network Message-ID: <179651344418.3148.7595047173402615204@kernel.org> References: <20261204230048.3554713-3-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3142990"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:lMS+w0K2a1211xZ/2vZrMrf3zEI= sha256:wHBMtCISR9rFT/NNIgDiq7wvqfkW8+Gf1gmc1WizsWY= sha1:18a2fmPnT9Z594uxUr07R82J6y0= sha256:32J9GAUJaQfBReDvnih/0zpTsoflQr5q9oJLhoZoPxI= 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 CF08C117EC8; Sun, 6 Dec 2026 02:31:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.639 X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.14, 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, URIBL_BLOCKED=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 mEcuX6b0CEDC; Sun, 6 Dec 2026 02:30:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-378179-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id B48D9117ECA; Sun, 6 Dec 2026 02:30:47 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id BE4C260632F; Sat, 5 Dec 2026 23:30:46 +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=1796513446; b=YiZl/q97KdZo6fFNCiAikYah8yWD97k6okwD8lhMu1FOTD8l0hER4dkXEBh6Gi7EZ+gX zrboL6TWar6iLDhIzCxJ6PeozSX8Qt8Pnps5FgeaoDkg5av7Yd1y3RcT0GVuxCfOR+hRo kGVdkUi5UNySHrYoHwznNVOsFYUcMCaWpZGXLpc+yjNUZTCKaK+s31JzFGwZwqv30J9gy n6t3pRYf0UGV0o7FJByzWPns1mApVBWiuo2NsGWHBwQSamArBsNP0+7ypfEgQuUj4S3mC q2QGkd1cf0d80H0/G2sHwDA37psO/y4Kg4Ogv4RhML3h+XMIzwz72YYi38CGoQ94e+Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796513446; 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=VzVXTCPVsFPfrGrUn9cwI2vou1usDNBsBRxOX/4itks=; b=UsJlb6vflLzglqr7z21POV8S7MvwdevZOzMHdL3RzCD5HV1lgs7m4SRov1+UVpvyCcAC nmqbXuw5R7hQoClCbT1LU5uT5tDsTbCfKiSHCpEWmHCE2F8w9LuHbrtYaLf8RPIEQf/1V XxQjaSsSjaThXr7q0If7C0x113tLkYUvERs5G7s/m/ieFdFYfgEgfWxLQ0V5KH1u+qOQJ gMENy/QgFjXF87kQDCaNhcXWJ713AKR6SSAV0Uce5M+anlcrav6iH/r3E062Tj0TZkBRy Pgqovf8LLxeuzrO99g8wwCnQVlzLQT261D2y9kMXKizgORIFkiIxOodDazVCAX0vKbA== 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=nXsETXS7; 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 63CD9606A332; Sat, 5 Dec 2026 23:30:46 +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=nXsETXS7 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=1796513445; b=TMsOk1HUk4VOrv+aXtFS8Nh7vw02oV1BJrSy7+gHMG2oK7OuE8LrMI/bSmhp/ip3S+f/ +hWamUKk1RPGX3XX0M0fNJpYX0YGuvI6nM5noJKZaPg+WdVzPfMUSPW48eO8mk+lqqQkp rezBlHH6fmXuC9AKCZp7YjD8d+WoEUWKLqrOoFVrbFp9ykNine/AJuhdhg89SHxppdYC8 zI6PALqXYhioMSJoP01IUbNjk2tJlvfkN8uSCeGkrFyoYsNfrfSdb4tCNjfZM6GVkLs7V bPku6rkR5AWVw/3tchah7TWuKMgN4GbKSma71fARoYmj7v/5qBZ1HswjgeG6+maSo2g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796513445; 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=VzVXTCPVsFPfrGrUn9cwI2vou1usDNBsBRxOX/4itks=; b=KWq3RZXwn4KLyLSL4r1V6EPyj1E3u9inCT1GHrtwRNUmfLMfKe9jnsf4exW2oeo0+bOo 4CuzmuOSIgtOramO7N9QntoxMRjGeuTfuc+IsvUrpsgguLzleL0zt5x3Wcii7NNS8ACIS 0Dm5YI4fS+WL4+eyrP0ju8gshC5USxgKXJNPhecLzmly+Ba7wOC82BwuzAG+fIYtDilBX FuwIhkWMwLlSKeydm9YU890AkikM5A735MKqh9VyU6eGW4OcUsPL2CANcfMYt5ddlg9bO xDj2B8CClQMS1AQHmb/dtqc90rV1heq6e6Rp5ht7yQiPXhxc+AWgg9gimje730ekLug== 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=nXsETXS7; 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) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8590E606A338 for <netdev@vger.kernel.org>; Sat, 5 Dec 2026 23:30:45 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BA6A1F00A07; Sat, 5 Dec 2026 23:30:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796513445; bh=VzVXTCPVsFPfrGrUn9cwI2vou1usDNBsBRxOX/4itks=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=nXsETXS7m8O9QrmIHF+RsC6kMKCKwXNjLPi5K7qkYF9UYcioMzHFakICVKLYfNPvu uR1zPQZq3yFbkwUpv+HXIgKuFHohzIjyxbkMIWmBL1oCVsHJJ3voxNzfEhlE52WWAV 5+PtPlIP0BL4DIUzmOvzdjGtQ5XqMQiy8KRnWuRHj7QjVXGPlSHGT5vPINQ7FUaQcn PxxLGdF3EuVsmj3jqtit8EEXkm3O3HCjB/M0v15Ll6vl4SdDi0Mtb+cEN9SzE2Fhgg pJtVMGkha8G2tTGbAlOBCOdnn/Gt275e0h50vGzdC8KI55meKBmN89umBMZoNInd5x YWLTe4U6G3kkA== X-Cc: netdev@vger.kernel.org, opendmb@gmail.com, nb@tipi-net.de, bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com X-In-Reply-To: <20261204230048.3554713-3-florian.fainelli@broadcom.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: 14365