Explorar o código

qcacmn: Don't disable DCS firmware event indication

Always enable DCS firmware wmi_dcs_interference_event_id event
indication as CCA feature requires, for below scenario, will
ignore dcs event data and won't do interference detection
algorithm calculation:
a: Current SAP channel isn't on 5G band
b: In the process of ACS
c: In the process of dcs disabling dcs_restart_delay time duration

Change-Id: Ic3d0e5c7ffd7ffc2009e2d86480ea9a6c95b59b3
CRs-Fixed: 2804273
hqu %!s(int64=4) %!d(string=hai) anos
pai
achega
7602376b88

+ 40 - 65
umac/dcs/core/src/wlan_dcs.c

@@ -136,46 +136,6 @@ QDF_STATUS wlan_dcs_cmd_send(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * wlan_dcs_disable_cmd_send() - send dcs disable command to target_if layer
- * @psoc: psoc pointer
- * @pdev_id: pdev_id
- * @is_host_pdev_id: pdev_id is host id or not
- *
- * The function gets called to send dcs disable command to FW
- *
- * return: QDF_STATUS_SUCCESS for success or error code
- */
-static QDF_STATUS wlan_dcs_disable_cmd_send(struct wlan_objmgr_psoc *psoc,
-					    uint32_t pdev_id,
-					    bool is_host_pdev_id)
-{
-	struct wlan_target_if_dcs_tx_ops *dcs_tx_ops;
-	struct dcs_pdev_priv_obj *dcs_pdev_priv;
-
-	if (!psoc) {
-		dcs_err("psoc is null");
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	dcs_pdev_priv = wlan_dcs_get_pdev_private_obj(psoc, pdev_id);
-	if (!dcs_pdev_priv) {
-		dcs_err("dcs pdev private object is null");
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
-	dcs_tx_ops = target_if_dcs_get_tx_ops(psoc);
-	if (dcs_tx_ops->dcs_cmd_send) {
-		dcs_info("dcs_enable: %u, pdev_id: %u", 0, pdev_id);
-		return dcs_tx_ops->dcs_cmd_send(psoc,
-						pdev_id,
-						is_host_pdev_id,
-						0);
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
 /**
  * wlan_dcs_im_copy_stats() - dcs target interference mitigation statistics copy
  * @prev_stats: previous statistics pointer
@@ -325,11 +285,7 @@ wlan_dcs_wlan_interference_process(
 	    (curr_stats->reg_tsf32 <= prev_stats->reg_tsf32)) {
 		if (unlikely(dcs_host_params.dcs_debug >= DCS_DEBUG_VERBOSE))
 			dcs_debug("ignoring due to negative TSF value");
-
-		/* Copy the current stats to previous stats for next run */
-		wlan_dcs_im_copy_stats(prev_stats, curr_stats);
-
-		goto end;
+		goto copy_stats;
 	}
 
 	reg_tsf_delta = curr_stats->reg_tsf32 - prev_stats->reg_tsf32;
@@ -342,11 +298,7 @@ wlan_dcs_wlan_interference_process(
 		curr_stats->mib_stats.reg_rxclr_cnt) {
 		if (unlikely(dcs_host_params.dcs_debug >= DCS_DEBUG_VERBOSE))
 			dcs_debug("ignoring due to negative rxclr count");
-
-		/* Copy the current stats to previous stats for next run */
-		wlan_dcs_im_copy_stats(prev_stats, curr_stats);
-
-		goto end;
+		goto copy_stats;
 	}
 
 	rxclr_delta = curr_stats->mib_stats.reg_rxclr_cnt -
@@ -368,13 +320,21 @@ wlan_dcs_wlan_interference_process(
 			  tx_frame_delta, rx_frame_delta, cycle_count_delta);
 
 	if (0 == (cycle_count_delta >> 8)) {
-		wlan_dcs_im_copy_stats(prev_stats, curr_stats);
 		if (unlikely(dcs_host_params.dcs_debug >= DCS_DEBUG_VERBOSE))
 			dcs_debug("cycle count NULL --Investigate--");
-
-		goto end;
+		goto copy_stats;
 	}
 
+	/*
+	 * For below scenario, will ignore dcs event data and won't do
+	 * interference detection algorithm calculation:
+	 * 1: Current SAP channel isn't on 5G band
+	 * 2: In the process of ACS
+	 * 3: In the process of dcs disabling dcs_restart_delay time duration
+	 */
+	if (!dcs_host_params.dcs_algorithm_process)
+		goto copy_stats;
+
 	/*
 	 * Total channel utiliztaion is the amount of time RXCLR is
 	 * counted. RXCLR is counted, when 'RX is NOT clear', please
@@ -549,14 +509,13 @@ wlan_dcs_wlan_interference_process(
 	/* Count the current run too */
 	p_dcs_im_stats->im_samp_cnt++;
 
-	/* Copy the stats for next cycle */
-	wlan_dcs_im_copy_stats(prev_stats, curr_stats);
-
 	if (unlikely(dcs_host_params.dcs_debug >= DCS_DEBUG_VERBOSE))
 		dcs_debug("intfr_count: %u, sample_count: %u",
 			  p_dcs_im_stats->im_intfr_cnt,
 			  p_dcs_im_stats->im_samp_cnt);
-
+copy_stats:
+	 /* Copy the stats for next cycle */
+	wlan_dcs_im_copy_stats(prev_stats, curr_stats);
 end:
 	return start_dcs_cbk_handler;
 }
@@ -586,13 +545,10 @@ void wlan_dcs_disable_timer_fn(void *dcs_timer_args)
 	}
 
 	dcs_pdev_priv = &dcs_psoc_priv->dcs_pdev_priv[pdev_id];
-
-	qdf_mem_set(&dcs_pdev_priv->dcs_im_stats,
-		    sizeof(dcs_pdev_priv->dcs_im_stats), 0);
 	dcs_pdev_priv->dcs_freq_ctrl_params.disable_delay_process = false;
 
 	dcs_info("dcs disable timeout, enable dcs detection again");
-	wlan_dcs_cmd_send(psoc, pdev_id, true);
+	wlan_dcs_set_algorithm_process(psoc, pdev_id, true);
 }
 
 /**
@@ -649,9 +605,10 @@ static void wlan_dcs_frequency_control(struct wlan_objmgr_psoc *psoc,
 
 	/*
 	 * Before start dcs callback handler or disable dcs for some time,
-	 * need to send dcs command to disable dcs detection firstly.
+	 * need to ignore dcs event data and won't do interference detection
+	 * algorithm calculation for disabling dcs detection firstly.
 	 */
-	wlan_dcs_disable_cmd_send(psoc, event->dcs_param.pdev_id, true);
+	wlan_dcs_set_algorithm_process(psoc, event->dcs_param.pdev_id, false);
 
 	if (disable_dcs_sometime) {
 		dcs_freq_ctrl_params->disable_delay_process = true;
@@ -698,9 +655,10 @@ wlan_dcs_process(struct wlan_objmgr_psoc *psoc, struct dcs_stats_event *event)
 
 	if (unlikely(dcs_pdev_priv->dcs_host_params.dcs_debug
 			>= DCS_DEBUG_VERBOSE))
-		dcs_debug("dcs_enable: %u, interference_type: %u",
+		dcs_debug("dcs_enable: %u, interference_type: %u, pdev_id: %u",
 			  dcs_pdev_priv->dcs_host_params.dcs_enable,
-			  event->dcs_param.interference_type);
+			  event->dcs_param.interference_type,
+			  event->dcs_param.pdev_id);
 
 	if (!dcs_pdev_priv->dcs_host_params.dcs_enable)
 		return QDF_STATUS_SUCCESS;
@@ -749,4 +707,21 @@ void wlan_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id)
 		    MAX_DCS_TIME_RECORD * sizeof(unsigned long), 0);
 	dcs_pdev_priv->dcs_freq_ctrl_params.dcs_happened_count = 0;
 	dcs_pdev_priv->dcs_freq_ctrl_params.disable_delay_process = false;
+	wlan_dcs_set_algorithm_process(psoc, pdev_id, false);
+}
+
+void wlan_dcs_set_algorithm_process(struct wlan_objmgr_psoc *psoc,
+				    uint32_t pdev_id,
+				    bool dcs_algorithm_process)
+{
+	struct dcs_pdev_priv_obj *dcs_pdev_priv;
+
+	dcs_pdev_priv = wlan_dcs_get_pdev_private_obj(psoc, pdev_id);
+	if (!dcs_pdev_priv) {
+		dcs_err("dcs pdev private object is null");
+		return;
+	}
+
+	dcs_pdev_priv->dcs_host_params.dcs_algorithm_process =
+							dcs_algorithm_process;
 }

+ 18 - 0
umac/dcs/core/src/wlan_dcs.h

@@ -68,6 +68,7 @@ struct pdev_dcs_im_stats {
  * struct pdev_dcs_params - define dcs configuration parameter in pdev object
  * @dcs_enable_cfg: dcs enable from ini config
  * @dcs_enable: dcs enable from ucfg config
+ * @dcs_algorithm_process: do dcs algorithm process or not
  * @dcs_debug: dcs debug trace level
  * @phy_err_penalty: phy error penalty
  * @phy_err_threshold: phy error threshold
@@ -81,6 +82,7 @@ struct pdev_dcs_im_stats {
 struct pdev_dcs_params {
 	uint8_t dcs_enable_cfg;
 	uint8_t dcs_enable;
+	bool dcs_algorithm_process;
 	enum wlan_dcs_debug_level dcs_debug;
 	uint32_t phy_err_penalty;
 	uint32_t phy_err_threshold;
@@ -237,4 +239,20 @@ void wlan_dcs_disable_timer_fn(void *dcs_timer_args);
  * Return: None
  */
 void wlan_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id);
+
+/**
+ * wlan_dcs_set_algorithm_process() - config dcs event data to do algorithm
+ * process or not
+ * @psoc: psoc pointer
+ * @pdev_id: pdev_id
+ * @dcs_algorithm_process: dcs algorithm process
+ *
+ * The function gets called to config dcs event data to do algorithm
+ * process or not
+ *
+ * Return: None
+ */
+void wlan_dcs_set_algorithm_process(struct wlan_objmgr_psoc *psoc,
+				    uint32_t pdev_id,
+				    bool dcs_algorithm_process);
 #endif  /* _WLAN_DCS_H_ */

+ 15 - 0
umac/dcs/dispatcher/inc/wlan_dcs_ucfg_api.h

@@ -127,4 +127,19 @@ uint8_t ucfg_get_dcs_enable(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id);
  * Return: None
  */
 void ucfg_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id);
+
+/**
+ * ucfg_config_dcs_event_data() - config dcs event data to do algorithm
+ * process or not
+ * @psoc: psoc pointer
+ * @pdev_id: pdev_id
+ * @dcs_algorithm_process: dcs algorithm process or not
+ *
+ * The function gets called to config dcs event data to do algorithm
+ * process or not
+ *
+ * Return: None
+ */
+void ucfg_config_dcs_event_data(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id,
+				bool dcs_algorithm_process);
 #endif /* _WLAN_DCS_UCFG_API_H_ */

+ 1 - 0
umac/dcs/dispatcher/src/wlan_dcs_init_deinit_api.c

@@ -176,6 +176,7 @@ QDF_STATUS wlan_dcs_psoc_open(struct wlan_objmgr_psoc *psoc)
 		dcs_pdev_priv = &dcs_psoc_obj->dcs_pdev_priv[loop];
 		dcs_pdev_priv->dcs_host_params.dcs_enable_cfg =
 					cfg_get(psoc, CFG_DCS_ENABLE);
+		dcs_pdev_priv->dcs_host_params.dcs_algorithm_process = false;
 		dcs_pdev_priv->dcs_host_params.dcs_debug =
 					cfg_get(psoc, CFG_DCS_DEBUG);
 		dcs_pdev_priv->dcs_host_params.phy_err_penalty =

+ 6 - 0
umac/dcs/dispatcher/src/wlan_dcs_ucfg_api.c

@@ -96,3 +96,9 @@ void ucfg_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id)
 {
 	wlan_dcs_clear(psoc, pdev_id);
 }
+
+void ucfg_config_dcs_event_data(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id,
+				bool dcs_algorithm_process)
+{
+	wlan_dcs_set_algorithm_process(psoc, pdev_id, dcs_algorithm_process);
+}