Skip to content

Commit fffa4b1

Browse files
Karl Beldanjmberg-intel
authored andcommitted
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>
1 parent fbd647b commit fffa4b1

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

‎net/mac80211/main.c‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
668668
int channels, max_bitrates;
669669
bool supp_ht, supp_vht;
670670
netdev_features_t feature_whitelist;
671+
struct cfg80211_chan_def dflt_chandef = {};
671672
static const u32 cipher_suites[] = {
672673
/* keep WEP first, it may be removed below */
673674
WLAN_CIPHER_SUITE_WEP40,
@@ -745,19 +746,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
745746
sband = local->hw.wiphy->bands[band];
746747
if (!sband)
747748
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);
749754
/* init channel we're on */
750-
struct cfg80211_chan_def chandef = {
751-
.chan = &sband->channels[0],
752-
.width = NL80211_CHAN_NO_HT,
753-
.center_freq1 = sband->channels[0].center_freq,
754-
.center_freq2 = 0
755-
};
756-
local->hw.conf.chandef = local->_oper_chandef = chandef;
755+
if (!local->use_chanctx && !local->_oper_chandef.chan) {
756+
local->hw.conf.chandef = dflt_chandef;
757+
local->_oper_chandef = dflt_chandef;
758+
}
759+
local->monitor_chandef = dflt_chandef;
757760
}
758-
cfg80211_chandef_create(&local->monitor_chandef,
759-
&sband->channels[0],
760-
NL80211_CHAN_NO_HT);
761+
761762
channels += sband->n_channels;
762763

763764
if (max_bitrates < sband->n_bitrates)

0 commit comments

Comments
 (0)