Skip to content

Commit a9cd144

Browse files
ws-yangpcgregkh
authored andcommitted
tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN
commit 62d9f1a upstream. Upon receiving a cumulative ACK that changes the congestion state from Disorder to Open, the TLP timer is not set. If the sender is app-limited, it can only wait for the RTO timer to expire and retransmit. The reason for this is that the TLP timer is set before the congestion state changes in tcp_ack(), so we delay the time point of calling tcp_set_xmit_timer() until after tcp_fastretrans_alert() returns and remove the FLAG_SET_XMIT_TIMER from ack_flag when the RACK reorder timer is set. This commit has two additional benefits: 1) Make sure to reset RTO according to RFC6298 when receiving ACK, to avoid spurious RTO caused by RTO timer early expires. 2) Reduce the xmit timer reschedule once per ACK when the RACK reorder timer is set. Fixes: df92c83 ("tcp: fix xmit timer to only be reset if data ACKed/SACKed") Link: https://lore.kernel.org/netdev/1611311242-6675-1-git-send-email-yangpc@wangsu.com Signed-off-by: Pengcheng Yang <yangpc@wangsu.com> Acked-by: Neal Cardwell <ncardwell@google.com> Acked-by: Yuchung Cheng <ycheng@google.com> Cc: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/1611464834-23030-1-git-send-email-yangpc@wangsu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 011c3d9 commit a9cd144

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎include/net/tcp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb);
20662066
void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
20672067
extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb,
20682068
u32 reo_wnd);
2069-
extern void tcp_rack_mark_lost(struct sock *sk);
2069+
extern bool tcp_rack_mark_lost(struct sock *sk);
20702070
extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
20712071
u64 xmit_time);
20722072
extern void tcp_rack_reo_timeout(struct sock *sk);

‎net/ipv4/tcp_input.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,8 @@ static void tcp_identify_packet_loss(struct sock *sk, int *ack_flag)
28452845
} else if (tcp_is_rack(sk)) {
28462846
u32 prior_retrans = tp->retrans_out;
28472847

2848-
tcp_rack_mark_lost(sk);
2848+
if (tcp_rack_mark_lost(sk))
2849+
*ack_flag &= ~FLAG_SET_XMIT_TIMER;
28492850
if (prior_retrans > tp->retrans_out)
28502851
*ack_flag |= FLAG_LOST_RETRANS;
28512852
}
@@ -3802,9 +3803,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
38023803

38033804
if (tp->tlp_high_seq)
38043805
tcp_process_tlp_ack(sk, ack, flag);
3805-
/* If needed, reset TLP/RTO timer; RACK may later override this. */
3806-
if (flag & FLAG_SET_XMIT_TIMER)
3807-
tcp_set_xmit_timer(sk);
38083806

38093807
if (tcp_ack_is_dubious(sk, flag)) {
38103808
if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) {
@@ -3817,6 +3815,10 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
38173815
&rexmit);
38183816
}
38193817

3818+
/* If needed, reset TLP/RTO timer when RACK doesn't set. */
3819+
if (flag & FLAG_SET_XMIT_TIMER)
3820+
tcp_set_xmit_timer(sk);
3821+
38203822
if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP))
38213823
sk_dst_confirm(sk);
38223824

‎net/ipv4/tcp_recovery.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
9696
}
9797
}
9898

99-
void tcp_rack_mark_lost(struct sock *sk)
99+
bool tcp_rack_mark_lost(struct sock *sk)
100100
{
101101
struct tcp_sock *tp = tcp_sk(sk);
102102
u32 timeout;
103103

104104
if (!tp->rack.advanced)
105-
return;
105+
return false;
106106

107107
/* Reset the advanced flag to avoid unnecessary queue scanning */
108108
tp->rack.advanced = 0;
@@ -112,6 +112,7 @@ void tcp_rack_mark_lost(struct sock *sk)
112112
inet_csk_reset_xmit_timer(sk, ICSK_TIME_REO_TIMEOUT,
113113
timeout, inet_csk(sk)->icsk_rto);
114114
}
115+
return !!timeout;
115116
}
116117

117118
/* Record the most recently (re)sent time among the (s)acked packets

0 commit comments

Comments
 (0)