ath25: switch default kernel to 5.15
[openwrt/staging/wigyori.git] / target / linux / realtek / files-5.10 / drivers / net / dsa / rtl83xx / dsa.c
index e45919d8b505f7f521fe7a5bd4c09e973e521ae4..bff42b088ad67cf9154d625f6bd6e1d730aacdc9 100644 (file)
@@ -988,13 +988,8 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port)
        if (mc_group >= MAX_MC_GROUPS - 1)
                return -1;
 
-       if (priv->is_lagmember[port]) {
-               pr_info("%s: %d is lag slave. ignore\n", __func__, port);
-               return 0;
-       }
-
        set_bit(mc_group, priv->mc_group_bm);
-       portmask = BIT_ULL(port) | BIT_ULL(priv->cpu_port); 
+       portmask = BIT_ULL(port);
        priv->r->write_mcast_pmask(mc_group, portmask);
 
        return mc_group;
@@ -1005,10 +1000,7 @@ static u64 rtl83xx_mc_group_add_port(struct rtl838x_switch_priv *priv, int mc_gr
        u64 portmask = priv->r->read_mcast_pmask(mc_group);
 
        pr_debug("%s: %d\n", __func__, port);
-       if (priv->is_lagmember[port]) {
-               pr_info("%s: %d is lag slave. ignore\n", __func__, port);
-               return portmask;
-       }
+
        portmask |= BIT_ULL(port);
        priv->r->write_mcast_pmask(mc_group, portmask);
 
@@ -1020,45 +1012,15 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr
        u64 portmask = priv->r->read_mcast_pmask(mc_group);
 
        pr_debug("%s: %d\n", __func__, port);
-       if (priv->is_lagmember[port]) {
-               pr_info("%s: %d is lag slave. ignore\n", __func__, port);
-               return portmask;
-       }
+
+       portmask &= ~BIT_ULL(port);
        priv->r->write_mcast_pmask(mc_group, portmask);
-       if (portmask == BIT_ULL(priv->cpu_port)) {
-               portmask &= ~BIT_ULL(priv->cpu_port);
-               priv->r->write_mcast_pmask(mc_group, portmask);
+       if (!portmask)
                clear_bit(mc_group, priv->mc_group_bm);
-       }
 
        return portmask;
 }
 
-static void store_mcgroups(struct rtl838x_switch_priv *priv, int port)
-{
-       int mc_group;
-
-       for (mc_group = 0; mc_group < MAX_MC_GROUPS; mc_group++) {
-               u64 portmask = priv->r->read_mcast_pmask(mc_group);
-               if (portmask & BIT_ULL(port)) {
-                       priv->mc_group_saves[mc_group] = port;
-                       rtl83xx_mc_group_del_port(priv, mc_group, port);
-               }
-       }
-}
-
-static void load_mcgroups(struct rtl838x_switch_priv *priv, int port)
-{
-       int mc_group;
-
-       for (mc_group = 0; mc_group < MAX_MC_GROUPS; mc_group++) {
-               if (priv->mc_group_saves[mc_group] == port) {
-                       rtl83xx_mc_group_add_port(priv, mc_group, port);
-                       priv->mc_group_saves[mc_group] = -1;
-               }
-       }
-}
-
 static int rtl83xx_port_enable(struct dsa_switch *ds, int port,
                                struct phy_device *phydev)
 {
@@ -1077,8 +1039,6 @@ static int rtl83xx_port_enable(struct dsa_switch *ds, int port,
        /* add port to switch mask of CPU_PORT */
        priv->r->traffic_enable(priv->cpu_port, port);
 
-       load_mcgroups(priv, port);
-
        if (priv->is_lagmember[port]) {
                pr_debug("%s: %d is lag slave. ignore\n", __func__, port);
                return 0;
@@ -1114,7 +1074,6 @@ static void rtl83xx_port_disable(struct dsa_switch *ds, int port)
        // BUG: This does not work on RTL931X
        /* remove port from switch mask of CPU_PORT */
        priv->r->traffic_disable(priv->cpu_port, port);
-       store_mcgroups(priv, port);
 
        /* remove all other ports in the same bridge from switch mask of port */
        v = priv->r->traffic_get(port);
@@ -1214,7 +1173,6 @@ static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port,
                        port_bitmap |= BIT_ULL(i);
                }
        }
-       load_mcgroups(priv, port);
 
        /* Add all other ports to this port matrix. */
        if (priv->ports[port].enable) {
@@ -1259,7 +1217,6 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port,
                        port_bitmap |= BIT_ULL(i);
                }
        }
-       store_mcgroups(priv, port);
 
        /* Remove all other ports from this port matrix. */
        if (priv->ports[port].enable) {