History

Merge branch 'io_uring-zero-copy-rx'

David Wei says: ==================== io_uring zero copy rx This patchset contains net/ patches needed by a new io_uring request implementing zero copy rx into userspace pages, eliminating a kernel to user copy. We configure a page pool that a driver uses to fill a hw rx queue to hand out user pages instead of kernel pages. Any data that ends up hitting this hw rx queue will thus be dma'd into userspace memory directly, without needing to be bounced through kernel memory. 'Reading' data out of a socket instead becomes a _notification_ mechanism, where the kernel tells userspace where the data is. The overall approach is similar to the devmem TCP proposal. This relies on hw header/data split, flow steering and RSS to ensure packet headers remain in kernel memory and only desired flows hit a hw rx queue configured for zero copy. Configuring this is outside of the scope of this patchset. We share netdev core infra with devmem TCP. The main difference is that io_uring is used for the uAPI and the lifetime of all objects are bound to an io_uring instance. Data is 'read' using a new io_uring request type. When done, data is returned via a new shared refill queue. A zero copy page pool refills a hw rx queue from this refill queue directly. Of course, the lifetime of these data buffers are managed by io_uring rather than the networking stack, with different refcounting rules. This patchset is the first step adding basic zero copy support. We will extend this iteratively with new features e.g. dynamically allocated zero copy areas, THP support, dmabuf support, improved copy fallback, general optimisations and more. In terms of netdev support, we're first targeting Broadcom bnxt. Patches aren't included since Taehee Yoo has already sent a more comprehensive patchset adding support in [1]. Google gve should already support this, and Mellanox mlx5 support is WIP pending driver changes. =========== Performance =========== Note: Comparison with epoll + TCP_ZEROCOPY_RECEIVE isn't done yet. Test setup: * AMD EPYC 9454 * Broadcom BCM957508 200G * Kernel v6.11 base [2] * liburing fork [3] * kperf fork [4] * 4K MTU * Single TCP flow With application thread + net rx softirq pinned to _different_ cores: +-------------------------------+ | epoll | io_uring | |-----------|-------------------| | 82.2 Gbps | 116.2 Gbps (+41%) | +-------------------------------+ Pinned to _same_ core: +-------------------------------+ | epoll | io_uring | |-----------|-------------------| | 62.6 Gbps | 80.9 Gbps (+29%) | +-------------------------------+ ===== Links ===== Broadcom bnxt support: [1]: https://lore.kernel.org/20241003160620.1521626-8-ap420073@gmail.com Linux kernel branch including io_uring bits: [2]: https://github.com/isilence/linux.git zcrx/v13 liburing for testing: [3]: https://github.com/isilence/liburing.git zcrx/next kperf for testing: [4]: https://git.kernel.dk/kperf.git ====================

Jakub Kicinski committed 1 year ago

Commit 71f0dd52 parents ba6ec09 6e18ed914 files · +321 −81Browse files

Showing the changes to include/uapi (1 of 14 files). Show all

Unified · Split

include/uapi/linux/netdev.h+7−0
@@ -86,6 +86,11 @@ enum { · 85 unmodified lines
8686 NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1)
8787 };
8888
89+enum {
90+ __NETDEV_A_IO_URING_PROVIDER_INFO_MAX,
91+ NETDEV_A_IO_URING_PROVIDER_INFO_MAX = (__NETDEV_A_IO_URING_PROVIDER_INFO_MAX - 1)
92+};
93+
8994 enum {
9095 NETDEV_A_PAGE_POOL_ID = 1,
9196 NETDEV_A_PAGE_POOL_IFINDEX,
@@ -94,6 +99,7 @@ enum { · 2 unmodified lines
9499 NETDEV_A_PAGE_POOL_INFLIGHT_MEM,
95100 NETDEV_A_PAGE_POOL_DETACH_TIME,
96101 NETDEV_A_PAGE_POOL_DMABUF,
102+ NETDEV_A_PAGE_POOL_IO_URING,
97103
98104 __NETDEV_A_PAGE_POOL_MAX,
99105 NETDEV_A_PAGE_POOL_MAX = (__NETDEV_A_PAGE_POOL_MAX - 1)
@@ -136,6 +142,7 @@ enum { · 36 unmodified lines
136142 NETDEV_A_QUEUE_TYPE,
137143 NETDEV_A_QUEUE_NAPI_ID,
138144 NETDEV_A_QUEUE_DMABUF,
145+ NETDEV_A_QUEUE_IO_URING,
139146
140147 __NETDEV_A_QUEUE_MAX,
141148 NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)