|
|
|
|
|
|
| Author |
Message |
Xin LI *nix forums beginner
Joined: 09 Nov 2004
Posts: 44
|
Posted: Tue Jun 13, 2006 2:49 am Post subject:
Why do we do if_init for AF_INET even if the interface is running?
|
|
|
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?
Cheers,
--
Xin LI <delphij delphij net> http://www.delphij.net/ |
|
| Back to top |
|
 |
Sam Leffler *nix forums addict
Joined: 20 Jun 2002
Posts: 75
|
Posted: Tue Jun 13, 2006 4:52 am Post subject:
Re: Why do we do if_init for AF_INET even if the interface is running?
|
|
|
Xin LI wrote:
| Quote: | 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?
Cheers,
------------------------------------------------------------------------
Index: if_ethersubr.c
===================================================================
RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.215
diff -u -r1.215 if_ethersubr.c
--- if_ethersubr.c 3 Mar 2006 17:21:08 -0000 1.215
+++ if_ethersubr.c 13 Jun 2006 01:55:31 -0000
@@ -997,7 +997,8 @@
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
- ifp->if_init(ifp->if_softc); /* before arpwhohas */
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ ifp->if_init(ifp->if_softc); /* before arpwhohas */
arp_ifinit(ifp, ifa);
break;
#endif
@@ -1027,7 +1028,8 @@
}
#endif
default:
- ifp->if_init(ifp->if_softc);
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ ifp->if_init(ifp->if_softc);
break;
}
break;
|
Try it; you'll find various drivers blow up in their multicast code
because they assume the init method is called. I tried to get this same
change committed last year because it causes wireless drivers to blow
chunks. I finally gave up and stuck a similar change in ieee80211_ioctl.
Sam
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" |
|
| Back to top |
|
 |
Brooks Davis *nix forums addict
Joined: 14 Jun 2002
Posts: 97
|
Posted: Tue Jun 13, 2006 5:03 am Post subject:
Re: Why do we do if_init for AF_INET even if the interface is running?
|
|
|
On Tue, Jun 13, 2006 at 10:49:34AM +0800, Xin LI wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Tue Dec 02, 2008 1:36 pm | All times are GMT
|
|
Mortgage Calculator | Loans | Debt Help | Credit Check | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|