[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5313b129-72b1-4fdc-954e-e2d0a141a99c@linux.dev>
Date: Thu, 23 Jan 2025 17:38:28 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Geliang Tang <geliang@...nel.org>
Cc: "Matthieu Baerts (NGI0)" <matttbe@...nel.org>, mptcp@...ts.linux.dev,
Mat Martineau <martineau@...nel.org>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH bpf-next/net v2 7/7] selftests/bpf: Add mptcp_subflow
bpf_iter subtest
On 12/19/24 7:46 AM, Matthieu Baerts (NGI0) wrote:
> +SEC("cgroup/getsockopt")
> +int iters_subflow(struct bpf_sockopt *ctx)
> +{
> + struct mptcp_subflow_context *subflow;
> + struct bpf_sock *sk = ctx->sk;
> + struct sock *ssk = NULL;
> + struct mptcp_sock *msk;
> + int local_ids = 0;
> +
> + if (ctx->level != SOL_TCP || ctx->optname != TCP_IS_MPTCP)
> + return 1;
> +
> + msk = bpf_skc_to_mptcp_sock(sk);
> + if (!msk || msk->pm.server_side || !msk->pm.subflows)
> + return 1;
> +
> + msk = bpf_mptcp_sock_acquire(msk);
> + if (!msk)
> + return 1;
> + bpf_for_each(mptcp_subflow, subflow, msk) {
> + /* Here MPTCP-specific packet scheduler kfunc can be called:
> + * this test is not doing anything really useful, only to
> + * verify the iteration works.
> + */
> +
> + local_ids += subflow->subflow_id;
> +
> + /* only to check the following kfunc works */
> + ssk = mptcp_subflow_tcp_sock(subflow);
It is good to have test cases to exercise the new iter and kfunc. Thanks.
However, it seems not useful to show how it will be used in the future
packet/subflow scheduler. iiuc, the core piece is in bpf_struct_ops. Without it,
it is hard to comment. Any RFC patches ready to be posted?
> + }
> +
> + if (!ssk)
> + goto out;
> +
> + /* assert: if not OK, something wrong on the kernel side */
> + if (ssk->sk_dport != ((struct sock *)msk)->sk_dport)
> + goto out;
> +
> + /* only to check the following kfunc works */
> + subflow = bpf_mptcp_subflow_ctx(ssk);
> + if (!subflow || subflow->token != msk->token)
> + goto out;
> +
> + ids = local_ids;
> +
> +out:
> + bpf_mptcp_sock_release(msk);
> + return 1;
> +}
Powered by blists - more mailing lists