* 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. */
| 424 | * generation number. |
| 425 | */ |
| 426 | int |
| 427 | bpf_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 |