diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 633389390788..051f0f815f17 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2402,14 +2402,6 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, | |||
2402 | return acked; | 2402 | return acked; |
2403 | } | 2403 | } |
2404 | 2404 | ||
2405 | static u32 tcp_usrtt(struct timeval *tv) | ||
2406 | { | ||
2407 | struct timeval now; | ||
2408 | |||
2409 | do_gettimeofday(&now); | ||
2410 | return (now.tv_sec - tv->tv_sec) * 1000000 + (now.tv_usec - tv->tv_usec); | ||
2411 | } | ||
2412 | |||
2413 | /* Remove acknowledged frames from the retransmission queue. */ | 2405 | /* Remove acknowledged frames from the retransmission queue. */ |
2414 | static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | 2406 | static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) |
2415 | { | 2407 | { |
@@ -2420,9 +2412,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2420 | int acked = 0; | 2412 | int acked = 0; |
2421 | __s32 seq_rtt = -1; | 2413 | __s32 seq_rtt = -1; |
2422 | u32 pkts_acked = 0; | 2414 | u32 pkts_acked = 0; |
2423 | void (*rtt_sample)(struct sock *sk, u32 usrtt) | 2415 | ktime_t last_ackt = ktime_set(0,0); |
2424 | = icsk->icsk_ca_ops->rtt_sample; | ||
2425 | struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; | ||
2426 | 2416 | ||
2427 | while ((skb = tcp_write_queue_head(sk)) && | 2417 | while ((skb = tcp_write_queue_head(sk)) && |
2428 | skb != tcp_send_head(sk)) { | 2418 | skb != tcp_send_head(sk)) { |
@@ -2471,7 +2461,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2471 | seq_rtt = -1; | 2461 | seq_rtt = -1; |
2472 | } else if (seq_rtt < 0) { | 2462 | } else if (seq_rtt < 0) { |
2473 | seq_rtt = now - scb->when; | 2463 | seq_rtt = now - scb->when; |
2474 | skb_get_timestamp(skb, &tv); | 2464 | last_ackt = skb->tstamp; |
2475 | } | 2465 | } |
2476 | if (sacked & TCPCB_SACKED_ACKED) | 2466 | if (sacked & TCPCB_SACKED_ACKED) |
2477 | tp->sacked_out -= tcp_skb_pcount(skb); | 2467 | tp->sacked_out -= tcp_skb_pcount(skb); |
@@ -2484,7 +2474,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2484 | } | 2474 | } |
2485 | } else if (seq_rtt < 0) { | 2475 | } else if (seq_rtt < 0) { |
2486 | seq_rtt = now - scb->when; | 2476 | seq_rtt = now - scb->when; |
2487 | skb_get_timestamp(skb, &tv); | 2477 | last_ackt = skb->tstamp; |
2488 | } | 2478 | } |
2489 | tcp_dec_pcount_approx(&tp->fackets_out, skb); | 2479 | tcp_dec_pcount_approx(&tp->fackets_out, skb); |
2490 | tcp_packets_out_dec(tp, skb); | 2480 | tcp_packets_out_dec(tp, skb); |
@@ -2494,13 +2484,14 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2494 | } | 2484 | } |
2495 | 2485 | ||
2496 | if (acked&FLAG_ACKED) { | 2486 | if (acked&FLAG_ACKED) { |
2487 | const struct tcp_congestion_ops *ca_ops | ||
2488 | = inet_csk(sk)->icsk_ca_ops; | ||
2489 | |||
2497 | tcp_ack_update_rtt(sk, acked, seq_rtt); | 2490 | tcp_ack_update_rtt(sk, acked, seq_rtt); |
2498 | tcp_ack_packets_out(sk); | 2491 | tcp_ack_packets_out(sk); |
2499 | if (rtt_sample && !(acked & FLAG_RETRANS_DATA_ACKED)) | ||
2500 | (*rtt_sample)(sk, tcp_usrtt(&tv)); | ||
2501 | 2492 | ||
2502 | if (icsk->icsk_ca_ops->pkts_acked) | 2493 | if (ca_ops->pkts_acked) |
2503 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); | 2494 | ca_ops->pkts_acked(sk, pkts_acked, last_ackt); |
2504 | } | 2495 | } |
2505 | 2496 | ||
2506 | #if FASTRETRANS_DEBUG > 0 | 2497 | #if FASTRETRANS_DEBUG > 0 |