Browse Source

qcacmn: Update the peer rssi for entire packet bandwidth

Peer rssi is updated with the rssi measured on primary 20 and
not on the entire bandwidth.
Scale the peer rssi value by packet bandwidth offset.
Packet bandwidth offset for packet bandwidth of 20/40/80/160 is
0/3/6/9 dB.

Change-Id: I13eb8c17ec9828c0025d6b3a92a8b26b971268a1
CRs-Fixed: 2518598
Shashikala Prabhu 5 years ago
parent
commit
fdf5499a36
2 changed files with 36 additions and 1 deletions
  1. 14 0
      dp/inc/cdp_txrx_stats_struct.h
  2. 22 1
      dp/wifi3.0/dp_rx_mon_status.c

+ 14 - 0
dp/inc/cdp_txrx_stats_struct.h

@@ -124,6 +124,20 @@
 #define CDP_TXRX_RATECODE_PREM_MASK 0x3
 #define CDP_TXRX_RATECODE_PREM_LSB 6
 
+/* Below BW_GAIN should be added to the SNR value of every ppdu based on the
+ * bandwidth. This table is obtained from HALPHY.
+ * BW         BW_Gain
+ * 20          0
+ * 40          3dBm
+ * 80          6dBm
+ * 160/80P80   9dBm
+ */
+
+#define PKT_BW_GAIN_20MHZ 0
+#define PKT_BW_GAIN_40MHZ 3
+#define PKT_BW_GAIN_80MHZ 6
+#define PKT_BW_GAIN_160MHZ 9
+
 /*
  * cdp_tx_transmit_type: Transmit type index
  * SU: SU Transmit type index

+ 22 - 1
dp/wifi3.0/dp_rx_mon_status.c

@@ -441,6 +441,7 @@ static void dp_rx_stats_update(struct dp_pdev *pdev, struct dp_peer *peer,
 	uint8_t mcs, preamble, ac = 0;
 	uint16_t num_msdu;
 	bool is_invalid_peer = false;
+	uint8_t pkt_bw_offset;
 
 	mcs = ppdu->u.mcs;
 	preamble = ppdu->u.preamble;
@@ -459,7 +460,27 @@ static void dp_rx_stats_update(struct dp_pdev *pdev, struct dp_peer *peer,
 	if (!soc || soc->process_rx_status)
 		return;
 
-	DP_STATS_UPD(peer, rx.rssi, ppdu->rssi);
+	switch (ppdu->u.bw) {
+	case CMN_BW_20MHZ:
+		pkt_bw_offset = PKT_BW_GAIN_20MHZ;
+		break;
+	case CMN_BW_40MHZ:
+		pkt_bw_offset = PKT_BW_GAIN_40MHZ;
+		break;
+	case CMN_BW_80MHZ:
+		pkt_bw_offset = PKT_BW_GAIN_80MHZ;
+		break;
+	case CMN_BW_160MHZ:
+		pkt_bw_offset = PKT_BW_GAIN_160MHZ;
+		break;
+	default:
+		pkt_bw_offset = 0;
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
+			  "Invalid BW index = %d", ppdu->u.bw);
+	}
+
+	DP_STATS_UPD(peer, rx.rssi, (ppdu->rssi + pkt_bw_offset));
+
 	if (peer->stats.rx.avg_rssi == INVALID_RSSI)
 		peer->stats.rx.avg_rssi = ppdu->rssi;
 	else