Skip to contentSkip to conversation

zerocopy send API changes

PATCH Applied Pavel Begunkov 3 participants 11 messages Sep 2, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

cover zerocopy send API changes

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
tests: verify that send addr is copied when async
zc: adjust sendzc to the simpler uapi
test: test iowq zc sends
examples: adjust zc bench to the new uapi

 examples/send-zerocopy.c        |  72 ++--
 src/include/liburing.h          |  39 +-
 src/include/liburing/io_uring.h |  28 +-
 src/register.c                  |  20 -
 test/send-zerocopy.c            | 667 +++++++-------------------------
 5 files changed, 178 insertions(+), 648 deletions(-)
Signature · 1 line
2.37.2
#1 lore raw

PATCH 1/4 tests: verify that send addr is copied when async

The kernel should not be touching timespec after returning from submit syscall, make sure it's not reloaded after a request goes async.

---
 test/send-zerocopy.c | 69 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
test/send-zerocopy.c +69 -0
index 307c114..97727e3 100644
@@ -836,6 +836,69 @@ static int test_inet_send(struct io_uring *ring)
 	return 0;
 }
 
+static int test_async_addr(struct io_uring *ring)
+{
+	struct io_uring_sqe *sqe;
+	struct io_uring_cqe *cqe;
+	struct sockaddr_storage addr;
+	int sock_tx = -1, sock_rx = -1;
+	struct __kernel_timespec ts;
+	int ret;
+
+	ret = prepare_ip(&addr, &sock_tx, &sock_rx, true, false, false, false);
+	if (ret) {
+		fprintf(stderr, "sock prep failed %d\n", ret);
+		return 1;
+	}
+
+	sqe = io_uring_get_sqe(ring);
+	ts.tv_sec = 1;
+	ts.tv_nsec = 0;
+	io_uring_prep_timeout(sqe, &ts, 0, IORING_TIMEOUT_ETIME_SUCCESS);
+	sqe->user_data = 1;
+	sqe->flags |= IOSQE_IO_LINK;
+
+	sqe = io_uring_get_sqe(ring);
+	io_uring_prep_sendzc(sqe, sock_tx, tx_buffer, 1, 0, 0, 0);
+	sqe->user_data = 2;
+	io_uring_prep_sendzc_set_addr(sqe, (const struct sockaddr *)&addr,
+				      sizeof(struct sockaddr_in6));
+
+	ret = io_uring_submit(ring);
+	assert(ret == 2);
+	memset(&addr, 0, sizeof(addr));
+
+	ret = io_uring_wait_cqe(ring, &cqe);
+	if (ret) {
+		fprintf(stderr, "io_uring_wait_cqe failed %i\n", ret);
+		return 1;
+	}
+	if (cqe->user_data != 1 || cqe->res != -ETIME) {
+		fprintf(stderr, "invalid timeout res %i %i\n",
+			(int)cqe->user_data, cqe->res);
+		return 1;
+	}
+	io_uring_cqe_seen(ring, cqe);
+
+	ret = io_uring_wait_cqe(ring, &cqe);
+	if (ret) {
+		fprintf(stderr, "io_uring_wait_cqe failed %i\n", ret);
+		return 1;
+	}
+	if (cqe->user_data != 2 || cqe->res != 1) {
+		fprintf(stderr, "invalid send %i %i\n",
+			(int)cqe->user_data, cqe->res);
+		return 1;
+	}
+	io_uring_cqe_seen(ring, cqe);
+	ret = recv(sock_rx, rx_buffer, 1, MSG_TRUNC);
+	assert(ret == 1);
+
+	close(sock_tx);
+	close(sock_rx);
+	return 0;
+}
+
 int main(int argc, char *argv[])
 {
 	struct io_uring ring;
@@ -973,6 +1036,12 @@ int main(int argc, char *argv[])
 		fprintf(stderr, "test_inet_send() failed\n");
 		return ret;
 	}
+
+	ret = test_async_addr(&ring);
+	if (ret) {
+		fprintf(stderr, "test_async_addr() failed\n");
+		return ret;
+	}
 out:
 	io_uring_queue_exit(&ring);
 	close(sp[0]);
Signature · 1 line
2.37.2
#2 lore raw

PATCH 2/4 zc: adjust sendzc to the simpler uapi

In reply to Pavel Begunkov

We update the zerocopy API, reflect it in liburing, this includes removing the whole notification story, updating headers and fixing up tests.

---
 src/include/liburing.h          |  39 +-
 src/include/liburing/io_uring.h |  28 +-
 src/register.c                  |  20 --
 test/send-zerocopy.c            | 611 ++++----------------------------
 4 files changed, 91 insertions(+), 607 deletions(-)
src/include/liburing.h +7 -32
index 68a1646..c672440 100644
@@ -199,10 +199,6 @@ int io_uring_register_sync_cancel(struct io_uring *ring,
 int io_uring_register_file_alloc_range(struct io_uring *ring,
 					unsigned off, unsigned len);
 
-int io_uring_register_notifications(struct io_uring *ring, unsigned nr,
-				    struct io_uring_notification_slot *slots);
-int io_uring_unregister_notifications(struct io_uring *ring);
-
 /*
  * io_uring syscalls.
  */
@@ -702,44 +698,23 @@ static inline void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd,
 	sqe->msg_flags = (__u32) flags;
 }
 
-static inline void io_uring_prep_sendzc(struct io_uring_sqe *sqe, int sockfd,
-				        const void *buf, size_t len, int flags,
-				        unsigned slot_idx, unsigned zc_flags)
+static inline void io_uring_prep_send_zc(struct io_uring_sqe *sqe, int sockfd,
+					 const void *buf, size_t len, int flags,
+					 unsigned zc_flags)
 {
-	io_uring_prep_rw(IORING_OP_SENDZC_NOTIF, sqe, sockfd, buf, (__u32) len, 0);
+	io_uring_prep_rw(IORING_OP_SEND_ZC, sqe, sockfd, buf, (__u32) len, 0);
 	sqe->msg_flags = (__u32) flags;
-	sqe->notification_idx = slot_idx;
 	sqe->ioprio = zc_flags;
 }
 
-static inline void io_uring_prep_sendzc_fixed(struct io_uring_sqe *sqe, int sockfd,
-					      const void *buf, size_t len,
-					      int flags, unsigned slot_idx,
-					      unsigned zc_flags, unsigned buf_idx)
-{
-	io_uring_prep_sendzc(sqe, sockfd, buf, len, flags, slot_idx, zc_flags);
-	sqe->ioprio |= IORING_RECVSEND_FIXED_BUF;
-	sqe->buf_index = buf_idx;
-}
-
-static inline void io_uring_prep_sendzc_set_addr(struct io_uring_sqe *sqe,
-						 const struct sockaddr *dest_addr,
-						 __u16 addr_len)
+static inline void io_uring_prep_send_set_addr(struct io_uring_sqe *sqe,
+						const struct sockaddr *dest_addr,
+						__u16 addr_len)
 {
 	sqe->addr2 = (unsigned long)(void *)dest_addr;
 	sqe->addr_len = addr_len;
 }
 
-static inline void io_uring_prep_notif_update(struct io_uring_sqe *sqe,
-					      __u64 new_tag, /* 0 to ignore */
-					      unsigned offset, unsigned nr)
-{
-	io_uring_prep_rw(IORING_OP_FILES_UPDATE, sqe, -1, 0, nr,
-			 (__u64)offset);
-	sqe->addr = new_tag;
-	sqe->ioprio = IORING_RSRC_UPDATE_NOTIF;
-}
-
 static inline void io_uring_prep_recv(struct io_uring_sqe *sqe, int sockfd,
 				      void *buf, size_t len, int flags)
 {
src/include/liburing/io_uring.h +6 -22
index 9e0b5c8..6b83177 100644
@@ -71,8 +71,8 @@ struct io_uring_sqe {
 		__s32	splice_fd_in;
 		__u32	file_index;
 		struct {
-			__u16	notification_idx;
 			__u16	addr_len;
+			__u16	__pad3[1];
 		};
 	};
 	union {
@@ -178,8 +178,7 @@ enum io_uring_op {
 	IORING_OP_FALLOCATE,
 	IORING_OP_OPENAT,
 	IORING_OP_CLOSE,
-	IORING_OP_RSRC_UPDATE,
-	IORING_OP_FILES_UPDATE = IORING_OP_RSRC_UPDATE,
+	IORING_OP_FILES_UPDATE,
 	IORING_OP_STATX,
 	IORING_OP_READ,
 	IORING_OP_WRITE,
@@ -206,7 +205,7 @@ enum io_uring_op {
 	IORING_OP_GETXATTR,
 	IORING_OP_SOCKET,
 	IORING_OP_URING_CMD,
-	IORING_OP_SENDZC_NOTIF,
+	IORING_OP_SEND_ZC,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,
@@ -228,7 +227,6 @@ enum io_uring_op {
 #define IORING_TIMEOUT_ETIME_SUCCESS	(1U << 5)
 #define IORING_TIMEOUT_CLOCK_MASK	(IORING_TIMEOUT_BOOTTIME | IORING_TIMEOUT_REALTIME)
 #define IORING_TIMEOUT_UPDATE_MASK	(IORING_TIMEOUT_UPDATE | IORING_LINK_TIMEOUT_UPDATE)
-
 /*
  * sqe->splice_flags
  * extends splice(2) flags
@@ -281,29 +279,16 @@ enum io_uring_op {
  *
  * IORING_RECVSEND_FIXED_BUF	Use registered buffers, the index is stored in
  *				the buf_index field.
- *
- * IORING_RECVSEND_NOTIF_FLUSH	Flush a notification after a successful
- *				successful. Only for zerocopy sends.
  */
 #define IORING_RECVSEND_POLL_FIRST	(1U << 0)
 #define IORING_RECV_MULTISHOT		(1U << 1)
 #define IORING_RECVSEND_FIXED_BUF	(1U << 2)
-#define IORING_RECVSEND_NOTIF_FLUSH	(1U << 3)
 
 /*
  * accept flags stored in sqe->ioprio
  */
 #define IORING_ACCEPT_MULTISHOT	(1U << 0)
 
-
-/*
- * IORING_OP_RSRC_UPDATE flags
- */
-enum {
-	IORING_RSRC_UPDATE_FILES,
-	IORING_RSRC_UPDATE_NOTIF,
-};
-
 /*
  * IORING_OP_MSG_RING command types, stored in sqe->addr
  */
@@ -341,10 +326,13 @@ struct io_uring_cqe {
  * IORING_CQE_F_BUFFER	If set, the upper 16 bits are the buffer ID
  * IORING_CQE_F_MORE	If set, parent SQE will generate more CQE entries
  * IORING_CQE_F_SOCK_NONEMPTY	If set, more data to read after socket recv
+ * IORING_CQE_F_NOTIF	Set for notification CQEs. Can be used to distinct
+ * 			them from sends.
  */
 #define IORING_CQE_F_BUFFER		(1U << 0)
 #define IORING_CQE_F_MORE		(1U << 1)
 #define IORING_CQE_F_SOCK_NONEMPTY	(1U << 2)
+#define IORING_CQE_F_NOTIF		(1U << 3)
 
 enum {
 	IORING_CQE_BUFFER_SHIFT		= 16,
@@ -485,10 +473,6 @@ enum {
 	/* register a range of fixed file slots for automatic slot allocation */
 	IORING_REGISTER_FILE_ALLOC_RANGE	= 25,
 
-	/* zerocopy notification API */
-	IORING_REGISTER_NOTIFIERS		= 26,
-	IORING_UNREGISTER_NOTIFIERS		= 27,
-
 	/* this goes last */
 	IORING_REGISTER_LAST
 };
src/register.c +0 -20
index 7482112..2b37e5f 100644
@@ -364,23 +364,3 @@ int io_uring_register_file_alloc_range(struct io_uring *ring,
 				       IORING_REGISTER_FILE_ALLOC_RANGE, &range,
 				       0);
 }
-
-int io_uring_register_notifications(struct io_uring *ring, unsigned nr,
-				    struct io_uring_notification_slot *slots)
-{
-	struct io_uring_notification_register r = {
-		.nr_slots = nr,
-		.data = (unsigned long)slots,
-	};
-
-	return __sys_io_uring_register(ring->ring_fd,
-				       IORING_REGISTER_NOTIFIERS,
-				       &r, sizeof(r));
-}
-
-int io_uring_unregister_notifications(struct io_uring *ring)
-{
-	return __sys_io_uring_register(ring->ring_fd,
-				       IORING_UNREGISTER_NOTIFIERS,
-				       NULL, 0);
-}
test/send-zerocopy.c +78 -533

779 lines not on this page · raw message

Signature · 1 line
2.37.2
#3 lore raw

PATCH 3/4 test: test iowq zc sends

In reply to Pavel Begunkov

Add tests exercising io-wq paths with zc by setting IOSQE_ASYNC.

---
 test/send-zerocopy.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
test/send-zerocopy.c +6 -3
index 7b58ae7..8714b6f 100644
@@ -239,7 +239,7 @@ static int prepare_ip(struct sockaddr_storage *addr, int *sock_client, int *sock
 static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_server,
 			     bool fixed_buf, struct sockaddr_storage *addr,
 			     size_t send_size, bool cork, bool mix_register,
-			     int buf_idx)
+			     int buf_idx, bool force_async)
 {
 	const unsigned zc_flags = 0;
 	struct io_uring_sqe *sqe;
@@ -285,6 +285,8 @@ static int do_test_inet_send(struct io_uring *ring, int sock_client, int sock_se
 			io_uring_prep_send_set_addr(sqe, (const struct sockaddr *)addr,
 						    addr_len);
 		}
+		if (force_async)
+			sqe->flags |= IOSQE_ASYNC;
 	}
 
 	ret = io_uring_submit(ring);
@@ -389,7 +391,7 @@ static int test_inet_send(struct io_uring *ring)
 			return 1;
 		}
 
-		for (i = 0; i < 128; i++) {
+		for (i = 0; i < 256; i++) {
 			bool fixed_buf = i & 1;
 			struct sockaddr_storage *addr_arg = (i & 2) ? &addr : NULL;
 			size_t size = (i & 4) ? 137 : 4096;
@@ -398,6 +400,7 @@ static int test_inet_send(struct io_uring *ring)
 			bool aligned = i & 32;
 			bool large_buf = i & 64;
 			int buf_idx = aligned ? 0 : 1;
+			bool force_async = i & 128;
 
 			if (!tcp || !large_buf)
 				continue;
@@ -418,7 +421,7 @@ static int test_inet_send(struct io_uring *ring)
 
 			ret = do_test_inet_send(ring, sock_client, sock_server, fixed_buf,
 						addr_arg, size, cork, mix_register,
-						buf_idx);
+						buf_idx, force_async);
 			if (ret) {
 				fprintf(stderr, "send failed fixed buf %i, conn %i, addr %i, "
 					"cork %i\n",
Signature · 1 line
2.37.2
#4 lore raw

PATCH 4/4 examples: adjust zc bench to the new uapi

In reply to Pavel Begunkov
---
 examples/send-zerocopy.c | 72 +++++++++++++---------------------------
 1 file changed, 23 insertions(+), 49 deletions(-)
examples/send-zerocopy.c +23 -49
index e42aa71..4ed0f67 100644
@@ -44,7 +44,6 @@
 static bool cfg_reg_ringfd = true;
 static bool cfg_fixed_files = 1;
 static bool cfg_zc = 1;
-static bool cfg_flush = 0;
 static int  cfg_nr_reqs = 8;
 static bool cfg_fixed_buf = 1;
 
@@ -146,13 +145,6 @@ static void do_tx(int domain, int type, int protocol)
 	if (ret)
 		error(1, ret, "io_uring: queue init");
 
-	if (cfg_zc) {
-		struct io_uring_notification_slot b[1] = {{.tag = ZC_TAG}};
-
-		ret = io_uring_register_notifications(&ring, 1, b);
-		if (ret)
-			error(1, ret, "io_uring: tx ctx registration");
-	}
 	if (cfg_fixed_files) {
 		ret = io_uring_register_files(&ring, &fd, 1);
 		if (ret < 0)
@@ -175,14 +167,8 @@ static void do_tx(int domain, int type, int protocol)
 	do {
 		struct io_uring_sqe *sqe;
 		struct io_uring_cqe *cqe;
-		unsigned zc_flags = 0;
 		unsigned buf_idx = 0;
-		unsigned slot_idx = 0;
-		unsigned msg_flags = 0;
-
-		compl_cqes += cfg_flush ? cfg_nr_reqs : 0;
-		if (cfg_flush)
-			zc_flags |= IORING_RECVSEND_NOTIF_FLUSH;
+		unsigned msg_flags = MSG_WAITALL;
 
 		for (i = 0; i < cfg_nr_reqs; i++) {
 			sqe = io_uring_get_sqe(&ring);
@@ -190,22 +176,22 @@ static void do_tx(int domain, int type, int protocol)
 			if (!cfg_zc)
 				io_uring_prep_send(sqe, fd, payload,
 						   cfg_payload_len, 0);
-			else if (cfg_fixed_buf)
-				io_uring_prep_sendzc_fixed(sqe, fd, payload,
-							   cfg_payload_len,
-							   msg_flags, slot_idx,
-							   zc_flags, buf_idx);
-			else
-				io_uring_prep_sendzc(sqe, fd, payload,
-						     cfg_payload_len, msg_flags,
-						     slot_idx, zc_flags);
-
+			else {
+				io_uring_prep_send_zc(sqe, fd, payload,
+						     cfg_payload_len, msg_flags, 0);
+				if (cfg_fixed_buf) {
+					sqe->ioprio |= IORING_RECVSEND_FIXED_BUF;
+					sqe->buf_index = buf_idx;
+				}
+			}
 			sqe->user_data = 1;
 			if (cfg_fixed_files) {
 				sqe->fd = 0;
 				sqe->flags |= IOSQE_FIXED_FILE;
 			}
 		}
+		if (cfg_zc)
+			compl_cqes += cfg_nr_reqs;
 
 		ret = io_uring_submit(&ring);
 		if (ret != cfg_nr_reqs)
@@ -214,27 +200,26 @@ static void do_tx(int domain, int type, int protocol)
 		for (i = 0; i < cfg_nr_reqs; i++) {
 			cqe = wait_cqe_fast(&ring);
 
-			if (cqe->user_data == ZC_TAG) {
+			if (cqe->flags & IORING_CQE_F_NOTIF) {
+				if (cqe->flags & IORING_CQE_F_MORE)
+					error(1, -EINVAL, "F_MORE notif");
 				compl_cqes--;
 				i--;
-			} else if (cqe->user_data != 1) {
-				error(1, cqe->user_data, "invalid user_data");
-			} else if (cqe->res > 0) {
+			} else if (cqe->res >= 0) {
+				if (!(cqe->flags & IORING_CQE_F_MORE) && cfg_zc)
+					error(1, -EINVAL, "no F_MORE");
 				packets++;
 				bytes += cqe->res;
 			} else if (cqe->res == -EAGAIN) {
-				/* request failed, don't flush */
-				if (cfg_flush)
+				if (cfg_zc)
 					compl_cqes--;
-			} else if (cqe->res == -ECONNREFUSED ||
-				   cqe->res == -ECONNRESET ||
-				   cqe->res == -EPIPE) {
-				fprintf(stderr, "Connection failure\n");
+			} else if (cqe->res == -ECONNREFUSED || cqe->res == -EPIPE ||
+				   cqe->res == -ECONNRESET) {
+				fprintf(stderr, "Connection failure");
 				goto out_fail;
 			} else {
 				error(1, cqe->res, "send failed");
 			}
-
 			io_uring_cqe_seen(&ring, cqe);
 		}
 	} while (gettimeofday_ms() < tstop);
@@ -255,12 +240,6 @@ out_fail:
 		io_uring_cqe_seen(&ring, cqe);
 		compl_cqes--;
 	}
-
-	if (cfg_zc) {
-		ret = io_uring_unregister_notifications(&ring);
-		if (ret)
-			error(1, ret, "io_uring: tx ctx unregistration");
-	}
 	io_uring_queue_exit(&ring);
 }
 
@@ -276,7 +255,7 @@ static void do_test(int domain, int type, int protocol)
 
 static void usage(const char *filepath)
 {
-	error(1, 0, "Usage: %s [-f] [-n<N>] [-z0] [-s<payload size>] "
+	error(1, 0, "Usage: %s [-n<N>] [-z<val>] [-s<payload size>] "
 		    "(-4|-6) [-t<time s>] -D<dst_ip> udp", filepath);
 }
 
@@ -294,7 +273,7 @@ static void parse_opts(int argc, char **argv)
 
 	cfg_payload_len = max_payload_len;
 
-	while ((c = getopt(argc, argv, "46D:p:s:t:n:fz:b:k")) != -1) {
+	while ((c = getopt(argc, argv, "46D:p:s:t:n:z:b:k")) != -1) {
 		switch (c) {
 		case '4':
 			if (cfg_family != PF_UNSPEC)
@@ -323,9 +302,6 @@ static void parse_opts(int argc, char **argv)
 		case 'n':
 			cfg_nr_reqs = strtoul(optarg, NULL, 0);
 			break;
-		case 'f':
-			cfg_flush = 1;
-			break;
 		case 'z':
 			cfg_zc = strtoul(optarg, NULL, 0);
 			break;
@@ -337,8 +313,6 @@ static void parse_opts(int argc, char **argv)
 
 	if (cfg_nr_reqs > MAX_SUBMIT_NR)
 		error(1, 0, "-n: submit batch nr exceeds max (%d)", MAX_SUBMIT_NR);
-	if (cfg_flush && !cfg_zc)
-		error(1, 0, "cfg_flush should be used with zc only");
 	if (cfg_payload_len > max_payload_len)
 		error(1, 0, "-s: payload exceeds max (%d)", max_payload_len);
 
Signature · 1 line
2.37.2
#5 lore raw
In reply to Pavel Begunkov
Quoted 7 lines · Pavel Begunkov

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
tests: verify that send addr is copied when async
zc: adjust sendzc to the simpler uapi
test: test iowq zc sends
examples: adjust zc bench to the new uapi

Hi Pavel,

Patch #2 and #3 are broken, but after applying patch #4, everything builds just fine. Please resend and avoid breakage in the middle.

Thanks!

--------------------------------------------------------------------------------
Patch #2

send-zerocopy.c:152:9: error: call to undeclared function 'io_uring_register_notifications'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

                  ret = io_uring_register_notifications(&ring, 1, b);
                        ^
  send-zerocopy.c:152:9: note: did you mean 'io_uring_register_restrictions'?
  ../src/include/liburing.h:181:5: note: 'io_uring_register_restrictions' declared here
  int io_uring_register_restrictions(struct io_uring *ring,
      ^
  send-zerocopy.c:185:16: error: use of undeclared identifier 'IORING_RECVSEND_NOTIF_FLUSH'
                          zc_flags |= IORING_RECVSEND_NOTIF_FLUSH;
                                      ^
  send-zerocopy.c:194:5: error: call to undeclared function 'io_uring_prep_sendzc_fixed'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                  io_uring_prep_sendzc_fixed(sqe, fd, payload,
                                  ^
  send-zerocopy.c:194:5: note: did you mean 'io_uring_prep_read_fixed'?
  ../src/include/liburing.h:405:20: note: 'io_uring_prep_read_fixed' declared here
  static inline void io_uring_prep_read_fixed(struct io_uring_sqe *sqe, int fd,
                     ^
  send-zerocopy.c:199:5: error: call to undeclared function 'io_uring_prep_sendzc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                  io_uring_prep_sendzc(sqe, fd, payload,
                                  ^
  send-zerocopy.c:199:5: note: did you mean 'io_uring_prep_send_zc'?
  ../src/include/liburing.h:701:20: note: 'io_uring_prep_send_zc' declared here
  static inline void io_uring_prep_send_zc(struct io_uring_sqe *sqe, int sockfd,
                     ^
  send-zerocopy.c:260:9: error: call to undeclared function 'io_uring_unregister_notifications'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                  ret = io_uring_unregister_notifications(&ring);
                        ^
  send-zerocopy.c:260:9: note: did you mean 'io_uring_register_restrictions'?
  ../src/include/liburing.h:181:5: note: 'io_uring_register_restrictions' declared here
  int io_uring_register_restrictions(struct io_uring *ring,
      ^

5 errors generated.
make[1]: *** [Makefile:36: send-zerocopy] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/runner/work/liburing/liburing/examples'
make: *** [Makefile:12: all] Error 2
Error: Process completed with exit code 2.

--------------------------------------------------------------------------------
Patch #3:

send-zerocopy.c: In function ‘do_tx’:
send-zerocopy.c:152:23: error: implicit declaration of function ‘io_uring_register_notifications’; did you mean ‘io_uring_register_restrictions’? [-Werror=implicit-function-declaration]

    152 |                 ret = io_uring_register_notifications(&ring, 1, b);
        |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        |                       io_uring_register_restrictions
  send-zerocopy.c:185:37: error: ‘IORING_RECVSEND_NOTIF_FLUSH’ undeclared (first use in this function); did you mean ‘IORING_RECVSEND_POLL_FIRST’?
    185 |                         zc_flags |= IORING_RECVSEND_NOTIF_FLUSH;
        |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        |                                     IORING_RECVSEND_POLL_FIRST
  send-zerocopy.c:185:37: note: each undeclared identifier is reported only once for each function it appears in
  send-zerocopy.c:194:33: error: implicit declaration of function ‘io_uring_prep_sendzc_fixed’; did you mean ‘io_uring_prep_read_fixed’? [-Werror=implicit-function-declaration]
    194 |                                 io_uring_prep_sendzc_fixed(sqe, fd, payload,
        |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
        |                                 io_uring_prep_read_fixed
  send-zerocopy.c:199:33: error: implicit declaration of function ‘io_uring_prep_sendzc’; did you mean ‘io_uring_prep_send_zc’? [-Werror=implicit-function-declaration]
    199 |                                 io_uring_prep_sendzc(sqe, fd, payload,
        |                                 ^~~~~~~~~~~~~~~~~~~~
        |                                 io_uring_prep_send_zc
  send-zerocopy.c:260:23: error: implicit declaration of function ‘io_uring_unregister_notifications’; did you mean ‘io_uring_register_restrictions’? [-Werror=implicit-function-declaration]
    260 |                 ret = io_uring_unregister_notifications(&ring);
        |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        |                       io_uring_register_restrictions

cc1: all warnings being treated as errors
make[1]: *** [Makefile:36: send-zerocopy] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/runner/work/liburing/liburing/examples'
make: *** [Makefile:12: all] Error 2
Error: Process completed with exit code 2.

Signature · 1 line
Ammar Faizi
maintainer Applied
#10 lore raw
In reply to Pavel Begunkov
Quoted 9 lines · Pavel Begunkov

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
tests: verify that send addr is copied when async
zc: adjust sendzc to the simpler uapi
test: test iowq zc sends
examples: adjust zc bench to the new uapi

[...]

Applied, thanks!

[1/4] tests: verify that send addr is copied when async

      commit: 54b16e6cfa489edd1f4f538ae245d98d65d42db7
[2/4] zc: adjust sendzc to the simpler uapi
      commit: 880a932c8ae36506b4d5040b9258a91251164589
[3/4] test: test iowq zc sends
      commit: 713ecf1cf9ad58ceb19893eead2b704b27367a8a
[4/4] examples: adjust zc bench to the new uapi
      commit: 860db521db4c86a1cb5d0b672a8fba83a89f01f0

Best regards,

Signature · 1 line
Jens Axboe
#6 lore raw
In reply to Ammar Faizi
Quoted 9 lines · Ammar Faizi
Quoted 7 lines · Pavel Begunkov

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
   tests: verify that send addr is copied when async
   zc: adjust sendzc to the simpler uapi
   test: test iowq zc sends
   examples: adjust zc bench to the new uapi

Quoted 6 lines

Hi Pavel,

Patch #2 and #3 are broken, but after applying patch #4, everything builds just fine. Please resend and avoid breakage in the middle.

Thanks!

Nevermind. It's already upstream now.

Signature · 1 line
Ammar Faizi
maintainer
#7 lore raw
Quoted 10 lines · Ammar Faizi
Quoted 9 lines · Ammar Faizi
Quoted 7 lines · Pavel Begunkov

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
   tests: verify that send addr is copied when async
   zc: adjust sendzc to the simpler uapi
   test: test iowq zc sends
   examples: adjust zc bench to the new uapi

Quoted 8 lines
Quoted 6 lines

Hi Pavel,

Patch #2 and #3 are broken, but after applying patch #4, everything builds just fine. Please resend and avoid breakage in the middle.

Thanks!

Nevermind. It's already upstream now.

Ah shoot, how did I miss that... That's annoying.

Signature · 1 line
Jens Axboe
#8 lore raw
Quoted 13 lines · Jens Axboe
Quoted 12 lines · Ammar Faizi
Quoted 11 lines · Ammar Faizi
Quoted 7 lines · Pavel Begunkov

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
   tests: verify that send addr is copied when async
   zc: adjust sendzc to the simpler uapi
   test: test iowq zc sends
   examples: adjust zc bench to the new uapi

Hi Pavel,

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Patch #2 and #3 are broken, but after applying patch #4, everything builds just fine. Please resend and avoid breakage in the middle.

Thanks!

Nevermind. It's already upstream now.

Ah shoot, how did I miss that... That's annoying.

We can squash them into a single commit if we care about it. Don't really want do the disable + fix +e nable dancing here.

Signature · 1 line
Pavel Begunkov
maintainer
#9 lore raw
Quoted 17 lines · Pavel Begunkov
Quoted 16 lines · Jens Axboe
Quoted 15 lines · Ammar Faizi
Quoted 14 lines · Ammar Faizi
Quoted 7 lines · Pavel Begunkov

Fix up helpers and tests to match API changes and also add some more tests.

Pavel Begunkov (4):
??? tests: verify that send addr is copied when async ??? zc: adjust sendzc to the simpler uapi
??? test: test iowq zc sends
??? examples: adjust zc bench to the new uapi

Hi Pavel,

Patch #2 and #3 are broken, but after applying patch #4, everything builds just fine. Please resend and avoid breakage in the middle.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Thanks!

Nevermind. It's already upstream now.

Ah shoot, how did I miss that... That's annoying.

We can squash them into a single commit if we care about it. Don't really want do the disable + fix +e nable dancing here.

It's already pushed out, so whatever is there is set in stone... Not a huge deal, but would've been nice to avoid. It's problematic when someone needs to bisect and issue and runs into a non-compiling step. Makes that process a lot more annoying, so yes we definitely do care about not introducing build breakage in a series of patches.

Signature · 1 line
Jens Axboe