public inbox for [email protected]
 help / color / mirror / Atom feed
* [RFC PATCH liburing v1 0/2] io_uring sendto
@ 2023-04-15 16:58 Ammar Faizi
  2023-04-15 16:58 ` [RFC PATCH liburing v1 1/2] liburing: Add `io_uring_prep_sendto()` Ammar Faizi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ammar Faizi @ 2023-04-15 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Ammar Faizi, Pavel Begunkov, Alviro Iskandar Setiawan,
	io-uring Mailing List, Linux Kernel Mailing List,
	GNU/Weeb Mailing List

Hi Jens,

There are two patches in this series. The first patch adds
io_uring_prep_sendto() function. The second patch addd the
manpage and CHANGELOG.

Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---

Ammar Faizi (2):
  liburing: Add `io_uring_prep_sendto()`
  man: Add `io_uring_prep_sendto()`

 CHANGELOG                  |  1 +
 man/io_uring_prep_send.3   | 31 +++++++++++++++++++++++++++++++
 man/io_uring_prep_sendto.3 |  1 +
 src/include/liburing.h     | 25 +++++++++++++++++--------
 src/liburing-ffi.map       |  1 +
 5 files changed, 51 insertions(+), 8 deletions(-)
 create mode 120000 man/io_uring_prep_sendto.3


base-commit: 4fed79510a189cc7997f6d04855ebf7fb66cc323
-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC PATCH liburing v1 1/2] liburing: Add `io_uring_prep_sendto()`
  2023-04-15 16:58 [RFC PATCH liburing v1 0/2] io_uring sendto Ammar Faizi
@ 2023-04-15 16:58 ` Ammar Faizi
  2023-04-15 16:58 ` [RFC PATCH liburing v1 2/2] man: " Ammar Faizi
  2023-04-15 20:37 ` [RFC PATCH liburing v1 0/2] io_uring sendto Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ammar Faizi @ 2023-04-15 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Ammar Faizi, Pavel Begunkov, Alviro Iskandar Setiawan,
	io-uring Mailing List, Linux Kernel Mailing List,
	GNU/Weeb Mailing List

A sendto(2) request can be done using:

   io_uring_prep_send() + io_uring_prep_send_set_addr()

Create a wrapper function, io_uring_prep_sendto().

Signed-off-by: Ammar Faizi <[email protected]>
---
 src/include/liburing.h | 25 +++++++++++++++++--------
 src/liburing-ffi.map   |  1 +
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index fbc65b60788a4d44..70c177431faf9f75 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -758,6 +758,23 @@ IOURINGINLINE void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd,
 	sqe->msg_flags = (__u32) flags;
 }
 
+IOURINGINLINE void io_uring_prep_send_set_addr(struct io_uring_sqe *sqe,
+						const struct sockaddr *dest_addr,
+						__u16 addr_len)
+{
+	sqe->addr2 = (unsigned long)(const void *)dest_addr;
+	sqe->addr_len = addr_len;
+}
+
+IOURINGINLINE void io_uring_prep_sendto(struct io_uring_sqe *sqe, int sockfd,
+					const void *buf, size_t len, int flags,
+					const struct sockaddr *addr,
+					socklen_t addrlen)
+{
+	io_uring_prep_send(sqe, sockfd, buf, len, flags);
+	io_uring_prep_send_set_addr(sqe, addr, addrlen);
+}
+
 IOURINGINLINE void io_uring_prep_send_zc(struct io_uring_sqe *sqe, int sockfd,
 					 const void *buf, size_t len, int flags,
 					 unsigned zc_flags)
@@ -786,14 +803,6 @@ IOURINGINLINE void io_uring_prep_sendmsg_zc(struct io_uring_sqe *sqe, int fd,
 	sqe->opcode = IORING_OP_SENDMSG_ZC;
 }
 
-IOURINGINLINE void io_uring_prep_send_set_addr(struct io_uring_sqe *sqe,
-						const struct sockaddr *dest_addr,
-						__u16 addr_len)
-{
-	sqe->addr2 = (unsigned long)(const void *)dest_addr;
-	sqe->addr_len = addr_len;
-}
-
 IOURINGINLINE void io_uring_prep_recv(struct io_uring_sqe *sqe, int sockfd,
 				      void *buf, size_t len, int flags)
 {
diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map
index c971bf8c858f3005..0a5e12ca764a2a1e 100644
--- a/src/liburing-ffi.map
+++ b/src/liburing-ffi.map
@@ -170,6 +170,7 @@ LIBURING_2.4 {
 		io_uring_prep_msg_ring_cqe_flags;
 		io_uring_prep_msg_ring_fd;
 		io_uring_prep_msg_ring_fd_alloc;
+		io_uring_prep_sendto;
 	local:
 		*;
 };
-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC PATCH liburing v1 2/2] man: Add `io_uring_prep_sendto()`
  2023-04-15 16:58 [RFC PATCH liburing v1 0/2] io_uring sendto Ammar Faizi
  2023-04-15 16:58 ` [RFC PATCH liburing v1 1/2] liburing: Add `io_uring_prep_sendto()` Ammar Faizi
@ 2023-04-15 16:58 ` Ammar Faizi
  2023-04-15 20:37 ` [RFC PATCH liburing v1 0/2] io_uring sendto Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ammar Faizi @ 2023-04-15 16:58 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Ammar Faizi, Pavel Begunkov, Alviro Iskandar Setiawan,
	io-uring Mailing List, Linux Kernel Mailing List,
	GNU/Weeb Mailing List

Signed-off-by: Ammar Faizi <[email protected]>
---
 CHANGELOG                  |  1 +
 man/io_uring_prep_send.3   | 31 +++++++++++++++++++++++++++++++
 man/io_uring_prep_sendto.3 |  1 +
 3 files changed, 33 insertions(+)
 create mode 120000 man/io_uring_prep_sendto.3

diff --git a/CHANGELOG b/CHANGELOG
index 85e02a280d4a7c45..71ca3919e114d858 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@ liburing-2.4 release
   io_uring_prep_openat2_direct(), io_uring_prep_msg_ring_fd(), and
   io_uring_prep_socket_direct() factor in being called with
   IORING_FILE_INDEX_ALLOC for allocating a direct descriptor.
+- Add io_uring_prep_sendto() function.
 
 liburing-2.3 release
 
diff --git a/man/io_uring_prep_send.3 b/man/io_uring_prep_send.3
index 3bdc96751ebfb230..b555ec3a8548c449 100644
--- a/man/io_uring_prep_send.3
+++ b/man/io_uring_prep_send.3
@@ -14,6 +14,14 @@ io_uring_prep_send \- prepare a send request
 .BI "                        const void *" buf ","
 .BI "                        size_t " len ","
 .BI "                        int " flags ");"
+.PP
+.BI "void io_uring_prep_sendto(struct io_uring_sqe *" sqe ","
+.BI "                          int " sockfd ","
+.BI "                          const void *" buf ","
+.BI "                          size_t " len ","
+.BI "                          int " flags ","
+.BI "                          const struct sockaddr *" addr ","
+.BI "                          socklen_t " addrlen ");"
 .fi
 .SH DESCRIPTION
 .PP
@@ -43,6 +51,28 @@ This function prepares an async
 .BR send (2)
 request. See that man page for details.
 
+The
+.BR io_uring_prep_sendto (3)
+function prepares a sendto request. The submission queue entry
+.I sqe
+is setup to use the file descriptor
+.I sockfd
+to start sending the data from
+.I buf
+of size
+.I len
+bytes and with modifier flags
+.IR flags .
+The destination address is specified by
+.I addr
+and
+.I addrlen
+and must be a valid address for the socket type.
+
+This function prepares an async
+.BR sendto (2)
+request. See that man page for details.
+
 .SH RETURN VALUE
 None
 .SH ERRORS
@@ -64,3 +94,4 @@ field.
 .BR io_uring_get_sqe (3),
 .BR io_uring_submit (3),
 .BR send (2)
+.BR sendto (2)
diff --git a/man/io_uring_prep_sendto.3 b/man/io_uring_prep_sendto.3
new file mode 120000
index 0000000000000000..ba85e68453fe6dcb
--- /dev/null
+++ b/man/io_uring_prep_sendto.3
@@ -0,0 +1 @@
+io_uring_prep_send.3
\ No newline at end of file
-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH liburing v1 0/2] io_uring sendto
  2023-04-15 16:58 [RFC PATCH liburing v1 0/2] io_uring sendto Ammar Faizi
  2023-04-15 16:58 ` [RFC PATCH liburing v1 1/2] liburing: Add `io_uring_prep_sendto()` Ammar Faizi
  2023-04-15 16:58 ` [RFC PATCH liburing v1 2/2] man: " Ammar Faizi
@ 2023-04-15 20:37 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2023-04-15 20:37 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Pavel Begunkov, Alviro Iskandar Setiawan, io-uring Mailing List,
	Linux Kernel Mailing List, GNU/Weeb Mailing List

On 4/15/23 10:58 AM, Ammar Faizi wrote:
> Hi Jens,
> 
> There are two patches in this series. The first patch adds
> io_uring_prep_sendto() function. The second patch addd the
> manpage and CHANGELOG.

Looks fine to me.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-15 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-15 16:58 [RFC PATCH liburing v1 0/2] io_uring sendto Ammar Faizi
2023-04-15 16:58 ` [RFC PATCH liburing v1 1/2] liburing: Add `io_uring_prep_sendto()` Ammar Faizi
2023-04-15 16:58 ` [RFC PATCH liburing v1 2/2] man: " Ammar Faizi
2023-04-15 20:37 ` [RFC PATCH liburing v1 0/2] io_uring sendto Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox