cvs commit: src/sys/net if_vlan.c
hartmut.brandt at dlr.de
Tue Jul 4 19:02:40 UTC 2006
On Tue, 4 Jul 2006, Julian Elischer wrote:
JE>Harti Brandt wrote:
JE>> On Tue, 4 Jul 2006, Brooks Davis wrote:
JE>> BD>On Tue, Jul 04, 2006 at 10:25:39AM -0600, M. Warner Losh wrote:
JE>> BD>> In message: <20060703202803.GA22556 at odin.ac.hmc.edu>
JE>> BD>> Brooks Davis <brooks at one-eyed-alien.net> writes:
JE>> BD>> : and act as though the interface is not there. We could then
JE>> BD>> : either holding the interface for a configurable or computed length
JE>> BD>> : of time or adding some sort of refcounting (probably impractical).
JE>> BD>> BD>> Refcounting would be good for the 'macro' things (coming and
JE>> BD>> that are infrequent, but we might have mulitple people doing. You are
JE>> BD>> right it likely is too inefficient to do with mbugs. One other option
JE>> BD>> might be to have a configurable time after the last time that it was
JE>> BD>> accessed via the 'safe' routines that were setup. This way we'd tie
JE>> BD>> the removal of the interface to a period of time after it was last
JE>> BD>> used, rather than after it was removed. I don't know if such a
JE>> BD>> difference would matter much in practice.
JE>> BD>We might get some mielage out of last used, but then we'd have to keep
JE>> BD>that timestamp updated. For normal applications, once we've torn down
JE>> BD>the sockets and drained their queues, I believe we should not have to
JE>> BD>wait more than a few seconds unless dummynet or some other mechanism
JE>> BD>that queues mbufs for a significant period of time is enabled. If
JE>> BD>dummynet is enabled we need to wait a bit longer, but it isn't outside
JE>> BD>the relm of possibility for dummynet to be modified to tell us how long
JE>> BD>it will be until the last mbuf it currenly holds will be released. In
JE>> BD>practice, 121 seconds is probably a good default number since a 60
JE>> BD>second max RTT is assumed in TCP and thus delays longer than that
JE>> BD>would break everything anyway.
JE>> BD>> The only other 'issue' that I see with this approach is if I remove a
JE>> BD>> card, and then insert it again before the timeout happens. Does that
JE>> BD>> card get a new interface name? And would people care or not...
JE>> BD>The name is unregistered with the call to if_detach because if_detach
JE>> BD>removes the interface from the ifnet list. My guess is that
JE>> BD>we'll either zero the name field or set to something like _zombie. The
JE>> BD>unit will remain reserved until later. We'll need to add an SNMP index
JE>> BD>mananaged in userland to satisfy come current if_index consumers.
JE>> bsnmp does this anyway because of the rules for ifIndex. It has some
JE>> heuristic to guess whether an interface is a physical one or not and if it
JE>> is, it uses the same index again. The downside of this is that the
JE>> interface index you see via SNMP has nothing to do with the interface index
JE>> you see in the system and this does not work accross reboots and daemon
JE>> restarts as required by the RFC.
JE>If we had a way to to this in the system (e.g. kept the mac address
JE>with the ifnum in a hash) then we could just keep the ifnum in the mbuf
JE>instead of the ifp pointer, as that is only occasionally used, and a
JE>ifnum2ipf() macro could check the validity wheheve it is used.
This would be helpful for the SNMP daemon, because this would also allow
to reuse the ifnum if the same interface is plugged in back. However care
must be taken that non-physical interfaces get a new ifnum always (iftun
More information about the freebsd-net