aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
authorVivien Didelot <[email protected]>2017-02-03 18:20:20 +0000
committerDavid S. Miller <[email protected]>2017-02-06 21:53:29 +0000
commitf515f192ab4f45bb695146b82432d63d98775787 (patch)
tree5a6fddcbb34e28e6850e63d3023504b46e5ea9c3 /net/dsa/dsa.c
parentnet: dsa: change state setter scope (diff)
downloadkernel-f515f192ab4f45bb695146b82432d63d98775787.tar.gz
kernel-f515f192ab4f45bb695146b82432d63d98775787.zip
net: dsa: add switch notifier
Add a notifier block per DSA switch, registered against a notifier head in the switch fabric they belong to. This infrastructure will allow to propagate fabric-wide events such as port bridging, VLAN configuration, etc. If a DSA switch driver cares about cross-chip configuration, such events can be caught. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index beb79ccf0f59..22e44f691ab9 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -275,6 +275,10 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
if (ret < 0)
return ret;
+ ret = dsa_switch_register_notifier(ds);
+ if (ret)
+ return ret;
+
if (ops->set_addr) {
ret = ops->set_addr(ds, dst->master_netdev->dev_addr);
if (ret < 0)
@@ -400,6 +404,8 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
if (ds->slave_mii_bus && ds->ops->phy_read)
mdiobus_unregister(ds->slave_mii_bus);
+
+ dsa_switch_unregister_notifier(ds);
}
#ifdef CONFIG_PM_SLEEP