aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-07-26 11:24:39 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-17 05:02:09 -0400
commit55de908ab292c03f1eb280f51170ddb9c6b57e31 (patch)
treebc75bb5cea581cadf6fe8b4f121cce02d07c276a /net/mac80211/mesh.c
parentfe57d9f5c0a2c1ef97ba8cdc42cfda5743f287b8 (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/mesh.c')
-rw-r--r--net/mac80211/mesh.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ff0296c7bab8..19725e0a051a 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -97,7 +97,7 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
97 (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth))) 97 (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)))
98 goto mismatch; 98 goto mismatch;
99 99
100 ieee80211_sta_get_rates(local, ie, local->oper_channel->band, 100 ieee80211_sta_get_rates(local, ie, ieee80211_get_sdata_band(sdata),
101 &basic_rates); 101 &basic_rates);
102 102
103 if (sdata->vif.bss_conf.basic_rates != basic_rates) 103 if (sdata->vif.bss_conf.basic_rates != basic_rates)
@@ -355,12 +355,22 @@ int mesh_add_ds_params_ie(struct sk_buff *skb,
355{ 355{
356 struct ieee80211_local *local = sdata->local; 356 struct ieee80211_local *local = sdata->local;
357 struct ieee80211_supported_band *sband; 357 struct ieee80211_supported_band *sband;
358 struct ieee80211_channel *chan = local->oper_channel; 358 struct ieee80211_chanctx_conf *chanctx_conf;
359 struct ieee80211_channel *chan;
359 u8 *pos; 360 u8 *pos;
360 361
361 if (skb_tailroom(skb) < 3) 362 if (skb_tailroom(skb) < 3)
362 return -ENOMEM; 363 return -ENOMEM;
363 364
365 rcu_read_lock();
366 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
367 if (WARN_ON(!chanctx_conf)) {
368 rcu_read_unlock();
369 return -EINVAL;
370 }
371 chan = chanctx_conf->channel;
372 rcu_read_unlock();
373
364 sband = local->hw.wiphy->bands[chan->band]; 374 sband = local->hw.wiphy->bands[chan->band];
365 if (sband->band == IEEE80211_BAND_2GHZ) { 375 if (sband->band == IEEE80211_BAND_2GHZ) {
366 pos = skb_put(skb, 2 + 1); 376 pos = skb_put(skb, 2 + 1);
@@ -376,10 +386,11 @@ int mesh_add_ht_cap_ie(struct sk_buff *skb,
376 struct ieee80211_sub_if_data *sdata) 386 struct ieee80211_sub_if_data *sdata)
377{ 387{
378 struct ieee80211_local *local = sdata->local; 388 struct ieee80211_local *local = sdata->local;
389 enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
379 struct ieee80211_supported_band *sband; 390 struct ieee80211_supported_band *sband;
380 u8 *pos; 391 u8 *pos;
381 392
382 sband = local->hw.wiphy->bands[local->oper_channel->band]; 393 sband = local->hw.wiphy->bands[band];
383 if (!sband->ht_cap.ht_supported || 394 if (!sband->ht_cap.ht_supported ||
384 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) 395 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT)
385 return 0; 396 return 0;
@@ -397,14 +408,26 @@ int mesh_add_ht_oper_ie(struct sk_buff *skb,
397 struct ieee80211_sub_if_data *sdata) 408 struct ieee80211_sub_if_data *sdata)
398{ 409{
399 struct ieee80211_local *local = sdata->local; 410 struct ieee80211_local *local = sdata->local;
400 struct ieee80211_channel *channel = local->oper_channel; 411 struct ieee80211_chanctx_conf *chanctx_conf;
412 struct ieee80211_channel *channel;
401 enum nl80211_channel_type channel_type = 413 enum nl80211_channel_type channel_type =
402 sdata->vif.bss_conf.channel_type; 414 sdata->vif.bss_conf.channel_type;
403 struct ieee80211_supported_band *sband = 415 struct ieee80211_supported_band *sband;
404 local->hw.wiphy->bands[channel->band]; 416 struct ieee80211_sta_ht_cap *ht_cap;
405 struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap;
406 u8 *pos; 417 u8 *pos;
407 418
419 rcu_read_lock();
420 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
421 if (WARN_ON(!chanctx_conf)) {
422 rcu_read_unlock();
423 return -EINVAL;
424 }
425 channel = chanctx_conf->channel;
426 rcu_read_unlock();
427
428 sband = local->hw.wiphy->bands[channel->band];
429 ht_cap = &sband->ht_cap;
430
408 if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT) 431 if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT)
409 return 0; 432 return 0;
410 433
@@ -610,7 +633,7 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
610 sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; 633 sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
611 sdata->vif.bss_conf.basic_rates = 634 sdata->vif.bss_conf.basic_rates =
612 ieee80211_mandatory_rates(sdata->local, 635 ieee80211_mandatory_rates(sdata->local,
613 sdata->local->oper_channel->band); 636 ieee80211_get_sdata_band(sdata));
614 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | 637 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
615 BSS_CHANGED_BEACON_ENABLED | 638 BSS_CHANGED_BEACON_ENABLED |
616 BSS_CHANGED_HT | 639 BSS_CHANGED_HT |