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

Function rte_bpf_load

dpdk/lib/bpf/bpf_load.c:82–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82struct rte_bpf *
83rte_bpf_load(const struct rte_bpf_prm *prm)
84{
85 struct rte_bpf *bpf;
86 int32_t rc;
87 uint32_t i;
88
89 if (prm == NULL || prm->ins == NULL ||
90 (prm->nb_xsym != 0 && prm->xsym == NULL)) {
91 rte_errno = EINVAL;
92 return NULL;
93 }
94
95 rc = 0;
96 for (i = 0; i != prm->nb_xsym && rc == 0; i++)
97 rc = bpf_check_xsym(prm->xsym + i);
98
99 if (rc != 0) {
100 rte_errno = -rc;
101 RTE_BPF_LOG(ERR, "%s: %d-th xsym is invalid\n", __func__, i);
102 return NULL;
103 }
104
105 bpf = bpf_load(prm);
106 if (bpf == NULL) {
107 rte_errno = ENOMEM;
108 return NULL;
109 }
110
111 rc = __rte_bpf_validate(bpf);
112 if (rc == 0) {
113 __rte_bpf_jit(bpf);
114 if (mprotect(bpf, bpf->sz, PROT_READ) != 0)
115 rc = -ENOMEM;
116 }
117
118 if (rc != 0) {
119 rte_bpf_destroy(bpf);
120 rte_errno = -rc;
121 return NULL;
122 }
123
124 return bpf;
125}

Callers 5

set_pdump_rxtx_cbsFunction · 0.85
bpf_load_elfFunction · 0.85
run_testFunction · 0.85
test_bpf_matchFunction · 0.85
test_bpf_filterFunction · 0.85

Calls 5

bpf_check_xsymFunction · 0.85
__rte_bpf_validateFunction · 0.85
__rte_bpf_jitFunction · 0.85
rte_bpf_destroyFunction · 0.85
bpf_loadFunction · 0.70

Tested by 3

run_testFunction · 0.68
test_bpf_matchFunction · 0.68
test_bpf_filterFunction · 0.68