From 07546fb480abfbe2d990e366dd8bc5a226c030f9 Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Mon, 8 Jul 2019 18:29:28 +0530 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_ioctl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 41a3d801ab423..67d770d0c8541 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -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; }