This RFC patchset shows the plans for allowing page_pool to handle and maintain DMA map/unmap of the pages it serves to the driver. For this to work a return hook in the network core is introduced, which also involves extending sk_buff with the necessary information.
The overall purpose is to simplify drivers, by providing a page allocation API that does recycling, such that each driver doesn't have to reinvent its own recycling scheme. Using page_pool in a driver does not require implementing XDP support, but it makes it trivially easy to do so. The recycles code leverage the XDP recycle APIs. The Marvell mvneta driver was used in this patchset to demonstrate how to use the API, and tested on the EspressoBIN board. We also have patches enabling XDP for this driver, but they are not part of this patchset as we want review of the general idea of the page_pool return SKB hook. A driver using page_pool and XDP redirecting into CPUMAP or veth, will also take advantage of the new SKB return hook, this is currently only mlx5. The longer term plans involves allowing other types of allocators to use this return hook. Particularly allowing zero-copy AF_XDP frames to travel further into the netstack, if userspace page have been restricted to read-only. --- Ilias Apalodimas (4): page_pool: add helper functions for DMA net: mvneta: use page pool API for sw buffer manager net: core: add recycle capabilities on skbs via page_pool API net: mvneta: remove copybreak, prefetch and use build_skb Jesper Dangaard Brouer (4): xdp: reduce size of struct xdp_mem_info mvneta: activate page recycling via skb using page_pool xdp: bpf: cpumap redirect must update skb->mem_info veth: xdp_frames redirected into veth need to transfer xdp_mem_info drivers/net/ethernet/marvell/Kconfig | 1 drivers/net/ethernet/marvell/mvneta.c | 158 +++++++++++++++++---------------- drivers/net/veth.c | 1 include/linux/skbuff.h | 6 + include/net/page_pool.h | 6 + include/net/xdp.h | 5 + kernel/bpf/cpumap.c | 2 net/core/page_pool.c | 7 + net/core/skbuff.c | 7 + net/core/xdp.c | 14 ++- 10 files changed, 125 insertions(+), 82 deletions(-) --