Subject: Re: Detachable network devices?
To: Bill Sommerfeld <firstname.lastname@example.org>
From: Bill Studenmund <email@example.com>
Date: 10/01/1999 12:06:04
On Fri, 1 Oct 1999, Bill Sommerfeld wrote:
> > What work needs to be done to allow this?
> There was some work done on this (on the kenh_ifdetach CVS branch); it
> needs to be merged (kicking and screaming, since it's sort of old)
> into -current. it's on my queue of things i want to get done, but
> it's not all that close to the top so if someone else wants to run
> with it..
> Unfortunately, it involves tweaks to just about every network device
> driver since it means that the "struct if", which is currently usually
> just inline in the "struct ethercom" in the device softc, has to be
> moved into a separately allocated structure so the softc can be
> deallocated at device detach time while there are still references to
> the struct if from mbufs all over the known universe...
That's not the nasty part. I was the one who initiated the ifdetach work,
and did most of it. Ken took it, fised it up so you could actually detach,
and then made a branch. We've both dropped the ball since then.
Fixing a driver for the new scheme was easy - twiddle the attach code a
little, fix some sc_if.foo becomes sc_if->foo cases, and add an if_addref
in the input routine to reflect the reference in the newly-created mbuf.
The really nasty part is what it does to all of the protocols. Before they
would grab references to ifaddr's, but only incriment the ifaddr reference
count if they held onto the ref long-term. With these changes, EVERY
reference to an ifaddr has to be accounted for (as ifaddr's contain
references to interfaces). THAT was the icky-messy part.