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.
Showing the changes to net/switchdev/switchdev.c (1 of 1 file). Show all
Unified · Split
| @@ -409,10 +409,10 @@ static int switchdev_lower_dev_walk(struct net_device *lower_dev, · 408 unmodified lines | |||
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | static struct net_device * | 411 | static struct net_device * |
| 412 | switchdev_lower_dev_find(struct net_device *dev, | 412 | switchdev_lower_dev_find_rcu(struct net_device *dev, |
| 413 | bool (*check_cb)(const struct net_device *dev), | 413 | bool (*check_cb)(const struct net_device *dev), |
| 414 | bool (*foreign_dev_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)) | 415 | const struct net_device *foreign_dev)) |
| 416 | { | 416 | { |
| 417 | struct switchdev_nested_priv switchdev_priv = { | 417 | struct switchdev_nested_priv switchdev_priv = { |
| 418 | .check_cb = check_cb, | 418 | .check_cb = check_cb, |
| @@ -451,7 +451,7 @@ static int __switchdev_handle_fdb_event_to_device(struct net_device *dev, · 32 unmodified lines | |||
| 451 | return mod_cb(dev, orig_dev, event, info->ctx, fdb_info); | 451 | return mod_cb(dev, orig_dev, event, info->ctx, fdb_info); |
| 452 | 452 | ||
| 453 | if (netif_is_lag_master(dev)) { | 453 | 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)) |
| 455 | goto maybe_bridged_with_us; | 455 | goto maybe_bridged_with_us; |
| 456 | 456 | ||
| 457 | /* This is a LAG interface that we offload */ | 457 | /* 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 | |||
| 465 | * towards a bridge device. | 465 | * towards a bridge device. |
| 466 | */ | 466 | */ |
| 467 | if (netif_is_bridge_master(dev)) { | 467 | 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)) |
| 469 | return 0; | 469 | return 0; |
| 470 | 470 | ||
| 471 | /* This is a bridge interface that we offload */ | 471 | /* 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 | |||
| 478 | * that we offload. | 478 | * that we offload. |
| 479 | */ | 479 | */ |
| 480 | if (!check_cb(lower_dev) && | 480 | if (!check_cb(lower_dev) && |
| 481 | !switchdev_lower_dev_find(lower_dev, check_cb, | 481 | !switchdev_lower_dev_find_rcu(lower_dev, check_cb, |
| 482 | foreign_dev_check_cb)) | 482 | foreign_dev_check_cb)) |
| 483 | continue; | 483 | continue; |
| 484 | 484 | ||
| 485 | err = __switchdev_handle_fdb_event_to_device(lower_dev, orig_dev, | 485 | err = __switchdev_handle_fdb_event_to_device(lower_dev, orig_dev, |
| @@ -501,7 +501,7 @@ maybe_bridged_with_us: · 15 unmodified lines | |||
| 501 | if (!br || !netif_is_bridge_master(br)) | 501 | if (!br || !netif_is_bridge_master(br)) |
| 502 | return 0; | 502 | return 0; |
| 503 | 503 | ||
| 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)) |
| 505 | return 0; | 505 | return 0; |
| 506 | 506 | ||
| 507 | return __switchdev_handle_fdb_event_to_device(br, orig_dev, event, fdb_info, | 507 | return __switchdev_handle_fdb_event_to_device(br, orig_dev, event, fdb_info, |