From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Sat, 5 Dec 2026 23:30:45 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BA6A1F00A07; Sat, 5 Dec 2026 23:30:44 +0000 (UTC) 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== Subject: Re: [PATCH net-next 2/2] net: bcmgenet: add support for NETIF_F_RXFCS From: netdev-bot+sashiko@kernel.org To: florian.fainelli@broadcom.com 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 Date: Sat, 05 Dec 2026 23:30:44 +0000 Message-ID: <179651344418.3148.7595047173402615204@kernel.org> In-Reply-To: <20261204230048.3554713-3-florian.fainelli@broadcom.com> References: <20261204230048.3554713-3-florian.fainelli@broadcom.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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