Commit fc448497 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Alexei Starovoitov

nfp: bpf: rename map_lookup_stack() to map_call_stack_common()

We will reuse most of map call code gen for other map calls.
Rename the lookup gen function and use meta->func_id instead
of hard-coding lookup.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJiong Wang <jiong.wang@netronome.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 87b10ecd
...@@ -1352,7 +1352,7 @@ static int adjust_head(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) ...@@ -1352,7 +1352,7 @@ static int adjust_head(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
} }
static int static int
map_lookup_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) map_call_stack_common(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
{ {
struct bpf_offloaded_map *offmap; struct bpf_offloaded_map *offmap;
struct nfp_bpf_map *nfp_map; struct nfp_bpf_map *nfp_map;
...@@ -1378,7 +1378,7 @@ map_lookup_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) ...@@ -1378,7 +1378,7 @@ map_lookup_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
*/ */
tid = ur_load_imm_any(nfp_prog, nfp_map->tid, imm_a(nfp_prog)); tid = ur_load_imm_any(nfp_prog, nfp_map->tid, imm_a(nfp_prog));
emit_br_relo(nfp_prog, BR_UNC, BR_OFF_RELO + BPF_FUNC_map_lookup_elem, emit_br_relo(nfp_prog, BR_UNC, BR_OFF_RELO + meta->func_id,
2, RELO_BR_HELPER); 2, RELO_BR_HELPER);
ret_tgt = nfp_prog_current_offset(nfp_prog) + 2; ret_tgt = nfp_prog_current_offset(nfp_prog) + 2;
...@@ -2326,7 +2326,7 @@ static int call(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta) ...@@ -2326,7 +2326,7 @@ static int call(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
case BPF_FUNC_xdp_adjust_head: case BPF_FUNC_xdp_adjust_head:
return adjust_head(nfp_prog, meta); return adjust_head(nfp_prog, meta);
case BPF_FUNC_map_lookup_elem: case BPF_FUNC_map_lookup_elem:
return map_lookup_stack(nfp_prog, meta); return map_call_stack_common(nfp_prog, meta);
default: default:
WARN_ONCE(1, "verifier allowed unsupported function\n"); WARN_ONCE(1, "verifier allowed unsupported function\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment