Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: Reevalute and reschedule meta-level RTO for new subflows
Browse files Browse the repository at this point in the history
When a new subflow comes in, he might reduce the meta-level RTO significantly.
E.g., because the other subflow is non-functional but *had* a huge RTO.

In that case, we should reschedule the timer so that it fires earlier
and we are able to recover quickly.

--tolerance_usecs=100000
+0	`sysctl -w net.mptcp.mptcp_checksum=0`

+0	socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0	setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0	setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
+0	fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0	bind(3, {sa_family = AF_INET, sin_port = htons(13000), sin_addr = inet_addr("192.168.0.1")}, ...) = 0
+0	listen(3, 1) = 0

+0	socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
+0	setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0	bind(5, {sa_family = AF_INET, sin_port = htons(13001), sin_addr = inet_addr("192.168.0.1")}, ...) = 0
+0	listen(5,1) = 0

+0	< S 0:0(0) win 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7,mp_capable_no_cs key_a> sock(3)
+0	> S. 0:0(0) ack 1 win 28800 <mss 1460,nop,nop,sackOK,nop,wscale 7,mp_capable_no_cs key_b> sock(3)
+0.4	< . 1:1(0) ack 1 win 257 <mp_capable_no_cs key_a key_b> sock(3)
+0	accept(3, ..., ...) = 4
+0	fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0

+0	write(4, ..., 1000) = 1000
+0	> P. 1:1001(1000) ack 1 <dss dack4 dsn4 nocs, nop, nop> sock(4)
+0.4	< . 1:1(0) ack 1001 win 4242 <dss dack4=1001> sock(4)
+0	write(4, ..., 1000) = 1000
+0	> P. 1001:2001(1000) ack 1 <dss dack4 dsn4 nocs, nop, nop> sock(4)
+0	write(4, ..., 1000) = 1000
+0	> P. 2001:3001(1000) ack 1 <dss dack4 dsn4 nocs, nop, nop> sock(4)
+0	write(4, ..., 1000) = 1000
+0	> P. 3001:4001(1000) ack 1 <dss dack4 dsn4 nocs, nop, nop> sock(4)
+0	write(4, ..., 1000) = 1000
+0	> P. 4001:5001(1000) ack 1 <dss dack4 dsn4 nocs, nop, nop> sock(4)

+0.4	< . 1:1(0) ack 5001 win 4242 <dss dack4=1001> sock(4)

/* ACK, without advencing dack: Now, the only way to recover is through a meta-retransmission timer */

/* Meta-level rexmit should fire in 400ms */

+0	write(4, ..., 1000) = 1000
+0	> P. 5001:6001(1000) ack 1 <dss dack4 dsn4=5001 nocs, nop, nop> sock(4)

+1.1	> P. 5001:6001(1000) ack 1 <dss dack4 dsn4=5001 nocs, nop, nop> sock(4)

/* Pushing out the timer */
+0.1	< . 1:1(0) ack 5001 win 4242 <dss dack4=2001> sock(4)

+1.1	> P. 5001:6001(1000) ack 1 <dss dack4 dsn4=5001 nocs, nop, nop> sock(4)

/* This one reschedules the meta-timer */
+0.01	< . 1:1(0) ack 5001 win 4242 <dss dack4=3001> sock(4)

+0	< S 0:0(0) win 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7,mp_join_syn backup=0 address_id=0 token=sha1_32(key_b)> sock(5)
+0	> S. 0:0(0) ack 1 win 28800 <mss 1460,nop,nop,sackOK,nop,wscale 7, mp_join_syn_ack backup=0 address_id=0 sender_hmac=trunc_l64_hmac(key_b key_a) > sock(5)
+0	< . 1:1(0) ack 1 win 32792 <mp_join_ack sender_hmac=full_160_hmac(key_a key_b)> sock(5)
+0	mp_join_accept(5) = 6

+0	> . 1:1(0) ack 1 <...> sock(6) // reliably mp_join_ack

/* This first one is a reinjection. */
+0	> P. 1:1001(1000) ack 1 <dss dack4 dsn4=5001 nocs, nop, nop> sock(6)
+0	< . 1:1(0) ack 1001 win 4242 <dss dack4=3001> sock(6)

/* Fire, in 400ms after the subflow got established */
+0.4	> P. 1001:2001(1000) ack 1 <dss dack4 dsn4=3001 nocs, nop, nop> sock(6)

+0	`sysctl -w net.mptcp.mptcp_checksum=1`

Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
cpaasch authored and matttbe committed Mar 13, 2019
1 parent fc29b3a commit 1ffbe0e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -6286,8 +6286,19 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
if (is_master_tp(tp)) {
mptcp_update_metasocket(mptcp_meta_sk(sk));
} else {
struct sock *meta_sk = mptcp_meta_sk(sk);

tcp_send_ack(sk);

/* Update RTO as it might be worse/better */
mptcp_set_rto(sk);

/* If the new RTO would fire earlier, pull it in! */
if (tcp_sk(meta_sk)->packets_out &&
icsk->icsk_timeout > inet_csk(meta_sk)->icsk_rto + jiffies) {
tcp_rearm_rto(meta_sk);
}

mptcp_push_pending_frames(mptcp_meta_sk(sk));
}
}
Expand Down

0 comments on commit 1ffbe0e

Please sign in to comment.