aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/main.c
diff options
context:
space:
mode:
authorKarl Beldan <karl.beldan@rivierawaves.com>2013-04-15 13:04:06 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-04-16 10:01:23 -0400
commitfffa4b1c170a3cabc58671495b0ae89ded007199 (patch)
treea084e2ce2622d0bc16317ad99c55a19ed0b4c15d /net/mac80211/main.c
parentfbd647b17689d584748bad62395cd1161d42d37c (diff)
mac80211: adjust initial chandefs assignments in ieee80211_register_hw
I noticed that monitor interfaces by default would start on 5GHz while STA/AP ones would start 2GHZ - It stems from the fact that ieee80211_register_hw unnecessarily adjusts the local->monitor_chandef for each band. This avoids this and while at it uses a single dflt_chandef to initialize in one go local->{hw.conf.chandef,_oper_chandef,monitor_chandef} Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/main.c')
-rw-r--r--net/mac80211/main.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 52136fd5ba97..8a7bfc47d577 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -668,6 +668,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
668 int channels, max_bitrates; 668 int channels, max_bitrates;
669 bool supp_ht, supp_vht; 669 bool supp_ht, supp_vht;
670 netdev_features_t feature_whitelist; 670 netdev_features_t feature_whitelist;
671 struct cfg80211_chan_def dflt_chandef = {};
671 static const u32 cipher_suites[] = { 672 static const u32 cipher_suites[] = {
672 /* keep WEP first, it may be removed below */ 673 /* keep WEP first, it may be removed below */
673 WLAN_CIPHER_SUITE_WEP40, 674 WLAN_CIPHER_SUITE_WEP40,
@@ -745,19 +746,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
745 sband = local->hw.wiphy->bands[band]; 746 sband = local->hw.wiphy->bands[band];
746 if (!sband) 747 if (!sband)
747 continue; 748 continue;
748 if (!local->use_chanctx && !local->_oper_chandef.chan) { 749
750 if (!dflt_chandef.chan) {
751 cfg80211_chandef_create(&dflt_chandef,
752 &sband->channels[0],
753 NL80211_CHAN_NO_HT);
749 /* init channel we're on */ 754 /* init channel we're on */
750 struct cfg80211_chan_def chandef = { 755 if (!local->use_chanctx && !local->_oper_chandef.chan) {
751 .chan = &sband->channels[0], 756 local->hw.conf.chandef = dflt_chandef;
752 .width = NL80211_CHAN_NO_HT, 757 local->_oper_chandef = dflt_chandef;
753 .center_freq1 = sband->channels[0].center_freq, 758 }
754 .center_freq2 = 0 759 local->monitor_chandef = dflt_chandef;
755 };
756 local->hw.conf.chandef = local->_oper_chandef = chandef;
757 } 760 }
758 cfg80211_chandef_create(&local->monitor_chandef, 761
759 &sband->channels[0],
760 NL80211_CHAN_NO_HT);
761 channels += sband->n_channels; 762 channels += sband->n_channels;
762 763
763 if (max_bitrates < sband->n_bitrates) 764 if (max_bitrates < sband->n_bitrates)