]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Test bpf_skc_to_mptcp_sock
authorGeliang Tang <geliang.tang@suse.com>
Thu, 19 May 2022 23:30:13 +0000 (16:30 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 20 May 2022 22:34:39 +0000 (15:34 -0700)
commit86080a592f71702a5d7233caa2159055168641db
treee1f280ff9fdf81d6257ad49cd730e1e8accd8de5
parent79466e4391fa38b454c326376821625e60c46e6c
selftests/bpf: Test bpf_skc_to_mptcp_sock

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)

v5:
 - some 'ASSERT_*' were replaced in the next commit by mistake.
 - Drop CONFIG_MPTCP (Martin)
 - Use ASSERT_EQ (Andrii)

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Link: https://lore.kernel.org/bpf/20220519233016.105670-5-mathew.j.martineau@linux.intel.com
tools/testing/selftests/bpf/bpf_tcp_helpers.h
tools/testing/selftests/bpf/prog_tests/mptcp.c
tools/testing/selftests/bpf/progs/mptcp_sock.c