Skip to content

Commit

Permalink
tcp: fix double-counted receiver RTT when leaving receiver fast path
Browse files Browse the repository at this point in the history
[ Upstream commit aab2b4b ]

We should not update ts_recent and call tcp_rcv_rtt_measure_ts() both
before and after going to step5. That wastes CPU and double-counts the
receiver-side RTT sample.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
nealcardwell authored and gregkh committed Mar 20, 2013
1 parent 280b2b9 commit d725632
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -5498,6 +5498,9 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
if (tcp_checksum_complete_user(sk, skb))
goto csum_error;

if ((int)skb->truesize > sk->sk_forward_alloc)
goto step5;

/* Predicted packet is in window by definition.
* seq == rcv_nxt and rcv_wup <= rcv_nxt.
* Hence, check seq<=rcv_wup reduces to:
Expand All @@ -5509,9 +5512,6 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,

tcp_rcv_rtt_measure_ts(sk, skb);

if ((int)skb->truesize > sk->sk_forward_alloc)
goto step5;

NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITS);

/* Bulk data transfer: receiver */
Expand Down

0 comments on commit d725632

Please sign in to comment.