From 17765f8de0782de09ebdf79940f934b8ccb83c41 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 26 Jul 2021 07:18:50 +0200 Subject: checksum: Introduce AVX2 implementation, unify helpers Provide an AVX2-based function using compiler intrinsics for TCP/IP-style checksums. The load/unpack/add idea and implementation is largely based on code from BESS (the Berkeley Extensible Software Switch) licensed as 3-Clause BSD, with a number of modifications to further decrease pipeline stalls and to minimise cache pollution. This speeds up considerably data paths from sockets to tap interfaces, decreasing overhead for checksum computation, with 16-64KiB packet buffers, from approximately 11% to 7%. The rest is just syscalls at this point. While at it, provide convenience targets in the Makefile for avx2, avx2_debug, and debug targets -- these simply add target-specific CFLAGS to the build. Signed-off-by: Stefano Brivio --- util.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 7fbce1f..1c11474 100644 --- a/util.h +++ b/util.h @@ -117,10 +117,6 @@ void debug(const char *format, ...); struct ctx; -uint32_t sum_16b(void *buf, size_t len); -uint16_t csum_fold(uint32_t sum); -uint16_t csum_ip4(void *buf, size_t len); -void csum_tcp4(struct iphdr *iph); char *ipv6_l4hdr(struct ipv6hdr *ip6h, uint8_t *proto); int sock_l4(struct ctx *c, int af, uint8_t proto, uint16_t port, int lo, uint32_t data); -- cgit v1.2.3