public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: mana: Expose page_pool stats via ethtool
@ 2026-02-27  9:39 Dipayaan Roy
  2026-02-27 15:11 ` Andrew Lunn
  2026-02-27 17:27 ` Jakub Kicinski
  0 siblings, 2 replies; 4+ messages in thread
From: Dipayaan Roy @ 2026-02-27  9:39 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
	kuba, pabeni, leon, longli, kotaranov, horms, shradhagupta,
	ssengar, ernis, shirazsaleem, linux-hyperv, netdev, linux-kernel,
	linux-rdma, dipayanroy

MANA relies on page_pool for RX buffers, and the buffer refill paths
can behave quite differently across architectures and configurations (e.g.
base page size, fragment vs full-page usage). This makes it harder to
understand and compare RX buffer behavior when investigating performance
and memory differences across platforms.

Wire up the generic page_pool ethtool stats helpers and report
page_pool allocation/recycle statistics via ethtool -S when
CONFIG_PAGE_POOL_STATS is enabled. The counters are exposed with the
standard "rx_pp_*" names, for example:

  rx_pp_alloc_fast
  rx_pp_alloc_slow
  rx_pp_alloc_slow_ho
  rx_pp_alloc_empty
  rx_pp_alloc_refill
  rx_pp_alloc_waive
  rx_pp_recycle_cached
  rx_pp_recycle_cache_full
  rx_pp_recycle_ring
  rx_pp_recycle_ring_full
  rx_pp_recycle_released_ref

Signed-off-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
---
 .../ethernet/microsoft/mana/mana_ethtool.c    | 30 +++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
index f2d220b371b5..8fec74cdd3c3 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
@@ -6,6 +6,7 @@
 #include <linux/ethtool.h>
 
 #include <net/mana/mana.h>
+#include <net/page_pool/helpers.h>
 
 struct mana_stats_desc {
 	char name[ETH_GSTRING_LEN];
@@ -143,8 +144,10 @@ static int mana_get_sset_count(struct net_device *ndev, int stringset)
 	if (stringset != ETH_SS_STATS)
 		return -EINVAL;
 
-	return ARRAY_SIZE(mana_eth_stats) + ARRAY_SIZE(mana_phy_stats) + ARRAY_SIZE(mana_hc_stats) +
-			num_queues * (MANA_STATS_RX_COUNT + MANA_STATS_TX_COUNT);
+	return  ARRAY_SIZE(mana_eth_stats) + ARRAY_SIZE(mana_phy_stats) +
+		ARRAY_SIZE(mana_hc_stats) +
+		num_queues * (MANA_STATS_RX_COUNT + MANA_STATS_TX_COUNT) +
+		page_pool_ethtool_stats_get_count();
 }
 
 static void mana_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
@@ -185,6 +188,27 @@ static void mana_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
 		ethtool_sprintf(&data, "tx_%d_csum_partial", i);
 		ethtool_sprintf(&data, "tx_%d_mana_map_err", i);
 	}
+
+	page_pool_ethtool_stats_get_strings(data);
+}
+
+static void mana_get_page_pool_stats(struct net_device *ndev, u64 *data)
+{
+#ifdef CONFIG_PAGE_POOL_STATS
+	struct mana_port_context *apc = netdev_priv(ndev);
+	unsigned int num_queues = apc->num_queues;
+	struct page_pool_stats pp_stats = {};
+	int q;
+
+	for (q = 0; q < num_queues; q++) {
+		if (!apc->rxqs[q] || !apc->rxqs[q]->page_pool)
+			continue;
+
+		page_pool_get_stats(apc->rxqs[q]->page_pool, &pp_stats);
+	}
+
+	page_pool_ethtool_stats_get(data, &pp_stats);
+#endif /* CONFIG_PAGE_POOL_STATS */
 }
 
 static void mana_get_ethtool_stats(struct net_device *ndev,
@@ -280,6 +304,8 @@ static void mana_get_ethtool_stats(struct net_device *ndev,
 		data[i++] = csum_partial;
 		data[i++] = mana_map_err;
 	}
+
+	mana_get_page_pool_stats(ndev, &data[i]);
 }
 
 static u32 mana_get_rx_ring_count(struct net_device *ndev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: mana: Expose page_pool stats via ethtool
  2026-02-27  9:39 [PATCH net-next] net: mana: Expose page_pool stats via ethtool Dipayaan Roy
@ 2026-02-27 15:11 ` Andrew Lunn
  2026-02-27 17:27 ` Jakub Kicinski
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-02-27 15:11 UTC (permalink / raw)
  To: Dipayaan Roy
  Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
	kuba, pabeni, leon, longli, kotaranov, horms, shradhagupta,
	ssengar, ernis, shirazsaleem, linux-hyperv, netdev, linux-kernel,
	linux-rdma, dipayanroy

> +static void mana_get_page_pool_stats(struct net_device *ndev, u64 *data)
> +{
> +#ifdef CONFIG_PAGE_POOL_STATS
> +	struct mana_port_context *apc = netdev_priv(ndev);
> +	unsigned int num_queues = apc->num_queues;
> +	struct page_pool_stats pp_stats = {};
> +	int q;
> +
> +	for (q = 0; q < num_queues; q++) {
> +		if (!apc->rxqs[q] || !apc->rxqs[q]->page_pool)
> +			continue;
> +
> +		page_pool_get_stats(apc->rxqs[q]->page_pool, &pp_stats);
> +	}
> +
> +	page_pool_ethtool_stats_get(data, &pp_stats);
> +#endif /* CONFIG_PAGE_POOL_STATS */

You should not need this #ifdef. The stubs should make the code do
sensible things if CONFIG_PAGE_POOL_STATS is not enabled.

	 Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: mana: Expose page_pool stats via ethtool
  2026-02-27  9:39 [PATCH net-next] net: mana: Expose page_pool stats via ethtool Dipayaan Roy
  2026-02-27 15:11 ` Andrew Lunn
@ 2026-02-27 17:27 ` Jakub Kicinski
  2026-03-11 19:47   ` Dipayaan Roy
  1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2026-02-27 17:27 UTC (permalink / raw)
  To: Dipayaan Roy
  Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
	pabeni, leon, longli, kotaranov, horms, shradhagupta, ssengar,
	ernis, shirazsaleem, linux-hyperv, netdev, linux-kernel,
	linux-rdma, dipayanroy

On Fri, 27 Feb 2026 01:39:18 -0800 Dipayaan Roy wrote:
> MANA relies on page_pool for RX buffers, and the buffer refill paths
> can behave quite differently across architectures and configurations (e.g.
> base page size, fragment vs full-page usage). This makes it harder to
> understand and compare RX buffer behavior when investigating performance
> and memory differences across platforms.

Standard stats must not be duplicated in ethtool -S.
ynl and ynltool provide easy access to these stats

# ynltool page-pool stats 
    eth0[2]	page pools: 44 (zombies: 0)
		refs: 495680 bytes: 2030305280 (refs: 0 bytes: 0)
		recycling: 100.0% (alloc: 7745:2097593009 recycle: 379301630:1717888312)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: mana: Expose page_pool stats via ethtool
  2026-02-27 17:27 ` Jakub Kicinski
@ 2026-03-11 19:47   ` Dipayaan Roy
  0 siblings, 0 replies; 4+ messages in thread
From: Dipayaan Roy @ 2026-03-11 19:47 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: kys, haiyangz, wei.liu, decui, andrew+netdev, davem, edumazet,
	pabeni, leon, longli, kotaranov, horms, shradhagupta, ssengar,
	ernis, shirazsaleem, linux-hyperv, netdev, linux-kernel,
	linux-rdma, dipayanroy

On Fri, Feb 27, 2026 at 09:27:22AM -0800, Jakub Kicinski wrote:
> On Fri, 27 Feb 2026 01:39:18 -0800 Dipayaan Roy wrote:
> > MANA relies on page_pool for RX buffers, and the buffer refill paths
> > can behave quite differently across architectures and configurations (e.g.
> > base page size, fragment vs full-page usage). This makes it harder to
> > understand and compare RX buffer behavior when investigating performance
> > and memory differences across platforms.
> 
> Standard stats must not be duplicated in ethtool -S.
> ynl and ynltool provide easy access to these stats
> 
> # ynltool page-pool stats 
>     eth0[2]	page pools: 44 (zombies: 0)
> 		refs: 495680 bytes: 2030305280 (refs: 0 bytes: 0)
> 		recycling: 100.0% (alloc: 7745:2097593009 recycle: 379301630:1717888312)

Thanks Jakub for the feedback, and understood the generic page pool
stats should be combined with ethtool -S. I will drop this patch
and use ynltool page-pool stats.


Regards



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-11 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27  9:39 [PATCH net-next] net: mana: Expose page_pool stats via ethtool Dipayaan Roy
2026-02-27 15:11 ` Andrew Lunn
2026-02-27 17:27 ` Jakub Kicinski
2026-03-11 19:47   ` Dipayaan Roy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox