Browse Source

qcacmn: add stats for invalid peer

invalid peer stats in rx when m_copy is enabled,
adding stats for invalid peer at pdev level

Change-Id: I394cfad0642eeb66062d8ab79858a8d7720d8c9f
CRs-Fixed: 2309099
Ruchi, Agrawal 6 years ago
parent
commit
4c5ade6388
3 changed files with 34 additions and 9 deletions
  1. 14 0
      dp/wifi3.0/dp_main.c
  2. 18 9
      dp/wifi3.0/dp_rx_mon_status.c
  3. 2 0
      dp/wifi3.0/dp_types.h

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

@@ -2867,6 +2867,15 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
 		goto fail0;
 	}
 
+	pdev->invalid_peer = qdf_mem_malloc(sizeof(struct dp_peer));
+
+	if (!pdev->invalid_peer) {
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
+			  FL("Invalid peer memory allocation failed"));
+		qdf_mem_free(pdev);
+		goto fail0;
+	}
+
 	soc_cfg_ctx = soc->wlan_cfg_ctx;
 	pdev->wlan_cfg_ctx = wlan_cfg_pdev_attach(soc->ctrl_psoc);
 
@@ -2874,6 +2883,7 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
 			FL("pdev cfg_attach failed"));
 
+		qdf_mem_free(pdev->invalid_peer);
 		qdf_mem_free(pdev);
 		goto fail0;
 	}
@@ -3217,6 +3227,7 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force)
 	soc->pdev_list[pdev->pdev_id] = NULL;
 	soc->pdev_count--;
 	wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx);
+	qdf_mem_free(pdev->invalid_peer);
 	qdf_mem_free(pdev->dp_txrx_handle);
 	qdf_mem_free(pdev);
 }
@@ -5303,6 +5314,9 @@ static inline void dp_aggregate_pdev_stats(struct dp_pdev *pdev)
 	qdf_mem_set(&(pdev->stats.rx), sizeof(pdev->stats.rx), 0x0);
 	qdf_mem_set(&(pdev->stats.tx_i), sizeof(pdev->stats.tx_i), 0x0);
 
+	if (pdev->mcopy_mode)
+		DP_UPDATE_STATS(pdev, pdev->invalid_peer);
+
 	qdf_spin_lock_bh(&pdev->vdev_list_lock);
 	TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) {
 

+ 18 - 9
dp/wifi3.0/dp_rx_mon_status.c

@@ -164,23 +164,29 @@ static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
 		peer->vdev->stats.rx.last_rx_rate = ratekbps;
 }
 
-static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
-		struct cdp_rx_indication_ppdu *ppdu)
+static void dp_rx_stats_update(struct dp_pdev *pdev, struct dp_peer *peer,
+			       struct cdp_rx_indication_ppdu *ppdu)
 {
-	struct dp_pdev *pdev = NULL;
+	struct dp_soc *soc = NULL;
 	uint8_t mcs, preamble, ac = 0;
 	uint16_t num_msdu;
+	bool is_invalid_peer = false;
 
 	mcs = ppdu->u.mcs;
 	preamble = ppdu->u.preamble;
 	num_msdu = ppdu->num_msdu;
 
-	if (!peer)
+	if (pdev)
+		soc = pdev->soc;
+	else
 		return;
 
-	pdev = peer->vdev->pdev;
+	if (!peer) {
+		is_invalid_peer = true;
+		peer = pdev->invalid_peer;
+	}
 
-	if (soc->process_rx_status)
+	if (!soc || soc->process_rx_status)
 		return;
 
 	DP_STATS_UPD(peer, rx.rssi, ppdu->rssi);
@@ -237,6 +243,9 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	dp_peer_stats_notify(peer);
 	DP_STATS_UPD(peer, rx.last_rssi, ppdu->rssi);
 
+	if (is_invalid_peer)
+		return;
+
 	dp_rx_rate_stats_update(peer, ppdu);
 
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
@@ -407,17 +416,17 @@ dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
 		qdf_nbuf_put_tail(ppdu_nbuf,
 				sizeof(struct cdp_rx_indication_ppdu));
 		cdp_rx_ppdu = (struct cdp_rx_indication_ppdu *)ppdu_nbuf->data;
-
+		peer = dp_peer_find_by_id(soc, cdp_rx_ppdu->peer_id);
 		if (cdp_rx_ppdu->peer_id != HTT_INVALID_PEER) {
-			peer = dp_peer_find_by_id(soc, cdp_rx_ppdu->peer_id);
 			if (peer) {
-				dp_rx_stats_update(soc, peer, cdp_rx_ppdu);
+				dp_rx_stats_update(pdev, peer, cdp_rx_ppdu);
 				dp_wdi_event_handler(WDI_EVENT_RX_PPDU_DESC,
 					soc, ppdu_nbuf, cdp_rx_ppdu->peer_id,
 					WDI_NO_VAL, pdev->pdev_id);
 				dp_peer_unref_del_find_by_id(peer);
 			}
 		} else if (pdev->mcopy_mode) {
+			dp_rx_stats_update(pdev, peer, cdp_rx_ppdu);
 			dp_wdi_event_handler(WDI_EVENT_RX_PPDU_DESC, soc,
 					ppdu_nbuf, HTT_INVALID_PEER,
 					WDI_NO_VAL, pdev->pdev_id);

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

@@ -1287,6 +1287,8 @@ struct dp_pdev {
 	struct cdp_tx_sojourn_stats sojourn_stats;
 	qdf_nbuf_t sojourn_buf;
 
+	/* peer pointer for collecting invalid peer stats */
+	struct dp_peer *invalid_peer;
 };
 
 struct dp_peer;