1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
12 #include <rte_common.h>
18 * dummy one for now, need more work.
21 bpf_validate(struct rte_bpf *bpf)
23 int32_t rc, ofs, stack_sz;
25 const struct ebpf_insn *ins;
29 for (i = 0; i != bpf->prm.nb_ins; i++) {
31 ins = bpf->prm.ins + i;
36 if ((BPF_CLASS(op) == BPF_STX || BPF_CLASS(op) == BPF_ST) &&
38 ofs -= sizeof(uint64_t);
39 stack_sz = RTE_MIN(ofs, stack_sz);
45 if (stack_sz > MAX_BPF_STACK_SIZE)
48 bpf->stack_sz = stack_sz;
52 RTE_BPF_LOG(ERR, "%s(%p) failed, error code: %d;\n",