vhost: add inflight structures
[dpdk.git] / lib / librte_bpf / bpf_load_elf.c
index 96d3630..2b11ade 100644 (file)
@@ -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)
 {