Forum Discussion
Altera_Forum
Honored Contributor
16 years agoTCP/UDP Checksum Error
Hi all,
I met a weird issue about tcp/udp checksum. The TSE works well under uClinux without any FCS error. It can ping remote deivces, but fails to communicate with others due to the tcp/udp checksum error. I found the issue is caused by the assembler code of checksum. if I rewrite the code in C, everything works well. here is my patch. arch/nios/include/asm/checksum.h
static inline __wsum
__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
unsigned short proto, __wsum sum)
{
#if 0
__asm__ __volatile__(
"add %0, %0, %1\n"
"cmpltu r8, %0, %1\n"
"add %0, %0, r8\n" /* add carry */
"add %0, %0, %2\n"
"cmpltu r8, %0, %2\n"
"add %0, %0, r8\n" /* add carry */
"add %0, %0, %3\n"
"cmpltu r8, %0, %3\n"
"add %0, %0, r8\n" /* add carry */
: "=r" (sum)
: "r" (sum), "r" (saddr), "r" (daddr), "r" ((len + proto) << 8)
: "r8");
#else
sum += saddr;
if (sum < saddr)
sum++;
sum += daddr;
if (sum < daddr)
sum++;
sum += ((len + proto) << 8);
if (sum < ((len + proto) << 8))
sum++;# endif
return sum;
}
The assembler code looks correct and it should work ok. but the result is incorrect. for example: first line of assembler code should do adding 'saddr' value into 'sum'. but the actual result is adding 'saddr' memory address into 'sum'. does it mean the toolchain has bug?. uClinux: v2.6.34 toolchain: nios2-linux-gnu-gcc version 4.1.2 all are update-to-date by git from sopc.et.ntust.edu.tw.4 Replies
- Altera_Forum
Honored Contributor
Fixed. Please pull update. Thanks.
- Hippo - Altera_Forum
Honored Contributor
it works. thanks for fix. :)
- Altera_Forum
Honored Contributor
Hi,
I have the same issue as the guy who started this thread.. I updated my linux-2.6 branch with v2.6.35 using a git pull.. When I do menuconfig, the "ehternet (10 or 100Mbit)" sub menus for the altera TSE SLS and experimental has vanish... I ignored this and chose to build the Uclinux instead... When I flash program the image to my board and do an ifconfig, the one that only shows now is the loopback.. I wonder what happened to my other ethernet connection.. before the pull, I am able to ping to and out the board. .. Please advise.. I would really like to make this TCP working.. --- Quote Start --- Fixed. Please pull update. Thanks. - Hippo --- Quote End --- - Altera_Forum
Honored Contributor
Please update to a more recent Linux Version (e.g. tag v3.2-nios), the problem is fixed there.