realtek: setup special portmasks only once

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>
This commit is contained in:
Linus Lüssing 2025-05-10 15:38:49 +02:00 committed by Robert Marko
parent 19d849d900
commit a0e11f61a9
3 changed files with 11 additions and 9 deletions

View 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);

View 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)

View 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)