aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2009-02-27 23:44:38 -0500
committerDavid S. Miller <davem@davemloft.net>2009-03-02 06:00:16 -0500
commitcabeccbd172cc305f4383f5a4808ae254745275f (patch)
tree0504d469ae4fc1a6c1ba368b3cc99ae7f55520cb /net/ipv4/tcp_output.c
parent758ce5c8d11d6fc57fe5f1dbc237aa8ff6386eac (diff)
tcp: kill eff_sacks "cache", the sole user can calculate itself
Also fixes insignificant bug that would cause sending of stale SACK block (would occur in some corner cases). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 61445b57610c..1555bb73b638 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -441,10 +441,8 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
441 *ptr++ = htonl(sp[this_sack].end_seq); 441 *ptr++ = htonl(sp[this_sack].end_seq);
442 } 442 }
443 443
444 if (tp->rx_opt.dsack) { 444 if (tp->rx_opt.dsack)
445 tp->rx_opt.dsack = 0; 445 tp->rx_opt.dsack = 0;
446 tp->rx_opt.eff_sacks = tp->rx_opt.num_sacks;
447 }
448 } 446 }
449} 447}
450 448
@@ -550,6 +548,7 @@ static unsigned tcp_established_options(struct sock *sk, struct sk_buff *skb,
550 struct tcp_skb_cb *tcb = skb ? TCP_SKB_CB(skb) : NULL; 548 struct tcp_skb_cb *tcb = skb ? TCP_SKB_CB(skb) : NULL;
551 struct tcp_sock *tp = tcp_sk(sk); 549 struct tcp_sock *tp = tcp_sk(sk);
552 unsigned size = 0; 550 unsigned size = 0;
551 unsigned int eff_sacks;
553 552
554#ifdef CONFIG_TCP_MD5SIG 553#ifdef CONFIG_TCP_MD5SIG
555 *md5 = tp->af_specific->md5_lookup(sk, sk); 554 *md5 = tp->af_specific->md5_lookup(sk, sk);
@@ -568,10 +567,11 @@ static unsigned tcp_established_options(struct sock *sk, struct sk_buff *skb,
568 size += TCPOLEN_TSTAMP_ALIGNED; 567 size += TCPOLEN_TSTAMP_ALIGNED;
569 } 568 }
570 569
571 if (unlikely(tp->rx_opt.eff_sacks)) { 570 eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
571 if (unlikely(eff_sacks)) {
572 const unsigned remaining = MAX_TCP_OPTION_SPACE - size; 572 const unsigned remaining = MAX_TCP_OPTION_SPACE - size;
573 opts->num_sack_blocks = 573 opts->num_sack_blocks =
574 min_t(unsigned, tp->rx_opt.eff_sacks, 574 min_t(unsigned, eff_sacks,
575 (remaining - TCPOLEN_SACK_BASE_ALIGNED) / 575 (remaining - TCPOLEN_SACK_BASE_ALIGNED) /
576 TCPOLEN_SACK_PERBLOCK); 576 TCPOLEN_SACK_PERBLOCK);
577 size += TCPOLEN_SACK_BASE_ALIGNED + 577 size += TCPOLEN_SACK_BASE_ALIGNED +
@@ -1418,7 +1418,7 @@ static int tcp_mtu_probe(struct sock *sk)
1418 icsk->icsk_mtup.probe_size || 1418 icsk->icsk_mtup.probe_size ||
1419 inet_csk(sk)->icsk_ca_state != TCP_CA_Open || 1419 inet_csk(sk)->icsk_ca_state != TCP_CA_Open ||
1420 tp->snd_cwnd < 11 || 1420 tp->snd_cwnd < 11 ||
1421 tp->rx_opt.eff_sacks) 1421 tp->rx_opt.num_sacks || tp->rx_opt.dsack)
1422 return -1; 1422 return -1;
1423 1423
1424 /* Very simple search strategy: just double the MSS. */ 1424 /* Very simple search strategy: just double the MSS. */