diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-07-26 11:24:39 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-10-17 05:02:09 -0400 |
commit | 55de908ab292c03f1eb280f51170ddb9c6b57e31 (patch) | |
tree | bc75bb5cea581cadf6fe8b4f121cce02d07c276a /net/mac80211/util.c | |
parent | fe57d9f5c0a2c1ef97ba8cdc42cfda5743f287b8 (diff) |
mac80211: use channel contexts
Instead of operating on a single channel only,
use the new channel context infrastructure in
all mac80211 code.
This enables drivers that want to use the new
channel context infrastructure to use multiple
channels, while nothing should change for all
the other drivers that don't support it.
Right now this disables both TX power settings
and spatial multiplexing powersave. Both need
to be re-enabled on a channel context basis.
Additionally, when channel contexts are used
drop the connection when channel switch is
received rather than trying to handle it. This
will have to be improved later.
[With fixes from Eliad and Emmanuel incorporated]
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 22ca35054dd0..7d737071dedb 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -832,6 +832,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, | |||
832 | { | 832 | { |
833 | struct ieee80211_local *local = sdata->local; | 833 | struct ieee80211_local *local = sdata->local; |
834 | struct ieee80211_tx_queue_params qparam; | 834 | struct ieee80211_tx_queue_params qparam; |
835 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
835 | int ac; | 836 | int ac; |
836 | bool use_11b, enable_qos; | 837 | bool use_11b, enable_qos; |
837 | int aCWmin, aCWmax; | 838 | int aCWmin, aCWmax; |
@@ -844,8 +845,12 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, | |||
844 | 845 | ||
845 | memset(&qparam, 0, sizeof(qparam)); | 846 | memset(&qparam, 0, sizeof(qparam)); |
846 | 847 | ||
847 | use_11b = (local->oper_channel->band == IEEE80211_BAND_2GHZ) && | 848 | rcu_read_lock(); |
849 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | ||
850 | use_11b = (chanctx_conf && | ||
851 | chanctx_conf->channel->band == IEEE80211_BAND_2GHZ) && | ||
848 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); | 852 | !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); |
853 | rcu_read_unlock(); | ||
849 | 854 | ||
850 | /* | 855 | /* |
851 | * By default disable QoS in STA mode for old access points, which do | 856 | * By default disable QoS in STA mode for old access points, which do |
@@ -924,7 +929,7 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
924 | const size_t supp_rates_len, | 929 | const size_t supp_rates_len, |
925 | const u8 *supp_rates) | 930 | const u8 *supp_rates) |
926 | { | 931 | { |
927 | struct ieee80211_local *local = sdata->local; | 932 | struct ieee80211_chanctx_conf *chanctx_conf; |
928 | int i, have_higher_than_11mbit = 0; | 933 | int i, have_higher_than_11mbit = 0; |
929 | 934 | ||
930 | /* cf. IEEE 802.11 9.2.12 */ | 935 | /* cf. IEEE 802.11 9.2.12 */ |
@@ -932,11 +937,16 @@ void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, | |||
932 | if ((supp_rates[i] & 0x7f) * 5 > 110) | 937 | if ((supp_rates[i] & 0x7f) * 5 > 110) |
933 | have_higher_than_11mbit = 1; | 938 | have_higher_than_11mbit = 1; |
934 | 939 | ||
935 | if (local->oper_channel->band == IEEE80211_BAND_2GHZ && | 940 | rcu_read_lock(); |
941 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | ||
942 | |||
943 | if (chanctx_conf && | ||
944 | chanctx_conf->channel->band == IEEE80211_BAND_2GHZ && | ||
936 | have_higher_than_11mbit) | 945 | have_higher_than_11mbit) |
937 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; | 946 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; |
938 | else | 947 | else |
939 | sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; | 948 | sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; |
949 | rcu_read_unlock(); | ||
940 | 950 | ||
941 | ieee80211_set_wmm_default(sdata, true); | 951 | ieee80211_set_wmm_default(sdata, true); |
942 | } | 952 | } |
@@ -1206,7 +1216,7 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
1206 | const u8 *ssid, size_t ssid_len, | 1216 | const u8 *ssid, size_t ssid_len, |
1207 | const u8 *ie, size_t ie_len, | 1217 | const u8 *ie, size_t ie_len, |
1208 | u32 ratemask, bool directed, bool no_cck, | 1218 | u32 ratemask, bool directed, bool no_cck, |
1209 | struct ieee80211_channel *channel) | 1219 | struct ieee80211_channel *channel, bool scan) |
1210 | { | 1220 | { |
1211 | struct sk_buff *skb; | 1221 | struct sk_buff *skb; |
1212 | 1222 | ||
@@ -1217,7 +1227,10 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, | |||
1217 | if (no_cck) | 1227 | if (no_cck) |
1218 | IEEE80211_SKB_CB(skb)->flags |= | 1228 | IEEE80211_SKB_CB(skb)->flags |= |
1219 | IEEE80211_TX_CTL_NO_CCK_RATE; | 1229 | IEEE80211_TX_CTL_NO_CCK_RATE; |
1220 | ieee80211_tx_skb(sdata, skb); | 1230 | if (scan) |
1231 | ieee80211_tx_skb_tid_band(sdata, skb, 7, channel->band); | ||
1232 | else | ||
1233 | ieee80211_tx_skb(sdata, skb); | ||
1221 | } | 1234 | } |
1222 | } | 1235 | } |
1223 | 1236 | ||
@@ -1280,6 +1293,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1280 | { | 1293 | { |
1281 | struct ieee80211_hw *hw = &local->hw; | 1294 | struct ieee80211_hw *hw = &local->hw; |
1282 | struct ieee80211_sub_if_data *sdata; | 1295 | struct ieee80211_sub_if_data *sdata; |
1296 | struct ieee80211_chanctx *ctx; | ||
1283 | struct sta_info *sta; | 1297 | struct sta_info *sta; |
1284 | int res, i; | 1298 | int res, i; |
1285 | 1299 | ||
@@ -1352,6 +1366,12 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1352 | res = drv_add_interface(local, sdata); | 1366 | res = drv_add_interface(local, sdata); |
1353 | } | 1367 | } |
1354 | 1368 | ||
1369 | /* add channel contexts */ | ||
1370 | mutex_lock(&local->chanctx_mtx); | ||
1371 | list_for_each_entry(ctx, &local->chanctx_list, list) | ||
1372 | WARN_ON(drv_add_chanctx(local, ctx)); | ||
1373 | mutex_unlock(&local->chanctx_mtx); | ||
1374 | |||
1355 | /* add STAs back */ | 1375 | /* add STAs back */ |
1356 | mutex_lock(&local->sta_mtx); | 1376 | mutex_lock(&local->sta_mtx); |
1357 | list_for_each_entry(sta, &local->sta_list, list) { | 1377 | list_for_each_entry(sta, &local->sta_list, list) { |
@@ -1392,11 +1412,22 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1392 | 1412 | ||
1393 | /* Finally also reconfigure all the BSS information */ | 1413 | /* Finally also reconfigure all the BSS information */ |
1394 | list_for_each_entry(sdata, &local->interfaces, list) { | 1414 | list_for_each_entry(sdata, &local->interfaces, list) { |
1415 | struct ieee80211_chanctx_conf *ctx_conf; | ||
1395 | u32 changed; | 1416 | u32 changed; |
1396 | 1417 | ||
1397 | if (!ieee80211_sdata_running(sdata)) | 1418 | if (!ieee80211_sdata_running(sdata)) |
1398 | continue; | 1419 | continue; |
1399 | 1420 | ||
1421 | mutex_lock(&local->chanctx_mtx); | ||
1422 | ctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | ||
1423 | lockdep_is_held(&local->chanctx_mtx)); | ||
1424 | if (ctx_conf) { | ||
1425 | ctx = container_of(ctx_conf, struct ieee80211_chanctx, | ||
1426 | conf); | ||
1427 | drv_assign_vif_chanctx(local, sdata, ctx); | ||
1428 | } | ||
1429 | mutex_unlock(&local->chanctx_mtx); | ||
1430 | |||
1400 | /* common change flags for all interface types */ | 1431 | /* common change flags for all interface types */ |
1401 | changed = BSS_CHANGED_ERP_CTS_PROT | | 1432 | changed = BSS_CHANGED_ERP_CTS_PROT | |
1402 | BSS_CHANGED_ERP_PREAMBLE | | 1433 | BSS_CHANGED_ERP_PREAMBLE | |