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.