[openwrt/openwrt] realtek: dsa: Simplify port member handling
LEDE Commits
lede-commits at lists.infradead.org
Sun Oct 12 03:49:56 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/77ce3f1a728cc6f1338d898beaca52a7d9bf3031
commit 77ce3f1a728cc6f1338d898beaca52a7d9bf3031
Author: Sven Eckelmann <se at simonwunderlich.de>
AuthorDate: Thu Oct 9 16:28:47 2025 +0200
realtek: dsa: Simplify port member handling
It is not necessary to read the back the current port members for a
specific port for enabling/disabling a port. All these members which are
expected to be in the HW port matrix of an active port are already stored
in the port specific member "pm".
And when a port is disabled, the port must no longer forwarding traffic to
any other port. Just writing 0 to the members is therefore good enough and
no read-back of the old HW state is necessary.
Signed-off-by: Sven Eckelmann <se at simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20360
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
index d97283065f..74cd728de5 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
@@ -1428,7 +1428,6 @@ static int rtl83xx_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phydev)
{
struct rtl838x_switch_priv *priv = ds->priv;
- u64 v;
pr_debug("%s: %x %d", __func__, (u32) priv, port);
priv->ports[port].enable = true;
@@ -1448,9 +1447,7 @@ static int rtl83xx_port_enable(struct dsa_switch *ds, int port,
}
/* add all other ports in the same bridge to switch mask of port */
- v = priv->r->traffic_get(port);
- v |= priv->ports[port].pm;
- priv->r->traffic_set(port, v);
+ priv->r->traffic_set(port, priv->ports[port].pm);
/* TODO: Figure out if this is necessary */
if (priv->family_id == RTL9300_FAMILY_ID) {
@@ -1467,7 +1464,6 @@ static int rtl83xx_port_enable(struct dsa_switch *ds, int port,
static void rtl83xx_port_disable(struct dsa_switch *ds, int port)
{
struct rtl838x_switch_priv *priv = ds->priv;
- u64 v;
pr_debug("%s %x: %d", __func__, (u32)priv, port);
/* you can only disable user ports */
@@ -1478,10 +1474,8 @@ static void rtl83xx_port_disable(struct dsa_switch *ds, int port)
/* remove port from switch mask of CPU_PORT */
priv->r->traffic_disable(priv->cpu_port, port);
- /* remove all other ports in the same bridge from switch mask of port */
- v = priv->r->traffic_get(port);
- v &= ~priv->ports[port].pm;
- priv->r->traffic_set(port, v);
+ /* remove all other ports from switch mask of port */
+ priv->r->traffic_set(port, 0);
priv->ports[port].enable = false;
}
More information about the lede-commits
mailing list