Re: [PATCH net 4/4] net: ethernet: cortina: Handle large frames

From: Linus Walleij
Date: Sun Nov 05 2023 - 15:56:42 EST


On Sat, Nov 4, 2023 at 3:57 PM Andrew Lunn <andrew@xxxxxxx> wrote:

> > + * Just bypass on bigger frames.
> > + */
> > + word1 |= TSS_BYPASS_BIT;
> > + } else if (skb->ip_summed != CHECKSUM_NONE) {
>
> I've never looked at how the network stack does checksums. But looking
> at this patch, it made me wounder, how do you tell the stack it needs
> to do a software checksum because the hardware cannot?

I read up on it: the documentation is in
Documentation/networking/checksum-offloads.rst
and in the header for skbuff, include/linux/skbuff.h

Actually we should check for == CHECKSUM_PARTIAL which means
we need to do the checksum (!= CHECKSUM_NONE is not inclusive)
then I call a software fallback directly from the driver if I need to.

> Or for this
> driver, is it always calculating a checksum, which is then ignored?
> Maybe you can improve performance a little but disabling software
> checksum when it is not needed?

The ping was somehow working without proper checksum
before, but I think I'm doing the right thing now, also tested with
HTTP traffic, check out v2.

Thanks for pointing it out, the patch looks way better now.

Yours,
Linus Walleij