On Mon, May 2, 2022 at 2:12 PM Mat Martineau <mathew.j.martineau@xxxxxxxxxxxxxxx> wrote: > > From: Geliang Tang <geliang.tang@xxxxxxxx> > > 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 > > Acked-by: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx> > Signed-off-by: Geliang Tang <geliang.tang@xxxxxxxx> > Signed-off-by: Mat Martineau <mathew.j.martineau@xxxxxxxxxxxxxxx> > --- > MAINTAINERS | 1 + > .../testing/selftests/bpf/bpf_mptcp_helpers.h | 14 ++++++++ > .../testing/selftests/bpf/prog_tests/mptcp.c | 36 +++++++++++++++---- > .../testing/selftests/bpf/progs/mptcp_sock.c | 24 ++++++++++--- > 4 files changed, 65 insertions(+), 10 deletions(-) > create mode 100644 tools/testing/selftests/bpf/bpf_mptcp_helpers.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 359afc617b92..d48d3cb6abbc 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -13780,6 +13780,7 @@ F: include/net/mptcp.h > F: include/trace/events/mptcp.h > F: include/uapi/linux/mptcp.h > F: net/mptcp/ > +F: tools/testing/selftests/bpf/bpf_mptcp_helpers.h > F: tools/testing/selftests/bpf/*/*mptcp*.c > F: tools/testing/selftests/net/mptcp/ > > diff --git a/tools/testing/selftests/bpf/bpf_mptcp_helpers.h b/tools/testing/selftests/bpf/bpf_mptcp_helpers.h > new file mode 100644 > index 000000000000..18da4cc65e89 > --- /dev/null > +++ b/tools/testing/selftests/bpf/bpf_mptcp_helpers.h > @@ -0,0 +1,14 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* Copyright (c) 2022, SUSE. */ > + > +#ifndef __BPF_MPTCP_HELPERS_H > +#define __BPF_MPTCP_HELPERS_H > + > +#include "bpf_tcp_helpers.h" > + > +struct mptcp_sock { > + struct inet_connection_sock sk; > + > +} __attribute__((preserve_access_index)); why can't all this live in bpf_tcp_helpers.h? why do we need extra header? > + > +#endif > diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c > index cd548bb2828f..4b40bbdaf91f 100644 > --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c > +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c > @@ -10,14 +10,12 @@ struct mptcp_storage { > __u32 is_mptcp; > }; > [...]