diff mbox series

[net-next,v7,4/4] mlx5: add support for page_pool_get_stats

Message ID 1645810914-35485-5-git-send-email-jdamato@fastly.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series page_pool: Add stats counters | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/cc_maintainers warning 3 maintainers not CCed: linux-rdma@vger.kernel.org leon@kernel.org saeedm@nvidia.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch warning WARNING: line length of 82 exceeds 80 columns WARNING: line length of 83 exceeds 80 columns WARNING: line length of 84 exceeds 80 columns WARNING: line length of 85 exceeds 80 columns WARNING: line length of 86 exceeds 80 columns WARNING: line length of 87 exceeds 80 columns WARNING: line length of 88 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Joe Damato Feb. 25, 2022, 5:41 p.m. UTC
This change adds support for the page_pool_get_stats API to mlx5. If the
user has enabled CONFIG_PAGE_POOL_STATS in their kernel, ethtool will
output page pool stats.

Signed-off-by: Joe Damato <jdamato@fastly.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 76 ++++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 27 +++++++-
 2 files changed, 102 insertions(+), 1 deletion(-)

Comments

Jesper Dangaard Brouer Feb. 28, 2022, 7:28 a.m. UTC | #1
On 25/02/2022 18.41, Joe Damato wrote:
> +#ifdef CONFIG_PAGE_POOL_STATS
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
> +	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
> +#endif

The naming: "page_pool_rec_xxx".
What does the "rec" stand for?

Users of ethtool -S stats... will they know "rec" is "recycle" ?

p.s. we need acks from driver maintainer(s).

--Jesper
Joe Damato Feb. 28, 2022, 8:38 a.m. UTC | #2
On Sun, Feb 27, 2022 at 11:28 PM Jesper Dangaard Brouer
<jbrouer@redhat.com> wrote:
>
>
>
> On 25/02/2022 18.41, Joe Damato wrote:
> > +#ifdef CONFIG_PAGE_POOL_STATS
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
> > +#endif
>
> The naming: "page_pool_rec_xxx".
> What does the "rec" stand for?

rec stands for recycle.

ethtool strings have a limited size (ETH_GSTRING_LEN - 32 bytes) and
the full word "recycle" didn't fit for some of the stats once the
queue number is prepended elsewhere in the driver code.

> Users of ethtool -S stats... will they know "rec" is "recycle" ?

I am open to other names or adding documentation to the driver docs to
explain the meaning.

> p.s. we need acks from driver maintainer(s).

I've CC'd Tariq and Saaed; I hope they'll take a look when they have a
chance and weigh in on the naming. I am happy to adjust the names as
they wish and submit a v8, or take this code as-is and then iterate on
the names in a separate change.

I think the latter option would be easiest, but I am happy to do
whatever you all prefer.

Thanks,
Joe
Toke Høiland-Jørgensen Feb. 28, 2022, 9:08 a.m. UTC | #3
Joe Damato <jdamato@fastly.com> writes:

> On Sun, Feb 27, 2022 at 11:28 PM Jesper Dangaard Brouer
> <jbrouer@redhat.com> wrote:
>>
>>
>>
>> On 25/02/2022 18.41, Joe Damato wrote:
>> > +#ifdef CONFIG_PAGE_POOL_STATS
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
>> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
>> > +#endif
>>
>> The naming: "page_pool_rec_xxx".
>> What does the "rec" stand for?
>
> rec stands for recycle.
>
> ethtool strings have a limited size (ETH_GSTRING_LEN - 32 bytes) and
> the full word "recycle" didn't fit for some of the stats once the
> queue number is prepended elsewhere in the driver code.
>
>> Users of ethtool -S stats... will they know "rec" is "recycle" ?
>
> I am open to other names or adding documentation to the driver docs to
> explain the meaning.

You could shorten the 'page_pool_' prefix to 'ppool_' or even 'pp_' and
gain some characters that way?

-Toke
Joe Damato March 1, 2022, 12:51 a.m. UTC | #4
On Mon, Feb 28, 2022 at 1:17 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Joe Damato <jdamato@fastly.com> writes:
>
> > On Sun, Feb 27, 2022 at 11:28 PM Jesper Dangaard Brouer
> > <jbrouer@redhat.com> wrote:
> >>
> >>
> >>
> >> On 25/02/2022 18.41, Joe Damato wrote:
> >> > +#ifdef CONFIG_PAGE_POOL_STATS
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
> >> > +#endif
> >>
> >> The naming: "page_pool_rec_xxx".
> >> What does the "rec" stand for?
> >
> > rec stands for recycle.
> >
> > ethtool strings have a limited size (ETH_GSTRING_LEN - 32 bytes) and
> > the full word "recycle" didn't fit for some of the stats once the
> > queue number is prepended elsewhere in the driver code.
> >
> >> Users of ethtool -S stats... will they know "rec" is "recycle" ?
> >
> > I am open to other names or adding documentation to the driver docs to
> > explain the meaning.
>
> You could shorten the 'page_pool_' prefix to 'ppool_' or even 'pp_' and
> gain some characters that way?

I had considered this, but I thought that 'pp' was possibly as terse as 'rec'.

If you all think these are more clear, I can send a v8 of this series
that changes the strings from the above to this instead:

rx_pp_alloc_fast
rx_pp_alloc_slow
rx_pp_alloc_...

and

rx_pp_recyle_cached
rx_pp_recycle_cache_full
rx_pp_recycle_...

With this name scheme, it looks like all the stat names seem to fit. I
have no idea if this is more or less clear to the user though :)

I'll leave it up to the mlx5 maintainers; I am happy to do whatever
they prefer to get this series in.

Thanks,
Joe
Toke Høiland-Jørgensen March 1, 2022, 11:23 a.m. UTC | #5
Joe Damato <jdamato@fastly.com> writes:

> On Mon, Feb 28, 2022 at 1:17 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>>
>> Joe Damato <jdamato@fastly.com> writes:
>>
>> > On Sun, Feb 27, 2022 at 11:28 PM Jesper Dangaard Brouer
>> > <jbrouer@redhat.com> wrote:
>> >>
>> >>
>> >>
>> >> On 25/02/2022 18.41, Joe Damato wrote:
>> >> > +#ifdef CONFIG_PAGE_POOL_STATS
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
>> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
>> >> > +#endif
>> >>
>> >> The naming: "page_pool_rec_xxx".
>> >> What does the "rec" stand for?
>> >
>> > rec stands for recycle.
>> >
>> > ethtool strings have a limited size (ETH_GSTRING_LEN - 32 bytes) and
>> > the full word "recycle" didn't fit for some of the stats once the
>> > queue number is prepended elsewhere in the driver code.
>> >
>> >> Users of ethtool -S stats... will they know "rec" is "recycle" ?
>> >
>> > I am open to other names or adding documentation to the driver docs to
>> > explain the meaning.
>>
>> You could shorten the 'page_pool_' prefix to 'ppool_' or even 'pp_' and
>> gain some characters that way?
>
> I had considered this, but I thought that 'pp' was possibly as terse as 'rec'.
>
> If you all think these are more clear, I can send a v8 of this series
> that changes the strings from the above to this instead:
>
> rx_pp_alloc_fast
> rx_pp_alloc_slow
> rx_pp_alloc_...
>
> and
>
> rx_pp_recyle_cached
> rx_pp_recycle_cache_full
> rx_pp_recycle_...
>
> With this name scheme, it looks like all the stat names seem to fit. I
> have no idea if this is more or less clear to the user though :)

My thinking was that at least 'pp_' is obviously opaque, so it will be
clear to readers that if they don't know what it is they have to look it
up. Whereas 'rec_' looks like it could be 'record' or something like
that, and it'll make people guess (wrongly).

> I'll leave it up to the mlx5 maintainers; I am happy to do whatever
> they prefer to get this series in.

Right, but this is also going to create precedence for other drivers
that add the page pool-based stats, so spending a bit of time agreeing
on the colour of the bikeshed may be worthwhile here... :)

-Toke
Joe Damato March 1, 2022, 5 p.m. UTC | #6
On Tue, Mar 1, 2022 at 3:23 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Joe Damato <jdamato@fastly.com> writes:
>
> > On Mon, Feb 28, 2022 at 1:17 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> >>
> >> Joe Damato <jdamato@fastly.com> writes:
> >>
> >> > On Sun, Feb 27, 2022 at 11:28 PM Jesper Dangaard Brouer
> >> > <jbrouer@redhat.com> wrote:
> >> >>
> >> >>
> >> >>
> >> >> On 25/02/2022 18.41, Joe Damato wrote:
> >> >> > +#ifdef CONFIG_PAGE_POOL_STATS
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
> >> >> > +     { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
> >> >> > +#endif
> >> >>
> >> >> The naming: "page_pool_rec_xxx".
> >> >> What does the "rec" stand for?
> >> >
> >> > rec stands for recycle.
> >> >
> >> > ethtool strings have a limited size (ETH_GSTRING_LEN - 32 bytes) and
> >> > the full word "recycle" didn't fit for some of the stats once the
> >> > queue number is prepended elsewhere in the driver code.
> >> >
> >> >> Users of ethtool -S stats... will they know "rec" is "recycle" ?
> >> >
> >> > I am open to other names or adding documentation to the driver docs to
> >> > explain the meaning.
> >>
> >> You could shorten the 'page_pool_' prefix to 'ppool_' or even 'pp_' and
> >> gain some characters that way?
> >
> > I had considered this, but I thought that 'pp' was possibly as terse as 'rec'.
> >
> > If you all think these are more clear, I can send a v8 of this series
> > that changes the strings from the above to this instead:
> >
> > rx_pp_alloc_fast
> > rx_pp_alloc_slow
> > rx_pp_alloc_...
> >
> > and
> >
> > rx_pp_recyle_cached
> > rx_pp_recycle_cache_full
> > rx_pp_recycle_...
> >
> > With this name scheme, it looks like all the stat names seem to fit. I
> > have no idea if this is more or less clear to the user though :)
>
> My thinking was that at least 'pp_' is obviously opaque, so it will be
> clear to readers that if they don't know what it is they have to look it
> up. Whereas 'rec_' looks like it could be 'record' or something like
> that, and it'll make people guess (wrongly).

Fair enough.

> > I'll leave it up to the mlx5 maintainers; I am happy to do whatever
> > they prefer to get this series in.
>
> Right, but this is also going to create precedence for other drivers
> that add the page pool-based stats, so spending a bit of time agreeing
> on the colour of the bikeshed may be worthwhile here... :)

Sure, that's fine with me.

I'll give it a few days - hoping to hear back from the mellanox folks
on what they prefer before submitting a v8 with the changes I
mentioned above.

My goal is to avoid a few extra rounds of back and forth if possible :)

Thanks,
Joe
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
index 3e5d8c7..56eedf5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
@@ -37,6 +37,10 @@ 
 #include "en/ptp.h"
 #include "en/port.h"
 
+#ifdef CONFIG_PAGE_POOL_STATS
+#include <net/page_pool.h>
+#endif
+
 static unsigned int stats_grps_num(struct mlx5e_priv *priv)
 {
 	return !priv->profile->stats_grps_num ? 0 :
@@ -183,6 +187,19 @@  static const struct counter_desc sw_stats_desc[] = {
 	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_congst_umr) },
 	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_err) },
 	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_recover) },
+#ifdef CONFIG_PAGE_POOL_STATS
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_fast) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_slow) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_slow_high_order) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_empty) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_refill) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_waive) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_rec_cached) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_rec_cache_full) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_rec_ring) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_rec_ring_full) },
+	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_page_pool_rec_released_ref) },
+#endif
 #ifdef CONFIG_MLX5_EN_TLS
 	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_packets) },
 	{ MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_bytes) },
@@ -349,6 +366,20 @@  static void mlx5e_stats_grp_sw_update_stats_rq_stats(struct mlx5e_sw_stats *s,
 	s->rx_congst_umr              += rq_stats->congst_umr;
 	s->rx_arfs_err                += rq_stats->arfs_err;
 	s->rx_recover                 += rq_stats->recover;
+#ifdef CONFIG_PAGE_POOL_STATS
+	s->rx_page_pool_fast          += rq_stats->page_pool_fast;
+	s->rx_page_pool_slow          += rq_stats->page_pool_slow;
+	s->rx_page_pool_empty         += rq_stats->page_pool_empty;
+	s->rx_page_pool_refill        += rq_stats->page_pool_refill;
+	s->rx_page_pool_waive         += rq_stats->page_pool_waive;
+
+	s->rx_page_pool_slow_high_order		+= rq_stats->page_pool_slow_high_order;
+	s->rx_page_pool_rec_cached		+= rq_stats->page_pool_rec_cached;
+	s->rx_page_pool_rec_cache_full		+= rq_stats->page_pool_rec_cache_full;
+	s->rx_page_pool_rec_ring		+= rq_stats->page_pool_rec_ring;
+	s->rx_page_pool_rec_ring_full		+= rq_stats->page_pool_rec_ring_full;
+	s->rx_page_pool_rec_released_ref	+= rq_stats->page_pool_rec_released_ref;
+#endif
 #ifdef CONFIG_MLX5_EN_TLS
 	s->rx_tls_decrypted_packets   += rq_stats->tls_decrypted_packets;
 	s->rx_tls_decrypted_bytes     += rq_stats->tls_decrypted_bytes;
@@ -455,6 +486,35 @@  static void mlx5e_stats_grp_sw_update_stats_qos(struct mlx5e_priv *priv,
 	}
 }
 
+#ifdef CONFIG_PAGE_POOL_STATS
+static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
+{
+	struct mlx5e_rq_stats *rq_stats = c->rq.stats;
+	struct page_pool *pool = c->rq.page_pool;
+	struct page_pool_stats stats = { 0 };
+
+	if (!page_pool_get_stats(pool, &stats))
+		return;
+
+	rq_stats->page_pool_fast = stats.alloc_stats.fast;
+	rq_stats->page_pool_slow = stats.alloc_stats.slow;
+	rq_stats->page_pool_slow_high_order = stats.alloc_stats.slow_high_order;
+	rq_stats->page_pool_empty = stats.alloc_stats.empty;
+	rq_stats->page_pool_waive = stats.alloc_stats.waive;
+	rq_stats->page_pool_refill = stats.alloc_stats.refill;
+
+	rq_stats->page_pool_rec_cached = stats.recycle_stats.cached;
+	rq_stats->page_pool_rec_cache_full = stats.recycle_stats.cache_full;
+	rq_stats->page_pool_rec_ring = stats.recycle_stats.ring;
+	rq_stats->page_pool_rec_ring_full = stats.recycle_stats.ring_full;
+	rq_stats->page_pool_rec_released_ref = stats.recycle_stats.released_refcnt;
+}
+#else
+static void mlx5e_stats_update_stats_rq_page_pool(struct mlx5e_channel *c)
+{
+}
+#endif
+
 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(sw)
 {
 	struct mlx5e_sw_stats *s = &priv->stats.sw;
@@ -465,8 +525,11 @@  static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(sw)
 	for (i = 0; i < priv->stats_nch; i++) {
 		struct mlx5e_channel_stats *channel_stats =
 			priv->channel_stats[i];
+
 		int j;
 
+		mlx5e_stats_update_stats_rq_page_pool(priv->channels.c[i]);
+
 		mlx5e_stats_grp_sw_update_stats_rq_stats(s, &channel_stats->rq);
 		mlx5e_stats_grp_sw_update_stats_xdpsq(s, &channel_stats->rq_xdpsq);
 		mlx5e_stats_grp_sw_update_stats_ch_stats(s, &channel_stats->ch);
@@ -1887,6 +1950,19 @@  static const struct counter_desc rq_stats_desc[] = {
 	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, congst_umr) },
 	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_err) },
 	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, recover) },
+#ifdef CONFIG_PAGE_POOL_STATS
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_fast) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_slow_high_order) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_empty) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_refill) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_waive) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cached) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_cache_full) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_ring_full) },
+	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, page_pool_rec_released_ref) },
+#endif
 #ifdef CONFIG_MLX5_EN_TLS
 	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_packets) },
 	{ MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_bytes) },
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
index 14eaf92..9f66425 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
@@ -205,7 +205,19 @@  struct mlx5e_sw_stats {
 	u64 ch_aff_change;
 	u64 ch_force_irq;
 	u64 ch_eq_rearm;
-
+#ifdef CONFIG_PAGE_POOL_STATS
+	u64 rx_page_pool_fast;
+	u64 rx_page_pool_slow;
+	u64 rx_page_pool_slow_high_order;
+	u64 rx_page_pool_empty;
+	u64 rx_page_pool_refill;
+	u64 rx_page_pool_waive;
+	u64 rx_page_pool_rec_cached;
+	u64 rx_page_pool_rec_cache_full;
+	u64 rx_page_pool_rec_ring;
+	u64 rx_page_pool_rec_ring_full;
+	u64 rx_page_pool_rec_released_ref;
+#endif
 #ifdef CONFIG_MLX5_EN_TLS
 	u64 tx_tls_encrypted_packets;
 	u64 tx_tls_encrypted_bytes;
@@ -352,6 +364,19 @@  struct mlx5e_rq_stats {
 	u64 congst_umr;
 	u64 arfs_err;
 	u64 recover;
+#ifdef CONFIG_PAGE_POOL_STATS
+	u64 page_pool_fast;
+	u64 page_pool_slow;
+	u64 page_pool_slow_high_order;
+	u64 page_pool_empty;
+	u64 page_pool_refill;
+	u64 page_pool_waive;
+	u64 page_pool_rec_cached;
+	u64 page_pool_rec_cache_full;
+	u64 page_pool_rec_ring;
+	u64 page_pool_rec_ring_full;
+	u64 page_pool_rec_released_ref;
+#endif
 #ifdef CONFIG_MLX5_EN_TLS
 	u64 tls_decrypted_packets;
 	u64 tls_decrypted_bytes;