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 | |
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')
-rw-r--r-- | net/core/dev.c | 38 | ||||
-rw-r--r-- | net/core/dev_mcast.c | 32 | ||||
-rw-r--r-- | net/mac80211/main.c | 12 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 6 |
4 files changed, 28 insertions, 60 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) |
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index b6b2a129971a..5402b3b38e0d 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c | |||
@@ -72,8 +72,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) | |||
72 | { | 72 | { |
73 | int err; | 73 | int err; |
74 | 74 | ||
75 | netif_tx_lock_bh(dev); | 75 | netif_addr_lock_bh(dev); |
76 | netif_addr_lock(dev); | ||
77 | err = __dev_addr_delete(&dev->mc_list, &dev->mc_count, | 76 | err = __dev_addr_delete(&dev->mc_list, &dev->mc_count, |
78 | addr, alen, glbl); | 77 | addr, alen, glbl); |
79 | if (!err) { | 78 | if (!err) { |
@@ -84,8 +83,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) | |||
84 | 83 | ||
85 | __dev_set_rx_mode(dev); | 84 | __dev_set_rx_mode(dev); |
86 | } | 85 | } |
87 | netif_addr_unlock(dev); | 86 | netif_addr_unlock_bh(dev); |
88 | netif_tx_unlock_bh(dev); | ||
89 | return err; | 87 | return err; |
90 | } | 88 | } |
91 | 89 | ||
@@ -97,13 +95,11 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) | |||
97 | { | 95 | { |
98 | int err; | 96 | int err; |
99 | 97 | ||
100 | netif_tx_lock_bh(dev); | 98 | netif_addr_lock_bh(dev); |
101 | netif_addr_lock(dev); | ||
102 | err = __dev_addr_add(&dev->mc_list, &dev->mc_count, addr, alen, glbl); | 99 | err = __dev_addr_add(&dev->mc_list, &dev->mc_count, addr, alen, glbl); |
103 | if (!err) | 100 | if (!err) |
104 | __dev_set_rx_mode(dev); | 101 | __dev_set_rx_mode(dev); |
105 | netif_addr_unlock(dev); | 102 | netif_addr_unlock_bh(dev); |
106 | netif_tx_unlock_bh(dev); | ||
107 | return err; | 103 | return err; |
108 | } | 104 | } |
109 | 105 | ||
@@ -123,14 +119,12 @@ int dev_mc_sync(struct net_device *to, struct net_device *from) | |||
123 | { | 119 | { |
124 | int err = 0; | 120 | int err = 0; |
125 | 121 | ||
126 | netif_tx_lock_bh(to); | 122 | netif_addr_lock_bh(to); |
127 | netif_addr_lock(to); | ||
128 | err = __dev_addr_sync(&to->mc_list, &to->mc_count, | 123 | err = __dev_addr_sync(&to->mc_list, &to->mc_count, |
129 | &from->mc_list, &from->mc_count); | 124 | &from->mc_list, &from->mc_count); |
130 | if (!err) | 125 | if (!err) |
131 | __dev_set_rx_mode(to); | 126 | __dev_set_rx_mode(to); |
132 | netif_addr_unlock(to); | 127 | netif_addr_unlock_bh(to); |
133 | netif_tx_unlock_bh(to); | ||
134 | 128 | ||
135 | return err; | 129 | return err; |
136 | } | 130 | } |
@@ -149,9 +143,7 @@ EXPORT_SYMBOL(dev_mc_sync); | |||
149 | */ | 143 | */ |
150 | void dev_mc_unsync(struct net_device *to, struct net_device *from) | 144 | void dev_mc_unsync(struct net_device *to, struct net_device *from) |
151 | { | 145 | { |
152 | netif_tx_lock_bh(from); | 146 | netif_addr_lock_bh(from); |
153 | netif_addr_lock(from); | ||
154 | netif_tx_lock_bh(to); | ||
155 | netif_addr_lock(to); | 147 | netif_addr_lock(to); |
156 | 148 | ||
157 | __dev_addr_unsync(&to->mc_list, &to->mc_count, | 149 | __dev_addr_unsync(&to->mc_list, &to->mc_count, |
@@ -159,9 +151,7 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from) | |||
159 | __dev_set_rx_mode(to); | 151 | __dev_set_rx_mode(to); |
160 | 152 | ||
161 | netif_addr_unlock(to); | 153 | netif_addr_unlock(to); |
162 | netif_tx_unlock_bh(to); | 154 | netif_addr_unlock_bh(from); |
163 | netif_addr_unlock(from); | ||
164 | netif_tx_unlock_bh(from); | ||
165 | } | 155 | } |
166 | EXPORT_SYMBOL(dev_mc_unsync); | 156 | EXPORT_SYMBOL(dev_mc_unsync); |
167 | 157 | ||
@@ -174,8 +164,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v) | |||
174 | if (v == SEQ_START_TOKEN) | 164 | if (v == SEQ_START_TOKEN) |
175 | return 0; | 165 | return 0; |
176 | 166 | ||
177 | netif_tx_lock_bh(dev); | 167 | netif_addr_lock_bh(dev); |
178 | netif_addr_lock(dev); | ||
179 | for (m = dev->mc_list; m; m = m->next) { | 168 | for (m = dev->mc_list; m; m = m->next) { |
180 | int i; | 169 | int i; |
181 | 170 | ||
@@ -187,8 +176,7 @@ static int dev_mc_seq_show(struct seq_file *seq, void *v) | |||
187 | 176 | ||
188 | seq_putc(seq, '\n'); | 177 | seq_putc(seq, '\n'); |
189 | } | 178 | } |
190 | netif_addr_unlock(dev); | 179 | netif_addr_unlock_bh(dev); |
191 | netif_tx_unlock_bh(dev); | ||
192 | return 0; | 180 | return 0; |
193 | } | 181 | } |
194 | 182 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 095b7d928d64..af0056e7e5b3 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -291,11 +291,9 @@ static int ieee80211_open(struct net_device *dev) | |||
291 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | 291 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) |
292 | local->fif_other_bss++; | 292 | local->fif_other_bss++; |
293 | 293 | ||
294 | netif_tx_lock_bh(local->mdev); | 294 | netif_addr_lock_bh(local->mdev); |
295 | netif_addr_lock(local->mdev); | ||
296 | ieee80211_configure_filter(local); | 295 | ieee80211_configure_filter(local); |
297 | netif_addr_unlock(local->mdev); | 296 | netif_addr_unlock_bh(local->mdev); |
298 | netif_tx_unlock_bh(local->mdev); | ||
299 | break; | 297 | break; |
300 | case IEEE80211_IF_TYPE_STA: | 298 | case IEEE80211_IF_TYPE_STA: |
301 | case IEEE80211_IF_TYPE_IBSS: | 299 | case IEEE80211_IF_TYPE_IBSS: |
@@ -492,11 +490,9 @@ static int ieee80211_stop(struct net_device *dev) | |||
492 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | 490 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) |
493 | local->fif_other_bss--; | 491 | local->fif_other_bss--; |
494 | 492 | ||
495 | netif_tx_lock_bh(local->mdev); | 493 | netif_addr_lock_bh(local->mdev); |
496 | netif_addr_lock(local->mdev); | ||
497 | ieee80211_configure_filter(local); | 494 | ieee80211_configure_filter(local); |
498 | netif_addr_unlock(local->mdev); | 495 | netif_addr_unlock_bh(local->mdev); |
499 | netif_tx_unlock_bh(local->mdev); | ||
500 | break; | 496 | break; |
501 | case IEEE80211_IF_TYPE_MESH_POINT: | 497 | case IEEE80211_IF_TYPE_MESH_POINT: |
502 | case IEEE80211_IF_TYPE_STA: | 498 | case IEEE80211_IF_TYPE_STA: |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 1232ba25e1e9..d7c371e36bf0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -4064,16 +4064,14 @@ static int ieee80211_sta_start_scan(struct net_device *dev, | |||
4064 | local->scan_band = IEEE80211_BAND_2GHZ; | 4064 | local->scan_band = IEEE80211_BAND_2GHZ; |
4065 | local->scan_dev = dev; | 4065 | local->scan_dev = dev; |
4066 | 4066 | ||
4067 | netif_tx_lock_bh(local->mdev); | 4067 | netif_addr_lock_bh(local->mdev); |
4068 | netif_addr_lock(local->mdev); | ||
4069 | local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; | 4068 | local->filter_flags |= FIF_BCN_PRBRESP_PROMISC; |
4070 | local->ops->configure_filter(local_to_hw(local), | 4069 | local->ops->configure_filter(local_to_hw(local), |
4071 | FIF_BCN_PRBRESP_PROMISC, | 4070 | FIF_BCN_PRBRESP_PROMISC, |
4072 | &local->filter_flags, | 4071 | &local->filter_flags, |
4073 | local->mdev->mc_count, | 4072 | local->mdev->mc_count, |
4074 | local->mdev->mc_list); | 4073 | local->mdev->mc_list); |
4075 | netif_addr_unlock(local->mdev); | 4074 | netif_addr_unlock_bh(local->mdev); |
4076 | netif_tx_unlock_bh(local->mdev); | ||
4077 | 4075 | ||
4078 | /* TODO: start scan as soon as all nullfunc frames are ACKed */ | 4076 | /* TODO: start scan as soon as all nullfunc frames are ACKed */ |
4079 | queue_delayed_work(local->hw.workqueue, &local->scan_work, | 4077 | queue_delayed_work(local->hw.workqueue, &local->scan_work, |