* [PATCH net-next] eth: mpnic: use netmem_get_pp() instead of page->pp
@ 2026-11-23 19:21 Nilay Vaish
2026-11-23 21:22 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Nilay Vaish @ 2026-11-23 19:21 UTC (permalink / raw)
To: Alexander Duyck, Jakub Kicinski
Cc: kernel-team, Andrew Lunn, David S . Miller, Eric Dumazet,
Paolo Abeni, netdev, Nilay Vaish
mpnic reads the page_pool of a page straight from struct page when it
returns Rx pages. The page_pool fields of struct page are being moved
behind struct netmem_desc, and netmem_get_pp() is the accessor for them.
Look the pool up through netmem_get_pp() and hand the same netmem
reference to the netmem variants of the put helpers, so that each page
is converted once. The XDP frags are taken as netmem directly with
skb_frag_netmem().
The driver no longer depends on where the pointer is stored. No
functional change.
This patch was written with the help of an AI coding assistant (Gemini).
Signed-off-by: Nilay Vaish <nilayvaish@google.com>
---
drivers/net/ethernet/meta/mpnic/mpnic_txrx.c | 29 ++++++++++++++------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
index af5e490c112d..90bb37fab8ca 100644
--- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
+++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.c
@@ -662,8 +662,12 @@ mpnic_page_pool_get(struct mpnic_pg_ctxt *pg_ctxt, struct mpnic_ring *ring,
if (unlikely(pg_ctxt->idx != idx)) {
if (pg_ctxt->pagecnt_bias &&
- !page_pool_unref_page(page, pg_ctxt->pagecnt_bias))
- page_pool_put_unrefed_page(page->pp, page, -1, true);
+ !page_pool_unref_page(page, pg_ctxt->pagecnt_bias)) {
+ netmem_ref netmem = page_to_netmem(page);
+
+ page_pool_put_unrefed_netmem(netmem_get_pp(netmem),
+ netmem, -1, true);
+ }
page = ring->rx_buf[idx];
page_pool_fragment_page(page, MPNIC_PAGECNT_BIAS_MAX);
@@ -685,8 +689,12 @@ static void mpnic_flush_pg_ctxt(struct mpnic_pg_ctxt *ctxt, bool napi)
if (pagecnt_bias) {
struct page *page = ctxt->page;
- if (!page_pool_unref_page(page, pagecnt_bias))
- page_pool_put_unrefed_page(page->pp, page, -1, napi);
+ if (!page_pool_unref_page(page, pagecnt_bias)) {
+ netmem_ref netmem = page_to_netmem(page);
+
+ page_pool_put_unrefed_netmem(netmem_get_pp(netmem),
+ netmem, -1, napi);
+ }
}
}
@@ -774,6 +782,7 @@ mpnic_add_rx_frag(u64 rcd, struct mpnic_rcq_state *state,
static void mpnic_put_pkt_buff(struct mpnic_pkt_ctxt *ctxt, bool napi)
{
struct xdp_buff *buff = &ctxt->buff;
+ netmem_ref netmem;
struct page *page;
if (!buff->data_hard_start)
@@ -787,13 +796,15 @@ static void mpnic_put_pkt_buff(struct mpnic_pkt_ctxt *ctxt, bool napi)
nr_frags = shinfo->nr_frags;
while (nr_frags--) {
- page = skb_frag_page(&shinfo->frags[nr_frags]);
- page_pool_put_full_page(page->pp, page, napi);
+ netmem = skb_frag_netmem(&shinfo->frags[nr_frags]);
+ page_pool_put_full_netmem(netmem_get_pp(netmem),
+ netmem, napi);
}
}
page = virt_to_head_page(buff->data_hard_start);
- page_pool_put_full_page(page->pp, page, napi);
+ netmem = page_to_netmem(page);
+ page_pool_put_full_netmem(netmem_get_pp(netmem), netmem, napi);
}
static void mpnic_rx_csum(u64 rcd, struct sk_buff *skb,
@@ -1684,9 +1695,9 @@ static void mpnic_clean_bdq(struct mpnic_ring *bdq)
unsigned int head = bdq->head;
while (head != bdq->tail) {
- struct page *page = bdq->rx_buf[head];
+ netmem_ref netmem = page_to_netmem(bdq->rx_buf[head]);
- page_pool_put_full_page(page->pp, page, false);
+ page_pool_put_full_netmem(netmem_get_pp(netmem), netmem, false);
head++;
head &= bdq->size_mask;
base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 19:21 [PATCH net-next] eth: mpnic: use netmem_get_pp() instead of page->pp Nilay Vaish
2026-11-23 21:22 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox