[ovs-dev] [PATCH 06/19] datapath: Compatibility code for csum_replace4.

Jesse Gross jesse at nicira.com
Thu Dec 9 21:10:24 UTC 2010


On Thu, Dec 9, 2010 at 9:53 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Wed, Dec 08, 2010 at 10:14:04PM -0800, Jesse Gross wrote:
>> Kernels ealier than 2.6.25 did not define csum_replace4, so
>> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
>> +static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
>> +{
>> +     __be32 diff[] = { ~from, to };
>> +
>> +     sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
>> +}
>> +#endif
>
> Compared to what I see in mainline Linux, there's an extra cast here.  I
> don't see why, because it looks like csum_partial()'s first parameter
> has always had type "const void *".

The first argument of csum_partial() used to be char *, so on the old
kernels where this compatibility code is used we need the cast.

This is actually the version of csum_replace4 from 2.6.25, which is
when it was introduced.




More information about the dev mailing list