]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: dsa: mt7530: fix handling of LLDP frames
authorArınç ÜNAL <arinc.unal@arinc9.com>
Sat, 17 Jun 2023 06:26:47 +0000 (09:26 +0300)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:22 +0000 (17:19 +0200)
BugLink: https://bugs.launchpad.net/bugs/2033931
[ Upstream commit 8332cf6fd7c7087dbc2067115b33979c9851bbc4 ]

LLDP frames are link-local frames, therefore they must be trapped to the
CPU port. Currently, the MT753X switches treat LLDP frames as regular
multicast frames, therefore flooding them to user ports. To fix this, set
LLDP frames to be trapped to the CPU port(s).

Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/dsa/mt7530.c
drivers/net/dsa/mt7530.h

index 7c2b6b530246e7cb453ede86a5fc80c81923c6c3..f18e423cce870d23d70844a579e4151db1e1b39a 100644 (file)
@@ -1004,6 +1004,10 @@ mt753x_trap_frames(struct mt7530_priv *priv)
        /* Trap BPDUs to the CPU port(s) */
        mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
                   MT753X_BPDU_CPU_ONLY);
+
+       /* Trap LLDP frames with :0E MAC DA to the CPU port(s) */
+       mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
+                  MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY));
 }
 
 static int
index e8d9664353504f66c7957e7e49b6bbb0645082c9..9a45663d8b4ef68e4770178ed72d5b0411b98886 100644 (file)
@@ -65,6 +65,11 @@ enum mt753x_id {
 #define MT753X_BPC                     0x24
 #define  MT753X_BPDU_PORT_FW_MASK      GENMASK(2, 0)
 
+/* Register for :03 and :0E MAC DA frame control */
+#define MT753X_RGAC2                   0x2c
+#define  MT753X_R0E_PORT_FW_MASK       GENMASK(18, 16)
+#define  MT753X_R0E_PORT_FW(x)         FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x)
+
 enum mt753x_bpdu_port_fw {
        MT753X_BPDU_FOLLOW_MFC,
        MT753X_BPDU_CPU_EXCLUDE = 4,