mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-29 12:14:28 +00:00
No need to pass 'acc' as u16_t since the _base functions are internal (we save one AND op when passing as u32_t)
This commit is contained in:
parent
cc84f28d1b
commit
c2fd905e32
@ -259,11 +259,10 @@ lwip_standard_chksum(void *dataptr, int len)
|
|||||||
|
|
||||||
/** Parts of the pseudo checksum which are common to IPv4 and IPv6 */
|
/** Parts of the pseudo checksum which are common to IPv4 and IPv6 */
|
||||||
static u16_t
|
static u16_t
|
||||||
inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u16_t chksum_base)
|
inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u32_t acc)
|
||||||
{
|
{
|
||||||
struct pbuf *q;
|
struct pbuf *q;
|
||||||
u8_t swapped = 0;
|
u8_t swapped = 0;
|
||||||
u32_t acc = chksum_base;
|
|
||||||
|
|
||||||
/* iterate through all pbuf in chain */
|
/* iterate through all pbuf in chain */
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
@ -325,7 +324,7 @@ inet_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
|||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
|
|
||||||
return inet_cksum_pseudo_base(p, proto, proto_len, (u16_t)acc);
|
return inet_cksum_pseudo_base(p, proto, proto_len, acc);
|
||||||
}
|
}
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
/**
|
/**
|
||||||
@ -359,19 +358,18 @@ ip6_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
|
|||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
|
|
||||||
return inet_cksum_pseudo_base(p, proto, proto_len, (u16_t)acc);
|
return inet_cksum_pseudo_base(p, proto, proto_len, acc);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
/** Parts of the pseudo checksum which are common to IPv4 and IPv6 */
|
/** Parts of the pseudo checksum which are common to IPv4 and IPv6 */
|
||||||
static u16_t
|
static u16_t
|
||||||
inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len,
|
inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len,
|
||||||
u16_t chksum_len, u16_t chksum_base)
|
u16_t chksum_len, u32_t acc)
|
||||||
{
|
{
|
||||||
struct pbuf *q;
|
struct pbuf *q;
|
||||||
u8_t swapped = 0;
|
u8_t swapped = 0;
|
||||||
u16_t chklen;
|
u16_t chklen;
|
||||||
u32_t acc = chksum_base;
|
|
||||||
|
|
||||||
/* iterate through all pbuf in chain */
|
/* iterate through all pbuf in chain */
|
||||||
for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) {
|
for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) {
|
||||||
@ -438,7 +436,7 @@ inet_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
|||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
|
|
||||||
return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, (u16_t)acc);
|
return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
@ -475,7 +473,7 @@ ip6_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
|
|||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
acc = FOLD_U32T(acc);
|
acc = FOLD_U32T(acc);
|
||||||
|
|
||||||
return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, (u16_t)acc);
|
return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user