Skip to content

Commit 797a68c

Browse files
Sean Andersonkuba-moo
authored andcommitted
net: xilinx: axienet: Fix dangling multicast addresses
If a multicast address is removed but there are still some multicast addresses, that address would remain programmed into the frame filter. Fix this by explicitly setting the enable bit for each filter. Fixes: 8a3b7a2 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4ae738d commit 797a68c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

drivers/net/ethernet/xilinx/xilinx_axienet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
#define XAE_UAW0_OFFSET 0x00000700 /* Unicast address word 0 */
171171
#define XAE_UAW1_OFFSET 0x00000704 /* Unicast address word 1 */
172172
#define XAE_FMI_OFFSET 0x00000708 /* Frame Filter Control */
173+
#define XAE_FFE_OFFSET 0x0000070C /* Frame Filter Enable */
173174
#define XAE_AF0_OFFSET 0x00000710 /* Address Filter 0 */
174175
#define XAE_AF1_OFFSET 0x00000714 /* Address Filter 1 */
175176

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static int netdev_set_mac_address(struct net_device *ndev, void *p)
432432
*/
433433
static void axienet_set_multicast_list(struct net_device *ndev)
434434
{
435-
int i;
435+
int i = 0;
436436
u32 reg, af0reg, af1reg;
437437
struct axienet_local *lp = netdev_priv(ndev);
438438

@@ -454,7 +454,6 @@ static void axienet_set_multicast_list(struct net_device *ndev)
454454
reg &= ~XAE_FMI_PM_MASK;
455455
axienet_iow(lp, XAE_FMI_OFFSET, reg);
456456

457-
i = 0;
458457
netdev_for_each_mc_addr(ha, ndev) {
459458
if (i >= XAE_MULTICAST_CAM_TABLE_NUM)
460459
break;
@@ -473,25 +472,23 @@ static void axienet_set_multicast_list(struct net_device *ndev)
473472
axienet_iow(lp, XAE_FMI_OFFSET, reg);
474473
axienet_iow(lp, XAE_AF0_OFFSET, af0reg);
475474
axienet_iow(lp, XAE_AF1_OFFSET, af1reg);
475+
axienet_iow(lp, XAE_FFE_OFFSET, 1);
476476
i++;
477477
}
478478
} else {
479479
reg = axienet_ior(lp, XAE_FMI_OFFSET);
480480
reg &= ~XAE_FMI_PM_MASK;
481481

482482
axienet_iow(lp, XAE_FMI_OFFSET, reg);
483-
484-
for (i = 0; i < XAE_MULTICAST_CAM_TABLE_NUM; i++) {
485-
reg = axienet_ior(lp, XAE_FMI_OFFSET) & 0xFFFFFF00;
486-
reg |= i;
487-
488-
axienet_iow(lp, XAE_FMI_OFFSET, reg);
489-
axienet_iow(lp, XAE_AF0_OFFSET, 0);
490-
axienet_iow(lp, XAE_AF1_OFFSET, 0);
491-
}
492-
493483
dev_info(&ndev->dev, "Promiscuous mode disabled.\n");
494484
}
485+
486+
for (; i < XAE_MULTICAST_CAM_TABLE_NUM; i++) {
487+
reg = axienet_ior(lp, XAE_FMI_OFFSET) & 0xFFFFFF00;
488+
reg |= i;
489+
axienet_iow(lp, XAE_FMI_OFFSET, reg);
490+
axienet_iow(lp, XAE_FFE_OFFSET, 0);
491+
}
495492
}
496493

497494
/**

0 commit comments

Comments
 (0)