]> git.karo-electronics.de Git - linux-beck.git/commit
bpf: xdp: Allow head adjustment in XDP prog
authorMartin KaFai Lau <kafai@fb.com>
Wed, 7 Dec 2016 23:53:11 +0000 (15:53 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Dec 2016 19:25:13 +0000 (14:25 -0500)
commit17bedab2723145d17b14084430743549e6943d03
tree6a1517e36c1be543f591b5ff7fcd7e816dcc906a
parent8a03cf2cb7efe269913db079afb8c31f20bf0bef
bpf: xdp: Allow head adjustment in XDP prog

This patch allows XDP prog to extend/remove the packet
data at the head (like adding or removing header).  It is
done by adding a new XDP helper bpf_xdp_adjust_head().

It also renames bpf_helper_changes_skb_data() to
bpf_helper_changes_pkt_data() to better reflect
that XDP prog does not work on skb.

This patch adds one "xdp_adjust_head" bit to bpf_prog for the
XDP-capable driver to check if the XDP prog requires
bpf_xdp_adjust_head() support.  The driver can then decide
to error out during XDP_SETUP_PROG.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 files changed:
arch/powerpc/net/bpf_jit_comp64.c
arch/s390/net/bpf_jit_comp.c
arch/x86/net/bpf_jit_comp.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/qlogic/qede/qede_main.c
include/linux/filter.h
include/uapi/linux/bpf.h
kernel/bpf/core.c
kernel/bpf/syscall.c
kernel/bpf/verifier.c
net/core/filter.c