Subject: Re: [PATCH net-next-2.6] net: Fix some corner cases in dev_can_checksum()

From: Ben Hutchings <[email-masked]>
Date: Tue, 26 Oct 2010 14:29:19 +0100

Jesse Gross wrote:
> On Fri, Oct 22, 2010 at 7:12 AM, Ben Hutchings
> <[email-masked]> wrote:
> > dev_can_checksum() incorrectly returns true in these cases:
> >
> > 1. The skb has both out-of-band and in-band VLAN tags and the device
> >   supports checksum offload for the encapsulated protocol but only with
> >   one layer of encapsulation.
> > 2. The skb has a VLAN tag and the device supports generic checksumming
> >   but not in conjunction with VLAN encapsulation.
> >
> > Rearrange the VLAN tag checks to avoid these.
> >
> > Signed-off-by: Ben Hutchings <[email-masked]>
> 
> If we assume that cards cannot handle offloading for double tagged
> packets, which is obviously the most conservative approach, we
> probably also need to change the checks for TSO/SG.  There's no issue
> with extracting the protocol from the right header but we might assume
> that the card can handle double tag offloading when it can't.  For
> both TSO/SG we check if there is either an in-band tag or out-of-band
> tag and use dev->vlan_features if that is the case.  Maybe we need to
> handle it in software if it is double tagged.

That's something to check.

> On the other hand, I don't know whether it's true that cards can't
> handle offloading for packets tagged in both manners.  I suppose that
> it depends on where the offloading and tagging are in the pipeline.
> For example, when it comes to SG I doubt that the cards care about
> vlan tags much at all.

I do know that current Solarflare controllers can parse two VLAN tags
and generate/validate TCP/IP-style checksums after them.  We could add
vlan2_features which would be copied to a VLAN sub-device's
vlan_features, but then what happens when people want to handle triple
VLAN encapsulation?

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.