59 # define LWIP_CHKSUM lwip_standard_chksum
60 # ifndef LWIP_CHKSUM_ALGORITHM
61 # define LWIP_CHKSUM_ALGORITHM 2
65 #ifndef LWIP_CHKSUM_ALGORITHM
66 # define LWIP_CHKSUM_ALGORITHM 0
69 #if (LWIP_CHKSUM_ALGORITHM == 1)
81 lwip_standard_chksum(
void *dataptr,
u16_t len)
89 octetptr = (
u8_t*)dataptr;
93 src = (*octetptr) << 8;
103 src = (*octetptr) << 8;
107 acc = (acc >> 16) + (acc & 0x0000ffffUL);
108 if ((acc & 0xffff0000UL) != 0) {
109 acc = (acc >> 16) + (acc & 0x0000ffffUL);
118 #if (LWIP_CHKSUM_ALGORITHM == 2)
135 lwip_standard_chksum(
void *dataptr,
int len)
143 if (odd && len > 0) {
144 ((
u8_t *)&t)[1] = *pb++;
149 ps = (
u16_t *)(
void *)pb;
177 #if (LWIP_CHKSUM_ALGORITHM == 3)
191 lwip_standard_chksum(
void *dataptr,
int len)
200 if (odd && len > 0) {
201 ((
u8_t *)&t)[1] = *pb++;
284 for(q = p; q !=
NULL; q = q->
next) {
286 (
void *)q, (
void *)q->
next));
292 if (q->
len % 2 != 0) {
293 swapped = 1 - swapped;
303 acc += (addr & 0xffffUL);
304 acc += ((addr >> 16) & 0xffffUL);
306 acc += (addr & 0xffffUL);
307 acc += ((addr >> 16) & 0xffffUL);
316 return (
u16_t)~(acc & 0xffffUL);
345 for(q = p; (q !=
NULL) && (chksum_len > 0); q = q->
next) {
347 (
void *)q, (
void *)q->
next));
349 if (chklen > chksum_len) {
353 chksum_len -= chklen;
358 if (q->
len % 2 != 0) {
359 swapped = 1 - swapped;
369 acc += (addr & 0xffffUL);
370 acc += ((addr >> 16) & 0xffffUL);
372 acc += (addr & 0xffffUL);
373 acc += ((addr >> 16) & 0xffffUL);
382 return (
u16_t)~(acc & 0xffffUL);
417 for(q = p; q !=
NULL; q = q->
next) {
420 if (q->
len % 2 != 0) {
421 swapped = 1 - swapped;
429 return (
u16_t)~(acc & 0xffffUL);
439 #if (LWIP_CHKSUM_COPY_ALGORITHM == 1)
445 lwip_chksum_copy(
void *dst,
const void *src,
u16_t len)