From: Eduard Zingerman <eddyz87@gmail.com>
To: Geliang Tang <geliang@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
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>
Cc: Geliang Tang <tanggeliang@kylinos.cn>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/5] selftests/bpf: Drop type from network_helper_opts
Date: Tue, 11 Jun 2024 14:20:48 -0700 [thread overview]
Message-ID: <90648db3ed02c6f75ce2f90cf6651c8a6f0123a0.camel@gmail.com> (raw)
In-Reply-To: <b80ca04f4f1e65e4b796331c48283ea282fe7ee0.1718070939.git.tanggeliang@kylinos.cn>
On Tue, 2024-06-11 at 09:59 +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> The opts.{type, noconnect, must_fail} 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. It's much better that test should have its own connect_to_fd_opts()
> instead.
>
> This patch adds a new helper named __connect_to_fd_opts() to do this. It
> accepts a new "type" parameter, then opts->type can be replaced by "type"
> parameter in this helper. In test_bpf_ip_check_defrag_ok, different types
> are passed to it. And the strcut member "type" of network_helper_opts can
> be dropped now.
>
> Then connect_to_fd_opts can implement as a wrapper of this new helper.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
Patches #1,2,3 trade options specified as struct fields for options
specified as function parameters. Tbh, this seems to be an opinionated
stylistic change, what is the need for it?
If anything, I think that this is less readable:
> + client_rx_fd = __connect_to_fd_opts(srv_fd, 0, &rx_opts);
compared to this:
> struct network_helper_opts tx_ops = {
> .timeout_ms = 1000,
> - .type = SOCK_RAW,
> .proto = IPPROTO_RAW,
> .noconnect = true,
> };
...
> - client_rx_fd = connect_to_fd_opts(srv_fd, &rx_opts);
(given that by patch #3 three parameters are added to
__connect_to_fd_opts() *and* it also accepts options).
[...]
next prev parent reply other threads:[~2024-06-11 21:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 1:59 [PATCH bpf-next 0/5] use network helpers, part 7 Geliang Tang
2024-06-11 1:59 ` [PATCH bpf-next 1/5] selftests/bpf: Drop type from network_helper_opts Geliang Tang
2024-06-11 21:20 ` Eduard Zingerman [this message]
2024-06-12 3:39 ` Geliang Tang
2024-06-11 1:59 ` [PATCH bpf-next 2/5] selftests/bpf: Drop noconnect " Geliang Tang
2024-06-11 1:59 ` [PATCH bpf-next 3/5] selftests/bpf: Drop must_fail " Geliang Tang
2024-06-11 1:59 ` [PATCH bpf-next 4/5] selftests/bpf: Use start_server_str in mptcp Geliang Tang
2024-06-11 21:11 ` Eduard Zingerman
2024-06-11 1:59 ` [PATCH bpf-next 5/5] selftests/bpf: Use start_server_str in test_tcp_check_syncookie_user Geliang Tang
2024-06-11 21:13 ` Eduard Zingerman
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=90648db3ed02c6f75ce2f90cf6651c8a6f0123a0.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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=martin.lau@linux.dev \
--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