diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-07-26 07:18:50 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-07-26 07:18:50 +0200 |
commit | 17765f8de0782de09ebdf79940f934b8ccb83c41 (patch) | |
tree | 11cc42c19a2b694b66dde7e377ba78e2107fd62a /dhcp.c | |
parent | 0be49ccd93186600e40b8bffe867d18c4d16366a (diff) | |
download | passt-17765f8de0782de09ebdf79940f934b8ccb83c41.tar passt-17765f8de0782de09ebdf79940f934b8ccb83c41.tar.gz passt-17765f8de0782de09ebdf79940f934b8ccb83c41.tar.bz2 passt-17765f8de0782de09ebdf79940f934b8ccb83c41.tar.lz passt-17765f8de0782de09ebdf79940f934b8ccb83c41.tar.xz passt-17765f8de0782de09ebdf79940f934b8ccb83c41.tar.zst passt-17765f8de0782de09ebdf79940f934b8ccb83c41.zip |
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 <sbrivio@redhat.com>
Diffstat (limited to 'dhcp.c')
-rw-r--r-- | dhcp.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -24,6 +24,7 @@ #include <net/if.h> #include <arpa/inet.h> +#include "checksum.h" #include "util.h" #include "passt.h" #include "dhcp.h" @@ -320,7 +321,7 @@ int dhcp(struct ctx *c, struct ethhdr *eh, size_t len) iph->daddr = c->addr4; iph->saddr = c->gw4; iph->check = 0; - iph->check = csum_ip4(iph, iph->ihl * 4); + iph->check = csum_unaligned(iph, iph->ihl * 4, 0); len += sizeof(*eh); memcpy(eh->h_dest, eh->h_source, ETH_ALEN); |