Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP
From: Jiri Pirko <jiri@resnulli.us>
Date: 2017-02-09 07:58:39
Thu, Feb 09, 2017 at 12:41:20AM CET, tom@herbertland.com wrote:
This patch creates an infrastructure for registering and running code at XDP hooks in drivers. This extends and generalizes the original XDP/BPF interface. Specifically, it defines a generic xdp_hook structure and a set of hooks that can be assigned to devices or napi instances. These hooks are also generic to allow for XDP/BPF programs as well as non-BPF code (e.g. kernel code can be written in a module). An XDP hook is defined by the xdp_hook structure. A pointer to this structure is passed into the XDP register function to set up a hook. The XDP register function mallocs its own xdp_hook structure and copies the values from the xdp_hook passed in. The register function also saves the pointer value of the xdp_hook argument; this pointer is used in subsequently calls to XDP to identify the registered hook. The interface is defined in net/xdp.h. This includes the definition of xdp_hook, functions to register and unregister hooks on a device or individual instances of napi, and xdp_hook_run that is called by drivers to run the hooks. Signed-off-by: Tom Herbert <redacted> --- drivers/net/ethernet/netronome/nfp/nfp_bpf_jit.c | 1 + include/linux/filter.h | 10 +- include/linux/netdev_features.h | 3 +- include/linux/netdevice.h | 16 ++ include/net/xdp.h | 310 +++++++++++++++++++++++ include/trace/events/xdp.h | 31 +++ kernel/bpf/core.c | 1 + net/core/Makefile | 2 +- net/core/dev.c | 53 ++-- net/core/filter.c | 1 + net/core/rtnetlink.c | 14 +- net/core/xdp.c | 304 ++++++++++++++++++++++ 12 files changed, 711 insertions(+), 35 deletions(-) create mode 100644 include/net/xdp.h create mode 100644 net/core/xdp.c
[...]
quoted hunk ↗ jump to hunk
@@ -48,6 +49,36 @@ TRACE_EVENT(xdp_exception,__print_symbolic(__entry->act, __XDP_ACT_SYM_TAB)) ); +/* Temporaray trace function. This will be renamed to xdp_exception after all
typo
+ * the calling drivers have been patched. + */