[openwrt/openwrt] realtek: Trap all frames with switch as destination to CPU-port
LEDE Commits
lede-commits at lists.infradead.org
Sat May 14 12:32:39 PDT 2022
svanheule pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/7b4702afef64b71c6c103b962535d390f3b7f240
commit 7b4702afef64b71c6c103b962535d390f3b7f240
Author: Birger Koblitz <git at birger-koblitz.de>
AuthorDate: Sun Apr 24 20:37:33 2022 +0200
realtek: Trap all frames with switch as destination to CPU-port
This fixes a bug where frames sent to the switch itself were
flooded to all ports unless the MAC address of the CPU-port
was learned otherwise.
Tested-by: Wenli Looi <wlooi at ucalgary.ca>
Tested-by: Bjørn Mork <bjorn at mork.no>
Signed-off-by: Birger Koblitz <git at birger-koblitz.de>
[fix code formatting]
Signed-off-by: Sander Vanheule <sander at svanheule.net>
(cherry picked from commit 98bb26f9f762408e42bd8a906f0eb01c41ada10a)
---
target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
index 4780632983..2e3ab4a805 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c
@@ -205,6 +205,15 @@ static int rtl83xx_setup(struct dsa_switch *ds)
priv->r->l2_learning_setup();
+ /*
+ * Make sure all frames sent to the switch's MAC are trapped to the CPU-port
+ * 0: FWD, 1: DROP, 2: TRAP2CPU
+ */
+ if (priv->family_id == RTL8380_FAMILY_ID)
+ sw_w32(0x2, RTL838X_SPCL_TRAP_SWITCH_MAC_CTRL);
+ else
+ sw_w32(0x2, RTL839X_SPCL_TRAP_SWITCH_MAC_CTRL);
+
/* Enable MAC Polling PHY again */
rtl83xx_enable_phy_polling(priv);
pr_debug("Please wait until PHY is settled\n");
More information about the lede-commits
mailing list