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>
This commit is contained in:

committed by
David S. Miller

parent
3f7832c26c
commit
60724d4bae
@@ -14,6 +14,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include <linux/of_platform.h>
|
||||
@@ -261,6 +262,28 @@ bool dsa_schedule_work(struct work_struct *work)
|
||||
return queue_work(dsa_owq, work);
|
||||
}
|
||||
|
||||
static ATOMIC_NOTIFIER_HEAD(dsa_notif_chain);
|
||||
|
||||
int register_dsa_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return atomic_notifier_chain_register(&dsa_notif_chain, nb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(register_dsa_notifier);
|
||||
|
||||
int unregister_dsa_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return atomic_notifier_chain_unregister(&dsa_notif_chain, nb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(unregister_dsa_notifier);
|
||||
|
||||
int call_dsa_notifiers(unsigned long val, struct net_device *dev,
|
||||
struct dsa_notifier_info *info)
|
||||
{
|
||||
info->dev = dev;
|
||||
return atomic_notifier_call_chain(&dsa_notif_chain, val, info);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(call_dsa_notifiers);
|
||||
|
||||
static int __init dsa_init_module(void)
|
||||
{
|
||||
int rc;
|
||||
|
Reference in New Issue
Block a user