netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IP GRO verifies csum again?
@ 2019-07-18  7:49 Jacob Wen
  2019-07-18  8:27 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Jacob Wen @ 2019-07-18  7:49 UTC (permalink / raw)
  To: netdev; +Cc: herbert

Hi,

inet_gro_receive verifies IP csum but a NIC already did so and set 
CHECKSUM_UNNECESSARY.


https://github.com/torvalds/linux/blob/v5.2/net/ipv4/af_inet.c#L1432-L1433

if (unlikely(ip_fast_csum((u8 *)iph, 5)))

         goto out_unlock;


Is this a bug?


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

* Re: IP GRO verifies csum again?
  2019-07-18  7:49 IP GRO verifies csum again? Jacob Wen
@ 2019-07-18  8:27 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2019-07-18  8:27 UTC (permalink / raw)
  To: Jacob Wen, netdev; +Cc: herbert



On 7/18/19 9:49 AM, Jacob Wen wrote:
> Hi,
> 
> inet_gro_receive verifies IP csum but a NIC already did so and set CHECKSUM_UNNECESSARY.
> 
> 
> https://github.com/torvalds/linux/blob/v5.2/net/ipv4/af_inet.c#L1432-L1433
> 
> if (unlikely(ip_fast_csum((u8 *)iph, 5)))
> 
>         goto out_unlock;
> 
> 
> Is this a bug?
> 

This checksum validates the TCP one, which is the real cost, since we need to touch all
the packet.

We do not bother 'offloading' IPV4 checksum over 20 bytes or so, since in modern cpus,
having the cache line hot in cpu caches means the checksum is almost free.

Adding a test here would not always be a win, say for CHECKSUM_COMPLETE cases,
which we try to generalize in favor of old CHECKSUM_UNNECESSARY.

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

end of thread, other threads:[~2019-07-18  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18  7:49 IP GRO verifies csum again? Jacob Wen
2019-07-18  8:27 ` Eric Dumazet

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).