OSDN Git Service

nfp: bpf: relocate jump targets just before the load
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 10 Jan 2018 12:26:01 +0000 (12:26 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 10 Jan 2018 12:49:35 +0000 (13:49 +0100)
commit2314fe9ed0a1760ceab96b81e6b7181963c93254
tree235da08eb7d649a9b1dc72ff46bc885a6b743a7c
parent488feeaf6d2f9189bdb65f31094a8cff5fcd6c58
nfp: bpf: relocate jump targets just before the load

Don't translate the program assuming it will be loaded at a given
address.  This will be required for sharing programs between ports
of the same NIC, tail calls and subprograms.  It will also make the
jump targets easier to understand when dumping the program to user
space.

Translate the program as if it was going to be loaded at address
zero.  When load happens add the load offset in and set addresses
of special branches.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Jiong Wang <jiong.wang@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/offload.c