Преглед изворни кода

qcacmn: Add dp interface to enable/disable reap timer

Enhanced channel frequency response (CFR) based on monitor status
ring, need to enable mon reap timer before starting CFR and disable
the timer after stopping CFR capture. This change adds interface to
enable/disable monitor status ring's reap timer.

Change-Id: I843433ac07c4d55e14b42855ee22779eb7ecb678
CRs-Fixed: 2639307
Wu Gao пре 9 година
родитељ
комит
577bdfe20e
4 измењених фајлова са 108 додато и 7 уклоњено
  1. 27 0
      dp/inc/cdp_txrx_ctrl.h
  2. 4 0
      dp/inc/cdp_txrx_ops.h
  3. 76 7
      dp/wifi3.0/dp_main.c
  4. 1 0
      dp/wifi3.0/dp_types.h

+ 27 - 0
dp/inc/cdp_txrx_ctrl.h

@@ -937,6 +937,33 @@ cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
 
 	soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id);
 }
+
+/**
+ * cdp_enable_mon_reap_timer() - enable/disable reap timer
+ * @soc: Datapath soc handle
+ * @pdev_id: id of objmgr pdev
+ * @enable: enable/disable reap timer of monitor status ring
+ *
+ * Return: none
+ */
+static inline void
+cdp_enable_mon_reap_timer(ol_txrx_soc_handle soc, uint8_t pdev_id,
+			  bool enable)
+{
+	if (!soc || !soc->ops) {
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
+			  "%s invalid instance", __func__);
+		QDF_BUG(0);
+		return;
+	}
+
+	if (!soc->ops->cfr_ops ||
+	    !soc->ops->cfr_ops->txrx_enable_mon_reap_timer)
+		return;
+
+	return soc->ops->cfr_ops->txrx_enable_mon_reap_timer(soc, pdev_id,
+							     enable);
+}
 #endif
 
 #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH)

+ 4 - 0
dp/inc/cdp_txrx_ops.h

@@ -1606,6 +1606,7 @@ struct cdp_rx_offld_ops {
  * @txrx_set_cfr_rcc: Handler to enable/disable CFR mode
  * @txrx_get_cfr_dbg_stats: Handler to get debug statistics for CFR mode
  * @txrx_clear_cfr_dbg_stats: Handler to clear debug statistics for CFR mode
+ * @txrx_enable_mon_reap_timer: Enable/Disable reap timer of monitor status ring
  */
 struct cdp_cfr_ops {
 	void (*txrx_cfr_filter)(struct cdp_soc_t *soc_hdl,
@@ -1622,6 +1623,9 @@ struct cdp_cfr_ops {
 				       struct cdp_cfr_rcc_stats *buf);
 	void (*txrx_clear_cfr_dbg_stats)(struct cdp_soc_t *soc_hdl,
 					 uint8_t pdev_id);
+	void (*txrx_enable_mon_reap_timer)(struct cdp_soc_t *soc_hdl,
+					   uint8_t pdev_id,
+					   bool enable);
 };
 #endif
 

+ 76 - 7
dp/wifi3.0/dp_main.c

@@ -185,7 +185,12 @@ dp_get_cfr_dbg_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
 		     struct cdp_cfr_rcc_stats *cfr_rcc_stats);
 static inline void
 dp_clear_cfr_dbg_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
+static inline void
+dp_enable_mon_reap_timer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			 bool enable);
 #endif
+static inline bool
+dp_is_enable_reap_timer_non_pkt(struct dp_pdev *pdev);
 static uint8_t dp_soc_ring_if_nss_offloaded(struct dp_soc *soc,
 					    enum hal_ring_type ring_type,
 					    int ring_num);
@@ -494,7 +499,7 @@ static void dp_pktlogmod_exit(struct dp_pdev *pdev)
 
 	/* stop mon_reap_timer if it has been started */
 	if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED &&
-	    soc->reap_timer_init)
+	    soc->reap_timer_init && (!dp_is_enable_reap_timer_non_pkt(pdev)))
 		qdf_timer_sync_cancel(&soc->mon_reap_timer);
 
 	pktlogmod_exit(scn);
@@ -3683,6 +3688,7 @@ static inline QDF_STATUS dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
 	TAILQ_INIT(&pdev->neighbour_peers_list);
 	pdev->neighbour_peers_added = false;
 	pdev->monitor_configured = false;
+	pdev->enable_reap_timer_non_pkt = false;
 
 	if (dp_soc_cmn_setup(soc)) {
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
@@ -10310,6 +10316,7 @@ static struct cdp_cfr_ops dp_ops_cfr = {
 	.txrx_set_cfr_rcc = dp_set_cfr_rcc,
 	.txrx_get_cfr_dbg_stats = dp_get_cfr_dbg_stats,
 	.txrx_clear_cfr_dbg_stats = dp_clear_cfr_dbg_stats,
+	.txrx_enable_mon_reap_timer = dp_enable_mon_reap_timer,
 };
 #endif
 
@@ -10808,7 +10815,8 @@ static QDF_STATUS dp_bus_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 		qdf_timer_stop(&soc->int_timer);
 
 	/* Stop monitor reap timer and reap any pending frames in ring */
-	if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED &&
+	if (((pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
+	     dp_is_enable_reap_timer_non_pkt(pdev)) &&
 	    soc->reap_timer_init) {
 		qdf_timer_sync_cancel(&soc->mon_reap_timer);
 		dp_service_mon_rings(soc, DP_MON_REAP_BUDGET);
@@ -10831,7 +10839,8 @@ static QDF_STATUS dp_bus_resume(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 		qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS);
 
 	/* Start monitor reap timer */
-	if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED &&
+	if (((pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
+	     dp_is_enable_reap_timer_non_pkt(pdev)) &&
 	    soc->reap_timer_init)
 		qdf_timer_mod(&soc->mon_reap_timer,
 			      DP_INTR_POLL_TIMER_MS);
@@ -10861,7 +10870,8 @@ static void dp_process_wow_ack_rsp(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
 	 * response from FW reap mon status ring to make sure no packets pending
 	 * in the ring.
 	 */
-	if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED &&
+	if (((pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) ||
+	     dp_is_enable_reap_timer_non_pkt(pdev)) &&
 	    soc->reap_timer_init) {
 		dp_service_mon_rings(soc, DP_MON_REAP_BUDGET);
 	}
@@ -11468,8 +11478,64 @@ static void dp_clear_cfr_dbg_stats(struct cdp_soc_t *soc_hdl,
 
 	qdf_mem_zero(&pdev->stats.rcc, sizeof(pdev->stats.rcc));
 }
+
+/*
+ * dp_enable_mon_reap_timer() - enable/disable reap timer
+ * @soc_hdl: Datapath soc handle
+ * @pdev_id: id of objmgr pdev
+ * @enable: Enable/Disable reap timer of monitor status ring
+ *
+ * Return: none
+ */
+static void
+dp_enable_mon_reap_timer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
+			 bool enable)
+{
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
+	struct dp_pdev *pdev = NULL;
+
+	pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+	if (!pdev) {
+		dp_err("pdev is NULL");
+		return;
+	}
+
+	pdev->enable_reap_timer_non_pkt = enable;
+	if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) {
+		dp_debug("pktlog enabled %d", pdev->rx_pktlog_mode);
+		return;
+	}
+
+	if (!soc->reap_timer_init) {
+		dp_err("reap timer not init");
+		return;
+	}
+
+	if (enable)
+		qdf_timer_mod(&soc->mon_reap_timer,
+			      DP_INTR_POLL_TIMER_MS);
+	else
+		qdf_timer_sync_cancel(&soc->mon_reap_timer);
+}
 #endif
 
+/*
+ * dp_is_enable_reap_timer_non_pkt() - check if mon reap timer is
+ * enabled by non-pkt log or not
+ * @pdev: point to dp pdev
+ *
+ * Return: true if mon reap timer is enabled by non-pkt log
+ */
+static bool dp_is_enable_reap_timer_non_pkt(struct dp_pdev *pdev)
+{
+	if (!pdev) {
+		dp_err("null pdev");
+		return false;
+	}
+
+	return pdev->enable_reap_timer_non_pkt;
+}
+
 /*
 * dp_is_soc_reinit() - Check if soc reinit is true
 * @soc: DP SoC context
@@ -11528,7 +11594,8 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
 					return 0;
 				}
 
-				if (soc->reap_timer_init)
+				if (soc->reap_timer_init &&
+				    (!dp_is_enable_reap_timer_non_pkt(pdev)))
 					qdf_timer_mod(&soc->mon_reap_timer,
 					DP_INTR_POLL_TIMER_MS);
 			}
@@ -11558,7 +11625,8 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
 					return 0;
 				}
 
-				if (soc->reap_timer_init)
+				if (soc->reap_timer_init &&
+				    (!dp_is_enable_reap_timer_non_pkt(pdev)))
 					qdf_timer_mod(&soc->mon_reap_timer,
 					DP_INTR_POLL_TIMER_MS);
 			}
@@ -11617,7 +11685,8 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
 					return 0;
 				}
 
-				if (soc->reap_timer_init)
+				if (soc->reap_timer_init &&
+				    (!dp_is_enable_reap_timer_non_pkt(pdev)))
 					qdf_timer_stop(&soc->mon_reap_timer);
 			}
 			break;

+ 1 - 0
dp/wifi3.0/dp_types.h

@@ -1671,6 +1671,7 @@ struct dp_pdev {
 	/* mirror copy mode */
 	bool mcopy_mode;
 	bool cfr_rcc_mode;
+	bool enable_reap_timer_non_pkt;
 	bool bpr_enable;
 
 	/* enable time latency check for tx completion */