moving struct bpf_if to bpf.c

Mark Johnston markj at FreeBSD.org
Mon Apr 20 19:53:27 UTC 2015


On Mon, Apr 20, 2015 at 10:26:18PM +0300, Gleb Smirnoff wrote:
> On Sat, Apr 18, 2015 at 02:08:56PM -0700, Mark Johnston wrote:
> M> At the moment, bpf.h defines struct bpf_if differently depending on
> M> whether BPF_INTERNAL is #defined. This causes problems with CTF, as it
> M> results in a sort of bifurcation within the type graph: CTF sees two
> M> different struct bpf_ifs, and so every struct/union containing a struct
> M> bpf_if is duplicated, and so on. CTF currently imposes a limit of 2^15
> M> distinct types within a container, and several people have been running
> M> into this limit. The type duplication exacerbates this problem.
> M> 
> M> The change here fixes the issue by moving the definition of
> M> struct bpf_if to bpf.c, and making its externally-used fields
> M> available via struct bpf_if_ext: https://reviews.freebsd.org/D2319
> M> 
> M> In particular, the ext fields are at the same offsets within struct
> M> bpf_if as before, so this change should have no functional impact.
> M> Moreover, it reduces the number of types from 20879 to 15725 with my
> M> (stripped-down) kernel config on amd64. Would anyone be willing to
> M> review the proposed change? I've also placed the raw diff here:
> M> https://people.freebsd.org/~markj/patches/bpf_entrails.diff
> 
> What actual software needs to look at struct bpf_if? I wonder if
> we can fix the software and hide the struct bpf_if into kernel
> entirely.

bpf_peers_present() is defined in bpf.h so that it can be inlined, and
it needs access to the bif_dlist field of struct bpf_if. As far as I can
see, this is the only reason for exposing part of struct bpf_if.


More information about the freebsd-net mailing list