aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.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.10/drivers/net/dsa/rtl83xx/rtl839x.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.10/drivers/net/dsa/rtl83xx/rtl839x.c')
-rw-r--r--target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c
index 986a4b5f45..c34bff78d7 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c
@@ -602,6 +602,16 @@ static void rtl839x_enable_bcast_flood(int port, bool enable)
{
}
+
+static void rtl839x_set_static_move_action(int port, bool forward)
+{
+ int shift = MV_ACT_PORT_SHIFT(port);
+ u32 val = forward ? MV_ACT_FORWARD : MV_ACT_DROP;
+
+ sw_w32_mask(MV_ACT_MASK << shift, val << shift,
+ RTL839X_L2_PORT_STATIC_MV_ACT(port));
+}
+
irqreturn_t rtl839x_switch_irq(int irq, void *dev_id)
{
struct dsa_switch *ds = dev_id;
@@ -1893,6 +1903,7 @@ const struct rtl838x_reg rtl839x_reg = {
.enable_flood = rtl839x_enable_flood,
.enable_mcast_flood = rtl839x_enable_mcast_flood,
.enable_bcast_flood = rtl839x_enable_bcast_flood,
+ .set_static_move_action = rtl839x_set_static_move_action,
.stp_get = rtl839x_stp_get,
.stp_set = rtl839x_stp_set,
.mac_force_mode_ctrl = rtl839x_mac_force_mode_ctrl,