summaryrefslogtreecommitdiffstats
path: root/include/net/page_pool.h
diff options
context:
space:
mode:
authorJoe Damato <jdamato@fastly.com>2022-03-01 23:55:49 -0800
committerDavid S. Miller <davem@davemloft.net>2022-03-03 09:55:28 +0000
commit6b95e3388b1ea0ca63500c5a6e39162dbf828433 (patch)
tree3d15476a44c79f2230e2467afa937193c64341b2 /include/net/page_pool.h
parentad6fa1e1ab1b8164f1ba296b1b4dc556a483bcad (diff)
downloadlinux-6b95e3388b1ea0ca63500c5a6e39162dbf828433.tar.bz2
page_pool: Add function to batch and return stats
Adds a function page_pool_get_stats which can be used by drivers to obtain stats for a specified page_pool. Signed-off-by: Joe Damato <jdamato@fastly.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/page_pool.h')
-rw-r--r--include/net/page_pool.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/page_pool.h b/include/net/page_pool.h
index 298af95bbf96..ea5fb70e5101 100644
--- a/include/net/page_pool.h
+++ b/include/net/page_pool.h
@@ -107,6 +107,23 @@ struct page_pool_recycle_stats {
* refcnt
*/
};
+
+/* This struct wraps the above stats structs so users of the
+ * page_pool_get_stats API can pass a single argument when requesting the
+ * stats for the page pool.
+ */
+struct page_pool_stats {
+ struct page_pool_alloc_stats alloc_stats;
+ struct page_pool_recycle_stats recycle_stats;
+};
+
+/*
+ * Drivers that wish to harvest page pool stats and report them to users
+ * (perhaps via ethtool, debugfs, or another mechanism) can allocate a
+ * struct page_pool_stats call page_pool_get_stats to get stats for the specified pool.
+ */
+bool page_pool_get_stats(struct page_pool *pool,
+ struct page_pool_stats *stats);
#endif
struct page_pool {