public inbox for [email protected]
 help / color / mirror / Atom feed
From: David Wei <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Subject: [PATCH liburing v1 2/3] zcrx: add basic support
Date: Fri, 14 Feb 2025 20:18:56 -0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Add basic support for zcrx with a thin wrapper around
IORING_REGISTER_ZCRX_IFQ and a struct for the refill queue.

Signed-off-by: David Wei <[email protected]>
---
 src/include/liburing.h | 12 ++++++++++++
 src/liburing-ffi.map   |  1 +
 src/liburing.map       |  1 +
 src/register.c         |  6 ++++++
 4 files changed, 20 insertions(+)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 49b4edf437b2..6393599cb3bf 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -132,6 +132,16 @@ struct io_uring {
 	unsigned pad2;
 };
 
+struct io_uring_zcrx_rq {
+	__u32 *khead;
+	__u32 *ktail;
+	__u32 rq_tail;
+	unsigned ring_entries;
+
+	struct io_uring_zcrx_rqe *rqes;
+	void *ring_ptr;
+};
+
 /*
  * Library interface
  */
@@ -265,6 +275,8 @@ int io_uring_register_file_alloc_range(struct io_uring *ring,
 
 int io_uring_register_napi(struct io_uring *ring, struct io_uring_napi *napi);
 int io_uring_unregister_napi(struct io_uring *ring, struct io_uring_napi *napi);
+int io_uring_register_ifq(struct io_uring *ring,
+			  struct io_uring_zcrx_ifq_reg *reg);
 
 int io_uring_register_clock(struct io_uring *ring,
 			    struct io_uring_clock_register *arg);
diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map
index 83593a33826a..cedc71383547 100644
--- a/src/liburing-ffi.map
+++ b/src/liburing-ffi.map
@@ -222,6 +222,7 @@ LIBURING_2.9 {
 		io_uring_register_wait_reg;
 		io_uring_submit_and_wait_reg;
 		io_uring_clone_buffers_offset;
+		io_uring_register_ifq;
 		io_uring_register_region;
 		io_uring_sqe_set_buf_group;
 } LIBURING_2.8;
diff --git a/src/liburing.map b/src/liburing.map
index 9f7b21171218..81dd6ab9b8cc 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -109,5 +109,6 @@ LIBURING_2.9 {
 		io_uring_register_wait_reg;
 		io_uring_submit_and_wait_reg;
 		io_uring_clone_buffers_offset;
+		io_uring_register_ifq;
 		io_uring_register_region;
 } LIBURING_2.8;
diff --git a/src/register.c b/src/register.c
index 0fff208cd5f5..99337d13135d 100644
--- a/src/register.c
+++ b/src/register.c
@@ -422,6 +422,12 @@ int io_uring_clone_buffers(struct io_uring *dst, struct io_uring *src)
 	return io_uring_clone_buffers_offset(dst, src, 0, 0, 0, 0);
 }
 
+int io_uring_register_ifq(struct io_uring *ring,
+			  struct io_uring_zcrx_ifq_reg *reg)
+{
+	return do_register(ring, IORING_REGISTER_ZCRX_IFQ, reg, 1);
+}
+
 int io_uring_resize_rings(struct io_uring *ring, struct io_uring_params *p)
 {
 	unsigned sq_head, sq_tail;
-- 
2.43.5


  parent reply	other threads:[~2025-02-15  4:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-15  4:18 [PATCH liburing v1 0/3] add basic zero copy receive support David Wei
2025-02-15  4:18 ` [PATCH liburing v1 1/3] zcrx: sync kernel headers David Wei
2025-02-18 17:04   ` Jens Axboe
2025-02-18 17:28     ` David Wei
2025-02-15  4:18 ` David Wei [this message]
2025-02-18 17:05   ` [PATCH liburing v1 2/3] zcrx: add basic support Jens Axboe
2025-02-18 17:29     ` David Wei
2025-02-15  4:18 ` [PATCH liburing v1 3/3] zcrx: add unit test David Wei
2025-02-18 17:01 ` [PATCH liburing v1 0/3] add basic zero copy receive support Jens Axboe
2025-02-18 17:30   ` David Wei
2025-02-18 17:31     ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox