From 6166abfc0b78f82e808cd1d3d6c5cc51411a29c2 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Fri, 12 Apr 2024 14:27:36 +0800 Subject: [PATCH] Revert "selftests/bpf: Add select for send_recv_data" This reverts commit dee8fd82e20a544accc2b4df0645987e39d20fa3. --- tools/testing/selftests/bpf/network_helpers.c | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c index aa18283c0997..49a32ecc3c06 100644 --- a/tools/testing/selftests/bpf/network_helpers.c +++ b/tools/testing/selftests/bpf/network_helpers.c @@ -597,12 +597,9 @@ struct send_recv_arg { static void *send_recv_server(void *arg) { struct send_recv_arg *a = (struct send_recv_arg *)arg; - struct timeval timeout = { .tv_sec = 3 }; ssize_t nr_sent = 0, bytes = 0; char batch[1500]; int err = 0, fd; - fd_set wset; - int max_fd; fd = accept(a->fd, NULL, NULL); while (fd == -1) { @@ -618,17 +615,6 @@ static void *send_recv_server(void *arg) } while (bytes < a->bytes && !READ_ONCE(a->stop)) { - /* FD sets */ - FD_ZERO(&wset); - FD_SET(fd, &wset); - max_fd = fd; - - if (select(max_fd + 1, NULL, &wset, NULL, &timeout) == -1) { - log_err("Failed to select"); - err = -1; - break; - } - nr_sent = send(fd, &batch, MIN(a->bytes - bytes, sizeof(batch)), 0); if (nr_sent == -1 && errno == EINTR) @@ -658,7 +644,6 @@ static void *send_recv_server(void *arg) int send_recv_data(int lfd, int fd, uint32_t total_bytes) { - struct timeval timeout = { .tv_sec = 3 }; ssize_t nr_recv = 0, bytes = 0; struct send_recv_arg arg = { .fd = lfd, @@ -668,9 +653,7 @@ int send_recv_data(int lfd, int fd, uint32_t total_bytes) pthread_t srv_thread; void *thread_ret; char batch[1500]; - int max_fd = fd; int err = 0; - fd_set rset; err = pthread_create(&srv_thread, NULL, send_recv_server, (void *)&arg); if (err) { @@ -680,16 +663,6 @@ int send_recv_data(int lfd, int fd, uint32_t total_bytes) /* recv total_bytes */ while (bytes < total_bytes && !READ_ONCE(arg.stop)) { - /* FD sets */ - FD_ZERO(&rset); - FD_SET(fd, &rset); - - if (select(max_fd + 1, &rset, NULL, NULL, &timeout) == -1) { - log_err("Failed to select"); - err = -1; - break; - } - nr_recv = recv(fd, &batch, MIN(total_bytes - bytes, sizeof(batch)), 0); if (nr_recv == -1 && errno == EINTR)