There shouldn't be any reason to forward all multicast to the CPU. The
original commit message also doesn't provide a reason for this seemingly
unrelated change.

The current implementation of the delete method is also broken, as it
entirely removes any entry when the portmask contains only the CPU port,
even if it was explicitly created.

Fixes: 724e4af530cd ("realtek: Store and Restore MC memberships for port 
enable/disable")
Signed-off-by: Jan Hoffmann <j...@3e8.eu>
---
 .../linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 7 ++-----
 .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c 
b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
index 79a5c5eea289..9aaa255d2639 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
@@ -987,7 +987,7 @@ static int rtl83xx_mc_group_alloc(struct 
rtl838x_switch_priv *priv, int port)
        }
 
        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;
@@ -1019,11 +1019,8 @@ static u64 rtl83xx_mc_group_del_port(struct 
rtl838x_switch_priv *priv, int mc_gr
        }
        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;
 }
diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c 
b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
index f3b1cd08acb3..f99736af24ee 100644
--- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
@@ -974,7 +974,7 @@ static int rtl83xx_mc_group_alloc(struct 
rtl838x_switch_priv *priv, int port)
        }
 
        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;
@@ -1006,11 +1006,8 @@ static u64 rtl83xx_mc_group_del_port(struct 
rtl838x_switch_priv *priv, int mc_gr
        }
        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;
 }
-- 
2.40.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to