diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-08-28 17:25:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-29 16:19:42 -0400 |
commit | 8b5be8561b804edf6b58fc27edbccf1d45863e08 (patch) | |
tree | 969e67314edbc253f3bcb0460b7a16d93de619c5 /include/linux/netdevice.h | |
parent | 48311f46853c0361f9fba7e0e6bb1652d633c049 (diff) |
net: add netdev_for_each_upper_dev_rcu()
The new macro netdev_for_each_upper_dev_rcu(dev, upper, iter) iterates
through the dev->upper_dev_list starting from the first element, using
the netdev_upper_get_next_dev_rcu(dev, &iter).
Must be called under RCU read lock.
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 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 5ccf5b73c378..3ad49b833eab 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2768,6 +2768,16 @@ extern int bpf_jit_enable; | |||
2768 | extern bool netdev_has_upper_dev(struct net_device *dev, | 2768 | extern bool netdev_has_upper_dev(struct net_device *dev, |
2769 | struct net_device *upper_dev); | 2769 | struct net_device *upper_dev); |
2770 | extern bool netdev_has_any_upper_dev(struct net_device *dev); | 2770 | extern bool netdev_has_any_upper_dev(struct net_device *dev); |
2771 | extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, | ||
2772 | struct list_head **iter); | ||
2773 | |||
2774 | /* iterate through upper list, must be called under RCU read lock */ | ||
2775 | #define netdev_for_each_upper_dev_rcu(dev, upper, iter) \ | ||
2776 | for (iter = &(dev)->upper_dev_list, \ | ||
2777 | upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \ | ||
2778 | upper; \ | ||
2779 | upper = netdev_upper_get_next_dev_rcu(dev, &(iter))) | ||
2780 | |||
2771 | extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); | 2781 | extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); |
2772 | extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); | 2782 | extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); |
2773 | extern int netdev_upper_dev_link(struct net_device *dev, | 2783 | extern int netdev_upper_dev_link(struct net_device *dev, |