Skip to content

Commit ccdbb6e

Browse files
edumazetdavem330
authored andcommitted
tcp: tcp_transmit_skb() optimizations
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 <[email protected]> Cc: MF Nowlan <[email protected]> Cc: Yuchung Cheng <[email protected]> Cc: Neal Cardwell <[email protected]> Acked-By: Yuchung Cheng <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 29b67c3 commit ccdbb6e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/ipv4/tcp_output.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -850,15 +850,15 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
850850

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

853-
/* If congestion control is doing timestamping, we must
854-
* take such a timestamp before we potentially clone/copy.
855-
*/
856-
if (icsk->icsk_ca_ops->flags & TCP_CONG_RTT_STAMP)
857-
__net_timestamp(skb);
858-
859-
if (likely(clone_it)) {
853+
if (clone_it) {
860854
const struct sk_buff *fclone = skb + 1;
861855

856+
/* If congestion control is doing timestamping, we must
857+
* take such a timestamp before we potentially clone/copy.
858+
*/
859+
if (icsk->icsk_ca_ops->flags & TCP_CONG_RTT_STAMP)
860+
__net_timestamp(skb);
861+
862862
if (unlikely(skb->fclone == SKB_FCLONE_ORIG &&
863863
fclone->fclone == SKB_FCLONE_CLONE))
864864
NET_INC_STATS_BH(sock_net(sk),

0 commit comments

Comments
 (0)