Commit 254245d23396aca1f9100d500163d7bd6019ab6f

Authored by stephen hemminger
Committed by David S. Miller
1 parent 856540ee31

netdev: add netdev_continue_rcu

This adds an RCU macro for continuing search, useful for some
network devices like vlan.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 16 additions and 0 deletions Side-by-side Diff

include/linux/netdevice.h
... ... @@ -1079,6 +1079,8 @@
1079 1079 list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
1080 1080 #define for_each_netdev_continue(net, d) \
1081 1081 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
  1082 +#define for_each_netdev_continue_rcu(net, d) \
  1083 + list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
1082 1084 #define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
1083 1085  
1084 1086 static inline struct net_device *next_net_device(struct net_device *dev)
include/linux/rculist.h
... ... @@ -262,6 +262,20 @@
262 262 (pos) = rcu_dereference((pos)->next))
263 263  
264 264 /**
  265 + * list_for_each_entry_continue_rcu - continue iteration over list of given type
  266 + * @pos: the type * to use as a loop cursor.
  267 + * @head: the head for your list.
  268 + * @member: the name of the list_struct within the struct.
  269 + *
  270 + * Continue to iterate over list of given type, continuing after
  271 + * the current position.
  272 + */
  273 +#define list_for_each_entry_continue_rcu(pos, head, member) \
  274 + for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \
  275 + prefetch(pos->member.next), &pos->member != (head); \
  276 + pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
  277 +
  278 +/**
265 279 * hlist_del_rcu - deletes entry from hash list without re-initialization
266 280 * @n: the element to delete from the hash list.
267 281 *