RFC io_uring: Add sendto(2) and recvfrom(2) support
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 RFC Latest3 patches 5 repliesIn review
- v2 RFC3 patches 0 repliesSuperseded
- v1 RFC3 patches 0 repliesSuperseded
Changes in v3 from the cover letter
- Fix build error when CONFIG_NET is undefined for PATCH 1/3. I tried to fix it in PATCH 3/3, but it should be fixed in PATCH 1/3, otherwise it breaks the build in PATCH 1/3.
- Added io_uring_prep_{sendto,recvfrom} docs to the liburing.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | io_uring: Rename `io_{send,recv}` to `io_{sendto,recvfrom}`fs/ | +6 | 0 replies | |
| 2/3 | net: Make `move_addr_to_user()` be a non static functioninclude/ net/ | +4 | 0 replies | |
| 3/3 | io_uring: Add `sendto(2)` and `recvfrom(2)` supportfs/ include/ | +78 | 5 replies |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by.
| Patch | Nugra |
|---|---|
| 1/3 | |
| 2/3 | |
| 3/3 | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [RFC PATCH v3 0/3] io_uring: Add sendto(2) and recvfrom(2) support
Hello,
This RFC patchset adds sendto(2) and recvfrom(2) support for io_uring. It also addresses an issue in the liburing GitHub repository [1].
## Motivations:
1) By using sendto() and recvfrom() we can make the submission simpler compared to always using sendmsg() and recvmsg() from the userspace.
2) There is a historical patch that tried to add the same functionality, but did not end up being applied. [2]
Quoted 6 lines · Jens Axboe
In a private conversation with the author, a good point was brought up that the sendto/recvfrom do not require an allocation of an async context, if we need to defer or go async with the request. I think that's a major win, to be honest. There are other benefits as well (like shorter path), but to me, the async less part is nice and will reduce overhead
## Changes summary
There are 3 patches in this series.
PATCH 1/3 renames io_recv to io_recvfrom and io_send to io_sendto. Note that
send(sockfd, buf, len, flags);
is equivalent to
sendto(sockfd, buf, len, flags, NULL, 0);
and
recv(sockfd, buf, len, flags);
is equivalent to
recvfrom(sockfd, buf, len, flags, NULL, NULL);
So it is saner to have send and recv directed to sendto and recvfrom instead of the opposite with respect to the name.
PATCH 2/3 makes move_addr_to_user() be a non static function. This function lives in net/socket.c, we need to call this from io_uring to add recvfrom() support for liburing. Added net files maintainers to the CC list.
PATCH 3/3 adds sendto(2) and recvfrom(2) support for io_uring. Added two new opcodes: IORING_OP_SENDTO and IORING_OP_RECVFROM.
## How to test
This patchset is based on "for-next" branch commit:
bb3294e22482db4b7ec7cfbb2d0f5b53c1adcf86 ("Merge branch 'for-5.17/drivers' into for-next")
It is also available in the Git repository at:
https://github.com/ammarfaizi2/linux-block ammarfaizi2/linux-block/io_uring-recvfrom-sendto
I also added the liburing support and test. The liburing support is based on "xattr-getdents64" branch commit:
55a9bf979f27f3a5c9f456f26dcfe16c4791667b ("src/include/liburing.h: style cleanups")
It is available in the Git repository at:
https://github.com/ammarfaizi2/liburing sendto-recvfrom
---
v3:
- Fix build error when CONFIG_NET is undefined for PATCH 1/3. I tried to fix it in PATCH 3/3, but it should be fixed in PATCH 1/3, otherwise it breaks the build in PATCH 1/3.
- Added io_uring_prep_{sendto,recvfrom} docs to the liburing.
v2:
- Rebased the work, now this patchset is based on commit
bb3294e22482db4b7ec ("Merge branch 'for-5.17/drivers' into
for-next"). - In io_recvfrom(), mark the error check of move_addr_to_user() call as unlikely.
- Fix build error when CONFIG_NET is undefined.
- Update liburing test (the branch is still the same, just force pushed).
- Added Nugra to CC list (tester).
---
RFC v2: https://lore.kernel.org/io-uring/[email protected]/
RFC v1: https://lore.kernel.org/io-uring/[email protected]/
---
Ammar Faizi (3):
io_uring: Rename io_{send,recv} to io_{sendto,recvfrom}
net: Make move_addr_to_user() be a non static function
io_uring: Add sendto(2) and recvfrom(2) support
fs/io_uring.c | 92 +++++++++++++++++++++++++++++++---- include/linux/socket.h | 2 + include/uapi/linux/io_uring.h | 2 + net/socket.c | 4 +- 4 files changed, 88 insertions(+), 12 deletions(-)
base-commit: bb3294e22482db4b7ec7cfbb2d0f5b53c1adcf86
Signature · 1 line
Ammar Faizi