diff options
author | Vlad Yasevich <vyasevic@redhat.com> | 2014-05-16 17:04:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-16 22:14:49 -0400 |
commit | 4085ebe8c31face855fd01ee40372cb4aab1df3a (patch) | |
tree | 1f3d2c9b76f1b97c5e264c36884ccdfc530cfee9 /include | |
parent | 29e98242783ed3ba569797846a606ba66f781625 (diff) |
net: Find the nesting level of a given device by type.
Multiple devices in the kernel can be stacked/nested and they
need to know their nesting level for the purposes of lockdep.
This patch provides a generic function that determines a nesting
level of a particular device by its type (ex: vlan, macvlan, etc).
We only care about nesting of the same type of devices.
For example:
eth0 <- vlan0.10 <- macvlan0 <- vlan1.20
The nesting level of vlan1.20 would be 1, since there is another vlan
in the stack under it.
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-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 20e99efb1ca6..fb912e8e5c7f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -3077,6 +3077,14 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev, | |||
3077 | priv; \ | 3077 | priv; \ |
3078 | priv = netdev_lower_get_next_private_rcu(dev, &(iter))) | 3078 | priv = netdev_lower_get_next_private_rcu(dev, &(iter))) |
3079 | 3079 | ||
3080 | void *netdev_lower_get_next(struct net_device *dev, | ||
3081 | struct list_head **iter); | ||
3082 | #define netdev_for_each_lower_dev(dev, ldev, iter) \ | ||
3083 | for (iter = &(dev)->adj_list.lower, \ | ||
3084 | ldev = netdev_lower_get_next(dev, &(iter)); \ | ||
3085 | ldev; \ | ||
3086 | ldev = netdev_lower_get_next(dev, &(iter))) | ||
3087 | |||
3080 | void *netdev_adjacent_get_private(struct list_head *adj_list); | 3088 | void *netdev_adjacent_get_private(struct list_head *adj_list); |
3081 | void *netdev_lower_get_first_private_rcu(struct net_device *dev); | 3089 | void *netdev_lower_get_first_private_rcu(struct net_device *dev); |
3082 | struct net_device *netdev_master_upper_dev_get(struct net_device *dev); | 3090 | struct net_device *netdev_master_upper_dev_get(struct net_device *dev); |
@@ -3092,6 +3100,8 @@ void netdev_upper_dev_unlink(struct net_device *dev, | |||
3092 | void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); | 3100 | void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); |
3093 | void *netdev_lower_dev_get_private(struct net_device *dev, | 3101 | void *netdev_lower_dev_get_private(struct net_device *dev, |
3094 | struct net_device *lower_dev); | 3102 | struct net_device *lower_dev); |
3103 | int dev_get_nest_level(struct net_device *dev, | ||
3104 | bool (*type_check)(struct net_device *dev)); | ||
3095 | int skb_checksum_help(struct sk_buff *skb); | 3105 | int skb_checksum_help(struct sk_buff *skb); |
3096 | struct sk_buff *__skb_gso_segment(struct sk_buff *skb, | 3106 | struct sk_buff *__skb_gso_segment(struct sk_buff *skb, |
3097 | netdev_features_t features, bool tx_path); | 3107 | netdev_features_t features, bool tx_path); |