xdp: factor out common program/flags handling from drivers
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 12 Jul 2018 03:36:40 +0000 (20:36 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 13 Jul 2018 18:26:35 +0000 (20:26 +0200)
commit05296620f6d14dce0030b87e1e57891a770fb65c
treef66b194fc4fd081abce58cd6dd97c2bd95ffa842
parent6b8675897338f874c41612655a85d8e10cdb23d8
xdp: factor out common program/flags handling from drivers

Basic operations drivers perform during xdp setup and query can
be moved to helpers in the core.  Encapsulate program and flags
into a structure and add helpers.  Note that the structure is
intended as the "main" program information source in the driver.
Most drivers will additionally place the program pointer in their
fast path or ring structures.

The helpers don't have a huge impact now, but they will
decrease the code duplication when programs can be installed
in HW and driver at the same time.  Encapsulating the basic
operations in helpers will hopefully also reduce the number
of changes to drivers which adopt them.

Helpers could really be static inline, but they depend on
definition of struct netdev_bpf which means they'd have
to be placed in netdevice.h, an already 4500 line header.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/nfp_net.h
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/netdevsim/bpf.c
drivers/net/netdevsim/netdevsim.h
include/net/xdp.h
net/core/xdp.c
tools/testing/selftests/bpf/test_offload.py