qcacld-3.0: Reject monitor mode command if invalid BW

Reject moniotr mode request if the BW given in the
start monitor command does not match with the
FW capability.

Change-Id: Ic1e2f4bcb811ec56526ae179407db197af591c9c
CRs-Fixed: 2590873
This commit is contained in:
gaurank kathpalia 2019-12-19 19:00:40 +05:30 committed by nshrivas
parent dd26bd904c
commit d5be743510

View File

@ -6782,6 +6782,8 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
struct qdf_mac_addr bssid; struct qdf_mac_addr bssid;
struct csr_roam_profile roam_profile; struct csr_roam_profile roam_profile;
struct ch_params ch_params; struct ch_params ch_params;
enum phy_ch_width max_fw_bw;
enum phy_ch_width ch_width;
if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE) { if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE) {
hdd_err("Not supported, device is not in monitor mode"); hdd_err("Not supported, device is not in monitor mode");
@ -6794,6 +6796,21 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
return -EINVAL; return -EINVAL;
} }
/* Verify the BW before accepting this request */
ch_width = bandwidth;
max_fw_bw = sme_get_vht_ch_width();
hdd_debug("max fw BW %d ch width %d", max_fw_bw, ch_width);
if ((ch_width == CH_WIDTH_160MHZ &&
max_fw_bw <= WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) ||
(ch_width == CH_WIDTH_80P80MHZ &&
max_fw_bw <= WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ)) {
hdd_err("FW does not support this BW %d max BW supported %d",
ch_width, max_fw_bw);
return -EINVAL;
}
if (WLAN_REG_IS_24GHZ_CH(chan)) { if (WLAN_REG_IS_24GHZ_CH(chan)) {
if (bandwidth == CH_WIDTH_80MHZ) { if (bandwidth == CH_WIDTH_80MHZ) {
hdd_err("BW80 not possible in 2.4GHz band"); hdd_err("BW80 not possible in 2.4GHz band");