[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzaMz=CR5H=_BXgQ8UfDC6mDawgNbGb5XyYBOBqkkS83Hg@mail.gmail.com>
Date: Mon, 16 May 2022 15:47:34 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Geliang Tang <geliang.tang@...e.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, mptcp@...ts.linux.dev,
Matthieu Baerts <matthieu.baerts@...sares.net>
Subject: Re: [PATCH bpf-next v4 4/7] selftests/bpf: test bpf_skc_to_mptcp_sock
On Fri, May 13, 2022 at 3:48 PM Mat Martineau
<mathew.j.martineau@...ux.intel.com> wrote:
>
> From: Geliang Tang <geliang.tang@...e.com>
>
> This patch extends the MPTCP test base, to test the new helper
> bpf_skc_to_mptcp_sock().
>
> Define struct mptcp_sock in bpf_tcp_helpers.h, use bpf_skc_to_mptcp_sock
> to get the msk socket in progs/mptcp_sock.c and store the infos in
> socket_storage_map.
>
> Get the infos from socket_storage_map in prog_tests/mptcp.c. Add a new
> function verify_msk() to verify the infos of MPTCP socket, and rename
> verify_sk() to verify_tsk() to verify TCP socket only.
>
> v2: Add CONFIG_MPTCP check for clearer error messages
> v4:
> - use ASSERT_* instead of CHECK_FAIL (Andrii)
> - drop bpf_mptcp_helpers.h (Andrii)
>
> Acked-by: Matthieu Baerts <matthieu.baerts@...sares.net>
> Signed-off-by: Geliang Tang <geliang.tang@...e.com>
> Signed-off-by: Mat Martineau <mathew.j.martineau@...ux.intel.com>
> ---
> tools/testing/selftests/bpf/bpf_tcp_helpers.h | 5 +++
> .../testing/selftests/bpf/prog_tests/mptcp.c | 45 ++++++++++++++-----
> .../testing/selftests/bpf/progs/mptcp_sock.c | 23 ++++++++--
> 3 files changed, 58 insertions(+), 15 deletions(-)
>
[...]
> +static int verify_msk(int map_fd, int client_fd)
> +{
> + char *msg = "MPTCP subflow socket";
> + int err, cfd = client_fd;
> + struct mptcp_storage val;
> +
> + err = bpf_map_lookup_elem(map_fd, &cfd, &val);
> + if (!ASSERT_OK(err, "bpf_map_lookup_elem"))
> + return err;
> +
> + if (val.invoked != 1) {
> + log_err("%s: unexpected invoked count %d != 1",
> + msg, val.invoked);
> + err++;
> + }
> +
> + if (val.is_mptcp != 1) {
> + log_err("%s: unexpected bpf_tcp_sock.is_mptcp %d != 1",
> + msg, val.is_mptcp);
> + err++;
> + }
any reason to not use ASSERT_NEQ ?
> +
> + return err;
> +}
> +
> static int run_test(int cgroup_fd, int server_fd, bool is_mptcp)
> {
> int client_fd, prog_fd, map_fd, err;
[...]
Powered by blists - more mailing lists