Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang committed Jan 15, 2025
1 parent bfa1bf0 commit 48df4b5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
5 changes: 4 additions & 1 deletion net/mptcp/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,11 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
*/
mptcp_local_address((struct sock_common *)msk, &msk_local);
mptcp_local_address((struct sock_common *)skc, &skc_local.addr);
if (mptcp_addresses_equal(&msk_local, &skc_local.addr, false))
if (mptcp_addresses_equal(&msk_local, &skc_local.addr, false)) {
//pr_info("%s msk_local=%u(%pI4) skc_local.addr=%u(%pI4)\n",
// __func__, msk_local.family, &msk_local.addr, skc_local.addr.family, &skc_local.addr.addr);
return 0;
}

skc_local.addr.id = 0;
skc_local.flags = MPTCP_PM_ADDR_FLAG_IMPLICIT;
Expand Down
5 changes: 3 additions & 2 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
/* ensure fitting the notsent_lowat() constraint */
copy_limit = mptcp_send_limit(sk);
if (!copy_limit) {
pr_info("%s call wait_for_memory timeo=%ld\n", __func__, timeo);
//pr_info("%s call wait_for_memory timeo=%ld\n", __func__, timeo);
goto wait_for_memory;
}

Expand Down Expand Up @@ -1817,7 +1817,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
__mptcp_push_pending(sk, msg->msg_flags);
ret = sk_stream_wait_memory(sk, &timeo);
pr_info("%s sk_stream_wait_memory ret=%d timeo=%ld\n", __func__, ret, timeo);
//pr_info("%s sk_stream_wait_memory ret=%d timeo=%ld\n", __func__, ret, timeo);
if (ret)
goto do_error;
}
Expand Down Expand Up @@ -2170,6 +2170,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
4 changes: 4 additions & 0 deletions tools/testing/selftests/bpf/network_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,8 @@ static void *send_recv_server(void *arg)
if (nr_sent == -1 && errno == EINTR)
continue;
if (nr_sent == -1) {
//if (errno == EAGAIN)
// continue;
err = -errno;
break;
}
Expand Down Expand Up @@ -701,6 +703,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
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/mptcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ 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;

Expand Down
7 changes: 5 additions & 2 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 All @@ -30,10 +33,10 @@ int BPF_PROG(trace_mptcp_sched_get_send, struct mptcp_sock *msk)
tp = bpf_core_cast(ssk, struct tcp_sock);

if (subflow->subflow_id == 1) {
bpf_printk("bytes 1: sent %lu received %lu subflows %u", tp->bytes_sent, tp->bytes_received, msk->pm.subflows);
//bpf_printk("bytes 1: sent %lu received %lu subflows %u", tp->bytes_sent, tp->bytes_received, msk->pm.subflows);
bytes_sent_1 += tp->bytes_sent;
} else if (subflow->subflow_id == 2) {
bpf_printk("bytes 2: sent %lu received %lu subflows %u", tp->bytes_sent, tp->bytes_received, msk->pm.subflows);
//bpf_printk("bytes 2: sent %lu received %lu subflows %u", tp->bytes_sent, tp->bytes_received, msk->pm.subflows);
bytes_sent_2 += tp->bytes_sent;
}
}
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ int BPF_PROG(bpf_rr_get_send, struct mptcp_sock *msk)

out:
mptcp_subflow_set_scheduled(next, true);
//bpf_printk("rr subflow=%u/%u", next->subflow_id, msk->pm.subflows + 1);
ptr->last_snd = mptcp_subflow_tcp_sock(next);
return 0;
}
Expand Down

0 comments on commit 48df4b5

Please sign in to comment.