Commit 0530020a authored by Geliang Tang's avatar Geliang Tang Committed by David S. Miller

mptcp: track and update contiguous data status

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: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0348c690
...@@ -2465,6 +2465,7 @@ static void __mptcp_retrans(struct sock *sk) ...@@ -2465,6 +2465,7 @@ static void __mptcp_retrans(struct sock *sk)
dfrag->already_sent = max(dfrag->already_sent, info.sent); dfrag->already_sent = max(dfrag->already_sent, info.sent);
tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
info.size_goal); info.size_goal);
WRITE_ONCE(msk->allow_infinite_fallback, false);
} }
release_sock(ssk); release_sock(ssk);
...@@ -2539,6 +2540,7 @@ static int __mptcp_init_sock(struct sock *sk) ...@@ -2539,6 +2540,7 @@ static int __mptcp_init_sock(struct sock *sk)
msk->first = NULL; msk->first = NULL;
inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss; inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk))); WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));
WRITE_ONCE(msk->allow_infinite_fallback, true);
msk->recovery = false; msk->recovery = false;
mptcp_pm_data_init(msk); mptcp_pm_data_init(msk);
...@@ -3275,6 +3277,7 @@ bool mptcp_finish_join(struct sock *ssk) ...@@ -3275,6 +3277,7 @@ bool mptcp_finish_join(struct sock *ssk)
} }
subflow->map_seq = READ_ONCE(msk->ack_seq); subflow->map_seq = READ_ONCE(msk->ack_seq);
WRITE_ONCE(msk->allow_infinite_fallback, false);
out: out:
mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC); mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC);
......
...@@ -263,6 +263,7 @@ struct mptcp_sock { ...@@ -263,6 +263,7 @@ struct mptcp_sock {
bool rcv_fastclose; bool rcv_fastclose;
bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool use_64bit_ack; /* Set when we received a 64-bit DSN */
bool csum_enabled; bool csum_enabled;
bool allow_infinite_fallback;
u8 recvmsg_inq:1, u8 recvmsg_inq:1,
cork:1, cork:1,
nodelay:1; nodelay:1;
......
...@@ -1206,7 +1206,8 @@ static bool subflow_check_data_avail(struct sock *ssk) ...@@ -1206,7 +1206,8 @@ static bool subflow_check_data_avail(struct sock *ssk)
if (!__mptcp_check_fallback(msk)) { if (!__mptcp_check_fallback(msk)) {
/* RFC 8684 section 3.7. */ /* RFC 8684 section 3.7. */
if (subflow->send_mp_fail) { if (subflow->send_mp_fail) {
if (mptcp_has_another_subflow(ssk)) { if (mptcp_has_another_subflow(ssk) ||
!READ_ONCE(msk->allow_infinite_fallback)) {
ssk->sk_err = EBADMSG; ssk->sk_err = EBADMSG;
tcp_set_state(ssk, TCP_CLOSE); tcp_set_state(ssk, TCP_CLOSE);
subflow->reset_transient = 0; subflow->reset_transient = 0;
...@@ -1486,6 +1487,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, ...@@ -1486,6 +1487,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
/* discard the subflow socket */ /* discard the subflow socket */
mptcp_sock_graft(ssk, sk->sk_socket); mptcp_sock_graft(ssk, sk->sk_socket);
iput(SOCK_INODE(sf)); iput(SOCK_INODE(sf));
WRITE_ONCE(msk->allow_infinite_fallback, false);
return err; return err;
failed_unlink: failed_unlink:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment