aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2013-07-08 10:55:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-07-16 02:58:07 -0400
commit74608aca4d82e2855b1a6a2cd60331d1a98f2d6a (patch)
tree43fdcc2e5cfa602c37bdd196cd583b10551c52ff /net/mac80211
parent2103dec14792be2c2194a454630b01120d30e5cb (diff)
cfg80211/mac80211: get mandatory rates based on scan width
Mandatory rates for 5 and 10 MHz are different from the rates used for 20 MHz in 2.4 GHz mode, as they use OFDM only. Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ibss.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 272a3b37615c..299603e4939f 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -371,6 +371,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
371 struct sta_info *sta; 371 struct sta_info *sta;
372 struct ieee80211_chanctx_conf *chanctx_conf; 372 struct ieee80211_chanctx_conf *chanctx_conf;
373 struct ieee80211_supported_band *sband; 373 struct ieee80211_supported_band *sband;
374 enum nl80211_bss_scan_width scan_width;
374 int band; 375 int band;
375 376
376 /* 377 /*
@@ -399,6 +400,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
399 if (WARN_ON_ONCE(!chanctx_conf)) 400 if (WARN_ON_ONCE(!chanctx_conf))
400 return NULL; 401 return NULL;
401 band = chanctx_conf->def.chan->band; 402 band = chanctx_conf->def.chan->band;
403 scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
402 rcu_read_unlock(); 404 rcu_read_unlock();
403 405
404 sta = sta_info_alloc(sdata, addr, GFP_KERNEL); 406 sta = sta_info_alloc(sdata, addr, GFP_KERNEL);
@@ -412,7 +414,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
412 /* make sure mandatory rates are always added */ 414 /* make sure mandatory rates are always added */
413 sband = local->hw.wiphy->bands[band]; 415 sband = local->hw.wiphy->bands[band];
414 sta->sta.supp_rates[band] = supp_rates | 416 sta->sta.supp_rates[band] = supp_rates |
415 ieee80211_mandatory_rates(sband); 417 ieee80211_mandatory_rates(sband, scan_width);
416 418
417 return ieee80211_ibss_finish_sta(sta); 419 return ieee80211_ibss_finish_sta(sta);
418} 420}
@@ -476,6 +478,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
476 u64 beacon_timestamp, rx_timestamp; 478 u64 beacon_timestamp, rx_timestamp;
477 u32 supp_rates = 0; 479 u32 supp_rates = 0;
478 enum ieee80211_band band = rx_status->band; 480 enum ieee80211_band band = rx_status->band;
481 enum nl80211_bss_scan_width scan_width;
479 struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; 482 struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
480 bool rates_updated = false; 483 bool rates_updated = false;
481 484
@@ -504,9 +507,15 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
504 507
505 prev_rates = sta->sta.supp_rates[band]; 508 prev_rates = sta->sta.supp_rates[band];
506 /* make sure mandatory rates are always added */ 509 /* make sure mandatory rates are always added */
507 sta->sta.supp_rates[band] = supp_rates | 510 scan_width = NL80211_BSS_CHAN_WIDTH_20;
508 ieee80211_mandatory_rates(sband); 511 if (rx_status->flag & RX_FLAG_5MHZ)
512 scan_width = NL80211_BSS_CHAN_WIDTH_5;
513 if (rx_status->flag & RX_FLAG_10MHZ)
514 scan_width = NL80211_BSS_CHAN_WIDTH_10;
509 515
516 sta->sta.supp_rates[band] = supp_rates |
517 ieee80211_mandatory_rates(sband,
518 scan_width);
510 if (sta->sta.supp_rates[band] != prev_rates) { 519 if (sta->sta.supp_rates[band] != prev_rates) {
511 ibss_dbg(sdata, 520 ibss_dbg(sdata,
512 "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", 521 "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
@@ -640,6 +649,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
640 struct sta_info *sta; 649 struct sta_info *sta;
641 struct ieee80211_chanctx_conf *chanctx_conf; 650 struct ieee80211_chanctx_conf *chanctx_conf;
642 struct ieee80211_supported_band *sband; 651 struct ieee80211_supported_band *sband;
652 enum nl80211_bss_scan_width scan_width;
643 int band; 653 int band;
644 654
645 /* 655 /*
@@ -665,6 +675,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
665 return; 675 return;
666 } 676 }
667 band = chanctx_conf->def.chan->band; 677 band = chanctx_conf->def.chan->band;
678 scan_width = cfg80211_chandef_to_scan_width(&chanctx_conf->def);
668 rcu_read_unlock(); 679 rcu_read_unlock();
669 680
670 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); 681 sta = sta_info_alloc(sdata, addr, GFP_ATOMIC);
@@ -676,7 +687,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
676 /* make sure mandatory rates are always added */ 687 /* make sure mandatory rates are always added */
677 sband = local->hw.wiphy->bands[band]; 688 sband = local->hw.wiphy->bands[band];
678 sta->sta.supp_rates[band] = supp_rates | 689 sta->sta.supp_rates[band] = supp_rates |
679 ieee80211_mandatory_rates(sband); 690 ieee80211_mandatory_rates(sband, scan_width);
680 691
681 spin_lock(&ifibss->incomplete_lock); 692 spin_lock(&ifibss->incomplete_lock);
682 list_add(&sta->list, &ifibss->incomplete_stations); 693 list_add(&sta->list, &ifibss->incomplete_stations);