aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-04-12 23:22:08 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-13 16:54:14 -0400
commitbece1b9708434b6fb90b029affc228fc21688404 (patch)
tree59b741f84bc6185e9fffcc03194e696cb687aa4b /net
parenteb1d064058c7c7c2b2e414c4c8e81c21965cdbe9 (diff)
tcp: tcp_tso_segment() small optimization
We can move th->check computation out of the loop, as compiler doesn't know each skb initially share same tcp headers after skb_segment() Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 963bda18486f..dcb116dde216 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2886,6 +2886,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
2886 unsigned int oldlen; 2886 unsigned int oldlen;
2887 unsigned int mss; 2887 unsigned int mss;
2888 struct sk_buff *gso_skb = skb; 2888 struct sk_buff *gso_skb = skb;
2889 __sum16 newcheck;
2889 2890
2890 if (!pskb_may_pull(skb, sizeof(*th))) 2891 if (!pskb_may_pull(skb, sizeof(*th)))
2891 goto out; 2892 goto out;
@@ -2936,11 +2937,13 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
2936 th = tcp_hdr(skb); 2937 th = tcp_hdr(skb);
2937 seq = ntohl(th->seq); 2938 seq = ntohl(th->seq);
2938 2939
2940 newcheck = ~csum_fold((__force __wsum)((__force u32)th->check +
2941 (__force u32)delta));
2942
2939 do { 2943 do {
2940 th->fin = th->psh = 0; 2944 th->fin = th->psh = 0;
2945 th->check = newcheck;
2941 2946
2942 th->check = ~csum_fold((__force __wsum)((__force u32)th->check +
2943 (__force u32)delta));
2944 if (skb->ip_summed != CHECKSUM_PARTIAL) 2947 if (skb->ip_summed != CHECKSUM_PARTIAL)
2945 th->check = 2948 th->check =
2946 csum_fold(csum_partial(skb_transport_header(skb), 2949 csum_fold(csum_partial(skb_transport_header(skb),