diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-09-25 09:20:08 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-26 16:02:04 -0400 |
commit | 5249dec7380cb64928d2ae6201028b4da1dceb1e (patch) | |
tree | 2503cd128a3302d5871d6fa0ed804e508188a54f /net | |
parent | 2f268f129c2d1a05d297fe3ee34d393f862d2b22 (diff) | |
download | linux-5249dec7380cb64928d2ae6201028b4da1dceb1e.tar.bz2 |
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 9a395e03da74..9290f09cdf26 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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) |