OSDN Git Service

nfp: bpf: round up the size of the stack
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 10 Jan 2018 12:25:56 +0000 (12:25 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 10 Jan 2018 12:49:35 +0000 (13:49 +0100)
Kernel enforces the alignment of the bottom of the stack, NFP
deals with positive offsets better so we should align the top
of the stack.  Round the stack size to NFP word size (4B).

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

index fa2905e..8dbf134 100644 (file)
@@ -147,7 +147,7 @@ int nfp_bpf_translate(struct nfp_app *app, struct nfp_net *nn,
                return -EOPNOTSUPP;
        }
 
-       nfp_prog->stack_depth = prog->aux->stack_depth;
+       nfp_prog->stack_depth = round_up(prog->aux->stack_depth, 4);
        nfp_prog->start_off = nn_readw(nn, NFP_NET_CFG_BPF_START);
        nfp_prog->tgt_done = nn_readw(nn, NFP_NET_CFG_BPF_DONE);