[qca-nss-drv] stats_drv: Replace spinlocks with atomic operations
When reading or updating stats_drv, we can use atomic operations
instead of spinlocks as it improves performance on the slow path.
Change-Id: I246e3cc965780b631aac72e2ae0cfba845601bac
Signed-off-by: Sundarajan Srinivasan <sundaraj@codeaurora.org>
diff --git a/nss_pppoe.c b/nss_pppoe.c
index 64b4f98..1313182 100644
--- a/nss_pppoe.c
+++ b/nss_pppoe.c
@@ -60,9 +60,7 @@
nbuf = dev_alloc_skb(NSS_NBUF_PAYLOAD_SIZE);
if (unlikely(!nbuf)) {
- spin_lock_bh(&nss_ctx->nss_top->stats_lock);
- nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]++;
- spin_unlock_bh(&nss_ctx->nss_top->stats_lock);
+ NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]);
nss_warning("%p: msg dropped as command allocation failed", nss_ctx);
return NSS_TX_FAILURE;
}