PERFORCE change 70406 for review

Sam Leffler sam at FreeBSD.org
Sat Feb 5 15:35:22 PST 2005


http://perforce.freebsd.org/chv.cgi?CH=70406

Change 70406 by sam at 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))


More information about the p4-projects mailing list