Commit e04135c0 authored by Miri Korenblit's avatar Miri Korenblit Committed by Luca Coelho

iwlwifi: mvm: move only to an enabled channel

During disassociation we're decreasing the phy's ref count.
If the ref count becomes 0, we're configuring the phy ctxt
to the default channel (the lowest channel which the device
can operate on). Currently we're not checking whether the
the default channel is enabled or not. Fix it by configuring
the phy ctxt to the lowest channel which is enabled.
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220210181930.03f281b6a6bc.I5b63d43ec41996d599e6f37ec3f32e878b3e405e@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 26de4c8b
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
* Copyright (C) 2012-2014, 2018-2021 Intel Corporation
* Copyright (C) 2012-2014, 2018-2022 Intel Corporation
* Copyright (C) 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2017 Intel Deutschland GmbH
*/
......@@ -345,18 +345,31 @@ void iwl_mvm_phy_ctxt_unref(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt)
* otherwise we might not be able to reuse this phy.
*/
if (ctxt->ref == 0) {
struct ieee80211_channel *chan;
struct ieee80211_channel *chan = NULL;
struct cfg80211_chan_def chandef;
struct ieee80211_supported_band *sband = NULL;
enum nl80211_band band = NL80211_BAND_2GHZ;
struct ieee80211_supported_band *sband;
enum nl80211_band band;
int channel;
while (!sband && band < NUM_NL80211_BANDS)
sband = mvm->hw->wiphy->bands[band++];
for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
sband = mvm->hw->wiphy->bands[band];
if (WARN_ON(!sband))
return;
if (!sband)
continue;
for (channel = 0; channel < sband->n_channels; channel++)
if (!(sband->channels[channel].flags &
IEEE80211_CHAN_DISABLED)) {
chan = &sband->channels[channel];
break;
}
chan = &sband->channels[0];
if (chan)
break;
}
if (WARN_ON(!chan))
return;
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
iwl_mvm_phy_ctxt_changed(mvm, ctxt, &chandef, 1, 1);
......
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