summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/network_helpers.h
diff options
context:
space:
mode:
authorGeliang Tang <tanggeliang@kylinos.cn>2024-05-25 20:08:17 +0800
committerMartin KaFai Lau <martin.lau@kernel.org>2024-05-28 17:53:04 -0700
commite078255abd53ac44c9133fd98d51645dbd196123 (patch)
tree1046081598c5ee4209a49cd82b4a5aadb55b565f /tools/testing/selftests/bpf/network_helpers.h
parent6f802cb8988e8e41f2fdb74ac949d3a0ef9a9594 (diff)
selftests/bpf: Use post_socket_cb in connect_to_fd_opts
Since the post_socket_cb() callback is added in struct network_helper_opts, it's make sense to use it not only in __start_server(), but also in connect_to_fd_opts(). Then it can be used to set TCP_CONGESTION sockopt. Add a "void *" type member cb_opts into struct network_helper_opts, and add a new struct named cb_opts in prog_tests/bpf_tcp_ca.c, then cc can be moved into struct cb_opts from network_helper_opts. Define a new callback cc_cb() to set TCP_CONGESTION sockopt, and set it to post_socket_cb pointer of opts. Define a new cb_opts cubic, set it to cb_opts of opts. Pass this opts to connect_to_fd_opts() in test_dctcp_fallback(). Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Link: https://lore.kernel.org/r/b512bb8d8f6854c9ea5c409b69d1bf37c6f272c6.1716638248.git.tanggeliang@kylinos.cn Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/network_helpers.h')
-rw-r--r--tools/testing/selftests/bpf/network_helpers.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpers.h
index 4e3e6afe7d3a..11eea8e2e4f1 100644
--- a/tools/testing/selftests/bpf/network_helpers.h
+++ b/tools/testing/selftests/bpf/network_helpers.h
@@ -22,13 +22,13 @@ typedef __u16 __sum16;
#define MAGIC_BYTES 123
struct network_helper_opts {
- const char *cc;
int timeout_ms;
bool must_fail;
bool noconnect;
int type;
int proto;
int (*post_socket_cb)(int fd, void *opts);
+ void *cb_opts;
};
/* ipv4 test vector */