]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit07536f12d86fc52cf9e84b3e7722e44f52cdef1d
tree057defd0704c2fcb6500c062037f2657710b73e2
parent4048a9caff5bb26735ff11b8f18c84ac267430b9
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