aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3a4d9b34bed4..bc790ea9960f 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1820,14 +1820,12 @@ advance_sp:
1820 for (j = 0; j < used_sacks; j++) 1820 for (j = 0; j < used_sacks; j++)
1821 tp->recv_sack_cache[i++] = sp[j]; 1821 tp->recv_sack_cache[i++] = sp[j];
1822 1822
1823 tcp_mark_lost_retrans(sk);
1824
1825 tcp_verify_left_out(tp);
1826
1827 if ((state.reord < tp->fackets_out) && 1823 if ((state.reord < tp->fackets_out) &&
1828 ((inet_csk(sk)->icsk_ca_state != TCP_CA_Loss) || tp->undo_marker)) 1824 ((inet_csk(sk)->icsk_ca_state != TCP_CA_Loss) || tp->undo_marker))
1829 tcp_update_reordering(sk, tp->fackets_out - state.reord, 0); 1825 tcp_update_reordering(sk, tp->fackets_out - state.reord, 0);
1830 1826
1827 tcp_mark_lost_retrans(sk);
1828 tcp_verify_left_out(tp);
1831out: 1829out:
1832 1830
1833#if FASTRETRANS_DEBUG > 0 1831#if FASTRETRANS_DEBUG > 0
@@ -3280,6 +3278,24 @@ static inline bool tcp_may_update_window(const struct tcp_sock *tp,
3280 (ack_seq == tp->snd_wl1 && nwin > tp->snd_wnd); 3278 (ack_seq == tp->snd_wl1 && nwin > tp->snd_wnd);
3281} 3279}
3282 3280
3281/* If we update tp->snd_una, also update tp->bytes_acked */
3282static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack)
3283{
3284 u32 delta = ack - tp->snd_una;
3285
3286 tp->bytes_acked += delta;
3287 tp->snd_una = ack;
3288}
3289
3290/* If we update tp->rcv_nxt, also update tp->bytes_received */
3291static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq)
3292{
3293 u32 delta = seq - tp->rcv_nxt;
3294
3295 tp->bytes_received += delta;
3296 tp->rcv_nxt = seq;
3297}
3298
3283/* Update our send window. 3299/* Update our send window.
3284 * 3300 *
3285 * Window update algorithm, described in RFC793/RFC1122 (used in linux-2.2 3301 * Window update algorithm, described in RFC793/RFC1122 (used in linux-2.2
@@ -3315,7 +3331,7 @@ static int tcp_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32
3315 } 3331 }
3316 } 3332 }
3317 3333
3318 tp->snd_una = ack; 3334 tcp_snd_una_update(tp, ack);
3319 3335
3320 return flag; 3336 return flag;
3321} 3337}
@@ -3497,7 +3513,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3497 * Note, we use the fact that SND.UNA>=SND.WL2. 3513 * Note, we use the fact that SND.UNA>=SND.WL2.
3498 */ 3514 */
3499 tcp_update_wl(tp, ack_seq); 3515 tcp_update_wl(tp, ack_seq);
3500 tp->snd_una = ack; 3516 tcp_snd_una_update(tp, ack);
3501 flag |= FLAG_WIN_UPDATE; 3517 flag |= FLAG_WIN_UPDATE;
3502 3518
3503 tcp_in_ack_event(sk, CA_ACK_WIN_UPDATE); 3519 tcp_in_ack_event(sk, CA_ACK_WIN_UPDATE);
@@ -4236,7 +4252,7 @@ static void tcp_ofo_queue(struct sock *sk)
4236 4252
4237 tail = skb_peek_tail(&sk->sk_receive_queue); 4253 tail = skb_peek_tail(&sk->sk_receive_queue);
4238 eaten = tail && tcp_try_coalesce(sk, tail, skb, &fragstolen); 4254 eaten = tail && tcp_try_coalesce(sk, tail, skb, &fragstolen);
4239 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 4255 tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
4240 if (!eaten) 4256 if (!eaten)
4241 __skb_queue_tail(&sk->sk_receive_queue, skb); 4257 __skb_queue_tail(&sk->sk_receive_queue, skb);
4242 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 4258 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
@@ -4404,7 +4420,7 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, int
4404 __skb_pull(skb, hdrlen); 4420 __skb_pull(skb, hdrlen);
4405 eaten = (tail && 4421 eaten = (tail &&
4406 tcp_try_coalesce(sk, tail, skb, fragstolen)) ? 1 : 0; 4422 tcp_try_coalesce(sk, tail, skb, fragstolen)) ? 1 : 0;
4407 tcp_sk(sk)->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 4423 tcp_rcv_nxt_update(tcp_sk(sk), TCP_SKB_CB(skb)->end_seq);
4408 if (!eaten) { 4424 if (!eaten) {
4409 __skb_queue_tail(&sk->sk_receive_queue, skb); 4425 __skb_queue_tail(&sk->sk_receive_queue, skb);
4410 skb_set_owner_r(skb, sk); 4426 skb_set_owner_r(skb, sk);
@@ -4497,7 +4513,7 @@ queue_and_out:
4497 4513
4498 eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen); 4514 eaten = tcp_queue_rcv(sk, skb, 0, &fragstolen);
4499 } 4515 }
4500 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 4516 tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
4501 if (skb->len) 4517 if (skb->len)
4502 tcp_event_data_recv(sk, skb); 4518 tcp_event_data_recv(sk, skb);
4503 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 4519 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
@@ -5245,7 +5261,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
5245 tcp_rcv_rtt_measure_ts(sk, skb); 5261 tcp_rcv_rtt_measure_ts(sk, skb);
5246 5262
5247 __skb_pull(skb, tcp_header_len); 5263 __skb_pull(skb, tcp_header_len);
5248 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 5264 tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq);
5249 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITSTOUSER); 5265 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITSTOUSER);
5250 eaten = 1; 5266 eaten = 1;
5251 } 5267 }