linux/samples
Jesper Dangaard Brouer fad3917e36 samples/bpf: add cpumap sample program xdp_redirect_cpu
This sample program show how to use cpumap and the associated
tracepoints.

It provides command line stats, which shows how the XDP-RX process,
cpumap-enqueue and cpumap kthread dequeue is cooperating on a per CPU
basis.  It also utilize the xdp_exception and xdp_redirect_err
transpoints to allow users quickly to identify setup issues.

One issue with ixgbe driver is that the driver reset the link when
loading XDP.  This reset the procfs smp_affinity settings.  Thus,
after loading the program, these must be reconfigured.  The easiest
workaround it to reduce the RX-queue to e.g. two via:

 # ethtool --set-channels ixgbe1 combined 2

And then add CPUs above 0 and 1, like:

 # xdp_redirect_cpu --dev ixgbe1 --prog 2 --cpu 2 --cpu 3 --cpu 4

Another issue with ixgbe is that the page recycle mechanism is tied to
the RX-ring size.  And the default setting of 512 elements is too
small.  This is the same issue with regular devmap XDP_REDIRECT.
To overcome this I've been using 1024 rx-ring size:

 # ethtool -G ixgbe1 rx 1024 tx 1024

V3:
 - whitespace cleanups
 - bpf tracepoint cannot access top part of struct

V4:
 - report on kthread sched events, according to tracepoint change
 - report average bulk enqueue size

V5:
 - bpf_map_lookup_elem on cpumap not allowed from bpf_prog
   use separate map to mark CPUs not available

V6:
 - correct kthread sched summary output

V7:
 - Added a --stress-mode for concurrently changing underlying cpumap

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-10-18 12:12:18 +01:00
..
auxdisplay
blackfin
bpf samples/bpf: add cpumap sample program xdp_redirect_cpu 2017-10-18 12:12:18 +01:00
configfs
connector
hidraw
hw_breakpoint
kdb
kfifo kfifo: clean up example to not use page_link 2017-07-12 16:26:01 -07:00
kobject
kprobes
livepatch
mei
mic/mpssd
pktgen pktgen: Specify the index of first thread 2017-06-16 12:32:34 -04:00
rpmsg
seccomp
sockmap bpf: convert sockmap field attach_bpf_fd2 to type 2017-08-28 11:13:21 -07:00
statx
timers
trace_events
trace_printk
uhid
v4l media: v4l2-pci-skeleton: constify vb2_ops structures 2017-08-20 08:03:09 -04:00
vfio-mdev
watchdog
Kconfig
Makefile