BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Handle EAGAIN in bpf_tcp_ca
@ 2024-03-28 10:23 Geliang Tang
  2024-03-28 16:55 ` Martin KaFai Lau
  0 siblings, 1 reply; 5+ messages in thread
From: Geliang Tang @ 2024-03-28 10:23 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>

bpf_tcp_ca tests may emit EAGAIN sometimes. In that case, tests fail with
"bytes != total_bytes" errors. Sending should continue, not break when
errno is EAGAIN. This patch can make bpf_tcp_ca tests stable.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 4 ++--
 1 file changed, 2 insertions(+), 2 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 077b107130f6..fbc219c2d53b 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -56,7 +56,7 @@ static void *server(void *arg)
 	while (bytes < total_bytes && !READ_ONCE(stop)) {
 		nr_sent = send(fd, &batch,
 			       MIN(total_bytes - bytes, sizeof(batch)), 0);
-		if (nr_sent == -1 && errno == EINTR)
+		if (nr_sent == -1 && (errno == EINTR || errno == EAGAIN))
 			continue;
 		if (nr_sent == -1) {
 			err = -errno;
@@ -131,7 +131,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
 	while (bytes < total_bytes && !READ_ONCE(stop)) {
 		nr_recv = recv(fd, &batch,
 			       MIN(total_bytes - bytes, sizeof(batch)), 0);
-		if (nr_recv == -1 && errno == EINTR)
+		if (nr_recv == -1 && (errno == EINTR || errno == EAGAIN))
 			continue;
 		if (nr_recv == -1)
 			break;
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-02 10:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-28 10:23 [PATCH bpf-next] selftests/bpf: Handle EAGAIN in bpf_tcp_ca Geliang Tang
2024-03-28 16:55 ` Martin KaFai Lau
2024-03-29  5:57   ` Geliang Tang
2024-03-29 17:27     ` Martin KaFai Lau
2024-04-02 10:53       ` Geliang Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox