[ovs-dev] [PATCH] datapath: Make our checksumming more closely match skb_checksum_help().

Jesse Gross jesse at nicira.com
Tue Jul 13 21:17:47 UTC 2010


On Tue, Jul 13, 2010 at 11:50 AM, Ben Pfaff <blp at nicira.com> wrote:

> On Mon, Jul 12, 2010 at 05:31:26PM -0700, Jesse Gross wrote:
> > Our code that handles checksumming does essentially the same thing
> > as skb_checksum_help() except it folds the process into copying to
> > userspace.  This makes the two functions more closely resemble
> > each other in structure, including adding a couple of BUG() checks.
> > This should have no functional change but makes comparision easier
> > when debugging.
>
> Looks good, one nit:
>
> > @@ -2215,6 +2210,8 @@ success:
> >
> >                               copy_bytes = csum_start;
> >                               csump = (__sum16 __user *)(buf + csum_start
> + csum_offset);
> > +
> > +                             BUG_ON((char *)csump + sizeof(__sum16) >
> buf + nbytes);
> >                               put_user(csum_fold(csum), csump);
>
> The BUG_ON could be tightened from > to >=, right?
>

I don't think so.  Both sides are base pointer + length, so if they are
equal the operation is fine (this check is directly equivalent to one in
skb_checksum_help()).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100713/b616e52c/attachment-0003.html>


More information about the dev mailing list