realtek: Trap LLDP packets to the CPU
authorKevin Jilissen <info@kevinjilissen.nl>
Sat, 4 May 2024 14:12:20 +0000 (16:12 +0200)
committerSander Vanheule <sander@svanheule.net>
Fri, 10 May 2024 14:03:51 +0000 (16:03 +0200)
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@kevinjilissen.nl>
target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c

index ff81a4c77b642477b7c75320a290ca7762780fbc..9eb444515f46b343ea15e718b0f36b061712b0ed 100644 (file)
@@ -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;