csum: Update csum_block_add to use rotate instead of byteswap
authorAlexander Duyck <aduyck@mirantis.com>
Wed, 9 Mar 2016 17:25:26 +0000 (09:25 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 13 Mar 2016 19:01:00 +0000 (15:01 -0400)
commit338039635d01524090e7bd706a3e555e20d5b337
tree057defd0704c2fcb6500c062037f2657710b73e2
parentc194cf93c164ed1c71142485ee0f70f9f2d1fe35
csum: Update csum_block_add to use rotate instead of byteswap

The code for csum_block_add was doing a funky byteswap to swap the even and
odd bytes of the checksum if the offset was odd.  Instead of doing this we
can save ourselves some trouble and just shift by 8 as this should have the
same effect in terms of the final checksum value and only requires one
instruction.

In addition we can update csum_block_sub to just use csum_block_add with a
inverse value for csum2.  This way we follow the same code path as
csum_block_add without having to duplicate it.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/checksum.h
This page took 0.024843 seconds and 5 git commands to generate.