summaryrefslogtreecommitdiffstats
path: root/net/net.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2015-02-13 13:11:09 -0500
committerTom Rini <trini@ti.com>2015-02-13 13:11:09 -0500
commit757566d1567a98f5c331c14f088001dbfe187191 (patch)
tree86c9ab53fbefee672f37165f51db398338bf9968 /net/net.c
parentc445506d73a0fba6472d12510b2d41148f078349 (diff)
parentb1f6659c420dae9cd06514fbd8342f39b3f326b9 (diff)
downloadtalos-obmc-uboot-757566d1567a98f5c331c14f088001dbfe187191.tar.gz
talos-obmc-uboot-757566d1567a98f5c331c14f088001dbfe187191.zip
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/net/net.c b/net/net.c
index 2bea07b3cd..b60ce6242c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1086,7 +1086,7 @@ NetReceive(uchar *inpkt, int len)
if ((ip->ip_hl_v & 0x0f) > 0x05)
return;
/* Check the Checksum of the header */
- if (!NetCksumOk((uchar *)ip, IP_HDR_SIZE / 2)) {
+ if (!ip_checksum_ok((uchar *)ip, IP_HDR_SIZE)) {
debug("checksum bad\n");
return;
}
@@ -1291,27 +1291,6 @@ common:
/**********************************************************************/
int
-NetCksumOk(uchar *ptr, int len)
-{
- return !((NetCksum(ptr, len) + 1) & 0xfffe);
-}
-
-
-unsigned
-NetCksum(uchar *ptr, int len)
-{
- ulong xsum;
- ushort *p = (ushort *)ptr;
-
- xsum = 0;
- while (len-- > 0)
- xsum += *p++;
- xsum = (xsum & 0xffff) + (xsum >> 16);
- xsum = (xsum & 0xffff) + (xsum >> 16);
- return xsum & 0xffff;
-}
-
-int
NetEthHdrSize(void)
{
ushort myvlanid;
@@ -1410,7 +1389,7 @@ void net_set_udp_header(uchar *pkt, IPaddr_t dest, int dport, int sport,
net_set_ip_header(pkt, dest, NetOurIP);
ip->ip_len = htons(IP_UDP_HDR_SIZE + len);
ip->ip_p = IPPROTO_UDP;
- ip->ip_sum = ~NetCksum((uchar *)ip, IP_HDR_SIZE >> 1);
+ ip->ip_sum = compute_ip_checksum(ip, IP_HDR_SIZE);
ip->udp_src = htons(sport);
ip->udp_dst = htons(dport);
OpenPOWER on IntegriCloud