* [PATCH net-next] virtio_net: use page_private() accessors for the big-packets page chain
@ 2026-11-23 19:22 Nilay Vaish
0 siblings, 0 replies; only message in thread
From: Nilay Vaish @ 2026-11-23 19:22 UTC (permalink / raw)
To: Michael S . Tsirkin, Jason Wang
Cc: Eugenio Pérez, Xuan Zhuo, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, virtualization,
Nilay Vaish
Big packets mode chains its receive pages through page->private, reading
and writing the field directly.
struct page is being shrunk as part of the memdesc work, and its private
field is one of those that will move. Direct users have to go through
the accessors before that can happen.
Use page_private() and set_page_private() instead, like the rest of the
kernel, so that the driver no longer depends on where struct page keeps
the field.
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/virtio_net.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 0988a946ef35..5eef2c315963 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -680,8 +680,10 @@ static void give_pages(struct receive_queue *rq, struct page *page)
struct page *end;
/* Find end of list, sew whole thing into vi->rq.pages. */
- for (end = page; end->private; end = (struct page *)end->private);
- end->private = (unsigned long)rq->pages;
+ for (end = page; page_private(end);
+ end = (struct page *)page_private(end))
+ ;
+ set_page_private(end, (unsigned long)rq->pages);
rq->pages = page;
}
@@ -690,9 +692,9 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask)
struct page *p = rq->pages;
if (p) {
- rq->pages = (struct page *)p->private;
+ rq->pages = (struct page *)page_private(p);
/* clear private here, it is used to chain pages */
- p->private = 0;
+ set_page_private(p, 0);
} else
p = alloc_page(gfp_mask);
return p;
@@ -881,7 +883,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
* Currently, big packets mode doesn't use page pools.
*/
if (!rq->page_pool) {
- page = (struct page *)page->private;
+ page = (struct page *)page_private(page);
if (page)
give_pages(rq, page);
}
@@ -929,7 +931,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset,
frag_size, truesize);
len -= frag_size;
- page = (struct page *)page->private;
+ page = (struct page *)page_private(page);
offset = 0;
}
@@ -2705,7 +2707,7 @@ static int add_recvbuf_big(struct virtnet_info *vi, struct receive_queue *rq,
sg_set_buf(&rq->sg[i], page_address(first), PAGE_SIZE);
/* chain new page in list head to match sg */
- first->private = (unsigned long)list;
+ set_page_private(first, (unsigned long)list);
list = first;
}
@@ -2725,7 +2727,7 @@ static int add_recvbuf_big(struct virtnet_info *vi, struct receive_queue *rq,
sg_set_buf(&rq->sg[1], p + offset, PAGE_SIZE - offset);
/* chain first in list head */
- first->private = (unsigned long)list;
+ set_page_private(first, (unsigned long)list);
err = virtqueue_add_inbuf(rq->vq, rq->sg, vi->big_packets_num_skbfrags + 2,
first, gfp);
if (err < 0)
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-23 19:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 19:22 [PATCH net-next] virtio_net: use page_private() accessors for the big-packets page chain Nilay Vaish
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox