Skip to content
/ linux Public

Commit ebcdcb5

Browse files
chintanv133gregkh
authored andcommitted
net: ethernet: ti: am65-cpsw-nuss/cpsw-ale: Fix multicast entry handling in ALE table
[ Upstream commit be11a53 ] 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: 5c50a85 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 98c92c9 commit ebcdcb5

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static void am65_cpsw_nuss_ndo_slave_set_rx_mode(struct net_device *ndev)
290290
cpsw_ale_set_allmulti(common->ale,
291291
ndev->flags & IFF_ALLMULTI, port->port_id);
292292

293-
port_mask = ALE_PORT_HOST;
293+
port_mask = BIT(port->port_id) | ALE_PORT_HOST;
294294
/* Clear all mcast from ALE */
295295
cpsw_ale_flush_multicast(common->ale, port_mask, -1);
296296

drivers/net/ethernet/ti/cpsw_ale.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,13 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry,
443443
ale->port_mask_bits);
444444
if ((mask & port_mask) == 0)
445445
return; /* ports dont intersect, not interested */
446-
mask &= ~port_mask;
446+
mask &= (~port_mask | ALE_PORT_HOST);
447447

448-
/* free if only remaining port is host port */
449-
if (mask)
448+
if (mask == 0x0 || mask == ALE_PORT_HOST)
449+
cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
450+
else
450451
cpsw_ale_set_port_mask(ale_entry, mask,
451452
ale->port_mask_bits);
452-
else
453-
cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
454453
}
455454

456455
int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)

0 commit comments

Comments
 (0)