Netdev List
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, TAKANO Ryousei <takano@axe-inc.co.jp>
Subject: [PATCH 5/7] [TCP]: No need to re-count fackets_out/sacked_out at RTO
Date: Thu, 11 Oct 2007 14:41:05 +0300	[thread overview]
Message-ID: <11921028672853-git-send-email-ilpo.jarvinen@helsinki.fi> (raw)
In-Reply-To: <11921028673030-git-send-email-ilpo.jarvinen@helsinki.fi>

Both sacked_out and fackets_out are directly known from how
parameter. Since fackets_out is accurate, there's no need for
recounting (sacked_out was previously unnecessarily counted
in the loop anyway).

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/tcp_input.c |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index bd18c25..a066039 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1711,18 +1711,23 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
 	tcp_clear_retrans_hints_partial(tp);
 }
 
-void tcp_clear_retrans(struct tcp_sock *tp)
+static void tcp_clear_retrans_partial(struct tcp_sock *tp)
 {
 	tp->retrans_out = 0;
-
-	tp->fackets_out = 0;
-	tp->sacked_out = 0;
 	tp->lost_out = 0;
 
 	tp->undo_marker = 0;
 	tp->undo_retrans = 0;
 }
 
+void tcp_clear_retrans(struct tcp_sock *tp)
+{
+	tcp_clear_retrans_partial(tp);
+
+	tp->fackets_out = 0;
+	tp->sacked_out = 0;
+}
+
 /* Enter Loss state. If "how" is not zero, forget all SACK information
  * and reset tags completely, otherwise preserve SACKs. If receiver
  * dropped its ofo queue, we will know this due to reneging detection.
@@ -1732,7 +1737,6 @@ void tcp_enter_loss(struct sock *sk, int how)
 	const struct inet_connection_sock *icsk = inet_csk(sk);
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct sk_buff *skb;
-	int cnt = 0;
 
 	/* Reduce ssthresh if it has not yet been made inside this window. */
 	if (icsk->icsk_ca_state <= TCP_CA_Disorder || tp->snd_una == tp->high_seq ||
@@ -1746,7 +1750,10 @@ void tcp_enter_loss(struct sock *sk, int how)
 	tp->snd_cwnd_stamp = tcp_time_stamp;
 
 	tp->bytes_acked = 0;
-	tcp_clear_retrans(tp);
+	tcp_clear_retrans_partial(tp);
+
+	if (tcp_is_reno(tp))
+		tcp_reset_reno_sack(tp);
 
 	if (!how) {
 		/* Push undo marker, if it was plain RTO and nothing
@@ -1754,13 +1761,15 @@ void tcp_enter_loss(struct sock *sk, int how)
 		tp->undo_marker = tp->snd_una;
 		tcp_clear_retrans_hints_partial(tp);
 	} else {
+		tp->sacked_out = 0;
+		tp->fackets_out = 0;
 		tcp_clear_all_retrans_hints(tp);
 	}
 
 	tcp_for_write_queue(skb, sk) {
 		if (skb == tcp_send_head(sk))
 			break;
-		cnt += tcp_skb_pcount(skb);
+
 		if (TCP_SKB_CB(skb)->sacked&TCPCB_RETRANS)
 			tp->undo_marker = 0;
 		TCP_SKB_CB(skb)->sacked &= (~TCPCB_TAGBITS)|TCPCB_SACKED_ACKED;
@@ -1768,9 +1777,6 @@ void tcp_enter_loss(struct sock *sk, int how)
 			TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_ACKED;
 			TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
 			tp->lost_out += tcp_skb_pcount(skb);
-		} else {
-			tp->sacked_out += tcp_skb_pcount(skb);
-			tp->fackets_out = cnt;
 		}
 	}
 	tcp_verify_left_out(tp);
-- 
1.5.0.6


  reply	other threads:[~2007-10-11 11:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11 11:41 [PATCH net-2.6 0/7] TCP: small changes/fixes + lost_retrans brokeness fix Ilpo Järvinen
2007-10-11 11:41 ` [PATCH 1/7] [TCP]: Add bytes_acked (ABC) clearing to FRTO too Ilpo Järvinen
2007-10-11 11:41   ` [PATCH 2/7] [TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L Ilpo Järvinen
2007-10-11 11:41     ` [PATCH 3/7] [TCP]: Kill almost unused variable pcount from sacktag Ilpo Järvinen
2007-10-11 11:41       ` [PATCH 4/7] [TCP]: Extract tcp_match_queue_to_sack from sacktag code Ilpo Järvinen
2007-10-11 11:41         ` Ilpo Järvinen [this message]
2007-10-11 11:41           ` [PATCH 6/7] [TCP]: Fix lost_retrans loop vs fastpath problems Ilpo Järvinen
2007-10-11 11:41             ` [PATCH 7/7] [TCP]: Limit processing lost_retrans loop to work-to-do cases Ilpo Järvinen
2007-10-12  0:36               ` David Miller
2007-10-18  3:50                 ` TAKANO Ryousei
2007-10-18  9:40                   ` [PATCH] [TCP]: Add highest_sack_end_seq check back to lost_retrans call Ilpo Järvinen
2007-10-18 10:17                     ` [PATCH] [TCP]: Remove lost_retrans zero special cases Ilpo Järvinen
2007-10-18 10:55                       ` TAKANO Ryousei
2007-10-18 11:07                         ` Ilpo Järvinen
2007-10-18 12:08                           ` David Miller
2007-10-12  0:35             ` [PATCH 6/7] [TCP]: Fix lost_retrans loop vs fastpath problems David Miller
2007-10-12  0:35           ` [PATCH 5/7] [TCP]: No need to re-count fackets_out/sacked_out at RTO David Miller
2007-10-12  0:34         ` [PATCH 4/7] [TCP]: Extract tcp_match_queue_to_sack from sacktag code David Miller
2007-10-12  0:34       ` [PATCH 3/7] [TCP]: Kill almost unused variable pcount from sacktag David Miller
2007-10-12  0:33     ` [PATCH 2/7] [TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L David Miller
2007-10-12  0:32   ` [PATCH 1/7] [TCP]: Add bytes_acked (ABC) clearing to FRTO too David Miller
2007-10-12  0:37 ` [PATCH net-2.6 0/7] TCP: small changes/fixes + lost_retrans brokeness fix David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11921028672853-git-send-email-ilpo.jarvinen@helsinki.fi \
    --to=ilpo.jarvinen@helsinki.fi \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=takano@axe-inc.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox