Commit fffa4b1c authored by Karl Beldan's avatar Karl Beldan Committed by Johannes Berg

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: default avatarKarl Beldan <karl.beldan@rivierawaves.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent fbd647b1
...@@ -668,6 +668,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) ...@@ -668,6 +668,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
int channels, max_bitrates; int channels, max_bitrates;
bool supp_ht, supp_vht; bool supp_ht, supp_vht;
netdev_features_t feature_whitelist; netdev_features_t feature_whitelist;
struct cfg80211_chan_def dflt_chandef = {};
static const u32 cipher_suites[] = { static const u32 cipher_suites[] = {
/* keep WEP first, it may be removed below */ /* keep WEP first, it may be removed below */
WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP40,
...@@ -745,19 +746,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) ...@@ -745,19 +746,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
sband = local->hw.wiphy->bands[band]; sband = local->hw.wiphy->bands[band];
if (!sband) if (!sband)
continue; continue;
if (!local->use_chanctx && !local->_oper_chandef.chan) {
if (!dflt_chandef.chan) {
cfg80211_chandef_create(&dflt_chandef,
&sband->channels[0],
NL80211_CHAN_NO_HT);
/* init channel we're on */ /* init channel we're on */
struct cfg80211_chan_def chandef = { if (!local->use_chanctx && !local->_oper_chandef.chan) {
.chan = &sband->channels[0], local->hw.conf.chandef = dflt_chandef;
.width = NL80211_CHAN_NO_HT, local->_oper_chandef = dflt_chandef;
.center_freq1 = sband->channels[0].center_freq, }
.center_freq2 = 0 local->monitor_chandef = dflt_chandef;
};
local->hw.conf.chandef = local->_oper_chandef = chandef;
} }
cfg80211_chandef_create(&local->monitor_chandef,
&sband->channels[0],
NL80211_CHAN_NO_HT);
channels += sband->n_channels; channels += sband->n_channels;
if (max_bitrates < sband->n_bitrates) if (max_bitrates < sband->n_bitrates)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment