Subject: Re: if_delete * if_alloc
To: Matt Thomas <>
From: Bill Studenmund <>
List: tech-kern
Date: 07/08/1997 19:14:20
[snip of outline of changes]

> Ouch.  That will make significantly more painful for me.  I'd
> rather have int (*if_freeself)(struct ifnet *) member added.  If
> NULL, the ifnet can not be deallocated.  It returns 0 on successful
> deletion or an error on failure.

What exactly is the killer (just for clarity)? The ec_if.if_XXX ->
ec_if->if_XXX part, something else, or c) all of the above?

> I can see if_delete for slip/ppp/tun/* but not real ethernet hardware
> which will be known at boot time.  (unless we want to LKM's.)

I am doing this for LKM's. I basically want to prototype all the
(infamous) LocalTalk stuff as an LKM. Also, too many folks on
port-mac68k aren't up to speed on kernel building, either from
experience or space. So if they could pull down a 1.3 kernel and add an
lkm to get LocalTalk, I'll have to deal with a lot fewer questions. :-)

Jason's motivation came across to me as being PCMCIA. If the user pops
an ethernet card out of the slot, the interface had better go away.

The idea is that if_detach will shut down the interface (killing all
the timers, etc), remove all the addresses from the interface,
kill the link address, remove the interface from the interface list,
and if_delref it. The protocols will delete all their routes (with
ifnet references). Extra link routes will get scrubbed manually.
Thus at the end, the only outstanding references (after the if_delref)
will be received packets in a protocol's in queue. When the packets
get dealt with (m_freem()), there's an if_delref.

One spurious question. The only things which will look at an ethercom
(or an arccom) live in etherinput (somewhere else for arccom) and
etheroutput, right? Thus if we disable the start routines, mark
the send queue as full, and disable any hardware interrupt services,
we will never look at an ethercom again. ? I ask as ethercom's tend
to live in softc's, and there is (will be) a pointer from the ifnet
back to the ethercom (or arccom) which will dangle if the softc
is killed before the interface's deleted.


Take care,