diff options
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index aba10d2a8bc3..a4f3b0a9aeaf 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -5445,6 +5445,52 @@ void *netdev_lower_get_next(struct net_device *dev, struct list_head **iter) | |||
| 5445 | EXPORT_SYMBOL(netdev_lower_get_next); | 5445 | EXPORT_SYMBOL(netdev_lower_get_next); |
| 5446 | 5446 | ||
| 5447 | /** | 5447 | /** |
| 5448 | * netdev_all_lower_get_next - Get the next device from all lower neighbour list | ||
| 5449 | * @dev: device | ||
| 5450 | * @iter: list_head ** of the current position | ||
| 5451 | * | ||
| 5452 | * Gets the next netdev_adjacent from the dev's all lower neighbour | ||
| 5453 | * list, starting from iter position. The caller must hold RTNL lock or | ||
| 5454 | * its own locking that guarantees that the neighbour all lower | ||
| 5455 | * list will remain unchanged. | ||
| 5456 | */ | ||
| 5457 | struct net_device *netdev_all_lower_get_next(struct net_device *dev, struct list_head **iter) | ||
| 5458 | { | ||
| 5459 | struct netdev_adjacent *lower; | ||
| 5460 | |||
| 5461 | lower = list_entry(*iter, struct netdev_adjacent, list); | ||
| 5462 | |||
| 5463 | if (&lower->list == &dev->all_adj_list.lower) | ||
| 5464 | return NULL; | ||
| 5465 | |||
| 5466 | *iter = lower->list.next; | ||
| 5467 | |||
| 5468 | return lower->dev; | ||
| 5469 | } | ||
| 5470 | EXPORT_SYMBOL(netdev_all_lower_get_next); | ||
| 5471 | |||
| 5472 | /** | ||
| 5473 | * netdev_all_lower_get_next_rcu - Get the next device from all | ||
| 5474 | * lower neighbour list, RCU variant | ||
| 5475 | * @dev: device | ||
| 5476 | * @iter: list_head ** of the current position | ||
| 5477 | * | ||
| 5478 | * Gets the next netdev_adjacent from the dev's all lower neighbour | ||
| 5479 | * list, starting from iter position. The caller must hold RCU read lock. | ||
| 5480 | */ | ||
| 5481 | struct net_device *netdev_all_lower_get_next_rcu(struct net_device *dev, | ||
| 5482 | struct list_head **iter) | ||
| 5483 | { | ||
| 5484 | struct netdev_adjacent *lower; | ||
| 5485 | |||
| 5486 | lower = list_first_or_null_rcu(&dev->all_adj_list.lower, | ||
| 5487 | struct netdev_adjacent, list); | ||
| 5488 | |||
| 5489 | return lower ? lower->dev : NULL; | ||
| 5490 | } | ||
| 5491 | EXPORT_SYMBOL(netdev_all_lower_get_next_rcu); | ||
| 5492 | |||
| 5493 | /** | ||
| 5448 | * netdev_lower_get_first_private_rcu - Get the first ->private from the | 5494 | * netdev_lower_get_first_private_rcu - Get the first ->private from the |
| 5449 | * lower neighbour list, RCU | 5495 | * lower neighbour list, RCU |
| 5450 | * variant | 5496 | * variant |
