mirror of
https://passt.top/passt
synced 2025-05-29 20:35:40 +02:00
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>
This commit is contained in:
parent
0be49ccd93
commit
17765f8de0
8 changed files with 332 additions and 92 deletions
19
Makefile
19
Makefile
|
@ -3,8 +3,23 @@ CFLAGS += -DRLIMIT_STACK_VAL=$(shell ulimit -s)
|
|||
|
||||
all: passt pasta passt4netns qrap
|
||||
|
||||
passt: passt.c passt.h arp.c arp.h dhcp.c dhcp.h dhcpv6.c dhcpv6.h pcap.c pcap.h ndp.c ndp.h siphash.c siphash.h tap.c tap.h icmp.c icmp.h tcp.c tcp.h udp.c udp.h util.c util.h
|
||||
$(CC) $(CFLAGS) passt.c arp.c dhcp.c dhcpv6.c pcap.c ndp.c siphash.c tap.c icmp.c tcp.c udp.c util.c -o passt
|
||||
avx2: CFLAGS += -Ofast -mavx2 -ftree-vectorize -funroll-loops
|
||||
avx2: clean all
|
||||
|
||||
avx2_debug: CFLAGS += -Ofast -mavx2 -ftree-vectorize -funroll-loops -DDEBUG -g
|
||||
avx2_debug: clean all
|
||||
|
||||
static: CFLAGS += -static
|
||||
static: clean all
|
||||
|
||||
debug: CFLAGS += -static -DDEBUG -g
|
||||
debug: clean all
|
||||
|
||||
passt: passt.c passt.h arp.c arp.h checksum.c checksum.h dhcp.c dhcp.h \
|
||||
dhcpv6.c dhcpv6.h pcap.c pcap.h ndp.c ndp.h siphash.c siphash.h \
|
||||
tap.c tap.h icmp.c icmp.h tcp.c tcp.h udp.c udp.h util.c util.h
|
||||
$(CC) $(CFLAGS) passt.c arp.c checksum.c dhcp.c dhcpv6.c pcap.c ndp.c \
|
||||
siphash.c tap.c icmp.c tcp.c udp.c util.c -o passt
|
||||
|
||||
pasta: passt
|
||||
ln -s passt pasta
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue