From: Jakub Kicinski <kuba@kernel.org>
To: Nicolai Buchwitz <nb@tipi-net.de>
Cc: netdev@vger.kernel.org, "Justin Chen" <justin.chen@broadcom.com>,
"Simon Horman" <horms@kernel.org>,
"Mohsin Bashir" <mohsin.bashr@gmail.com>,
"Doug Berger" <opendmb@gmail.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
"Vikas Gupta" <vikas.gupta@broadcom.com>,
"Bhargava Marreddy" <bhargava.marreddy@broadcom.com>,
"Rajashekar Hudumula" <rajashekar.hudumula@broadcom.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Fernando Fernandez Mancera" <fmancera@suse.de>,
"Markus Blöchl" <markus@blochl.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v6 1/7] net: bcmgenet: convert RX path to page_pool
Date: Sun, 12 Apr 2026 12:10:44 -0700 [thread overview]
Message-ID: <20260412121044.4dbd4869@kernel.org> (raw)
In-Reply-To: <20260406083536.839517-2-nb@tipi-net.de>
On Mon, 6 Apr 2026 10:35:25 +0200 Nicolai Buchwitz wrote:
> Replace the per-packet __netdev_alloc_skb() + dma_map_single() in the
> RX path with page_pool, which provides efficient page recycling and
> DMA mapping management. This is a prerequisite for XDP support (which
> requires stable page-backed buffers rather than SKB linear data).
>
> Key changes:
> - Create a page_pool per RX ring (PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV)
> - bcmgenet_rx_refill() allocates pages via page_pool_alloc_pages()
> - bcmgenet_desc_rx() builds SKBs from pages via napi_build_skb() with
> skb_mark_for_recycle() for automatic page_pool return
> - Buffer layout reserves XDP_PACKET_HEADROOM (256 bytes) before the HW
> RSB (64 bytes) + alignment pad (2 bytes) for future XDP headroom
some nits here, since I have more "real" comments on later patches
> +/* Page pool RX buffer layout:
> + * XDP_PACKET_HEADROOM | RSB(64) + pad(2) | frame data | skb_shared_info
> + * The HW writes the 64B RSB + 2B alignment padding before the frame.
> + */
> +#define GENET_XDP_HEADROOM XDP_PACKET_HEADROOM
subjective but IDK what value this define adds vs using
XDP_PACKET_HEADROOM directly.
> +#define GENET_RSB_PAD (sizeof(struct status_64) + 2)
> +#define GENET_RX_HEADROOM (GENET_XDP_HEADROOM + GENET_RSB_PAD)
> +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);
page pool adds __GFP_NOWARN automatically, you can drop it now
> - if (!skb) {
> + page = page_pool_alloc_pages(ring->page_pool,
> + GFP_ATOMIC | __GFP_NOWARN);
> + if (!page) {
> priv->mib.alloc_rx_buff_failed++;
> netif_err(priv, rx_err, priv->dev,
> - "%s: Rx skb allocation failed\n", __func__);
> - return NULL;
> - }
next prev parent reply other threads:[~2026-04-12 19:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 8:35 [PATCH net-next v6 0/7] net: bcmgenet: add XDP support Nicolai Buchwitz
2026-04-06 8:35 ` [PATCH net-next v6 1/7] net: bcmgenet: convert RX path to page_pool Nicolai Buchwitz
2026-04-06 17:10 ` Florian Fainelli
2026-04-12 19:10 ` Jakub Kicinski [this message]
2026-04-06 8:35 ` [PATCH net-next v6 2/7] net: bcmgenet: register xdp_rxq_info for each RX ring Nicolai Buchwitz
2026-04-06 17:22 ` Florian Fainelli
2026-04-06 8:35 ` [PATCH net-next v6 3/7] net: bcmgenet: add basic XDP support (PASS/DROP) Nicolai Buchwitz
2026-04-06 18:57 ` Nicolai Buchwitz
2026-04-12 19:22 ` Jakub Kicinski
2026-04-06 8:35 ` [PATCH net-next v6 4/7] net: bcmgenet: add XDP_TX support Nicolai Buchwitz
2026-04-06 18:52 ` Nicolai Buchwitz
2026-04-06 8:35 ` [PATCH net-next v6 5/7] net: bcmgenet: add XDP_REDIRECT and ndo_xdp_xmit support Nicolai Buchwitz
2026-04-06 8:35 ` [PATCH net-next v6 6/7] net: bcmgenet: add XDP statistics counters Nicolai Buchwitz
2026-04-06 17:20 ` Florian Fainelli
2026-04-06 8:35 ` [PATCH net-next v6 7/7] net: bcmgenet: reject MTU changes incompatible with XDP Nicolai Buchwitz
2026-04-06 17:19 ` Florian Fainelli
2026-04-06 18:30 ` Mohsin Bashir
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260412121044.4dbd4869@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=arnd@arndb.de \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhargava.marreddy@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=fmancera@suse.de \
--cc=horms@kernel.org \
--cc=justin.chen@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@blochl.de \
--cc=mohsin.bashr@gmail.com \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=vikas.gupta@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.