]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
nfp: bpf: rename nfp_prog->stack_depth as nfp_prog->stack_frame_depth
authorQuentin Monnet <quentin.monnet@netronome.com>
Sun, 7 Oct 2018 11:56:48 +0000 (12:56 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 8 Oct 2018 08:24:12 +0000 (10:24 +0200)
In preparation for support for BPF to BPF calls in offloaded programs,
rename the "stack_depth" field of the struct nfp_prog as
"stack_frame_depth". This is to make it clear that the field refers to
the maximum size of the current stack frame (as opposed to the maximum
size of the whole stack memory).

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-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.h
drivers/net/ethernet/netronome/nfp/bpf/offload.c

index eff57f7d056a44ccb51caed4d1bd617ff7fc3319..98a94ca36bfa0abbc838c67c4b690f10e87ff6c3 100644 (file)
@@ -1137,7 +1137,7 @@ mem_op_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta,
             unsigned int size, unsigned int ptr_off, u8 gpr, u8 ptr_gpr,
             bool clr_gpr, lmem_step step)
 {
-       s32 off = nfp_prog->stack_depth + meta->insn.off + ptr_off;
+       s32 off = nfp_prog->stack_frame_depth + meta->insn.off + ptr_off;
        bool first = true, last;
        bool needs_inc = false;
        swreg stack_off_reg;
@@ -1695,7 +1695,7 @@ map_call_stack_common(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
        s64 lm_off;
 
        /* We only have to reload LM0 if the key is not at start of stack */
-       lm_off = nfp_prog->stack_depth;
+       lm_off = nfp_prog->stack_frame_depth;
        lm_off += meta->arg2.reg.var_off.value + meta->arg2.reg.off;
        load_lm_ptr = meta->arg2.var_off || lm_off;
 
@@ -1808,10 +1808,10 @@ static int mov_reg64(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
                swreg stack_depth_reg;
 
                stack_depth_reg = ur_load_imm_any(nfp_prog,
-                                                 nfp_prog->stack_depth,
+                                                 nfp_prog->stack_frame_depth,
                                                  stack_imm(nfp_prog));
-               emit_alu(nfp_prog, reg_both(dst),
-                        stack_reg(nfp_prog), ALU_OP_ADD, stack_depth_reg);
+               emit_alu(nfp_prog, reg_both(dst), stack_reg(nfp_prog),
+                        ALU_OP_ADD, stack_depth_reg);
                wrp_immed(nfp_prog, reg_both(dst + 1), 0);
        } else {
                wrp_reg_mov(nfp_prog, dst, src);
index 792ebc4081a3763bbd300eff8e69257c731d2ada..7050535383b84025b7938b81d5059bb5f44ba610 100644 (file)
@@ -436,7 +436,7 @@ static inline bool is_mbpf_div(const struct nfp_insn_meta *meta)
  * @tgt_abort: jump target for abort (e.g. access outside of packet buffer)
  * @n_translated: number of successfully translated instructions (for errors)
  * @error: error code if something went wrong
- * @stack_depth: max stack depth from the verifier
+ * @stack_frame_depth: max stack depth for current frame
  * @adjust_head_location: if program has single adjust head call - the insn no.
  * @map_records_cnt: the number of map pointers recorded for this prog
  * @map_records: the map record pointers from bpf->maps_neutral
@@ -460,7 +460,7 @@ struct nfp_prog {
        unsigned int n_translated;
        int error;
 
-       unsigned int stack_depth;
+       unsigned int stack_frame_depth;
        unsigned int adjust_head_location;
 
        unsigned int map_records_cnt;
index 1ccd6371a15b5c3c0a142909d63b4e0796418fd4..c9519bb00f8a39afa65caf504e400b65dc54ae7f 100644 (file)
@@ -260,7 +260,7 @@ static int nfp_bpf_translate(struct nfp_net *nn, struct bpf_prog *prog)
                        prog->aux->stack_depth, stack_size);
                return -EOPNOTSUPP;
        }
-       nfp_prog->stack_depth = round_up(prog->aux->stack_depth, 4);
+       nfp_prog->stack_frame_depth = round_up(prog->aux->stack_depth, 4);
 
        max_instr = nn_readw(nn, NFP_NET_CFG_BPF_MAX_LEN);
        nfp_prog->__prog_alloc_len = max_instr * sizeof(u64);