ip_checksum.c: Fixes for ip_csum_and_memcpy() alignment issues 44/144/2
authorKevin Paul Herbert <kph@cisco.com>
Wed, 9 Dec 2015 03:53:45 +0000 (19:53 -0800)
committerGerrit Code Review <gerrit@fd.io>
Wed, 27 Jan 2016 18:58:26 +0000 (18:58 +0000)
commitcf121e3d5135c1c06ccca35372126baf5559e144
tree1f389dae64a22a920e81852901c945cbc2a887f3
parentc42508d1581fc1ad4afe2e234fb1f1f005613eb5
ip_checksum.c: Fixes for ip_csum_and_memcpy() alignment issues

Add explicit support for incremental operations which may be on
byte boundaries and misaligned. Since this is a memcpy() like function,
it needs to be robust in all byte operations.

Add code to perform the checksum 16 bits at a time when the destination
buffer pointer is not naturally aligned. The previous code did support
misaligned source data (via clib_mem_unaligned()), but didn't properly
align the destination pointer.

It would be possible to further optimize this by adding an optimzed
move operation where the source is aligned on natural boundaries.
Look at this as we optimize this function. At this point, I am
concentrating on correctness.

Change-Id: I2b0fd4795ec5c0ca294a733159c7355b54177690
Signed-off-by: Kevin Paul Herbert <kph@cisco.com>
vnet/vnet/ip/ip_checksum.c
vnet/vnet/ip/ip_packet.h