Date: Mon, 12 Jun 2006 21:52:37 -0700 From: Sam Leffler <sam@errno.com> To: Xin LI <delphij@delphij.net> Cc: freebsd-arch@freebsd.org Subject: Re: Why do we do if_init for AF_INET even if the interface is running? Message-ID: <448E4495.4030200@errno.com> In-Reply-To: <1150166974.936.6.camel@spirit> References: <1150166974.936.6.camel@spirit>
next in thread | previous in thread | raw e-mail | index | archive | help
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? > > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?448E4495.4030200>