On Tue, 23 Jun 2020 23:39:33 +0200 Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote: > Extend xdp_redirect_cpu_{usr,kern}.c adding the possibility to load > a XDP program on cpumap entries. The following options have been added: > - mprog-name: cpumap entry program name > - mprog-filename: cpumap entry program filename > - redirect-device: output interface if the cpumap program performs a > XDP_REDIRECT to an egress interface > - redirect-map: bpf map used to perform XDP_REDIRECT to an egress > interface > - mprog-disable: disable loading XDP program on cpumap entries > > Add xdp_pass, xdp_drop, xdp_redirect stats accounting > > Co-developed-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx> > Signed-off-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx> > Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx> Acked-by: Jesper Dangaard Brouer <brouer@xxxxxxxxxx> Example command and output: sudo ./xdp_redirect_cpu --dev i40e2 --qsize 64 --cpu 2 --prog xdp_cpu_map0 \ --mprog-filename xdp1_kern.o --mprog-name xdp1 Running XDP/eBPF prog_name:xdp_cpu_map0 XDP-cpumap CPU:to pps drop-pps extra-info XDP-RX 4 17,904,077 0 0 XDP-RX total 17,904,077 0 cpumap-enqueue 4:2 17,904,076 418,122 8.00 bulk-average cpumap-enqueue sum:2 17,904,076 418,122 8.00 bulk-average cpumap_kthread 2 17,485,954 0 35,139 sched cpumap_kthread total 17,485,954 0 35,139 sched-sum redirect_err total 0 0 xdp_exception total 0 0 2nd remote XDP/eBPF prog_name: xdp1 XDP-cpumap CPU:to xdp-pass xdp-drop xdp-redir xdp-in-kthread 2 0 17,485,955 0 xdp-in-kthread total 0 17,485,955 0 Another example, where RSS is deliberately setup to only hit CPU-0. $ sudo ./xdp_redirect_cpu --dev i40e2 --qsize 192 --cpu 2 --cpu 3 --cpu 4 \ --prog xdp_cpu_map5_lb_hash_ip_pairs \ --mprog-name xdp_redirect --redirect-device mlx5p1 --redirect-map tx_port Running XDP/eBPF prog_name:xdp_cpu_map5_lb_hash_ip_pairs XDP-cpumap CPU:to pps drop-pps extra-info XDP-RX 0 10,603,984 0 0 XDP-RX total 10,603,984 0 cpumap-enqueue 0:2 3,539,815 0 6.88 bulk-average cpumap-enqueue sum:2 3,539,815 0 6.88 bulk-average cpumap-enqueue 0:3 3,554,091 0 6.88 bulk-average cpumap-enqueue sum:3 3,554,091 0 6.88 bulk-average cpumap-enqueue 0:4 3,510,076 84 6.87 bulk-average cpumap-enqueue sum:4 3,510,076 84 6.87 bulk-average cpumap_kthread 2 3,539,817 0 91,310 sched cpumap_kthread 3 3,554,101 0 93,604 sched cpumap_kthread 4 3,509,991 0 92,893 sched cpumap_kthread total 10,603,910 0 277,809 sched-sum redirect_err total 0 0 xdp_exception total 0 0 2nd remote XDP/eBPF prog_name: xdp_redirect XDP-cpumap CPU:to xdp-pass xdp-drop xdp-redir xdp-in-kthread 2 0 0 3,539,818 xdp-in-kthread 3 0 0 3,554,101 xdp-in-kthread 4 0 0 3,509,991 xdp-in-kthread total 0 0 10,603,910 More performance test examples can be found here: https://github.com/xdp-project/xdp-project/blob/master/areas/cpumap/cpumap04-map-xdp-prog.org -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer