mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-06 01:09:08 +00:00
net: switchdev: Change notifier chain to be atomic
In order to use the switchdev notifier chain for FDB sync with the device it has to be changed to atomic. The is done because the bridge can learn new FDBs in atomic context. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0baa10fff2
commit
ff5cf10011
@ -571,24 +571,17 @@ int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(switchdev_port_obj_dump);
|
EXPORT_SYMBOL_GPL(switchdev_port_obj_dump);
|
||||||
|
|
||||||
static RAW_NOTIFIER_HEAD(switchdev_notif_chain);
|
static ATOMIC_NOTIFIER_HEAD(switchdev_notif_chain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register_switchdev_notifier - Register notifier
|
* register_switchdev_notifier - Register notifier
|
||||||
* @nb: notifier_block
|
* @nb: notifier_block
|
||||||
*
|
*
|
||||||
* Register switch device notifier. This should be used by code
|
* Register switch device notifier.
|
||||||
* which needs to monitor events happening in particular device.
|
|
||||||
* Return values are same as for atomic_notifier_chain_register().
|
|
||||||
*/
|
*/
|
||||||
int register_switchdev_notifier(struct notifier_block *nb)
|
int register_switchdev_notifier(struct notifier_block *nb)
|
||||||
{
|
{
|
||||||
int err;
|
return atomic_notifier_chain_register(&switchdev_notif_chain, nb);
|
||||||
|
|
||||||
rtnl_lock();
|
|
||||||
err = raw_notifier_chain_register(&switchdev_notif_chain, nb);
|
|
||||||
rtnl_unlock();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(register_switchdev_notifier);
|
EXPORT_SYMBOL_GPL(register_switchdev_notifier);
|
||||||
|
|
||||||
@ -597,16 +590,10 @@ EXPORT_SYMBOL_GPL(register_switchdev_notifier);
|
|||||||
* @nb: notifier_block
|
* @nb: notifier_block
|
||||||
*
|
*
|
||||||
* Unregister switch device notifier.
|
* Unregister switch device notifier.
|
||||||
* Return values are same as for atomic_notifier_chain_unregister().
|
|
||||||
*/
|
*/
|
||||||
int unregister_switchdev_notifier(struct notifier_block *nb)
|
int unregister_switchdev_notifier(struct notifier_block *nb)
|
||||||
{
|
{
|
||||||
int err;
|
return atomic_notifier_chain_unregister(&switchdev_notif_chain, nb);
|
||||||
|
|
||||||
rtnl_lock();
|
|
||||||
err = raw_notifier_chain_unregister(&switchdev_notif_chain, nb);
|
|
||||||
rtnl_unlock();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
|
EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
|
||||||
|
|
||||||
@ -616,18 +603,13 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
|
|||||||
* @dev: port device
|
* @dev: port device
|
||||||
* @info: notifier information data
|
* @info: notifier information data
|
||||||
*
|
*
|
||||||
* Call all network notifier blocks. This should be called by driver
|
* Call all network notifier blocks.
|
||||||
* when it needs to propagate hardware event.
|
|
||||||
* Return values are same as for atomic_notifier_call_chain().
|
|
||||||
* rtnl_lock must be held.
|
|
||||||
*/
|
*/
|
||||||
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
|
||||||
struct switchdev_notifier_info *info)
|
struct switchdev_notifier_info *info)
|
||||||
{
|
{
|
||||||
ASSERT_RTNL();
|
|
||||||
|
|
||||||
info->dev = dev;
|
info->dev = dev;
|
||||||
return raw_notifier_call_chain(&switchdev_notif_chain, val, info);
|
return atomic_notifier_call_chain(&switchdev_notif_chain, val, info);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
|
EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user