History

net: switchdev: rename switchdev_lower_dev_find to switchdev_lower_dev_find_rcu

switchdev_lower_dev_find() assumes RCU read-side critical section calling context, since it uses netdev_walk_all_lower_dev_rcu(). Rename it appropriately, in preparation of adding a similar iterator that assumes writer-side rtnl_mutex protection.

Vladimir Oltean committed 4 years ago

Commit 7b465f41 parent b28d5801 file · +9 −9Browse files

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

Unified · Split

net/switchdev/switchdev.c+9−9
@@ -409,10 +409,10 @@ static int switchdev_lower_dev_walk(struct net_device *lower_dev, · 408 unmodified lines
409409 }
410410
411411 static struct net_device *
412−switchdev_lower_dev_find(struct net_device *dev,
413− bool (*check_cb)(const struct net_device *dev),
414− bool (*foreign_dev_check_cb)(const struct net_device *dev,
415− const struct net_device *foreign_dev))
412+switchdev_lower_dev_find_rcu(struct net_device *dev,
413+ bool (*check_cb)(const struct net_device *dev),
414+ bool (*foreign_dev_check_cb)(const struct net_device *dev,
415+ const struct net_device *foreign_dev))
416416 {
417417 struct switchdev_nested_priv switchdev_priv = {
418418 .check_cb = check_cb,
@@ -451,7 +451,7 @@ static int __switchdev_handle_fdb_event_to_device(struct net_device *dev, · 32 unmodified lines
451451 return mod_cb(dev, orig_dev, event, info->ctx, fdb_info);
452452
453453 if (netif_is_lag_master(dev)) {
454− if (!switchdev_lower_dev_find(dev, check_cb, foreign_dev_check_cb))
454+ if (!switchdev_lower_dev_find_rcu(dev, check_cb, foreign_dev_check_cb))
455455 goto maybe_bridged_with_us;
456456
457457 /* This is a LAG interface that we offload */
@@ -465,7 +465,7 @@ static int __switchdev_handle_fdb_event_to_device(struct net_device *dev, · 7 unmodified lines
465465 * towards a bridge device.
466466 */
467467 if (netif_is_bridge_master(dev)) {
468− if (!switchdev_lower_dev_find(dev, check_cb, foreign_dev_check_cb))
468+ if (!switchdev_lower_dev_find_rcu(dev, check_cb, foreign_dev_check_cb))
469469 return 0;
470470
471471 /* This is a bridge interface that we offload */
@@ -478,8 +478,8 @@ static int __switchdev_handle_fdb_event_to_device(struct net_device *dev, · 6 unmodified lines
478478 * that we offload.
479479 */
480480 if (!check_cb(lower_dev) &&
481− !switchdev_lower_dev_find(lower_dev, check_cb,
482− foreign_dev_check_cb))
481+ !switchdev_lower_dev_find_rcu(lower_dev, check_cb,
482+ foreign_dev_check_cb))
483483 continue;
484484
485485 err = __switchdev_handle_fdb_event_to_device(lower_dev, orig_dev,
@@ -501,7 +501,7 @@ maybe_bridged_with_us: · 15 unmodified lines
501501 if (!br || !netif_is_bridge_master(br))
502502 return 0;
503503
504− if (!switchdev_lower_dev_find(br, check_cb, foreign_dev_check_cb))
504+ if (!switchdev_lower_dev_find_rcu(br, check_cb, foreign_dev_check_cb))
505505 return 0;
506506
507507 return __switchdev_handle_fdb_event_to_device(br, orig_dev, event, fdb_info,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t