[qca-nss-drv]: Add stats framework support for wifili

Stats framework support for wifili

Change-Id: I8fce6c906a47d469fa460b740a33db8c29fe0acd
Signed-off-by: Aniruddha Paul <paulani@codeaurora.org>
diff --git a/exports/nss_wifili_if.h b/exports/nss_wifili_if.h
index 1f5d6d4..4b7755a 100644
--- a/exports/nss_wifili_if.h
+++ b/exports/nss_wifili_if.h
@@ -31,6 +31,12 @@
 				/**< Max number of reo data ring for NSS. */
 #define NSS_WIFILI_SOC_PER_PACKET_METADATA_OFFSET 4
 				/**< Metadata area for storing rx stats. */
+#define NSS_WIFILI_MAX_TXDESC_POOLS_MSG 4
+				/**< Max number of txdesc sw pools */
+#define NSS_WIFILI_MAX_TX_EXT_DESC_POOLS_MSG 4
+				/**< Max number of txdesc ext sw pools */
+#define NSS_WIFILI_MAX_PDEV_NUM_MSG 3
+				/**< Max number of pdev devices*/
 
 /**
  * nss_wifili_msg_types
@@ -47,7 +53,7 @@
 	NSS_WIFILI_PEER_DELETE_MSG,
 	NSS_WIFILI_SEND_PEER_MEMORY_REQUEST_MSG,
 	NSS_WIFILI_PEER_FREELIST_APPEND_MSG,
-	NSS_WIFILI_PDEV_STATS_SYNC_MSG,
+	NSS_WIFILI_STATS_MSG,
 	NSS_WIFILI_MAX_MSG
 };
 
@@ -291,39 +297,170 @@
 			/**< tx enqueue succesful count */
 	uint32_t tx_dequeue_cnt;
 			/**< tx dequeue count */
-	uint32_t tx_dequeue_drop;
-			/**< drop count for dequeue */
 	uint32_t tx_send_fail_cnt;
 			/**< hw send fail count */
-	uint32_t tx_completion_cnt;
-			/**< tx completion count */
-	uint32_t tx_desc_in_use;
-			/**< tx desc in use count */
+	uint32_t inv_peer;
+			/**< invalid peer enqueue count */
+	uint32_t inv_peer_drop_byte_cnt;
+			/**< invalid peer drop byte count */
+	uint32_t tx_input_pkt;
+			/**< tx packets ready to sent */
+	uint32_t tx_processed_pkt;
+			/**< tx no of packets sent */
+	uint32_t tx_processed_bytes;
+			/**< tx no of bytes processed */
+
 };
 
-/**
+/*
  * nss_wifili_rx_stats
  *	rx statistics
  */
 struct nss_wifili_rx_stats {
-	uint32_t rx_desc_alloc_fail;
-			/**< rx desc alloc fail count */
 	uint32_t rx_msdu_err;
-			/**< rx msdu error count */
+					/**< rx msdu error count */
 	uint32_t rx_inv_peer;
-			/**< rx invalid peer count */
+					/**< rx invalid peer count */
 	uint32_t rx_scatter_inv_peer;
-			/**< rx scatter invalid peer count */
+					/**< rx scatter invalid peer count */
 	uint32_t rx_wds_learn_send;
-			/**< wds src port learn packet */
+					/**< wds src port learn packet */
 	uint32_t rx_wds_learn_send_fail;
-			/**< wds src port learn exception send fail cnt */
-	uint32_t rx_ring_error;
-			/**< rx ring error count */
+					/**< wds src port learn exception send fail cnt */
 	uint32_t rx_send_dropped;
-			/**< rx send dropped count */
+					/**< rx send dropped count */
 	uint32_t rx_deliver_cnt;
-			/**< rx deliver count */
+					/**< rx deliver count to next node */
+	uint32_t rx_deliver_cnt_fail;
+					/**< rx deliver count fail*/
+	uint32_t rx_intra_bss_ucast_send;
+					/**< intrabss unicast sent count */
+	uint32_t rx_intra_bss_ucast_send_fail;
+					/**< intrabss unicast send fail count */
+	uint32_t rx_intra_bss_mcast_send;
+					/**< intrabss mcast send count */
+	uint32_t rx_intra_bss_mcast_send_fail;
+					/**< intrabss mcast send fail count */
+	uint32_t rx_sg_recv_fail;
+					/**< rx sg receive fail count */
+};
+
+/**
+ * nss_wifili_tx_tcl_ring_stats
+ *	tcl ring specific statistics;
+ */
+struct nss_wifili_tx_tcl_ring_stats {
+	uint32_t tcl_no_hw_desc;	/**< no of tcl hw descriptors*/
+	uint32_t tcl_ring_full;		/**< no of times tcl ring full*/
+	uint32_t tcl_ring_sent;		/**< totall no of ring sent*/
+};
+
+/**
+ * nss_wifili_tx_comp_ring_stats
+ *	Tx completion ring statistics
+ */
+struct nss_wifili_tx_comp_ring_stats {
+	uint32_t invalid_bufsrc;	/**< tx comp ring desc invalid bufsrc */
+	uint32_t invalid_cookie;	/**< tx com ring desc invalid cookie  */
+	uint32_t hw_ring_empty;		/**< tx comp no comp ring available */
+	uint32_t ring_reaped;		/**< tx comp successfull ring reaped*/
+
+};
+
+/**
+ * nss_wifili_tx_sw_pool_stats
+ *	Tx completion sw stats
+ */
+struct nss_wifili_tx_sw_pool_stats {
+	uint32_t desc_alloc;			/**< tx desc sw pool desc in use*/
+	uint32_t desc_alloc_fail;		/**< tx desc sw pool alloc fail  */
+	uint32_t desc_already_allocated;	/**< tx desc re-alloc for allocated desc */
+	uint32_t desc_invalid_free;		/**< tx desc freeing of allocated desc */
+	uint32_t tx_rel_src_fw;			/**< tx desc src is fw */
+	uint32_t tx_rel_ext_desc;		/**< tx desc sg */
+	uint32_t tx_rel_tx_desc;		/**< tx desc src is hw*/
+	uint32_t tx_rel_no_pb;			/**< tx desc has pbuf present */
+};
+
+/*
+ * wifili_tx_ext_sw_pool_stats
+ *	Tx ext desc pool
+ */
+struct nss_wifili_tx_ext_sw_pool_stats {
+	uint32_t desc_alloc;			/**< tx ext(sg) desc in use */
+	uint32_t desc_alloc_fail;		/**< tx ext desc alloc fail */
+	uint32_t desc_already_allocated;	/**< tx ext desc already allocated */
+	uint32_t desc_invalid_free;		/**< tx desc invalid src */
+
+};
+
+/**
+ * nss_wifili_rx_wbm_ring_stats
+ *	wbm release ring statistics
+ */
+struct nss_wifili_rx_wbm_ring_stats {
+	uint32_t invalid_buf_mgr;		/**< wbm invalid buffer manager */
+	uint32_t err_src_rxdma;			/**< wbm src is rdma ring */
+	uint32_t err_src_rxdma_code_inv;	/**< wbm src dma reason unknown */
+	uint32_t err_src_reo;			/**< wbm src is reo */
+	uint32_t err_src_reo_code_nullq;	/**< wbm src reo because of null tlv */
+	uint32_t err_src_reo_code_inv;		/**< wbm src reo reason unknown */
+	uint32_t err_src_invalid;		/**< wbm src is unknown */
+};
+
+/**
+ * nss_wifili_rx_reo_ring_stats
+ * 	reo error statistics
+ */
+struct nss_wifili_rx_reo_ring_stats {
+	uint32_t ring_error;			/**< reo ring error*/
+	uint32_t ring_reaped;			/**< no of ring desc reaped */
+	uint32_t invalid_cookie;		/**< no of invalid cookie */
+};
+
+/**
+ * nss_wifili_rx sw_pool_stats
+ *	nss_wifoli dma sw pool stats
+ */
+struct nss_wifili_rx_sw_pool_stats {
+	uint32_t rx_no_pb;			/**< rx sw  desc no buff avail */
+	uint32_t desc_alloc;			/**< no of desc in use */
+	uint32_t desc_alloc_fail;		/**< no of desc alloc fail */
+};
+
+/*
+ * wifili rx dma ring stats
+ *	nss_wifli dma ring statistics
+ */
+struct nss_wifili_rx_dma_ring_stats {
+	uint32_t rx_hw_desc_unavailable;	/**< no of times hw desc is unavailable */
+};
+
+/**
+ * nss_wifili_device_stats
+ * 	wifili device specific stats
+ */
+struct nss_wifili_device_stats {
+	struct nss_wifili_tx_tcl_ring_stats tcl_stats[NSS_WIFILI_MAX_TCL_DATA_RINGS_MSG];
+									/**< tcl ring stats */
+	struct nss_wifili_tx_comp_ring_stats txcomp_stats[NSS_WIFILI_MAX_TCL_DATA_RINGS_MSG];
+									/**< tx comp ring stats*/
+	struct nss_wifili_tx_sw_pool_stats tx_sw_pool_stats[NSS_WIFILI_MAX_TXDESC_POOLS_MSG];
+									/**< tx sw pool stats */
+	struct nss_wifili_tx_ext_sw_pool_stats tx_ext_sw_pool_stats[NSS_WIFILI_MAX_TX_EXT_DESC_POOLS_MSG];
+									/**< tx ext ext sw pool stats */
+	struct nss_wifili_tx_stats tx_data_stats[NSS_WIFILI_MAX_PDEV_NUM_MSG];
+									/**< tx data stats for each pdev */
+	struct nss_wifili_rx_reo_ring_stats rxreo_stats[NSS_WIFILI_MAX_REO_DATA_RINGS_MSG];
+									/**< rx reo ring stats */
+	struct nss_wifili_rx_sw_pool_stats rx_sw_pool_stats[NSS_WIFILI_MAX_PDEV_NUM_MSG];
+									/**< rx dma sw pool stats */
+	struct nss_wifili_rx_stats rx_data_stats[NSS_WIFILI_MAX_PDEV_NUM_MSG];
+									/**< rx data stats for each pdev */
+	struct nss_wifili_rx_dma_ring_stats rxdma_stats[NSS_WIFILI_MAX_PDEV_NUM_MSG];
+									/**< rx dma ring stats */
+	struct nss_wifili_rx_wbm_ring_stats rxwbm_stats;
+									/**< wbm ring stats */
 };
 
 /**
@@ -331,10 +468,8 @@
  *	li stats sync msg
  */
 struct nss_wifili_stats_sync_msg {
-	struct nss_wifili_tx_stats tx_stats;
-			/**< transmit statistics */
-	struct nss_wifili_rx_stats rx_stats;
-			/**< receive statistics */
+	struct nss_wifili_device_stats stats;
+			/**< device statistics */
 };
 
 /**
diff --git a/nss_core.h b/nss_core.h
index 23243d4..7d077a4 100644
--- a/nss_core.h
+++ b/nss_core.h
@@ -567,6 +567,143 @@
 };
 
 /*
+ * wifili txrx statistics
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_txrx {
+	NSS_STATS_WIFILI_RX_MSDU_ERROR,			/* Number of rx packets received from ring with msdu error */
+	NSS_STATS_WIFILI_RX_INV_PEER_RCV,		/* Number of rx packets with invalid peer id */
+	NSS_STATS_WIFILI_RX_WDS_SRCPORT_EXCEPTION,	/* Number of rx packets exceptioned to host because of src port learn fail */
+	NSS_STATS_WIFILI_RX_WDS_SRCPORT_EXCEPTION_FAIL,	/* Number of rx src port learn fail packets failed to get enqueued to host */
+	NSS_STATS_WIFILI_RX_DELIVERD,			/* Number of packets wifili has given to next node */
+	NSS_STATS_WIFILI_RX_DELIVER_DROPPED,		/* Number of packets which wifili failed to enqueue to next node */
+	NSS_STATS_WIFILI_RX_INTRA_BSS_UCAST,		/* Number of packets which wifili send for intra bss ucast packet*/
+	NSS_STATS_WIFILI_RX_INTRA_BSS_UCAST_FAIL,	/* Number of packets which wifili send for intra bss ucast packet failed*/
+	NSS_STATS_WIFILI_RX_INTRA_BSS_MCAST,		/* Number of packets which wifili send for intra bss mcast packet*/
+	NSS_STATS_WIFILI_RX_INTRA_BSS_MCAST_FAIL,	/* Number of packets which wifili send for intra bss mcast packet failed*/
+	NSS_STATS_WIFILI_RX_SG_RCV_FAIL,		/* Number of packets sg received failure*/
+	NSS_STATS_WIFILI_TX_ENQUEUE,			/* Number of packets that got enqueued to wifili */
+	NSS_STATS_WIFILI_TX_ENQUEUE_DROP,		/* Number of packets that dropped during enqueue to wifili */
+	NSS_STATS_WIFILI_TX_DEQUEUE,			/* Number of packets that are dequeued by wifili */
+	NSS_STATS_WIFILI_TX_HW_ENQUEUE_FAIL,		/* Number of rx packets that NSS wifi offload path could successfully process */
+	NSS_STATS_WIFILI_TX_SENT_COUNT,			/* Number of Tx packets sent to hw */
+	NSS_STATS_WIFILI_TXRX_MAX,			/* Number of max txrx stats*/
+};
+
+/*
+ * wifili tcl stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_tcl {
+	NSS_STATS_WIFILI_TCL_NO_HW_DESC,		/* Number of tcl hw desc*/
+	NSS_STATS_WIFILI_TCL_RING_FULL,			/* Number of times tcl ring full*/
+	NSS_STATS_WIFILI_TCL_RING_SENT,			/* Number of times tcl desc sent*/
+	NSS_STATS_WIFILI_TCL_MAX,			/* Number of max tcl stats*/
+};
+
+/*
+ * wifili tx comp stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *  	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_tx_comp {
+	NSS_STATS_WIFILI_TX_DESC_FREE_INV_BUFSRC,	/* Number of invalid bufsrc packets */
+	NSS_STATS_WIFILI_TX_DESC_FREE_INV_COOKIE,	/* Number of invalid cookie packets */
+	NSS_STATS_WIFILI_TX_DESC_FREE_HW_RING_EMPTY,	/* Number of time times hw ring empty found*/
+	NSS_STATS_WIFILI_TX_DESC_FREE_REAPED,		/* Number of tx packets that are reaped out of tx completion ring */
+	NSS_STATS_WIFILI_TX_DESC_FREE_MAX,		/* Number of tx comp stats */
+};
+
+/*
+ * wifili tx reo stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *  	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_reo {
+	NSS_STATS_WIFILI_REO_ERROR,			/* Number of reo error*/
+	NSS_STATS_WIFILI_REO_REAPED,			/* Number of reo reaped*/
+	NSS_STATS_WIFILI_REO_INV_COOKIE,		/* Number of invalid cookie*/
+	NSS_STATS_WIFILI_REO_MAX,			/* Number of reo stats*/
+};
+
+/*
+ * wifili tx desc stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_txsw_pool {
+	NSS_STATS_WIFILI_TX_DESC_IN_USE,		/* Number of tx packets that are currently in flight */
+	NSS_STATS_WIFILI_TX_DESC_ALLOC_FAIL,		/* Number of tx sw desc alloc failures */
+	NSS_STATS_WIFILI_TX_DESC_ALREADY_ALLOCATED,	/* Number of tx sw desc already allocated*/
+	NSS_STATS_WIFILI_TX_DESC_INVALID_FREE,		/* Number of tx sw desc invalid free*/
+	NSS_STATS_WIFILI_TX_DESC_FREE_SRC_FW,		/* Number of tx desc for which release src is fw */
+	NSS_STATS_WIFILI_TX_DESC_FREE_COMPLETION,	/* Number of tx desc completion*/
+	NSS_STATS_WIFILI_TX_DESC_NO_PB,			/* Number of tx desc pb is null*/
+	NSS_STATS_WIFILI_TX_DESC_MAX,			/* Number of tx desc stats*/
+};
+
+/*
+ * wifili tx ext desc stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_ext_txsw_pool {
+	NSS_STATS_WIFILI_EXT_TX_DESC_IN_USE,		/* Number of ext tx packets that are currently in flight */
+	NSS_STATS_WIFILI_EXT_TX_DESC_ALLOC_FAIL,	/* Number of ext tx sw desc alloc failures */
+	NSS_STATS_WIFILI_EXT_TX_DESC_ALREADY_ALLOCATED,	/* Number of ext tx sw desc already allocated*/
+	NSS_STATS_WIFILI_EXT_TX_DESC_INVALID_FREE,	/* Number of ext tx sw desc invalid free*/
+	NSS_STATS_WIFILI_EXT_TX_DESC_MAX,		/* Number of ext tx desc stats*/
+};
+
+/*
+ * wifili rx desc stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_rxdma_pool {
+	NSS_STATS_WIFILI_RX_DESC_NO_PB,			/* Number of rx desc no pb*/
+	NSS_STATS_WIFILI_RX_DESC_ALLOC_FAIL,		/* Number of rx desc alloc failures */
+	NSS_STATS_WIFILI_RX_DESC_IN_USE,		/* Number of rx desc alloc in use*/
+	NSS_STATS_WIFILI_RX_DESC_MAX,			/* Number of rx desc stats*/
+};
+
+/*
+ * wifili rx dma ring stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_rxdma_ring {
+	NSS_STATS_WIFILI_RXDMA_DESC_UNAVAILABLE, 	/* Number of rx dma desc unavailable*/
+	NSS_STATS_WIFILI_RXDMA_DESC_MAX,	 	/* Number of rx dma desc stast*/
+};
+
+/*
+ * wifili wbm ring stats
+ *
+ * WARNING: There is a 1:1 mapping between values below and corresponding
+ *	stats string array in nss_stats.c
+ */
+enum nss_stats_wifili_wbm {
+	NSS_STATS_WIFILI_WBM_SRC_DMA,			/* Number of rx invalid src dma*/
+	NSS_STATS_WIFILI_WBM_SRC_DMA_CODE_INV,		/* Number of rx invalid src dma*/
+	NSS_STATS_WIFILI_WBM_SRC_REO,			/* Number of rx invalid src reo*/
+	NSS_STATS_WIFILI_WBM_SRC_REO_CODE_NULLQ,	/* Number of rx invalid reo error with null q*/
+	NSS_STATS_WIFILI_WBM_SRC_REO_CODE_INV,		/* Number of rx invalid reo error with null q*/
+	NSS_STATS_WIFILI_WBM_SRC_INV,			/* Number of rx invalid reo code invalid*/
+	NSS_STATS_WIFILI_WBM_MAX,			/* Number of rx wbm stats*/
+};
+
+/*
  * NSS core state -- for H2N/N2H
  * l2tpv2 debug stats
  */
@@ -1008,6 +1145,30 @@
 };
 
 /*
+ * NSS wifili stats
+ */
+struct nss_wifili_stats {
+	uint64_t stats_txrx[NSS_WIFILI_MAX_PDEV_NUM_MSG][NSS_STATS_WIFILI_TXRX_MAX];
+							/* Number of txrx stats*/
+	uint64_t stats_tcl_ring[NSS_WIFILI_MAX_TCL_DATA_RINGS_MSG][NSS_STATS_WIFILI_TCL_MAX];
+							/* Tcl stats for each ring*/
+	uint64_t stats_tx_comp[NSS_WIFILI_MAX_TCL_DATA_RINGS_MSG][NSS_STATS_WIFILI_TX_DESC_FREE_MAX];
+							/* Tx comp ring stats*/
+	uint64_t stats_tx_desc[NSS_WIFILI_MAX_TXDESC_POOLS_MSG][NSS_STATS_WIFILI_TX_DESC_MAX];
+							/* Tx desc pool stats*/
+	uint64_t stats_ext_tx_desc[NSS_WIFILI_MAX_TX_EXT_DESC_POOLS_MSG][NSS_STATS_WIFILI_EXT_TX_DESC_MAX];
+							/* Tx ext desc pool stats*/
+	uint64_t stats_reo[NSS_WIFILI_MAX_REO_DATA_RINGS_MSG][NSS_STATS_WIFILI_REO_MAX];
+							/* Rx  reo ring stats*/
+	uint64_t stats_rx_desc[NSS_WIFILI_MAX_PDEV_NUM_MSG][NSS_STATS_WIFILI_RX_DESC_MAX];
+							/* Rx  rx sw pool stats*/
+	uint64_t stats_rxdma[NSS_WIFILI_MAX_PDEV_NUM_MSG][NSS_STATS_WIFILI_RXDMA_DESC_MAX];
+							/* Rx  dma ring stats*/
+	uint64_t stats_wbm[NSS_STATS_WIFILI_WBM_MAX];
+							/* Wbm  error ring stats*/
+};
+
+/*
  * Main NSS context structure (singleton)
  */
 struct nss_top_instance {
@@ -1053,6 +1214,7 @@
 	struct dentry *wifi_if_dentry;		/* wifi_if stats dentry */
 	struct dentry *virt_if_dentry;		/* virt_if stats dentry */
 	struct dentry *tx_rx_virt_if_dentry;	/* tx_rx_virt_if stats dentry. Will be deprecated soon */
+	struct dentry *wifili_dentry;		/* wifili stats dentry */
 	struct nss_ctx_instance nss[NSS_MAX_CORES];
 						/* NSS contexts */
 	/*
@@ -1206,6 +1368,7 @@
 	uint64_t stats_trustsec_tx[NSS_STATS_TRUSTSEC_TX_MAX];
 					/* Trustsec TX stats */
 
+	struct nss_wifili_stats stats_wifili; /* Wifili stats*/
 	bool nss_hal_common_init_done;
 
 	uint16_t prev_mtu_sz;		/* mtu sz needed as of now */
diff --git a/nss_stats.c b/nss_stats.c
index 4550061..8ed280a 100644
--- a/nss_stats.c
+++ b/nss_stats.c
@@ -30,6 +30,10 @@
  * inclusive of stats value
  */
 #define NSS_STATS_MAX_STR_LENGTH 96
+#define NSS_STATS_WIFILI_MAX	(NSS_STATS_WIFILI_TXRX_MAX + NSS_STATS_WIFILI_TCL_MAX + \
+				NSS_STATS_WIFILI_TX_DESC_FREE_MAX + NSS_STATS_WIFILI_REO_MAX + \
+				NSS_STATS_WIFILI_TX_DESC_MAX + NSS_STATS_WIFILI_EXT_TX_DESC_MAX + \
+				NSS_STATS_WIFILI_RX_DESC_MAX + NSS_STATS_WIFILI_RXDMA_DESC_MAX)
 
 extern int32_t nss_tx_rx_virt_if_copy_stats(int32_t if_num, int i, char *line);
 
@@ -451,7 +455,7 @@
 
 /*
  * nss_stats_str_wifi
- * 	Wifi statistics strings
+ *	Wifi statistics strings
  */
 static int8_t *nss_stats_str_wifi[NSS_STATS_WIFI_MAX] = {
 	"RX_PACKETS",
@@ -518,6 +522,116 @@
 };
 
 /*
+ * nss_stats_str_wifili
+ *	wifili txrx statistics
+ */
+static int8_t *nss_stats_str_wifili_txrx[NSS_STATS_WIFILI_TXRX_MAX] = {
+	"WIFILI_RX_MSDU_ERROR",
+	"WIFILI_RX_INV_PEER_RCV",
+	"WIFILI_RX_WDS_SRCPORT_EXCEPTION",
+	"WIFILI_RX_WDS_SRCPORT_EXCEPTION_FAIL",
+	"WIFILI_RX_DELIVERD",
+	"WIFILI_RX_DELIVER_DROPPED",
+	"WIFILI_RX_INTRA_BSS_UCAST",
+	"WIFILI_RX_INTRA_BSS_UCAST_FAIL",
+	"WIFILI_RX_INTRA_BSS_MCAST",
+	"WIFILI_RX_INTRA_BSS_MCAST_FAIL",
+	"WIFILI_RX_SG_RCV_FAIL",
+	"WIFILI_TX_ENQUEUE",
+	"WIFILI_TX_ENQUEUE_DROP",
+	"WIFILI_TX_DEQUEUE",
+	"WIFILI_TX_HW_ENQUEUE_FAIL",
+	"WIFILI_TX_SENT_COUNT",
+};
+
+/*
+ * nss_stats_str_wifili_tcl
+ *	wifili tcl stats
+ */
+static int8_t *nss_stats_str_wifili_tcl[NSS_STATS_WIFILI_TCL_MAX] = {
+	"WIFILI_TCL_NO_HW_DESC",
+	"WIFILI_TCL_RING_FULL",
+	"WIFILI_TCL_RING_SENT",
+};
+
+/*
+ * nss_stats_str_wifili_tx_comp
+ *	wifili tx comp stats
+ */
+static int8_t *nss_stats_str_wifili_tx_comp[NSS_STATS_WIFILI_TX_DESC_FREE_MAX] = {
+	"WIFILI_TX_DESC_FREE_INV_BUFSRC",
+	"WIFILI_TX_DESC_FREE_INV_COOKIE",
+	"WIFILI_TX_DESC_FREE_HW_RING_EMPTY",
+	"WIFILI_TX_DESC_FREE_REAPED",
+};
+
+/*
+ * nss_stats_str_wifili_reo
+ *	wifili tx reo stats
+ */
+static int8_t *nss_stats_str_wifili_reo[NSS_STATS_WIFILI_REO_MAX] = {
+	"WIFILI_REO_ERROR",
+	"WIFILI_REO_REAPED",
+	"WIFILI_REO_INV_COOKIE",
+};
+
+/*
+ * nss_stats_str_wifili_txsw_pool
+ *	wifili tx desc stats
+ */
+static int8_t *nss_stats_str_wifili_txsw_pool[NSS_STATS_WIFILI_TX_DESC_MAX] = {
+	"WIFILI_TX_DESC_IN_USE",
+	"WIFILI_TX_DESC_ALLOC_FAIL",
+	"WIFILI_TX_DESC_ALREADY_ALLOCATED",
+	"WIFILI_TX_DESC_INVALID_FREE",
+	"WIFILI_TX_DESC_FREE_SRC_FW",
+	"WIFILI_TX_DESC_FREE_COMPLETION",
+	"WIFILI_TX_DESC_NO_PB",
+};
+
+/*
+ * nss_stats_str_wifili_ext_txsw_pool
+ *	wifili tx ext desc stats
+ */
+static uint8_t *nss_stats_str_wifili_ext_txsw_pool[NSS_STATS_WIFILI_EXT_TX_DESC_MAX] = {
+	"WIFILI_EXT_TX_DESC_IN_USE",
+	"WIFILI_EXT_TX_DESC_ALLOC_FAIL",
+	"WIFILI_EXT_TX_DESC_ALREADY_ALLOCATED",
+	"WIFILI_EXT_TX_DESC_INVALID_FREE",
+};
+
+/*
+ * nss_stats_str_wifili_rxdma_pool
+ *	wifili rx desc stats
+ */
+static int8_t *nss_stats_str_wifili_rxdma_pool[NSS_STATS_WIFILI_RX_DESC_MAX] = {
+	"WIFILI_RX_DESC_NO_PB",
+	"WIFILI_RX_DESC_ALLOC_FAIL",
+	"WIFILI_RX_DESC_IN_USE",
+};
+
+/*
+ * nss_stats_str_wifili_rxdma_ring
+ *	wifili rx dma ring stats
+ */
+static int8_t *nss_stats_str_wifili_rxdma_ring[NSS_STATS_WIFILI_RXDMA_DESC_MAX] = {
+	"WIFILI_RXDMA_HW_DESC_UNAVAILABLE",
+};
+
+/*
+ * nss_stats_str_wifili_wbm
+ *	wifili wbm ring stats
+ */
+static int8_t *nss_stats_str_wifili_wbm[NSS_STATS_WIFILI_WBM_MAX] = {
+	"WIFILI_WBM_SRC_DMA",
+	"WIFILI_WBM_SRC_DMA_CODE_INV",
+	"WIFILI_WBM_SRC_REO",
+	"WIFILI_WBM_SRC_REO_CODE_NULLQ",
+	"WIFILI_WBM_SRC_REO_CODE_INV",
+	"WIFILI_WBM_SRC_INV",
+};
+
+/*
  * nss_stats_str_portid
  *	PortID statistics strings
  */
@@ -1023,7 +1137,7 @@
 					"%s = %llu\n", nss_stats_str_if_exception_ipv6[i], stats_shadow[i]);
 	}
 
-	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,"\nipv6 stats end\n\n");
+	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nipv6 stats end\n\n");
 	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 	kfree(lbuf);
 	kfree(stats_shadow);
@@ -1538,7 +1652,7 @@
 		return 0;
 	}
 
-	size_wr = scnprintf(lbuf, size_al,"eth_rx stats start:\n\n");
+	size_wr = scnprintf(lbuf, size_al, "eth_rx stats start:\n\n");
 
 	/*
 	 * Common node stats
@@ -1589,7 +1703,7 @@
 					"%s = %llu\n", nss_stats_str_if_exception_eth_rx[i], stats_shadow[i]);
 	}
 
-	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,"\neth_rx stats end\n\n");
+	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\neth_rx stats end\n\n");
 	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
 	kfree(lbuf);
 	kfree(stats_shadow);
@@ -1937,7 +2051,7 @@
 			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
 					"%s = %llu\n", nss_stats_str_gmac[i], stats_shadow[i]);
 		}
-		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,"\n");
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
 	}
 
 	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\ngmac stats end\n\n");
@@ -2005,6 +2119,171 @@
 }
 
 /*
+ * nss_stats_wifili_read()
+ * 	Read wifili statistics
+ */
+static ssize_t nss_stats_wifili_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
+{
+	uint32_t i, j;
+
+	/*
+	 * max output lines = ((#stats + eight blank lines) * #WIFILI #STATS) + start/end tag + 3 blank
+	 */
+	uint32_t max_output_lines = (((NSS_STATS_WIFILI_MAX + 9) * NSS_WIFILI_MAX_PDEV_NUM_MSG)+
+									NSS_STATS_WIFILI_WBM_MAX + 5);
+	size_t size_al = NSS_STATS_MAX_STR_LENGTH * max_output_lines;
+	size_t size_wr = 0;
+	ssize_t bytes_read = 0;
+	uint64_t *stats_shadow;
+
+	char *lbuf = kzalloc(size_al, GFP_KERNEL);
+	if (unlikely(lbuf == NULL)) {
+		nss_warning("Could not allocate memory for local statistics buffer");
+		return 0;
+	}
+
+	/*
+	 * Take max of all wifili stats
+	 *
+	 * NOTE: txrx stats is bigger of all stats
+	 */
+	stats_shadow = kzalloc(NSS_STATS_WIFILI_TXRX_MAX * 8, GFP_KERNEL);
+	if (unlikely(stats_shadow == NULL)) {
+		nss_warning("Could not allocate memory for local shadow buffer");
+		kfree(lbuf);
+		return 0;
+	}
+
+	size_wr = scnprintf(lbuf, size_al, "wifili stats start:\n\n");
+
+	for (i = 0; i < NSS_WIFILI_MAX_PDEV_NUM_MSG; i++) {
+
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "WIFILI ID: %d\n", i);
+
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_TXRX_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_txrx[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_txrx[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng TCL ring stats
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_TCL_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_tcl_ring[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_tcl[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng TCL comp stats
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_TX_DESC_FREE_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_tx_comp[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_tx_comp[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng reo ring stats
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_REO_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_reo[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_reo[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng TX SW Pool
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_TX_DESC_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_tx_desc[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_txsw_pool[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng TX  EXt SW Pool
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_EXT_TX_DESC_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_ext_tx_desc[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_ext_txsw_pool[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng rxdma pool stats
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_RX_DESC_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_rx_desc[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_rxdma_pool[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+		/*
+		 * Fillinng rxdma ring stats
+		 */
+		spin_lock_bh(&nss_top_main.stats_lock);
+		for (j = 0; (j < NSS_STATS_WIFILI_RXDMA_DESC_MAX); j++) {
+			stats_shadow[j] = nss_top_main.stats_wifili.stats_rxdma[i][j];
+			size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+					"%s = %llu\n", nss_stats_str_wifili_rxdma_ring[j], stats_shadow[j]);
+		}
+
+		spin_unlock_bh(&nss_top_main.stats_lock);
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\n");
+
+	}
+
+	/*
+	 * Fillinng wbm ring stats
+	 */
+	spin_lock_bh(&nss_top_main.stats_lock);
+	for (j = 0; (j < NSS_STATS_WIFILI_WBM_MAX); j++) {
+		stats_shadow[j] = nss_top_main.stats_wifili.stats_wbm[j];
+		size_wr += scnprintf(lbuf + size_wr, size_al - size_wr,
+				"%s = %llu\n", nss_stats_str_wifili_wbm[j], stats_shadow[j]);
+	}
+
+	spin_unlock_bh(&nss_top_main.stats_lock);
+	size_wr += scnprintf(lbuf + size_wr, size_al - size_wr, "\nwifili stats end\n\n");
+
+	bytes_read = simple_read_from_buffer(ubuf, sz, ppos, lbuf, strlen(lbuf));
+	kfree(lbuf);
+	kfree(stats_shadow);
+
+	return bytes_read;
+}
+
+/*
  * nss_stats_dtls_read()
  *	Read DTLS session statistics
  */
@@ -2790,7 +3069,7 @@
 		"drop_csum", "drop_malformed", "unknown" };
 	uint64_t tcnt = 0;
 
-	switch(i) {
+	switch (i) {
 	case 0:
 		tcnt = s->pnode_stats.rx_packets;
 		break;
@@ -3577,6 +3856,11 @@
 NSS_STATS_DECLARE_FILE_OPERATIONS(trustsec_tx)
 
 /*
+ * wifili_stats_ops
+ */
+NSS_STATS_DECLARE_FILE_OPERATIONS(wifili)
+
+/*
  * nss_stats_init()
  * 	Enable NSS statistics
  */
@@ -4054,6 +4338,17 @@
 		return;
 	}
 
+	/*
+	 * WIFILI stats
+	 */
+	nss_top_main.wifili_dentry = debugfs_create_file("wifili", 0400,
+						nss_top_main.stats_dentry,
+						&nss_top_main, &nss_stats_wifili_ops);
+	if (unlikely(nss_top_main.wifili_dentry == NULL)) {
+		nss_warning("Failed to create qca-nss-drv/stats/wifili file in debugfs");
+		return;
+	}
+
 	nss_log_init();
 }
 
diff --git a/nss_wifili.c b/nss_wifili.c
index 2def610..0010fda 100644
--- a/nss_wifili.c
+++ b/nss_wifili.c
@@ -35,8 +35,160 @@
  *	Handle the syncing of WIFI stats.
  */
 static void nss_wifili_stats_sync(struct nss_ctx_instance *nss_ctx,
-		struct nss_wifili_stats_sync_msg *stats, uint16_t interface)
+		struct nss_wifili_stats_sync_msg *wlsoc_stats, uint16_t interface)
 {
+	struct nss_top_instance *nss_top = nss_ctx->nss_top;
+	struct nss_wifili_stats *stats = &nss_top->stats_wifili;
+	struct nss_wifili_device_stats *devstats = &wlsoc_stats->stats;
+	uint32_t index;
+
+	spin_lock_bh(&nss_top->stats_lock);
+
+	for (index = 0; index < NSS_WIFILI_MAX_PDEV_NUM_MSG; index++) {
+		/*
+		 * Rx stats
+		 */
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_MSDU_ERROR] +=
+							devstats->rx_data_stats[index].rx_msdu_err;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_INV_PEER_RCV] +=
+							(devstats->rx_data_stats[index].rx_inv_peer +
+							devstats->rx_data_stats[index].rx_scatter_inv_peer);
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_WDS_SRCPORT_EXCEPTION] +=
+							devstats->rx_data_stats[index].rx_wds_learn_send;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_WDS_SRCPORT_EXCEPTION_FAIL] +=
+							devstats->rx_data_stats[index].rx_wds_learn_send_fail;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_DELIVERD] +=
+							devstats->rx_data_stats[index].rx_deliver_cnt;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_DELIVER_DROPPED] +=
+							devstats->rx_data_stats[index].rx_deliver_cnt_fail;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_INTRA_BSS_UCAST] +=
+							devstats->rx_data_stats[index].rx_intra_bss_ucast_send;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_INTRA_BSS_UCAST_FAIL] +=
+							devstats->rx_data_stats[index].rx_intra_bss_ucast_send_fail;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_INTRA_BSS_MCAST] +=
+							devstats->rx_data_stats[index].rx_intra_bss_mcast_send;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_INTRA_BSS_MCAST_FAIL] +=
+							devstats->rx_data_stats[index].rx_intra_bss_mcast_send_fail;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_RX_SG_RCV_FAIL] +=
+							devstats->rx_data_stats[index].rx_sg_recv_fail;
+
+		/*
+		 * Tx stats
+		 */
+		stats->stats_txrx[index][NSS_STATS_WIFILI_TX_ENQUEUE] +=
+							devstats->tx_data_stats[index].tx_enqueue_cnt;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_TX_ENQUEUE_DROP] +=
+							devstats->tx_data_stats[index].tx_enqueue_dropped;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_TX_DEQUEUE] +=
+							devstats->tx_data_stats[index].tx_dequeue_cnt;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_TX_HW_ENQUEUE_FAIL] +=
+							devstats->tx_data_stats[index].tx_send_fail_cnt;
+		stats->stats_txrx[index][NSS_STATS_WIFILI_TX_SENT_COUNT] +=
+							devstats->tx_data_stats[index].tx_processed_pkt;
+	}
+
+	/*
+	 * update the tcl ring stats
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_TCL_DATA_RINGS_MSG; index++) {
+		stats->stats_tcl_ring[index][NSS_STATS_WIFILI_TCL_NO_HW_DESC] +=
+							devstats->tcl_stats[index].tcl_no_hw_desc;
+		stats->stats_tcl_ring[index][NSS_STATS_WIFILI_TCL_RING_FULL] +=
+							devstats->tcl_stats[index].tcl_ring_full;
+		stats->stats_tcl_ring[index][NSS_STATS_WIFILI_TCL_RING_SENT] +=
+							devstats->tcl_stats[index].tcl_ring_sent;
+	}
+
+	/*
+	 * update the tcl comp stats
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_TCL_DATA_RINGS_MSG; index++) {
+		stats->stats_tx_comp[index][NSS_STATS_WIFILI_TX_DESC_FREE_INV_BUFSRC] +=
+								devstats->txcomp_stats[index].invalid_bufsrc;
+		stats->stats_tx_comp[index][NSS_STATS_WIFILI_TX_DESC_FREE_INV_COOKIE] +=
+								devstats->txcomp_stats[index].invalid_cookie;
+		stats->stats_tx_comp[index][NSS_STATS_WIFILI_TX_DESC_FREE_HW_RING_EMPTY] +=
+								devstats->txcomp_stats[index].hw_ring_empty;
+		stats->stats_tx_comp[index][NSS_STATS_WIFILI_TX_DESC_FREE_REAPED] +=
+								devstats->txcomp_stats[index].ring_reaped;
+	}
+
+	/*
+	 * update reo ring stats
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_REO_DATA_RINGS_MSG; index++) {
+		stats->stats_reo[index][NSS_STATS_WIFILI_REO_ERROR] +=
+								devstats->rxreo_stats[index].ring_error;
+		stats->stats_reo[index][NSS_STATS_WIFILI_REO_REAPED] +=
+								devstats->rxreo_stats[index].ring_reaped;
+		stats->stats_reo[index][NSS_STATS_WIFILI_REO_INV_COOKIE] +=
+								devstats->rxreo_stats[index].invalid_cookie;
+	}
+
+	/*
+	 * update tx sw pool
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_TXDESC_POOLS_MSG; index++) {
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_IN_USE] =
+								devstats->tx_sw_pool_stats[index].desc_alloc;
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_ALLOC_FAIL] +=
+								devstats->tx_sw_pool_stats[index].desc_alloc_fail;
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_ALREADY_ALLOCATED] +=
+								devstats->tx_sw_pool_stats[index].desc_already_allocated;
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_INVALID_FREE] +=
+								devstats->tx_sw_pool_stats[index].desc_invalid_free;
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_FREE_SRC_FW] +=
+								devstats->tx_sw_pool_stats[index].tx_rel_src_fw;
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_FREE_COMPLETION] +=
+								devstats->tx_sw_pool_stats[index].tx_rel_tx_desc;
+		stats->stats_tx_desc[index][NSS_STATS_WIFILI_TX_DESC_NO_PB] +=
+								devstats->tx_sw_pool_stats[index].tx_rel_no_pb;
+	}
+
+	/*
+	 * update ext tx desc pool stats
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_TX_EXT_DESC_POOLS_MSG; index++) {
+		stats->stats_ext_tx_desc[index][NSS_STATS_WIFILI_EXT_TX_DESC_IN_USE] =
+								devstats->tx_ext_sw_pool_stats[index].desc_alloc;
+		stats->stats_ext_tx_desc[index][NSS_STATS_WIFILI_EXT_TX_DESC_ALLOC_FAIL] +=
+								devstats->tx_ext_sw_pool_stats[index].desc_alloc_fail;
+		stats->stats_ext_tx_desc[index][NSS_STATS_WIFILI_EXT_TX_DESC_ALREADY_ALLOCATED] +=
+								devstats->tx_ext_sw_pool_stats[index].desc_already_allocated;
+		stats->stats_ext_tx_desc[index][NSS_STATS_WIFILI_EXT_TX_DESC_INVALID_FREE] +=
+								devstats->tx_ext_sw_pool_stats[index].desc_invalid_free;
+	}
+
+	/*
+	 * update rx desc pool stats
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_PDEV_NUM_MSG; index++) {
+		stats->stats_rx_desc[index][NSS_STATS_WIFILI_RX_DESC_NO_PB] +=
+								devstats->rx_sw_pool_stats[index].rx_no_pb;
+		stats->stats_rx_desc[index][NSS_STATS_WIFILI_RX_DESC_ALLOC_FAIL] +=
+								devstats->rx_sw_pool_stats[index].desc_alloc_fail;
+		stats->stats_rx_desc[index][NSS_STATS_WIFILI_RX_DESC_IN_USE] =
+								devstats->rx_sw_pool_stats[index].desc_alloc;
+	}
+
+	/*
+	 * update rx dma ring stats
+	 */
+	for (index = 0; index < NSS_WIFILI_MAX_PDEV_NUM_MSG; index++) {
+		stats->stats_rxdma[index][NSS_STATS_WIFILI_RXDMA_DESC_UNAVAILABLE] +=
+								devstats->rxdma_stats[index].rx_hw_desc_unavailable;
+	}
+
+	/*
+	 * update wbm ring stats
+	 */
+	stats->stats_wbm[NSS_STATS_WIFILI_WBM_SRC_DMA] += devstats->rxwbm_stats.err_src_rxdma;
+	stats->stats_wbm[NSS_STATS_WIFILI_WBM_SRC_DMA_CODE_INV] += devstats->rxwbm_stats.err_src_rxdma_code_inv;
+	stats->stats_wbm[NSS_STATS_WIFILI_WBM_SRC_REO] += devstats->rxwbm_stats.err_src_reo;
+	stats->stats_wbm[NSS_STATS_WIFILI_WBM_SRC_REO_CODE_NULLQ] += devstats->rxwbm_stats.err_src_reo_code_nullq;
+	stats->stats_wbm[NSS_STATS_WIFILI_WBM_SRC_REO_CODE_INV] += devstats->rxwbm_stats.err_src_reo_code_inv;
+	stats->stats_wbm[NSS_STATS_WIFILI_WBM_SRC_INV] += devstats->rxwbm_stats.err_src_invalid;
+	spin_unlock_bh(&nss_top->stats_lock);
 	return;
 }
 
@@ -74,7 +226,7 @@
 	 * Snoop messages for local driver and handle
 	 */
 	switch (ntm->cm.type) {
-	case NSS_WIFILI_PDEV_STATS_SYNC_MSG:
+	case NSS_WIFILI_STATS_MSG:
 		nss_wifili_stats_sync(nss_ctx, &ntm->msg.wlsoc_stats, ncm->interface);
 		break;
 	}
@@ -285,7 +437,7 @@
 	 */
 	nss_assert(if_num == NSS_WIFILI_INTERFACE);
 
-        nss_info("nss_register_wifili_if if_num %d wifictx %p", if_num, netdev);
+	nss_info("nss_register_wifili_if if_num %d wifictx %p", if_num, netdev);
 
 	nss_ctx->subsys_dp_register[if_num].ndev = netdev;
 	nss_ctx->subsys_dp_register[if_num].cb = wifili_callback;
@@ -335,7 +487,7 @@
 	 * The interface number shall be wifili radio dynamic interface
 	 */
 	nss_assert(nss_is_dynamic_interface(if_num));
-        nss_info("nss_register_wifili_if if_num %d wifictx %p", if_num, netdev);
+	nss_info("nss_register_wifili_if if_num %d wifictx %p", if_num, netdev);
 
 	nss_ctx->subsys_dp_register[if_num].ndev = netdev;
 	nss_ctx->subsys_dp_register[if_num].cb = wifili_callback;
@@ -372,7 +524,7 @@
  * nss_wifili_register_handler()
  *	Register handle for notfication messages received on wifi interface
  */
-void nss_wifili_register_handler(void )
+void nss_wifili_register_handler(void)
 {
 	nss_info("nss_wifili_register_handler");
 	nss_core_register_handler(NSS_WIFILI_INTERFACE, nss_wifili_handler, NULL);