From ce8b74b524da51104e48826caebd9cc386bde97b Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 11 Jan 2018 16:52:21 +0100 Subject: [PATCH] doc: document XDP CPU redirect --- doc/userguide/capture-hardware/ebpf-xdp.rst | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/userguide/capture-hardware/ebpf-xdp.rst b/doc/userguide/capture-hardware/ebpf-xdp.rst index e5ad750062..0c1118e7c4 100644 --- a/doc/userguide/capture-hardware/ebpf-xdp.rst +++ b/doc/userguide/capture-hardware/ebpf-xdp.rst @@ -289,6 +289,32 @@ Try to use the network's card balancing as much as possible :: /sbin/ethtool -N eth3 rx-flow-hash $proto sdfn done +The XDP CPU redirect case +~~~~~~~~~~~~~~~~~~~~~~~~~ + +If ever your hardware is not able to do a symetric load balancing but support XDP in driver mode, you +can then use the CPU redirect map support available in the xdp_filter.bpf file. In this mode, the load +balancinf will be done by the XDP filter and each CPU will handle the whole packet treatment including +the creation of the skb structure in kernel. + +To do so set the `xdp-cpu-redirect` variable in af-packet interface configuration to a set of CPUs. +Then use the `cluster_cpu` as load balancing function. You will also need to set the affinity +accordingly. + +It is possible to use `xdp_monitor` to have information about the behavior of CPU redirect. This +program is available in Linux tree under the `samples/bpf` directory and will be build by the +make command. Sample output is the following :: + + sudo ./xdp_monitor --stats + XDP-event CPU:to pps drop-pps extra-info + XDP_REDIRECT 11 2,880,212 0 Success + XDP_REDIRECT total 2,880,212 0 Success + XDP_REDIRECT total 0 0 Error + cpumap-enqueue 11:0 575,954 0 5.27 bulk-average + cpumap-enqueue sum:0 575,954 0 5.27 bulk-average + cpumap-kthread 0 575,990 0 56,409 sched + cpumap-kthread 1 576,090 0 54,897 sched + Start Suricata with XDP ~~~~~~~~~~~~~~~~~~~~~~~