Page MenuHomeFreeBSD

net: attach IPv4 and IPv6 stacks to an interface with EVENTHANDLER(9)
AcceptedPublic

Authored by glebius on Fri, Dec 5, 5:36 PM.
Tags
None
Referenced Files
F140610481: D54089.id167594.diff
Thu, Dec 25, 10:39 PM
Unknown Object (File)
Wed, Dec 17, 11:04 AM
Unknown Object (File)
Mon, Dec 15, 10:00 PM
Unknown Object (File)
Sun, Dec 14, 12:02 AM
Unknown Object (File)
Sat, Dec 13, 11:16 PM
Unknown Object (File)
Mon, Dec 8, 4:52 PM
Unknown Object (File)
Sat, Dec 6, 3:17 PM
Unknown Object (File)
Sat, Dec 6, 3:15 PM

Details

Reviewers
gallatin
zlei
melifaro
Group Reviewers
network
Summary

This change retires two historic relics: the if_afdata[] array and the
dom_ifattach/dom_ifdetach methods.

The if_afdata[] array is a relic of the era, when there was expectation
that many transport protocols will coexist with IP, e.g. IPX or NetAtalk.
The array hasn't had any members except AF_INET and AF_INET6 for over a
decade already. This change removes the array and just leaves two pointer
fields: if_inet and if_inet6.

The dom_ifattach/dom_ifdetach predates the EVENTHANDLER(9) framework and
was a good enough method to initialize protocol contexts back then. Today
there is no good reason to treat IPv4 and IPv6 stacks differently to other
protocols/features that attach and detach from an interface.

The locking of if_afdata[] is a relic of SMPng times, when the system
startup and the interface attach was even more convoluted than before this
change, and we also had unloadable protocols that used a field in
if_afdata[]. Note that IPv4 and IPv6 are not unloadable.

Note that this change removes NET_EPOCH_WAIT() from the interface detach
sequence. This may surface several new races associated with interface
removal. I failed to hit any with consecutive test suite runs, though.
The expected general race scenario is that while struct ifnet is freed
with proper epoch_call(9) itself, some structures hanging off ifnet are
freed with direct free(9). The proper fix is either make if_foo point at
some static "dead" structure providing SMP visibility of this store, or
free those structure with epoch_call(9). All of these cases are planned
to be found and resolved during 16.0-CURRENT lifetime.

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.Fri, Dec 5, 6:38 PM
zlei added a subscriber: zlei.

I like this approach. This change will also relief the cache usage and have nice effect on performance.

sys/netinet/ip_input.c
386

I would assert that the current vnet is vnet0.

  • Rebased. No functional changes.
This revision now requires review to proceed.Tue, Dec 16, 7:37 PM
melifaro added inline comments.
sys/net/if.c
1119โ€“1120

Is this still needed provided we detached all supported AFs?

This revision is now accepted and ready to land.Thu, Dec 18, 12:16 AM
sys/net/if.c
1119โ€“1120

This is on my list of things that need to be revised separately.