summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-04-13 05:22:08 +0200
committerDavid S. Miller <davem@davemloft.net>2013-04-13 22:54:14 +0200
commitbece1b9708434b6fb90b029affc228fc21688404 (patch)
tree59b741f84bc6185e9fffcc03194e696cb687aa4b /net/ipv4
parentfec: Fix PHC device log (diff)
downloadlinux-bece1b9708434b6fb90b029affc228fc21688404.tar.xz
linux-bece1b9708434b6fb90b029affc228fc21688404.zip
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/ipv4')
-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,
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),