qcacld-3.0: Check TDLS offchannel is supported or not

Check if the configured tdls offchannel through IOCTL
is supported or not. This is required if firmware
does not support 5G channels or any invalid channels

Change-Id: I49e3b7b758fddf22fbfe1b64dda2e4f47a27cf3b
CRs-Fixed: 2503913
This commit is contained in:
Bala Venkatesh 2019-07-08 18:29:28 +05:30 committed by nshrivas
parent 289bcc4f26
commit 07546fb480

View File

@ -6089,24 +6089,28 @@ static int drv_cmd_tdls_off_channel(struct hdd_adapter *adapter,
{
int ret;
uint8_t *value = command;
int set_value;
int channel;
enum channel_state reg_state;
/* Move pointer to point the string */
value += command_len;
ret = sscanf(value, "%d", &set_value);
ret = sscanf(value, "%d", &channel);
if (ret != 1)
return -EINVAL;
reg_state = wlan_reg_get_channel_state(hdd_ctx->pdev, channel);
if (wlan_reg_is_dfs_ch(hdd_ctx->pdev, set_value)) {
hdd_err("DFS channel %d is passed for hdd_set_tdls_offchannel",
set_value);
if (reg_state == CHANNEL_STATE_DFS ||
reg_state == CHANNEL_STATE_DISABLE ||
reg_state == CHANNEL_STATE_INVALID) {
hdd_err("reg state of the channel %d is %d and not supported",
channel, reg_state);
return -EINVAL;
}
hdd_debug("Tdls offchannel num: %d", set_value);
hdd_debug("Tdls offchannel num: %d", channel);
ret = hdd_set_tdls_offchannel(hdd_ctx, adapter, set_value);
ret = hdd_set_tdls_offchannel(hdd_ctx, adapter, channel);
return ret;
}