From owner-p4-projects@FreeBSD.ORG Sat Feb 5 23:35:22 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EBD9D16A4D0; Sat, 5 Feb 2005 23:35:21 +0000 (GMT) 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 AEC6516A4CE for ; Sat, 5 Feb 2005 23:35:21 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 75D6A43D45 for ; Sat, 5 Feb 2005 23:35:21 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j15NZLlD060248 for ; Sat, 5 Feb 2005 23:35:21 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j15NZLmr060235 for perforce@freebsd.org; Sat, 5 Feb 2005 23:35:21 GMT (envelope-from sam@freebsd.org) Date: Sat, 5 Feb 2005 23:35:21 GMT Message-Id: <200502052335.j15NZLmr060235@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 70406 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: Sat, 05 Feb 2005 23:35:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=70406 Change 70406 by sam@sam_ebb on 2005/02/05 23:34:56 Fix media status on the base device by moving the ieee80211com struct to the front of the softc; we can do this since we're not an IFT_ETHER and there's no requirement that the arpcom appear first in the softc. Note this is all a big hack that'll need fixup before public use. Otherwise change if_type for the device from OTHER to IEEE80211 and move the arpcom enaddr setup to the driver since the 802.11 layer no longer can use IFP2AC to locate it. Doing this also uncovered that we were calling ath_init with the ifp instead of the softc (no type checking 'cuz of void* calling convention, gag). Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#4 edit .. //depot/projects/vap/sys/dev/ath/if_athvar.h#3 edit .. //depot/projects/vap/sys/net80211/ieee80211.c#3 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#4 (text+ko) ==== @@ -563,6 +563,8 @@ /* get mac address from hardware */ ath_hal_getmac(ah, ic->ic_myaddr); + /* XXX required for arp, yech */ + IEEE80211_ADDR_COPY(IFP2AC(ifp)->ac_enaddr, ic->ic_myaddr); /* call MI attach routine. */ ieee80211_ifattach(ic); @@ -721,7 +723,7 @@ __func__, ifp->if_flags); if (ifp->if_flags & IFF_UP) { - ath_init(ifp); + ath_init(sc); if (ifp->if_flags & IFF_RUNNING) ath_start(ifp); } @@ -4777,7 +4779,7 @@ * probably a better way to deal with this. */ if (!sc->sc_invalid) - ath_init(ifp); /* XXX lose error */ + ath_init(sc); /* XXX lose error */ } else ath_stop_locked(ifp); ATH_UNLOCK(sc); ==== //depot/projects/vap/sys/dev/ath/if_athvar.h#3 (text+ko) ==== @@ -175,9 +175,9 @@ } while (0) struct ath_softc { + struct ieee80211com sc_ic; /* NB: must be first XXX */ struct arpcom sc_arp; /* interface common */ struct ath_stats sc_stats; /* interface statistics */ - struct ieee80211com sc_ic; /* IEEE 802.11 common */ int sc_regdomain; int sc_countrycode; int sc_debug; ==== //depot/projects/vap/sys/net80211/ieee80211.c#3 (text+ko) ==== @@ -149,7 +149,7 @@ (void) ieee80211_setmode(ic, ic->ic_curmode); - ifp->if_type = IFT_OTHER; /* intentionally unusable */ + ifp->if_type = IFT_IEEE80211; /* NB: not IFT_ETHER */ ifp->if_addrlen = IEEE80211_ADDR_LEN; ifp->if_hdrlen = 0; if_attach(ifp); @@ -158,10 +158,9 @@ ifa = ifaddr_byindex(ifp->if_index); KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sdl->sdl_type = IFT_ETHER; + sdl->sdl_type = IFT_ETHER; /* XXX IFT_IEEE80211? */ sdl->sdl_alen = IEEE80211_ADDR_LEN; IEEE80211_ADDR_COPY(LLADDR(sdl), ic->ic_myaddr); - IEEE80211_ADDR_COPY(IFP2AC(ifp)->ac_enaddr, ic->ic_myaddr); ifp->if_broadcastaddr = ieee80211broadcastaddr; maxrate = ieee80211_media_setup(ic, &ic->ic_media, ic->ic_caps, @@ -518,7 +517,8 @@ static void ieee80211com_media_status(struct ifnet *ifp, struct ifmediareq *imr) { - struct ieee80211com *ic = ifp->if_softc; /*XXX*/ + /* XXX assumes ieee80211com at front of softc */ + struct ieee80211com *ic = ifp->if_softc; imr->ifm_status = IFM_AVALID; if (!TAILQ_EMPTY(&ic->ic_vaps))