Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at ee9dce44362b2d8132c32964656ab6dff7dfbc6a 115 lines 2.2 kB view raw
1/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT */ 2/* 3 * Header file for the io_uring zerocopy receive (zcrx) interface. 4 * 5 * Copyright (C) 2026 Pavel Begunkov 6 * Copyright (C) 2026 David Wei 7 * Copyright (C) Meta Platforms, Inc. 8 */ 9#ifndef LINUX_IO_ZCRX_H 10#define LINUX_IO_ZCRX_H 11 12#include <linux/types.h> 13 14/* Zero copy receive refill queue entry */ 15struct io_uring_zcrx_rqe { 16 __u64 off; 17 __u32 len; 18 __u32 __pad; 19}; 20 21struct io_uring_zcrx_cqe { 22 __u64 off; 23 __u64 __pad; 24}; 25 26/* The bit from which area id is encoded into offsets */ 27#define IORING_ZCRX_AREA_SHIFT 48 28#define IORING_ZCRX_AREA_MASK (~(((__u64)1 << IORING_ZCRX_AREA_SHIFT) - 1)) 29 30struct io_uring_zcrx_offsets { 31 __u32 head; 32 __u32 tail; 33 __u32 rqes; 34 __u32 __resv2; 35 __u64 __resv[2]; 36}; 37 38enum io_uring_zcrx_area_flags { 39 IORING_ZCRX_AREA_DMABUF = 1, 40}; 41 42struct io_uring_zcrx_area_reg { 43 __u64 addr; 44 __u64 len; 45 __u64 rq_area_token; 46 __u32 flags; 47 __u32 dmabuf_fd; 48 __u64 __resv2[2]; 49}; 50 51enum zcrx_reg_flags { 52 ZCRX_REG_IMPORT = 1, 53 54 /* 55 * Register a zcrx instance without a net device. All data will be 56 * copied. The refill queue entries might not be automatically 57 * consumed and need to be flushed, see ZCRX_CTRL_FLUSH_RQ. 58 */ 59 ZCRX_REG_NODEV = 2, 60}; 61 62enum zcrx_features { 63 /* 64 * The user can ask for the desired rx page size by passing the 65 * value in struct io_uring_zcrx_ifq_reg::rx_buf_len. 66 */ 67 ZCRX_FEATURE_RX_PAGE_SIZE = 1 << 0, 68}; 69 70/* 71 * Argument for IORING_REGISTER_ZCRX_IFQ 72 */ 73struct io_uring_zcrx_ifq_reg { 74 __u32 if_idx; 75 __u32 if_rxq; 76 __u32 rq_entries; 77 __u32 flags; 78 79 __u64 area_ptr; /* pointer to struct io_uring_zcrx_area_reg */ 80 __u64 region_ptr; /* struct io_uring_region_desc * */ 81 82 struct io_uring_zcrx_offsets offsets; 83 __u32 zcrx_id; 84 __u32 rx_buf_len; 85 __u64 __resv[3]; 86}; 87 88enum zcrx_ctrl_op { 89 ZCRX_CTRL_FLUSH_RQ, 90 ZCRX_CTRL_EXPORT, 91 92 __ZCRX_CTRL_LAST, 93}; 94 95struct zcrx_ctrl_flush_rq { 96 __u64 __resv[6]; 97}; 98 99struct zcrx_ctrl_export { 100 __u32 zcrx_fd; 101 __u32 __resv1[11]; 102}; 103 104struct zcrx_ctrl { 105 __u32 zcrx_id; 106 __u32 op; /* see enum zcrx_ctrl_op */ 107 __u64 __resv[2]; 108 109 union { 110 struct zcrx_ctrl_export zc_export; 111 struct zcrx_ctrl_flush_rq zc_flush; 112 }; 113}; 114 115#endif /* LINUX_IO_ZCRX_H */