Jelajahi Sumber

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
gaurank kathpalia 5 tahun lalu
induk
melakukan
d5be743510
1 mengubah file dengan 17 tambahan dan 0 penghapusan
  1. 17 0
      core/hdd/src/wlan_hdd_main.c

+ 17 - 0
core/hdd/src/wlan_hdd_main.c

@@ -6782,6 +6782,8 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
 	struct qdf_mac_addr bssid;
 	struct csr_roam_profile roam_profile;
 	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) {
 		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;
 	}
 
+	/* 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 (bandwidth == CH_WIDTH_80MHZ) {
 			hdd_err("BW80 not possible in 2.4GHz band");