diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-02-12 08:21:00 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-02-15 03:41:41 -0500 |
commit | af0ed69badc67a0b6e976543f52029fce9ac8f69 (patch) | |
tree | 95f35f3f70f3fd949beda47ad3cee838b0c343c1 /net | |
parent | 9fb04b501a57ad29fa989ab3cd2123482e7eac5f (diff) |
mac80211: stop modifying HT SMPS capability
Instead of modifying the HT SMPS capability field
for stations, track the SMPS mode explicitly in a
new field in the station struct and use it in the
drivers that care about it. This simplifies the
code using it.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ht.c | 19 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.c | 6 | ||||
-rw-r--r-- | net/mac80211/rx.c | 16 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 2 |
4 files changed, 28 insertions, 15 deletions
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index b84147ac5b4c..0db25d4bb223 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -102,6 +102,7 @@ bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, | |||
102 | int i, max_tx_streams; | 102 | int i, max_tx_streams; |
103 | bool changed; | 103 | bool changed; |
104 | enum ieee80211_sta_rx_bandwidth bw; | 104 | enum ieee80211_sta_rx_bandwidth bw; |
105 | enum ieee80211_smps_mode smps_mode; | ||
105 | 106 | ||
106 | memset(&ht_cap, 0, sizeof(ht_cap)); | 107 | memset(&ht_cap, 0, sizeof(ht_cap)); |
107 | 108 | ||
@@ -216,6 +217,24 @@ bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, | |||
216 | ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? | 217 | ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ? |
217 | IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20; | 218 | IEEE80211_STA_RX_BW_40 : IEEE80211_STA_RX_BW_20; |
218 | 219 | ||
220 | switch ((ht_cap.cap & IEEE80211_HT_CAP_SM_PS) | ||
221 | >> IEEE80211_HT_CAP_SM_PS_SHIFT) { | ||
222 | case WLAN_HT_CAP_SM_PS_INVALID: | ||
223 | case WLAN_HT_CAP_SM_PS_STATIC: | ||
224 | smps_mode = IEEE80211_SMPS_STATIC; | ||
225 | break; | ||
226 | case WLAN_HT_CAP_SM_PS_DYNAMIC: | ||
227 | smps_mode = IEEE80211_SMPS_DYNAMIC; | ||
228 | break; | ||
229 | case WLAN_HT_CAP_SM_PS_DISABLED: | ||
230 | smps_mode = IEEE80211_SMPS_OFF; | ||
231 | break; | ||
232 | } | ||
233 | |||
234 | if (smps_mode != sta->sta.smps_mode) | ||
235 | changed = true; | ||
236 | sta->sta.smps_mode = smps_mode; | ||
237 | |||
219 | return changed; | 238 | return changed; |
220 | } | 239 | } |
221 | 240 | ||
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 6176c71d47ff..3af141c69712 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -808,7 +808,6 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, | |||
808 | int ack_dur; | 808 | int ack_dur; |
809 | int stbc; | 809 | int stbc; |
810 | int i; | 810 | int i; |
811 | unsigned int smps; | ||
812 | 811 | ||
813 | /* fall back to the old minstrel for legacy stations */ | 812 | /* fall back to the old minstrel for legacy stations */ |
814 | if (!sta->ht_cap.ht_supported) | 813 | if (!sta->ht_cap.ht_supported) |
@@ -844,9 +843,6 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, | |||
844 | if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) | 843 | if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) |
845 | mi->tx_flags |= IEEE80211_TX_CTL_LDPC; | 844 | mi->tx_flags |= IEEE80211_TX_CTL_LDPC; |
846 | 845 | ||
847 | smps = (sta_cap & IEEE80211_HT_CAP_SM_PS) >> | ||
848 | IEEE80211_HT_CAP_SM_PS_SHIFT; | ||
849 | |||
850 | for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { | 846 | for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { |
851 | mi->groups[i].supported = 0; | 847 | mi->groups[i].supported = 0; |
852 | if (i == MINSTREL_CCK_GROUP) { | 848 | if (i == MINSTREL_CCK_GROUP) { |
@@ -869,7 +865,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, | |||
869 | continue; | 865 | continue; |
870 | 866 | ||
871 | /* Mark MCS > 7 as unsupported if STA is in static SMPS mode */ | 867 | /* Mark MCS > 7 as unsupported if STA is in static SMPS mode */ |
872 | if (smps == WLAN_HT_CAP_SM_PS_STATIC && | 868 | if (sta->smps_mode == IEEE80211_SMPS_STATIC && |
873 | minstrel_mcs_groups[i].streams > 1) | 869 | minstrel_mcs_groups[i].streams > 1) |
874 | continue; | 870 | continue; |
875 | 871 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 296a4aeadedc..3acb70b73e22 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2375,31 +2375,27 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2375 | switch (mgmt->u.action.u.ht_smps.action) { | 2375 | switch (mgmt->u.action.u.ht_smps.action) { |
2376 | case WLAN_HT_ACTION_SMPS: { | 2376 | case WLAN_HT_ACTION_SMPS: { |
2377 | struct ieee80211_supported_band *sband; | 2377 | struct ieee80211_supported_band *sband; |
2378 | u8 smps; | 2378 | enum ieee80211_smps_mode smps_mode; |
2379 | 2379 | ||
2380 | /* convert to HT capability */ | 2380 | /* convert to HT capability */ |
2381 | switch (mgmt->u.action.u.ht_smps.smps_control) { | 2381 | switch (mgmt->u.action.u.ht_smps.smps_control) { |
2382 | case WLAN_HT_SMPS_CONTROL_DISABLED: | 2382 | case WLAN_HT_SMPS_CONTROL_DISABLED: |
2383 | smps = WLAN_HT_CAP_SM_PS_DISABLED; | 2383 | smps_mode = IEEE80211_SMPS_OFF; |
2384 | break; | 2384 | break; |
2385 | case WLAN_HT_SMPS_CONTROL_STATIC: | 2385 | case WLAN_HT_SMPS_CONTROL_STATIC: |
2386 | smps = WLAN_HT_CAP_SM_PS_STATIC; | 2386 | smps_mode = IEEE80211_SMPS_STATIC; |
2387 | break; | 2387 | break; |
2388 | case WLAN_HT_SMPS_CONTROL_DYNAMIC: | 2388 | case WLAN_HT_SMPS_CONTROL_DYNAMIC: |
2389 | smps = WLAN_HT_CAP_SM_PS_DYNAMIC; | 2389 | smps_mode = IEEE80211_SMPS_DYNAMIC; |
2390 | break; | 2390 | break; |
2391 | default: | 2391 | default: |
2392 | goto invalid; | 2392 | goto invalid; |
2393 | } | 2393 | } |
2394 | smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT; | ||
2395 | 2394 | ||
2396 | /* if no change do nothing */ | 2395 | /* if no change do nothing */ |
2397 | if ((rx->sta->sta.ht_cap.cap & | 2396 | if (rx->sta->sta.smps_mode == smps_mode) |
2398 | IEEE80211_HT_CAP_SM_PS) == smps) | ||
2399 | goto handled; | 2397 | goto handled; |
2400 | 2398 | rx->sta->sta.smps_mode = smps_mode; | |
2401 | rx->sta->sta.ht_cap.cap &= ~IEEE80211_HT_CAP_SM_PS; | ||
2402 | rx->sta->sta.ht_cap.cap |= smps; | ||
2403 | 2399 | ||
2404 | sband = rx->local->hw.wiphy->bands[status->band]; | 2400 | sband = rx->local->hw.wiphy->bands[status->band]; |
2405 | 2401 | ||
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 0794b9018ed4..a79ce820cb50 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -375,6 +375,8 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
375 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) | 375 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) |
376 | sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); | 376 | sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); |
377 | 377 | ||
378 | sta->sta.smps_mode = IEEE80211_SMPS_OFF; | ||
379 | |||
378 | sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); | 380 | sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); |
379 | 381 | ||
380 | return sta; | 382 | return sta; |