Bladeren bron

qcacmn: Add ini to control rate filter for rx avg

Adds ini field to control the filter for rx avg rate calculation.
	0     : Filter Disabled
	11000 : Max rate filter (in kbps) supported for filter

Change-Id: I6ae88b7af3d4c1fae033101e77b308949e5b3d1e
CRs-Fixed: 3628056
Aman Mehta 1 jaar geleden
bovenliggende
commit
37e5a76c07
4 gewijzigde bestanden met toevoegingen van 54 en 4 verwijderingen
  1. 33 2
      dp/wifi3.0/monitor/dp_rx_mon.c
  2. 14 1
      wlan_cfg/cfg_dp.h
  3. 4 1
      wlan_cfg/wlan_cfg.c
  4. 3 0
      wlan_cfg/wlan_cfg.h

+ 33 - 2
dp/wifi3.0/monitor/dp_rx_mon.c

@@ -661,6 +661,33 @@ end:
 	dp_rx_populate_cfr_non_assoc_sta(pdev, ppdu_info, cdp_rx_ppdu);
 }
 
+/*
+ * dp_mon_eval_avg_rate_filter() - Evaluates rate value against filter
+ * @peer: dp peer
+ * @ratekbps: last packet rate in kbps
+ * @avg_rate: average rate for which new rate is to be evaluated
+ *
+ * Return: true when average need to be evaluated else false
+ */
+static inline bool
+dp_mon_eval_avg_rate_filter(struct dp_peer *peer, uint32_t ratekbps,
+			    uint32_t avg_rate) {
+	uint16_t filter_val = 0;
+
+	if (qdf_unlikely(!peer || !peer->vdev ||
+			  !peer->vdev->pdev->soc->wlan_cfg_ctx)) {
+		return true;
+	}
+
+	filter_val =
+		peer->vdev->pdev->soc->wlan_cfg_ctx->avg_rate_stats_filter_val;
+
+	if (!filter_val || avg_rate < filter_val || ratekbps > filter_val) {
+		return true;
+	}
+	return false;
+}
+
 /**
  * dp_rx_rate_stats_update() - Update per-peer rate statistics
  * @peer: Datapath peer handle
@@ -736,8 +763,12 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 	ppdu->rix = rix;
 	ppdu_user->rix = rix;
 	DP_STATS_UPD(mon_peer, rx.last_rx_rate, ratekbps);
-	mon_peer->stats.rx.avg_rx_rate =
-		dp_ath_rate_lpf(mon_peer->stats.rx.avg_rx_rate, ratekbps);
+	if (qdf_unlikely(dp_mon_eval_avg_rate_filter(peer, ratekbps,
+					mon_peer->stats.rx.avg_rx_rate))) {
+		mon_peer->stats.rx.avg_rx_rate =
+			dp_ath_rate_lpf(mon_peer->stats.rx.avg_rx_rate,
+					ratekbps);
+	}
 	ppdu_rx_rate = dp_ath_rate_out(mon_peer->stats.rx.avg_rx_rate);
 	DP_STATS_UPD(mon_peer, rx.rnd_avg_rx_rate, ppdu_rx_rate);
 	ppdu->rx_ratekbps = ratekbps;

+ 14 - 1
wlan_cfg/cfg_dp.h

@@ -565,6 +565,10 @@
 #define WLAN_CFG_TX_CAPT_2_RBM_DEFAULT 2
 #define WLAN_CFG_TX_CAPT_3_RBM_DEFAULT 3
 
+#define WLAN_CFG_DP_AVG_RATE_FILTER_MIN 0
+#define WLAN_CFG_DP_AVG_RATE_FILTER_MAX 11000
+#define WLAN_CFG_DP_AVG_RATE_FILTER_DEFAULT 0
+
 /*
  * <ini>
  * "dp_tx_capt_max_mem_mb"- maximum memory used by Tx capture
@@ -1581,6 +1585,14 @@
 		WLAN_CFG_DP_NAPI_SCALE_FACTOR, \
 		CFG_VALUE_OR_DEFAULT, "NAPI scale factor for DP")
 
+#define CFG_DP_STATS_AVG_RATE_FILTER \
+		CFG_INI_UINT("dp_stats_avg_rate_filter_val", \
+		WLAN_CFG_DP_AVG_RATE_FILTER_MIN,\
+		WLAN_CFG_DP_AVG_RATE_FILTER_MAX, \
+		WLAN_CFG_DP_AVG_RATE_FILTER_DEFAULT, \
+		CFG_VALUE_OR_DEFAULT, \
+		"Average Rate filter for stats")
+
 /*
  * <ini>
  * legacy_mode_csum_disable - Disable csum offload for legacy 802.11abg modes
@@ -2190,5 +2202,6 @@
 		CFG(CFG_DP_TX_CAPT_RADIO_2_RBM_ID) \
 		CFG(CFG_DP_TX_CAPT_RADIO_3_RBM_ID) \
 		CFG_DP_UMAC_RESET_BUFFER_WINDOW_CFG \
-		CFG(CFG_DP_RX_BUFFER_SIZE)
+		CFG(CFG_DP_RX_BUFFER_SIZE) \
+		CFG(CFG_DP_STATS_AVG_RATE_FILTER)
 #endif /* _CFG_DP_H_ */

+ 4 - 1
wlan_cfg/wlan_cfg.c

@@ -4193,6 +4193,8 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
 	wlan_soc_local_pkt_capture_cfg_attach(psoc, wlan_cfg_ctx);
 	wlan_soc_umac_reset_cfg_attach(psoc, wlan_cfg_ctx);
 	wlan_cfg_ctx->rx_buffer_size = cfg_get(psoc, CFG_DP_RX_BUFFER_SIZE);
+	wlan_cfg_ctx->avg_rate_stats_filter_val =
+		cfg_get(psoc, CFG_DP_STATS_AVG_RATE_FILTER);
 	return wlan_cfg_ctx;
 }
 
@@ -4447,7 +4449,8 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
 			cfg_get(psoc, CFG_SPECIAL_FRAME_MSK);
 	wlan_soc_umac_reset_cfg_attach(psoc, wlan_cfg_ctx);
 	wlan_cfg_ctx->rx_buffer_size = cfg_get(psoc, CFG_DP_RX_BUFFER_SIZE);
-
+	wlan_cfg_ctx->avg_rate_stats_filter_val =
+		cfg_get(psoc, CFG_DP_STATS_AVG_RATE_FILTER);
 	return wlan_cfg_ctx;
 }
 #endif

+ 3 - 0
wlan_cfg/wlan_cfg.h

@@ -352,6 +352,8 @@ struct wlan_srng_cfg {
  *                            during this window, configured time is in
  *                            milliseconds.
  * @fw_ast_indication_disable: Disable AST
+ * @avg_rate_stats_filter_val: Average rate filter value for stats.
+ *
  */
 struct wlan_cfg_dp_soc_ctxt {
 	int num_int_ctxts;
@@ -566,6 +568,7 @@ struct wlan_cfg_dp_soc_ctxt {
 	uint32_t umac_reset_buffer_window;
 #endif
 	bool fw_ast_indication_disable;
+	uint16_t avg_rate_stats_filter_val;
 };
 
 /**