]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: setup special portmasks only once
authorLinus Lüssing <linus.luessing@c0d3.blue>
Sat, 10 May 2025 13:38:49 +0000 (15:38 +0200)
committerRobert Marko <robimarko@gmail.com>
Sat, 28 Feb 2026 11:11:31 +0000 (12:11 +0100)
The special all-ports multicast portmasks table entry would be written
twice, redundantly as vlan_profile_setup() is called twice. Which is
unnecessary. Writing this reserved multicast portmask entry is
independent of a VLAN profile, therefore let's move this to a more
suitable position.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/21872
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl839x.c

index 2726a3ca2063956d02503fa8d5560bd093c24862..fd2710f0391a4c0b211202b0c2a331b4221255a3 100644 (file)
@@ -445,6 +445,16 @@ static void rtldsa_vlan_set_pvid(struct rtl838x_switch_priv *priv,
        priv->ports[port].pvid = pvid;
 }
 
+static void rtldsa_83xx_mc_pmasks_setup(struct rtl838x_switch_priv *priv)
+{
+       /* RTL8380 and RTL8390 use an index into the portmask table to set the
+        * unknown multicast portmask, setup a default at a safe location
+        * On RTL93XX, the portmask is directly set in the profile,
+        * see e.g. rtl9300_vlan_profile_setup
+        */
+       priv->r->write_mcast_pmask(MC_PMASK_ALL_PORTS_IDX, ~0);
+}
+
 /* Initialize all VLANS */
 static void rtldsa_vlan_setup(struct rtl838x_switch_priv *priv)
 {
@@ -547,6 +557,7 @@ static int rtldsa_83xx_setup(struct dsa_switch *ds)
        rtldsa_83xx_init_stats(priv);
        rtldsa_init_counters(priv);
 
+       rtldsa_83xx_mc_pmasks_setup(priv);
        rtldsa_vlan_setup(priv);
 
        rtldsa_setup_bpdu_traps(priv);
index 8c20c04083bf3448ca9547fe16d021bef93c89ae..8c408e5608683a3848da65efd126c35b480679b2 100644 (file)
@@ -521,13 +521,6 @@ static void rtl838x_vlan_profile_setup(int profile)
                RTL838X_VLAN_IP6_UNKN_MC_FLD(MC_PMASK_ALL_PORTS_IDX);
 
        sw_w32(p, RTL838X_VLAN_PROFILE(profile));
-
-       /* RTL8380 and RTL8390 use an index into the portmask table to set the
-        * unknown multicast portmask, setup a default at a safe location
-        * On RTL93XX, the portmask is directly set in the profile,
-        * see e.g. rtl9300_vlan_profile_setup
-        */
-       rtl838x_write_mcast_pmask(MC_PMASK_ALL_PORTS_IDX, RTL838X_MC_PMASK_ALL_PORTS);
 }
 
 static void rtl838x_l2_learning_setup(void)
index a60a406f81cf1e760b8119d8beea9567b53790ab..72185d3e8989d997e8a0c3c26c447762acd5e67e 100644 (file)
@@ -554,8 +554,6 @@ static void rtl839x_vlan_profile_setup(int profile)
 
        sw_w32(p[0], RTL839X_VLAN_PROFILE(profile));
        sw_w32(p[1], RTL839X_VLAN_PROFILE(profile) + 4);
-
-       rtl839x_write_mcast_pmask(MC_PMASK_ALL_PORTS_IDX, RTL839X_MC_PMASK_ALL_PORTS);
 }
 
 static void rtl839x_traffic_set(int source, u64 dest_matrix)