mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
net: core: Use csum_replace_by_diff() and csum_sub() instead of opencoding
Open coded calculation can be avoided and replaced by the equivalent csum_replace_by_diff() and csum_sub(). Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
adfb62dbda
commit
0f6938eb2e
1 changed files with 2 additions and 2 deletions
|
@ -476,9 +476,9 @@ void inet_proto_csum_replace_by_diff(__sum16 *sum, struct sk_buff *skb,
|
|||
__wsum diff, bool pseudohdr)
|
||||
{
|
||||
if (skb->ip_summed != CHECKSUM_PARTIAL) {
|
||||
*sum = csum_fold(csum_add(diff, ~csum_unfold(*sum)));
|
||||
csum_replace_by_diff(sum, diff);
|
||||
if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
|
||||
skb->csum = ~csum_add(diff, ~skb->csum);
|
||||
skb->csum = ~csum_sub(diff, skb->csum);
|
||||
} else if (pseudohdr) {
|
||||
*sum = ~csum_fold(csum_add(diff, csum_unfold(*sum)));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue