selftests/bpf/sockopt: Add io_uring support for-6.7/io_uring-sockopt for-6.7/io_uring-sockopt-2023-10-30
authorBreno Leitao <leitao@debian.org>
Mon, 16 Oct 2023 13:47:49 +0000 (06:47 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 19 Oct 2023 22:42:04 +0000 (16:42 -0600)
commitb9ec913212e6e91efa5a0a612c4a8ec4cf5da896
tree6cea837326eae4029a0e8afefcb1527115d75dfe
parent4232c6e349f3a591fd0f432e6b858d32095adce6
selftests/bpf/sockopt: Add io_uring support

Expand the sockopt test to use also check for io_uring {g,s}etsockopt
commands operations.

This patch starts by marking each test if they support io_uring support
or not.

Right now, io_uring cmd getsockopt() has a limitation of only
accepting level == SOL_SOCKET, otherwise it returns -EOPNOTSUPP. Since
there aren't any test exercising getsockopt(level == SOL_SOCKET), this
patch changes two tests to use level == SOL_SOCKET, they are
"getsockopt: support smaller ctx->optlen" and "getsockopt: read
ctx->optlen".
There is no limitation for the setsockopt() part.

Later, each test runs using regular {g,s}etsockopt systemcalls, and, if
liburing is supported, execute the same test (again), but calling
liburing {g,s}setsockopt commands.

This patch also changes the level of two tests to use SOL_SOCKET for the
following two tests. This is going to help to exercise the io_uring
subsystem:
 * getsockopt: read ctx->optlen
 * getsockopt: support smaller ctx->optlen

Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://lore.kernel.org/r/20231016134750.1381153-12-leitao@debian.org
Acked-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
tools/testing/selftests/bpf/prog_tests/sockopt.c