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

Function bpf_zerocopy_canfreebuf

freebsd/net/bpf_zerocopy.c:426–441  ·  view source on GitHub ↗

* Query from the BPF framework regarding whether the buffer currently in the * held position can be moved to the free position, which can be indicated by * the user process making their generation number equal to the kernel * generation number. */

Source from the content-addressed store, hash-verified

424 * generation number.
425 */
426int
427bpf_zerocopy_canfreebuf(struct bpf_d *d)
428{
429 struct zbuf *zb;
430
431 KASSERT(d->bd_bufmode == BPF_BUFMODE_ZBUF,
432 ("bpf_zerocopy_canfreebuf: not in zbuf mode"));
433
434 zb = (struct zbuf *)d->bd_hbuf;
435 if (zb == NULL)
436 return (0);
437 if (zb->zb_header->bzh_kernel_gen ==
438 atomic_load_acq_int(&zb->zb_header->bzh_user_gen))
439 return (1);
440 return (0);
441}
442
443/*
444 * Query from the BPF framework as to whether or not the buffer current in

Callers 1

bpf_canfreebufFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected