]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mptcp: track and update contiguous data status
authorGeliang Tang <geliang.tang@suse.com>
Sat, 19 Oct 2024 09:30:47 +0000 (11:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Oct 2024 13:40:47 +0000 (15:40 +0200)
commit 0530020a7c8f2204e784f0dbdc882bbd961fdbde upstream.

This patch adds a new member allow_infinite_fallback in mptcp_sock,
which is initialized to 'true' when the connection begins and is set
to 'false' on any retransmit or successful MP_JOIN. Only do infinite
mapping fallback if there is a single subflow AND there have been no
retransmissions AND there have never been any MP_JOINs.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: e32d262c89e2 ("mptcp: handle consistently DSS corruption")
[ Conflicts in protocol.c, because commit 3e5014909b56 ("mptcp: cleanup
  MPJ subflow list handling") is not in this version. This commit is
  linked to a new feature, changing the context around. The new line
  can still be added at the same place.
  Conflicts in protocol.h, because commit 4f6e14bd19d6 ("mptcp: support
  TCP_CORK and TCP_NODELAY") is not in this version. This commit is
  linked to a new feature, changing the context around. The new line can
  still be added at the same place.
  Conflicts in subflow.c, because commit 0348c690ed37 ("mptcp: add the
  fallback check") is not in this version. This commit is linked to a
  new feature, changing the context around. The new line can still be
  added at the same place. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mptcp/protocol.c
net/mptcp/protocol.h
net/mptcp/subflow.c

index da2a1a150bc67476f7fe61f684570a17a01049c7..73a0b0d153825d6895a5332cee43e426bfdf6d78 100644 (file)
@@ -2472,6 +2472,7 @@ static void __mptcp_retrans(struct sock *sk)
                dfrag->already_sent = max(dfrag->already_sent, info.sent);
                tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
                         info.size_goal);
+               WRITE_ONCE(msk->allow_infinite_fallback, false);
        }
 
        release_sock(ssk);
@@ -2549,6 +2550,7 @@ static int __mptcp_init_sock(struct sock *sk)
        msk->first = NULL;
        inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
        WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));
+       WRITE_ONCE(msk->allow_infinite_fallback, true);
        msk->recovery = false;
 
        mptcp_pm_data_init(msk);
@@ -3299,6 +3301,7 @@ bool mptcp_finish_join(struct sock *ssk)
        if (parent_sock && !ssk->sk_socket)
                mptcp_sock_graft(ssk, parent_sock);
        subflow->map_seq = READ_ONCE(msk->ack_seq);
+       WRITE_ONCE(msk->allow_infinite_fallback, false);
 out:
        mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC);
        return true;
index 9e0a5591d4e1f6b8327ec57ab9315c0f40c04a36..5d458c3161cd3e26c56594a5ccb07bc1c02c0a30 100644 (file)
@@ -249,6 +249,7 @@ struct mptcp_sock {
        bool            rcv_fastclose;
        bool            use_64bit_ack; /* Set when we received a 64-bit DSN */
        bool            csum_enabled;
+       bool            allow_infinite_fallback;
        spinlock_t      join_list_lock;
        int             keepalive_cnt;
        int             keepalive_idle;
index e71082dd6484268dabb360f990cb8b07ac445b5d..412823af2c1d49a6e6ba38f29a335eea5f68cb30 100644 (file)
@@ -1219,7 +1219,8 @@ no_data:
 fallback:
        /* RFC 8684 section 3.7. */
        if (subflow->send_mp_fail) {
-               if (mptcp_has_another_subflow(ssk)) {
+               if (mptcp_has_another_subflow(ssk) ||
+                   !READ_ONCE(msk->allow_infinite_fallback)) {
                        while ((skb = skb_peek(&ssk->sk_receive_queue)))
                                sk_eat_skb(ssk, skb);
                }
@@ -1481,6 +1482,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
        /* discard the subflow socket */
        mptcp_sock_graft(ssk, sk->sk_socket);
        iput(SOCK_INODE(sf));
+       WRITE_ONCE(msk->allow_infinite_fallback, false);
        return err;
 
 failed_unlink: