Drop excess siphash round (see comment for more details)
[flowspec-xdp] / install.sh
index b791d8ee5c0b98c692e14e9102cecd149b3b8a04..197155c722d7b7bf24aaea92a62c8036da4ed7a3 100755 (executable)
@@ -17,18 +17,19 @@ $(birdc show route table flowspec6 primary all)"
 
 echo "const uint8_t COMPILE_TIME_RAND[] = { $(dd if=/dev/urandom of=/dev/stdout bs=1 count=8 2>/dev/null | hexdump -e '4/1 "0x%02x, "') };" > rand.h
 
+[ "$CLANG" != "" ] || CLANG="clang"
+[ "$LLC" != "" ] || LLC="llc"
+[ "$LLVM_LINK" != "" ] || LLVM_LINK="llvm-link"
+
 STATS_RULES="$(echo "$RULES" | ./genrules.py --8021q=drop-vlan --v6frag=ignore-parse-if-rule --ihl=parse-options)"
-clang $CLANG_ARGS -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -Wno-unused-function -O3 -emit-llvm -c xdp.c -o xdp.bc
+$CLANG $CLANG_ARGS -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Wno-unused-variable -Wno-unused-function -Oz -emit-llvm -c xdp.c -o xdp.bc
 if [ "$2" != "" ]; then
-       clang $4 -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -O3 -emit-llvm -c "$2" -o wrapper.bc
-       llvm-link xdp.bc wrapper.bc | llc -O3 -march=bpf -filetype=obj -o xdp
+       $CLANG $4 -g -std=c99 -pedantic -Wall -Wextra -Wno-pointer-arith -Oz -emit-llvm -c "$2" -o wrapper.bc
+       $LLVM_LINK xdp.bc wrapper.bc | $LLC -O3 -march=bpf -mcpu=probe -filetype=obj -o xdp
 else
-       cat xdp.bc | llc -O3 -march=bpf -filetype=obj -o xdp
+       cat xdp.bc | $LLC -O3 -march=bpf -mcpu=probe -filetype=obj -o xdp
 fi
 
-echo "Before unload drop count was:"
-./dropcount.sh || echo "Not loaded"
-
 # Note that sometimes the automated fallback does not work properly so we have to || generic here
 ip -force link set "$1" xdpoffload obj xdp sec $XDP_SECTION || (
        echo "Failed to install in NIC, testing in driver..." && ip -force link set "$1" xdpdrv obj xdp sec $XDP_SECTION || (