Date: Thu, 8 Jan 2004 13:51:50 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 44973 for review Message-ID: <200401082151.i08LpofG024956@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=44973 Change 44973 by sam@sam_ebb on 2004/01/08 13:51:11 Eliminate gratuitous calls to if_init when setting the interface address. This is especially important for 802.11 devices where the init method kicks the 802.11 state machine. Affected files ... .. //depot/projects/netperf+sockets/sys/net/if_ethersubr.c#3 edit Differences ... ==== //depot/projects/netperf+sockets/sys/net/if_ethersubr.c#3 (text+ko) ==== @@ -873,12 +873,21 @@ switch (command) { case SIOCSIFADDR: - ifp->if_flags |= IFF_UP; - + /* + * NB: don't reset the interface unless it's + * being marked up for the first time. Calling + * the init method unncessarily can cause some + * devices to do lots of work (e.g. 802.11 where + * the station may reassociate). + */ switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - ifp->if_init(ifp->if_softc); /* before arpwhohas */ + if ((ifp->if_flags & IFF_UP) == 0) { + /* bring the interface up before arpwhohas */ + ifp->if_flags |= IFF_UP; + ifp->if_init(ifp->if_softc); + } arp_ifinit(ifp, ifa); break; #endif @@ -886,8 +895,7 @@ /* * XXX - This code is probably wrong */ - case AF_IPX: - { + case AF_IPX: { struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); struct arpcom *ac = IFP2AC(ifp); @@ -900,16 +908,14 @@ (caddr_t) ac->ac_enaddr, sizeof(ac->ac_enaddr)); } - - /* - * Set new address - */ - ifp->if_init(ifp->if_softc); - break; - } + /* fall thru... */ + } #endif default: - ifp->if_init(ifp->if_softc); + if ((ifp->if_flags & IFF_UP) == 0) { + ifp->if_flags |= IFF_UP; + ifp->if_init(ifp->if_softc); + } break; } break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401082151.i08LpofG024956>