[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_ipsec.c b/nss_ipsec.c
index 29591a9..fb2c7d3 100644
--- a/nss_ipsec.c
+++ b/nss_ipsec.c
@@ -201,9 +201,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_ipsec_warning("%p: tx rule dropped as command allocation failed", nss_ctx);
return NSS_TX_FAILURE;
}