Page MenuHomeFreeBSD

bpf: convert several boolean natured fields of bpf_d to flags
ClosedPublic

Authored by glebius on Nov 21 2025, 10:56 PM.
Tags
None
Referenced Files
F169780576: D53870.id166930.diff
Wed, Sep 2, 1:25 PM
F169778835: D53870.id167948.diff
Wed, Sep 2, 1:16 PM
F169748011: D53870.id167511.diff
Wed, Sep 2, 11:05 AM
F169697104: D53870.diff
Wed, Sep 2, 7:52 AM
Unknown Object (File)
Fri, Aug 28, 2:16 PM
Unknown Object (File)
Fri, Aug 28, 1:29 PM
Unknown Object (File)
Tue, Aug 25, 12:33 PM
Unknown Object (File)
Thu, Aug 20, 3:00 PM

Details

Summary

This shrinks the structure a bit. Should be no functional change.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68796
Build 65679: arc lint + arc unit

Event Timeline

markj added inline comments.
sys/net/bpf.c
880

No lock is held here.

1516

Most of the accesses/updates are locked by the bpfd lock, so this update is unlocked.

sys/net/bpf.c
1516

With this revision I don't intend to fix any bugs, just make struct smaller and make it possible to pass flags to bif_write method.

sys/net/bpf.c
1516

Ok, but you're also introducing new bugs. Before, the code was performing unsynchronized stores to different fields. Now they are doing read-modify-writes to the same field, so setting one flag might clobber a different one. That wasn't possible before.

The d_promisc appears to be locked by the global BPF_LOCK(). Thus, remove it
from this changes. This addresses Mark's comments.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 13 2025, 12:44 AM
This revision was automatically updated to reflect the committed changes.