Skip to content

Commit a0e11f6

Browse files
T-Xrobimarko
authored andcommitted
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: openwrt/openwrt#21872 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent 19d849d commit a0e11f6

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,16 @@ static void rtldsa_vlan_set_pvid(struct rtl838x_switch_priv *priv,
445445
priv->ports[port].pvid = pvid;
446446
}
447447

448+
static void rtldsa_83xx_mc_pmasks_setup(struct rtl838x_switch_priv *priv)
449+
{
450+
/* RTL8380 and RTL8390 use an index into the portmask table to set the
451+
* unknown multicast portmask, setup a default at a safe location
452+
* On RTL93XX, the portmask is directly set in the profile,
453+
* see e.g. rtl9300_vlan_profile_setup
454+
*/
455+
priv->r->write_mcast_pmask(MC_PMASK_ALL_PORTS_IDX, ~0);
456+
}
457+
448458
/* Initialize all VLANS */
449459
static void rtldsa_vlan_setup(struct rtl838x_switch_priv *priv)
450460
{
@@ -547,6 +557,7 @@ static int rtldsa_83xx_setup(struct dsa_switch *ds)
547557
rtldsa_83xx_init_stats(priv);
548558
rtldsa_init_counters(priv);
549559

560+
rtldsa_83xx_mc_pmasks_setup(priv);
550561
rtldsa_vlan_setup(priv);
551562

552563
rtldsa_setup_bpdu_traps(priv);

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,6 @@ static void rtl838x_vlan_profile_setup(int profile)
521521
RTL838X_VLAN_IP6_UNKN_MC_FLD(MC_PMASK_ALL_PORTS_IDX);
522522

523523
sw_w32(p, RTL838X_VLAN_PROFILE(profile));
524-
525-
/* RTL8380 and RTL8390 use an index into the portmask table to set the
526-
* unknown multicast portmask, setup a default at a safe location
527-
* On RTL93XX, the portmask is directly set in the profile,
528-
* see e.g. rtl9300_vlan_profile_setup
529-
*/
530-
rtl838x_write_mcast_pmask(MC_PMASK_ALL_PORTS_IDX, RTL838X_MC_PMASK_ALL_PORTS);
531524
}
532525

533526
static void rtl838x_l2_learning_setup(void)

target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl839x.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,6 @@ static void rtl839x_vlan_profile_setup(int profile)
554554

555555
sw_w32(p[0], RTL839X_VLAN_PROFILE(profile));
556556
sw_w32(p[1], RTL839X_VLAN_PROFILE(profile) + 4);
557-
558-
rtl839x_write_mcast_pmask(MC_PMASK_ALL_PORTS_IDX, RTL839X_MC_PMASK_ALL_PORTS);
559557
}
560558

561559
static void rtl839x_traffic_set(int source, u64 dest_matrix)

0 commit comments

Comments
 (0)