On Mon, Aug 21, 2023 at 07:36:47PM +0000, Sriram Yagnaraman wrote:
Do you think it would be OK to drop this patch from the series for now? I can come back with the selftest when I have something working correctly?
There's a more direct way of testing it and that's by counting the number of times the relevant FIB trace point was triggered. This script [1] does it for IPv4. For IPv6 the equivalent trace point is called fib6:fib6_table_lookup. The script can obviously be made nicer.
Before the patches:
# ./mp_repo.sh 10020
After the patches:
# ./mp_repo.sh 65535
You can see that after the patches the trace point is triggered for every packet. Sometimes it's a bit less. I assume because some events are lost.
Another approach would be to tweak the current test so that $h1 and $rp1 are configured in a similar fashion to veth0 and veth1.
[1] #!/bin/bash
ip link del dev veth0 &> /dev/null ip netns del ns1 &> /dev/null
ip link add name veth0 type veth peer name veth1 ethtool -K veth0 tcp-segmentation-offload off ethtool -K veth1 generic-receive-offload on echo 20000 > /sys/class/net/veth1/gro_flush_timeout echo 1 > /sys/class/net/veth1/napi_defer_hard_irqs
ip netns add ns1
ip link set dev veth0 up ip address add 192.0.2.1/28 dev veth0
ip link set dev veth1 netns ns1 ip -n ns1 link set dev veth1 up ip -n ns1 address add 192.0.2.2/28 dev veth1
ip -n ns1 link set dev lo up ip netns exec ns1 sysctl -w -q net.ipv4.conf.all.forwarding=1 ip netns exec ns1 sysctl -w -q net.ipv4.fib_multipath_hash_policy=1
ip -n ns1 link add name dummy1 up type dummy ip -n ns1 address add 192.0.2.17/28 dev dummy1 ip -n ns1 neigh add 192.0.2.18 lladdr 00:11:22:33:44:55 nud perm dev dummy1 ip -n ns1 neigh add 192.0.2.19 lladdr 00:aa:bb:cc:dd:ee nud perm dev dummy1 ip -n ns1 route add 198.51.100.0/24 nexthop via 192.0.2.18 nexthop via 192.0.2.19
dmac=$(ip -n ns1 -j link show dev veth1 | jq -r '.[]["address"]') fout=$(mktemp) perf stat -o $fout -j -e fib:fib_table_lookup -- \ mausezahn veth0 -a own -b $dmac -A 192.0.2.1 -B 198.51.100.10 \ -t udp "sp=12345,dp=0-65535" -q tail -n 1 $fout | jq '.["counter-value"] | tonumber | floor'