๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27543

Re: [PATCH net-next 1/2] net: bcmgenet: keep FCS forwarding when exiting Wake-on-LAN

#27543
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 23:30
117 lines
12193 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Not a bug in the final state of the series; kept only because
  requires_validation=true.
- [Low] Not a bug in the final state of the series; kept only because
  requires_validation=true.

--

net: bcmgenet: keep FCS forwarding when exiting Wake-on-LAN

Before this change, bcmgenet_wol_power_up_cfg() always cleared
priv->crc_fwd_en. It now sets it from NETIF_F_RXFCS in dev->features and
clears CMD_CRC_FWD in UMAC_CMD only when the FCS is not wanted. This
prepares for a later change that adds NETIF_F_RXFCS support.

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
> index 984432952963a..ff34c4df4f4ab 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
> @@ -223,7 +223,8 @@ int bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv,
>  	}
>  
>  	clk_disable_unprepare(priv->clk_wol);
> -	priv->crc_fwd_en = 0;
> +	/* Keep forwarding the FCS if the user asked for it */
> +	priv->crc_fwd_en = !!(dev->features & NETIF_F_RXFCS);

[Severity: Low]
In bcmgenet_wol_power_up_cfg(), this assignment runs before the two
"already reset" early returns:

	reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL);
	if (!(reg & MPD_EN))
		return -EPERM;	/* already reset so skip the rest */
	...
	reg = bcmgenet_hfb_reg_readl(priv, HFB_CTRL);
	if (!(reg & RBUF_ACPI_EN))
		return -EPERM;	/* already reset so skip the rest */

If either return is taken, bcmgenet_resume_noirq() falls through to
bcmgenet_umac_reset(). bcmgenet_resume() then takes the "MAC was reset"
path and calls init_umac().

In init_umac(), reset_umac() clears CMD_CRC_FWD. RBUF_SKIP_FCS, though,
is set from crc_fwd_en:

	if (priv->crc_fwd_en)
		reg |= RBUF_SKIP_FCS;
	else
		reg &= ~RBUF_SKIP_FCS;

Once RXFCS can be turned on, could RBUF_SKIP_FCS end up set while
CMD_CRC_FWD is clear?

At this commit, crc_fwd_en is always 0 on this path, because
NETIF_F_RXFCS is not in hw_features.

The follow-up patch "net: bcmgenet: add support for NETIF_F_RXFCS" covers
this. bcmgenet_resume() calls bcmgenet_set_features(dev, dev->features)
after init_umac() and before bcmgenet_netif_start() enables RX. After
that patch, this call writes CMD_CRC_FWD, crc_fwd_en and RBUF_SKIP_FCS
together. So by the end of the series, received frames should never see
the mismatch.

[ ... ]

> @@ -248,10 +249,11 @@ int bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv,
>  	reg &= ~RBUF_ACPI_EN;
>  	bcmgenet_hfb_reg_writel(priv, reg, HFB_CTRL);
>  
> -	/* Disable CRC Forward */
> +	/* Disable CRC Forward unless NETIF_F_RXFCS needs it */
>  	spin_lock_bh(&priv->reg_lock);
>  	reg = bcmgenet_umac_readl(priv, UMAC_CMD);
> -	reg &= ~CMD_CRC_FWD;
> +	if (!priv->crc_fwd_en)
> +		reg &= ~CMD_CRC_FWD;
>  	bcmgenet_umac_writel(priv, reg, UMAC_CMD);

[Severity: Low]
With this change, priv->crc_fwd_en is set from two different sources.
bcmgenet_wol_power_up_cfg() sets it from the user's NETIF_F_RXFCS
setting. bcmgenet_set_features() still reads it back from the hardware
and never writes CMD_CRC_FWD:

	/* Make sure we reflect the value of CRC_CMD_FWD */
	reg = bcmgenet_umac_readl(priv, UMAC_CMD);
	priv->crc_fwd_en = !!(reg & CMD_CRC_FWD);

bcmgenet_desc_rx() also strips the FCS whenever crc_fwd_en is set:

	if (priv->crc_fwd_en) {
		skb_trim(skb, skb->len - ETH_FCS_LEN);
	}

Looking at this commit alone, wouldn't bcmgenet_desc_rx() trim the FCS
that the new comment says the user asked to keep?

As the commit message says, this has no runtime effect at this commit.
NETIF_F_RXFCS is not in hw_features, so the expression always evaluates
to 0.

The follow-up patch "net: bcmgenet: add support for NETIF_F_RXFCS"
resolves this by the end of the series. It makes bcmgenet_set_features()
program CMD_CRC_FWD from NETIF_F_RXFCS. It also changes bcmgenet_desc_rx()
to trim only when crc_fwd_en is set and NETIF_F_RXFCS is not.

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204230048.3554713-1-florian.fainelli%40broadcom.com
Technical Details
Message-ID: <179651344306.3148.4944015682516225848@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378178-linux-kernel-netdev=dewy.ru
References: <20261204230048.3554713-2-florian.fainelli@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378178-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/2] net: bcmgenet: keep FCS forwarding when
 exiting Wake-on-LAN
Date: Sat, 05 Dec 2026 23:30:43 +0000
Organization: Usenet Network
Message-ID: <179651344306.3148.4944015682516225848@kernel.org>
References: <20261204230048.3554713-2-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="3142913"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:i6cs6jPBOxinCFxJdbzpoePy8xQ= sha256:kgdzXIe0woIKD5p2bB2/X5SM7EexPBOsq4e2eMsGCrk=
	sha1:cagt4xnZB5ug3iX0oSKHpfoojM0= sha256:3kIuig4DouG6DTkyp5p4L1TLmGcjrmd5pFAfbc03AJM=
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 E6268117EEB; Sun,  6 Dec 2026 02:31:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 HknQ38wj2jCE;
	Sun,  6 Dec 2026 02:30:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378178-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 9DBA6117EE8; Sun,  6 Dec 2026 02:30:49 +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 878B732B9F; Sat,  5 Dec 2026 23:30:45 +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=1796513445;
	b=BElDssh3GUBern/kq74j6pSJyNcS//Akg88XyPKxHhgFeyTzyksq3idHqA0yxCdPEZoV
	 lt1leWd4dRYGzRN0vB4iEzFlm1LoE6ZJnWaEB1mYNEwDlOu/3K1mNum7dUepPnJYRP78M
	 CL8R0M7AvRiaVYQllSrtP9QGvbx8UsdBme33W1cgIrJaXfAya6l+ZExoc1C7Jr4EAusAY
	 sokRIDGiZFbVcyfbWMAYsAjiX5LoTEDBqkC0LzSzf8vejrc5aYUDc7kL1H8B4QH0VnAa1
	 YGHz5KGrAXVXwf3ZuZQFNArTwEh1WntIkjib4M9u9xMNZsuMjmNRDlmvChNoTHvDAWw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796513445;
	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=oSDWWTRoWhvW8And9pSwzs8X2+EczAG7TWeDn5Vb6YU=;
	b=HAzEdkl3BwAaUlTvK1nUuQ9wpBR5hogBRMIsjlmsALcperxumRfTXMbiwRCXGtNXyLCh
	 BB+TkIbk/qgiq4cXAHFYmttV+5Obqukr3UDq7rkep51kak/9BeagmyxEWtvbtj1uCl3vj
	 TIMunFpXHv7F8q1S+31pLBE/dmdGvej5DgrhfLq/vzkj/wyf1okk5T8xUp2jlBnL6Tw+v
	 EBnZO5zNtqK29VHsN5J/TEDzzs9Uh98EOMdoO2djhYmPnTV8jLKCdpVNnl7bbpIEdXYsj
	 Pys+Z1u2yS6v7WeI8aRQUcnEoaS0dMRnAZ2gScTTcYYT8xgG6TS/KjQ6rtbr3B7bY7A==
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=bECTnVXm;
	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 2AD0F606A334;
	Sat,  5 Dec 2026 23:30:45 +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=bECTnVXm
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=1796513444;
	b=hfI1gQqh7JbmSGpF5J3r2fEzam96tJxBjsiZ6pTL+rrfSl9pBZ5D9VaGB8pmcerDx10k
	 H6saBS173kWIrH4iybkI0+c28GpF620vAUrGb33cwe39I9tGVTcnKvGEd9rLgioyEdT2Q
	 twD7RRThmD1tSVBTblTdjcqX/QiZeyk3j1+UJnPz/NqB2ydezoBBrw3+53GpTvOdIOgsm
	 Qcar1oRddTXS8YJeBq9gbh9ft0NwRqH1tkxFiPfESuyI71uEswQv0lgyXrVIT0D+Rd1/q
	 59LbKNhmBWP+XqY/Nsrnx0Md69ktHgemwUZ9nBn+bUe+qyPyvaYZnKytcIAT45KmTkw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796513444;
	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=oSDWWTRoWhvW8And9pSwzs8X2+EczAG7TWeDn5Vb6YU=;
	b=ENgplqFgopqwIi2aciJ/PzM98alyEyE4Tz0Rs54A50YL0hObDnjxUFiYPbI+2jQ0D9yI
	 6kn2hw1MXa/yNOkiEgcdbRckV63XImWylBXlAz/NhZJneV5UiGdM1AGtAHdwHCfCIsYdm
	 +MMknYR7oGQ0y7MpvQtbkoB4Kd87GtFZn3gB2xvrapzpxZwb5xYn5LSAlhgT90uQoCg+3
	 nNfx5lJczgITqaQRVcYTEquadDN1ZWvcAfVqghWtiIv6VIm9h+1388uap5EaNLXiWVeix
	 Fu9GrgbXCZ976sJC6nDQWCG1S6OrHd8kmgngkJTq5m2IklaJfIQES635wa2yDMGQO6A==
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=bECTnVXm;
	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 49F3B606A31F
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 23:30:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 824BB1F0092B;
	Sat,  5 Dec 2026 23:30:43 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796513444;
	bh=oSDWWTRoWhvW8And9pSwzs8X2+EczAG7TWeDn5Vb6YU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=bECTnVXmafqXwioi7suYCnEpTPbAr6F5GM1S2nGCIyDTdQTnhyLHfE6TreX/p+uKA
	 7xX6HtOTJQI5GbzLHnRii/0b2s0EeRdo6+dbIHJ61E7otJlE+glq4yqFEDEKuGjw9U
	 YYr9DUq1yqAMvq1xpnEHMzXf0Q8E3ckT8PbJ9VapNpunIb9HEThsjpgswyXZI5JBcG
	 4VPCkrBp4PjJILR9s/Rd7p8TQeucIqtk7IeXITsBfpLIPH1kW8/IHSI81F9oFvknU6
	 Zm9tIu5ixWxofUSbthxwtWjWVchfWY3Rg2ztOe8NRM3IMc+xbXVGkCEqcl2WpxdVqw
	 lozmLWnflqm0g==
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-2-florian.fainelli@broadcom.com>
X-sashiko-severity: Low
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