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

Function bpf_load_elf

dpdk/lib/bpf/bpf_load_elf.c:266–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266static struct rte_bpf *
267bpf_load_elf(const struct rte_bpf_prm *prm, int32_t fd, const char *section)
268{
269 Elf *elf;
270 Elf_Data *sd;
271 size_t sidx;
272 int32_t rc;
273 struct rte_bpf *bpf;
274 struct rte_bpf_prm np;
275
276 elf_version(EV_CURRENT);
277 elf = elf_begin(fd, ELF_C_READ, NULL);
278
279 rc = find_elf_code(elf, section, &sd, &sidx);
280 if (rc == 0)
281 rc = elf_reloc_code(elf, sd, sidx, prm);
282
283 if (rc == 0) {
284 np = prm[0];
285 np.ins = sd->d_buf;
286 np.nb_ins = sd->d_size / sizeof(struct ebpf_insn);
287 bpf = rte_bpf_load(&np);
288 } else {
289 bpf = NULL;
290 rte_errno = -rc;
291 }
292
293 elf_end(elf);
294 return bpf;
295}
296
297struct rte_bpf *
298rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,

Callers 1

rte_bpf_elf_loadFunction · 0.85

Calls 3

find_elf_codeFunction · 0.85
elf_reloc_codeFunction · 0.85
rte_bpf_loadFunction · 0.85

Tested by

no test coverage detected