tcp: tcp_tso_segment() small optimization
authorEric Dumazet <edumazet@google.com>
Sat, 13 Apr 2013 03:22:08 +0000 (03:22 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Apr 2013 20:54:14 +0000 (16:54 -0400)
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>
net/ipv4/tcp.c

index 963bda18486f956a738abd33dfcbb4380eef0363..dcb116dde2168759025d315f4e2d3b77994a276a 100644 (file)
@@ -2886,6 +2886,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
        unsigned int oldlen;
        unsigned int mss;
        struct sk_buff *gso_skb = skb;
+       __sum16 newcheck;
 
        if (!pskb_may_pull(skb, sizeof(*th)))
                goto out;
@@ -2936,11 +2937,13 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
        th = tcp_hdr(skb);
        seq = ntohl(th->seq);
 
+       newcheck = ~csum_fold((__force __wsum)((__force u32)th->check +
+                                              (__force u32)delta));
+
        do {
                th->fin = th->psh = 0;
+               th->check = newcheck;
 
-               th->check = ~csum_fold((__force __wsum)((__force u32)th->check +
-                                      (__force u32)delta));
                if (skb->ip_summed != CHECKSUM_PARTIAL)
                        th->check =
                             csum_fold(csum_partial(skb_transport_header(skb),