On 4/22/26 12:25, Clément Léger wrote:
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 <[email protected]>
---
  include/uapi/linux/io_uring/zcrx.h | 1 +
  io_uring/zcrx.c                    | 7 ++++++-
  io_uring/zcrx.h                    | 3 ++-
  3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/io_uring/zcrx.h 
b/include/uapi/linux/io_uring/zcrx.h
index b8596d7d47b6..e0c0079626c8 100644
--- a/include/uapi/linux/io_uring/zcrx.h
+++ b/include/uapi/linux/io_uring/zcrx.h
@@ -70,6 +70,7 @@ enum zcrx_features {
enum zcrx_notification_type {
        ZCRX_NOTIF_NO_BUFFERS = 1 << 0,
+       ZCRX_NOTIF_COPY = 1 << 1
  };
struct zcrx_notification_desc {
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 35ca28cb6583..732e585aa13a 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -1510,8 +1510,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);

We also copy the linear part if present, depends on the semantics
would make sense adding it there as well.

Pavel Begunkov


Reply via email to