]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ethernet: ti: am65-cpsw-nuss/cpsw-ale: Fix multicast entry handling in ALE table
authorChintan Vankar <c-vankar@ti.com>
Tue, 24 Feb 2026 18:13:59 +0000 (23:43 +0530)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Feb 2026 03:43:54 +0000 (19:43 -0800)
In the current implementation, flushing multicast entries in MAC mode
incorrectly deletes entries for all ports instead of only the target port,
disrupting multicast traffic on other ports. The cause is adding multicast
entries by setting only host port bit, and not setting the MAC port bits.

Fix this by setting the MAC port's bit in the port mask while adding the
multicast entry. Also fix the flush logic to preserve the host port bit
during removal of MAC port and free ALE entries when mask contains only
host port.

Fixes: 5c50a856d550 ("drivers: net: ethernet: cpsw: add multicast address to ALE table")
Signed-off-by: Chintan Vankar <c-vankar@ti.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260224181359.2055322-1-c-vankar@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/cpsw_ale.c

index 5924db6be3feaf8a7566a0ee82e6cec225110729..9679180504330fc59617da84119bed1332c7cb58 100644 (file)
@@ -391,7 +391,7 @@ static void am65_cpsw_nuss_ndo_slave_set_rx_mode(struct net_device *ndev)
        cpsw_ale_set_allmulti(common->ale,
                              ndev->flags & IFF_ALLMULTI, port->port_id);
 
-       port_mask = ALE_PORT_HOST;
+       port_mask = BIT(port->port_id) | ALE_PORT_HOST;
        /* Clear all mcast from ALE */
        cpsw_ale_flush_multicast(common->ale, port_mask, -1);
 
index bb969dd435b401cd2b42ea73859c437fab3fc47c..be7b6931922166d15dd1800baee8d37ae89257c3 100644 (file)
@@ -450,14 +450,13 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry,
                                      ale->port_mask_bits);
        if ((mask & port_mask) == 0)
                return; /* ports dont intersect, not interested */
-       mask &= ~port_mask;
+       mask &= (~port_mask | ALE_PORT_HOST);
 
-       /* free if only remaining port is host port */
-       if (mask)
+       if (mask == 0x0 || mask == ALE_PORT_HOST)
+               cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
+       else
                cpsw_ale_set_port_mask(ale_entry, mask,
                                       ale->port_mask_bits);
-       else
-               cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
 }
 
 int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)