]> asedeno.scripts.mit.edu Git - linux.git/commit
samples/bpf: xdp_redirect_cpu load balance like Suricata
authorJesper Dangaard Brouer <brouer@redhat.com>
Fri, 10 Aug 2018 12:03:02 +0000 (14:03 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Aug 2018 14:07:49 +0000 (16:07 +0200)
commit1bca4e6b1863c0a006fde6a66720a87823109294
tree445df34e43e9a988597c5ff8f1654d235e3aedb4
parent11395686586bc9ca867b3f27501fd6c48244187a
samples/bpf: xdp_redirect_cpu load balance like Suricata

This implement XDP CPU redirection load-balancing across available
CPUs, based on the hashing IP-pairs + L4-protocol.  This equivalent to
xdp-cpu-redirect feature in Suricata, which is inspired by the
Suricata 'ippair' hashing code.

An important property is that the hashing is flow symmetric, meaning
that if the source and destination gets swapped then the selected CPU
will remain the same.  This is helps locality by placing both directions
of a flows on the same CPU, in a forwarding/routing scenario.

The hashing INITVAL (15485863 the 10^6th prime number) was fairly
arbitrary choosen, but experiments with kernel tree pktgen scripts
(pktgen_sample04_many_flows.sh +pktgen_sample05_flow_per_thread.sh)
showed this improved the distribution.

This patch also change the default loaded XDP program to be this
load-balancer.  As based on different user feedback, this seems to be
the expected behavior of the sample xdp_redirect_cpu.

Link: https://github.com/OISF/suricata/commit/796ec08dd7a63
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
samples/bpf/xdp_redirect_cpu_kern.c
samples/bpf/xdp_redirect_cpu_user.c