From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v7 2/4] selftests/bpf: Add getsockopt to inspect mptcp subflow
Date: Tue, 3 Sep 2024 11:16:36 +0200 [thread overview]
Message-ID: <b8394aac-0fc7-4c40-8125-77450737c323@kernel.org> (raw)
In-Reply-To: <b32de9d6-f941-46d0-9805-ad542ef6f5d6@kernel.org>
On 03/09/2024 11:11, Matthieu Baerts wrote:
> On 03/09/2024 10:04, Geliang Tang wrote:
>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>
>> This patch adds a "cgroup/getsockopt" way to inspect the subflows of a
>> mptcp socket.
>>
>> mptcp_for_each_stubflow() and other helpers related to list_dentry are
>> added into progs/mptcp_bpf.h.
>>
>> Add an extra "cgroup/getsockopt" prog to walk the msk->conn_list and use
>> bpf_core_cast to cast a pointer to tcp_sock for readonly. It will allow
>> to inspect all the fields in a tcp_sock.
>
> (...)
>
>> diff --git a/tools/testing/selftests/bpf/progs/mptcp_subflow.c b/tools/testing/selftests/bpf/progs/mptcp_subflow.c
>> index 2e28f4a215b5..1053a795eb43 100644
>> --- a/tools/testing/selftests/bpf/progs/mptcp_subflow.c
>> +++ b/tools/testing/selftests/bpf/progs/mptcp_subflow.c
>> @@ -4,6 +4,7 @@
>>
>> /* vmlinux.h, bpf_helpers.h and other 'define' */
>> #include "bpf_tracing_net.h"
>> +#include "mptcp_bpf.h"
>>
>> char _license[] SEC("license") = "GPL";
>>
>> @@ -57,3 +58,92 @@ int mptcp_subflow(struct bpf_sock_ops *skops)
>>
>> return 1;
>> }
>> +
>> +static int _check_getsockopt_subflow_mark(struct bpf_sock *sk)
>> +{
>> + struct mptcp_subflow_context *subflow;
>> + struct mptcp_sock *msk;
>> + int i = 0;
>> +
>> + if (sk->protocol != IPPROTO_MPTCP) {
>> + bpf_printk("MPTCP Subflow: unexpected protocol %u", sk->protocol);
>> + return -1;
>> + }
>
> Out of curiosity, why did you move this code here and in
> _check_getsockopt_subflow_cc()?
>
> I'm just surprised because recently, you tried to reduce the amount of
> duplicated code :)
While at it: it sounds better to have unique error messages, to know
where was the error. Here, a few messages are the same, e.g. protocol,
number of subflows, sk is null. Do not hesitate to add something to
differentiate them: level & optname, a string prefix, the line number, etc.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-09-03 9:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 8:04 [PATCH mptcp-next v7 0/4] fixes for "new MPTCP subflow subtest v4" Geliang Tang
2024-09-03 8:04 ` [PATCH mptcp-next v7 1/4] Squash to "selftests/bpf: Add mptcp subflow example" Geliang Tang
2024-09-03 8:04 ` [PATCH mptcp-next v7 2/4] selftests/bpf: Add getsockopt to inspect mptcp subflow Geliang Tang
2024-09-03 9:11 ` Matthieu Baerts
2024-09-03 9:16 ` Matthieu Baerts [this message]
2024-09-04 9:55 ` Geliang Tang
2024-09-04 10:29 ` Matthieu Baerts
2024-09-04 10:09 ` Geliang Tang
2024-09-04 10:35 ` Matthieu Baerts
2024-09-03 8:04 ` [PATCH mptcp-next v7 3/4] Squash to "selftests/bpf: Add mptcp subflow subtest" Geliang Tang
2024-09-03 8:05 ` [PATCH mptcp-next v7 4/4] Squash to "selftests/bpf: Add bpf scheduler test" Geliang Tang
2024-09-03 8:59 ` [PATCH mptcp-next v7 0/4] fixes for "new MPTCP subflow subtest v4" MPTCP CI
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=b8394aac-0fc7-4c40-8125-77450737c323@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/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