summaryrefslogtreecommitdiff
path: root/net/core/xdp.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2020-11-13 12:48:29 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2020-11-14 02:29:00 +0100
commit7886244736a4dbb49987f330772842130493e050 (patch)
treeb77bc5437fc0787c4d38d58742c2f4294a20ca05 /net/core/xdp.c
parent8965398713d831f6b893805880c249e62e9059ae (diff)
net: page_pool: Add bulk support for ptr_ring
Introduce the capability to batch page_pool ptr_ring refill since it is usually run inside the driver NAPI tx completion loop. Suggested-by: Jesper Dangaard Brouer <brouer@redhat.com> Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Link: https://lore.kernel.org/bpf/08dd249c9522c001313f520796faa777c4089e1c.1605267335.git.lorenzo@kernel.org
Diffstat (limited to 'net/core/xdp.c')
-rw-r--r--net/core/xdp.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/net/core/xdp.c b/net/core/xdp.c
index bbaee7fdd44f..3d330ebda893 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -393,16 +393,11 @@ EXPORT_SYMBOL_GPL(xdp_return_frame_rx_napi);
void xdp_flush_frame_bulk(struct xdp_frame_bulk *bq)
{
struct xdp_mem_allocator *xa = bq->xa;
- int i;
- if (unlikely(!xa))
+ if (unlikely(!xa || !bq->count))
return;
- for (i = 0; i < bq->count; i++) {
- struct page *page = virt_to_head_page(bq->q[i]);
-
- page_pool_put_full_page(xa->page_pool, page, false);
- }
+ page_pool_put_page_bulk(xa->page_pool, bq->q, bq->count);
/* bq->xa is not cleared to save lookup, if mem.id same in next bulk */
bq->count = 0;
}