Skip to content

Commit

Permalink
tcp: tcp_transmit_skb() optimizations
Browse files Browse the repository at this point in the history
1) We need to take a timestamp only for skb that should be cloned.

Other skbs are not in write queue and no rtt estimation is done on them.

2) the unlikely() hint is wrong for receivers (they send pure ACK)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: MF Nowlan <fitz@cs.yale.edu>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-By: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 11, 2013
1 parent 29b67c3 commit ccdbb6e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,15 +850,15 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,

BUG_ON(!skb || !tcp_skb_pcount(skb));

/* If congestion control is doing timestamping, we must
* take such a timestamp before we potentially clone/copy.
*/
if (icsk->icsk_ca_ops->flags & TCP_CONG_RTT_STAMP)
__net_timestamp(skb);

if (likely(clone_it)) {
if (clone_it) {
const struct sk_buff *fclone = skb + 1;

/* If congestion control is doing timestamping, we must
* take such a timestamp before we potentially clone/copy.
*/
if (icsk->icsk_ca_ops->flags & TCP_CONG_RTT_STAMP)
__net_timestamp(skb);

if (unlikely(skb->fclone == SKB_FCLONE_ORIG &&
fclone->fclone == SKB_FCLONE_CLONE))
NET_INC_STATS_BH(sock_net(sk),
Expand Down

0 comments on commit ccdbb6e

Please sign in to comment.