X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_bpf%2Fbpf_load_elf.c;h=2b11adeb5eb1a296a7248b1631a0b118620ddbcb;hb=a18e79cd3cce35dd6f7c61f323100833e5ed9db9;hp=96d3630fe75bc361e0d8c20380df7562651b4bf2;hpb=60702e8c7cbbadd4d5e6ffe4d7f470db339b0a04;p=dpdk.git diff --git a/lib/librte_bpf/bpf_load_elf.c b/lib/librte_bpf/bpf_load_elf.c index 96d3630fe7..2b11adeb5e 100644 --- a/lib/librte_bpf/bpf_load_elf.c +++ b/lib/librte_bpf/bpf_load_elf.c @@ -77,10 +77,21 @@ resolve_xsym(const char *sn, size_t ofs, struct ebpf_insn *ins, size_t ins_sz, return -ENOENT; /* for function we just need an index in our xsym table */ - if (type == RTE_BPF_XTYPE_FUNC) + if (type == RTE_BPF_XTYPE_FUNC) { + + /* we don't support multiple functions per BPF module, + * so treat EBPF_PSEUDO_CALL to extrernal function + * as an ordinary EBPF_CALL. + */ + if (ins[idx].src_reg == EBPF_PSEUDO_CALL) { + RTE_BPF_LOG(INFO, "%s(%u): " + "EBPF_PSEUDO_CALL to external function: %s\n", + __func__, idx, sn); + ins[idx].src_reg = EBPF_REG_0; + } ins[idx].imm = fidx; /* for variable we need to store its absolute address */ - else { + } else { ins[idx].imm = (uintptr_t)prm->xsym[fidx].var.val; ins[idx + 1].imm = (uint64_t)(uintptr_t)prm->xsym[fidx].var.val >> 32; @@ -283,7 +294,7 @@ bpf_load_elf(const struct rte_bpf_prm *prm, int32_t fd, const char *section) return bpf; } -__rte_experimental struct rte_bpf * +struct rte_bpf * rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname, const char *sname) {