> Dear "Greg Ren", > > In message <cb2dd11991b27c4f99935e6229450d3204e5c...@stork.scenix.com> you > wrote: > > > > I am new to u-boot and got assignment to debug some networking issue. I > > traced the checksum failure and was able to fix it with the patch below. > > It would be important to know on which system(s) you have actually > tested your patch - and on which you experienced any issues in the > first place. Please mention CPU, board, and network driver used. > > > The patch is a git commit log from my local git reposite. > > > > Thanks for your time and advice. > > > > % git show cffd5fb03e0c3f116cce9f3ff825c5445a1eca3f > > Please use git-format-patch / git-send-email to submit patches, see > http://www.denx.de/wiki/U-Boot/Patches for details. > > > > @@ -1420,12 +1420,12 @@ NetReceive(volatile uchar * inpkt, int len) > > ip->ip_off = 0; > > NetCopyIP((void*)&ip->ip_dst, > > &ip->ip_src); > > NetCopyIP((void*)&ip->ip_src, > > &NetOurIP); > > - ip->ip_sum = ~NetCksum((uchar *)ip, > > IP_HDR_SIZE_NO_UDP >> 1); > > + ip->ip_sum = ~NetCksum((uchar *)ip, > > IP_HDR_SIZE_NO_UDP); > > Your mailer has line-wrapped the patch which makes it useless. > > > + if (len == 1) { > > + xsum += (*p & 0xff00); > > I doubt that this code is endianess-clean.
Nope, I would think some thing like this would work better: count = len >> 1; /* div by 2 */ for(p--; count; --count) xsum += *++p; if (len & 1) /* Odd */ xsum += *(u_char *)(++p); /* one byte only */ _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot