Skip to content

Commit

Permalink
mptcp: re-arm retransmit timer if data is pending
Browse files Browse the repository at this point in the history
commit 3241a9c upstream.

The retransmit head will be NULL in case there is no in-flight data
(meaning all data injected into network has been acked).

In that case the retransmit timer is stopped.

This is only correct if there is no more pending, not-yet-sent data.

If there is, the retransmit timer needs to set the PENDING bit again so
that mptcp tries to send the remaining (new) data once a subflow can accept
more data.

Also, mptcp_subflow_get_retrans() has to be called unconditionally.

This function checks for subflows that have become unresponsive and marks
them as stale, so in the case where the rtx queue is empty, subflows
will never be marked stale which prevents available backup subflows from
becoming eligible for transmit.

Closes: multipath-tcp/mptcp_net-next#226
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3241a9c
 mheyne: fixed contextual conflicts due to upstream commit f6909dc
   ("mptcp: rename timer related helper to less confusing names"))
  • Loading branch information
Florian Westphal authored and abuehaze14 committed Jul 5, 2024
1 parent 62d40bb commit 3f3f0bb
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,8 @@ static void __mptcp_clean_una(struct sock *sk)
if (cleaned && tcp_under_memory_pressure(sk))
__mptcp_mem_reclaim_partial(sk);

if (snd_una == READ_ONCE(msk->snd_nxt) && !msk->recovery) {
if (snd_una == READ_ONCE(msk->snd_nxt) &&
snd_una == READ_ONCE(msk->write_seq)) {
if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk))
mptcp_stop_rtx_timer(sk);
} else {
Expand Down Expand Up @@ -1583,6 +1584,13 @@ static void mptcp_update_post_push(struct mptcp_sock *msk,
msk->snd_nxt = snd_nxt_new;
}

static void mptcp_check_and_set_pending(struct sock *sk)
{
if (mptcp_send_head(sk) &&
!test_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags))
set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags);
}

void __mptcp_push_pending(struct sock *sk, unsigned int flags)
{
struct sock *prev_ssk = NULL, *ssk = NULL;
Expand Down Expand Up @@ -2421,6 +2429,9 @@ static void __mptcp_retrans(struct sock *sk)
int ret;

mptcp_clean_una_wakeup(sk);

/* first check ssk: need to kick "stale" logic */
ssk = mptcp_subflow_get_retrans(msk);
dfrag = mptcp_rtx_head(sk);
if (!dfrag) {
if (mptcp_data_fin_enabled(msk)) {
Expand All @@ -2433,10 +2444,12 @@ static void __mptcp_retrans(struct sock *sk)
goto reset_timer;
}

return;
if (!mptcp_send_head(sk))
return;

goto reset_timer;
}

ssk = mptcp_subflow_get_retrans(msk);
if (!ssk)
goto reset_timer;

Expand All @@ -2463,6 +2476,8 @@ static void __mptcp_retrans(struct sock *sk)
release_sock(ssk);

reset_timer:
mptcp_check_and_set_pending(sk);

if (!mptcp_rtx_timer_pending(sk))
mptcp_reset_rtx_timer(sk);
}
Expand Down

0 comments on commit 3f3f0bb

Please sign in to comment.