minor tail loss probe improvements
Subsystems (3)
v2 cover minor tail loss probe improvements
This patch series enhance the tail loss probe (TLP) on some error conditions. When TLP fails to send a probe, it will no longer extend the RTO. When it fails to send a new packet because of receiver window limit, it'll try to retransmit the last packet.
Yuchung Cheng (2):
tcp: don't extend RTO on failed loss probe attempts
tcp: TLP retransmits last if failed to send new packet
net/ipv4/tcp_output.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-)
Signature · 1 line
2.5.0.276.gf5e568e
PATCH v2 1/2 tcp: don't extend RTO on failed loss probe attempts
If TLP was unable to send a probe, it extended the RTO to now + icsk_rto. But extending the RTO makes little sense if no TLP probe went out. With this commit, instead of extending the RTO we re-arm it relative to the transmit time of the write queue head.
--- net/ipv4/tcp_output.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
net/ipv4/tcp_output.c +6 -7
@@ -2275,13 +2275,12 @@ void tcp_send_loss_probe(struct sock *sk) tp->tlp_high_seq = tp->snd_nxt; rearm_timer: -inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , -inet_csk (sk)->icsk_rto, -TCP_RTO_MAX ); - -if (likely (!err)) -NET_INC_STATS_BH (sock_net (sk), -LINUX_MIB_TCPLOSSPROBES ); +if (likely (!err)) { +NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPLOSSPROBES ); +/* Reset s.t. tcp_rearm_rto will restart timer from now */ +inet_csk (sk)->icsk_pending =0 ; + } +tcp_rearm_rto (sk); }/* Push out any pending frames which were held back due to
Signature · 1 line
2.5.0.276.gf5e568e
PATCH v2 2/2 tcp: TLP retransmits last if failed to send new packet
In reply to Yuchung ChengWhen TLP fails to send new packet because of receive window limit, it should fall back to retransmit the last packet instead.
---
v2: condition the fallback retransmit on receiver window limit
net/ipv4/tcp_output.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-)
net/ipv4/tcp_output.c +22 -16
@@ -2149,7 +2149,7 @@ repair:tcp_cwnd_validate (sk, is_cwnd_limited);return false; } -return (push_one ==2 ) || (!tp->packets_out &&tcp_send_head (sk)); +return !tp->packets_out &&tcp_send_head (sk); }bool tcp_schedule_loss_probe (struct sock *sk)
@@ -2226,7 +2226,7 @@ static bool skb_still_in_host_queue(const struct sock *sk,return false; } -/* When probe timeout (PTO) fires, send a new segment if one exists, else +/* When probe timeout (PTO) fires, try send a new segment if possible, else * retransmit the last segment. */ void tcp_send_loss_probe (struct sock *sk)
@@ -2235,11 +2235,19 @@ void tcp_send_loss_probe(struct sock *sk)struct sk_buff *skb;int pcount;int mss =tcp_current_mss (sk); -int err =-1 ; -if (tcp_send_head (sk)) { - err =tcp_write_xmit (sk, mss,TCP_NAGLE_OFF ,2 ,GFP_ATOMIC ); - goto rearm_timer; + skb =tcp_send_head (sk); +if (skb) { +if (tcp_snd_wnd_test (tp, skb, mss)) { + pcount = tp->packets_out; +tcp_write_xmit (sk, mss,TCP_NAGLE_OFF ,2 ,GFP_ATOMIC ); +if (tp->packets_out > pcount) + goto probe_sent; + goto rearm_timer; + } + skb =tcp_write_queue_prev (sk, skb); + }else { + skb =tcp_write_queue_tail (sk); }/* At most one outstanding TLP retransmission. */
@@ -2247,7 +2255,6 @@ void tcp_send_loss_probe(struct sock *sk) goto rearm_timer;/* Retransmit last segment. */ - skb =tcp_write_queue_tail (sk);if (WARN_ON (!skb)) goto rearm_timer;
@@ -2262,24 +2269,23 @@ void tcp_send_loss_probe(struct sock *sk)if (unlikely (tcp_fragment (sk, skb, (pcount -1 ) * mss, mss,GFP_ATOMIC ))) goto rearm_timer; - skb =tcp_write_queue_tail (sk); + skb =tcp_write_queue_next (sk, skb); }if (WARN_ON (!skb || !tcp_skb_pcount (skb))) goto rearm_timer; - err =__tcp_retransmit_skb (sk, skb); +if (__tcp_retransmit_skb (sk, skb)) + goto rearm_timer;/* Record snd_nxt for loss detection. */ -if (likely (!err)) - tp->tlp_high_seq = tp->snd_nxt; + tp->tlp_high_seq = tp->snd_nxt; +probe_sent: +NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPLOSSPROBES ); +/* Reset s.t. tcp_rearm_rto will restart timer from now */ +inet_csk (sk)->icsk_pending =0 ; rearm_timer: -if (likely (!err)) { -NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPLOSSPROBES ); -/* Reset s.t. tcp_rearm_rto will restart timer from now */ -inet_csk (sk)->icsk_pending =0 ; - }tcp_rearm_rto (sk); }
Signature · 1 line
2.5.0.276.gf5e568e
Re: [PATCH net-next v2 1/2] tcp: don't extend RTO on failed loss probe attempts
In reply to Yuchung ChengQuoted 10 lines · Yuchung Cheng
If TLP was unable to send a probe, it extended the RTO to now +
icsk_rto. But extending the RTO makes little sense if no TLP probe went out. With this commit, instead of extending the RTO we re-arm it relative to the transmit time of the write queue head.Signed-off-by Yuchung Cheng <[email protected]>Signed-off-by Neal Cardwell <[email protected]>Signed-off-by Nandita Dukkipati <[email protected]>---
David Miller
maintainerFrom: Yuchung Cheng <[email protected]>
Date: Wed, 12 Aug 2015 11:18:17 -0700
Quoted 4 lines
This patch series enhance the tail loss probe (TLP) on some error conditions. When TLP fails to send a probe, it will no longer extend the RTO. When it fails to send a new packet because of receiver window limit, it'll try to retransmit the last packet.
Series applied, thanks.