Skip to content

Commit

Permalink
EAGAIN
Browse files Browse the repository at this point in the history
TODO

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang committed Dec 2, 2024
1 parent 2fc90d0 commit eac7f92
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2272,6 +2272,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,

if (!timeo) {
copied = -EAGAIN;
pr_info("%s return EAGAIN\n", __func__);
break;
}

Expand Down
12 changes: 12 additions & 0 deletions tools/testing/selftests/bpf/network_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ static void *send_recv_server(void *arg)
{
struct send_recv_arg *a = (struct send_recv_arg *)arg;
ssize_t nr_sent = 0, bytes = 0;
int so_buf = 6553500;
char batch[1500];
int err = 0, fd;

Expand All @@ -646,12 +647,21 @@ static void *send_recv_server(void *arg)
goto done;
}

err = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &so_buf, sizeof(so_buf));
if (!ASSERT_OK(err, "setsockopt SO_SNDBUF"))
goto done;
err = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &so_buf, sizeof(so_buf));
if (!ASSERT_OK(err, "setsockopt SO_RCVBUF"))
goto done;

while (bytes < a->bytes && !READ_ONCE(a->stop)) {
nr_sent = send(fd, &batch,
MIN(a->bytes - bytes, sizeof(batch)), 0);
if (nr_sent == -1 && errno == EINTR)
continue;
if (nr_sent == -1) {
//if (errno == EAGAIN)
// continue;
err = -errno;
break;
}
Expand Down Expand Up @@ -701,6 +711,8 @@ int send_recv_data(int lfd, int fd, uint32_t total_bytes, int timeout_ms)
if (nr_recv == -1 && errno == EINTR)
continue;
if (nr_recv == -1) {
//if (errno == EAGAIN)
// continue;
err = -errno;
break;
}
Expand Down
10 changes: 9 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/mptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ static void send_data_and_verify(char *sched, bool addr1, bool addr2)
struct mptcp_bpf_bytes *skel;
struct timespec start, end;
unsigned int delta_ms;
int so_buf = 6553500;

skel = mptcp_bpf_bytes__open_and_load();
if (!ASSERT_OK_PTR(skel, "open_and_load: bytes"))
Expand All @@ -1200,10 +1201,17 @@ static void send_data_and_verify(char *sched, bool addr1, bool addr2)
if (!ASSERT_OK_FD(server_fd, "start_mptcp_server"))
goto skel_destroy;

client_fd = connect_to_fd(server_fd, 0);
client_fd = connect_to_fd(server_fd, 30000);
if (!ASSERT_OK_FD(client_fd, "connect_to_fd"))
goto close_server;

err = setsockopt(client_fd, SOL_SOCKET, SO_SNDBUF, &so_buf, sizeof(so_buf));
if (!ASSERT_OK(err, "setsockopt SO_SNDBUF"))
goto close_client;
err = setsockopt(client_fd, SOL_SOCKET, SO_RCVBUF, &so_buf, sizeof(so_buf));
if (!ASSERT_OK(err, "setsockopt SO_RCVBUF"))
goto close_client;

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

Expand Down
3 changes: 3 additions & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ int BPF_PROG(trace_mptcp_sched_get_send, struct mptcp_sock *msk)
if (!msk->pm.server_side)
return 0;

bytes_sent_1 = 0;
bytes_sent_2 = 0;

mptcp_for_each_subflow(msk, subflow) {
struct tcp_sock *tp;
struct sock *ssk;
Expand Down

0 comments on commit eac7f92

Please sign in to comment.