From owner-p4-projects@FreeBSD.ORG Fri Jan 9 11:39:51 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8F0E916A4D1; Fri, 9 Jan 2004 11:39:51 -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 6A2D216A4CE for ; Fri, 9 Jan 2004 11:39:51 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0F38943D49 for ; Fri, 9 Jan 2004 11:39:49 -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 i09Jdm0B047973 for ; Fri, 9 Jan 2004 11:39:48 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i09JdmbV047970 for perforce@freebsd.org; Fri, 9 Jan 2004 11:39:48 -0800 (PST) (envelope-from sam@freebsd.org) Date: Fri, 9 Jan 2004 11:39:48 -0800 (PST) Message-Id: <200401091939.i09JdmbV047970@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 45026 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: Fri, 09 Jan 2004 19:39:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=45026 Change 45026 by sam@sam_ebb on 2004/01/09 11:39:01 Do if_init suppression for SIOCSIFADDR. Setting the higher level address on an 802.11 interface should not have any effect in the driver. But since IFF_UP is set as a side-effect of this ioctl we need to call the driver at least once. This change eliminates 1-N channel scans when operating in station or ibss/adhoc mode as each call to if_init typically causes the driver to initiate a scan. The 1-N number varies depending on how many address families are configured for use on the interface. Affected files ... .. //depot/projects/netperf+sockets/sys/net80211/ieee80211_ioctl.c#5 edit Differences ... ==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_ioctl.c#5 (text+ko) ==== @@ -38,6 +38,9 @@ * IEEE 802.11 ioctl support (FreeBSD-specific) */ +#include "opt_inet.h" +#include "opt_ipx.h" + #include #include #include @@ -50,6 +53,16 @@ #include #include +#ifdef INET +#include +#include +#endif + +#ifdef IPX +#include +#include +#endif + #include #include @@ -762,6 +775,7 @@ u_int8_t tmpkey[IEEE80211_KEYBUF_SIZE]; char tmpssid[IEEE80211_NWID_LEN]; struct ieee80211_channel *chan; + struct ifaddr *ifa; /* XXX */ switch (cmd) { case SIOCSIFMEDIA: @@ -1037,6 +1051,51 @@ error = copyout(&ic->ic_stats, ifr->ifr_data, sizeof (ic->ic_stats)); break; + case SIOCSIFADDR: + /* + * XXX Handle this directly so we can supress if_init calls. + * XXX This should be done in ether_ioctl but for the moment + * XXX there are too many other parts of the system that + * XXX set IFF_UP and so supress if_init being called when + * XXX it should be. + */ + ifa = (struct ifaddr *) data; + switch (ifa->ifa_addr->sa_family) { +#ifdef INET + case AF_INET: + if ((ifp->if_flags & IFF_UP) == 0) { + ifp->if_flags |= IFF_UP; + ifp->if_init(ifp->if_softc); + } + arp_ifinit(ifp, ifa); + break; +#endif +#ifdef IPX + /* + * XXX - This code is probably wrong, + * but has been copied many times. + */ + case AF_IPX: { + struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); + struct arpcom *ac = (struct arpcom *)ifp; + + if (ipx_nullhost(*ina)) + ina->x_host = *(union ipx_host *) ac->ac_enaddr; + else + bcopy((caddr_t) ina->x_host.c_host, + (caddr_t) ac->ac_enaddr, + sizeof(ac->ac_enaddr)); + /* fall thru... */ + } +#endif + default: + if ((ifp->if_flags & IFF_UP) == 0) { + ifp->if_flags |= IFF_UP; + ifp->if_init(ifp->if_softc); + } + break; + } + break; case SIOCSIFMTU: ifr = (struct ifreq *)data; if (ifr->ifr_mtu > IEEE80211_MTU)