mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00

Add a new object called an interface queue (ifq) that represents a net rx queue that has been configured for zero copy. Each ifq is registered using a new registration opcode IORING_REGISTER_ZCRX_IFQ. The refill queue is allocated by the kernel and mapped by userspace using a new offset IORING_OFF_RQ_RING, in a similar fashion to the main SQ/CQ. It is used by userspace to return buffers that it is done with, which will then be re-used by the netdev again. The main CQ ring is used to notify userspace of received data by using the upper 16 bytes of a big CQE as a new struct io_uring_zcrx_cqe. Each entry contains the offset + len to the data. For now, each io_uring instance only has a single ifq. Reviewed-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: David Wei <dw@davidwei.uk> Acked-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20250215000947.789731-2-dw@davidwei.uk Signed-off-by: Jens Axboe <axboe@kernel.dk>
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
#ifndef IO_URING_MEMMAP_H
|
|
#define IO_URING_MEMMAP_H
|
|
|
|
#define IORING_MAP_OFF_PARAM_REGION 0x20000000ULL
|
|
#define IORING_MAP_OFF_ZCRX_REGION 0x30000000ULL
|
|
|
|
struct page **io_pin_pages(unsigned long ubuf, unsigned long len, int *npages);
|
|
|
|
#ifndef CONFIG_MMU
|
|
unsigned int io_uring_nommu_mmap_capabilities(struct file *file);
|
|
#endif
|
|
unsigned long io_uring_get_unmapped_area(struct file *file, unsigned long addr,
|
|
unsigned long len, unsigned long pgoff,
|
|
unsigned long flags);
|
|
int io_uring_mmap(struct file *file, struct vm_area_struct *vma);
|
|
|
|
void io_free_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr);
|
|
int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
|
|
struct io_uring_region_desc *reg,
|
|
unsigned long mmap_offset);
|
|
|
|
int io_create_region_mmap_safe(struct io_ring_ctx *ctx,
|
|
struct io_mapped_region *mr,
|
|
struct io_uring_region_desc *reg,
|
|
unsigned long mmap_offset);
|
|
|
|
static inline void *io_region_get_ptr(struct io_mapped_region *mr)
|
|
{
|
|
return mr->ptr;
|
|
}
|
|
|
|
static inline bool io_region_is_set(struct io_mapped_region *mr)
|
|
{
|
|
return !!mr->nr_pages;
|
|
}
|
|
|
|
#endif
|