diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-09-29 10:04:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-30 15:57:19 -0400 |
commit | c2c98fdeb5c897499644eb247285c8e3dacc6450 (patch) | |
tree | aaa9c0f8dd16ab896308470e21a0813041094670 /net/mac80211/sta_info.c | |
parent | deeaee197b0fa694ba6c8f02cdb57b3be7115b4f (diff) |
mac80211: optimise station flags
The flaglock in struct sta_info has long been
something that I wanted to get rid of, this
finally does the conversion to atomic bitops.
The conversion itself is straight-forward in
most places, a few things needed to change a
bit since we can no longer use multiple bits
at the same time.
On x86-64, this is a fairly significant code
size reduction:
text data bss dec hex
427861 23648 1008 452517 6e7a5 before
425383 23648 976 450007 6ddd7 after
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/sta_info.c')
-rw-r--r-- | net/mac80211/sta_info.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 5732e4d0cc21..a00358224cd5 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -244,22 +244,22 @@ static void sta_unblock(struct work_struct *wk) | |||
244 | if (sta->dead) | 244 | if (sta->dead) |
245 | return; | 245 | return; |
246 | 246 | ||
247 | if (!test_sta_flags(sta, WLAN_STA_PS_STA)) | 247 | if (!test_sta_flag(sta, WLAN_STA_PS_STA)) |
248 | ieee80211_sta_ps_deliver_wakeup(sta); | 248 | ieee80211_sta_ps_deliver_wakeup(sta); |
249 | else if (test_and_clear_sta_flags(sta, WLAN_STA_PSPOLL)) { | 249 | else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) { |
250 | clear_sta_flags(sta, WLAN_STA_PS_DRIVER); | 250 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); |
251 | 251 | ||
252 | local_bh_disable(); | 252 | local_bh_disable(); |
253 | ieee80211_sta_ps_deliver_poll_response(sta); | 253 | ieee80211_sta_ps_deliver_poll_response(sta); |
254 | local_bh_enable(); | 254 | local_bh_enable(); |
255 | } else if (test_and_clear_sta_flags(sta, WLAN_STA_UAPSD)) { | 255 | } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) { |
256 | clear_sta_flags(sta, WLAN_STA_PS_DRIVER); | 256 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); |
257 | 257 | ||
258 | local_bh_disable(); | 258 | local_bh_disable(); |
259 | ieee80211_sta_ps_deliver_uapsd(sta); | 259 | ieee80211_sta_ps_deliver_uapsd(sta); |
260 | local_bh_enable(); | 260 | local_bh_enable(); |
261 | } else | 261 | } else |
262 | clear_sta_flags(sta, WLAN_STA_PS_DRIVER); | 262 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); |
263 | } | 263 | } |
264 | 264 | ||
265 | static int sta_prepare_rate_control(struct ieee80211_local *local, | 265 | static int sta_prepare_rate_control(struct ieee80211_local *local, |
@@ -292,7 +292,6 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
292 | return NULL; | 292 | return NULL; |
293 | 293 | ||
294 | spin_lock_init(&sta->lock); | 294 | spin_lock_init(&sta->lock); |
295 | spin_lock_init(&sta->flaglock); | ||
296 | INIT_WORK(&sta->drv_unblock_wk, sta_unblock); | 295 | INIT_WORK(&sta->drv_unblock_wk, sta_unblock); |
297 | INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); | 296 | INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); |
298 | mutex_init(&sta->ampdu_mlme.mtx); | 297 | mutex_init(&sta->ampdu_mlme.mtx); |
@@ -871,7 +870,7 @@ static int __must_check __sta_info_destroy(struct sta_info *sta) | |||
871 | * sessions -- block that to make sure the tear-down | 870 | * sessions -- block that to make sure the tear-down |
872 | * will be sufficient. | 871 | * will be sufficient. |
873 | */ | 872 | */ |
874 | set_sta_flags(sta, WLAN_STA_BLOCK_BA); | 873 | set_sta_flag(sta, WLAN_STA_BLOCK_BA); |
875 | ieee80211_sta_tear_down_BA_sessions(sta, true); | 874 | ieee80211_sta_tear_down_BA_sessions(sta, true); |
876 | 875 | ||
877 | spin_lock_irqsave(&local->sta_lock, flags); | 876 | spin_lock_irqsave(&local->sta_lock, flags); |
@@ -892,10 +891,13 @@ static int __must_check __sta_info_destroy(struct sta_info *sta) | |||
892 | 891 | ||
893 | sta->dead = true; | 892 | sta->dead = true; |
894 | 893 | ||
895 | if (test_and_clear_sta_flags(sta, | 894 | if (test_sta_flag(sta, WLAN_STA_PS_STA) || |
896 | WLAN_STA_PS_STA | WLAN_STA_PS_DRIVER)) { | 895 | test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { |
897 | BUG_ON(!sdata->bss); | 896 | BUG_ON(!sdata->bss); |
898 | 897 | ||
898 | clear_sta_flag(sta, WLAN_STA_PS_STA); | ||
899 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); | ||
900 | |||
899 | atomic_dec(&sdata->bss->num_sta_ps); | 901 | atomic_dec(&sdata->bss->num_sta_ps); |
900 | sta_info_recalc_tim(sta); | 902 | sta_info_recalc_tim(sta); |
901 | } | 903 | } |
@@ -1116,7 +1118,8 @@ static void clear_sta_ps_flags(void *_sta) | |||
1116 | { | 1118 | { |
1117 | struct sta_info *sta = _sta; | 1119 | struct sta_info *sta = _sta; |
1118 | 1120 | ||
1119 | clear_sta_flags(sta, WLAN_STA_PS_DRIVER | WLAN_STA_PS_STA); | 1121 | clear_sta_flag(sta, WLAN_STA_PS_DRIVER); |
1122 | clear_sta_flag(sta, WLAN_STA_PS_STA); | ||
1120 | } | 1123 | } |
1121 | 1124 | ||
1122 | /* powersave support code */ | 1125 | /* powersave support code */ |
@@ -1127,7 +1130,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) | |||
1127 | struct sk_buff_head pending; | 1130 | struct sk_buff_head pending; |
1128 | int filtered = 0, buffered = 0, ac; | 1131 | int filtered = 0, buffered = 0, ac; |
1129 | 1132 | ||
1130 | clear_sta_flags(sta, WLAN_STA_SP); | 1133 | clear_sta_flag(sta, WLAN_STA_SP); |
1131 | 1134 | ||
1132 | BUILD_BUG_ON(BITS_TO_LONGS(STA_TID_NUM) > 1); | 1135 | BUILD_BUG_ON(BITS_TO_LONGS(STA_TID_NUM) > 1); |
1133 | sta->driver_buffered_tids = 0; | 1136 | sta->driver_buffered_tids = 0; |
@@ -1173,7 +1176,7 @@ static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata, | |||
1173 | struct sk_buff *skb; | 1176 | struct sk_buff *skb; |
1174 | int size = sizeof(*nullfunc); | 1177 | int size = sizeof(*nullfunc); |
1175 | __le16 fc; | 1178 | __le16 fc; |
1176 | bool qos = test_sta_flags(sta, WLAN_STA_WME); | 1179 | bool qos = test_sta_flag(sta, WLAN_STA_WME); |
1177 | struct ieee80211_tx_info *info; | 1180 | struct ieee80211_tx_info *info; |
1178 | 1181 | ||
1179 | if (qos) { | 1182 | if (qos) { |
@@ -1241,7 +1244,7 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, | |||
1241 | struct sk_buff_head frames; | 1244 | struct sk_buff_head frames; |
1242 | 1245 | ||
1243 | /* Service or PS-Poll period starts */ | 1246 | /* Service or PS-Poll period starts */ |
1244 | set_sta_flags(sta, WLAN_STA_SP); | 1247 | set_sta_flag(sta, WLAN_STA_SP); |
1245 | 1248 | ||
1246 | __skb_queue_head_init(&frames); | 1249 | __skb_queue_head_init(&frames); |
1247 | 1250 | ||
@@ -1453,8 +1456,8 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
1453 | trace_api_sta_block_awake(sta->local, pubsta, block); | 1456 | trace_api_sta_block_awake(sta->local, pubsta, block); |
1454 | 1457 | ||
1455 | if (block) | 1458 | if (block) |
1456 | set_sta_flags(sta, WLAN_STA_PS_DRIVER); | 1459 | set_sta_flag(sta, WLAN_STA_PS_DRIVER); |
1457 | else if (test_sta_flags(sta, WLAN_STA_PS_DRIVER)) | 1460 | else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) |
1458 | ieee80211_queue_work(hw, &sta->drv_unblock_wk); | 1461 | ieee80211_queue_work(hw, &sta->drv_unblock_wk); |
1459 | } | 1462 | } |
1460 | EXPORT_SYMBOL(ieee80211_sta_block_awake); | 1463 | EXPORT_SYMBOL(ieee80211_sta_block_awake); |