90f307772a38e96d00b3d3bfd42cd9d4d68f8fad
[openwrt/staging/blocktrron.git] /
1 commit 590032a4d2133ecc10d3078a8db1d85a4842f12c
2 Author: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Mon Apr 11 16:05:26 2022 +0200
4
5 page_pool: Add recycle stats to page_pool_put_page_bulk
6
7 Add missing recycle stats to page_pool_put_page_bulk routine.
8
9 Reviewed-by: Joe Damato <jdamato@fastly.com>
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 Link: https://lore.kernel.org/r/3712178b51c007cfaed910ea80e68f00c916b1fa.1649685634.git.lorenzo@kernel.org
13 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
14
15 --- a/net/core/page_pool.c
16 +++ b/net/core/page_pool.c
17 @@ -36,6 +36,12 @@
18 this_cpu_inc(s->__stat); \
19 } while (0)
20
21 +#define recycle_stat_add(pool, __stat, val) \
22 + do { \
23 + struct page_pool_recycle_stats __percpu *s = pool->recycle_stats; \
24 + this_cpu_add(s->__stat, val); \
25 + } while (0)
26 +
27 bool page_pool_get_stats(struct page_pool *pool,
28 struct page_pool_stats *stats)
29 {
30 @@ -63,6 +69,7 @@ EXPORT_SYMBOL(page_pool_get_stats);
31 #else
32 #define alloc_stat_inc(pool, __stat)
33 #define recycle_stat_inc(pool, __stat)
34 +#define recycle_stat_add(pool, __stat, val)
35 #endif
36
37 static int page_pool_init(struct page_pool *pool,
38 @@ -569,9 +576,13 @@ void page_pool_put_page_bulk(struct page
39 /* Bulk producer into ptr_ring page_pool cache */
40 page_pool_ring_lock(pool);
41 for (i = 0; i < bulk_len; i++) {
42 - if (__ptr_ring_produce(&pool->ring, data[i]))
43 - break; /* ring full */
44 + if (__ptr_ring_produce(&pool->ring, data[i])) {
45 + /* ring full */
46 + recycle_stat_inc(pool, ring_full);
47 + break;
48 + }
49 }
50 + recycle_stat_add(pool, ring, i);
51 page_pool_ring_unlock(pool);
52
53 /* Hopefully all pages was return into ptr_ring */