]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: make page_pool_get_stats() void
authorJakub Kicinski <kuba@kernel.org>
Tue, 26 May 2026 15:57:22 +0000 (08:57 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 29 May 2026 01:10:03 +0000 (18:10 -0700)
The kdoc for page_pool_get_stats() is missing a Returns: statement.
Looking at this function, I have no idea what is the purpose of
the bool it returns. My guess was that maybe the static inline
stub returns false if CONFIG_PAGE_POOL_STATS=n but such static
inline helper doesn't exist at all. All callers pass a pointer
to a struct on the stack. Make this function void.

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260526155722.2790742-5-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
include/net/page_pool/helpers.h
net/core/page_pool.c
net/core/page_pool_user.c

index 1a3ecf073913ca9c76053c9ef51f95e3cae773bc..7f33261ba6553bb70d908c1b96b1eef4055d6a26 100644 (file)
@@ -496,8 +496,7 @@ static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
        struct page_pool *pool = c->rq.page_pool;
        struct page_pool_stats stats = { 0 };
 
-       if (!page_pool_get_stats(pool, &stats))
-               return;
+       page_pool_get_stats(pool, &stats);
 
        rq_stats->pp_alloc_fast = stats.alloc_stats.fast;
        rq_stats->pp_alloc_slow = stats.alloc_stats.slow;
index 3247026e096abe5d909e69ee3da1254de4250a98..e2730dd273b2843b790811d1a6a5f5acd68d3ad3 100644 (file)
@@ -64,7 +64,7 @@ int page_pool_ethtool_stats_get_count(void);
 u8 *page_pool_ethtool_stats_get_strings(u8 *data);
 u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats);
 
-bool page_pool_get_stats(const struct page_pool *pool,
+void page_pool_get_stats(const struct page_pool *pool,
                         struct page_pool_stats *stats);
 #else
 static inline int page_pool_ethtool_stats_get_count(void)
index 7798726f5a3e0ffbf5e75847ac150fce3bc5028b..21dc4a9c8714df15165fae9920950293443f70ad 100644 (file)
@@ -85,14 +85,11 @@ static const char pp_stats[][ETH_GSTRING_LEN] = {
  * is passed to this API which is filled in. The caller can then report
  * those stats to the user (perhaps via ethtool, debugfs, etc.).
  */
-bool page_pool_get_stats(const struct page_pool *pool,
+void page_pool_get_stats(const struct page_pool *pool,
                         struct page_pool_stats *stats)
 {
        int cpu = 0;
 
-       if (!stats)
-               return false;
-
        /* The caller is responsible to initialize stats. */
        stats->alloc_stats.fast += pool->alloc_stats.fast;
        stats->alloc_stats.slow += pool->alloc_stats.slow;
@@ -111,8 +108,6 @@ bool page_pool_get_stats(const struct page_pool *pool,
                stats->recycle_stats.ring_full += pcpu->ring_full;
                stats->recycle_stats.released_refcnt += pcpu->released_refcnt;
        }
-
-       return true;
 }
 EXPORT_SYMBOL(page_pool_get_stats);
 
index 1cdef13e6cead19df87de5bb3e4098c42c3fbf46..ef4261c0e8eaf4e20ee4d7a872a657c025ba3670 100644 (file)
@@ -127,8 +127,7 @@ page_pool_nl_stats_fill(struct sk_buff *rsp, const struct page_pool *pool,
        struct nlattr *nest;
        void *hdr;
 
-       if (!page_pool_get_stats(pool, &stats))
-               return 0;
+       page_pool_get_stats(pool, &stats);
 
        hdr = genlmsg_iput(rsp, info);
        if (!hdr)