Skip to content

Commit bc13911

Browse files
grygoriySdavem330
authored andcommitted
net: ethernet: ti: ale: fix allmulti for nu type ale
On AM65xx MCU CPSW2G NUSS and 66AK2E/L NUSS allmulti setting does not allow unregistered mcast packets to pass. This happens, because ALE VLAN entries on these SoCs do not contain port masks for reg/unreg mcast packets, but instead store indexes of ALE_VLAN_MASK_MUXx_REG registers which intended for store port masks for reg/unreg mcast packets. This path was missed by commit 9d1f644 ("net: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti disabled"). Hence, fix it by taking into account ALE type in cpsw_ale_set_allmulti(). Fixes: 9d1f644 ("net: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti disabled") Signed-off-by: Grygorii Strashko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2074f9e commit bc13911

File tree

1 file changed

+40
-9
lines changed

1 file changed

+40
-9
lines changed

drivers/net/ethernet/ti/cpsw_ale.c

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,44 @@ void cpsw_ale_set_unreg_mcast(struct cpsw_ale *ale, int unreg_mcast_mask,
604604
}
605605
}
606606

607+
static void cpsw_ale_vlan_set_unreg_mcast(struct cpsw_ale *ale, u32 *ale_entry,
608+
int allmulti)
609+
{
610+
int unreg_mcast;
611+
612+
unreg_mcast =
613+
cpsw_ale_get_vlan_unreg_mcast(ale_entry,
614+
ale->vlan_field_bits);
615+
if (allmulti)
616+
unreg_mcast |= ALE_PORT_HOST;
617+
else
618+
unreg_mcast &= ~ALE_PORT_HOST;
619+
cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast,
620+
ale->vlan_field_bits);
621+
}
622+
623+
static void
624+
cpsw_ale_vlan_set_unreg_mcast_idx(struct cpsw_ale *ale, u32 *ale_entry,
625+
int allmulti)
626+
{
627+
int unreg_mcast;
628+
int idx;
629+
630+
idx = cpsw_ale_get_vlan_unreg_mcast_idx(ale_entry);
631+
632+
unreg_mcast = readl(ale->params.ale_regs + ALE_VLAN_MASK_MUX(idx));
633+
634+
if (allmulti)
635+
unreg_mcast |= ALE_PORT_HOST;
636+
else
637+
unreg_mcast &= ~ALE_PORT_HOST;
638+
639+
writel(unreg_mcast, ale->params.ale_regs + ALE_VLAN_MASK_MUX(idx));
640+
}
641+
607642
void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port)
608643
{
609644
u32 ale_entry[ALE_ENTRY_WORDS];
610-
int unreg_mcast = 0;
611645
int type, idx;
612646

613647
for (idx = 0; idx < ale->params.ale_entries; idx++) {
@@ -624,15 +658,12 @@ void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port)
624658
if (port != -1 && !(vlan_members & BIT(port)))
625659
continue;
626660

627-
unreg_mcast =
628-
cpsw_ale_get_vlan_unreg_mcast(ale_entry,
629-
ale->vlan_field_bits);
630-
if (allmulti)
631-
unreg_mcast |= ALE_PORT_HOST;
661+
if (!ale->params.nu_switch_ale)
662+
cpsw_ale_vlan_set_unreg_mcast(ale, ale_entry, allmulti);
632663
else
633-
unreg_mcast &= ~ALE_PORT_HOST;
634-
cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast,
635-
ale->vlan_field_bits);
664+
cpsw_ale_vlan_set_unreg_mcast_idx(ale, ale_entry,
665+
allmulti);
666+
636667
cpsw_ale_write(ale, idx, ale_entry);
637668
}
638669
}

0 commit comments

Comments
 (0)