Re: [PATCH bpf-next v4 2/2] selftests/bpf: Add mptcp subflow subtest

2024-08-17 Thread Geliang Tang
Hi Martin, Matt, On Wed, 2024-08-14 at 15:37 -0700, Martin KaFai Lau wrote: > On 8/14/24 3:04 AM, Matthieu Baerts wrote: > > Hi Martin, > > > > Thank you for your reply! > > > > On 14/08/2024 03:12, Martin KaFai Lau wrote: > > > On 8/5/24 2:52 AM, Matthieu Baerts (NGI0) wrote: > > > > +static in

Re: [PATCH net-next] selftests: forwarding: lib.sh: ignore "Address not found"

2024-08-08 Thread Geliang Tang
On Wed, 2024-08-07 at 09:59 +0300, Ido Schimmel wrote: > On Wed, Aug 07, 2024 at 12:08:15PM +0800, Geliang Tang wrote: > > On Tue, 2024-08-06 at 10:40 +0300, Ido Schimmel wrote: > > > On Tue, Aug 06, 2024 at 12:20:38PM +0800, Geliang Tang wrote: > > > > From: Geliang

Re: [PATCH net-next] selftests: forwarding: lib.sh: ignore "Address not found"

2024-08-06 Thread Geliang Tang
On Tue, 2024-08-06 at 09:34 +0200, Nicolas Dichtel wrote: > Le 06/08/2024 à 06:20, Geliang Tang a écrit : > > From: Geliang Tang > > > > So many "Address not found" messages occur at the end of forwarding > > tests > > when using "ip address de

Re: [PATCH net-next] selftests: forwarding: lib.sh: ignore "Address not found"

2024-08-06 Thread Geliang Tang
Hi Ido, Thanks for the review. On Tue, 2024-08-06 at 10:40 +0300, Ido Schimmel wrote: > On Tue, Aug 06, 2024 at 12:20:38PM +0800, Geliang Tang wrote: > > From: Geliang Tang > > > > So many "Address not found" messages occur at the end of forwarding > >

[PATCH net-next] selftests: forwarding: lib.sh: ignore "Address not found"

2024-08-05 Thread Geliang Tang
From: Geliang Tang So many "Address not found" messages occur at the end of forwarding tests when using "ip address del" command for an invalid address: TEST: FDB limits interacting with FDB type local[ OK ] Error: ipv4: Address not found. ... ... T

Re: [PATCH bpf-next v3 2/3] selftests/bpf: Add mptcp pm_nl_ctl link

2024-07-24 Thread Geliang Tang
Hi Matt, On Sat, 2024-07-06 at 02:25 +0200, Matthieu Baerts wrote: > Hi Martin, > > Thank you for your reply! > > On 06/07/2024 01:10, Martin KaFai Lau wrote: > > On 7/4/24 3:48 AM, Matthieu Baerts wrote: > > > > diff --git a/tools/testing/selftests/bpf/Makefile > > > > b/tools/testing/ > > > >

Re: [PATCH bpf-next v1 07/19] selftests/bpf: Fix missing ARRAY_SIZE() definition in bench.c

2024-07-24 Thread Geliang Tang
On Mon, 2024-07-22 at 22:54 -0700, Tony Ambardar wrote: > Add a "bpf_util.h" include to avoid the following error seen > compiling for > mips64el with musl libc: > >   bench.c: In function 'find_benchmark': >   bench.c:590:25: error: implicit declaration of function > 'ARRAY_SIZE' [-Werror=implici

Re: [PATCH bpf-next v1 03/19] selftests/bpf: Fix error compiling bpf_iter_setsockopt.c with musl libc

2024-07-23 Thread Geliang Tang
> + if (!getsockname(fd, (struct sockaddr *) &addr, &addrlen)) nit: Generally, a space is not required when casting: (struct sockaddr *)&addr not (struct sockaddr *) &addr. See here: $ grep -r "struct sockaddr \*) \&" tools/testing/selftests/bpf/prog_tests | wc -l 1 $ grep -r "struct sockaddr \*)\&" tools/testing/selftests/bpf/prog_tests | wc -l 33 Except this, LGTM. Acked-by: Geliang Tang >   return ntohs(addr.sin6_port); >   >   return 0;

Re: [PATCH bpf-next 00/15] use network helpers, part 11

2024-07-23 Thread Geliang Tang
On Tue, 2024-07-23 at 19:43 -0700, Alexei Starovoitov wrote: > On Tue, Jul 23, 2024 at 7:07 PM Geliang Tang > wrote: > > > > Hi Alexei, > > > > On Tue, 2024-07-23 at 17:04 -0700, Alexei Starovoitov wrote: > > > I strongly suggest you invest just as much

Re: [PATCH bpf-next v1 01/19] selftests/bpf: Use pid_t consistently in test_progs.c

2024-07-23 Thread Geliang Tang
env.worker_pids = calloc(sizeof(__pid_t), > env.workers); > + env.worker_pids = calloc(sizeof(pid_t), > env.workers); Yes, "pid_t" is much better. "worker_pids" dose define as "pid_t" in test_progs.h: struct test_env { ... ...

Re: [PATCH bpf-next 00/15] use network helpers, part 11

2024-07-23 Thread Geliang Tang
ommunity has such a rule. I will try to reduce the number of iterations of my patches and the number of my emails sent to our community. I am very willing to review other people's patches, but I am only familiar with "BPF [SELFTESTS]" module. If possible, I would like to add myself (Ge

[PATCH bpf-next 15/15] selftests/bpf: Use start_server_str in sockmap_helpers

2024-07-23 Thread Geliang Tang
From: Geliang Tang Now both SOCK_SEQPACKET and SOCK_NONBLOCK can be passed as "type" parameter into start_server_str(), use this helper in socket_loopback_reuseport() in sockmap_helpers.h to simplify the code. Signed-off-by: Geliang Tang --- .../bpf/prog_tests/sockmap_helpers.h

[PATCH bpf-next 14/15] selftests/bpf: Clear type bits for start_server_addr

2024-07-23 Thread Geliang Tang
From: Geliang Tang The types "sotype | SOCK_NONBLOCK" are passed to socket_loopback_reuseport by some tests in sockmap_listen.c, so they must be handled in helper start_server_addr() too. This patch uses SOCK_TYPE_MASK to clear useless bits of "type" before check whether it

[PATCH bpf-next 13/15] selftests/bpf: Check listen support for start_server_addr

2024-07-23 Thread Geliang Tang
From: Geliang Tang No only SOCK_STREAM type supports listen for connections on a socket, SOCK_SEQPACKET used in sockmap_listen.c supports it too. This patch adds a new helper listen_support() to check whether a given "type" supports listen for connections on a socket or not. Sig

[PATCH bpf-next 11/15] selftests/bpf: Add loopback_addr_str helper

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch adds a new helper loopback_addr_str() to get the loopback address string according to the given different protocol family. Also use this new helper in start_servers() in migrate_reuseport.c. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf

[PATCH bpf-next 10/15] selftests/bpf: AF_VSOCK support for make_sockaddr

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch adds AF_VSOCK support for make_sockaddr(), uses atoi() to convert the given addr_str string to an integer id and sets it to "svm_cid". Set "svm_port" as VMADDR_PORT_ANY if the value of port is zero. Signed-off-by: Geliang Tang --- tools/t

[PATCH bpf-next 12/15] selftests/bpf: Use make_sockaddr in sockmap_helpers

2024-07-23 Thread Geliang Tang
From: Geliang Tang AF_VSOCK is supported in make_sockaddr() now, use it to implement init_addr_loopback() in sockmap_helpers.h. Then three local functions init_addr_loopback4(), init_addr_loopback6() and init_addr_loopback_vsock() can be dropped. Signed-off-by: Geliang Tang --- .../bpf

[PATCH bpf-next 09/15] selftests/bpf: Use start_server_str in crypto_sanity

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch uses start_server_str() to start a AF_ALG server in test crypto_sanity, since no listen is needed in this test, nolisten flag of network_helper_opts is set. Signed-off-by: Geliang Tang --- .../testing/selftests/bpf/prog_tests/crypto_sanity.c | 12 1

[PATCH bpf-next 07/15] selftests/bpf: AF_ALG support for make_sockaddr

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch adds AF_ALG support for make_sockaddr(), uses sscanf() to parse the given addr_str string to "salg_type" and "salg_name" of struct sockaddr_alg. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/network_helpers.c | 15 +++

[PATCH bpf-next 08/15] selftests/bpf: Add nolisten for network_helper_opts

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch adds a struct member "nolisten" for network_helper_opts, which is used to control whether to invoke listen() or not in start_server_addr(). Also print out a warning if backlog is set for a type not support listen for connections. Signed-off-by: Ge

[PATCH bpf-next 06/15] selftests/bpf: Use send_to_addr_str in xdp_bonding

2024-07-23 Thread Geliang Tang
From: Geliang Tang The first user of send_to_addr_str() is send_udp_packets() in xdp_bonding. Use sprintf() to generate "addr_str" string from ifindex, sll_halen and sll_addr, and pass it to send_to_addr_str(). Since IPPROTO_ICMP is used, set it as opts.proto and pass opts to the

[PATCH bpf-next 05/15] selftests/bpf: Add send_to_addr_str helper

2024-07-23 Thread Geliang Tang
From: Geliang Tang Similar to network helper connect_to_addr_str(), this patch adds a new helper send_to_addr_str(). It uses make_sockaddr() to make a sockaddr_storage type address from the "family", "addr_str" and "port" parameters and passes it to send_to_addr()

[PATCH bpf-next 04/15] selftests/bpf: Add send_to_fd_opts helper

2024-07-23 Thread Geliang Tang
From: Geliang Tang Similar to network helpers connect_to_addr() and connect_to_fd_opts(), this patch adds two helpers send_to_addr() send_to_fd_opts() to use sendto() to send data. They accepts three more parameters "const void *data", "size_t datalen" and "int fl

[PATCH bpf-next 03/15] selftests/bpf: Use start_server_str in lwt_redirect

2024-07-23 Thread Geliang Tang
From: Geliang Tang AF_PACKET can be passed to start_server_str() now. Use it to simplify the code in lwt_redirect. In this test, use sprintf() to save the "ifindex" value into addr_str string, then pass it to the helper. Signed-off-by: Geliang Tang --- .../selftests/bpf/

[PATCH bpf-next 02/15] selftests/bpf: AF_PACKET support for make_sockaddr

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch adds AF_PACKET support for make_sockaddr(), uses sscanf() to parse the given addr_str string into sll_ifindex, sll_halen and sll_addr of sockaddr_ll. Other fields of struct sockaddr_ll are not used in BPF selftests right now. Signed-off-by: Geliang Tang --- tools

[PATCH bpf-next 00/15] use network helpers, part 11

2024-07-23 Thread Geliang Tang
From: Geliang Tang This set is part 11 of series "use network helpers" all BPF selftests wide. Finally something new in this set. The helper make_sockaddr is extended to support sockets of AF_PACKET, AF_ALG and AF_VSOCK families. Then these types of sockets can be used to start_

[PATCH bpf-next 01/15] selftests/bpf: Use start_server_str in skc_to_unix_sock

2024-07-23 Thread Geliang Tang
From: Geliang Tang This patch uses network helper start_server_str() in skc_to_unix_sock test in skc_to_unix_sock.c to simplify the code. This is the first time to use start_server_str() for a AF_UNIX socket. The first "@" of "sun_path" needs to be skipped by make_sockad

[PATCH bpf-next 4/4] selftests/bpf: Drop __start_server in network_helpers

2024-07-20 Thread Geliang Tang
From: Geliang Tang The helper start_server_addr() is a wrapper of __start_server(), the only difference between them is __start_server() accepts a sockaddr type address parameter, but start_server_addr() accepts a sockaddr_storage one. This patch drops __start_server(), and updates the callers

[PATCH bpf-next 1/4] selftests/bpf: Drop make_client in sk_lookup

2024-07-20 Thread Geliang Tang
From: Geliang Tang This patch uses the new helper connect_to_addr_str() in sk_lookup.c to create the client socket and connect to the server, instead of using local defined function make_client(). This local function can be dropped then. Signed-off-by: Geliang Tang --- .../selftests/bpf

[PATCH bpf-next 3/4] selftests/bpf: Drop inetaddr_len in sk_lookup

2024-07-20 Thread Geliang Tang
From: Geliang Tang No need to use a dedicated helper inetaddr_len() to get the length of the IPv4 or IPv6 address, it can be got by make_sockaddr(), this patch drops it. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 21 --- 1 file changed, 9

[PATCH bpf-next 2/4] selftests/bpf: Drop make_socket in sk_lookup

2024-07-20 Thread Geliang Tang
From: Geliang Tang This patch uses the public network helers client_socket() + make_sockaddr() in sk_lookup.c to create the client socket, set the timeout sockopts, and make the connecting address. The local defined function make_socket() can be dropped then. Signed-off-by: Geliang Tang

[PATCH bpf-next 0/4] use network helpers, part 10

2024-07-20 Thread Geliang Tang
From: Geliang Tang This set is part 10 of series "use network helpers" all BPF selftests wide. Patches 1-3 drop local functions make_client(), make_socket() and inetaddr_len() in sk_lookup.c. Patch 4 drops a useless function __start_server() in network_helpers.c. Geliang Tang (4):

[PATCH bpf-next v3 5/5] selftests/bpf: Drop make_socket in sk_lookup

2024-07-17 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() in drop_on_lookup(), drop_on_reuseport() and run_multi_prog_lookup() instead of using make_socket() + connect(). Then make_socket() and inetaddr_len() can be dropped. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c

[PATCH bpf-next v3 4/5] selftests/bpf: Use connect_to_addr_str in sk_lookup

2024-07-17 Thread Geliang Tang
From: Geliang Tang This patch uses the new helper connect_to_addr_str() in make_client() instead of using local defined function make_socket() + connect(). This local function can be dropped latter. A new parameter "expect_errno" is added for make_client() too to allow different &qu

[PATCH bpf-next v3 3/5] selftests/bpf: Add connect_to_addr_str helper

2024-07-17 Thread Geliang Tang
From: Geliang Tang Similar to connect_to_addr() helper for connecting to a server with the given sockaddr_storage type address, this patch adds a new helper named connect_to_addr_str() for connecting to a server with the given string type address "addr_str", together with its "fa

[PATCH bpf-next v3 2/5] selftests/bpf: Drop must_fail from network_helper_opts

2024-07-17 Thread Geliang Tang
From: Geliang Tang The struct member "must_fail" of network_helper_opts() is only used in cgroup_v1v2 tests, it makes sense to drop it from network_helper_opts. Return value (fd) of connect_to_fd_opts() and the expect errno (EPERM) can be checked in cgroup_v1v2.c directly, no need to

[PATCH bpf-next v3 1/5] selftests/bpf: Drop type of connect_to_fd_opts

2024-07-17 Thread Geliang Tang
From: Geliang Tang The "type" parameter of connect_to_fd_opts() is redundant of "server_fd". Since the "type" can be obtained inside by invoking getsockopt(SO_TYPE), without passing it in as a parameter. This patch drops the "type" parameter of conn

[PATCH bpf-next v3 0/5] use network helpers, part 9

2024-07-17 Thread Geliang Tang
From: Geliang Tang v3: - patch 2: - clear errno before connect_to_fd_opts. - print err logs in run_test. - set err to -1 when fd >= 0. - patch 3: - drop "int err". v2: - update patch 2 as Martin suggested. This is the 9th part of series "use network helpers&

Re: [PATCH net v3 2/2] skmsg: bugfix for sk_msg sge iteration

2024-07-15 Thread Geliang Tang
Hi John, On Mon, 2024-07-01 at 18:29 +0800, Geliang Tang wrote: > > > > > > > > Hello, > > > > > > > > > > > > > > > > On Mon, 2024-07-01 at 17:00 +0800, D. Wythe wrote: > > > > > > > > > > >

[PATCH bpf-next v2 3/3] selftests/bpf: Drop duplicate ENOTSUPP definitions

2024-07-12 Thread Geliang Tang
From: Geliang Tang ENOTSUPP is defined in bpf/str_error.h now, so no need to redefine it in so many places in bpf selftests. This patch includes in testing_helpers.h, which is almost included by each tests. And drop all duplicate definitions. Signed-off-by: Geliang Tang --- tools/testing

[PATCH bpf-next v2 1/3] bpf: verifier: Fix return value of fixup_call_args

2024-07-12 Thread Geliang Tang
From: Geliang Tang Run bloom_filter_map selftests (./test_progs -t bloom_filter_map) on a Loongarch platform, an error message "JIT doesn't support bpf-to-bpf calls" is got in user space, together with an unexpected errno EINVAL (22), not ENOTSUPP (524): libbpf: prog 'inn

[PATCH bpf-next v2 2/3] libbpf: handle ENOTSUPP in libbpf_strerror_r

2024-07-12 Thread Geliang Tang
From: Geliang Tang Errno 95 (ENOTSUP or EOPNOTSUPP) can be recognized by libbpf_strerror_r(), but 524 (ENOTSUPP) can't: prog 'basic_alloc3': BPF program load failed: Operation not supported prog 'basic_alloc3': failed to load: -95 failed to lo

[PATCH bpf-next v2 0/3] handle errno ENOTSUPP

2024-07-12 Thread Geliang Tang
From: Geliang Tang v2: - patch 1, only commit log updated - update patch 2 - add an unsigned variable - use "switch-case" - only "Operation not supported", no (-524) in string - patch 3, a now one This patchset contains three fixes for handling errno ENOTSUPP

[PATCH bpf-next v2 5/5] selftests/bpf: Drop make_socket in sk_lookup

2024-07-12 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() in drop_on_lookup(), drop_on_reuseport() and run_multi_prog_lookup() instead of using make_socket() + connect(). Then make_socket() and inetaddr_len() can be dropped. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c

[PATCH bpf-next v2 4/5] selftests/bpf: Use connect_to_addr_str in sk_lookup

2024-07-12 Thread Geliang Tang
From: Geliang Tang This patch uses the new helper connect_to_addr_str() in make_client() instead of using local defined function make_socket() + connect(). This local function can be dropped latter. A new parameter "expect_errno" is added for make_client() too to allow different &qu

[PATCH bpf-next v2 3/5] selftests/bpf: Add connect_to_addr_str helper

2024-07-12 Thread Geliang Tang
From: Geliang Tang Similar to connect_to_addr() helper for connecting to a server with the given sockaddr_storage type address, this patch adds a new helper named connect_to_addr_str() for connecting to a server with the given string type address "addr_str", together with its "fa

[PATCH bpf-next v2 2/5] selftests/bpf: Drop must_fail from network_helper_opts

2024-07-12 Thread Geliang Tang
From: Geliang Tang The struct member "must_fail" of network_helper_opts() is only used in cgroup_v1v2 tests, it makes sense to drop it from network_helper_opts. Return value (fd) of connect_to_fd_opts() and the expect errno (EPERM) can be checked in cgroup_v1v2.c directly, no need to

[PATCH bpf-next v2 1/5] selftests/bpf: Drop type of connect_to_fd_opts

2024-07-12 Thread Geliang Tang
From: Geliang Tang The "type" parameter of connect_to_fd_opts() is redundant of "server_fd". Since the "type" can be obtained inside by invoking getsockopt(SO_TYPE), without passing it in as a parameter. This patch drops the "type" parameter of conn

[PATCH bpf-next v2 0/5] use network helpers, part 9

2024-07-12 Thread Geliang Tang
From: Geliang Tang v2: - update patch 2 as Martin suggested. This is the 9th part of series "use network helpers" all BPF selftests wide. Patches 1-2 update network helpers interfaces suggested by Martin. Patch 3 adds a new helper connect_to_addr_str() as Martin suggested instead

[PATCH bpf-next 5/5] selftests/bpf: Drop make_socket in sk_lookup

2024-07-10 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() in drop_on_lookup(), drop_on_reuseport() and run_multi_prog_lookup() instead of using make_socket() + connect(). Then make_socket() and inetaddr_len() can be dropped. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c

[PATCH bpf-next 4/5] selftests/bpf: Use connect_to_addr_str in sk_lookup

2024-07-10 Thread Geliang Tang
From: Geliang Tang This patch uses the new helper connect_to_addr_str() in make_client() instead of using local defined function make_socket() + connect(). This local function can be dropped latter. A new parameter "expect_errno" is added for make_client() too to allow different &qu

[PATCH bpf-next 3/5] selftests/bpf: Add connect_to_addr_str helper

2024-07-10 Thread Geliang Tang
From: Geliang Tang Similar to connect_to_addr() helper for connecting to a server with the given sockaddr_storage type address, this patch adds a new helper named connect_to_addr_str() for connecting to a server with the given string type address "addr_str", together with its "fa

[PATCH bpf-next 2/5] selftests/bpf: Drop must_fail from network_helper_opts

2024-07-10 Thread Geliang Tang
From: Geliang Tang The struct member "must_fail" of network_helper_opts() is only used in cgroup_v1v2 tests, it makes sense to drop it from network_helper_opts. Return value (fd) of connect_to_fd_opts() and the expect errno (EPERM) can be checked in cgroup_v1v2.c directly, no need to

[PATCH bpf-next 1/5] selftests/bpf: Drop type of connect_to_fd_opts

2024-07-10 Thread Geliang Tang
From: Geliang Tang The "type" parameter of connect_to_fd_opts() is redundant of "server_fd". Since the "type" can be obtained inside by invoking getsockopt(SO_TYPE), without passing it in as a parameter. This patch drops the "type" parameter of conn

[PATCH bpf-next 0/5] use network helpers, part 9

2024-07-10 Thread Geliang Tang
From: Geliang Tang This is the 9th part of series "use network helpers" all BPF selftests wide. Patches 1-2 update network helpers interfaces suggested by Martin. Patch 3 adds a new helper connect_to_addr_str() as Martin suggested instead of adding connect_fd_to_addr_str(). Patch 4

[PATCH bpf-next v2 2/2] selftests/bpf: Close obj in error path in xdp_adjust_tail

2024-07-10 Thread Geliang Tang
From: Geliang Tang If bpf_object__load() fails in test_xdp_adjust_frags_tail_grow(), "obj" opened before this should be closed. So use "goto out" to close it instead of using "return" here. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/xd

[PATCH bpf-next v2 1/2] selftests/bpf: Null checks for links in bpf_tcp_ca

2024-07-10 Thread Geliang Tang
From: Geliang Tang Run bpf_tcp_ca selftests (./test_progs -t bpf_tcp_ca) on a Loongarch platform, some "Segmentation fault" errors occur: ''' test_dctcp:PASS:bpf_dctcp__open_and_load 0 nsec test_dctcp:FAIL:bpf_map__attach_struct_ops unexpected error: -524 #29/1

[PATCH bpf-next v2 0/2] BPF selftests misc fixes

2024-07-10 Thread Geliang Tang
From: Geliang Tang v2: - only check the first "link" (link_nl) in test_mixed_links(). - Drop patch 2 in v1. Resend patch 1 out of "skip ENOTSUPP BPF selftests" set as Eduard suggested. Together with another fix for xdp_adjust_tail. Geliang Tang (2): selftests/bpf: Null

Re: [PATCH bpf-next 1/3] selftests/bpf: Null checks for links in bpf_tcp_ca

2024-07-10 Thread Geliang Tang
On Wed, 2024-07-10 at 12:25 +0100, Alan Maguire wrote: > On 09/07/2024 11:45, Geliang Tang wrote: > > From: Geliang Tang > > > > Run bpf_tcp_ca selftests (./test_progs -t bpf_tcp_ca) on a > > Loongarch > > platform, some

Re: [PATCH bpf-next v2 4/6] selftests/bpf: Null checks for link in bpf_tcp_ca

2024-07-09 Thread Geliang Tang
Hi Eduard, On Mon, 2024-07-08 at 12:42 -0700, Eduard Zingerman wrote: > On Fri, 2024-07-05 at 10:38 +0800, Geliang Tang wrote: > > [...] > > I think that this patch is an improvement independent of the patch- > set. > Please submit it separately. > > >

[PATCH bpf-next 3/3] selftests/bpf: Close obj in error paths in xdp_adjust_tail

2024-07-09 Thread Geliang Tang
From: Geliang Tang If bpf_object__load() fails in test_xdp_adjust_frags_tail_grow(), "obj" opened before this should be closed. So use "goto out" to close it instead of using "return" here. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests/xd

[PATCH bpf-next 2/3] selftests/bpf: Check ASSERT_OK(err) in dummy_st_ops

2024-07-09 Thread Geliang Tang
From: Geliang Tang Run dummy_st_ops selftests (./test_progs -t dummy_st_ops) on a Loongarch platform, some "unexpected arg" errors occur: ''' #78/1dummy_st_ops/dummy_st_ops_attach:OK test_dummy_init_ret_value:FAIL:test_ret unexpected test_ret: \

[PATCH bpf-next 1/3] selftests/bpf: Null checks for links in bpf_tcp_ca

2024-07-09 Thread Geliang Tang
From: Geliang Tang Run bpf_tcp_ca selftests (./test_progs -t bpf_tcp_ca) on a Loongarch platform, some "Segmentation fault" errors occur: ''' test_dctcp:PASS:bpf_dctcp__open_and_load 0 nsec test_dctcp:FAIL:bpf_map__attach_struct_ops unexpected error: -524 #29/1

[PATCH bpf-next 0/3] BPF selftests misc fixes

2024-07-09 Thread Geliang Tang
From: Geliang Tang Resend patch 1 out of "skip ENOTSUPP BPF selftests" set as Eduard suggested. Together with two other cleanups. Geliang Tang (3): selftests/bpf: Null checks for links in bpf_tcp_ca selftests/bpf: Check ASSERT_OK(err) in dummy_st_ops selftests/bpf: Close ob

[PATCH bpf-next v11 9/9] selftests/bpf: Drop make_socket in sk_lookup

2024-07-09 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() in drop_on_lookup(), drop_on_reuseport() and run_multi_prog_lookup() instead of using make_socket() + connect(). Then make_socket() and inetaddr_len() can be dropped now. make_client() returns normal "fd" instead of "-1" when

[PATCH bpf-next v11 8/9] selftests/bpf: Use connect_fd_to_addr_str in sk_lookup

2024-07-09 Thread Geliang Tang
From: Geliang Tang This patch uses the new helper connect_fd_to_addr_str() in make_client() instead of using local defined function make_socket() + connect(). This local function can be dropped latter. A new parameter "expect_errno" is added for make_client() too to allow

[PATCH bpf-next v11 6/9] selftests/bpf: Use connect_fd_to_fd in sk_lookup

2024-07-09 Thread Geliang Tang
From: Geliang Tang This patch uses public helper connect_fd_to_fd() exported in network_helpers.h instead of using getsockname() + connect() in run_lookup_prog() in prog_tests/sk_lookup.c. This can simplify the code. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v11 7/9] selftests/bpf: Add connect_fd_to_addr_str helper

2024-07-09 Thread Geliang Tang
From: Geliang Tang Similar to connect_fd_to_fd() helper to connect from a client fd to a server fd, this patch adds a new helper connect_fd_to_addr_str() to connect from a client fd to a server address. It accepts the server address string "addr_str", together with the server family

[PATCH bpf-next v11 5/9] selftests/bpf: Use start_server_addr in sk_lookup

2024-07-09 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_addr() in udp_recv_send() in prog_tests/sk_lookup.c to simplify the code. And use ASSERT_OK_FD() to check fd returned by start_server_addr(). Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf

[PATCH bpf-next v11 4/9] selftests/bpf: Use start_server_str in sk_lookup

2024-07-09 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_str() to simplify make_server() in prog_tests/sk_lookup.c. Add a callback setsockopts() to do all sockopts, set it to post_socket_cb pointer of struct network_helper_opts. And add a new struct cb_opts to save the data needed to pass

[PATCH bpf-next v11 3/9] selftests/bpf: Close fd in error path in drop_on_reuseport

2024-07-09 Thread Geliang Tang
From: Geliang Tang In the error path when update_lookup_map() fails in drop_on_reuseport in prog_tests/sk_lookup.c, "server1", the fd of server 1, should be closed. This patch fixes this by using "goto close_srv1" lable instead of "detach" to close "serve

[PATCH bpf-next v11 1/9] selftests/bpf: Add backlog for network_helper_opts

2024-07-09 Thread Geliang Tang
From: Geliang Tang Some callers expect __start_server() helper to pass their own "backlog" value to listen() instead of the default of 1. So this patch adds struct member "backlog" for network_helper_opts to allow callers to set "backlog" value via start_serv

[PATCH bpf-next v11 2/9] selftests/bpf: Add ASSERT_OK_FD macro

2024-07-09 Thread Geliang Tang
From: Geliang Tang Add a new dedicated ASSERT macro ASSERT_OK_FD to test whether a socket FD is valid or not. It can be used to replace macros ASSERT_GT(fd, 0, ""), ASSERT_NEQ(fd, -1, "") or statements (fd < 0), (fd != -1). Suggested-by: Martin KaFai Lau Signed-off-by: G

[PATCH bpf-next v11 0/9] use network helpers, part 8

2024-07-09 Thread Geliang Tang
From: Geliang Tang v11: - new patches 2, 4, 6. - drop expect_errno from network_helper_opts as Eduard and Martin suggested. - drop sockmap_ktls patches from this set. - add a new helper connect_fd_to_addr_str. v10: - a new patch 10 is added. - patches 1-6, 8-9 unchanged, only commit

Re: [PATCH bpf-next v10 02/12] selftests/bpf: Use start_server_str in sockmap_ktls

2024-07-08 Thread Geliang Tang
On Mon, 2024-07-08 at 10:29 +0800, Geliang Tang wrote: > > > > From: Geliang Tang > > > > > > > > Include network_helpers.h in prog_tests/sockmap_ktls.c, use > > > > public > > > > network > > > > helper start_server_str()

Re: [PATCH bpf-next v9 00/11] use network helpers, part 8

2024-07-07 Thread Geliang Tang
On Sat, 2024-07-06 at 22:45 +0800, Geliang Tang wrote: > From: Geliang Tang > > v9: >  - new patches 5-7, new struct member expect_errno for > network_helper_opts. >  - patches 1-4, 8-9 unchanged. >  - update patches 10-11 to make sure all tests pass. Superseded, v10 is se

[PATCH bpf-next v10 12/12] selftests/bpf: Drop make_socket in sk_lookup

2024-07-07 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() in run_multi_prog_lookup() instead of using make_socket() + connect(). Then make_socket() and inetaddr_len() can be dropped now. make_client() returns normal "fd" instead of "-1" when connect() fails but "expect_errn

[PATCH bpf-next v10 11/12] selftests/bpf: Use connect_to_addr in sk_lookup

2024-07-07 Thread Geliang Tang
From: Geliang Tang Add a new parameter expect_errno for make_client(), and use public network helpers make_sockaddr() + connect_to_addr() in it instead of using local defined function make_socket() + connect(). This local function can be dropped latter. A new parameter "expect_errno"

[PATCH bpf-next v10 10/12] selftests/bpf: Use connect_fd_to_fd in sk_lookup

2024-07-07 Thread Geliang Tang
From: Geliang Tang This patch uses public helper connect_fd_to_fd() exported in network_helpers.h instead of using getsockname() + connect() in run_lookup_prog() in prog_tests/sk_lookup.c. This can simplify the code. Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_tests

[PATCH bpf-next v10 09/12] selftests/bpf: Use start_server_str in sk_lookup

2024-07-07 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_addr() instead of local defined function make_server() in prog_tests/sk_lookup.c to avoid duplicate code. Add a helper setsockopts() to set SOL_CUSTOM sockopt looply, set it to setsockopt pointer of struct network_helper_opts, and

[PATCH bpf-next v10 06/12] selftests/bpf: Add expect_errno for network_helper_opts

2024-07-07 Thread Geliang Tang
From: Geliang Tang The errno EPERM is skipped in connect_fd_to_addr() by cgroup_v1v2 tests. More generally, it makes sense to add a struct member "expect_errno" for network_helper_opts to identify the expect errno to be skipped. Correspondingly, connect_fd_to_addr() helper needs to

[PATCH bpf-next v10 08/12] selftests/bpf: Close fd in error path in drop_on_reuseport

2024-07-07 Thread Geliang Tang
From: Geliang Tang In the error path when update_lookup_map() fails in drop_on_reuseport in prog_tests/sk_lookup.c, "server1", the fd of server 1, should be closed. This patch fixes this by using "goto close_srv1" lable instead of "detach" to close "serve

[PATCH bpf-next v10 07/12] selftests/bpf: Set expect_errno for cgroup_skb_sk_lookup

2024-07-07 Thread Geliang Tang
From: Geliang Tang EINPROGRESS is skipped in run_lookup_test() in cgroup_skb_sk_lookup tests, but it is still showed in the log: ./test_progs -t cgroup_skb_sk_lookup -v run_cgroup_bpf_test:PASS:skel_open_load 0 nsec run_cgroup_bpf_test:PASS:cgroup_join 0 nsec

[PATCH bpf-next v10 05/12] selftests/bpf: Add network_helper_opts for connect_fd_to_fd

2024-07-07 Thread Geliang Tang
From: Geliang Tang To make connect_fd_to_fd() more flexible, use a struct network_helper_opts parameter "opts" instead of timeout_ms. With this change, other opts like "must_fail" can be used in connect_fd_to_fd() too. Signed-off-by: Geliang Tang --- tools/t

[PATCH bpf-next v10 04/12] selftests/bpf: Use make_sockaddr in sockmap_ktls

2024-07-07 Thread Geliang Tang
From: Geliang Tang This patch uses public helper make_sockaddr() exported in network_helpers.h instead of open-coding in sockmap_ktls.c. This can avoid duplicate code. Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c | 16

[PATCH bpf-next v10 03/12] selftests/bpf: Use connect_to_fd_opts in sockmap_ktls

2024-07-07 Thread Geliang Tang
From: Geliang Tang Use public network helper connect_to_fd_opts() instead of open-coding it in prog_tests/sockmap_ktls.c. This can avoid duplicate code. Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c| 14 ++ 1 file

[PATCH bpf-next v10 02/12] selftests/bpf: Use start_server_str in sockmap_ktls

2024-07-07 Thread Geliang Tang
From: Geliang Tang Include network_helpers.h in prog_tests/sockmap_ktls.c, use public network helper start_server_str() instead of local defined function tcp_server(). This can avoid duplicate code. Technically, this is not a one-for-one replacement, as start_server_str() also does bind(). But

[PATCH bpf-next v10 01/12] selftests/bpf: Add backlog for network_helper_opts

2024-07-07 Thread Geliang Tang
From: Geliang Tang Some callers expect __start_server() helper to pass their own "backlog" value to listen() instead of the default of 1. So this patch adds struct member "backlog" for network_helper_opts to allow callers to set "backlog" value via start_serv

[PATCH bpf-next v10 00/12] use network helpers, part 8

2024-07-07 Thread Geliang Tang
From: Geliang Tang v10: - a new patch 10 is added. - patches 1-6, 8-9 unchanged, only commit logs updated. - "err = -errno" is used in patches 7, 11, 12 to get the real error number before checking value of "err". v9: - new patches 5-7, new struct mem

[PATCH bpf-next v9 11/11] selftests/bpf: Drop make_socket in sk_lookup

2024-07-06 Thread Geliang Tang
From: Geliang Tang Use local helper make_client() in run_multi_prog_lookup() instead of using make_socket() + connect(). Then make_socket() and inetaddr_len() can be dropped now. Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sk_lookup.c | 46 ++- 1 file

[PATCH bpf-next v9 10/11] selftests/bpf: Use connect_to_addr in sk_lookup

2024-07-06 Thread Geliang Tang
From: Geliang Tang Add a new parameter expect_errno for make_client(), and use public network helpers make_sockaddr() + connect_to_addr() in it instead of using local defined function make_socket() + connect(). This local function can be dropped latter. Signed-off-by: Geliang Tang

[PATCH bpf-next v9 09/11] selftests/bpf: Use start_server_str in sk_lookup

2024-07-06 Thread Geliang Tang
From: Geliang Tang This patch uses public helper start_server_addr() instead of local defined function make_server() in prog_tests/sk_lookup.c to avoid duplicate code. Add a helper setsockopts() to set SOL_CUSTOM sockopt looply, set it to setsockopt pointer of struct network_helper_opts, and

[PATCH bpf-next v9 08/11] selftests/bpf: Close fd in error path in drop_on_reuseport

2024-07-06 Thread Geliang Tang
From: Geliang Tang Server 1 fd should be closed in the error path when update_lookup_map() fails. This patch fixes it by goto "close_srv1" instead of "detach" lable in that case. Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- tools/testing/selftests/bpf/prog_t

[PATCH bpf-next v9 07/11] selftests/bpf: Set expect_errno for cgroup_skb_sk_lookup

2024-07-06 Thread Geliang Tang
From: Geliang Tang EINPROGRESS is skipped in run_lookup_test() in cgroup_skb_sk_lookup tests, but it is still showed in the log: ./test_progs -t cgroup_skb_sk_lookup -v run_cgroup_bpf_test:PASS:skel_open_load 0 nsec run_cgroup_bpf_test:PASS:cgroup_join 0 nsec

[PATCH bpf-next v9 06/11] selftests/bpf: Add expect_errno for network_helper_opts

2024-07-06 Thread Geliang Tang
From: Geliang Tang The errno EPERM is skipped in connect_fd_to_addr() by cgroup_v1v2 tests. More generally, it makes sense to add a "expect_errno" struct member for network_helper_opts to identify the expect errno to be skipped. Signed-off-by: Geliang Tang --- tools/testing/sel

[PATCH bpf-next v9 05/11] selftests/bpf: Add network_helper_opts for connect_fd_to_fd

2024-07-06 Thread Geliang Tang
From: Geliang Tang To make connect_fd_to_fd() more flexible, use a struct network_helper_opts parameter "opts" instead of timeout_ms. With this change, other opts like "must_fail" can be used in connect_fd_to_fd() too. Signed-off-by: Geliang Tang --- tools/t

[PATCH bpf-next v9 04/11] selftests/bpf: Use make_sockaddr in sockmap_ktls

2024-07-06 Thread Geliang Tang
From: Geliang Tang This patch uses public helper make_sockaddr() exported in network_helpers.h instead of open-coding in sockmap_ktls.c. This can avoid duplicate code. Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c | 16

[PATCH bpf-next v9 03/11] selftests/bpf: Use connect_to_fd_opts in sockmap_ktls

2024-07-06 Thread Geliang Tang
From: Geliang Tang Use public network helper connect_to_fd_opts() instead of open-coding it in prog_tests/sockmap_ktls.c. This can avoid duplicate code. Acked-by: Eduard Zingerman Signed-off-by: Geliang Tang --- .../selftests/bpf/prog_tests/sockmap_ktls.c| 14 ++ 1 file

[PATCH bpf-next v9 02/11] selftests/bpf: Use start_server_str in sockmap_ktls

2024-07-06 Thread Geliang Tang
From: Geliang Tang Include network_helpers.h in prog_tests/sockmap_ktls.c, use public network helper start_server_str() instead of local defined function tcp_server(). This can avoid duplicate code. Technically, this is not a one-for-one replacement, as start_server_str() also does bind(). But

[PATCH bpf-next v9 01/11] selftests/bpf: Add backlog for network_helper_opts

2024-07-06 Thread Geliang Tang
From: Geliang Tang Some callers expect __start_server() helper to pass their own "backlog" value to listen() instead of the default of 1. So this patch adds struct member "backlog" for network_helper_opts to allow callers to set "backlog" value via start_serv

  1   2   3   4   5   >