netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/8] Simplify xdp_do_redirect_map()/xdp_do_flush_map() and XDP maps
@ 2019-12-18 10:53 Björn Töpel
  2019-12-18 10:53 ` [PATCH bpf-next 1/8] xdp: simplify devmap cleanup Björn Töpel
                   ` (8 more replies)
  0 siblings, 9 replies; 32+ messages in thread
From: Björn Töpel @ 2019-12-18 10:53 UTC (permalink / raw)
  To: netdev, ast, daniel
  Cc: Björn Töpel, bpf, davem, jakub.kicinski, hawk,
	john.fastabend, magnus.karlsson, jonathan.lemon

This series aims to simplify the XDP maps and
xdp_do_redirect_map()/xdp_do_flush_map(), and to crank out some more
performance from XDP_REDIRECT scenarios.

The first part of the series simplifies all XDP_REDIRECT capable maps,
so that __XXX_flush_map() does not require the map parameter, by
moving the flush list from the map to global scope.

This results in that the map_to_flush member can be removed from
struct bpf_redirect_info, and its corresponding logic.

Simpler code, and more performance due to that checks/code per-packet
is moved to flush.

Pre-series performance:
  $ sudo taskset -c 22 ./xdpsock -i enp134s0f0 -q 20 -n 1 -r -z
  
   sock0@enp134s0f0:20 rxdrop xdp-drv 
                  pps         pkts        1.00       
  rx              20,797,350  230,942,399
  tx              0           0          
  
  $ sudo ./xdp_redirect_cpu --dev enp134s0f0 --cpu 22 xdp_cpu_map0
  
  Running XDP/eBPF prog_name:xdp_cpu_map5_lb_hash_ip_pairs
  XDP-cpumap      CPU:to  pps            drop-pps    extra-info
  XDP-RX          20      7723038        0           0
  XDP-RX          total   7723038        0
  cpumap_kthread  total   0              0           0
  redirect_err    total   0              0
  xdp_exception   total   0              0

Post-series performance:
  $ sudo taskset -c 22 ./xdpsock -i enp134s0f0 -q 20 -n 1 -r -z

   sock0@enp134s0f0:20 rxdrop xdp-drv 
                  pps         pkts        1.00       
  rx              21,524,979  86,835,327 
  tx              0           0          
  
  $ sudo ./xdp_redirect_cpu --dev enp134s0f0 --cpu 22 xdp_cpu_map0

  Running XDP/eBPF prog_name:xdp_cpu_map5_lb_hash_ip_pairs
  XDP-cpumap      CPU:to  pps            drop-pps    extra-info
  XDP-RX          20      7840124        0           0          
  XDP-RX          total   7840124        0          
  cpumap_kthread  total   0              0           0          
  redirect_err    total   0              0          
  xdp_exception   total   0              0          
  
Results: +3.5% and +1.5% for the ubenchmarks.

Björn Töpel (8):
  xdp: simplify devmap cleanup
  xdp: simplify cpumap cleanup
  xdp: fix graze->grace type-o in cpumap comments
  xsk: make xskmap flush_list common for all map instances
  xdp: make devmap flush_list common for all map instances
  xdp: make cpumap flush_list common for all map instances
  xdp: remove map_to_flush and map swap detection
  xdp: simplify __bpf_tx_xdp_map()

 include/linux/bpf.h    |  8 ++---
 include/linux/filter.h |  1 -
 include/net/xdp_sock.h | 11 +++---
 kernel/bpf/cpumap.c    | 76 ++++++++++++++--------------------------
 kernel/bpf/devmap.c    | 78 ++++++++++--------------------------------
 kernel/bpf/xskmap.c    | 16 ++-------
 net/core/filter.c      | 63 ++++++----------------------------
 net/xdp/xsk.c          | 17 ++++-----
 8 files changed, 74 insertions(+), 196 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2019-12-19 22:56 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 10:53 [PATCH bpf-next 0/8] Simplify xdp_do_redirect_map()/xdp_do_flush_map() and XDP maps Björn Töpel
2019-12-18 10:53 ` [PATCH bpf-next 1/8] xdp: simplify devmap cleanup Björn Töpel
2019-12-18 11:14   ` Toke Høiland-Jørgensen
2019-12-18 10:53 ` [PATCH bpf-next 2/8] xdp: simplify cpumap cleanup Björn Töpel
2019-12-18 11:15   ` Toke Høiland-Jørgensen
2019-12-18 17:47   ` Jakub Kicinski
2019-12-18 17:48     ` Björn Töpel
2019-12-18 10:53 ` [PATCH bpf-next 3/8] xdp: fix graze->grace type-o in cpumap comments Björn Töpel
2019-12-18 11:18   ` Toke Høiland-Jørgensen
2019-12-18 10:53 ` [PATCH bpf-next 4/8] xsk: make xskmap flush_list common for all map instances Björn Töpel
2019-12-18 11:19   ` Toke Høiland-Jørgensen
2019-12-18 10:53 ` [PATCH bpf-next 5/8] xdp: make devmap " Björn Töpel
2019-12-18 11:19   ` Toke Høiland-Jørgensen
2019-12-18 10:53 ` [PATCH bpf-next 6/8] xdp: make cpumap " Björn Töpel
2019-12-18 11:19   ` Toke Høiland-Jørgensen
2019-12-18 10:53 ` [PATCH bpf-next 7/8] xdp: remove map_to_flush and map swap detection Björn Töpel
2019-12-18 11:20   ` Toke Høiland-Jørgensen
2019-12-18 13:03   ` Jesper Dangaard Brouer
2019-12-18 13:09     ` Björn Töpel
2019-12-18 10:54 ` [PATCH bpf-next 8/8] xdp: simplify __bpf_tx_xdp_map() Björn Töpel
2019-12-18 11:20   ` Toke Høiland-Jørgensen
2019-12-18 11:11 ` [PATCH bpf-next 0/8] Simplify xdp_do_redirect_map()/xdp_do_flush_map() and XDP maps Jesper Dangaard Brouer
2019-12-18 11:39   ` Björn Töpel
2019-12-18 12:03     ` Jesper Dangaard Brouer
2019-12-18 12:18       ` Björn Töpel
2019-12-18 12:32         ` Björn Töpel
2019-12-18 12:40         ` Jesper Dangaard Brouer
2019-12-18 12:48           ` Björn Töpel
2019-12-19  0:39       ` Andrii Nakryiko
2019-12-19 19:33         ` Jesper Dangaard Brouer
2019-12-19 20:08           ` Daniel Borkmann
2019-12-19 22:56             ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).