Skip to content

Commit 0530020

Browse files
geliangtangdavem330
authored andcommitted
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: Paolo Abeni <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0348c69 commit 0530020

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

net/mptcp/protocol.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,6 +2465,7 @@ static void __mptcp_retrans(struct sock *sk)
24652465
dfrag->already_sent = max(dfrag->already_sent, info.sent);
24662466
tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
24672467
info.size_goal);
2468+
WRITE_ONCE(msk->allow_infinite_fallback, false);
24682469
}
24692470

24702471
release_sock(ssk);
@@ -2539,6 +2540,7 @@ static int __mptcp_init_sock(struct sock *sk)
25392540
msk->first = NULL;
25402541
inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
25412542
WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));
2543+
WRITE_ONCE(msk->allow_infinite_fallback, true);
25422544
msk->recovery = false;
25432545

25442546
mptcp_pm_data_init(msk);
@@ -3275,6 +3277,7 @@ bool mptcp_finish_join(struct sock *ssk)
32753277
}
32763278

32773279
subflow->map_seq = READ_ONCE(msk->ack_seq);
3280+
WRITE_ONCE(msk->allow_infinite_fallback, false);
32783281

32793282
out:
32803283
mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC);

net/mptcp/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ struct mptcp_sock {
263263
bool rcv_fastclose;
264264
bool use_64bit_ack; /* Set when we received a 64-bit DSN */
265265
bool csum_enabled;
266+
bool allow_infinite_fallback;
266267
u8 recvmsg_inq:1,
267268
cork:1,
268269
nodelay:1;

net/mptcp/subflow.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,8 @@ static bool subflow_check_data_avail(struct sock *ssk)
12061206
if (!__mptcp_check_fallback(msk)) {
12071207
/* RFC 8684 section 3.7. */
12081208
if (subflow->send_mp_fail) {
1209-
if (mptcp_has_another_subflow(ssk)) {
1209+
if (mptcp_has_another_subflow(ssk) ||
1210+
!READ_ONCE(msk->allow_infinite_fallback)) {
12101211
ssk->sk_err = EBADMSG;
12111212
tcp_set_state(ssk, TCP_CLOSE);
12121213
subflow->reset_transient = 0;
@@ -1486,6 +1487,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
14861487
/* discard the subflow socket */
14871488
mptcp_sock_graft(ssk, sk->sk_socket);
14881489
iput(SOCK_INODE(sf));
1490+
WRITE_ONCE(msk->allow_infinite_fallback, false);
14891491
return err;
14901492

14911493
failed_unlink:

0 commit comments

Comments
 (0)