All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: amd-xgbe: support receiving packets with bad FCS
@ 2026-08-12  9:16 James
  2026-08-14 10:09 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: James @ 2026-08-12  9:16 UTC (permalink / raw)
  To: Raju Rangoju, Prashanth Kumar K R; +Cc: netdev, Thomas.Lendacky, James Nugraha

From: James Nugraha <aslan.jnn@gmail.com>

The driver currently sets the MAC_RCR.DCRCC bit whenever RX is enabled.
This disables hardware FCS validation, causing packets with a bad FCS to
be accepted unconditionally. Users cannot control this behavior because
the driver does not advertise NETIF_F_RXALL.

Advertise NETIF_F_RXALL and disable it by default. Update DCRCC when the
RXALL feature is enabled or disabled, and preserve the selected state
across RX and link stop/start cycles.

Fixes: c5aa9e3b8156 ("amd-xgbe: Initial AMD 10GbE platform driver")
Signed-off-by: James Nugraha <aslan.jnn@gmail.com>
---
Tests:
- Verified invalid-FCS packets are dropped with RXALL disabled.
- Verified invalid-FCS packets are received with RXALL enabled.
- Verified invalid-FCS packets are dropped again after RXALL is disabled.
- Verified the RXALL setting survives RX stop/start.
- Verified the RXALL setting survives link down/up.
- Verified RXALL is disabled by default.

 drivers/net/ethernet/amd/xgbe/xgbe-dev.c  |  3 +--
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c  |  7 ++++++-
 drivers/net/ethernet/amd/xgbe/xgbe-main.c |  7 +++++--
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 1f350d3bd..ad2030517 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -3455,7 +3455,8 @@ static void xgbe_enable_rx(struct xgbe_prv_data *pdata)
 	XGMAC_IOWRITE(pdata, MAC_RQC0R, reg_val);
 
 	/* Enable MAC Rx */
-	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC, 1);
+	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC,
+			   !!(pdata->netdev->features & NETIF_F_RXALL));
 	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, CST, 1);
 	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, ACS, 1);
 	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, RE, 1);
@@ -3466,7 +3467,6 @@ static void xgbe_disable_rx(struct xgbe_prv_data *pdata)
 	unsigned int i;
 
 	/* Disable MAC Rx */
-	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC, 0);
 	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, CST, 0);
 	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, ACS, 0);
 	XGMAC_IOWRITE_BITS(pdata, MAC_RCR, RE, 0);
 
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 3a79fd054..5fb81bea1 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -2247,13 +2247,14 @@ static int xgbe_set_features(struct net_device *netdev,
 {
 	struct xgbe_prv_data *pdata = netdev_priv(netdev);
 	struct xgbe_hw_if *hw_if = &pdata->hw_if;
-	netdev_features_t rxhash, rxcsum, rxvlan, rxvlan_filter;
+	netdev_features_t rxhash, rxcsum, rxvlan, rxvlan_filter, rxall;
 	int ret = 0;
 
 	rxhash = pdata->netdev_features & NETIF_F_RXHASH;
 	rxcsum = pdata->netdev_features & NETIF_F_RXCSUM;
 	rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX;
 	rxvlan_filter = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER;
+	rxall = pdata->netdev_features & NETIF_F_RXALL;
 
 	if ((features & NETIF_F_RXHASH) && !rxhash)
 		ret = hw_if->enable_rss(pdata);
@@ -2284,6 +2285,10 @@ static int xgbe_set_features(struct net_device *netdev,
 	else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && rxvlan_filter)
 		hw_if->disable_rx_vlan_filtering(pdata);
 
+	if ((features & NETIF_F_RXALL) != rxall)
+		XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC,
+				   !!(features & NETIF_F_RXALL));
+
 	pdata->netdev_features = features;
 
 	DBGPR("<--xgbe_set_features\n");
 
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
index 0e8698928..898146b67 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
@@ -351,7 +351,8 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)
 			      NETIF_F_GRO |
 			      NETIF_F_HW_VLAN_CTAG_RX |
 			      NETIF_F_HW_VLAN_CTAG_TX |
-			      NETIF_F_HW_VLAN_CTAG_FILTER;
+			      NETIF_F_HW_VLAN_CTAG_FILTER |
+			      NETIF_F_RXALL;
 
 	if (pdata->hw_feat.rss)
 		netdev->hw_features |= NETIF_F_RXHASH;
@@ -382,2 +382,4 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)
 	netdev->features |= netdev->hw_features;
+	/* disable RXALL by default */
+	netdev->features &= ~NETIF_F_RXALL;
 	pdata->netdev_features = netdev->features;

^ permalink raw reply related	[flat|nested] 13+ messages in thread
* Re: [PATCH net] net: amd-xgbe: support receiving packets with bad FCS
@ 2026-08-21 17:51 kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2026-08-21 17:51 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "linux-review patch is more than 7 days old, verify it wasn't already superseded"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260812091616.35811-1-aslan.jnn@gmail.com>
References: <20260812091616.35811-1-aslan.jnn@gmail.com>
TO: James <aslan.jnn@gmail.com>
TO: Raju Rangoju <Raju.Rangoju@amd.com>
TO: Prashanth Kumar K R <PrashanthKumar.K.R@amd.com>
CC: netdev@vger.kernel.org
CC: Thomas.Lendacky@amd.com
CC: James Nugraha <aslan.jnn@gmail.com>

Hi James,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/James/net-amd-xgbe-support-receiving-packets-with-bad-FCS/20260812-091616
base:   net/main
patch link:    https://lore.kernel.org/r/20260812091616.35811-1-aslan.jnn%40gmail.com
patch subject: [PATCH net] net: amd-xgbe: support receiving packets with bad FCS
:::::: branch date: 16 hours ago
:::::: commit date: 16 hours ago
config: powerpc-randconfig-r123-20260821 (https://download.01.org/0day-ci/archive/20260822/202608220122.kg89130y-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 935bfc708590c60147a79c7df145bb6e68b1d388)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260822/202608220122.kg89130y-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202608220122.kg89130y-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:2022:17: sparse: sparse: dubious: !x & y
   drivers/net/ethernet/amd/xgbe/xgbe-drv.c: note: in included file (through include/linux/tcp.h):
   include/linux/skbuff.h:2904:28: sparse: sparse: unsigned value that used to be signed checked against zero?
   include/linux/skbuff.h:2904:28: sparse: signed value source
--
>> drivers/net/ethernet/amd/xgbe/xgbe-dev.c:3403:9: sparse: sparse: dubious: !x & y

vim +2022 drivers/net/ethernet/amd/xgbe/xgbe-drv.c

1a510ccf5869a9 Lendacky, Thomas 2017-08-18  1977  
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1978  static int xgbe_set_features(struct net_device *netdev,
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1979  			     netdev_features_t features)
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1980  {
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1981  	struct xgbe_prv_data *pdata = netdev_priv(netdev);
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1982  	struct xgbe_hw_if *hw_if = &pdata->hw_if;
5a1edf2f430d12 James Nugraha    2026-08-12  1983  	netdev_features_t rxhash, rxcsum, rxvlan, rxvlan_filter, rxall;
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1984  	int ret = 0;
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1985  
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1986  	rxhash = pdata->netdev_features & NETIF_F_RXHASH;
801c62d945c612 Lendacky, Thomas 2014-06-24  1987  	rxcsum = pdata->netdev_features & NETIF_F_RXCSUM;
801c62d945c612 Lendacky, Thomas 2014-06-24  1988  	rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX;
801c62d945c612 Lendacky, Thomas 2014-06-24  1989  	rxvlan_filter = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER;
5a1edf2f430d12 James Nugraha    2026-08-12  1990  	rxall = pdata->netdev_features & NETIF_F_RXALL;
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  1991  
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1992  	if ((features & NETIF_F_RXHASH) && !rxhash)
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1993  		ret = hw_if->enable_rss(pdata);
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1994  	else if (!(features & NETIF_F_RXHASH) && rxhash)
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1995  		ret = hw_if->disable_rss(pdata);
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1996  	if (ret)
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1997  		return ret;
5b9dfe299e5560 Lendacky, Thomas 2014-11-04  1998  
f04dd30f1bef1e Vishal Badole    2025-04-24  1999  	if ((features & NETIF_F_RXCSUM) && !rxcsum) {
f04dd30f1bef1e Vishal Badole    2025-04-24  2000  		hw_if->enable_sph(pdata);
f04dd30f1bef1e Vishal Badole    2025-04-24  2001  		hw_if->enable_vxlan(pdata);
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2002  		hw_if->enable_rx_csum(pdata);
f04dd30f1bef1e Vishal Badole    2025-04-24  2003  		schedule_work(&pdata->restart_work);
f04dd30f1bef1e Vishal Badole    2025-04-24  2004  	} else if (!(features & NETIF_F_RXCSUM) && rxcsum) {
f04dd30f1bef1e Vishal Badole    2025-04-24  2005  		hw_if->disable_sph(pdata);
f04dd30f1bef1e Vishal Badole    2025-04-24  2006  		hw_if->disable_vxlan(pdata);
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2007  		hw_if->disable_rx_csum(pdata);
f04dd30f1bef1e Vishal Badole    2025-04-24  2008  		schedule_work(&pdata->restart_work);
f04dd30f1bef1e Vishal Badole    2025-04-24  2009  	}
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2010  
801c62d945c612 Lendacky, Thomas 2014-06-24  2011  	if ((features & NETIF_F_HW_VLAN_CTAG_RX) && !rxvlan)
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2012  		hw_if->enable_rx_vlan_stripping(pdata);
801c62d945c612 Lendacky, Thomas 2014-06-24  2013  	else if (!(features & NETIF_F_HW_VLAN_CTAG_RX) && rxvlan)
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2014  		hw_if->disable_rx_vlan_stripping(pdata);
801c62d945c612 Lendacky, Thomas 2014-06-24  2015  
801c62d945c612 Lendacky, Thomas 2014-06-24  2016  	if ((features & NETIF_F_HW_VLAN_CTAG_FILTER) && !rxvlan_filter)
801c62d945c612 Lendacky, Thomas 2014-06-24  2017  		hw_if->enable_rx_vlan_filtering(pdata);
801c62d945c612 Lendacky, Thomas 2014-06-24  2018  	else if (!(features & NETIF_F_HW_VLAN_CTAG_FILTER) && rxvlan_filter)
801c62d945c612 Lendacky, Thomas 2014-06-24  2019  		hw_if->disable_rx_vlan_filtering(pdata);
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2020  
5a1edf2f430d12 James Nugraha    2026-08-12  2021  	if ((features & NETIF_F_RXALL) != rxall)
5a1edf2f430d12 James Nugraha    2026-08-12 @2022  		XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC,
5a1edf2f430d12 James Nugraha    2026-08-12  2023  				   !!(features & NETIF_F_RXALL));
5a1edf2f430d12 James Nugraha    2026-08-12  2024  
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2025  	pdata->netdev_features = features;
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2026  
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2027  	DBGPR("<--xgbe_set_features\n");
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2028  
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2029  	return 0;
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2030  }
c5aa9e3b815645 Lendacky, Thomas 2014-06-05  2031  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-08-21 20:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12  9:16 [PATCH net] net: amd-xgbe: support receiving packets with bad FCS James
2026-08-14 10:09 ` Simon Horman
2026-08-19  2:36   ` James
2026-08-19  9:01     ` Simon Horman
2026-08-17 23:32 ` Jakub Kicinski
2026-08-19  6:31   ` James
2026-08-19  9:16 ` [PATCH net v2] " James
2026-08-21 10:39   ` Simon Horman
2026-08-21 20:36   ` David Laight
2026-08-19 11:43 ` [PATCH net] " David Laight
2026-08-20  0:38   ` James
2026-08-20  8:58     ` David Laight
  -- strict thread matches above, loose matches on Subject: below --
2026-08-21 17:51 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.