Forráskód Böngészése

qcacld-3.0: Request fw stats for monitor mode

Periodically request pdev stats from FW to receive channel noise floor
information after monitor vdev has been brought up, based on the band
currently being sniffed. Use the band information as a secondary parameter
when sending periodic request to fw so a single noise floor value is sent
to host. Pass this noise floor information to dp_pdev to be populated in
radiotap header.

Change-Id: I488e4985392cb646ffdee914359fa995dbeb025e
CRs-Fixed: 2833458
Saket Jha 4 éve
szülő
commit
6599516554

+ 16 - 0
components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_tgt_api.h

@@ -27,6 +27,22 @@
 #ifdef QCA_SUPPORT_CP_STATS
 #include "wlan_cp_stats_mc_defs.h"
 
+#ifdef QCA_WIFI_QCA6490
+#define TGT_MAC_ID_24G 2
+#define TGT_MAC_ID_5G 1
+#else
+#define TGT_MAC_ID_24G 0
+#define TGT_MAC_ID_5G 0
+#endif
+
+/**
+ * target_if_mc_cp_get_mac_id(): API to get mac id
+ * @vdev_mlme: vdev mlme pointer
+ *
+ * Return: mac id
+ */
+uint8_t target_if_mc_cp_get_mac_id(struct vdev_mlme_obj *vdev_mlme);
+
 /**
  * tgt_mc_cp_stats_process_stats_event(): API to process stats event
  * @psoc: pointer to psoc object

+ 19 - 0
components/target_if/cp_stats/src/target_if_mc_cp_stats.c

@@ -38,6 +38,7 @@
 #include <cdp_txrx_ops.h>
 #include <cdp_txrx_stats_struct.h>
 #include <cdp_txrx_host_stats.h>
+#include <cdp_txrx_ctrl.h>
 #include <cds_api.h>
 
 #ifdef WLAN_SUPPORT_TWT
@@ -365,6 +366,8 @@ static QDF_STATUS target_if_cp_stats_extract_pdev_stats(
 	uint32_t i;
 	QDF_STATUS status;
 	wmi_host_pdev_stats pdev_stats;
+	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	cdp_config_param_type val;
 
 	ev->num_pdev_stats = stats_param->num_pdev_stats;
 	if (!ev->num_pdev_stats)
@@ -386,8 +389,12 @@ static QDF_STATUS target_if_cp_stats_extract_pdev_stats(
 			return status;
 		}
 		ev->pdev_stats[i].max_pwr = pdev_stats.chan_tx_pwr;
+
 		target_if_cp_stats_extract_congestion(&ev->pdev_stats[i],
 						      &pdev_stats);
+
+		val.cdp_pdev_param_chn_noise_flr = pdev_stats.chan_nf;
+		cdp_txrx_set_pdev_param(soc, 0, CDP_CHAN_NOISE_FLOOR, val);
 	}
 
 	return QDF_STATUS_SUCCESS;
@@ -817,6 +824,18 @@ static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl,
 	return status;
 }
 
+uint8_t target_if_mc_cp_get_mac_id(struct vdev_mlme_obj *vdev_mlme)
+{
+	uint8_t mac_id = 0;
+
+	if (wlan_reg_is_24ghz_ch_freq(vdev_mlme->vdev->vdev_mlme.des_chan->ch_freq))
+		mac_id = TGT_MAC_ID_24G;
+	else
+		mac_id = TGT_MAC_ID_5G;
+
+	return mac_id;
+}
+
 /**
  * target_if_mc_cp_stats_stats_event_handler() - function to handle stats event
  * from firmware.

+ 1 - 1
core/wma/src/wma_main.c

@@ -901,7 +901,7 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
 		pdev_param.param_value = privcmd->param_value;
 		ret = wmi_unified_pdev_param_send(wma->wmi_handle,
 						 &pdev_param,
-						 WMA_WILDCARD_PDEV_ID);
+						 privcmd->param_sec_value);
 		if (QDF_IS_STATUS_ERROR(ret)) {
 			wma_err("wma_vdev_set_param failed ret %d", ret);
 			return;

+ 47 - 0
core/wma/src/wma_utils.c

@@ -67,6 +67,7 @@
 #include "cdp_txrx_misc.h"
 #include <cdp_txrx_host_stats.h>
 #include "wlan_mlme_ucfg_api.h"
+#include <wlan_cp_stats_mc_tgt_api.h>
 
 /* MCS Based rate table */
 /* HT MCS parameters with Nss = 1 */
@@ -4405,6 +4406,51 @@ QDF_STATUS wma_ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme,
 	return wma_vdev_send_start_resp(wma, add_bss_rsp);
 }
 
+#ifdef QCA_SUPPORT_CP_STATS
+QDF_STATUS wma_mon_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
+					    uint16_t data_len, void *data)
+{
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
+	struct request_info info = {0};
+	uint8_t interval = 1;
+	QDF_STATUS status;
+	int pdev;
+
+	if (!wma)
+		return QDF_STATUS_E_INVAL;
+
+	if (mlme_is_chan_switch_in_progress(vdev_mlme->vdev))
+		mlme_set_chan_switch_in_progress(vdev_mlme->vdev, false);
+
+	pdev = target_if_mc_cp_get_mac_id(vdev_mlme);
+
+	/* Cancel periodic pdev stats update if running for other mac */
+	status = wma_cli_set_command(vdev_mlme->vdev->vdev_objmgr.vdev_id,
+				     WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
+				     0, PDEV_CMD);
+	if (status != QDF_STATUS_SUCCESS)
+		pe_err("failed to clear fw stats request = %d", status);
+
+	/* send periodic fw stats to get chan noise floor for monitor mode */
+	info.vdev_id = vdev_mlme->vdev->vdev_objmgr.vdev_id;
+	info.pdev_id = pdev;
+	status = tgt_send_mc_cp_stats_req((wlan_vdev_get_psoc(vdev_mlme->vdev)),
+					  TYPE_STATION_STATS,
+					  &info);
+	if (status != QDF_STATUS_SUCCESS)
+		pe_err("failed to send fw stats request = %d", status);
+
+	status = wma_cli_set2_command(vdev_mlme->vdev->vdev_objmgr.vdev_id,
+				      WMI_PDEV_PARAM_PDEV_STATS_UPDATE_PERIOD,
+				      interval * 2000, pdev, PDEV_CMD);
+	if (status != QDF_STATUS_SUCCESS)
+		pe_err("failed to send fw stats request = %d", status);
+
+	lim_process_switch_channel_rsp(wma->mac_context, data);
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
 QDF_STATUS wma_mon_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
 					    uint16_t data_len, void *data)
 {
@@ -4420,6 +4466,7 @@ QDF_STATUS wma_mon_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif /* QCA_SUPPORT_CP_STATS */
 
 QDF_STATUS wma_mon_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
 				     uint16_t data_len, void *data)