mirror of
https://github.com/torvalds/linux.git
synced 2024-12-23 11:21:33 +00:00
iwlwifi: mvm: be more forgiving if num of channels is too big
If number of channels in the driver is greater than number of scan channels given by firmware TLV, do not fail scan config, but adjust to firmware's number of channels. This is helpful for supporting in driver new channels before it being supported by firmware scan. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
e47df5bd51
commit
8636ca769c
@ -1082,21 +1082,23 @@ static void iwl_mvm_fill_scan_dwell(struct iwl_mvm *mvm,
|
||||
dwell->extended = IWL_SCAN_DWELL_EXTENDED;
|
||||
}
|
||||
|
||||
static void iwl_mvm_fill_channels(struct iwl_mvm *mvm, u8 *channels)
|
||||
static void iwl_mvm_fill_channels(struct iwl_mvm *mvm, u8 *channels,
|
||||
u32 max_channels)
|
||||
{
|
||||
struct ieee80211_supported_band *band;
|
||||
int i, j = 0;
|
||||
|
||||
band = &mvm->nvm_data->bands[NL80211_BAND_2GHZ];
|
||||
for (i = 0; i < band->n_channels; i++, j++)
|
||||
for (i = 0; i < band->n_channels && j < max_channels; i++, j++)
|
||||
channels[j] = band->channels[i].hw_value;
|
||||
band = &mvm->nvm_data->bands[NL80211_BAND_5GHZ];
|
||||
for (i = 0; i < band->n_channels; i++, j++)
|
||||
for (i = 0; i < band->n_channels && j < max_channels; i++, j++)
|
||||
channels[j] = band->channels[i].hw_value;
|
||||
}
|
||||
|
||||
static void iwl_mvm_fill_scan_config_v1(struct iwl_mvm *mvm, void *config,
|
||||
u32 flags, u8 channel_flags)
|
||||
u32 flags, u8 channel_flags,
|
||||
u32 max_channels)
|
||||
{
|
||||
enum iwl_mvm_scan_type type = iwl_mvm_get_scan_type(mvm, NULL);
|
||||
struct iwl_scan_config_v1 *cfg = config;
|
||||
@ -1115,11 +1117,12 @@ static void iwl_mvm_fill_scan_config_v1(struct iwl_mvm *mvm, void *config,
|
||||
cfg->bcast_sta_id = mvm->aux_sta.sta_id;
|
||||
cfg->channel_flags = channel_flags;
|
||||
|
||||
iwl_mvm_fill_channels(mvm, cfg->channel_array);
|
||||
iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);
|
||||
}
|
||||
|
||||
static void iwl_mvm_fill_scan_config(struct iwl_mvm *mvm, void *config,
|
||||
u32 flags, u8 channel_flags)
|
||||
u32 flags, u8 channel_flags,
|
||||
u32 max_channels)
|
||||
{
|
||||
struct iwl_scan_config *cfg = config;
|
||||
|
||||
@ -1162,7 +1165,7 @@ static void iwl_mvm_fill_scan_config(struct iwl_mvm *mvm, void *config,
|
||||
cfg->bcast_sta_id = mvm->aux_sta.sta_id;
|
||||
cfg->channel_flags = channel_flags;
|
||||
|
||||
iwl_mvm_fill_channels(mvm, cfg->channel_array);
|
||||
iwl_mvm_fill_channels(mvm, cfg->channel_array, max_channels);
|
||||
}
|
||||
|
||||
int iwl_mvm_config_scan(struct iwl_mvm *mvm)
|
||||
@ -1181,7 +1184,7 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
|
||||
u8 channel_flags;
|
||||
|
||||
if (WARN_ON(num_channels > mvm->fw->ucode_capa.n_scan_channels))
|
||||
return -ENOBUFS;
|
||||
num_channels = mvm->fw->ucode_capa.n_scan_channels;
|
||||
|
||||
if (iwl_mvm_is_cdb_supported(mvm)) {
|
||||
type = iwl_mvm_get_scan_type_band(mvm, NULL,
|
||||
@ -1234,9 +1237,11 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
|
||||
flags |= (iwl_mvm_is_scan_fragmented(hb_type)) ?
|
||||
SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED :
|
||||
SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED;
|
||||
iwl_mvm_fill_scan_config(mvm, cfg, flags, channel_flags);
|
||||
iwl_mvm_fill_scan_config(mvm, cfg, flags, channel_flags,
|
||||
num_channels);
|
||||
} else {
|
||||
iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags);
|
||||
iwl_mvm_fill_scan_config_v1(mvm, cfg, flags, channel_flags,
|
||||
num_channels);
|
||||
}
|
||||
|
||||
cmd.data[0] = cfg;
|
||||
|
Loading…
Reference in New Issue
Block a user