aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_packet.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2018-06-14 18:05:30 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-06-19 18:47:11 +0000
commitc6215d902f02d08a59567f3f788caa0e03508c0d (patch)
tree5c5fa6fe1616446385ed4292c6912ef76f82b3da /src/vnet/ip/ip_packet.h
parent3337bd22002e9b78459082c34f7b78370b177eb0 (diff)
ip checksum multiarch support, cleanup
When computing tcp/udp checksums across large amounts of data - e.g. when NIC h/w checksum offload is not available - it's worth providing arch-dependent code; if only to compile the code w/ -O3. Fix calculation when data is fully unaligned / on an odd byte boundary. Add a buffer alignment test vector. Change-Id: I7644e2276ac6cbc3f575bf61746a6ffedbbb6150 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/ip/ip_packet.h')
-rw-r--r--src/vnet/ip/ip_packet.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vnet/ip/ip_packet.h b/src/vnet/ip/ip_packet.h
index d3f3de771bc..3c532f10ffe 100644
--- a/src/vnet/ip/ip_packet.h
+++ b/src/vnet/ip/ip_packet.h
@@ -156,9 +156,13 @@ ip_csum_fold (ip_csum_t c)
return c;
}
-/* Copy data and checksum at the same time. */
-ip_csum_t ip_csum_and_memcpy (ip_csum_t sum, void *dst, void *src,
- uword n_bytes);
+extern ip_csum_t (*vnet_incremental_checksum_fp) (ip_csum_t, void *, uword);
+
+always_inline ip_csum_t
+ip_incremental_checksum (ip_csum_t sum, void *_data, uword n_bytes)
+{
+ return (*vnet_incremental_checksum_fp) (sum, _data, n_bytes);
+}
always_inline u16
ip_csum_and_memcpy_fold (ip_csum_t sum, void *dst)