On 5/15/24 6:13 PM, Geliang Tang wrote:
From: Geliang Tang
Many BPF selftests create new test network namespaces by using CLONE_NEWNET
flag to unshare the network namespace, so that the calling process is moved
into a new network namespace which is not shared with any previously
existing
On 5/25/24 5:08 AM, Geliang Tang wrote:
From: Geliang Tang
This patch uses connect_to_fd_opts() instead of using connect_fd_to_fd()
and settcpca() in do_test() in prog_tests/bpf_tcp_ca.c to accept a struct
network_helper_opts argument.
Then define a dctcp dedicated post_socket_cb callback
On 5/23/24 8:21 PM, Geliang Tang wrote:
From: Geliang Tang
This patchset uses post_socket_cb and post_connect_cb callbacks of struct
network_helper_opts to refactor do_test() in bpf_tcp_ca.c to move dctcp
test dedicated code out of do_test() into test_dctcp().
Overall looks good. It needs
On 5/23/24 8:21 PM, Geliang Tang wrote:
From: Geliang Tang
This patch uses new helper start_server_str() in do_test() in bpf_tcp_ca.c
to accept a struct network_helper_opts argument instead of using
start_server() and settcpca(). Then change the type of the first paramenter
I think it missed
On 5/23/24 8:21 PM, Geliang Tang wrote:
+static int cc_cb(int fd, void *opts)
+{
+ struct cb_opts *cb_opts = (struct cb_opts *)opts;
+
+ return setsockopt(fd, SOL_TCP, TCP_CONGESTION, cb_opts->cc,
+ strlen(cb_opts->cc) + 1);
Since this cc_cb is in the test
On 5/22/24 2:23 AM, Geliang Tang wrote:
diff --git a/tools/testing/selftests/bpf/prog_tests/sk_assign.c
b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
index 0b9bd1d6f7cc..517d1186e386 100644
--- a/tools/testing/selftests/bpf/prog_tests/sk_assign.c
+++
On 5/14/24 9:20 PM, Geliang Tang wrote:
From: Geliang Tang
This patch uses start_server_addr() in do_test() in prog_tests/bpf_tcp_ca.c
to accept a struct network_helper_opts argument instead of using
start_server() and settcpca(). Then change the type of the first paramenter
of do_test() into
On 5/14/24 9:20 PM, Geliang Tang wrote:
From: Geliang Tang
Since the post_socket_cb() callback is added in struct network_helper_opts,
it's make sense to use it not only in __start_server(), but also in
connect_to_fd_opts(). Then it can be used to set TCP_CONGESTION sockopt.
Add a
On 5/5/24 4:35 AM, Geliang Tang wrote:
From: Geliang Tang
Include network_helpers.h in prog_tests/sockopt_inherit.c, use public
helper start_server_addr() instead of the local defined function
start_server(). This can avoid duplicate code.
Add a helper custom_cb() to set SOL_CUSTOM sockopt
On 5/5/24 4:35 AM, Geliang Tang wrote:
From: Geliang Tang
__start_server() sets SO_REUSPORT through setsockopt() when the parameter
'reuseport' is set. This patch makes it more flexible by adding a function
pointer post_socket_cb, together with 'struct post_socket_opts cb_opts'
for future
On 4/24/24 8:23 PM, Geliang Tang wrote:
+static int setsockopt_reuseport(int fd, const void *optval, socklen_t optlen)
+{
+ return setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, optval, optlen);
}
[ ... ]
void free_fds(int *fds, unsigned int nr_close_fds)
diff --git
On 4/28/24 10:47 AM, Jordan Rife wrote:
Also, all this setup (and test) has to be done in a new netns. Anything blocking
the kfunc in patch 2 using the current task netns instead of the init_net?
Add nodad to the "ip -6 addr add...". just in case it may add unnecessary delay.
This
On 4/18/24 9:37 AM, Jordan Rife wrote:
The test_sock_addr.{c,sh} can be retired as long as all its tests are migrated
to sock_addr.c
test_sock_addr.c has a few more test dimensions than
prog_tests/sock_addr.c currently does, so it covers a few more
scenarios.
struct sock_addr_test {
On 4/17/24 10:08 AM, Jordan Rife wrote:
Can the test_sock_addr.{c,sh} be retired after this patch?
I know it's not used in the BPF CI tests, but is it still used in any
other contexts?
If anyone depends on the test_sock_addr binary, it will have to start using
"./test_progs -t sock_addr".
On 4/16/24 3:13 AM, Geliang Tang wrote:
From: Geliang Tang
The helpers ASSERT_OK/GE/OK_PTR should avoid using in public functions.
This patch uses log_err() to replace them in network_helpers.c, then
uses ASSERT_OK_PTR() to check the return values of all open_netns().
Signed-off-by: Geliang
On 4/16/24 3:13 AM, Geliang Tang wrote:
From: Geliang Tang
This patch uses public helper connect_to_addr() exported in
network_helpers.h instead of the local defined function connect_to_server()
in prog_tests/sk_assign.c. This can avoid duplicate code.
The code that sets SO_SNDTIMEO timeout
On 4/16/24 3:13 AM, Geliang Tang wrote:
From: Geliang Tang
In order to pair up with connect_to_addr(), this patch adds a new helper
start_server_addr(), and another one start_server_addr_opts(), which is
a wrapper of __start_server(), only added a network_helper_opts arg at
the end.
They all
On 4/12/24 9:52 AM, Jordan Rife wrote:
This patch lays the groundwork for testing IPv4 and IPv6 sockaddr hooks
and their interaction with both socket syscalls and kernel functions
(e.g. kernel_connect, kernel_bind, etc.) and moves the test cases from
the old-style bpf/test_sock_addr.c self test
On 4/12/24 9:52 AM, Jordan Rife wrote:
This patch adds a set of kfuncs to bpf_testmod that can be used to
manipulate a socket from kernel space.
Signed-off-by: Jordan Rife
---
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 139 ++
.../bpf/bpf_testmod/bpf_testmod_kfunc.h
On 4/12/24 9:52 AM, Jordan Rife wrote:
This patch lays the groundwork for testing IPv4 and IPv6 sockaddr hooks
and their interaction with both socket syscalls and kernel functions
(e.g. kernel_connect, kernel_bind, etc.) and moves the test cases from
the old-style bpf/test_sock_addr.c self test
On 4/10/24 6:03 PM, Geliang Tang wrote:
From: Geliang Tang
Include network_helpers.h in prog_tests/sockopt_inherit.c, use public
helpers make_sockaddr() and start_server_setsockopt() instead of the
local defined function start_server(). This can avoid duplicate code.
Add a helper
On 4/10/24 6:03 PM, Geliang Tang wrote:
From: Geliang Tang
In order to pair up with connect_to addr(), this patch adds a new helper
start_server_addr(), which is a wrapper of __start_server(), and accepts an
argument 'addr' of 'struct sockaddr' type instead of a string type argument
like
On 4/10/24 10:43 PM, Geliang Tang wrote:
+static void *send_recv_server(void *arg)
+{
+ struct send_recv_arg *a = (struct send_recv_arg *)arg;
+ ssize_t nr_sent = 0, bytes = 0;
+ char batch[1500];
+ int err = 0, fd;
+
+ fd = accept(a->fd, NULL, NULL);
+ while
On 4/9/24 11:13 PM, Geliang Tang wrote:
From: Geliang Tang
Some tests, such as the MPTCP bpf tests, require send_recv_data helper
to run in nonblock mode.
This patch adds nonblock support for send_recv_data(). Check if it is
currently in nonblock mode, and if so, ignore EWOULDBLOCK to
On 4/9/24 11:13 PM, Geliang Tang wrote:
+int send_recv_data(int lfd, int fd, uint32_t total_bytes)
+{
+ ssize_t nr_recv = 0, bytes = 0;
+ struct send_recv_arg arg = {
+ .fd = lfd,
+ .bytes = total_bytes,
+ .stop = 0,
+ };
+
are needed.
Acked-by: Martin KaFai Lau
On 4/8/24 8:51 PM, Geliang Tang wrote:
+static void *send_recv_server(void *arg)
+{
+ struct send_recv_arg *a = (struct send_recv_arg *)arg;
+ ssize_t nr_sent = 0, bytes = 0;
+ char batch[1500];
+ int err = 0, fd;
+
+ fd = accept(a->fd, NULL, NULL);
+ while
On 3/29/24 12:18 PM, Jordan Rife wrote:
diff --git a/tools/testing/selftests/bpf/sock_addr_helpers.c
b/tools/testing/selftests/bpf/sock_addr_helpers.c
new file mode 100644
index 0..ff2eb09870f16
--- /dev/null
+++ b/tools/testing/selftests/bpf/sock_addr_helpers.c
@@ -0,0 +1,46 @@
+//
On 3/29/24 12:18 PM, Jordan Rife wrote:
+int recvmsg_from_client(int sockfd, struct sockaddr_storage *src_addr)
+{
+ struct timeval tv;
+ struct msghdr hdr;
+ struct iovec iov;
+ char data[64];
+ fd_set rfds;
+
+ FD_ZERO();
+ FD_SET(sockfd, );
+
+
On 3/29/24 12:18 PM, Jordan Rife wrote:
+static int do_sock_op(int op, struct sockaddr *addr, int addrlen)
This function can be made as a new kfunc in bpf_testmod.c. The
sock_create_kern() could be moved to here also. Take a look at the
register_btf_kfunc_id_set() usage in bpf_testmod.c and
On 3/10/24 1:45 AM, Alessandro Carminati wrote:
Hi Martin,
Thanks for the review.
Il giorno ven 8 mar 2024 alle ore 02:03 Martin KaFai Lau
ha scritto:
On 2/29/24 6:00 AM, Alessandro Carminati (Red Hat) wrote:
In some systems, the netcat server can incur in delay to start listening.
When
On 2/29/24 6:00 AM, Alessandro Carminati (Red Hat) wrote:
In some systems, the netcat server can incur in delay to start listening.
When this happens, the test can randomly fail in various points.
This is an example error message:
# ip gre none gso
# encap 192.168.1.1 to 192.168.1.2,
On 2/14/24 9:18 AM, Benjamin Tissoires wrote:
+static void bpf_timer_work_cb(struct work_struct *work)
+{
+ struct bpf_hrtimer *t = container_of(work, struct bpf_hrtimer, work);
+ struct bpf_map *map = t->map;
+ void *value = t->value;
+ bpf_callback_t callback_fn;
+
On 2/6/24 9:04 AM, Marco Elver wrote:
On Mon, Feb 05, 2024 at 03:24PM -0800, Martin KaFai Lau wrote:
[...]
Or can you suggest different functions to hook to for the recursion test?
I don't prefer to add another tracepoint for the selftest.
Ok - I also checked, even though it should
On 2/5/24 7:00 AM, Marco Elver wrote:
On Wed, 31 Jan 2024 at 20:52, Martin KaFai Lau wrote:
[...]
| num_maps: 1000
| local_storage cache sequential get:
| |
| hits throughput: 0.357 ± 0.005 M ops/s | 0.325 ± 0.005 M ops/s
On 2/2/24 1:06 AM, Jiapeng Chong wrote:
Use of macro ARRAY_SIZE to calculate array size minimizes
the redundant code and improves code reusability.
./tools/testing/selftests/bpf/progs/syscall.c:122:26-27: WARNING: Use
ARRAY_SIZE.
Reported-by: Abaci Robot
Closes:
On 1/31/24 6:18 AM, Marco Elver wrote:
To allow the compiler to inline the bpf_local_storage_lookup() fast-
path, factor it out by making bpf_local_storage_lookup() a static inline
function and move the slow-path to bpf_local_storage_lookup_slowpath().
Base on results from
On 1/17/24 7:55 AM, Willem de Bruijn wrote:
Martin KaFai Lau wrote:
On 1/16/24 7:17 AM, Willem de Bruijn wrote:
Jörn-Thorben Hinz wrote:
A BPF application, e.g., a TCP congestion control, might benefit from or
even require precise (=hardware) packet timestamps. These timestamps are
already
On 1/16/24 7:17 AM, Willem de Bruijn wrote:
Jörn-Thorben Hinz wrote:
A BPF application, e.g., a TCP congestion control, might benefit from or
even require precise (=hardware) packet timestamps. These timestamps are
already available through __sk_buff.hwtstamp and
bpf_sock_ops.skb_hwtstamp, but
On 1/2/24 10:11 AM, Stanislav Fomichev wrote:
On 12/29, Menglong Dong wrote:
For now, we have to call some helpers when we need to update the csum,
such as bpf_l4_csum_replace, bpf_l3_csum_replace, etc. These helpers are
not inlined, which causes poor performance.
In fact, we can define our
On 12/11/23 12:20 PM, Daniel Xu wrote:
Add some tests that exercise BPF_CORE_WRITE_BITFIELD() macro. Since some
non-trivial bit fiddling is going on, make sure various edge cases (such
as adjacent bitfields and bitfields at the edge of structs) are
exercised.
Hi DanielXu, I have pushed the
g two tests. This is going to help to exercise the io_uring
subsystem:
* getsockopt: read ctx->optlen
* getsockopt: support smaller ctx->optlen
Acked-by: Martin KaFai Lau
On 10/5/23 12:21 AM, Geliang Tang wrote:
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
@@ -1336,32 +1336,22 @@ static void test_redir(struct test_sockmap_listen
*skel, struct bpf_map *map,
}
}
-static
On 9/13/23 8:27 AM, Breno Leitao wrote:
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
44 matches
Mail list logo