net: dsa: pass bridge device when a port leaves
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Fri, 27 Jan 2017 20:29:41 +0000 (15:29 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sun, 29 Jan 2017 23:42:46 +0000 (18:42 -0500)
Upon reception of the NETDEV_CHANGEUPPER, a leaving port is already
unbridged, so reflect this by assigning the port's bridge_dev pointer to
NULL before calling the port_bridge_leave DSA driver operation.

Now that the bridge_dev pointer is exposed to the drivers, reflecting
the current state of the DSA switch fabric is necessary for the drivers
to adjust their port based VLANs correctly.

Pass the bridge device pointer to the port_bridge_leave operation so
that drivers have all information to re-program their chips properly,
and do not need to cache it anymore.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_priv.h
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/qca8k.c
include/net/dsa.h
net/dsa/slave.c

index 31afc4d4b68b959e7457a615bb98cfb6e9e630d3..32fdcf5570c8f97484ca0a6bb8f0413321cddd1a 100644 (file)
@@ -1354,7 +1354,7 @@ int b53_br_join(struct dsa_switch *ds, int port, struct net_device *bridge)
 }
 EXPORT_SYMBOL(b53_br_join);
 
-void b53_br_leave(struct dsa_switch *ds, int port)
+void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)
 {
        struct b53_device *dev = ds->priv;
        struct net_device *bridge = dev->ports[port].bridge_dev;
index a8031b382c5534a45ffb3489a531b8112b01f07c..5dafb70e75fc3e0fd5f8df44baaa72f63c82b270 100644 (file)
@@ -382,7 +382,7 @@ void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
 int b53_get_sset_count(struct dsa_switch *ds);
 int b53_br_join(struct dsa_switch *ds, int port, struct net_device *bridge);
-void b53_br_leave(struct dsa_switch *ds, int port);
+void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *bridge);
 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
 void b53_br_fast_age(struct dsa_switch *ds, int port);
 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering);
index cb7b24748336d531827c076cdf019cd61bb72a4f..8eb0dc063f4e7bb9fc12c07c6314380480b84e6a 100644 (file)
@@ -2343,7 +2343,8 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
        return err;
 }
 
-static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
+static void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
+                                       struct net_device *br)
 {
        struct mv88e6xxx_chip *chip = ds->priv;
        struct net_device *bridge = chip->ports[port].bridge_dev;
index f67c6a3cebff82b8e20b82846f77a30301237f9c..c85b187aa3d9bac5958a37c9b4aa42cb456a55f4 100644 (file)
@@ -775,7 +775,7 @@ qca8k_port_bridge_join(struct dsa_switch *ds, int port,
 }
 
 static void
-qca8k_port_bridge_leave(struct dsa_switch *ds, int port)
+qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br)
 {
        struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
        int i;
index 924533fd44258a6d8dfdd528df8eb20e06ef6f1b..b951e2ebda75598ac70ba9a91687e24157ebf7d6 100644 (file)
@@ -325,7 +325,8 @@ struct dsa_switch_ops {
        int     (*set_ageing_time)(struct dsa_switch *ds, unsigned int msecs);
        int     (*port_bridge_join)(struct dsa_switch *ds, int port,
                                    struct net_device *bridge);
-       void    (*port_bridge_leave)(struct dsa_switch *ds, int port);
+       void    (*port_bridge_leave)(struct dsa_switch *ds, int port,
+                                    struct net_device *bridge);
        void    (*port_stp_state_set)(struct dsa_switch *ds, int port,
                                      u8 state);
        void    (*port_fast_age)(struct dsa_switch *ds, int port);
index cdb1df87e1112bb9e008dd302c3b29b0b8fcc029..08725286f79dd05b01490fdab74ca0fccc624048 100644 (file)
@@ -565,16 +565,16 @@ static int dsa_slave_bridge_port_join(struct net_device *dev,
        return ret == -EOPNOTSUPP ? 0 : ret;
 }
 
-static void dsa_slave_bridge_port_leave(struct net_device *dev)
+static void dsa_slave_bridge_port_leave(struct net_device *dev,
+                                       struct net_device *br)
 {
        struct dsa_slave_priv *p = netdev_priv(dev);
        struct dsa_switch *ds = p->dp->ds;
 
+       p->dp->bridge_dev = NULL;
 
        if (ds->ops->port_bridge_leave)
-               ds->ops->port_bridge_leave(ds, p->dp->index);
-
-       p->dp->bridge_dev = NULL;
+               ds->ops->port_bridge_leave(ds, p->dp->index, br);
 
        /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer,
         * so allow it to be in BR_STATE_FORWARDING to be kept functional
@@ -1343,7 +1343,7 @@ static int dsa_slave_port_upper_event(struct net_device *dev,
                        if (info->linking)
                                err = dsa_slave_bridge_port_join(dev, upper);
                        else
-                               dsa_slave_bridge_port_leave(dev);
+                               dsa_slave_bridge_port_leave(dev, upper);
                }
 
                break;