Browse Source

qcacmn: Add checks in rx_mon_status handler to filter spurious frames

1. find_first_bit API returns Size value if it doesn’t find any bit set.
   This was causing VOICE AC counter to go high even for TID 0
2. Reset stats was not resetting the stats immediately
3. Added checks to avoid spurious stats increment
4. Detect data/mgmt pkt to avoid spurious stats increment

Change-Id: Ic9c5695fc7bdf58d1237e7e20bb79378a02a21f6
Anish Nataraj 7 years ago
parent
commit
28490c4c5e
4 changed files with 62 additions and 3 deletions
  1. 15 0
      dp/wifi3.0/dp_main.c
  2. 25 2
      dp/wifi3.0/dp_rx_mon_status.c
  3. 20 1
      hal/wifi3.0/hal_api_mon.h
  4. 2 0
      qdf/inc/qdf_nbuf.h

+ 15 - 0
dp/wifi3.0/dp_main.c

@@ -4613,6 +4613,8 @@ static inline void
 dp_txrx_host_stats_clr(struct dp_vdev *vdev)
 {
 	struct dp_peer *peer = NULL;
+	struct dp_soc *soc = (struct dp_soc *)vdev->pdev->soc;
+
 	DP_STATS_CLR(vdev->pdev);
 	DP_STATS_CLR(vdev->pdev->soc);
 	DP_STATS_CLR(vdev);
@@ -4620,8 +4622,21 @@ dp_txrx_host_stats_clr(struct dp_vdev *vdev)
 		if (!peer)
 			return;
 		DP_STATS_CLR(peer);
+
+		if (soc->cdp_soc.ol_ops->update_dp_stats) {
+			soc->cdp_soc.ol_ops->update_dp_stats(
+					vdev->pdev->osif_pdev,
+					&peer->stats,
+					peer->peer_ids[0],
+					UPDATE_PEER_STATS);
+		}
+
 	}
 
+	if (soc->cdp_soc.ol_ops->update_dp_stats)
+		soc->cdp_soc.ol_ops->update_dp_stats(vdev->pdev->osif_pdev,
+				&vdev->stats, (uint16_t)vdev->vdev_id,
+				UPDATE_VDEV_STATS);
 }
 
 /**

+ 25 - 2
dp/wifi3.0/dp_rx_mon_status.c

@@ -81,6 +81,7 @@ dp_rx_populate_cdp_indication_ppdu(struct dp_soc *soc,
 	cdp_rx_ppdu->u.mcs = ppdu_info->rx_status.mcs;
 	cdp_rx_ppdu->u.gi = ppdu_info->rx_status.sgi;
 	cdp_rx_ppdu->u.preamble = ppdu_info->rx_status.preamble_type;
+	cdp_rx_ppdu->u.ppdu_type = ppdu_info->rx_status.reception_type;
 	cdp_rx_ppdu->rssi = ppdu_info->rx_status.rssi_comb;
 	cdp_rx_ppdu->timestamp = ppdu_info->com_info.ppdu_timestamp;
 	cdp_rx_ppdu->channel = ppdu_info->rx_status.chan_freq;
@@ -116,7 +117,7 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 		struct cdp_rx_indication_ppdu *ppdu)
 {
 	struct dp_pdev *pdev = NULL;
-	uint8_t mcs, preamble;
+	uint8_t mcs, preamble, ac = 0;
 	uint16_t num_msdu;
 
 	mcs = ppdu->u.mcs;
@@ -141,6 +142,7 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 
 	DP_STATS_INC(peer, rx.sgi_count[ppdu->u.gi], num_msdu);
 	DP_STATS_INC(peer, rx.bw[ppdu->u.bw], num_msdu);
+	DP_STATS_INC(peer, rx.reception_type[ppdu->u.ppdu_type], num_msdu);
 	DP_STATS_INCC(peer, rx.ampdu_cnt, num_msdu, ppdu->is_ampdu);
 	DP_STATS_INCC(peer, rx.non_ampdu_cnt, num_msdu, !(ppdu->is_ampdu));
 	DP_STATS_UPD(peer, rx.rx_rate, mcs);
@@ -174,7 +176,14 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX)));
-	DP_STATS_INC(peer, rx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)], num_msdu);
+	/*
+	 * If invalid TID, it could be a non-qos frame, hence do not update
+	 * any AC counters
+	 */
+	ac = TID_TO_WME_AC(ppdu->tid);
+	if (ppdu->tid != HAL_TID_INVALID)
+		DP_STATS_INC(peer, rx.wme_ac_type[ac], num_msdu);
+
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
 		soc->cdp_soc.ol_ops->update_dp_stats(pdev->osif_pdev,
 				&peer->stats, ppdu->peer_id,
@@ -246,6 +255,20 @@ dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
 	struct dp_peer *peer;
 	struct cdp_rx_indication_ppdu *cdp_rx_ppdu;
 
+	/*
+	 * Do not allocate if fcs error,
+	 * ast idx invalid / fctl invalid
+	 */
+
+	if (!ppdu_info->rx_status.frame_control_info_valid)
+		return;
+
+	if (ppdu_info->com_info.mpdu_cnt_fcs_ok == 0)
+		return;
+
+	if (ppdu_info->rx_status.ast_index == HAL_AST_IDX_INVALID)
+		return;
+
 	ppdu_nbuf = qdf_nbuf_alloc(soc->osdev,
 			sizeof(struct hal_rx_ppdu_info), 0, 0, FALSE);
 	if (ppdu_nbuf) {

+ 20 - 1
hal/wifi3.0/hal_api_mon.h

@@ -114,6 +114,10 @@
 #define HE_LTF_2_X 1
 #define HE_LTF_4_X 2
 #define VHT_SIG_SU_NSS_MASK	0x7
+
+#define HAL_TID_INVALID 31
+#define HAL_AST_IDX_INVALID 0xFFFF
+
 enum {
 	HAL_HW_RX_DECAP_FORMAT_RAW = 0,
 	HAL_HW_RX_DECAP_FORMAT_NWIFI,
@@ -521,6 +525,7 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 	case WIFIRX_PPDU_END_USER_STATS_E:
 	{
 		unsigned long tid = 0;
+		uint16_t seq = 0;
 
 		ppdu_info->rx_status.ast_index =
 				HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_4,
@@ -531,6 +536,10 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 		tid = HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_12,
 				RECEIVED_QOS_DATA_TID_BITMAP);
 		ppdu_info->rx_status.tid = qdf_find_first_bit(&tid, sizeof(tid)*8);
+
+		if (ppdu_info->rx_status.tid == (sizeof(tid) * 8))
+			ppdu_info->rx_status.tid = HAL_TID_INVALID;
+
 		ppdu_info->rx_status.tcp_msdu_count =
 			HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_9,
 					TCP_MSDU_COUNT) +
@@ -544,9 +553,16 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 					OTHER_MSDU_COUNT);
 		ppdu_info->rx_status.nss =
 			HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_1, NSS);
-		ppdu_info->rx_status.first_data_seq_ctrl =
+
+		ppdu_info->rx_status.frame_control_info_valid =
 			HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_3,
 					DATA_SEQUENCE_CONTROL_INFO_VALID);
+
+		seq = HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_5,
+					FIRST_DATA_SEQ_CTRL);
+		if (ppdu_info->rx_status.frame_control_info_valid)
+			ppdu_info->rx_status.first_data_seq_ctrl = seq;
+
 		ppdu_info->rx_status.preamble_type =
 			HAL_RX_GET(rx_tlv, RX_PPDU_END_USER_STATS_3,
 						HT_CONTROL_FIELD_PKT_TYPE);
@@ -896,6 +912,9 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 #endif
 		ppdu_info->rx_status.he_re = 0;
 
+		ppdu_info->rx_status.reception_type = HAL_RX_GET(rx_tlv,
+				PHYRX_RSSI_LEGACY_0, RECEPTION_TYPE);
+
 		value = HAL_RX_GET(rssi_info_tlv,
 			RECEIVE_RSSI_INFO_0, RSSI_PRI20_CHAIN0);
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,

+ 2 - 0
qdf/inc/qdf_nbuf.h

@@ -217,7 +217,9 @@ struct mon_rx_status {
 	uint8_t  beamformed;
 	uint8_t  he_sig_b_common_RU[4];
 	int8_t   rssi_comb;
+	uint8_t  reception_type;
 	uint16_t duration;
+	uint8_t frame_control_info_valid;
 	int16_t first_data_seq_ctrl;
 	uint32_t ast_index;
 	uint32_t tid;