diff options
Diffstat (limited to 'firmware/microblaze/lib/net_common.c')
-rw-r--r-- | firmware/microblaze/lib/net_common.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/firmware/microblaze/lib/net_common.c b/firmware/microblaze/lib/net_common.c index e9b633b13..9804ae4c5 100644 --- a/firmware/microblaze/lib/net_common.c +++ b/firmware/microblaze/lib/net_common.c @@ -162,7 +162,15 @@ send_pkt(eth_mac_addr_t dst, int ethertype, //printf("sent %d bytes\n", total_len); } -unsigned int +unsigned int CHKSUM(unsigned int x, unsigned int *chksum) +{ + *chksum += x; + *chksum = (*chksum & 0xffff) + (*chksum>>16); + *chksum = (*chksum & 0xffff) + (*chksum>>16); + return x; +} + +static unsigned int chksum_buffer(unsigned short *buf, int nshorts, unsigned int initial_chksum) { unsigned int chksum = initial_chksum; @@ -172,7 +180,6 @@ chksum_buffer(unsigned short *buf, int nshorts, unsigned int initial_chksum) return chksum; } - void send_ip_pkt(struct ip_addr dst, int protocol, const void *buf0, size_t len0, |