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 9d1f6447274f ("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: 9d1f6447274f ("net: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti disabled")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Grygorii Strashko and committed by David S. Miller bc139119 2074f9ea

Changed files
+40 -9
drivers
net
ethernet
+40 -9
drivers/net/ethernet/ti/cpsw_ale.c
··· 604 604 } 605 605 } 606 606 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 + 607 642 void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti, int port) 608 643 { 609 644 u32 ale_entry[ALE_ENTRY_WORDS]; 610 - int unreg_mcast = 0; 611 645 int type, idx; 612 646 613 647 for (idx = 0; idx < ale->params.ale_entries; idx++) { ··· 658 624 if (port != -1 && !(vlan_members & BIT(port))) 659 625 continue; 660 626 661 - unreg_mcast = 662 - cpsw_ale_get_vlan_unreg_mcast(ale_entry, 663 - ale->vlan_field_bits); 664 - if (allmulti) 665 - unreg_mcast |= ALE_PORT_HOST; 627 + if (!ale->params.nu_switch_ale) 628 + cpsw_ale_vlan_set_unreg_mcast(ale, ale_entry, allmulti); 666 629 else 667 - unreg_mcast &= ~ALE_PORT_HOST; 668 - cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast, 669 - ale->vlan_field_bits); 630 + cpsw_ale_vlan_set_unreg_mcast_idx(ale, ale_entry, 631 + allmulti); 632 + 670 633 cpsw_ale_write(ale, idx, ale_entry); 671 634 } 672 635 }