diff options
author | Thomas Pedersen <thomas@cozybit.com> | 2013-02-16 13:41:04 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-02-18 09:31:23 -0500 |
commit | 52ac8c488774b7ac6d1b0ed4c323b5de90d39d6e (patch) | |
tree | 06b25764ec6c7f1fded25bc7db004e028810fad7 /net | |
parent | 572078be54856bf751af9a43d501ffb8d09b1ea7 (diff) |
mac80211: clean up mesh HT operation
ieee80211_ht_cap_ie_to_sta_ht_cap() will clean up the
ht_supported flag and station bandwidth field for us
if the peer beacon doesn't have an HT capability element
(is operating as non-HT).
Also, we don't really need a special station ch_width
member to track the station operating mode any more so use
sta.bandwidth instead.
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/mesh_plink.c | 62 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 2 |
2 files changed, 24 insertions, 40 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 0b58e8139937..d74bdf94c8a4 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -129,7 +129,6 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) | |||
129 | { | 129 | { |
130 | struct ieee80211_local *local = sdata->local; | 130 | struct ieee80211_local *local = sdata->local; |
131 | struct sta_info *sta; | 131 | struct sta_info *sta; |
132 | u32 changed = 0; | ||
133 | u16 ht_opmode; | 132 | u16 ht_opmode; |
134 | bool non_ht_sta = false, ht20_sta = false; | 133 | bool non_ht_sta = false, ht20_sta = false; |
135 | 134 | ||
@@ -142,23 +141,19 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata) | |||
142 | sta->plink_state != NL80211_PLINK_ESTAB) | 141 | sta->plink_state != NL80211_PLINK_ESTAB) |
143 | continue; | 142 | continue; |
144 | 143 | ||
145 | switch (sta->ch_width) { | 144 | if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20) |
146 | case NL80211_CHAN_WIDTH_20_NOHT: | 145 | continue; |
147 | mpl_dbg(sdata, | 146 | |
148 | "mesh_plink %pM: nonHT sta (%pM) is present\n", | 147 | if (!sta->sta.ht_cap.ht_supported) { |
149 | sdata->vif.addr, sta->sta.addr); | 148 | mpl_dbg(sdata, "nonHT sta (%pM) is present\n", |
149 | sta->sta.addr); | ||
150 | non_ht_sta = true; | 150 | non_ht_sta = true; |
151 | goto out; | ||
152 | case NL80211_CHAN_WIDTH_20: | ||
153 | mpl_dbg(sdata, | ||
154 | "mesh_plink %pM: HT20 sta (%pM) is present\n", | ||
155 | sdata->vif.addr, sta->sta.addr); | ||
156 | ht20_sta = true; | ||
157 | default: | ||
158 | break; | 151 | break; |
159 | } | 152 | } |
153 | |||
154 | mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); | ||
155 | ht20_sta = true; | ||
160 | } | 156 | } |
161 | out: | ||
162 | rcu_read_unlock(); | 157 | rcu_read_unlock(); |
163 | 158 | ||
164 | if (non_ht_sta) | 159 | if (non_ht_sta) |
@@ -169,16 +164,13 @@ out: | |||
169 | else | 164 | else |
170 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; | 165 | ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
171 | 166 | ||
172 | if (sdata->vif.bss_conf.ht_operation_mode != ht_opmode) { | 167 | if (sdata->vif.bss_conf.ht_operation_mode == ht_opmode) |
173 | sdata->vif.bss_conf.ht_operation_mode = ht_opmode; | 168 | return 0; |
174 | sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; | ||
175 | changed = BSS_CHANGED_HT; | ||
176 | mpl_dbg(sdata, | ||
177 | "mesh_plink %pM: protection mode changed to %d\n", | ||
178 | sdata->vif.addr, ht_opmode); | ||
179 | } | ||
180 | 169 | ||
181 | return changed; | 170 | sdata->vif.bss_conf.ht_operation_mode = ht_opmode; |
171 | sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; | ||
172 | mpl_dbg(sdata, "selected new HT protection mode %d\n", ht_opmode); | ||
173 | return BSS_CHANGED_HT; | ||
182 | } | 174 | } |
183 | 175 | ||
184 | /** | 176 | /** |
@@ -371,24 +363,18 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, | |||
371 | if (sta->sta.supp_rates[band] != rates) | 363 | if (sta->sta.supp_rates[band] != rates) |
372 | changed |= IEEE80211_RC_SUPP_RATES_CHANGED; | 364 | changed |= IEEE80211_RC_SUPP_RATES_CHANGED; |
373 | sta->sta.supp_rates[band] = rates; | 365 | sta->sta.supp_rates[band] = rates; |
374 | if (elems->ht_cap_elem && | ||
375 | sdata->vif.bss_conf.chandef.width != NL80211_CHAN_WIDTH_20_NOHT) | ||
376 | ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, | ||
377 | elems->ht_cap_elem, sta); | ||
378 | else | ||
379 | memset(&sta->sta.ht_cap, 0, sizeof(sta->sta.ht_cap)); | ||
380 | 366 | ||
381 | if (elems->ht_operation) { | 367 | if (ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, |
382 | struct cfg80211_chan_def chandef; | 368 | elems->ht_cap_elem, sta)) |
369 | changed |= IEEE80211_RC_BW_CHANGED; | ||
383 | 370 | ||
384 | if (!(elems->ht_operation->ht_param & | 371 | /* HT peer is operating 20MHz-only */ |
385 | IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) | 372 | if (elems->ht_operation && |
386 | sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; | 373 | !(elems->ht_operation->ht_param & |
387 | ieee80211_ht_oper_to_chandef(sdata->vif.bss_conf.chandef.chan, | 374 | IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) { |
388 | elems->ht_operation, &chandef); | 375 | if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20) |
389 | if (sta->ch_width != chandef.width) | ||
390 | changed |= IEEE80211_RC_BW_CHANGED; | 376 | changed |= IEEE80211_RC_BW_CHANGED; |
391 | sta->ch_width = chandef.width; | 377 | sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; |
392 | } | 378 | } |
393 | 379 | ||
394 | if (insert) | 380 | if (insert) |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 63dfdb5e91da..4947341a2a82 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -285,7 +285,6 @@ struct sta_ampdu_mlme { | |||
285 | * @t_offset: timing offset relative to this host | 285 | * @t_offset: timing offset relative to this host |
286 | * @t_offset_setpoint: reference timing offset of this sta to be used when | 286 | * @t_offset_setpoint: reference timing offset of this sta to be used when |
287 | * calculating clockdrift | 287 | * calculating clockdrift |
288 | * @ch_width: peer's channel width | ||
289 | * @local_pm: local link-specific power save mode | 288 | * @local_pm: local link-specific power save mode |
290 | * @peer_pm: peer-specific power save mode towards local STA | 289 | * @peer_pm: peer-specific power save mode towards local STA |
291 | * @nonpeer_pm: STA power save mode towards non-peer neighbors | 290 | * @nonpeer_pm: STA power save mode towards non-peer neighbors |
@@ -386,7 +385,6 @@ struct sta_info { | |||
386 | struct timer_list plink_timer; | 385 | struct timer_list plink_timer; |
387 | s64 t_offset; | 386 | s64 t_offset; |
388 | s64 t_offset_setpoint; | 387 | s64 t_offset_setpoint; |
389 | enum nl80211_chan_width ch_width; | ||
390 | /* mesh power save */ | 388 | /* mesh power save */ |
391 | enum nl80211_mesh_power_mode local_pm; | 389 | enum nl80211_mesh_power_mode local_pm; |
392 | enum nl80211_mesh_power_mode peer_pm; | 390 | enum nl80211_mesh_power_mode peer_pm; |