History

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.

Arkadi Sharshevsky committed 9 years ago

Commit ff5cf101 parent 0baa10f1 file · +6 −24Browse files

Showing the changes to net/switchdev/switchdev.c (1 of 1 file). Show all

Unified · Split

net/switchdev/switchdev.c+6−24
@@ -571,24 +571,17 @@ int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj, · 570 unmodified lines
571571 }
572572 EXPORT_SYMBOL_GPL(switchdev_port_obj_dump);
573573
574−static RAW_NOTIFIER_HEAD(switchdev_notif_chain);
574+static ATOMIC_NOTIFIER_HEAD(switchdev_notif_chain);
575575
576576 /**
577577 * register_switchdev_notifier - Register notifier
578578 * @nb: notifier_block
579579 *
580− * Register switch device notifier. This should be used by code
581− * which needs to monitor events happening in particular device.
582− * Return values are same as for atomic_notifier_chain_register().
580+ * Register switch device notifier.
583581 */
584582 int register_switchdev_notifier(struct notifier_block *nb)
585583 {
586− int err;
587−
588− rtnl_lock();
589− err = raw_notifier_chain_register(&switchdev_notif_chain, nb);
590− rtnl_unlock();
591− return err;
584+ return atomic_notifier_chain_register(&switchdev_notif_chain, nb);
592585 }
593586 EXPORT_SYMBOL_GPL(register_switchdev_notifier);
594587
@@ -597,16 +590,10 @@ EXPORT_SYMBOL_GPL(register_switchdev_notifier); · 2 unmodified lines
597590 * @nb: notifier_block
598591 *
599592 * Unregister switch device notifier.
600− * Return values are same as for atomic_notifier_chain_unregister().
601593 */
602594 int unregister_switchdev_notifier(struct notifier_block *nb)
603595 {
604− int err;
605−
606− rtnl_lock();
607− err = raw_notifier_chain_unregister(&switchdev_notif_chain, nb);
608− rtnl_unlock();
609− return err;
596+ return atomic_notifier_chain_unregister(&switchdev_notif_chain, nb);
610597 }
611598 EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
612599
@@ -616,18 +603,13 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_notifier); · 3 unmodified lines
616603 * @dev: port device
617604 * @info: notifier information data
618605 *
619− * Call all network notifier blocks. This should be called by driver
620− * when it needs to propagate hardware event.
621− * Return values are same as for atomic_notifier_call_chain().
622− * rtnl_lock must be held.
606+ * Call all network notifier blocks.
623607 */
624608 int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
625609 struct switchdev_notifier_info *info)
626610 {
627− ASSERT_RTNL();
628−
629611 info->dev = dev;
630− return raw_notifier_call_chain(&switchdev_notif_chain, val, info);
612+ return atomic_notifier_call_chain(&switchdev_notif_chain, val, info);
631613 }
632614 EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
633615