mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
net: add RCU variant to search for netdev_adjacent link
Currently we have only the RTNL flavour, however we can traverse it while holding only RCU, so add the RCU search. Add an RCU variant that uses list_head * as an argument, so that it can be universally used afterwards. CC: "David S. Miller" <davem@davemloft.net> CC: Eric Dumazet <edumazet@google.com> CC: Jiri Pirko <jiri@resnulli.us> CC: Alexander Duyck <alexander.h.duyck@intel.com> CC: Cong Wang <amwang@redhat.com> Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2f268f129c
commit
5249dec738
1 changed files with 13 additions and 0 deletions
|
@ -4380,6 +4380,19 @@ struct netdev_adjacent {
|
|||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
static struct netdev_adjacent *__netdev_find_adj_rcu(struct net_device *dev,
|
||||
struct net_device *adj_dev,
|
||||
struct list_head *adj_list)
|
||||
{
|
||||
struct netdev_adjacent *adj;
|
||||
|
||||
list_for_each_entry_rcu(adj, adj_list, list) {
|
||||
if (adj->dev == adj_dev)
|
||||
return adj;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct netdev_adjacent *__netdev_find_adj(struct net_device *dev,
|
||||
struct net_device *adj_dev,
|
||||
struct list_head *adj_list)
|
||||
|
|
Loading…
Reference in a new issue