diff options
author | Vlad Yasevich <vyasevic@redhat.com> | 2014-05-16 17:04:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-16 22:14:49 -0400 |
commit | 25175ba5c9bff9aaf0229df34bb5d54c81633ec3 (patch) | |
tree | fc6c7a430875d3bd85527772c69b6a8811ba84a4 /include/linux/netdevice.h | |
parent | 4085ebe8c31face855fd01ee40372cb4aab1df3a (diff) |
net: Allow for more then a single subclass for netif_addr_lock
Currently netif_addr_lock_nested assumes that there can be only
a single nesting level between 2 devices. However, if we
have multiple devices of the same type stacked, this fails.
For example:
eth0 <-- vlan0.10 <-- vlan0.10.20
A more complicated configuration may stack more then one type of
device in different order.
Ex:
eth0 <-- vlan0.10 <-- macvlan0 <-- vlan1.10.20 <-- macvlan1
This patch adds an ndo_* function that allows each stackable
device to report its nesting level. If the device doesn't
provide this function default subclass of 1 is used.
Signed-off-by: Vlad Yasevich <vyasevic@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 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index fb912e8e5c7f..9d4b1f1b6b75 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1144,6 +1144,7 @@ struct net_device_ops { | |||
1144 | netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb, | 1144 | netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb, |
1145 | struct net_device *dev, | 1145 | struct net_device *dev, |
1146 | void *priv); | 1146 | void *priv); |
1147 | int (*ndo_get_lock_subclass)(struct net_device *dev); | ||
1147 | }; | 1148 | }; |
1148 | 1149 | ||
1149 | /** | 1150 | /** |
@@ -2950,7 +2951,12 @@ static inline void netif_addr_lock(struct net_device *dev) | |||
2950 | 2951 | ||
2951 | static inline void netif_addr_lock_nested(struct net_device *dev) | 2952 | static inline void netif_addr_lock_nested(struct net_device *dev) |
2952 | { | 2953 | { |
2953 | spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); | 2954 | int subclass = SINGLE_DEPTH_NESTING; |
2955 | |||
2956 | if (dev->netdev_ops->ndo_get_lock_subclass) | ||
2957 | subclass = dev->netdev_ops->ndo_get_lock_subclass(dev); | ||
2958 | |||
2959 | spin_lock_nested(&dev->addr_list_lock, subclass); | ||
2954 | } | 2960 | } |
2955 | 2961 | ||
2956 | static inline void netif_addr_lock_bh(struct net_device *dev) | 2962 | static inline void netif_addr_lock_bh(struct net_device *dev) |