X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Flibrte_bpf%2Fbpf_load_elf.c;h=2b11adeb5eb1a296a7248b1631a0b118620ddbcb;hb=6861c01001ac3b1869f5cf1f492809875f753e67;hp=6ab03d86e3e91a83d71e309e6a658bd10849c8b2;hpb=5dba93ae5f2dc38a13f373634bd06926716d150a;p=dpdk.git diff --git a/lib/librte_bpf/bpf_load_elf.c b/lib/librte_bpf/bpf_load_elf.c index 6ab03d86e3..2b11adeb5e 100644 --- a/lib/librte_bpf/bpf_load_elf.c +++ b/lib/librte_bpf/bpf_load_elf.c @@ -77,13 +77,24 @@ 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 { - ins[idx].imm = (uintptr_t)prm->xsym[fidx].var; + } else { + ins[idx].imm = (uintptr_t)prm->xsym[fidx].var.val; ins[idx + 1].imm = - (uint64_t)(uintptr_t)prm->xsym[fidx].var >> 32; + (uint64_t)(uintptr_t)prm->xsym[fidx].var.val >> 32; } return 0; @@ -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) {