Skip to content

Commit

Permalink
Revert "selftests/bpf: Support nonblock for send_recv_data"
Browse files Browse the repository at this point in the history
This reverts commit 8fdb31d.
  • Loading branch information
Geliang Tang committed Apr 21, 2024
1 parent 4c294ec commit 8d0bbdc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
6 changes: 0 additions & 6 deletions tools/testing/selftests/bpf/network_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ struct send_recv_arg {
static void *send_recv_server(void *arg)
{
struct send_recv_arg *a = (struct send_recv_arg *)arg;
int flags = fcntl(a->fd, F_GETFL);
ssize_t nr_sent = 0, bytes = 0;
char batch[1500];
int err = 0, fd;
Expand All @@ -611,8 +610,6 @@ static void *send_recv_server(void *arg)
if (nr_sent == -1 && errno == EINTR)
continue;
if (nr_sent == -1) {
if (flags & O_NONBLOCK && errno == EWOULDBLOCK)
continue;
err = -errno;
break;
}
Expand All @@ -637,7 +634,6 @@ static void *send_recv_server(void *arg)

int send_recv_data(int lfd, int fd, uint32_t total_bytes)
{
int flags = fcntl(lfd, F_GETFL);
ssize_t nr_recv = 0, bytes = 0;
struct send_recv_arg arg = {
.fd = lfd,
Expand All @@ -662,8 +658,6 @@ int send_recv_data(int lfd, int fd, uint32_t total_bytes)
if (nr_recv == -1 && errno == EINTR)
continue;
if (nr_recv == -1) {
if (flags & O_NONBLOCK && errno == EWOULDBLOCK)
continue;
err = -errno;
break;
}
Expand Down
16 changes: 0 additions & 16 deletions tools/testing/selftests/bpf/prog_tests/mptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,6 @@ static void test_mptcpify(void)
close(cgroup_fd);
}

static inline int set_nonblock(int fd)
{
int flags = fcntl(fd, F_GETFL);

if (flags == -1 || flags & O_NONBLOCK)
return -1;

return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
}

static int endpoint_init(char *flags)
{
SYS(fail, "ip -net %s link add veth1 type veth peer name veth2", NS_TEST);
Expand Down Expand Up @@ -411,9 +401,6 @@ static void run_subflow(char *new)
if (!ASSERT_GE(client_fd, 0, "connect to fd"))
goto fail;

if (set_nonblock(server_fd))
goto fail;

err = getsockopt(server_fd, SOL_TCP, TCP_CONGESTION, cc, &len);
if (!ASSERT_OK(err, "getsockopt(srv_fd, TCP_CONGESTION)"))
goto fail;
Expand Down Expand Up @@ -508,9 +495,6 @@ static void send_data_and_verify(char *sched, bool addr1, bool addr2)
if (CHECK(client_fd < 0, sched, "connect_to_fd: %d\n", errno))
goto fail;

if (set_nonblock(server_fd))
goto fail;

if (clock_gettime(CLOCK_MONOTONIC, &start) < 0)
goto fail;

Expand Down

0 comments on commit 8d0bbdc

Please sign in to comment.