net: dsa: Add teardown callback for drivers
authorVladimir Oltean <olteanv@gmail.com>
Sat, 8 Jun 2019 12:04:28 +0000 (15:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 8 Jun 2019 22:20:39 +0000 (15:20 -0700)
This is helpful for e.g. draining per-driver (not per-port) tagger
queues.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dsa.h
net/dsa/dsa2.c

index 1131d9f..82a2baa 100644 (file)
@@ -357,6 +357,7 @@ struct dsa_switch_ops {
                                                  int port);
 
        int     (*setup)(struct dsa_switch *ds);
+       void    (*teardown)(struct dsa_switch *ds);
        u32     (*get_phy_flags)(struct dsa_switch *ds, int port);
 
        /*
index 38d11c8..3abd173 100644 (file)
@@ -408,6 +408,9 @@ static void dsa_switch_teardown(struct dsa_switch *ds)
 
        dsa_switch_unregister_notifier(ds);
 
+       if (ds->ops->teardown)
+               ds->ops->teardown(ds);
+
        if (ds->devlink) {
                devlink_unregister(ds->devlink);
                devlink_free(ds->devlink);