Commit d7c66073 authored by Arınç ÜNAL's avatar Arınç ÜNAL Committed by David S. Miller

net: dsa: mt7530: fix handling of BPDUs on MT7530 switch

BPDUs are link-local frames, therefore they must be trapped to the CPU
port. Currently, the MT7530 switch treats BPDUs as regular multicast
frames, therefore flooding them to user ports. To fix this, set BPDUs to be
trapped to the CPU port. Group this on mt7530_setup() and
mt7531_setup_common() into mt753x_trap_frames() and call that.

Fixes: b8f126a8 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
Signed-off-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4ae90f90
...@@ -985,6 +985,14 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) ...@@ -985,6 +985,14 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
mutex_unlock(&priv->reg_mutex); mutex_unlock(&priv->reg_mutex);
} }
static void
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);
}
static int static int
mt753x_cpu_port_enable(struct dsa_switch *ds, int port) mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
{ {
...@@ -2262,6 +2270,8 @@ mt7530_setup(struct dsa_switch *ds) ...@@ -2262,6 +2270,8 @@ mt7530_setup(struct dsa_switch *ds)
priv->p6_interface = PHY_INTERFACE_MODE_NA; priv->p6_interface = PHY_INTERFACE_MODE_NA;
mt753x_trap_frames(priv);
/* Enable and reset MIB counters */ /* Enable and reset MIB counters */
mt7530_mib_reset(ds); mt7530_mib_reset(ds);
...@@ -2361,9 +2371,7 @@ mt7531_setup_common(struct dsa_switch *ds) ...@@ -2361,9 +2371,7 @@ mt7531_setup_common(struct dsa_switch *ds)
struct mt7530_priv *priv = ds->priv; struct mt7530_priv *priv = ds->priv;
int ret, i; int ret, i;
/* Trap BPDUs to the CPU port(s) */ mt753x_trap_frames(priv);
mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
MT753X_BPDU_CPU_ONLY);
/* Enable and reset MIB counters */ /* Enable and reset MIB counters */
mt7530_mib_reset(ds); mt7530_mib_reset(ds);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment