From: Tom Evans <tom@ceos.com.au>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [ARM] Change the UDP Checksum code to work with ARM data alignment.
Date: Tue, 26 Aug 2008 14:01:36 +1000 [thread overview]
Message-ID: <48B38020.4010204@ceos.com.au> (raw)
In-Reply-To: <mailman.241.1219120922.2783.u-boot@lists.denx.de>
> From: Ben Warren <biggerbadderben@gmail.com>
> Subject: Re: [U-Boot] ARM: net.c: UDP Checksum code
> failing every packet
> To: Tom Evans <tom@ceos.com.au>
> Cc: U-Boot <u-boot@lists.denx.de>
> Message-ID: <48AA4BAE.2060204@gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Tom Evans wrote:
> > > Ben Warren wrote:
> > ...
> > Besides which, I've never made a patch before, and
> > couldn't find any instructions on how to do so.
> >
> There is good documentation out there, just not where
> you looked.
I followed Ben's instructions and here's the resulting patch.
I don't have any hardware that is supported in the current distribution,
so I can't perform a full compile-run-test pass on this patch. I've run
the changes on our modified u-boot setup and it works. I've also changed
the distribution Makefile for our cross compiler, added "#define
CONFIG_UDP_CHECKSUM 1" to cradle.h, done "make cradle_config ; make"
without any errors.
Signed-off-by: Tom Evans <tom.evans@ceos.com.au>
---
net/net.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/net.c b/net/net.c
index 313d5d8..c8cda77 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1494,10 +1494,12 @@ NetReceive(volatile uchar * inpkt, int len)
xsum = ip->ip_p;
xsum += (ntohs(ip->udp_len));
- xsum += (ntohl(ip->ip_src) >> 16) & 0x0000ffff;
- xsum += (ntohl(ip->ip_src) >> 0) & 0x0000ffff;
- xsum += (ntohl(ip->ip_dst) >> 16) & 0x0000ffff;
- xsum += (ntohl(ip->ip_dst) >> 0) & 0x0000ffff;
+ tmp = NetReadIP(&ip->ip_src);
+ xsum += (ntohl(tmp) >> 16) & 0x0000ffff;
+ xsum += (ntohl(tmp) >> 0) & 0x0000ffff;
+ tmp = NetReadIP(&ip->ip_dst);
+ xsum += (ntohl(tmp) >> 16) & 0x0000ffff;
+ xsum += (ntohl(tmp) >> 0) & 0x0000ffff;
sumlen = ntohs(ip->udp_len);
sumptr = (ushort *) &(ip->udp_src);
@@ -1520,7 +1522,7 @@ NetReceive(volatile uchar * inpkt, int len)
xsum = (xsum & 0x0000ffff) + ((xsum >>
16) & 0x0000ffff);
}
if ((xsum != 0x00000000) && (xsum != 0x0000ffff)) {
- printf(" UDP wrong checksum %08lx %08x\n",
+ printf("\nUDP wrong checksum %08lx %08x\n",
xsum, ntohs(ip->udp_xsum));
return;
}
--
1.5.5.1
--
===
Tom Evans Tom.Evans at ceos.com.au
CEOS Pty Ltd www.ceos.com.au
3/17 Burgundy St, Heidelberg,
Victoria 3084, Australia
Phone (+61 3) 9458 4955
Direct Unsupported
FAX (+61 3) 9458 4966
Mobile 0405 776 431
next parent reply other threads:[~2008-08-26 4:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.241.1219120922.2783.u-boot@lists.denx.de>
2008-08-26 4:01 ` Tom Evans [this message]
2008-08-26 22:17 ` [U-Boot] [PATCH] [ARM] Change the UDP Checksum code to work with ARM data alignment Wolfgang Denk
[not found] <mailman.383.1219789049.2783.u-boot@lists.denx.de>
2008-08-27 5:23 ` Tom Evans
2008-08-27 5:28 ` Ben Warren
2008-08-27 8:39 ` Wolfgang Denk
2008-08-27 8:58 ` Stefan Roese
2008-08-27 9:34 ` Wolfgang Denk
2008-08-27 9:49 ` Stefan Roese
2008-08-27 11:07 ` Wolfgang Denk
2008-08-27 12:27 ` JerryVanBaren
2008-08-27 14:06 ` Ben Warren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48B38020.4010204@ceos.com.au \
--to=tom@ceos.com.au \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox