[openwrt/openwrt] realtek: Trap LLDP packets to the CPU

LEDE Commits lede-commits at lists.infradead.org
Fri May 10 07:08:42 PDT 2024


svanheule pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/5b7240c07056ccdde606cea8e832d76f0d4e8002

commit 5b7240c07056ccdde606cea8e832d76f0d4e8002
Author: Kevin Jilissen <info at kevinjilissen.nl>
AuthorDate: Sat May 4 16:12:20 2024 +0200

    realtek: Trap LLDP packets to the CPU
    
    We should setup the registers for trapping LLDP packets to the CPU.
    Currently, these packets are forwarded to all ports which is not desired
    behaviour.
    
    Signed-off-by: Kevin Jilissen <info at kevinjilissen.nl>
    (cherry picked from commit 5a5c52085a5bd0b1b8bc629f3586c7a93dcb4460)
---
 target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 7 +++++++
 1 file changed, 7 insertions(+)

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 063ce9b8c5..6d8b155245 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
@@ -155,6 +155,12 @@ static void rtl83xx_setup_bpdu_traps(struct rtl838x_switch_priv *priv)
 		priv->r->set_receive_management_action(i, BPDU, TRAP2CPU);
 }
 
+static void rtl83xx_setup_lldp_traps(struct rtl838x_switch_priv *priv)
+{
+	for (int i = 0; i < priv->cpu_port; i++)
+		priv->r->set_receive_management_action(i, LLDP, TRAP2CPU);
+}
+
 static void rtl83xx_port_set_salrn(struct rtl838x_switch_priv *priv,
 				   int port, bool enable)
 {
@@ -207,6 +213,7 @@ static int rtl83xx_setup(struct dsa_switch *ds)
 	rtl83xx_vlan_setup(priv);
 
 	rtl83xx_setup_bpdu_traps(priv);
+	rtl83xx_setup_lldp_traps(priv);
 
 	ds->configure_vlan_while_not_filtering = true;
 




More information about the lede-commits mailing list