From: Geliang Tang <tanggeliang@xxxxxxxxxx> 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@xxxxxxxxxx> --- 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