Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 2015 09:14:24 +0300
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Mark Johnston <markj@FreeBSD.org>
Cc:        melifaro@FreeBSD.org, freebsd-net@FreeBSD.org
Subject:   Re: moving struct bpf_if to bpf.c
Message-ID:  <20150421061424.GC883@glebius.int.ru>
In-Reply-To: <20150420195233.GA71166@muskytusk>
References:  <20150418210855.GA50409@charmander.west.isilon.com> <20150420192618.GY883@FreeBSD.org> <20150420195233.GA71166@muskytusk>

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

My suggestion is to un-inline it. Calling a static function isn't a big
deal on modern machines.

-- 
Totus tuus, Glebius.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150421061424.GC883>