From owner-p4-projects@FreeBSD.ORG Thu Jan 8 13:51:52 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4349616A4D1; Thu, 8 Jan 2004 13:51:52 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D4A516A4CE for ; Thu, 8 Jan 2004 13:51:52 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D6D2D43D49 for ; Thu, 8 Jan 2004 13:51:50 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i08Lpo0B024962 for ; Thu, 8 Jan 2004 13:51:50 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i08LpofG024956 for perforce@freebsd.org; Thu, 8 Jan 2004 13:51:50 -0800 (PST) (envelope-from sam@freebsd.org) Date: Thu, 8 Jan 2004 13:51:50 -0800 (PST) Message-Id: <200401082151.i08LpofG024956@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 44973 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2004 21:51:52 -0000 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;