[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1643499540-8351-4-git-send-email-jdamato@fastly.com>
Date: Sat, 29 Jan 2022 15:38:53 -0800
From: Joe Damato <jdamato@...tly.com>
To: netdev@...r.kernel.org, kuba@...nel.org,
ilias.apalodimas@...aro.org, davem@...emloft.net, hawk@...nel.org
Cc: Joe Damato <jdamato@...tly.com>
Subject: [net-next v2 03/10] page_pool: Add a macro for incrementing stats
Add simple wrapper macro for incrementing page pool stats. This wrapper is
intended to be used in softirq context.
Signed-off-by: Joe Damato <jdamato@...tly.com>
---
net/core/page_pool.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 7e33590..b1a2599 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -29,6 +29,15 @@
#ifdef CONFIG_PAGE_POOL_STATS
DEFINE_PER_CPU_ALIGNED(struct page_pool_stats, page_pool_stats);
EXPORT_PER_CPU_SYMBOL(page_pool_stats);
+
+#define page_pool_stat_alloc_inc(__stat) \
+ do { \
+ struct page_pool_stats *pps = this_cpu_ptr(&page_pool_stats); \
+ pps->alloc.__stat++; \
+ } while (0)
+
+#else
+#define page_pool_stat_alloc_inc(stat)
#endif
static int page_pool_init(struct page_pool *pool,
--
2.7.4
Powered by blists - more mailing lists