Browse Source

qcacmn: Notify peer stats change to upper layer

Notify peer stats change to upper layer via WDI interface.

Change-Id: I4b9ea3ed98ba09b4afc03e3c3edc42ab9c9f3cba
CRs-Fixed: 2287145
Amir Patel 6 years ago
parent
commit
52c6b73468
4 changed files with 48 additions and 0 deletions
  1. 2 0
      dp/wifi3.0/dp_htt.c
  2. 8 0
      dp/wifi3.0/dp_internal.h
  3. 2 0
      dp/wifi3.0/dp_rx_mon_status.c
  4. 36 0
      dp/wifi3.0/dp_stats.c

+ 2 - 0
dp/wifi3.0/dp_htt.c

@@ -150,6 +150,8 @@ static void dp_tx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	DP_STATS_INCC(peer,
 			tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX)));
+	dp_peer_stats_notify(peer);
+	DP_STATS_UPD(peer, tx.last_tx_rate, ppdu->tx_rate);
 
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
 		soc->cdp_soc.ol_ops->update_dp_stats(pdev->ctrl_pdev,

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

@@ -528,6 +528,8 @@ static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
 		DP_HTT_T2H_HP_PIPE, &hif_pipe_callbacks);
 }
 
+QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer);
+
 #else
 static inline int dp_wdi_event_unsub(struct cdp_pdev *txrx_pdev_handle,
 	void *event_cb_sub_handle,
@@ -573,6 +575,12 @@ static inline void dp_hif_update_pipe_callback(void *soc, void *cb_context,
 	QDF_STATUS (*callback)(void *, qdf_nbuf_t, uint8_t), uint8_t pipe_id)
 {
 }
+
+static inline QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
 #endif /* CONFIG_WIN */
 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
 void dp_tx_dump_flow_pool_info(void *soc);

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

@@ -197,6 +197,8 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	ac = TID_TO_WME_AC(ppdu->tid);
 	if (ppdu->tid != HAL_TID_INVALID)
 		DP_STATS_INC(peer, rx.wme_ac_type[ac], num_msdu);
+	dp_peer_stats_notify(peer);
+	DP_STATS_UPD(peer, rx.last_rssi, ppdu->rssi);
 
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
 		soc->cdp_soc.ol_ops->update_dp_stats(pdev->ctrl_pdev,

+ 36 - 0
dp/wifi3.0/dp_stats.c

@@ -3330,3 +3330,39 @@ void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag
 	if (dest_ptr)
 		qdf_mem_copy(dest_ptr, tag_buf, size);
 }
+
+#if defined(CONFIG_WIN) && WDI_EVENT_ENABLE
+QDF_STATUS dp_peer_stats_notify(struct dp_peer *peer)
+{
+	struct dp_pdev *dp_pdev;
+	struct cdp_interface_peer_stats peer_stats_intf;
+	struct cdp_peer_stats *peer_stats = &peer->stats;
+
+	if (!peer->vdev)
+		return QDF_STATUS_E_FAULT;
+
+	dp_pdev = peer->vdev->pdev;
+	qdf_mem_zero(&peer_stats_intf, sizeof(peer_stats_intf));
+	if (peer_stats->rx.last_rssi != peer_stats->rx.rssi)
+		peer_stats_intf.rssi_changed = true;
+
+	if ((peer_stats->rx.rssi && peer_stats_intf.rssi_changed) ||
+	    (peer_stats->tx.tx_rate &&
+	     peer_stats->tx.tx_rate != peer_stats->tx.last_tx_rate)) {
+		peer_stats_intf.peer_hdl = peer->ctrl_peer;
+		peer_stats_intf.last_peer_tx_rate = peer_stats->tx.last_tx_rate;
+		peer_stats_intf.peer_tx_rate = peer_stats->tx.tx_rate;
+		peer_stats_intf.peer_rssi = peer_stats->rx.rssi;
+		peer_stats_intf.tx_packet_count = peer_stats->tx.ucast.num;
+		peer_stats_intf.rx_packet_count = peer_stats->rx.to_stack.num;
+		peer_stats_intf.tx_byte_count = peer_stats->tx.tx_success.bytes;
+		peer_stats_intf.rx_byte_count = peer_stats->rx.to_stack.bytes;
+		peer_stats_intf.per = peer_stats->tx.last_per;
+		dp_wdi_event_handler(WDI_EVENT_PEER_STATS, dp_pdev->soc,
+				     (void *)&peer_stats_intf, 0,
+				     WDI_NO_VAL, dp_pdev->pdev_id);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif