]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: add XDP prog type for early driver filter
authorBrenden Blanco <bblanco@plumgrid.com>
Tue, 19 Jul 2016 19:16:47 +0000 (12:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Jul 2016 04:46:31 +0000 (21:46 -0700)
commit4f8e5b4a0b0983eedec99310109d92660848bce6
tree58af6ac091ff817048eb9324db326261da78dd53
parent6bea72da9d1d453e02ee7aa5f472ac3fdb7471bd
bpf: add XDP prog type for early driver filter

Add a new bpf prog type that is intended to run in early stages of the
packet rx path. Only minimal packet metadata will be available, hence a
new context type, struct xdp_md, is exposed to userspace. So far only
expose the packet start and end pointers, and only in read mode.

An XDP program must return one of the well known enum values, all other
return codes are reserved for future use. Unfortunately, this
restriction is hard to enforce at verification time, so take the
approach of warning at runtime when such programs are encountered. Out
of bounds return codes should alias to XDP_ABORTED.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/filter.h
include/uapi/linux/bpf.h
kernel/bpf/verifier.c
net/core/filter.c