An empty struct page_pool_stats allows to always add it to structs and pass it to functions like page_pool_ethtool_stats_get() without the need for an ifdef. Provide an empty struct page_pool_stats and page_pool_get_stats() for !CONFIG_PAGE_POOL_STATS builds. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- include/net/page_pool/helpers.h | 6 ++++++ include/net/page_pool/types.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h index 582a3d00cbe23..4622db90f88f2 100644 --- a/include/net/page_pool/helpers.h +++ b/include/net/page_pool/helpers.h @@ -81,6 +81,12 @@ static inline u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats) { return data; } + +static inline bool page_pool_get_stats(const struct page_pool *pool, + struct page_pool_stats *stats) +{ + return false; +} #endif /** diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h index 7f405672b089d..6d55e6cf5d0db 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -140,6 +140,10 @@ struct page_pool_stats { struct page_pool_alloc_stats alloc_stats; struct page_pool_recycle_stats recycle_stats; }; + +#else /* !CONFIG_PAGE_POOL_STATS */ + +struct page_pool_stats { }; #endif /* The whole frag API block must stay within one cacheline. On 32-bit systems, -- 2.47.2