diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-10-11 13:57:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-12 15:10:01 -0400 |
commit | 60724d4bae14cd295b27b1610cad9a2720eb0860 (patch) | |
tree | c686c50e92a9d1ffd68c3892732a723a6f127c03 /net/dsa/dsa.c | |
parent | 3f7832c26cc0cad2245981f777f3ee684399ce93 (diff) |
net: dsa: Add support for DSA specific notifiers
In preparation for communicating a given DSA network device's port
number and switch index, create a specialized DSA notifier and two
events: DSA_PORT_REGISTER and DSA_PORT_UNREGISTER that communicate: the
slave network device (slave_dev), port number and switch number in the
tree.
This will be later used for network device drivers like bcmsysport which
needs to cooperate with its DSA network devices to set-up queue mapping
and scheduling.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r-- | net/dsa/dsa.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 51ca2a524a27..832c659ff993 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/notifier.h> | ||
17 | #include <linux/of.h> | 18 | #include <linux/of.h> |
18 | #include <linux/of_mdio.h> | 19 | #include <linux/of_mdio.h> |
19 | #include <linux/of_platform.h> | 20 | #include <linux/of_platform.h> |
@@ -261,6 +262,28 @@ bool dsa_schedule_work(struct work_struct *work) | |||
261 | return queue_work(dsa_owq, work); | 262 | return queue_work(dsa_owq, work); |
262 | } | 263 | } |
263 | 264 | ||
265 | static ATOMIC_NOTIFIER_HEAD(dsa_notif_chain); | ||
266 | |||
267 | int register_dsa_notifier(struct notifier_block *nb) | ||
268 | { | ||
269 | return atomic_notifier_chain_register(&dsa_notif_chain, nb); | ||
270 | } | ||
271 | EXPORT_SYMBOL_GPL(register_dsa_notifier); | ||
272 | |||
273 | int unregister_dsa_notifier(struct notifier_block *nb) | ||
274 | { | ||
275 | return atomic_notifier_chain_unregister(&dsa_notif_chain, nb); | ||
276 | } | ||
277 | EXPORT_SYMBOL_GPL(unregister_dsa_notifier); | ||
278 | |||
279 | int call_dsa_notifiers(unsigned long val, struct net_device *dev, | ||
280 | struct dsa_notifier_info *info) | ||
281 | { | ||
282 | info->dev = dev; | ||
283 | return atomic_notifier_call_chain(&dsa_notif_chain, val, info); | ||
284 | } | ||
285 | EXPORT_SYMBOL_GPL(call_dsa_notifiers); | ||
286 | |||
264 | static int __init dsa_init_module(void) | 287 | static int __init dsa_init_module(void) |
265 | { | 288 | { |
266 | int rc; | 289 | int rc; |