diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index eb06b89d7ce3..5b2c199488bf 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6656,6 +6656,36 @@ static void disconnect_sta_and_stop_sap(struct hdd_context *hdd_ctx, } } +/** + * hdd_check_chan_and_fill_freq() - to validate chan and convert into freq + * @pdev: The physical dev to cache the channels for + * @in_chan: input as channel number or freq + * @freq: frequency for input in_chan (output parameter) + * + * This function checks input "in_chan" is channel number, if yes then fills + * appropriate frequency into "freq" out param. If the "in_param" is greater + * than MAX_5GHZ_CHANNEL then gets the valid frequencies for legacy channels + * else get the valid channel for 6Ghz frequency. + * + * Return: true if "in_chan" is valid channel/frequency; false otherwise + */ +static bool hdd_check_chan_and_fill_freq(struct wlan_objmgr_pdev *pdev, + uint32_t *in_chan, qdf_freq_t *freq) +{ + if (IS_CHANNEL_VALID(*in_chan)) { + *freq = wlan_reg_legacy_chan_to_freq(pdev, *in_chan); + } else if (WLAN_REG_IS_24GHZ_CH_FREQ(*in_chan) || + WLAN_REG_IS_5GHZ_CH_FREQ(*in_chan) || + WLAN_REG_IS_6GHZ_CHAN_FREQ(*in_chan)) { + *freq = *in_chan; + *in_chan = wlan_reg_freq_to_chan(pdev, *in_chan); + } else { + return false; + } + + return true; +} + /** * hdd_parse_disable_chan_cmd() - Parse the channel list received * in command. @@ -6665,11 +6695,13 @@ static void disconnect_sta_and_stop_sap(struct hdd_context *hdd_ctx, * This function parses the channel list received in the command. * command should be a string having format * SET_DISABLE_CHANNEL_LIST - * . - * If the command comes multiple times than this function will compare - * the channels received in the command with the channles cached in the - * first command, if the channel list matches with the cached channles, - * it returns success otherwise returns failure. + * /. + * If this command has frequency as input, this function first converts into + * equivalent channel. + * If the command comes multiple times then the channels received in the + * command or channels converted from frequency will be compared with the + * channels cached in the first command, if the channel list matches with + * the cached channels, it returns success otherwise returns failure. * * Return: 0 on success, Error code on failure */ @@ -6681,6 +6713,7 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr) int j, i, temp_int, ret = 0, num_channels; qdf_freq_t *chan_freq_list = NULL; bool is_command_repeated = false; + qdf_freq_t freq = 0; if (!hdd_ctx) { hdd_err("HDD Context is NULL"); @@ -6780,15 +6813,16 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr) goto parse_failed; } - if (!IS_CHANNEL_VALID(temp_int)) { + if (!hdd_check_chan_and_fill_freq(hdd_ctx->pdev, &temp_int, + &freq)) { hdd_err("Invalid channel number received"); ret = -EINVAL; goto parse_failed; } - hdd_debug("channel[%d] = %d", j, temp_int); - chan_freq_list[j] = wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, - temp_int); + hdd_debug("channel[%d] = %d Frequency[%d] = %d", j, temp_int, + j, freq); + chan_freq_list[j] = freq; } /*extra arguments check*/ diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index e0262ec99646..a8dd5410829e 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -3230,7 +3230,8 @@ qdf_freq_t wlansap_get_chan_band_restrict(struct sap_context *sap_ctx, sap_debug("Restore chan freq: %d, width: %d", restart_freq, restart_ch_width); *csa_reason = CSA_REASON_BAND_RESTRICTED; - } else if (wlan_reg_is_disable_for_freq(mac->pdev, + } else if (wlan_reg_is_disable_in_secondary_list_for_freq( + mac->pdev, sap_ctx->chan_freq)) { sap_debug("channel is disabled"); *csa_reason = CSA_REASON_CHAN_DISABLED;