On Wed, 17 Sep 2008, Atsushi Nemoto wrote:
> On Wed, 17 Sep 2008 11:40:01 +0100 (BST), "Maciej W. Rozycki"
> <macro@linux-mips.org> wrote:
> > > and it seems to fix the problem for me. Can you comment?
> >
> > It seems obvious that a carry from the bit #15 in the last addition of
> > the passed checksum -- ADDC(sum, a2) -- will negate the effect of the
> > folding. However a simpler fix should do as well. Try if the following
> > patch works for you. Please note this is completely untested and further
> > optimisation is possible, but I've skipped it in this version for clarity.
>
> Well, csum_partial()'s return value is __wsum (32-bit). So strictly
> there is no need to folding into 16-bit.
Hmm, what's the purpose of doing the fold in csum_partial() then?
Anyway, having looked at the code again the byte swap at the end means
the passed checksum should be added afterwards, so my proposal is
incorrect. Your suggestion to use 32-bit addition in all cases is
certainly valid.
Maciej
|