net: add and export netdev_adjacent_get_private_rcu()
Subsystems (2)
PATCH v2 5/10 net: add and export netdev_adjacent_get_private_rcu()
In bonding, the bond lock could not protect slave list any more, the bond lock will be replace with RTNL or RCU, sometimes bonding needs netdev_adjacent_get_private_rcu() to get a slave in RCU protect, so add a new function and export it.
Suggested-by Jay Vosburgh <[email protected]>
Suggested-by Veaceslav Falico <[email protected]>
Signed-off-by Ding Tianhong <[email protected]>
--- include/linux/netdevice.h | 1 + net/core/dev.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
include/linux/netdevice.h +1 -0
@@ -2840,6 +2840,7 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev, priv = netdev_lower_get_next_private_rcu(dev, &(iter)))void *netdev_adjacent_get_private (struct list_head *adj_list); +void *netdev_adjacent_get_private_rcu (struct list_head *adj_list);struct net_device *netdev_master_upper_dev_get (struct net_device *dev);struct net_device *netdev_master_upper_dev_get_rcu (struct net_device *dev);int netdev_upper_dev_link (struct net_device *dev,struct net_device *upper_dev);
net/core/dev.c +10 -0
@@ -4478,6 +4478,16 @@ void *netdev_adjacent_get_private(struct list_head *adj_list) }EXPORT_SYMBOL (netdev_adjacent_get_private); +void *netdev_adjacent_get_private_rcu (struct list_head *adj_list) +{ +struct netdev_adjacent *adj; + + adj = list_entry_rcu(adj_list, struct netdev_adjacent, list); + +return adj->private; +} +EXPORT_SYMBOL (netdev_adjacent_get_private_rcu); +/** * netdev_all_upper_get_next_dev_rcu - Get the next dev from upper list * @dev: device
Signature · 1 line
1.8.2.1