* [PATCH bpf-next v3 0/2] Use start_server and connect_fd_to_fd
@ 2024-03-26 1:26 Geliang Tang
2024-03-26 1:26 ` [PATCH bpf-next v3 1/2] Squash to "selftests/bpf: Use start_server in bpf_tcp_ca" Geliang Tang
2024-03-26 1:26 ` [PATCH bpf-next v3 2/2] selftests/bpf: Use connect_fd_to_fd in bpf_tcp_ca Geliang Tang
0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2024-03-26 1:26 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan
Cc: Geliang Tang, bpf, mptcp
From: Geliang Tang <tanggeliang@kylinos.cn>
v3:
- split v2 as two patches as Daniel suggested.
- The patch "selftests/bpf: Use start_server in bpf_tcp_ca" is merged
by Daniel (thanks), but I forgot to drop 'settimeo(lfd, 0)' in it, so
I send a squash-to patch to fix this.
Geliang Tang (2):
Squash to "selftests/bpf: Use start_server in bpf_tcp_ca"
selftests/bpf: Use connect_fd_to_fd in bpf_tcp_ca
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH bpf-next v3 1/2] Squash to "selftests/bpf: Use start_server in bpf_tcp_ca"
2024-03-26 1:26 [PATCH bpf-next v3 0/2] Use start_server and connect_fd_to_fd Geliang Tang
@ 2024-03-26 1:26 ` Geliang Tang
2024-03-26 1:26 ` [PATCH bpf-next v3 2/2] selftests/bpf: Use connect_fd_to_fd in bpf_tcp_ca Geliang Tang
1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2024-03-26 1:26 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan
Cc: Geliang Tang, bpf, mptcp
From: Geliang Tang <tanggeliang@kylinos.cn>
Please add these lines into commit log:
'''
settimeo(lfd, 0) is invoked in start_server() already, drop the
duplicate one.
'''
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
index 94cb22b01482..f44abb990804 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -100,7 +100,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
}
if (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca) ||
- settimeo(lfd, 0) || settimeo(fd, 0))
+ settimeo(fd, 0))
goto done;
err = getsockname(lfd, (struct sockaddr *)&sa6, &addrlen);
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH bpf-next v3 2/2] selftests/bpf: Use connect_fd_to_fd in bpf_tcp_ca
2024-03-26 1:26 [PATCH bpf-next v3 0/2] Use start_server and connect_fd_to_fd Geliang Tang
2024-03-26 1:26 ` [PATCH bpf-next v3 1/2] Squash to "selftests/bpf: Use start_server in bpf_tcp_ca" Geliang Tang
@ 2024-03-26 1:26 ` Geliang Tang
1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2024-03-26 1:26 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan
Cc: Geliang Tang, bpf, mptcp
From: Geliang Tang <tanggeliang@kylinos.cn>
To simplify the code, use BPF selftests helper connect_fd_to_fd() in
bpf_tcp_ca.c instead of open-coding it. This helper is defined in
network_helpers.c, and exported in network_helpers.h, which is already
included in bpf_tcp_ca.c.
settimeo(fd, 0) is invoked in connect_fd_to_fd() already, drop the
duplicate one.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
index f44abb990804..3da3030c9365 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -78,11 +78,9 @@ static void *server(void *arg)
static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
{
- struct sockaddr_in6 sa6 = {};
ssize_t nr_recv = 0, bytes = 0;
int lfd = -1, fd = -1;
pthread_t srv_thread;
- socklen_t addrlen = sizeof(sa6);
void *thread_ret;
char batch[1500];
int err;
@@ -99,12 +97,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
return;
}
- if (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca) ||
- settimeo(fd, 0))
- goto done;
-
- err = getsockname(lfd, (struct sockaddr *)&sa6, &addrlen);
- if (!ASSERT_NEQ(err, -1, "getsockname"))
+ if (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca))
goto done;
if (sk_stg_map) {
@@ -115,7 +108,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
}
/* connect to server */
- err = connect(fd, (struct sockaddr *)&sa6, addrlen);
+ err = connect_fd_to_fd(fd, lfd, 0);
if (!ASSERT_NEQ(err, -1, "connect"))
goto done;
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-26 1:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 1:26 [PATCH bpf-next v3 0/2] Use start_server and connect_fd_to_fd Geliang Tang
2024-03-26 1:26 ` [PATCH bpf-next v3 1/2] Squash to "selftests/bpf: Use start_server in bpf_tcp_ca" Geliang Tang
2024-03-26 1:26 ` [PATCH bpf-next v3 2/2] selftests/bpf: Use connect_fd_to_fd in bpf_tcp_ca Geliang Tang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.