mbox series

[0/5] io_uring: support IORING_OP_BIND and IORING_OP_LISTEN

Message ID 20240531211211.12628-1-krisman@suse.de (mailing list archive)
Headers show
Series io_uring: support IORING_OP_BIND and IORING_OP_LISTEN | expand

Message

Gabriel Krisman Bertazi May 31, 2024, 9:12 p.m. UTC
Following a discussion at LSFMM, this patchset introduces two new
io_uring operations for bind(2) and listen(2).

The goal is to provide functional parity of registered files and direct
file descriptors with regular fds for io_uring network operations.  The
cool outcome is that we can kickstart a network server solely with
io_uring operations.

This feature has been requested several times in the past, including
at:

  https://github.com/axboe/liburing/issues/941

Regarding parameter organization within the SQE, specifically for
bind(2), I'm following the implementation of IO_RING_CONECT.  So, even
though addr_len is expected to be an integer in the original syscall, I
pass it through addr2, to match IO_RING_CONNECT.  Other than that, the
implementation is quite straightforward.

Patchset 1 fixes a memleak in IO_RING_CONNECT that you might want to
apply ahead of the rest of the patchset; Patches 2 and 3 adapt the net/
side in preparation to support invocations from io_uring; patch 4 and 5
add the io_uring boilerplate.

I wrote liburing support, including tests. I'll follow with those
patches shortly.

Gabriel Krisman Bertazi (5):
  io_uring: Fix leak of async data when connect prep fails
  net: Split a __sys_bind helper for io_uring
  net: Split a __sys_listen helper for io_uring
  io_uring: Introduce IORING_OP_BIND
  io_uring: Introduce IORING_OP_LISTEN

 include/linux/socket.h        |  3 ++
 include/uapi/linux/io_uring.h |  2 +
 io_uring/net.c                | 78 ++++++++++++++++++++++++++++++++++-
 io_uring/net.h                |  6 +++
 io_uring/opdef.c              | 26 ++++++++++++
 net/socket.c                  | 48 +++++++++++++--------
 6 files changed, 144 insertions(+), 19 deletions(-)