Browse Source

qcacmn: Compute average rssi

Compute average rssi from last packet rssi

CRs-Fixed: 2419240
Change-Id: I20851e3804412808393121ce882245ee8f110d5d
Amir Patel 6 years ago
parent
commit
bb69cfaeda
2 changed files with 14 additions and 0 deletions
  1. 9 0
      dp/wifi3.0/dp_internal.h
  2. 5 0
      dp/wifi3.0/dp_rx_mon_status.c

+ 9 - 0
dp/wifi3.0/dp_internal.h

@@ -23,6 +23,15 @@
 
 #define RX_BUFFER_SIZE_PKTLOG_LITE 1024
 
+
+#define DP_RSSI_AVG_WEIGHT 2
+/*
+ * Formula to derive avg_rssi is taken from wifi2.o firmware
+ */
+#define DP_GET_AVG_RSSI(avg_rssi, last_rssi) \
+	(((avg_rssi) - (((uint8_t)(avg_rssi)) >> DP_RSSI_AVG_WEIGHT)) \
+	+ ((((uint8_t)(last_rssi)) >> DP_RSSI_AVG_WEIGHT)))
+
 /* Macro For NYSM value received in VHT TLV */
 #define VHT_SGI_NYSM 3
 

+ 5 - 0
dp/wifi3.0/dp_rx_mon_status.c

@@ -199,6 +199,11 @@ static void dp_rx_stats_update(struct dp_pdev *pdev, struct dp_peer *peer,
 		return;
 
 	DP_STATS_UPD(peer, rx.rssi, ppdu->rssi);
+	if (!peer->stats.rx.avg_rssi)
+		peer->stats.rx.avg_rssi = ppdu->rssi;
+	else
+		peer->stats.rx.avg_rssi =
+			DP_GET_AVG_RSSI(peer->stats.rx.avg_rssi, ppdu->rssi);
 
 	if ((preamble == DOT11_A) || (preamble == DOT11_B))
 		ppdu->u.nss = 1;