• Alexander Duyck's avatar
    csum: Update csum_block_add to use rotate instead of byteswap · 33803963
    Alexander Duyck authored
    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: 's avatarAlexander Duyck <aduyck@mirantis.com>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
    33803963
checksum.h 4.63 KB