aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2007-08-09 07:33:18 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:55 -0400
commitb5860bbac7be1381626f3dc8a0cb970a60fcefb4 (patch)
tree53034429084f92fdb55c062498e1f4255be9bd4a
parent35e8694198ba94b62df8aa35fa6e52a1cfb86df2 (diff)
[TCP]: Tighten tcp_sock's belt, drop left_out
It is easily calculable when needed and user are not that many after all. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/net/tcp.h4
-rw-r--r--net/ipv4/tcp_input.c11
-rw-r--r--net/ipv4/tcp_minisocks.c1
-rw-r--r--net/ipv4/tcp_output.c12
5 files changed, 7 insertions, 22 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index d64734389fb6..1f12fa0b67d7 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -304,7 +304,6 @@ struct tcp_sock {
304 u32 rtt_seq; /* sequence number to update rttvar */ 304 u32 rtt_seq; /* sequence number to update rttvar */
305 305
306 u32 packets_out; /* Packets which are "in flight" */ 306 u32 packets_out; /* Packets which are "in flight" */
307 u32 left_out; /* Packets which leaved network */
308 u32 retrans_out; /* Retransmitted packets out */ 307 u32 retrans_out; /* Retransmitted packets out */
309/* 308/*
310 * Options received (usually on last packet, some only on SYN packets). 309 * Options received (usually on last packet, some only on SYN packets).
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 9d3438f6b52f..299872d461c7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -735,7 +735,8 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
735 */ 735 */
736static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) 736static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
737{ 737{
738 return (tp->packets_out - tp->left_out + tp->retrans_out); 738 return tp->packets_out - (tp->sacked_out + tp->lost_out) +
739 tp->retrans_out;
739} 740}
740 741
741/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 742/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
@@ -757,7 +758,6 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
757{ 758{
758 BUG_ON(tp->rx_opt.sack_ok && 759 BUG_ON(tp->rx_opt.sack_ok &&
759 (tp->sacked_out + tp->lost_out > tp->packets_out)); 760 (tp->sacked_out + tp->lost_out > tp->packets_out));
760 tp->left_out = tp->sacked_out + tp->lost_out;
761} 761}
762 762
763extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 763extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ea690afa592a..957e0fb8afb7 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1346,8 +1346,6 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1346 } 1346 }
1347 } 1347 }
1348 1348
1349 tp->left_out = tp->sacked_out + tp->lost_out;
1350
1351 if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss && 1349 if ((reord < tp->fackets_out) && icsk->icsk_ca_state != TCP_CA_Loss &&
1352 (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark))) 1350 (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark)))
1353 tcp_update_reordering(sk, ((tp->fackets_out + 1) - reord), 0); 1351 tcp_update_reordering(sk, ((tp->fackets_out + 1) - reord), 0);
@@ -1408,7 +1406,6 @@ static void tcp_remove_reno_sacks(struct sock *sk, int acked)
1408static inline void tcp_reset_reno_sack(struct tcp_sock *tp) 1406static inline void tcp_reset_reno_sack(struct tcp_sock *tp)
1409{ 1407{
1410 tp->sacked_out = 0; 1408 tp->sacked_out = 0;
1411 tp->left_out = tp->lost_out;
1412} 1409}
1413 1410
1414int tcp_use_frto(struct sock *sk) 1411int tcp_use_frto(struct sock *sk)
@@ -1573,7 +1570,6 @@ static void tcp_enter_frto_loss(struct sock *sk, int allowed_segments, int flag)
1573 1570
1574void tcp_clear_retrans(struct tcp_sock *tp) 1571void tcp_clear_retrans(struct tcp_sock *tp)
1575{ 1572{
1576 tp->left_out = 0;
1577 tp->retrans_out = 0; 1573 tp->retrans_out = 0;
1578 1574
1579 tp->fackets_out = 0; 1575 tp->fackets_out = 0;
@@ -1973,7 +1969,7 @@ static void DBGUNDO(struct sock *sk, const char *msg)
1973 printk(KERN_DEBUG "Undo %s %u.%u.%u.%u/%u c%u l%u ss%u/%u p%u\n", 1969 printk(KERN_DEBUG "Undo %s %u.%u.%u.%u/%u c%u l%u ss%u/%u p%u\n",
1974 msg, 1970 msg,
1975 NIPQUAD(inet->daddr), ntohs(inet->dport), 1971 NIPQUAD(inet->daddr), ntohs(inet->dport),
1976 tp->snd_cwnd, tp->left_out, 1972 tp->snd_cwnd, tp->sacked_out + tp->lost_out,
1977 tp->snd_ssthresh, tp->prior_ssthresh, 1973 tp->snd_ssthresh, tp->prior_ssthresh,
1978 tp->packets_out); 1974 tp->packets_out);
1979} 1975}
@@ -2102,7 +2098,6 @@ static int tcp_try_undo_loss(struct sock *sk)
2102 2098
2103 DBGUNDO(sk, "partial loss"); 2099 DBGUNDO(sk, "partial loss");
2104 tp->lost_out = 0; 2100 tp->lost_out = 0;
2105 tp->left_out = tp->sacked_out;
2106 tcp_undo_cwr(sk, 1); 2101 tcp_undo_cwr(sk, 1);
2107 NET_INC_STATS_BH(LINUX_MIB_TCPLOSSUNDO); 2102 NET_INC_STATS_BH(LINUX_MIB_TCPLOSSUNDO);
2108 inet_csk(sk)->icsk_retransmits = 0; 2103 inet_csk(sk)->icsk_retransmits = 0;
@@ -2126,8 +2121,6 @@ static void tcp_try_to_open(struct sock *sk, int flag)
2126{ 2121{
2127 struct tcp_sock *tp = tcp_sk(sk); 2122 struct tcp_sock *tp = tcp_sk(sk);
2128 2123
2129 tcp_sync_left_out(tp);
2130
2131 if (tp->retrans_out == 0) 2124 if (tp->retrans_out == 0)
2132 tp->retrans_stamp = 0; 2125 tp->retrans_stamp = 0;
2133 2126
@@ -2137,7 +2130,7 @@ static void tcp_try_to_open(struct sock *sk, int flag)
2137 if (inet_csk(sk)->icsk_ca_state != TCP_CA_CWR) { 2130 if (inet_csk(sk)->icsk_ca_state != TCP_CA_CWR) {
2138 int state = TCP_CA_Open; 2131 int state = TCP_CA_Open;
2139 2132
2140 if (tp->left_out || tp->retrans_out || tp->undo_marker) 2133 if (tp->sacked_out || tp->retrans_out || tp->undo_marker)
2141 state = TCP_CA_Disorder; 2134 state = TCP_CA_Disorder;
2142 2135
2143 if (inet_csk(sk)->icsk_ca_state != state) { 2136 if (inet_csk(sk)->icsk_ca_state != state) {
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 36a8fbd0e64e..fdfe89fe646b 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -405,7 +405,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
405 newicsk->icsk_rto = TCP_TIMEOUT_INIT; 405 newicsk->icsk_rto = TCP_TIMEOUT_INIT;
406 406
407 newtp->packets_out = 0; 407 newtp->packets_out = 0;
408 newtp->left_out = 0;
409 newtp->retrans_out = 0; 408 newtp->retrans_out = 0;
410 newtp->sacked_out = 0; 409 newtp->sacked_out = 0;
411 newtp->fackets_out = 0; 410 newtp->fackets_out = 0;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 3c8c8e7f6f6d..7434944caa8f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -732,10 +732,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
732 if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS) 732 if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS)
733 tp->retrans_out -= diff; 733 tp->retrans_out -= diff;
734 734
735 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST) { 735 if (TCP_SKB_CB(skb)->sacked & TCPCB_LOST)
736 tp->lost_out -= diff; 736 tp->lost_out -= diff;
737 tp->left_out -= diff;
738 }
739 737
740 if (diff > 0) { 738 if (diff > 0) {
741 /* Adjust Reno SACK estimate. */ 739 /* Adjust Reno SACK estimate. */
@@ -1727,15 +1725,11 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1727 TCP_SKB_CB(skb)->sacked |= TCP_SKB_CB(next_skb)->sacked&(TCPCB_EVER_RETRANS|TCPCB_AT_TAIL); 1725 TCP_SKB_CB(skb)->sacked |= TCP_SKB_CB(next_skb)->sacked&(TCPCB_EVER_RETRANS|TCPCB_AT_TAIL);
1728 if (TCP_SKB_CB(next_skb)->sacked&TCPCB_SACKED_RETRANS) 1726 if (TCP_SKB_CB(next_skb)->sacked&TCPCB_SACKED_RETRANS)
1729 tp->retrans_out -= tcp_skb_pcount(next_skb); 1727 tp->retrans_out -= tcp_skb_pcount(next_skb);
1730 if (TCP_SKB_CB(next_skb)->sacked&TCPCB_LOST) { 1728 if (TCP_SKB_CB(next_skb)->sacked&TCPCB_LOST)
1731 tp->lost_out -= tcp_skb_pcount(next_skb); 1729 tp->lost_out -= tcp_skb_pcount(next_skb);
1732 tp->left_out -= tcp_skb_pcount(next_skb);
1733 }
1734 /* Reno case is special. Sigh... */ 1730 /* Reno case is special. Sigh... */
1735 if (!tp->rx_opt.sack_ok && tp->sacked_out) { 1731 if (!tp->rx_opt.sack_ok && tp->sacked_out)
1736 tcp_dec_pcount_approx(&tp->sacked_out, next_skb); 1732 tcp_dec_pcount_approx(&tp->sacked_out, next_skb);
1737 tp->left_out -= tcp_skb_pcount(next_skb);
1738 }
1739 1733
1740 /* Not quite right: it can be > snd.fack, but 1734 /* Not quite right: it can be > snd.fack, but
1741 * it is better to underestimate fackets. 1735 * it is better to underestimate fackets.