Skip to contentSkip to conversation

net: bcmgenet: convert RX path to page_pool

PATCH Superseded Nicolai Buchwitz 3 participants 6 messages Jun 2 – Jun 4

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nicolai Buchwitz

author maintainer
#0 lore raw

PATCH 1/1 net: bcmgenet: convert RX path to page_pool

Replace the per-packet __netdev_alloc_skb() + dma_map_single() in the RX path with page_pool. SKBs are built from pool pages via napi_build_skb() with skb_mark_for_recycle() so the network stack returns pages to the pool, and DMA mapping happens once per page instead of once per packet.

Reject HW-reported lengths smaller than RSB + minimum Ethernet frame (+ FCS if crc_fwd_en) so a runt cannot underflow the SKB build path.

Drop the now-unused priv->rx_buf_len field and the rx_dma_failed soft MIB counter (nothing increments it after the conversion).

---
This is the page_pool conversion patch from my bcmgenet XDP series [1], pulled out as a standalone submission. The XDP series has had several review rounds, and page_pool is the part that has taken the most discussion. Getting it in on its own should hopefully make the rest of the XDP work easier to review later, and it is also the API new RX paths are expected to use anyway.

Tested on a Raspberry Pi CM4 (BCM2711, 1 Gbps). Ran the benchmarks at the default 1.5 GHz and again with the CPU pinned to 600 MHz to push the RX path harder. No regressions either way.

[1] https://lore.kernel.org/netdev/[email protected]/

 drivers/net/ethernet/broadcom/Kconfig         |   1 +
 .../net/ethernet/broadcom/genet/bcmgenet.c    | 229 +++++++++++-------
 .../net/ethernet/broadcom/genet/bcmgenet.h    |   6 +-
 3 files changed, 150 insertions(+), 86 deletions(-)
drivers/net/ethernet/broadcom/Kconfig +1 -0
index 4287edc7ddd6..f0bac0dd1439 100644
@@ -78,6 +78,7 @@ config BCMGENET
 	select BCM7XXX_PHY
 	select MDIO_BCM_UNIMAC
 	select DIMLIB
+	select PAGE_POOL
 	select BROADCOM_PHY if ARCH_BCM2835
 	help
 	  This driver supports the built-in Ethernet MACs found in the
drivers/net/ethernet/broadcom/genet/bcmgenet.c +145 -84

382 lines not on this page · raw message

drivers/net/ethernet/broadcom/genet/bcmgenet.h +4 -2
index 9e4110c7fdf6..41ceda21c6f3 100644
@@ -15,6 +15,7 @@
 #include <linux/phy.h>
 #include <linux/dim.h>
 #include <linux/ethtool.h>
+#include <net/page_pool/helpers.h>
 
 #include "../unimac.h"
 
@@ -149,7 +150,6 @@ struct bcmgenet_mib_counters {
 	u32	rbuf_err_cnt;
 	u32	mdf_err_cnt;
 	u32	alloc_rx_buff_failed;
-	u32	rx_dma_failed;
 	u32	tx_dma_failed;
 	u32	tx_realloc_tsb;
 	u32	tx_realloc_tsb_failed;
@@ -469,6 +469,8 @@ struct bcmgenet_rx_stats64 {
 
 struct enet_cb {
 	struct sk_buff      *skb;
+	struct page         *rx_page;
+	unsigned int        rx_page_offset;
 	void __iomem *bd_addr;
 	DEFINE_DMA_UNMAP_ADDR(dma_addr);
 	DEFINE_DMA_UNMAP_LEN(dma_len);
@@ -575,6 +577,7 @@ struct bcmgenet_rx_ring {
 	struct bcmgenet_net_dim dim;
 	u32		rx_max_coalesced_frames;
 	u32		rx_coalesce_usecs;
+	struct page_pool *page_pool;
 	struct bcmgenet_priv *priv;
 };
 
@@ -609,7 +612,6 @@ struct bcmgenet_priv {
 	void __iomem *rx_bds;
 	struct enet_cb *rx_cbs;
 	unsigned int num_rx_bds;
-	unsigned int rx_buf_len;
 	struct bcmgenet_rxnfc_rule rxnfc_rules[MAX_NUM_OF_FS_RULES];
 	struct list_head rxnfc_list;
 
Signature · 1 line
2.53.0
reviewer
#1 lore raw

From: 'Simon Horman' <[email protected]>

This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://netdev-ai.bots.linux.dev/sashiko/
---
Now I have the exact diff. Let me produce the report.

commit ff8ce4b2334ded9490897cdd2cff5a25a4a0a438
Author: Nicolai Buchwitz <[email protected]>

net: bcmgenet: convert RX path to page_pool

This patch converts the bcmgenet RX path from per-packet __netdev_alloc_skb() + dma_map_single() to page_pool, builds SKBs from pool pages via napi_build_skb() with skb_mark_for_recycle(), and removes the now-unused priv->rx_buf_len field and rx_dma_failed soft MIB counter.

Quoted 4 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -0
index 7c11cf916762..80dbfba9fa88 100644

[ ... ]

drivers/net/ethernet/broadcom/genet/bcmgenet.c static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = { · line 1162

Quoted 6 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -1
@@ -1153,7 +1159,6 @@ static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = {
 			UMAC_RBUF_ERR_CNT_V1),
 	STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT),
 	STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", mib.alloc_rx_buff_failed),
-	STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed),
 	STAT_GENET_SOFT_MIB("tx_dma_failed", mib.tx_dma_failed),

[Medium]
The string "rx_dma_failed" exposed via ethtool -S is user-visible: monitoring agents (collectd, telegraf, Prometheus exporters, ad-hoc scripts) may key off that name, and the strings list is ordered, so removing one shifts the index of every counter that follows for tools that index by offset rather than name.

Should the changelog mention this user-visible change explicitly, or could the entry be retained reporting 0 to preserve the existing string set?

Worth noting that the sibling driver drivers/net/ethernet/broadcom/bcmsysport.c still exposes rx_dma_failed, so the two drivers in the same Broadcom directory will diverge after this patch.

Quoted 49 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +11 -26
@@ -2249,46 +2246,30 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 	goto out;
 }
 
-static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv,
-					  struct enet_cb *cb)
+static int bcmgenet_rx_refill(struct bcmgenet_rx_ring *ring,
+			      struct enet_cb *cb)
 {
-	struct device *kdev = &priv->pdev->dev;
-	struct sk_buff *skb;
-	struct sk_buff *rx_skb;
+	struct bcmgenet_priv *priv = ring->priv;
 	dma_addr_t mapping;
+	struct page *page;
 
-	/* Allocate a new Rx skb */
-	skb = __netdev_alloc_skb(priv->dev, priv->rx_buf_len + SKB_ALIGNMENT,
-				 GFP_ATOMIC | __GFP_NOWARN);
-	if (!skb) {
+	page = page_pool_alloc_pages(ring->page_pool,
+				     GFP_ATOMIC);
+	if (!page) {
 		priv->mib.alloc_rx_buff_failed++;
 		netif_err(priv, rx_err, priv->dev,
-			  "%s: Rx skb allocation failed\n", __func__);
-		return NULL;
-	}
-
-	/* DMA-map the new Rx skb */
-	mapping = dma_map_single(kdev, skb->data, priv->rx_buf_len,
-				 DMA_FROM_DEVICE);
-	if (dma_mapping_error(kdev, mapping)) {
-		priv->mib.rx_dma_failed++;
-		dev_kfree_skb_any(skb);
-		netif_err(priv, rx_err, priv->dev,
-			  "%s: Rx skb DMA mapping failed\n", __func__);
-		return NULL;
+			  "%s: Rx page allocation failed\n", __func__);
+		return -ENOMEM;
 	}
 
-	/* Grab the current Rx skb from the ring and DMA-unmap it */
-	rx_skb = bcmgenet_free_rx_cb(kdev, cb);
+	/* page_pool handles DMA mapping via PP_FLAG_DMA_MAP */
+	mapping = page_pool_get_dma_addr(page);
 
-	/* Put the new Rx skb on the ring */
-	cb->skb = skb;

drivers/net/ethernet/broadcom/genet/bcmgenet.c static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) · line 2273

Quoted 10 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +3 -4
-	dma_unmap_addr_set(cb, dma_addr, mapping);
-	dma_unmap_len_set(cb, dma_len, priv->rx_buf_len);
+	cb->rx_page = page;
+	cb->rx_page_offset = 0;
 	dmadesc_set_addr(priv, cb->bd_addr, mapping);
 
-	/* Return the current Rx skb to caller */
-	return rx_skb;
+	return 0;
 }

[High]
Has a one-page-per-RX-descriptor scheme been considered against the platforms bcmgenet actually runs on?

The pool is created with order=0 and max_len=RX_BUF_LENGTH (2048):

	struct page_pool_params pp_params = {
		.order = 0,
		...
		.max_len = RX_BUF_LENGTH,
	};

bcmgenet_rx_refill() always sets cb->rx_page_offset = 0, and bcmgenet_desc_rx() then does:

	skb = napi_build_skb(hard_start, PAGE_SIZE - rx_off);

so each ~1.5KB frame ends up with skb->truesize == PAGE_SIZE.

bcmgenet runs on BCM2711/2712 (Raspberry Pi 4/5) and Brahma-B53 STB SoCs, which are commonly built with 16K or 64K page sizes. With ring->size of 256 and one full page per descriptor, that is e.g. 256 * 64K = 16MB of DMA-mapped memory per ring on a 64K-page kernel, for ~512KB of frame data. Every ~1.5KB packet also bills PAGE_SIZE bytes against sk_rcvbuf and per-socket memory accounting, which can drive TCP receivers into memory pressure on a Gigabit MAC.

The newly added struct enet_cb::rx_page_offset is set but never to a non-zero value:

	cb->rx_page = page;
	cb->rx_page_offset = 0;

Was a fragmented allocation (page_pool_dev_alloc_frag(), or a higher .order) the original intent here? If so, would it make sense to either implement that in this patch, or drop the unused rx_page_offset field until it is needed?

Quoted 1 line
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -0
@@ -2340,25 +2321,31 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,

[ ... ]

Quoted 6 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 -2
-		if (unlikely(len > RX_BUF_LENGTH)) {
-			netif_err(priv, rx_status, dev, "oversized packet\n");
+		/* Reject obviously bogus lengths to keep the SKB build path
+		 * safe against runt frames.
+		 */
+		min_len = GENET_RSB_PAD + ETH_ZLEN +

drivers/net/ethernet/broadcom/genet/bcmgenet.c static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, · line 2373

Quoted 10 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +6 -1
+			  (priv->crc_fwd_en ? ETH_FCS_LEN : 0);
+		if (unlikely(len > RX_BUF_LENGTH || len < min_len)) {
+			netif_err(priv, rx_status, dev,
+				  "invalid packet length %d\n", len);
 			BCMGENET_STATS64_INC(stats, length_errors);
-			dev_kfree_skb_any(skb);
+			page_pool_put_full_page(ring->page_pool, rx_page,
+						true);
 			goto next;
 		}

[Low, Low]
This combined check changes the per-counter attribution for short frames. Previously, only len > RX_BUF_LENGTH short-circuited into length_errors; runts that also had DMA_RX_CRC_ERROR / DMA_RX_OV / DMA_RX_NO / DMA_RX_LG / DMA_RX_RXER set would fall through to the dma_flag-driven block and be counted as crc_errors / over_errors / frame_errors / errors as appropriate.

After this patch any sub-min_len frame is bucketed only as length_errors, even if dma_flag indicates a CRC or RXER condition. Is the loss of finer attribution intentional, and could the changelog mention it?

A related question on the lower bound itself: min_len is computed as GENET_RSB_PAD + ETH_ZLEN (+ ETH_FCS_LEN if crc_fwd_en), so any HW-reported frame below ETH_ZLEN on the wire is dropped. Frames below the minimum that the MAC nevertheless delivers (for example with promiscuous mode or runt-pass enabled, or some PHY-side debug captures) used to reach the stack with DMA_RX_LG / DMA_RX_NO flagging.

The commit message describes this as "a runt cannot underflow the SKB build path". The actual underflow precondition for the skb_reserve() / __skb_put() sequence is len < GENET_RSB_PAD (= 66):

		skb_reserve(skb, GENET_RSB_PAD);
		__skb_put(skb, len - GENET_RSB_PAD);

Would a tighter check of len < GENET_RSB_PAD satisfy the stated safety goal without filtering legitimate sub-ETH_ZLEN frames the HW chose to deliver?

reviewer
#2 lore raw
Quoted 39 lines · Simon Horman

From: 'Simon Horman' <[email protected]>

This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://netdev-ai.bots.linux.dev/sashiko/
---
Now I have the exact diff. Let me produce the report.

commit ff8ce4b2334ded9490897cdd2cff5a25a4a0a438
Author: Nicolai Buchwitz <[email protected]>

net: bcmgenet: convert RX path to page_pool

This patch converts the bcmgenet RX path from per-packet __netdev_alloc_skb() + dma_map_single() to page_pool, builds SKBs from pool pages via napi_build_skb() with skb_mark_for_recycle(), and removes the now-unused priv->rx_buf_len field and rx_dma_failed soft MIB counter.

Quoted 4 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -0
index 7c11cf916762..80dbfba9fa88 100644

[ ... ]

drivers/net/ethernet/broadcom/genet/bcmgenet.c static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = { · line 1162

Quoted 6 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -1
@@ -1153,7 +1159,6 @@ static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = {
 			UMAC_RBUF_ERR_CNT_V1),
 	STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT),
 	STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", mib.alloc_rx_buff_failed),
-	STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed),
 	STAT_GENET_SOFT_MIB("tx_dma_failed", mib.tx_dma_failed),

[Medium]
The string "rx_dma_failed" exposed via ethtool -S is user-visible: monitoring agents (collectd, telegraf, Prometheus exporters, ad-hoc scripts) may key off that name, and the strings list is ordered, so removing one shifts the index of every counter that follows for tools that index by offset rather than name.

Quoted 6 lines

Should the changelog mention this user-visible change explicitly, or could the entry be retained reporting 0 to preserve the existing string set?

Worth noting that the sibling driver drivers/net/ethernet/broadcom/bcmsysport.c still exposes rx_dma_failed, so the two drivers in the same Broadcom directory will diverge after this patch.

FWIIW, I feel that mentioning the change in the patch description would be sufficient. And I don't buy the index argument, in my view these are key value pairs.

...

author maintainer
#3 lore raw
In reply to Simon Horman

Hi Simon

Quoted 5 lines · Simon Horman

From: 'Simon Horman' <[email protected]>

This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://netdev-ai.bots.linux.dev/sashiko/

Thanks, I will have a look and respond individually per addressed feedback.

Out of interest, how does this sashiko instance differs from sashiko.dev? The later doesn't flag anything in its review [1], so I'm just curious what I might can add to my local pre checks.

[1] https://sashiko.dev/#/patchset/20260602094248.4130712-1-nb%40tipi-net.de

Quoted 1 line

[...]

Regards,
Nicolai

#4 lore raw
Quoted 9 lines · Nicolai Buchwitz

Hi Simon

Quoted 5 lines · Simon Horman

From: 'Simon Horman' <[email protected]>

This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://netdev-ai.bots.linux.dev/sashiko/

Quoted 6 lines

Thanks, I will have a look and respond individually per addressed feedback.

Out of interest, how does this sashiko instance differs from sashiko.dev? The later doesn't flag anything in its review [1], so I'm just curious what I might can add to my local pre checks.

Your review on sashiko.dev is here:
https://sashiko.dev/#/patchset/20260602094248.4130712-1-nb%40tipi-net.de

And on netdev its at here:

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260602094248.4130712-1-nb%40tipi-net.de

On sashiko.dev, the review used gemini/gemini-3.1-pro-preview, but on the netdev instance it used bedrock/global.anthropic.claude-opus-4-7

So at a minimum it definitely uses different models, but it might also be using different context files as well, I know the netdev review had its own context files from when it predated sashiko as a whole, so I don't know if those are still fed in or differ.

Looking at the raw logs, the system prompts used are slightly different, so that also likely plays a part in the differing results.

Additionally, repeating runs can sometimes end up with different/new results because of the nature of LLMs relying on some randomness when picking next tokens from its weighted outputs. Even using the same model can give different results if you repeat the run.

Quoted 8 lines

[1] https://sashiko.dev/#/patchset/20260602094248.4130712-1-nb%40tipi-
net.de

Quoted 1 line

[...]

Regards,
Nicolai

author maintainer
#5 lore raw
In reply to Simon Horman

Hi Simon

Quoted 38 lines · Simon Horman

From: 'Simon Horman' <[email protected]>

This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://netdev-ai.bots.linux.dev/sashiko/
---
Now I have the exact diff. Let me produce the report.

commit ff8ce4b2334ded9490897cdd2cff5a25a4a0a438
Author: Nicolai Buchwitz <[email protected]>

net: bcmgenet: convert RX path to page_pool

This patch converts the bcmgenet RX path from per-packet __netdev_alloc_skb() + dma_map_single() to page_pool, builds SKBs from pool pages via napi_build_skb() with skb_mark_for_recycle(), and removes the now-unused priv->rx_buf_len field and rx_dma_failed soft MIB counter.

Quoted 1 line
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -0

[...]

drivers/net/ethernet/broadcom/genet/bcmgenet.c static const struct bcmgenet_stats · line 1164

Quoted 8 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -1
@@ -1153,7 +1159,6 @@ static const struct bcmgenet_stats 
 bcmgenet_gstrings_stats[] = {
 			UMAC_RBUF_ERR_CNT_V1),
 	STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT),
 	STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", 
 mib.alloc_rx_buff_failed),
-	STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed),
 	STAT_GENET_SOFT_MIB("tx_dma_failed", mib.tx_dma_failed),

[Medium]
The string "rx_dma_failed" exposed via ethtool -S is user-visible: monitoring agents (collectd, telegraf, Prometheus exporters, ad-hoc scripts) may key off that name, and the strings list is ordered, so removing one shifts the index of every counter that follows for tools that index by offset rather than name.

Quoted 2 lines

Should the changelog mention this user-visible change explicitly, or could the entry be retained reporting 0 to preserve the existing string set?

Nothing in the driver can increment rx_dma_failed after this patch. What would be the point in keeping it static 0? AFAIU removing dead soft-MIB counters in the same patch is not so special for page_pool conversions (e.g. ionic)?

I will mention it in the commit message of v2 though.

Quoted 4 lines

Worth noting that the sibling driver drivers/net/ethernet/broadcom/bcmsysport.c still exposes rx_dma_failed, so the two drivers in the same Broadcom directory will diverge after this patch.

bcmsysport still does per-packet dma_map_single() and not PP. The two drivers diverge because they do different things now, not because removing the counter here is wrong?

Quoted 17 lines

[...]

[High]
Has a one-page-per-RX-descriptor scheme been considered against the platforms bcmgenet actually runs on?

The pool is created with order=0 and max_len=RX_BUF_LENGTH (2048):

	struct page_pool_params pp_params = {
		.order = 0,
		...
		.max_len = RX_BUF_LENGTH,
	};

bcmgenet_rx_refill() always sets cb->rx_page_offset = 0, and bcmgenet_desc_rx() then does:

Quoted 6 lines
	skb = napi_build_skb(hard_start, PAGE_SIZE - rx_off);

so each ~1.5KB frame ends up with skb->truesize == PAGE_SIZE.

bcmgenet runs on BCM2711/2712 (Raspberry Pi 4/5) and Brahma-B53 STB SoCs, which are commonly built with 16K or 64K page sizes. With ring->size of

Pi5 uses BCM2712, but doesn't expose the genet and instead uses cadence macb on it's RP1. AFAIK only pi5 uses 16k pages and Pi4 and other STB platforms use 4k pages? With 4k we would end up at 1 MB per ring, which seems fine for a GBit MAC?

Quoted 9 lines

256 and one full page per descriptor, that is e.g. 256 * 64K = 16MB of DMA-mapped memory per ring on a 64K-page kernel, for ~512KB of frame data. Every ~1.5KB packet also bills PAGE_SIZE bytes against sk_rcvbuf and per-socket memory accounting, which can drive TCP receivers into memory pressure on a Gigabit MAC.

The newly added struct enet_cb::rx_page_offset is set but never to a non-zero value:

Quoted 7 lines
	cb->rx_page = page;
	cb->rx_page_offset = 0;

Was a fragmented allocation (page_pool_dev_alloc_frag(), or a higher .order) the original intent here? If so, would it make sense to either implement that in this patch, or drop the unused rx_page_offset field until it is needed?

Frag allocation is a reasonable follow-up but I'd keep this patch focused on the page_pool conversion. rx_page_offset is an artifact from the original XDP series. It is meant for the later XDP_PACKET_HEADROOM, but I can drop it in v2 for now.

Quoted 45 lines
Quoted 3 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -0
@@ -2340,25 +2321,31 @@ static unsigned int bcmgenet_desc_rx(struct 
 bcmgenet_rx_ring *ring,

[ ... ]

Quoted 6 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 -2
-		if (unlikely(len > RX_BUF_LENGTH)) {
-			netif_err(priv, rx_status, dev, "oversized packet\n");
+		/* Reject obviously bogus lengths to keep the SKB build path
+		 * safe against runt frames.
+		 */
+		min_len = GENET_RSB_PAD + ETH_ZLEN +

drivers/net/ethernet/broadcom/genet/bcmgenet.c static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, · line 2373

Quoted 10 lines
drivers/net/ethernet/broadcom/genet/bcmgenet.c +6 -1
+			  (priv->crc_fwd_en ? ETH_FCS_LEN : 0);
+		if (unlikely(len > RX_BUF_LENGTH || len < min_len)) {
+			netif_err(priv, rx_status, dev,
+				  "invalid packet length %d\n", len);
 			BCMGENET_STATS64_INC(stats, length_errors);
-			dev_kfree_skb_any(skb);
+			page_pool_put_full_page(ring->page_pool, rx_page,
+						true);
 			goto next;
 		}

[Low, Low]
This combined check changes the per-counter attribution for short frames. Previously, only len > RX_BUF_LENGTH short-circuited into length_errors; runts that also had DMA_RX_CRC_ERROR / DMA_RX_OV / DMA_RX_NO / DMA_RX_LG / DMA_RX_RXER set would fall through to the dma_flag-driven block and be counted as crc_errors / over_errors / frame_errors / errors as appropriate.

After this patch any sub-min_len frame is bucketed only as length_errors, even if dma_flag indicates a CRC or RXER condition. Is the loss of finer attribution intentional, and could the changelog mention it?

A related question on the lower bound itself: min_len is computed as GENET_RSB_PAD + ETH_ZLEN (+ ETH_FCS_LEN if crc_fwd_en), so any HW-reported frame below ETH_ZLEN on the wire is dropped. Frames below the minimum that the MAC nevertheless delivers (for example with promiscuous mode or runt-pass enabled, or some PHY-side debug captures) used to reach the stack with DMA_RX_LG / DMA_RX_NO flagging.

The commit message describes this as "a runt cannot underflow the SKB build path". The actual underflow precondition for the skb_reserve() / __skb_put() sequence is len < GENET_RSB_PAD (= 66):

Quoted 6 lines
		skb_reserve(skb, GENET_RSB_PAD);
		__skb_put(skb, len - GENET_RSB_PAD);

Would a tighter check of len < GENET_RSB_PAD satisfy the stated safety goal without filtering legitimate sub-ETH_ZLEN frames the HW chose to deliver?

Resonable. Will use len < GENET_RSB_PAD in v2.

Thanks,
Nicolai