aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.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_input.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_input.c')
-rw-r--r--net/ipv4/tcp_input.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 03f5ede87224..e4442a293eb0 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4099,7 +4099,6 @@ static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq)
4099 tp->rx_opt.dsack = 1; 4099 tp->rx_opt.dsack = 1;
4100 tp->duplicate_sack[0].start_seq = seq; 4100 tp->duplicate_sack[0].start_seq = seq;
4101 tp->duplicate_sack[0].end_seq = end_seq; 4101 tp->duplicate_sack[0].end_seq = end_seq;
4102 tp->rx_opt.eff_sacks = tp->rx_opt.num_sacks + 1;
4103 } 4102 }
4104} 4103}
4105 4104
@@ -4154,8 +4153,6 @@ static void tcp_sack_maybe_coalesce(struct tcp_sock *tp)
4154 * Decrease num_sacks. 4153 * Decrease num_sacks.
4155 */ 4154 */
4156 tp->rx_opt.num_sacks--; 4155 tp->rx_opt.num_sacks--;
4157 tp->rx_opt.eff_sacks = tp->rx_opt.num_sacks +
4158 tp->rx_opt.dsack;
4159 for (i = this_sack; i < tp->rx_opt.num_sacks; i++) 4156 for (i = this_sack; i < tp->rx_opt.num_sacks; i++)
4160 sp[i] = sp[i + 1]; 4157 sp[i] = sp[i + 1];
4161 continue; 4158 continue;
@@ -4218,7 +4215,6 @@ new_sack:
4218 sp->start_seq = seq; 4215 sp->start_seq = seq;
4219 sp->end_seq = end_seq; 4216 sp->end_seq = end_seq;
4220 tp->rx_opt.num_sacks++; 4217 tp->rx_opt.num_sacks++;
4221 tp->rx_opt.eff_sacks = tp->rx_opt.num_sacks + tp->rx_opt.dsack;
4222} 4218}
4223 4219
4224/* RCV.NXT advances, some SACKs should be eaten. */ 4220/* RCV.NXT advances, some SACKs should be eaten. */
@@ -4232,7 +4228,6 @@ static void tcp_sack_remove(struct tcp_sock *tp)
4232 /* Empty ofo queue, hence, all the SACKs are eaten. Clear. */ 4228 /* Empty ofo queue, hence, all the SACKs are eaten. Clear. */
4233 if (skb_queue_empty(&tp->out_of_order_queue)) { 4229 if (skb_queue_empty(&tp->out_of_order_queue)) {
4234 tp->rx_opt.num_sacks = 0; 4230 tp->rx_opt.num_sacks = 0;
4235 tp->rx_opt.eff_sacks = tp->rx_opt.dsack;
4236 return; 4231 return;
4237 } 4232 }
4238 4233
@@ -4253,11 +4248,8 @@ static void tcp_sack_remove(struct tcp_sock *tp)
4253 this_sack++; 4248 this_sack++;
4254 sp++; 4249 sp++;
4255 } 4250 }
4256 if (num_sacks != tp->rx_opt.num_sacks) { 4251 if (num_sacks != tp->rx_opt.num_sacks)
4257 tp->rx_opt.num_sacks = num_sacks; 4252 tp->rx_opt.num_sacks = num_sacks;
4258 tp->rx_opt.eff_sacks = tp->rx_opt.num_sacks +
4259 tp->rx_opt.dsack;
4260 }
4261} 4253}
4262 4254
4263/* This one checks to see if we can put data from the 4255/* This one checks to see if we can put data from the
@@ -4333,10 +4325,8 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
4333 4325
4334 TCP_ECN_accept_cwr(tp, skb); 4326 TCP_ECN_accept_cwr(tp, skb);
4335 4327
4336 if (tp->rx_opt.dsack) { 4328 if (tp->rx_opt.dsack)
4337 tp->rx_opt.dsack = 0; 4329 tp->rx_opt.dsack = 0;
4338 tp->rx_opt.eff_sacks = tp->rx_opt.num_sacks;
4339 }
4340 4330
4341 /* Queue data for delivery to the user. 4331 /* Queue data for delivery to the user.
4342 * Packets in sequence go to the receive queue. 4332 * Packets in sequence go to the receive queue.
@@ -4456,7 +4446,6 @@ drop:
4456 if (tcp_is_sack(tp)) { 4446 if (tcp_is_sack(tp)) {
4457 tp->rx_opt.num_sacks = 1; 4447 tp->rx_opt.num_sacks = 1;
4458 tp->rx_opt.dsack = 0; 4448 tp->rx_opt.dsack = 0;
4459 tp->rx_opt.eff_sacks = 1;
4460 tp->selective_acks[0].start_seq = TCP_SKB_CB(skb)->seq; 4449 tp->selective_acks[0].start_seq = TCP_SKB_CB(skb)->seq;
4461 tp->selective_acks[0].end_seq = 4450 tp->selective_acks[0].end_seq =
4462 TCP_SKB_CB(skb)->end_seq; 4451 TCP_SKB_CB(skb)->end_seq;