aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
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')
-rw-r--r--net/mac80211/ibss.c19
-rw-r--r--net/wireless/mesh.c5
-rw-r--r--net/wireless/util.c14
3 files changed, 29 insertions, 9 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);
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 30c49202ee4d..0553fd4d85ae 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -167,9 +167,12 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
167 * basic rates 167 * basic rates
168 */ 168 */
169 if (!setup->basic_rates) { 169 if (!setup->basic_rates) {
170 enum nl80211_bss_scan_width scan_width;
170 struct ieee80211_supported_band *sband = 171 struct ieee80211_supported_band *sband =
171 rdev->wiphy.bands[setup->chandef.chan->band]; 172 rdev->wiphy.bands[setup->chandef.chan->band];
172 setup->basic_rates = ieee80211_mandatory_rates(sband); 173 scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
174 setup->basic_rates = ieee80211_mandatory_rates(sband,
175 scan_width);
173 } 176 }
174 177
175 if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef)) 178 if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef))
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 74458b7f61eb..ce090c1c5e4f 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -33,7 +33,8 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
33} 33}
34EXPORT_SYMBOL(ieee80211_get_response_rate); 34EXPORT_SYMBOL(ieee80211_get_response_rate);
35 35
36u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband) 36u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
37 enum nl80211_bss_scan_width scan_width)
37{ 38{
38 struct ieee80211_rate *bitrates; 39 struct ieee80211_rate *bitrates;
39 u32 mandatory_rates = 0; 40 u32 mandatory_rates = 0;
@@ -43,10 +44,15 @@ u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband)
43 if (WARN_ON(!sband)) 44 if (WARN_ON(!sband))
44 return 1; 45 return 1;
45 46
46 if (sband->band == IEEE80211_BAND_2GHZ) 47 if (sband->band == IEEE80211_BAND_2GHZ) {
47 mandatory_flag = IEEE80211_RATE_MANDATORY_B; 48 if (scan_width == NL80211_BSS_CHAN_WIDTH_5 ||
48 else 49 scan_width == NL80211_BSS_CHAN_WIDTH_10)
50 mandatory_flag = IEEE80211_RATE_MANDATORY_G;
51 else
52 mandatory_flag = IEEE80211_RATE_MANDATORY_B;
53 } else {
49 mandatory_flag = IEEE80211_RATE_MANDATORY_A; 54 mandatory_flag = IEEE80211_RATE_MANDATORY_A;
55 }
50 56
51 bitrates = sband->bitrates; 57 bitrates = sband->bitrates;
52 for (i = 0; i < sband->n_bitrates; i++) 58 for (i = 0; i < sband->n_bitrates; i++)