diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-15 03:15:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-15 03:15:08 -0400 |
commit | b9e40857682ecfc5bcd0356a23ff409883ffb982 (patch) | |
tree | d241fd289bed6d16f36f6d26815c1e78e212c89a /net/core/dev.c | |
parent | e308a5d806c852f56590ffdd3834d0df0cbed8d7 (diff) |
netdev: Do not use TX lock to protect address lists.
Now that we have a specific lock to protect the network
device unicast and multicast lists, remove extraneous
grabs of the TX lock in cases where the code only needs
address list protection.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index ef1502d71f25..9b49f74a9820 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2981,11 +2981,9 @@ void __dev_set_rx_mode(struct net_device *dev) | |||
2981 | 2981 | ||
2982 | void dev_set_rx_mode(struct net_device *dev) | 2982 | void dev_set_rx_mode(struct net_device *dev) |
2983 | { | 2983 | { |
2984 | netif_tx_lock_bh(dev); | 2984 | netif_addr_lock_bh(dev); |
2985 | netif_addr_lock(dev); | ||
2986 | __dev_set_rx_mode(dev); | 2985 | __dev_set_rx_mode(dev); |
2987 | netif_addr_unlock(dev); | 2986 | netif_addr_unlock_bh(dev); |
2988 | netif_tx_unlock_bh(dev); | ||
2989 | } | 2987 | } |
2990 | 2988 | ||
2991 | int __dev_addr_delete(struct dev_addr_list **list, int *count, | 2989 | int __dev_addr_delete(struct dev_addr_list **list, int *count, |
@@ -3063,13 +3061,11 @@ int dev_unicast_delete(struct net_device *dev, void *addr, int alen) | |||
3063 | 3061 | ||
3064 | ASSERT_RTNL(); | 3062 | ASSERT_RTNL(); |
3065 | 3063 | ||
3066 | netif_tx_lock_bh(dev); | 3064 | netif_addr_lock_bh(dev); |
3067 | netif_addr_lock(dev); | ||
3068 | err = __dev_addr_delete(&dev->uc_list, &dev->uc_count, addr, alen, 0); | 3065 | err = __dev_addr_delete(&dev->uc_list, &dev->uc_count, addr, alen, 0); |
3069 | if (!err) | 3066 | if (!err) |
3070 | __dev_set_rx_mode(dev); | 3067 | __dev_set_rx_mode(dev); |
3071 | netif_addr_unlock(dev); | 3068 | netif_addr_unlock_bh(dev); |
3072 | netif_tx_unlock_bh(dev); | ||
3073 | return err; | 3069 | return err; |
3074 | } | 3070 | } |
3075 | EXPORT_SYMBOL(dev_unicast_delete); | 3071 | EXPORT_SYMBOL(dev_unicast_delete); |
@@ -3091,13 +3087,11 @@ int dev_unicast_add(struct net_device *dev, void *addr, int alen) | |||
3091 | 3087 | ||
3092 | ASSERT_RTNL(); | 3088 | ASSERT_RTNL(); |
3093 | 3089 | ||
3094 | netif_tx_lock_bh(dev); | 3090 | netif_addr_lock_bh(dev); |
3095 | netif_addr_lock(dev); | ||
3096 | err = __dev_addr_add(&dev->uc_list, &dev->uc_count, addr, alen, 0); | 3091 | err = __dev_addr_add(&dev->uc_list, &dev->uc_count, addr, alen, 0); |
3097 | if (!err) | 3092 | if (!err) |
3098 | __dev_set_rx_mode(dev); | 3093 | __dev_set_rx_mode(dev); |
3099 | netif_addr_unlock(dev); | 3094 | netif_addr_unlock_bh(dev); |
3100 | netif_tx_unlock_bh(dev); | ||
3101 | return err; | 3095 | return err; |
3102 | } | 3096 | } |
3103 | EXPORT_SYMBOL(dev_unicast_add); | 3097 | EXPORT_SYMBOL(dev_unicast_add); |
@@ -3164,14 +3158,12 @@ int dev_unicast_sync(struct net_device *to, struct net_device *from) | |||
3164 | { | 3158 | { |
3165 | int err = 0; | 3159 | int err = 0; |
3166 | 3160 | ||
3167 | netif_tx_lock_bh(to); | 3161 | netif_addr_lock_bh(to); |
3168 | netif_addr_lock(to); | ||
3169 | err = __dev_addr_sync(&to->uc_list, &to->uc_count, | 3162 | err = __dev_addr_sync(&to->uc_list, &to->uc_count, |
3170 | &from->uc_list, &from->uc_count); | 3163 | &from->uc_list, &from->uc_count); |
3171 | if (!err) | 3164 | if (!err) |
3172 | __dev_set_rx_mode(to); | 3165 | __dev_set_rx_mode(to); |
3173 | netif_addr_unlock(to); | 3166 | netif_addr_unlock_bh(to); |
3174 | netif_tx_unlock_bh(to); | ||
3175 | return err; | 3167 | return err; |
3176 | } | 3168 | } |
3177 | EXPORT_SYMBOL(dev_unicast_sync); | 3169 | EXPORT_SYMBOL(dev_unicast_sync); |
@@ -3187,9 +3179,7 @@ EXPORT_SYMBOL(dev_unicast_sync); | |||
3187 | */ | 3179 | */ |
3188 | void dev_unicast_unsync(struct net_device *to, struct net_device *from) | 3180 | void dev_unicast_unsync(struct net_device *to, struct net_device *from) |
3189 | { | 3181 | { |
3190 | netif_tx_lock_bh(from); | 3182 | netif_addr_lock_bh(from); |
3191 | netif_addr_lock(from); | ||
3192 | netif_tx_lock_bh(to); | ||
3193 | netif_addr_lock(to); | 3183 | netif_addr_lock(to); |
3194 | 3184 | ||
3195 | __dev_addr_unsync(&to->uc_list, &to->uc_count, | 3185 | __dev_addr_unsync(&to->uc_list, &to->uc_count, |
@@ -3197,9 +3187,7 @@ void dev_unicast_unsync(struct net_device *to, struct net_device *from) | |||
3197 | __dev_set_rx_mode(to); | 3187 | __dev_set_rx_mode(to); |
3198 | 3188 | ||
3199 | netif_addr_unlock(to); | 3189 | netif_addr_unlock(to); |
3200 | netif_tx_unlock_bh(to); | 3190 | netif_addr_unlock_bh(from); |
3201 | netif_addr_unlock(from); | ||
3202 | netif_tx_unlock_bh(from); | ||
3203 | } | 3191 | } |
3204 | EXPORT_SYMBOL(dev_unicast_unsync); | 3192 | EXPORT_SYMBOL(dev_unicast_unsync); |
3205 | 3193 | ||
@@ -3219,8 +3207,7 @@ static void __dev_addr_discard(struct dev_addr_list **list) | |||
3219 | 3207 | ||
3220 | static void dev_addr_discard(struct net_device *dev) | 3208 | static void dev_addr_discard(struct net_device *dev) |
3221 | { | 3209 | { |
3222 | netif_tx_lock_bh(dev); | 3210 | netif_addr_lock_bh(dev); |
3223 | netif_addr_lock(dev); | ||
3224 | 3211 | ||
3225 | __dev_addr_discard(&dev->uc_list); | 3212 | __dev_addr_discard(&dev->uc_list); |
3226 | dev->uc_count = 0; | 3213 | dev->uc_count = 0; |
@@ -3228,8 +3215,7 @@ static void dev_addr_discard(struct net_device *dev) | |||
3228 | __dev_addr_discard(&dev->mc_list); | 3215 | __dev_addr_discard(&dev->mc_list); |
3229 | dev->mc_count = 0; | 3216 | dev->mc_count = 0; |
3230 | 3217 | ||
3231 | netif_addr_unlock(dev); | 3218 | netif_addr_unlock_bh(dev); |
3232 | netif_tx_unlock_bh(dev); | ||
3233 | } | 3219 | } |
3234 | 3220 | ||
3235 | unsigned dev_get_flags(const struct net_device *dev) | 3221 | unsigned dev_get_flags(const struct net_device *dev) |