Skip to content

Commit

Permalink
mptcp: Retransmit DATA_FIN
Browse files Browse the repository at this point in the history
With this change, the MPTCP-level retransmission timer is used to resend
DATA_FIN. The retranmit timer is not stopped while waiting for a
MPTCP-level ACK of DATA_FIN, and retransmitted DATA_FINs are sent on all
subflows. The retry interval starts at TCP_RTO_MIN and then doubles on
each attempt, up to TCP_RTO_MAX.

Closes: #146
Fixes: 43b54c6 ("mptcp: Use full MPTCP-level disconnect state machine")
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
  • Loading branch information
mjmartineau authored and matttbe committed Apr 21, 2021
1 parent e4d1a0d commit a9b09fc
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,14 @@ static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq)
return false;
}

static void mptcp_set_datafin_timeout(const struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);

mptcp_sk(sk)->timer_ival = min(TCP_RTO_MAX,
TCP_RTO_MIN << icsk->icsk_retransmits);
}

static void mptcp_set_timeout(const struct sock *sk, const struct sock *ssk)
{
long tout = ssk && inet_csk(ssk)->icsk_pending ?
Expand Down Expand Up @@ -1061,7 +1069,8 @@ static void __mptcp_clean_una(struct sock *sk)
}
}

if (snd_una == READ_ONCE(msk->snd_nxt)) {
if (snd_una == READ_ONCE(msk->snd_nxt) &&
!mptcp_data_fin_enabled(msk)) {
if (msk->timer_ival)
mptcp_stop_timer(sk);
} else {
Expand Down Expand Up @@ -2276,8 +2285,19 @@ static void __mptcp_retrans(struct sock *sk)

__mptcp_clean_una_wakeup(sk);
dfrag = mptcp_rtx_head(sk);
if (!dfrag)
if (!dfrag) {
if (mptcp_data_fin_enabled(msk)) {
struct inet_connection_sock *icsk = inet_csk(sk);

icsk->icsk_retransmits++;
mptcp_set_datafin_timeout(sk);
mptcp_send_ack(msk);

goto reset_timer;
}

return;
}

ssk = mptcp_subflow_get_retrans(msk);
if (!ssk)
Expand Down

0 comments on commit a9b09fc

Please sign in to comment.