Commit 79b330c5 authored by Geliang Tang's avatar Geliang Tang Committed by Martin KaFai Lau

selftests/bpf: Use post_socket_cb in start_server_str

This patch uses start_server_str() helper in test_dctcp_fallback() in
bpf_tcp_ca.c, instead of using start_server() and settcpca(). For
support opts in start_server_str() helper, opts->cb_opts needs to be
passed to post_socket_cb() in __start_server().
Signed-off-by: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Link: https://lore.kernel.org/r/414c749321fa150435f7fe8e12c80fec8b447c78.1716638248.git.tanggeliang@kylinos.cnSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent e078255a
......@@ -94,7 +94,8 @@ static int __start_server(int type, const struct sockaddr *addr, socklen_t addrl
if (settimeo(fd, opts->timeout_ms))
goto error_close;
if (opts->post_socket_cb && opts->post_socket_cb(fd, NULL)) {
if (opts->post_socket_cb &&
opts->post_socket_cb(fd, opts->cb_opts)) {
log_err("Failed to call post_socket_cb");
goto error_close;
}
......
......@@ -187,6 +187,9 @@ static void test_dctcp_fallback(void)
};
struct bpf_dctcp *dctcp_skel;
struct bpf_link *link = NULL;
struct cb_opts dctcp = {
.cc = "bpf_dctcp",
};
struct cb_opts cubic = {
.cc = "cubic",
};
......@@ -204,9 +207,9 @@ static void test_dctcp_fallback(void)
if (!ASSERT_OK_PTR(link, "dctcp link"))
goto done;
lfd = start_server(AF_INET6, SOCK_STREAM, "::1", 0, 0);
if (!ASSERT_GE(lfd, 0, "lfd") ||
!ASSERT_OK(settcpca(lfd, "bpf_dctcp"), "lfd=>bpf_dctcp"))
opts.cb_opts = &dctcp;
lfd = start_server_str(AF_INET6, SOCK_STREAM, "::1", 0, &opts);
if (!ASSERT_GE(lfd, 0, "lfd"))
goto done;
opts.cb_opts = &cubic;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment