diff mbox series

[v3,net-next,02/17] net: dsa: Add teardown callback for drivers

Message ID 20190604170756.14338-3-olteanv@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series PTP support for the SJA1105 DSA driver | expand

Commit Message

Vladimir Oltean June 4, 2019, 5:07 p.m. UTC
This is helpful for e.g. draining per-driver (not per-port) tagger
queues.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
---
Changes in v3:

Moved after dsa_switch_unregister_notifier, which is symmetrical to
where the setup callback is.

Changes in v2:

Patch is new.

 include/net/dsa.h | 1 +
 net/dsa/dsa2.c    | 3 +++
 2 files changed, 4 insertions(+)

Comments

Andrew Lunn June 4, 2019, 6:15 p.m. UTC | #1
On Tue, Jun 04, 2019 at 08:07:41PM +0300, Vladimir Oltean wrote:
> 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>

    Andrew
Florian Fainelli June 4, 2019, 8:32 p.m. UTC | #2
On 6/4/2019 10:07 AM, Vladimir Oltean wrote:
> This is helpful for e.g. draining per-driver (not per-port) tagger
> queues.
> 
> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/include/net/dsa.h b/include/net/dsa.h
index a7f36219904f..4033e0677be4 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -361,6 +361,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);
 
 	/*
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index b70befe8a3c8..d98e0e8ee8aa 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -412,6 +412,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);