From 1b94a9b462d869bbb466767caa28b197953f2a37 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 22 Sep 2026 16:24:34 -0700 Subject: [PATCH] net: systemport: Fix Wake-on-LAN RXCHK filter enable loop In bcm_sysport_suspend_to_wol(), the loop enabling programmed RXCHK filters in RXCHK_CONTROL used an auxiliary counter 'i' instead of the actual set filter index 'index'. When non-contiguous filters were configured (for example, if filter 0 was deleted and filter 1 remained), the code would enable bit (RXCHK_BRCM_TAG_MATCH_SHIFT + 0) corresponding to filter 0 rather than filter 1, causing Wake-on-LAN filter matching to fail. Fix this by using the filter 'index' to set the appropriate match bit in RXCHK_CONTROL. Cc: stable+noautosel@kernel.org # never worked Reviewed-by: Nicolai Buchwitz Signed-off-by: Florian Fainelli Link: https://patch.msgid.link/20260922232440.598918-5-florian.fainelli@broadcom.com Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/broadcom/bcmsysport.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 4d8c7d2f24a4..03d381d4e9a8 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2650,7 +2650,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) { struct net_device *ndev = priv->netdev; unsigned int timeout = 1000; - unsigned int index, i = 0; + unsigned int index; u32 reg; reg = umac_readl(priv, UMAC_MPD_CTRL); @@ -2680,10 +2680,8 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv) reg = rxchk_readl(priv, RXCHK_CONTROL); reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK << RXCHK_BRCM_TAG_MATCH_SHIFT); - for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) { - reg |= BIT(RXCHK_BRCM_TAG_MATCH_SHIFT + i); - i++; - } + for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) + reg |= BIT(RXCHK_BRCM_TAG_MATCH_SHIFT + index); reg |= RXCHK_EN | RXCHK_BRCM_TAG_EN; rxchk_writel(priv, reg, RXCHK_CONTROL); }