Why do we do if_init for AF_INET even if the interface is running?

Brooks Davis brooks at one-eyed-alien.net
Tue Jun 13 05:04:19 UTC 2006


On Tue, Jun 13, 2006 at 10:49:34AM +0800, Xin LI wrote:
> Hi,
> 
> Is there any reason why we do if_init() for AF_INET regardless whether
> the interface is already in IF_DRV_RUNNING?  This seems to cause the
> interface to reinitialize its link level state, which causes the network
> to stop for a short while.
> 
> The proposed patch is inspired from NetBSD net/if_ethersubr.c,v 1.86
> which says:
> 
> "When setting an address on an interface, for address families which
> do not require changing the link-level address, only (*if_init)()
> if the interface is not already RUNNING."
> 
> I think we may want this as well.
> 
> Comments?

As Sam says, there are hardware filters that need to be initialized.
My feeling is that you're correct that doing so via if_init is a bug
since that's way too big a hammer, but there are too many edge cases
for it to be possible to have a flag day.  If we want to move to more
selective updating, the way to do it is probably some sort of flag
similar to IFF_NEEDSGIANT that tell the interface subsystem to keep the
old behavior and otherwise pass the change down to the driver to decide
what it needs to do.  That way we could make the change over time and
eventually deprecate and then remove the flag.

-- Brooks

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20060613/255696ee/attachment.pgp


More information about the freebsd-arch mailing list