nfp: bpf: optimize the adjust_head calls in trivial cases
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 15 Dec 2017 05:29:19 +0000 (21:29 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 Dec 2017 13:18:18 +0000 (14:18 +0100)
commit8231f8444110c346a7d28756abbca11c956d5803
tree6d28e0c7a5cb126f044cf45b9d1b6dff876fc53f
parent0d49eaf4db2ad18489ff1cfceba17006c1d17b7e
nfp: bpf: optimize the adjust_head calls in trivial cases

If the program is simple and has only one adjust head call
with constant parameters, we can check that the call will
always succeed at translation time.  We need to track the
location of the call and make sure parameters are always
the same.  We also have to check the parameters against
datapath constraints and ETH_HLEN.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/bpf/jit.c
drivers/net/ethernet/netronome/nfp/bpf/main.c
drivers/net/ethernet/netronome/nfp/bpf/main.h
drivers/net/ethernet/netronome/nfp/bpf/verifier.c