Subject: Re: af_packet & CHECKSUM_HW

From: "David S. Miller" <[email-masked]>
Date: Tue, 18 Nov 2003 17:46:12 -0800

On Tue, 18 Nov 2003 14:21:37 +0100
Petr Vandrovec <[email-masked]> wrote:

> On Mon, Nov 17, 2003 at 12:30:47PM -0800, David S. Miller wrote:
> > Remind me again why the vmnet driver can't just run skb_checksum()
> > on packets that have CHECKSUM_HW set?
> 
> Because vmnet driver (for bridged networking) is hooked through dev_add_pack.
> Place where to put checksum is defined as skb->h.raw + skb->csum, and what 
> to checksum as skb->h.raw ... skb->data + skb->len. But unfortunately
> dev_queue_xmit_nit replaces skb2->h.raw with skb2->nh.raw - and so hook
> has to look at the packet contents to compute h.raw from packet data and
> protocol type.

Thanks so much for reminding me.

I'd like to resolve this.  One solution is evident, let me know
what you think about the following idea.

How about we add a flag the the packet_type structure, called
PTYPE_FLAG_NEEDCHECKSUM.  If it is set, we run skb_checksum() on
CHECKSUM_HW SKBs and do not mangle the skb2->h.raw etc. pointers, then
we pass it into ptype->func().

In this way all existing ptype->func() implementations get what
they expect.  Only if the flag is set will the new behavior occur.

Comments?