MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bpf_check_xsym

Function bpf_check_xsym

dpdk/lib/bpf/bpf_load.c:50–80  ·  view source on GitHub ↗

* Check that user provided external symbol. */

Source from the content-addressed store, hash-verified

48 * Check that user provided external symbol.
49 */
50static int
51bpf_check_xsym(const struct rte_bpf_xsym *xsym)
52{
53 uint32_t i;
54
55 if (xsym->name == NULL)
56 return -EINVAL;
57
58 if (xsym->type == RTE_BPF_XTYPE_VAR) {
59 if (xsym->var.desc.type == RTE_BPF_ARG_UNDEF)
60 return -EINVAL;
61 } else if (xsym->type == RTE_BPF_XTYPE_FUNC) {
62
63 if (xsym->func.nb_args > EBPF_FUNC_MAX_ARGS)
64 return -EINVAL;
65
66 /* check function arguments */
67 for (i = 0; i != xsym->func.nb_args; i++) {
68 if (xsym->func.args[i].type == RTE_BPF_ARG_UNDEF)
69 return -EINVAL;
70 }
71
72 /* check return value info */
73 if (xsym->func.ret.type != RTE_BPF_ARG_UNDEF &&
74 xsym->func.ret.size == 0)
75 return -EINVAL;
76 } else
77 return -EINVAL;
78
79 return 0;
80}
81
82struct rte_bpf *
83rte_bpf_load(const struct rte_bpf_prm *prm)

Callers 1

rte_bpf_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected