public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Geliang Tang <geliang@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Mykola Lysenko <mykolal@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Geliang Tang <tanggeliang@kylinos.cn>,
	bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 2/8] selftests/bpf: Drop type parameter of start_server_addr
Date: Thu, 23 May 2024 12:06:29 -0700	[thread overview]
Message-ID: <5c6beff5-2fb0-489b-917d-688a98f51175@linux.dev> (raw)
In-Reply-To: <65dd42dd91d678740e9c05e32852f5e01ba2b7bc.1716369375.git.tanggeliang@kylinos.cn>

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
> +++ b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
> @@ -255,6 +255,9 @@ void test_sk_assign(void)
>   
>   	for (i = 0; i < ARRAY_SIZE(tests) && !READ_ONCE(stop); i++) {
>   		struct test_sk_cfg *test = &tests[i];
> +		struct network_helper_opts opts = {
> +			.type = test->type,

I think dropping the type arg from the start_server_addr (and other existing 
helpers) is wrong.

"type" is the common case that tests usually want to specify here (at least 
between SOCK_STREAM and SOCK_DGRAM). It becomes optional (opts) now and have a 
more complicated way to pass it to the the start_server_addr, connect_to_addr...etc.

imo, the opts.{type, proto, noconnect} is at least a bit non intuitive or 
unnecessary. The only use case now is in test_bpf_ip_check_defrag_ok which ends 
up bypassing most (or at least some) of the connect_to_fd_opts() logic. May be 
that test should have its own connect_to_fd_opts() instead. However, lets leave 
this potential cleanup out for later and not complicate this set further.

Please keep type as the individual arg to the helper functions.

pw-bot: cr

> +		};
>   		const struct sockaddr *addr;
>   		const int zero = 0;
>   		int err;
> @@ -263,9 +266,8 @@ void test_sk_assign(void)
>   			continue;
>   		prepare_addr(test->addr, test->family, BIND_PORT, false);
>   		addr = (const struct sockaddr *)test->addr;
> -		server = start_server_addr(test->type,
> -					   (const struct sockaddr_storage *)addr,
> -					   test->len, NULL);
> +		server = start_server_addr((const struct sockaddr_storage *)addr,
> +					   test->len, &opts);


  reply	other threads:[~2024-05-23 19:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22  9:23 [PATCH bpf-next v3 0/8] use network helpers, part 5 Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 1/8] selftests/bpf: Drop struct post_socket_opts Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 2/8] selftests/bpf: Drop type parameter of start_server_addr Geliang Tang
2024-05-23 19:06   ` Martin KaFai Lau [this message]
2024-05-22  9:23 ` [PATCH bpf-next v3 3/8] selftests/bpf: Drop type parameter of connect_to_addr Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 4/8] selftests/bpf: Add start_server_str helper Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 5/8] selftests/bpf: Use post_socket_cb in connect_to_fd_opts Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 6/8] selftests/bpf: Use start_server_str in bpf_tcp_ca Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 7/8] selftests/bpf: Use connect_to_fd_opts in do_test " Geliang Tang
2024-05-22  9:23 ` [PATCH bpf-next v3 8/8] selftests/bpf: Add post_connect_cb callback Geliang Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c6beff5-2fb0-489b-917d-688a98f51175@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=geliang@kernel.org \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mykolal@fb.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tanggeliang@kylinos.cn \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox