selftests/bpf: Use connect_to_fd_opts in do_test in bpf_tcp_ca
authorGeliang Tang <tanggeliang@kylinos.cn>
Thu, 30 May 2024 07:41:08 +0000 (15:41 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 6 Jun 2024 21:04:05 +0000 (23:04 +0200)
commit9abdfd8a212332c64f6d0a27fc2ad69e9e0335d1
tree5196cf3014b60e094cd31bf19c615754b874cbf3
parent08ac454e258e38813afb906650f19acce3afd982
selftests/bpf: Use connect_to_fd_opts in do_test in bpf_tcp_ca

This patch uses connect_to_fd_opts() instead of using connect_fd_to_fd()
and settcpca() in do_test() in prog_tests/bpf_tcp_ca.c to accept a struct
network_helper_opts argument.

Then define a dctcp dedicated post_socket_cb callback stg_post_socket_cb(),
invoking both settcpca() and bpf_map_update_elem() in it, and set it in
test_dctcp(). For passing map_fd into stg_post_socket_cb() callback, a new
member map_fd is added in struct cb_opts.

Add another "const struct network_helper_opts *cli_opts" to do_test() to
separate it from the server "opts".

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/876ec90430865bc468e3b7f6fb2648420b075548.1717054461.git.tanggeliang@kylinos.cn
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c