Skip to content

Commit

Permalink
mptcp: call mp_fail_no_response only when needed
Browse files Browse the repository at this point in the history
mptcp_mp_fail_no_response shouldn't be invoked on each worker run, it
should be invoked only when MP_FAIL response timeout occurs.

This patch adds a new msk flag MPTCP_FAIL_RESPONSE_EXPECT, set it when
sending MP_FAIL and test it in mptcp_timeout_timer().

Add back MPTCP_FAIL_NO_RESPONSE flag, set it in mptcp_timeout_timer()
when MP_FAIL response timeout occurs. Test it in mptcp_worker() before
invoking mptcp_mp_fail_no_response().

Closes: multipath-tcp/mptcp_net-next#281
Fixes: d9fb797 ("mptcp: Do not traverse the subflow connection list without lock")
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Jun 8, 2022
1 parent 2109f19 commit 5137781
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,12 @@ mp_fail_response_expect_subflow(struct mptcp_sock *msk)
static void mptcp_timeout_timer(struct timer_list *t)
{
struct sock *sk = from_timer(sk, t, sk_timer);
struct mptcp_sock *msk = mptcp_sk(sk);

bh_lock_sock(sk);
if (test_and_clear_bit(MPTCP_FAIL_RESPONSE_EXPECT, &msk->flags))
__set_bit(MPTCP_FAIL_NO_RESPONSE, &msk->flags);
bh_unlock_sock(sk);
mptcp_schedule_work(sk);
sock_put(sk);
}
Expand Down Expand Up @@ -2562,7 +2567,8 @@ static void mptcp_worker(struct work_struct *work)
if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags))
__mptcp_retrans(sk);

mptcp_mp_fail_no_response(msk);
if (test_and_clear_bit(MPTCP_FAIL_NO_RESPONSE, &msk->flags))
mptcp_mp_fail_no_response(msk);

unlock:
release_sock(sk);
Expand Down
2 changes: 2 additions & 0 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
#define MPTCP_WORK_EOF 3
#define MPTCP_FALLBACK_DONE 4
#define MPTCP_WORK_CLOSE_SUBFLOW 5
#define MPTCP_FAIL_RESPONSE_EXPECT 6
#define MPTCP_FAIL_NO_RESPONSE 7

/* MPTCP socket release cb flags */
#define MPTCP_PUSH_PENDING 1
Expand Down
1 change: 1 addition & 0 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
sk_eat_skb(ssk, skb);
} else if (!sock_flag(ssk, SOCK_DEAD)) {
WRITE_ONCE(subflow->mp_fail_response_expect, true);
__set_bit(MPTCP_FAIL_RESPONSE_EXPECT, &msk->flags);
sk_reset_timer((struct sock *)msk,
&((struct sock *)msk)->sk_timer,
jiffies + TCP_RTO_MAX);
Expand Down

0 comments on commit 5137781

Please sign in to comment.