netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] csum experts, csum_replace2() is too expensive
@ 2014-03-20 18:49 Eric Dumazet
  2014-03-21  0:13 ` Herbert Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Eric Dumazet @ 2014-03-20 18:49 UTC (permalink / raw)
  To: Patrick McHardy, Herbert Xu, H.K. Jerry Chu, Michael Dalton; +Cc: netdev

csum_replace2() uses about 29 cycles, while a plain ip_send_check() is
way faster (16 cycles)

csum_partial() is not really meant for doing checksums over 8 bytes !

Any idea how to make the thing really fast as intended ?

I saw csum_partial() consuming 1% of cpu cycles in a GRO workload, that
is insane...

Following patch might be the fastest thing ?

(At this point we already have validated IP checksum)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 8c54870db792..86c924c16f3c 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1434,8 +1434,8 @@ static int inet_gro_complete(struct sk_buff *skb, int nhoff)
 	int proto = iph->protocol;
 	int err = -ENOSYS;
 
-	csum_replace2(&iph->check, iph->tot_len, newlen);
 	iph->tot_len = newlen;
+	ip_send_check(&iph);
 
 	rcu_read_lock();
 	ops = rcu_dereference(inet_offloads[proto]);

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2014-03-24 15:52 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-20 18:49 [RFC] csum experts, csum_replace2() is too expensive Eric Dumazet
2014-03-21  0:13 ` Herbert Xu
2014-03-21  0:54   ` Eric Dumazet
2014-03-21 12:50     ` Herbert Xu
2014-03-21  1:56 ` Andi Kleen
2014-03-21  2:51   ` Eric Dumazet
2014-03-21 12:50   ` Eric Dumazet
2014-03-21 13:28     ` Andi Kleen
2014-03-21 13:32     ` Eric Dumazet
2014-03-21 13:47       ` Eric Dumazet
2014-03-21 13:56         ` Eric Dumazet
2014-03-21 14:14     ` David Laight
2014-03-21 18:52     ` David Miller
2014-03-24  2:50       ` Eric Dumazet
2014-03-24 10:30         ` David Laight
2014-03-24 13:17           ` Eric Dumazet
2014-03-24 14:13             ` Eric Dumazet
2014-03-21 18:07 ` David Miller
2014-03-21 18:30   ` Eric Dumazet
2014-03-24  2:51   ` [PATCH net-next] net: optimize csum_replace2() Eric Dumazet
2014-03-24  4:20     ` David Miller
2014-03-24 10:22     ` David Laight
2014-03-24 13:25       ` Eric Dumazet
2014-03-24 14:38         ` David Laight
2014-03-24 15:14           ` Eric Dumazet
2014-03-24 15:52             ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).