Roadmap for ifnet(9) for FreeBSD 11

Marcel Moolenaar marcel at xcllnt.net
Wed May 28 16:34:10 UTC 2014


All,

The ifnet structure represents a network interface. Right now it
is known to all NIC drivers as well as to all protocols. This
means that whenever we change the structure, we need at minimum
recompile all drivers, but usually also change them. This severely
slow downs the development in this area and also makes it hard, if
not, impossible to merge things back to stable branches.

There were at least 3 efforts on fixing this:

1)  Juniper’s JUNOS is a FreeBSD based operating system that has
    its own (alternative) network stack, but that leverages the
    network drivers from FreeBSD. Juniper mechanically changed all
    ifnet dereferences to to accessor methods. This could have
    been incorporated as early as 2011, but lacked good follow
    through. Marcel Moolenaar was prime contact for this.

2)  Andre Oppermann was sponsored in 2013 by the FreeBSD
    Foundation to make ifnet(9) opaque. This is not complete as of
    the time of this writing.

3)  Gleb Smirnoff also planned to work on opaque ifnet(9), but
    that always has been delayed due to 1) and 2).

To outline what we would like to achieve:

o   FreeBSD wants to have an opaque ifnet(9). The benefits of
    which are:
    - quicker development of networking improvements w/o breaking
      ABI/API
    - splitting up ifnet into multiple structures or otherwise
      make ifnet of variable size.

o   Juniper wants to continue using stock FreeBSD drivers against
    its own network stack.

The suggested roadmap is as follows:

Since Juniper already has a working patch that achieves the
objective of making ifnet an opaque type by replacing ifnet
pointer dereferences with function calls in an almost mechanical
fashion, we propose to merge that first.
The patch doesn't break old-style access to struct ifnet, which
means that unconverted and converted drivers coexist. This gives
us time to convert drivers. This also gives Juniper an important
rendezvous point between their and our repos.

The following drivers have been converted by Juniper:
o   fxp
o   em and lem
o   bxe.

Additional drivers will be converted by the community. Once all
drivers are converted, no network driver needs or uses “struct
ifnet”. At that point the definition can be removed from headers
included by drivers or changed entirely.

Schedule:

late May 2014		Juniper adds accessor methods. Access via
			void *, that inside if.c is re-casted to
			(struct ifnet *). This “ugly” moment is
			required to keep unconverted drivers
			compilable and will go away shortly after.
1st week June 2014	Juniper commits few converted drivers.
June - July		All drivers are being converted. Gleb
			volunteers, but this should be done by as
			many hands as possible.
August 2014		'#define if_t void *' is removed.
			'typedef if_t struct ifnet *' is added.
			actual struct ifnet is hidden.
2014/2015		Better APIs developed and improved, actual
			ifnet representation becomes variable
			sized. New networking stack improvements
			are already unblocked at this moment.

The complete patch as well as the conversion script can be
found here:

http://people.freebsd.org/~marcel/Juniper/201405/drvapi.diff
http://people.freebsd.org/~marcel/Juniper/201405/convert_drvapi.sh

-- 
Marcel Moolenaar
marcel at xcllnt.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20140528/3443e7de/attachment.sig>


More information about the freebsd-arch mailing list