-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
io_uring: Initial support for {s,g}etsockopt commands #5646
Conversation
Upstream branch: ebc8484 |
bd3fa85
to
6f242f7
Compare
Upstream branch: ebc8484 |
eaca694
to
33cb4a0
Compare
6f242f7
to
5bf85b8
Compare
Upstream branch: 96daa98 |
33cb4a0
to
c25e456
Compare
5bf85b8
to
58ad940
Compare
Split __sys_setsockopt() into two functions by removing the core logic into a sub-function (do_sock_setsockopt()). This will avoid code duplication when doing the same operation in other callers, for instance. do_sock_setsockopt() will be called by io_uring setsockopt() command operation in the following patch. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Willem de Bruijn <willemb@google.com>
Split __sys_getsockopt() into two functions by removing the core logic into a sub-function (do_sock_getsockopt()). This will avoid code duplication when executing the same operation in other callers, for instance. do_sock_getsockopt() will be called by io_uring getsockopt() command operation in the following patch. Suggested-by: Martin KaFai Lau <martin.lau@linux.dev> Signed-off-by: Breno Leitao <leitao@debian.org>
Create a new flag to track if the operation is running compat mode. This basically check the context->compat and pass it to the issue_flags, so, it could be queried later in the callbacks. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Instead of defining basic io_uring functions in the test case, move them to a common directory, so, other tests can use them. This simplify the test code and reuse the common "mini" liburing infrastructure. This is basically a copy of what we have in io_uring_zerocopy_tx with some minor improvements. A follow-up test will use the same helpers in a BPF sockopt test. Signed-off-by: Breno Leitao <leitao@debian.org>
Protect io_uring_cmd_sock() to be called if CONFIG_NET is not set. If network is not enabled, but io_uring is, then we want to return -EOPNOTSUPP for any possible socket operation. This is helpful because io_uring_cmd_sock() can now call functions that only exits if CONFIG_NET is enabled without having #ifdef CONFIG_NET inside the function itself. Signed-off-by: Breno Leitao <leitao@debian.org>
Add support for getsockopt command (SOCKET_URING_OP_GETSOCKOPT), where level is SOL_SOCKET. This is similar to the getsockopt(2) system call, and both parameters are pointers to userspace. Important to say that userspace needs to keep the pointer alive until the CQE is completed. Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Signed-off-by: Breno Leitao <leitao@debian.org>
Add support for SOCKET_URING_OP_SETSOCKOPT. This new command is similar to setsockopt(2). This implementation leverages the function do_sock_setsockopt(), which is shared with the setsockopt() system call path. Important to say that userspace needs to keep the pointer's memory alive until the operation is completed. I.e, the memory could not be deallocated before the CQE is returned to userspace. Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Signed-off-by: Breno Leitao <leitao@debian.org>
Expand the BPF sockopt test to use also check for io_uring {g,s}etsockopt commands operations. Create infrastructure to run io_uring tests using the mini_liburing helpers, so, the {g,s}etsockopt operation could either be called from system calls, or, via io_uring. Add a 'use_io_uring' parameter to run_test(), to specify if the test should be run using io_uring if the parameter is set, or via the regular system calls if false. Call *all* tests twice, using the regular io_uring path, and the new io_uring path. Signed-off-by: Breno Leitao <leitao@debian.org>
Upstream branch: 96daa98 |
c25e456
to
c1a7f25
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=782885 irrelevant now. Closing PR. |
Pull request for series with
subject: io_uring: Initial support for {s,g}etsockopt commands
version: 5
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=782885