34 Commits

Author SHA1 Message Date
fangzhiyi18 0ae77b95ef 升级2.7
Signed-off-by: fangzhiyi18 <fangzhiyi1@huawei.com>
2024-10-21 02:53:20 +00:00
Dylan Yudaken c393e7cf86 add io_uring_buf_ring_init
Kernel expects the tail to start at 0, so provide an API to init the
ring appropriately.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-13 07:58:11 -06:00
Dylan Yudaken 5f9468a3e0 add mask parameter to io_uring_buf_ring_add
Without the mask parameter, it's not feasible to use this API without
knowing where the tail is and performing some arithmetic

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-06-13 07:58:10 -06:00
Jens Axboe 382a6a2071 Change io_uring_buf_ring_add() to take ring and buffer offset
Start inserting at tail + offset passed in, this is more natural than
having to index the buffer from the application.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-18 14:24:46 -06:00
Jens Axboe 697e926036 Change io_uring_register_buf_ring() to take a flags argument
Unused so far, but future proofing so we can add some if needed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-18 14:24:46 -06:00
Jens Axboe 40ba16cfe5 Add combined cq+buf ring advance helper
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-18 14:24:09 -06:00
Jens Axboe 0edd213ea4 test/send_recvmsg.c: use buffer ring helpers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-18 14:24:03 -06:00
Jens Axboe f816d1d5fb test/send_recvmsg: add buffer ring test cases
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-18 14:24:03 -06:00
Jens Axboe 8afeaa315f test/send_recvmsg.c: only check buffer group ID if set
This test assumes that the only valid flag being set for a send/recv
is IORING_CQE_F_BUFFER. But that isn't necessarily true, so check
specifically for whether this is a provided buffer return before checking
the buffer group ID.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14 15:44:40 -06:00
Dylan Yudaken 97b8313ede test: use unique ports
In preparation for running tests in parallel remove some collisions in
ports. In the future this should probably use ephemeral ports, but for now
there are not too many places to change.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220422160132.2891927-4-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22 11:18:08 -06:00
nick black 197c685fea remove double casts
Signed-off-by: nick black <nickblack@linux.com>
2022-04-04 10:59:19 -04:00
Jens Axboe 396a835aaf test/send_recvmsg: drop mutex on thread creation failure
Fixes: https://github.com/axboe/liburing/issues/382
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-07-15 12:12:16 -06:00
Pavel Begunkov ce2e71b316 test: long iov recvmsg()/copy
Pass in a long iov (larger than on-stack cache)  to test that it's
allocated correctly, and copied well if inline execution failed with
-EAGAIN.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-11-16 09:30:52 -07:00
Paymon MARANDI be11f769b9 test: check return of io_uring_get_sqe() 2020-07-14 13:20:59 -04:00
Jens Axboe d99b222de2 test: various missing return checks from io_uring_wait_cqe()
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-30 09:58:23 -06:00
Jens Axboe 6c32e92bb0 test: add potential argument, ignore if unused
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-19 17:36:19 -06:00
Jens Axboe 0e5568c707 Fix 32-bit warnings on compile
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-04-24 07:47:50 -06:00
Jens Axboe 293330b078 Change 'gid' to 'bgid' for providing buffers
This makes it clear it's a buffer group ID, and not some variant of
a credential related group ID.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-03-11 07:50:04 -06:00
Jens Axboe 5afe10ef3b test/send_recvmsg: cleanup on abort
If we don't have PROVIDE_BUFFERS, then ensure we free the ring, and
(more importantly) up the mutex so we don't hang.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-03-02 21:48:46 -07:00
Jens Axboe 5e0cf0909a test/send_recvmsg: ensure that we get -ENOBUFS for no buffers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-29 12:11:21 -07:00
Jens Axboe c552f6c020 test/send_recvmsg: add missing socket close
This is especially important as we're now running two tests, and we
don't want to leave one lingering and interfering.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-28 14:39:38 -07:00
Jens Axboe cf77a51286 test/send_recvmsg: add support for BUF_SELECT
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-27 16:59:49 -07:00
Guillem Jover a72c2db426 test: Handle NULL sqe and cqe in tests
We need to check the return values from io_uring_queue_init() and
recv_prep() or we will be passing a NULL sqe to io_uring_get_sqe(),
or a NULL cge to io_uring_wait_cqe().

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2020-02-14 14:39:28 +01:00
Guillem Jover 9502d6d646 test: Unify queue init failed error message
Signed-off-by: Guillem Jover <guillem@hadrons.org>
2020-02-14 14:39:28 +01:00
Jens Axboe e502435779 Add SPDX license identifiers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-11 20:34:12 -07:00
Jens Axboe a8dc4979d5 Use stderr consistently in test/ cases
This is a start, still some to go. The goal here is to ensure that we
use stderr consistently for errors, and include the error value as well.
Right now folks copy/paste test cases (which they should), but that
also means they should be doing the right thing so we don't keep adding
test cases that just use stdout for errors, or don't include the error
value.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-01 09:58:07 -07:00
Carter Li 6c0bb68b57 test: add test for send_recv
Also ensure that `test/send_recvmsg.c` the recv thread finishs
before the process exits

Signed-off-by: Carter Li <carter.li@eoitek.com>
2020-02-02 00:17:30 +08:00
Jens Axboe a769aa109c test/send_recvmsg: hopefully make it reliable
Split the recv part in prep, sync, then receive. This should make it
more reliable, hopefully.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-24 19:17:58 -06:00
Jens Axboe 1c8734fd8d test/send_recvmsg: ensure we exit
We may never get the data from the socket read, and this requires
someone to SIGINT the test. Let's quit after 1 second if we haven't
received anything. If the test is actually hung, the alive worker
detection will catch it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-24 16:34:31 -06:00
李通洲 6e68fda171 liburing: add io_uring_prep_{recv,send}msg 2019-09-16 11:42:00 +08:00
Stefan Hajnoczi c31c7ec4bc src/Makefile: keep private headers in <liburing/*.h>
It is not possible to install barrier.h and compat.h into the top-level
/usr/include directly since they are likely to conflict with other
software.  io_uring.h could be confused with the system's kernel header
file.

Put liburing headers into <liburing/*.h> so there is no chance of
conflicts or confusion.

Existing applications continue to build successfully since the location
of <liburing.h> is unchanged.  In-tree examples and tests require
modification because src/liburing.h is moved to src/include/liburing.h.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-24 09:11:44 -06:00
Bart Van Assche 3036ba1217 Fix the 32-bit build
Fix the warnings reported when building liburing as follows:

make CFLAGS=-m32

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-08 15:25:58 -06:00
Jens Axboe d672969583 test/send_recvmsg: code cleanups and error handling
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-24 09:04:17 -06:00
Jens Axboe 5d1e32e44b Add send/recvmsg test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-23 22:51:10 -06:00