]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: minor optimizations around tcp_hdr() usage
authorEric Dumazet <edumazet@google.com>
Fri, 13 May 2016 16:16:40 +0000 (09:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 May 2016 17:46:23 +0000 (13:46 -0400)
commit6388f5c2fce1c3fa5cdc216c36b2f6a70c669c7a
treee0b21e3af57979d1f5b1faf718582aaa4a6566b0
parent35d45120f31c4fc21d5c4982b31050ef9319b256
tcp: minor optimizations around tcp_hdr() usage

tcp_hdr() is slightly more expensive than using skb->data in contexts
where we know they point to the same byte.

In receive path, tcp_v4_rcv() and tcp_v6_rcv() are in this situation,
as tcp header has not been pulled yet.

In output path, the same can be said when we just pushed the tcp header
in the skb, in tcp_transmit_skb() and tcp_make_synack()

Also factorize the two checks for tcb->tcp_flags & TCPHDR_SYN in
tcp_transmit_skb() and pass tcp header pointer to tcp_ecn_send(),
so that compiler can further optimize and avoid a reload.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_output.c
net/ipv6/tcp_ipv6.c