On Tue, 2011-03-29 at 18:15 +0100, Anil Madhavapeddy wrote:
> On 29 Mar 2011, at 12:37, Ian Campbell wrote:
>
> > On Tue, 2011-03-29 at 17:17 +0100, Anil Madhavapeddy wrote:
> >> I'm just adding checksum offload support into a custom guest, and wanted
> >> to clarify a few things.
> >>
> >> In netfront, I can mark outgoing frames with:
> >> - NETTXF_csum_blank
> >> - NETTXF_data_validated
> >>
> >> These refer to UDP or TCP checksums, and not the IP checksum, right?
> >> Linux seems to never offload IP header checksumming, so it must be
> >> offloading the UDP/TCP calculation and then adjusting the IPv4
> >> checksum based on that calculation.
> >>
> >> For outgoing UDP, my guest is setting the checksum to 0 (as it's
> >> optional in the protocol), and calculating the full IPv4 checksum in
> >> software, and all works (slowly). However, setting NETTXF_csum_blank
> >> in the outgoing frame and leaving the IPv4 checksum at 0 doesn't seem
> >> to result in any adjustment by netback, and the packet gets dropped.
> >
> > I think you need to set the checksum to the psuedo-header checksum
> > rather than 0 since that is what csum_blank means (such a well named
> > flag!)...
> >
> > It's not clear why anything would drop a UDP frame with checksum==0
> > since, as you say, it is optional. My guess is that since the
> > NETTXF_csum_blank and data_validated turn into an skb->ip_summed ==
> > SKB_PARTIAL on the backend side this causes the Linux network stack to
> > drop it because that statement conflicts with the checksum being 0.
>
> Right, but I'm setting the IPv4 checksum to 0 too, since I want to
> offload the whole lot and never calculate a body checksum in the
> guest.
Maybe I'm getting confused but the IPv4 checksum only covers the
headers, doesn't it? I don't think you can offload those, at least not
using the current PV protocol. So you need to include a valid IP header
checksum but that doesn't require summing over all the data, just the
headers.
> But if the UDP checksum is set to 0, then the backend can't just
> adjust it to obtain the IPv4 checksum and has to iterate over the
> packet body at some stage.
I don't think it needs to obtain the IPv4 checksum to do UDP checksum if
the UDP checksum is initially set to the partial(/pseudo header)
checksum -- it's already incorporated as necessary.
> I've tried setting the UDP checksum to 0, the pseudoheader, and the
> full checksum, and the IPv4 checksum is never set by the backend in
> any of these cases. If I set the IPv4 checksum in software to the
> correct value, then packets go through, but the UDP checksums are
> never altered.
>
> Guess it's time to start slapping printfs all over the dom0 kernel to
> see what's going on unless you know what I "should" be setting both
> the IPv4/UDP checksums to with NETTXF_csum_blank...
The protocol is unhelpfully "defined" to be basically "what Linux does".
i.e. whatever Linux generates in an SKB with skb->ip_summed ==
CHECKSUM_PARTIAL is what you need to generate.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|