The mlx5 driver supports per-channel statistics. To make support generic it is required to have a template to fill the individual channel/ queue. Provide page_pool_ethtool_stats_get_strings_mq() to fill the strings for multiple queue. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- include/net/page_pool/helpers.h | 5 +++++ net/core/page_pool.c | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h index 4622db90f88f2..a815b0ff97448 100644 --- a/include/net/page_pool/helpers.h +++ b/include/net/page_pool/helpers.h @@ -62,6 +62,7 @@ /* Deprecated driver-facing API, use netlink instead */ int page_pool_ethtool_stats_get_count(void); u8 *page_pool_ethtool_stats_get_strings(u8 *data); +void page_pool_ethtool_stats_get_strings_mq(u8 **data, unsigned int queue); u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats); bool page_pool_get_stats(const struct page_pool *pool, @@ -77,6 +78,10 @@ static inline u8 *page_pool_ethtool_stats_get_strings(u8 *data) return data; } +static inline void page_pool_ethtool_stats_get_strings_mq(u8 **data, unsigned int queue) +{ +} + static inline u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats) { return data; diff --git a/net/core/page_pool.c b/net/core/page_pool.c index f5e908c9e7ad8..2290d80443d1e 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -68,6 +68,20 @@ static const char pp_stats[][ETH_GSTRING_LEN] = { "rx_pp_recycle_released_ref", }; +static const char pp_stats_mq[][ETH_GSTRING_LEN] = { + "rx%d_pp_alloc_fast", + "rx%d_pp_alloc_slow", + "rx%d_pp_alloc_slow_ho", + "rx%d_pp_alloc_empty", + "rx%d_pp_alloc_refill", + "rx%d_pp_alloc_waive", + "rx%d_pp_recycle_cached", + "rx%d_pp_recycle_cache_full", + "rx%d_pp_recycle_ring", + "rx%d_pp_recycle_ring_full", + "rx%d_pp_recycle_released_ref", +}; + /** * page_pool_get_stats() - fetch page pool stats * @pool: pool from which page was allocated @@ -123,6 +137,15 @@ u8 *page_pool_ethtool_stats_get_strings(u8 *data) } EXPORT_SYMBOL(page_pool_ethtool_stats_get_strings); +void page_pool_ethtool_stats_get_strings_mq(u8 **data, unsigned int queue) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(pp_stats_mq); i++) + ethtool_sprintf(data, pp_stats_mq[i], queue); +} +EXPORT_SYMBOL(page_pool_ethtool_stats_get_strings_mq); + int page_pool_ethtool_stats_get_count(void) { return ARRAY_SIZE(pp_stats); -- 2.47.2