57 # define LWIP_CHKSUM lwip_standard_chksum 
   58 # ifndef LWIP_CHKSUM_ALGORITHM 
   59 #  define LWIP_CHKSUM_ALGORITHM 2 
   64 #ifndef LWIP_CHKSUM_ALGORITHM 
   65 # define LWIP_CHKSUM_ALGORITHM 0 
   68 #if (LWIP_CHKSUM_ALGORITHM == 1)  
   88   octetptr = (
const u8_t*)dataptr;
 
   92     src = (*octetptr) << 8;
 
  102     src = (*octetptr) << 8;
 
  106   acc = (acc >> 16) + (acc & 0x0000ffffUL);
 
  107   if ((acc & 0xffff0000UL) != 0) {
 
  108     acc = (acc >> 16) + (acc & 0x0000ffffUL);
 
  117 #if (LWIP_CHKSUM_ALGORITHM == 2)  
  135   const u8_t *pb = (
const u8_t *)dataptr;
 
  142   if (odd && len > 0) {
 
  143     ((
u8_t *)&t)[1] = *pb++;
 
  148   ps = (
const u16_t *)(
const void *)pb;
 
  156     ((
u8_t *)&t)[0] = *(
const u8_t *)ps;
 
  176 #if (LWIP_CHKSUM_ALGORITHM == 3)  
  191   const u8_t *pb = (
const u8_t *)dataptr;
 
  199   if (odd && len > 0) {
 
  200     ((
u8_t *)&t)[1] = *pb++;
 
  204   ps = (
const u16_t *)(
const void*)pb;
 
  211   pl = (
const u32_t *)(
const void*)ps;
 
  230   ps = (
const u16_t *)pl;
 
  240     ((
u8_t *)&t)[0] = *(
const u8_t *)ps;
 
  266   for (q = p; q != 
NULL; q = q->
next) {
 
  268       (
void *)q, (
void *)q->next));
 
  274     if (q->len % 2 != 0) {
 
  275       swapped = 1 - swapped;
 
  293   return (
u16_t)~(acc & 0xffffUL);
 
  310 inet_chksum_pseudo(
struct pbuf *p, 
u8_t proto, 
u16_t proto_len,
 
  311        const ip4_addr_t *src, 
const ip4_addr_t *dest)
 
  316   addr = ip4_addr_get_u32(src);
 
  317   acc = (addr & 0xffffUL);
 
  318   acc += ((addr >> 16) & 0xffffUL);
 
  319   addr = ip4_addr_get_u32(dest);
 
  320   acc += (addr & 0xffffUL);
 
  321   acc += ((addr >> 16) & 0xffffUL);
 
  326   return inet_cksum_pseudo_base(p, proto, proto_len, acc);
 
  343 ip6_chksum_pseudo(
struct pbuf *p, 
u8_t proto, 
u16_t proto_len,
 
  344        const ip6_addr_t *src, 
const ip6_addr_t *dest)
 
  350   for (addr_part = 0; addr_part < 4; addr_part++) {
 
  351     addr = src->addr[addr_part];
 
  352     acc += (addr & 0xffffUL);
 
  353     acc += ((addr >> 16) & 0xffffUL);
 
  354     addr = dest->addr[addr_part];
 
  355     acc += (addr & 0xffffUL);
 
  356     acc += ((addr >> 16) & 0xffffUL);
 
  362   return inet_cksum_pseudo_base(p, proto, proto_len, acc);
 
  384     return ip6_chksum_pseudo(p, proto, proto_len, 
ip_2_ip6(src), 
ip_2_ip6(dest));
 
  387 #if LWIP_IPV4 && LWIP_IPV6 
  392     return inet_chksum_pseudo(p, proto, proto_len, ip_2_ip4(src), ip_2_ip4(dest));
 
  399 inet_cksum_pseudo_partial_base(
struct pbuf *p, 
u8_t proto, 
u16_t proto_len,
 
  407   for (q = p; (q != 
NULL) && (chksum_len > 0); q = q->
next) {
 
  409       (
void *)q, (
void *)q->next));
 
  411     if (chklen > chksum_len) {
 
  415     chksum_len -= chklen;
 
  420     if (q->len % 2 != 0) {
 
  421       swapped = 1 - swapped;
 
  439   return (
u16_t)~(acc & 0xffffUL);
 
  456 inet_chksum_pseudo_partial(
struct pbuf *p, 
u8_t proto, 
u16_t proto_len,
 
  457        u16_t chksum_len, 
const ip4_addr_t *src, 
const ip4_addr_t *dest)
 
  462   addr = ip4_addr_get_u32(src);
 
  463   acc = (addr & 0xffffUL);
 
  464   acc += ((addr >> 16) & 0xffffUL);
 
  465   addr = ip4_addr_get_u32(dest);
 
  466   acc += (addr & 0xffffUL);
 
  467   acc += ((addr >> 16) & 0xffffUL);
 
  472   return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
 
  491 ip6_chksum_pseudo_partial(
struct pbuf *p, 
u8_t proto, 
u16_t proto_len,
 
  492        u16_t chksum_len, 
const ip6_addr_t *src, 
const ip6_addr_t *dest)
 
  498   for (addr_part = 0; addr_part < 4; addr_part++) {
 
  499     addr = src->addr[addr_part];
 
  500     acc += (addr & 0xffffUL);
 
  501     acc += ((addr >> 16) & 0xffffUL);
 
  502     addr = dest->addr[addr_part];
 
  503     acc += (addr & 0xffffUL);
 
  504     acc += ((addr >> 16) & 0xffffUL);
 
  510   return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
 
  531     return ip6_chksum_pseudo_partial(p, proto, proto_len, chksum_len, 
ip_2_ip6(src), 
ip_2_ip6(dest));
 
  534 #if LWIP_IPV4 && LWIP_IPV6 
  539     return inet_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip4(src), ip_2_ip4(dest));
 
  576   for (q = p; q != 
NULL; q = q->
next) {
 
  579     if (q->
len % 2 != 0) {
 
  580       swapped = 1 - swapped;
 
  588   return (
u16_t)~(acc & 0xffffUL);
 
  598 #if (LWIP_CHKSUM_COPY_ALGORITHM == 1)  
  604 lwip_chksum_copy(
void *dst, 
const void *src, 
u16_t len)