summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorClément Léger <cleger@meta.com>2026-05-19 12:44:33 +0100
committerJens Axboe <axboe@kernel.dk>2026-05-26 10:42:01 -0600
commit255180f7034f48aa5b0c8df70228307394bddbb9 (patch)
treea4bccc913785f78ff456ea00eb852e4242859986 /io_uring
parent0719e10d826aa0ba4840917d0261986eaead9a51 (diff)
downloadlinux-255180f7034f48aa5b0c8df70228307394bddbb9.tar.gz
linux-255180f7034f48aa5b0c8df70228307394bddbb9.zip
io_uring/zcrx: notify user on frag copy fallback
Add a ZCRX_NOTIF_COPY notification type to signal userspace when a received fragment could not be delivered using zero-copy and was instead copied into a buffer. Signed-off-by: Clément Léger <cleger@meta.com> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/3d54bcd8bf10b3a1e88beb0cd39c40c3937bea4f.1779189667.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/zcrx.c7
-rw-r--r--io_uring/zcrx.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 2bca9a58dcf6..404f9e7574a2 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -1532,8 +1532,13 @@ static int io_zcrx_copy_frag(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
const skb_frag_t *frag, int off, int len)
{
struct page *page = skb_frag_page(frag);
+ int ret;
+
+ ret = io_zcrx_copy_chunk(req, ifq, page, off + skb_frag_off(frag), len);
+ if (ret > 0)
+ zcrx_send_notif(ifq, ZCRX_NOTIF_COPY);
- return io_zcrx_copy_chunk(req, ifq, page, off + skb_frag_off(frag), len);
+ return ret;
}
static int io_zcrx_recv_frag(struct io_kiocb *req, struct io_zcrx_ifq *ifq,
diff --git a/io_uring/zcrx.h b/io_uring/zcrx.h
index e8b7717d6adf..54d91b580eaf 100644
--- a/io_uring/zcrx.h
+++ b/io_uring/zcrx.h
@@ -11,7 +11,7 @@
#define ZCRX_SUPPORTED_REG_FLAGS (ZCRX_REG_IMPORT | ZCRX_REG_NODEV)
#define ZCRX_FEATURES (ZCRX_FEATURE_RX_PAGE_SIZE |\
ZCRX_FEATURE_NOTIFICATION)
-#define ZCRX_NOTIF_TYPE_MASK (1U << ZCRX_NOTIF_NO_BUFFERS)
+#define ZCRX_NOTIF_TYPE_MASK ((1U << ZCRX_NOTIF_NO_BUFFERS) | (1U << ZCRX_NOTIF_COPY))
struct io_zcrx_mem {
unsigned long size;