Commit 553eb544 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv88e6xxx: remove bridge work

Now that the bridge code defers the switchdev port state setting, there
is no need to defer the port STP state change within the mv88e6xxx code.
Thus get rid of the driver's bridge work code.

This also fixes a race condition where the DSA layer assumes that the
bridge code already set the unbridged port's STP state to Disabled
before restoring the Forwarding state.

As a consequence, this also fixes the FDB flush for the unbridged port
which now correctly occurs during the Forwarding to Disabled transition.

Fixes: 0bc05d58 ("switchdev: allow caller to explicitly request attr_set as deferred")
Reported-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b0e95ccd
...@@ -1373,6 +1373,7 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, ...@@ -1373,6 +1373,7 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
{ {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
int stp_state; int stp_state;
int err;
if (!mv88e6xxx_has(ps, MV88E6XXX_FLAG_PORTSTATE)) if (!mv88e6xxx_has(ps, MV88E6XXX_FLAG_PORTSTATE))
return; return;
...@@ -1394,12 +1395,13 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, ...@@ -1394,12 +1395,13 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
break; break;
} }
/* mv88e6xxx_port_stp_state_set may be called with softirqs disabled, mutex_lock(&ps->smi_mutex);
* so we can not update the port state directly but need to schedule it. err = _mv88e6xxx_port_state(ps, port, stp_state);
*/ mutex_unlock(&ps->smi_mutex);
ps->ports[port].state = stp_state;
set_bit(port, ps->port_state_update_mask); if (err)
schedule_work(&ps->bridge_work); netdev_err(ds->ports[port], "failed to update state to %s\n",
mv88e6xxx_port_state_names[stp_state]);
} }
static int _mv88e6xxx_port_pvid(struct mv88e6xxx_priv_state *ps, int port, static int _mv88e6xxx_port_pvid(struct mv88e6xxx_priv_state *ps, int port,
...@@ -2535,27 +2537,6 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port) ...@@ -2535,27 +2537,6 @@ static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
mutex_unlock(&ps->smi_mutex); mutex_unlock(&ps->smi_mutex);
} }
static void mv88e6xxx_bridge_work(struct work_struct *work)
{
struct mv88e6xxx_priv_state *ps;
struct dsa_switch *ds;
int port;
ps = container_of(work, struct mv88e6xxx_priv_state, bridge_work);
ds = ps->ds;
mutex_lock(&ps->smi_mutex);
for (port = 0; port < ps->info->num_ports; ++port)
if (test_and_clear_bit(port, ps->port_state_update_mask) &&
_mv88e6xxx_port_state(ps, port, ps->ports[port].state))
netdev_warn(ds->ports[port],
"failed to update state to %s\n",
mv88e6xxx_port_state_names[ps->ports[port].state]);
mutex_unlock(&ps->smi_mutex);
}
static int _mv88e6xxx_phy_page_write(struct mv88e6xxx_priv_state *ps, static int _mv88e6xxx_phy_page_write(struct mv88e6xxx_priv_state *ps,
int port, int page, int reg, int val) int port, int page, int reg, int val)
{ {
...@@ -3145,8 +3126,6 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) ...@@ -3145,8 +3126,6 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
ps->ds = ds; ps->ds = ds;
INIT_WORK(&ps->bridge_work, mv88e6xxx_bridge_work);
if (mv88e6xxx_has(ps, MV88E6XXX_FLAG_EEPROM)) if (mv88e6xxx_has(ps, MV88E6XXX_FLAG_EEPROM))
mutex_init(&ps->eeprom_mutex); mutex_init(&ps->eeprom_mutex);
......
...@@ -543,7 +543,6 @@ struct mv88e6xxx_vtu_stu_entry { ...@@ -543,7 +543,6 @@ struct mv88e6xxx_vtu_stu_entry {
struct mv88e6xxx_priv_port { struct mv88e6xxx_priv_port {
struct net_device *bridge_dev; struct net_device *bridge_dev;
u8 state;
}; };
struct mv88e6xxx_priv_state { struct mv88e6xxx_priv_state {
...@@ -593,10 +592,6 @@ struct mv88e6xxx_priv_state { ...@@ -593,10 +592,6 @@ struct mv88e6xxx_priv_state {
struct mv88e6xxx_priv_port ports[DSA_MAX_PORTS]; struct mv88e6xxx_priv_port ports[DSA_MAX_PORTS];
DECLARE_BITMAP(port_state_update_mask, DSA_MAX_PORTS);
struct work_struct bridge_work;
/* A switch may have a GPIO line tied to its reset pin. Parse /* A switch may have a GPIO line tied to its reset pin. Parse
* this from the device tree, and use it before performing * this from the device tree, and use it before performing
* switch soft reset. * switch soft reset.
......
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