[JNPR] Network stack as a module (RFC)

Steve Kiernan stevek at juniper.net
Mon Nov 18 19:35:22 UTC 2013

On Mon, 18 Nov 2013 20:41:49 +0400
Gleb Smirnoff <glebius at freebsd.org> wrote:

>   Marcel,
> On Sun, Nov 17, 2013 at 10:10:15AM -0800, Marcel Moolenaar wrote:
> M> > S> Add a NETSTACK option to facilitate separating network stack pieces from the
> M> > S> rest of the OS core. This is the first step towards having the network stack
> M> > S> as a module.
> M> > 
> M> > You probably mean "having the network stack optional", since under module we
> M> > usually mean loadable kernel module.
> M> 
> M> Actually, we do mean module. At Juniper we have the FreeBSD stack
> M> as a loadable module now. We also have the Juniper stack as a
> M> loadable module. Depending on context, we can use the most
> M> appropriate one. Yes, this implies that we also have a stable
> M> interface between the NIC driver and the network stack itself.
> M> We'll be contributing that as well...
> M> 
> M> Note that assumptions in the finalization of setting up networking
> M> limits the network stack from being loaded manually, not to mention
> M> that unloading is an entirely different challenge. Nonetheless it's
> M> very useful without all that and I think it will make it easier for
> M> people to change the network stack or experiment with beta versions
> M> this way.
> Have you measured the performance impact on the loadable stack? I
> suppose many functions, that are now called directly, with loadable
> stack will be called via functon pointers.

No, only a small number of functions were needed to be methods in a
netstack kobj in the current implementation that we have. And some of
those may need to change, as they revolve around NFS exports.

Currently, we have four (4) methods that are needed:

When one is not dealing with NFS exports, only the socreate method is
of interest. It is called just before mac_socket_create() would be
called in socreate().

See http://people.freebsd.org/~marcel/Juniper/netstack-v2.diff, which
is the full patch set that had been previously sent out. Some things
have changed a bit since then, but if you look for curnetstack usage
in the patch, you should be able to see the places where netsack
methods are called.

Stephen J. Kiernan
Juniper Networks, Inc.

More information about the freebsd-net mailing list