aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
diff options
context:
space:
mode:
authorJan Hoffmann <jan@3e8.eu>2023-05-06 19:28:54 +0200
committerSander Vanheule <sander@svanheule.net>2023-05-07 19:07:34 +0200
commit5d34fc92eccc7d8f3fd35fd5841c110ca1aefc13 (patch)
treec8d92333fa6a590daeaaa6d85c8ff6ae34b93499 /target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
parent4c0a1667f3e752d31b22ca699a9a3fda5eb47dc7 (diff)
downloadupstream-5d34fc92eccc7d8f3fd35fd5841c110ca1aefc13.tar.gz
upstream-5d34fc92eccc7d8f3fd35fd5841c110ca1aefc13.tar.bz2
upstream-5d34fc92eccc7d8f3fd35fd5841c110ca1aefc13.zip
realtek: fix standalone ports in presence of static fdb entries
The registers L2_PORT_STATIC_MV_ACT seem to specify the action to take when the source address of a packet exists as a static fdb entry on another port. By default the configured action is to drop such packets. For standalone ports, this behaviour is undesired, as all traffic should be forwarded to the CPU. So change the action to forward on standalone ports. A situation where this issue can occur is when a non-offloaded bond interface is part of a bridge. In that case, the CPU port will have fdb entries for devices connected to the bond interface, which are managed by the assisted learning feature. For now, this is only implemented for RTL838x/RTL839x, as the available set of registers differs for the other devices. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Diffstat (limited to 'target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c')
-rw-r--r--target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c15
1 files changed, 15 insertions, 0 deletions
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 3ecdda205f..703306498e 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
@@ -188,6 +188,14 @@ static int rtl83xx_setup(struct dsa_switch *ds)
}
priv->r->traffic_set(priv->cpu_port, BIT_ULL(priv->cpu_port));
+ /* For standalone ports, forward packets even if a static fdb
+ * entry for the source address exists on another port.
+ */
+ if (priv->r->set_static_move_action) {
+ for (int i = 0; i <= priv->cpu_port; i++)
+ priv->r->set_static_move_action(i, true);
+ }
+
if (priv->family_id == RTL8380_FAMILY_ID)
rtl838x_print_matrix();
else
@@ -1202,6 +1210,10 @@ static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port,
priv->r->traffic_set(port, v);
}
priv->ports[port].pm |= port_bitmap;
+
+ if (priv->r->set_static_move_action)
+ priv->r->set_static_move_action(port, false);
+
mutex_unlock(&priv->reg_mutex);
return 0;
@@ -1242,6 +1254,9 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port,
}
priv->ports[port].pm &= ~port_bitmap;
+ if (priv->r->set_static_move_action)
+ priv->r->set_static_move_action(port, true);
+
mutex_unlock(&priv->reg_mutex);
}