summaryrefslogtreecommitdiffstats
path: root/io_uring/net.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2024-08-08 18:42:18 +0200
committerJens Axboe <axboe@kernel.dk>2024-08-25 16:27:01 +0200
commit566a424212d79b90e3a8fe6b5c7bd8f69174105c (patch)
treead85e3e189a0d5bc6d24f3534fc3c8368bf8a4e0 /io_uring/net.c
parentio_uring/kbuf: use 'bl' directly rather than req->buf_list (diff)
downloadlinux-566a424212d79b90e3a8fe6b5c7bd8f69174105c.tar.xz
linux-566a424212d79b90e3a8fe6b5c7bd8f69174105c.zip
io_uring/net: use ITER_UBUF for single segment send maps
Just like what is being done on the recv side, if we only map a single segment, then use ITER_UBUF for mapping it. That's more efficient than using an ITER_IOVEC. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/net.c')
-rw-r--r--io_uring/net.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/io_uring/net.c b/io_uring/net.c
index d08abcca89cc..dc83a35b8af4 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -618,14 +618,23 @@ retry_bundle:
if (unlikely(ret < 0))
return ret;
- sr->len = arg.out_len;
- iov_iter_init(&kmsg->msg.msg_iter, ITER_SOURCE, arg.iovs, ret,
- arg.out_len);
if (arg.iovs != &kmsg->fast_iov && arg.iovs != kmsg->free_iov) {
kmsg->free_iov_nr = ret;
kmsg->free_iov = arg.iovs;
req->flags |= REQ_F_NEED_CLEANUP;
}
+ sr->len = arg.out_len;
+
+ if (ret == 1) {
+ sr->buf = arg.iovs[0].iov_base;
+ ret = import_ubuf(ITER_SOURCE, sr->buf, sr->len,
+ &kmsg->msg.msg_iter);
+ if (unlikely(ret))
+ return ret;
+ } else {
+ iov_iter_init(&kmsg->msg.msg_iter, ITER_SOURCE,
+ arg.iovs, ret, arg.out_len);
+ }
}
/*