[qca-nss-drv] Break up statistics implementation
Break up the centralized statistics implementation to be subsystem based
statistics implementation.
Change-Id: Ibc14d88f391e816d3d6284a57ea6676f2842ac70
Signed-off-by: Yu Huang <yuhuang@codeaurora.org>
diff --git a/nss_wifi.c b/nss_wifi.c
index fab4c7c..fb2ec65 100644
--- a/nss_wifi.c
+++ b/nss_wifi.c
@@ -15,63 +15,7 @@
*/
#include "nss_tx_rx_common.h"
-
-/*
- * nss_wifi_stats_sync()
- * Handle the syncing of WIFI stats.
- */
-void nss_wifi_stats_sync(struct nss_ctx_instance *nss_ctx,
- struct nss_wifi_stats_sync_msg *stats, uint16_t interface)
-{
- struct nss_top_instance *nss_top = nss_ctx->nss_top;
- uint32_t radio_id = interface - NSS_WIFI_INTERFACE0;
- int i = 0;
-
- if (radio_id >= NSS_MAX_WIFI_RADIO_INTERFACES) {
- nss_warning("%p: invalid interface: %d", nss_ctx, interface);
- return;
- }
-
- spin_lock_bh(&nss_top->stats_lock);
-
- /*
- * Tx/Rx stats
- */
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_PKTS] += stats->node_stats.rx_packets;
- for (i = 0; i < NSS_MAX_NUM_PRI; i++) {
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_QUEUE_0_DROPPED + i] += stats->node_stats.rx_dropped[i];
- }
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TX_PKTS] += stats->node_stats.tx_packets;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TX_DROPPED] += stats->tx_transmit_dropped;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TX_COMPLETED] += stats->tx_transmit_completions;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_MGMT_RCV_CNT] += stats->tx_mgmt_rcv_cnt;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_MGMT_TX_PKTS] += stats->tx_mgmt_pkts;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_MGMT_TX_DROPPED] += stats->tx_mgmt_dropped;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_MGMT_TX_COMPLETIONS] += stats->tx_mgmt_completions;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TX_INV_PEER_ENQUEUE_CNT] += stats->tx_inv_peer_enq_cnt;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_INV_PEER_RCV_CNT] += stats->rx_inv_peer_rcv_cnt;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_PN_CHECK_FAILED] += stats->rx_pn_check_failed;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_DELIVERED] += stats->rx_pkts_deliverd;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_BYTES_DELIVERED] += stats->rx_bytes_deliverd;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TX_BYTES_COMPLETED] += stats->tx_bytes_transmit_completions;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_DELIVER_UNALIGNED_DROP_CNT] += stats->rx_deliver_unaligned_drop_cnt;
-
- for (i = 0; i < NSS_WIFI_TX_NUM_TOS_TIDS; i++) {
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TIDQ_ENQUEUE_CNT + i] += stats->tidq_enqueue_cnt[i];
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TIDQ_DEQUEUE_CNT + i] += stats->tidq_dequeue_cnt[i];
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TIDQ_ENQUEUE_FAIL_CNT + i] += stats->tidq_enqueue_fail_cnt[i];
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TIDQ_TTL_EXPIRE_CNT + i] += stats->tidq_ttl_expire_cnt[i];
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TIDQ_DEQUEUE_REQ_CNT + i] += stats->tidq_dequeue_req_cnt[i];
- }
-
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_RX_HTT_FETCH_CNT] += stats->rx_htt_fetch_cnt;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TOTAL_TIDQ_DEPTH] = stats->total_tidq_depth;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TOTAL_TIDQ_BYPASS_CNT] += stats->total_tidq_bypass_cnt;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_GLOBAL_Q_FULL_CNT] += stats->global_q_full_cnt;
- nss_top->stats_wifi[radio_id][NSS_STATS_WIFI_TIDQ_FULL_CNT] += stats->tidq_full_cnt;
-
- spin_unlock_bh(&nss_top->stats_lock);
-}
+#include "nss_wifi_stats.h"
/*
* nss_wifi_get_context()
@@ -100,7 +44,7 @@
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_WIFI_MAX_MSG) {
- nss_warning("%p: received invalid message %d for wifi interface", nss_ctx, ncm->type);
+ nss_warning("%p: received invalid message %d for wifi interface", nss_ctx, ncm->type);
return;
}
@@ -273,6 +217,8 @@
nss_core_register_handler(nss_ctx, NSS_WIFI_INTERFACE0, nss_wifi_handler, NULL);
nss_core_register_handler(nss_ctx, NSS_WIFI_INTERFACE1, nss_wifi_handler, NULL);
nss_core_register_handler(nss_ctx, NSS_WIFI_INTERFACE2, nss_wifi_handler, NULL);
+
+ nss_wifi_stats_dentry_create();
}
EXPORT_SYMBOL(nss_wifi_get_context);