Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2008 23:16:42 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 139383 for review
Message-ID:  <200804042316.m34NGgvK031938@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=139383

Change 139383 by sam@sam_ebb on 2008/04/04 23:16:18

	Use if_l2com mechanism to move the ieee80211com structure to
	an adjunct of the ifnet associated with the parent device:
	o register a com allocator for IFT_IEEE80211 that allocates
	  an ieee80211com structure
	o change all use of if_softc in net80211 to if_l2com
	o replace if_type override in ieee80211_ifattach with an assert;
	  if the driver doesn't setup the ifnet correctly lots of badness
	  will happen
	o remove ieee80211com structure from the softc of all drivers
	  and change all drivers to use if_l2com to get a reference to the
	  com structure
	o change all drivers to use sc_ifp to locate the parent device
	  ifnet instead of chasing ic_ifp; this should probably be used
	  only inside net80211 but there's no way to protect it (and
	  there are some callbacks that still require referencing it)
	o change some driver printfs to use if_printf/device_printf as
	  appropriate (especially rum+ural which still had usb nonsense)
	
	Tested: ath, iwn, ral (rt2661), wi, mwl, zyd, ural, bwi, malo

Affected files ...

.. //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#10 edit
.. //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.h#6 edit
.. //depot/projects/vap/sys/dev/ath/if_ath.c#60 edit
.. //depot/projects/vap/sys/dev/ath/if_athvar.h#20 edit
.. //depot/projects/vap/sys/dev/bwi/bwimac.c#3 edit
.. //depot/projects/vap/sys/dev/bwi/bwiphy.c#2 edit
.. //depot/projects/vap/sys/dev/bwi/bwirf.c#3 edit
.. //depot/projects/vap/sys/dev/bwi/if_bwi.c#6 edit
.. //depot/projects/vap/sys/dev/bwi/if_bwivar.h#4 edit
.. //depot/projects/vap/sys/dev/ipw/if_ipw.c#10 edit
.. //depot/projects/vap/sys/dev/ipw/if_ipwvar.h#8 edit
.. //depot/projects/vap/sys/dev/iwi/if_iwi.c#16 edit
.. //depot/projects/vap/sys/dev/iwi/if_iwivar.h#10 edit
.. //depot/projects/vap/sys/dev/iwn/if_iwn.c#7 edit
.. //depot/projects/vap/sys/dev/iwn/if_iwnvar.h#5 edit
.. //depot/projects/vap/sys/dev/malo/if_malo.c#3 edit
.. //depot/projects/vap/sys/dev/malo/if_malo.h#3 edit
.. //depot/projects/vap/sys/dev/mwl/if_mwl.c#4 edit
.. //depot/projects/vap/sys/dev/mwl/if_mwlvar.h#2 edit
.. //depot/projects/vap/sys/dev/ral/rt2560.c#24 edit
.. //depot/projects/vap/sys/dev/ral/rt2560var.h#16 edit
.. //depot/projects/vap/sys/dev/ral/rt2661.c#21 edit
.. //depot/projects/vap/sys/dev/ral/rt2661var.h#12 edit
.. //depot/projects/vap/sys/dev/usb/if_rum.c#14 edit
.. //depot/projects/vap/sys/dev/usb/if_rumvar.h#9 edit
.. //depot/projects/vap/sys/dev/usb/if_ural.c#17 edit
.. //depot/projects/vap/sys/dev/usb/if_uralvar.h#11 edit
.. //depot/projects/vap/sys/dev/usb/if_zyd.c#15 edit
.. //depot/projects/vap/sys/dev/usb/if_zydreg.h#8 edit
.. //depot/projects/vap/sys/dev/wi/if_wi.c#24 edit
.. //depot/projects/vap/sys/dev/wi/if_wi_pci.c#7 edit
.. //depot/projects/vap/sys/dev/wi/if_wivar.h#16 edit
.. //depot/projects/vap/sys/dev/wpi/if_wpi.c#17 edit
.. //depot/projects/vap/sys/dev/wpi/if_wpivar.h#7 edit
.. //depot/projects/vap/sys/net80211/ieee80211.c#38 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ddb.c#12 edit
.. //depot/projects/vap/sys/net80211/ieee80211_freebsd.c#26 edit

Differences ...

==== //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#10 (text+ko) ====

@@ -239,7 +239,8 @@
 {
 	struct sample_node *sn = ATH_NODE_SAMPLE(an);
 	struct sample_softc *ssc = ATH_SOFTC_SAMPLE(sc);
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	int ndx, size_bin, mrr, best_ndx, change_rates;
 	unsigned average_tx_time;
 
@@ -491,7 +492,8 @@
 ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an,
 	const struct ath_buf *bf)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct sample_node *sn = ATH_NODE_SAMPLE(an);
 	const struct ath_tx_status *ts = &bf->bf_status.ds_txstat;
 	const struct ath_desc *ds0 = &bf->bf_desc[0];

==== //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.h#6 (text+ko) ====

@@ -155,12 +155,13 @@
 				int length, 
 				int rix, int short_retries, int long_retries) {
 	const HAL_RATE_TABLE *rt = sc->sc_currates;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	int rts, cts;
 	
 	unsigned t_slot = 20;
 	unsigned t_difs = 50; 
 	unsigned t_sifs = 10; 
-	struct ieee80211com *ic = &sc->sc_ic;
 	int tt = 0;
 	int x = 0;
 	int cw = WIFI_CW_MIN;

==== //depot/projects/vap/sys/dev/ath/if_ath.c#60 (text+ko) ====

@@ -288,7 +288,7 @@
 ath_attach(u_int16_t devid, struct ath_softc *sc)
 {
 	struct ifnet *ifp;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic;
 	struct ath_hal *ah = NULL;
 	HAL_STATUS status;
 	int error = 0, i;
@@ -301,6 +301,7 @@
 		error = ENOSPC;
 		goto bad;
 	}
+	ic = ifp->if_l2com;
 
 	/* set these up early for if_printf use */
 	if_initname(ifp, device_get_name(sc->sc_dev),
@@ -689,7 +690,7 @@
 	 *   it last
 	 * Other than that, it's straightforward...
 	 */
-	ieee80211_ifdetach(&sc->sc_ic);
+	ieee80211_ifdetach(ifp->if_l2com);
 #ifdef ATH_TX99_DIAG
 	if (sc->sc_tx99 != NULL)
 		sc->sc_tx99->detach(sc->sc_tx99);
@@ -1245,9 +1246,10 @@
 ath_bmiss_proc(void *arg, int pending)
 {
 	struct ath_softc *sc = arg;
+	struct ifnet *ifp = sc->sc_ifp;
 
 	DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending);
-	ieee80211_beacon_miss(&sc->sc_ic);
+	ieee80211_beacon_miss(ifp->if_l2com);
 }
 
 /*
@@ -1301,7 +1303,8 @@
 static void
 ath_settkipmic(struct ath_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	if ((ic->ic_cryptocaps & IEEE80211_CRYPTO_TKIP) && !sc->sc_wmetkipmic) {
 		if (ic->ic_flags & IEEE80211_F_WME) {
@@ -1318,8 +1321,8 @@
 ath_init(void *arg)
 {
 	struct ath_softc *sc = (struct ath_softc *) arg;
-	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	HAL_STATUS status;
 
@@ -1479,7 +1482,7 @@
 ath_reset(struct ifnet *ifp)
 {
 	struct ath_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	HAL_STATUS status;
 
@@ -1607,6 +1610,7 @@
 static __inline u_int32_t
 ath_ff_approx_txtime(struct ath_softc *sc, struct ath_node *an, struct mbuf *m)
 {
+	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
 	u_int32_t framelen;
 	struct ath_buf *bf;
 
@@ -1620,7 +1624,7 @@
 	 *   - 14: 1 802.3 FF tunnel header (skb already accounts for 2nd)
 	 */
 	framelen = m->m_pkthdr.len + 32 + 4 + 6 + 16 + 14;
-	if (sc->sc_ic.ic_flags & IEEE80211_F_PRIVACY)
+	if (ic->ic_flags & IEEE80211_F_PRIVACY)
 		framelen += 24;
 	bf = an->an_ff_buf[M_WME_GETAC(m)];
 	if (bf != NULL)
@@ -1644,7 +1648,7 @@
 ath_ff_can_aggregate(struct ath_softc *sc,
 	struct ath_node *an, struct mbuf *m, int *flushq)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
 	struct ath_txq *txq;
 	u_int32_t txoplimit;
 	u_int pri;
@@ -1888,7 +1892,7 @@
 ath_start(struct ifnet *ifp)
 {
 	struct ath_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211_node *ni;
 	struct ath_buf *bf;
 	struct mbuf *m, *next;
@@ -2506,8 +2510,8 @@
 static u_int32_t
 ath_calcrxfilter(struct ath_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	u_int32_t rfilt;
 
 #if HAL_ABI_VERSION < 0x08011600
@@ -2595,9 +2599,9 @@
 static void
 ath_mode_init(struct ath_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
-	struct ifnet *ifp = sc->sc_ifp;
 	u_int32_t rfilt;
 
 	/* configure rx filter */
@@ -2628,7 +2632,7 @@
 static void
 ath_setslottime(struct ath_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	u_int usec;
 
@@ -2663,7 +2667,7 @@
 ath_updateslot(struct ifnet *ifp)
 {
 	struct ath_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	/*
 	 * When not coordinating the BSS, change the hardware
@@ -2700,7 +2704,7 @@
 ath_beaconq_config(struct ath_softc *sc)
 {
 #define	ATH_EXPONENT_TO_VALUE(v)	((1<<(v))-1)
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	HAL_TXQ_INFO qi;
 
@@ -2963,7 +2967,7 @@
 	}
 
 	if (sc->sc_stagbeacons) {			/* staggered beacons */
-		struct ieee80211com *ic = &sc->sc_ic;
+		struct ieee80211com *ic = sc->sc_ifp->if_l2com;
 		uint32_t tsftu;
 
 		tsftu = ath_hal_gettsf32(ah) >> 10;
@@ -3243,7 +3247,7 @@
 	((((u_int32_t)(_h)) << 22) | (((u_int32_t)(_l)) >> 10))
 #define	FUDGE	2
 	struct ath_hal *ah = sc->sc_ah;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = sc->sc_ifp->if_l2com;
 	struct ieee80211_node *ni;
 	u_int32_t nexttbtt, intval, tsftu;
 	u_int64_t tsf;
@@ -3894,8 +3898,8 @@
 		((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
 	struct ath_softc *sc = arg;
 	struct ath_buf *bf;
-	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	struct ath_desc *ds;
 	struct ath_rx_status *rs;
@@ -4281,7 +4285,8 @@
 {
 #define	ATH_EXPONENT_TO_VALUE(v)	((1<<v)-1)
 #define	ATH_TXOP_TO_US(v)		(v<<5)
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_txq *txq = sc->sc_ac2q[ac];
 	struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac];
 	struct ath_hal *ah = sc->sc_ah;
@@ -4294,7 +4299,7 @@
 	qi.tqi_burstTime = ATH_TXOP_TO_US(wmep->wmep_txopLimit);
 
 	if (!ath_hal_settxqueueprops(ah, txq->axq_qnum, &qi)) {
-		device_printf(sc->sc_dev, "unable to update hardware queue "
+		if_printf(ifp, "unable to update hardware queue "
 			"parameters for %s traffic!\n",
 			ieee80211_wme_acnames[ac]);
 		return 0;
@@ -4514,9 +4519,9 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ath_vap *avp = ATH_VAP(vap);
-	struct ieee80211com *ic = &sc->sc_ic;
 	struct ath_hal *ah = sc->sc_ah;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	const struct chanAccParams *cap = &ic->ic_wme.wme_chanParams;
 	int error, iswep, ismcast, isfrag, ismrr;
 	int keyix, hdrlen, pktlen, try0;
@@ -4908,7 +4913,8 @@
 ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
 {
 	struct ath_hal *ah = sc->sc_ah;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_buf *bf;
 	struct ath_desc *ds, *ds0;
 	struct ath_tx_status *ts;
@@ -5149,10 +5155,12 @@
 		ATH_TXQ_UNLOCK(txq);
 #ifdef ATH_DEBUG
 		if (sc->sc_debug & ATH_DEBUG_RESET) {
+			struct ieee80211com *ic = sc->sc_ifp->if_l2com;
+
 			ath_printtxbuf(bf, txq->axq_qnum, ix,
 				ath_hal_txprocdesc(ah, bf->bf_desc,
 				    &bf->bf_status.ds_txstat) == HAL_OK);
-			ieee80211_dump_pkt(&sc->sc_ic, mtod(bf->bf_m, caddr_t),
+			ieee80211_dump_pkt(ic, mtod(bf->bf_m, caddr_t),
 				bf->bf_m->m_len, 0, -1);
 		}
 #endif /* ATH_DEBUG */
@@ -5220,7 +5228,7 @@
 			ath_printtxbuf(bf, sc->sc_bhalq, 0,
 				ath_hal_txprocdesc(ah, bf->bf_desc,
 				    &bf->bf_status.ds_txstat) == HAL_OK);
-			ieee80211_dump_pkt(&sc->sc_ic, mtod(bf->bf_m, caddr_t),
+			ieee80211_dump_pkt(ifp->if_l2com, mtod(bf->bf_m, caddr_t),
 				bf->bf_m->m_len, 0, -1);
 		}
 	}
@@ -5340,8 +5348,9 @@
 static int
 ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan)
 {
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
-	struct ieee80211com *ic = &sc->sc_ic;
 	HAL_CHANNEL hchan;
 
 	/*
@@ -5373,7 +5382,7 @@
 		ath_draintxq(sc);		/* clear pending tx frames */
 		ath_stoprecv(sc);		/* turn off frame recv */
 		if (!ath_hal_reset(ah, sc->sc_opmode, &hchan, AH_TRUE, &status)) {
-			if_printf(ic->ic_ifp, "%s: unable to reset "
+			if_printf(ifp, "%s: unable to reset "
 			    "channel %u (%u Mhz, flags 0x%x hal flags 0x%x), "
 			    "hal status %u\n", __func__,
 			    ieee80211_chan2ieee(ic, chan), chan->ic_freq,
@@ -5389,8 +5398,8 @@
 		 * Re-enable rx framework.
 		 */
 		if (ath_startrecv(sc) != 0) {
-			if_printf(ic->ic_ifp,
-				"%s: unable to restart recv logic\n", __func__);
+			if_printf(ifp, "%s: unable to restart recv logic\n",
+			    __func__);
 			return EIO;
 		}
 
@@ -5922,7 +5931,8 @@
 static int
 ath_getchannels(struct ath_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	u_int32_t rd, cc;
 	int error;
@@ -5935,12 +5945,10 @@
 	(void) ath_hal_getregdomain(ah, &rd);
 	ath_hal_getcountrycode(ah, &cc);	/* NB: cannot fail */
 	if (error) {
-		device_printf(sc->sc_dev,
-		    "%s: unable to collect channel list from hal, error %d\n",
-		    __func__, error);
+		if_printf(ifp, "%s: unable to collect channel list from hal, "
+		    "error %d\n", __func__, error);
 		if (error == EINVAL) {
-			device_printf(sc->sc_dev,
-			    "%s: regdomain likely %u country code %u\n",
+			if_printf(ifp, "%s: regdomain likely %u country code %u\n",
 			    __func__, rd, cc);
 		}
 		return error;
@@ -6258,7 +6266,7 @@
 #define	IS_RUNNING(ifp) \
 	((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING))
 	struct ath_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ifreq *ifr = (struct ifreq *)data;
 	int error = 0;
 
@@ -6698,8 +6706,8 @@
 	struct ath_buf *bf, struct mbuf *m0,
 	const struct ieee80211_bpf_params *params)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ath_hal *ah = sc->sc_ah;
 	int error, ismcast, ismrr;
 	int hdrlen, pktlen, try0, txantenna;

==== //depot/projects/vap/sys/dev/ath/if_athvar.h#20 (text+ko) ====

@@ -204,7 +204,6 @@
 struct ath_tx99;
 
 struct ath_softc {
-	struct ieee80211com	sc_ic;		/* NB: must be first */
 	struct ifnet		*sc_ifp;	/* interface common */
 	struct ath_stats	sc_stats;	/* interface statistics */
 	int			sc_debug;

==== //depot/projects/vap/sys/dev/bwi/bwimac.c#3 (text+ko) ====

@@ -833,7 +833,7 @@
 		     uint8_t fw_type)
 {
 	const struct bwi_fwhdr *hdr;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 
 	if (fw->datasize < sizeof(*hdr)) {
 		if_printf(ifp, "invalid firmware (%s): invalid size %zu\n",
@@ -879,7 +879,7 @@
 bwi_mac_fw_alloc(struct bwi_mac *mac)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	char fwname[64];
 	int idx;
 
@@ -1013,7 +1013,7 @@
 bwi_mac_fw_load(struct bwi_mac *mac)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	const uint32_t *fw;
 	uint16_t fw_rev;
 	int fw_len, i;
@@ -1143,7 +1143,7 @@
 bwi_mac_fw_load_iv(struct bwi_mac *mac, const struct firmware *fw)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	const struct bwi_fwhdr *hdr;
 	const struct bwi_fw_iv *iv;
 	int n, i, iv_img_size;
@@ -1220,7 +1220,7 @@
 static int
 bwi_mac_fw_init(struct bwi_mac *mac)
 {
-	struct ifnet *ifp = mac->mac_sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = mac->mac_sc->sc_ifp;
 	int error;
 
 	error = bwi_mac_fw_load_iv(mac, mac->mac_iv);
@@ -1241,7 +1241,8 @@
 bwi_mac_opmode_init(struct bwi_mac *mac)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	uint32_t mac_status;
 	uint16_t pre_tbtt;
 
@@ -1341,6 +1342,8 @@
 {
 	struct bwi_softc *sc = mac->mac_sc;
 	struct bwi_phy *phy = &mac->mac_phy;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct bwi_retry_lim lim;
 	uint16_t cw_min;
 
@@ -1368,7 +1371,7 @@
 	/*
 	 * Set MAC level acknowledge rates
 	 */
-	bwi_mac_set_ackrates(mac, &sc->sc_ic.ic_sup_rates[phy->phy_mode]);
+	bwi_mac_set_ackrates(mac, &ic->ic_sup_rates[phy->phy_mode]);
 
 	/*
 	 * Set CW min
@@ -1911,7 +1914,8 @@
 bwi_mac_lock(struct bwi_mac *mac)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	KASSERT((mac->mac_flags & BWI_MAC_F_LOCKED) == 0,
 	    ("mac_flags 0x%x", mac->mac_flags));
@@ -1934,7 +1938,8 @@
 bwi_mac_unlock(struct bwi_mac *mac)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	KASSERT(mac->mac_flags & BWI_MAC_F_LOCKED,
 	    ("mac_flags 0x%x", mac->mac_flags));

==== //depot/projects/vap/sys/dev/bwi/bwiphy.c#2 (text+ko) ====

@@ -430,7 +430,7 @@
 bwi_phy_init_11b_rev2(struct bwi_mac *mac)
 { 
 	/* TODO:11B */
-	if_printf(mac->mac_sc->sc_ic.ic_ifp,
+	if_printf(mac->mac_sc->sc_ifp,
 		  "%s is not implemented yet\n", __func__);
 }
 
@@ -438,7 +438,7 @@
 bwi_phy_init_11b_rev4(struct bwi_mac *mac)
 {
 	/* TODO:11B */
-	if_printf(mac->mac_sc->sc_ic.ic_ifp,
+	if_printf(mac->mac_sc->sc_ifp,
 		  "%s is not implemented yet\n", __func__);
 }
 

==== //depot/projects/vap/sys/dev/bwi/bwirf.c#3 (text+ko) ====

@@ -1238,7 +1238,7 @@
 bwi_rf_lo_update(struct bwi_mac *mac)
 {
 	struct bwi_softc *sc = mac->mac_sc;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct bwi_rf *rf = &mac->mac_rf;
 	struct bwi_phy *phy = &mac->mac_phy;
 	struct bwi_tpctl *tpctl = &mac->mac_tpctl;
@@ -1440,7 +1440,7 @@
 	static const int rf_lo_measure_order[RF_ATTEN_LISTSZ] =
 	{ 3, 1, 5, 7, 9, 2, 0, 4, 6, 8, 10, 11, 12, 13 };
 
-	struct ifnet *ifp = mac->mac_sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = mac->mac_sc->sc_ifp;
 	struct bwi_rf_lo lo_save, *lo;
 	uint8_t devi_ctrl = 0;
 	int idx, adj_rf7a = 0;

==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#6 (text+ko) ====

@@ -350,7 +350,7 @@
 int
 bwi_attach(struct bwi_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic;
 	device_t dev = sc->sc_dev;
 	struct ifnet *ifp;
 	struct bwi_mac *mac;
@@ -449,6 +449,7 @@
 		error = ENOSPC;
 		goto fail;
 	}
+	ic = ifp->if_l2com;
 
 	/* set these up early for if_printf use */
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
@@ -573,6 +574,7 @@
 bwi_detach(struct bwi_softc *sc)
 {
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	int i;
 
 	BWI_LOCK(sc);
@@ -580,7 +582,7 @@
 	BWI_UNLOCK(sc);
 
 	callout_drain(&sc->sc_calib_ch);
-	ieee80211_ifdetach(&sc->sc_ic);
+	ieee80211_ifdetach(ic);
 
 	for (i = 0; i < sc->sc_nmac; ++i)
 		bwi_mac_detach(&sc->sc_mac[i]);
@@ -1230,8 +1232,8 @@
 static void
 bwi_init_statechg(struct bwi_softc *sc, int statechg)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct bwi_mac *mac;
 	int error;
 
@@ -1315,7 +1317,7 @@
 #define	IS_RUNNING(ifp) \
 	((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING))
 	struct bwi_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ifreq *ifr = (struct ifreq *)req;
 	int error = 0;
 
@@ -1515,8 +1517,7 @@
 static void
 bwi_stop(struct bwi_softc *sc, int statechg)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct bwi_mac *mac;
 	int i, error, pwr_off = 0;
 
@@ -1563,8 +1564,8 @@
 bwi_intr(void *xsc)
 {
 	struct bwi_softc *sc = xsc;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct bwi_mac *mac;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
 	uint32_t intr_status;
 	uint32_t txrx_intr_status[BWI_TXRX_NRING];
 	int i, txrx_error, tx = 0, rx_data = -1;
@@ -2604,8 +2605,8 @@
 {
 	struct bwi_ring_data *rd = &sc->sc_rx_rdata;
 	struct bwi_rxbuf_data *rbd = &sc->sc_rx_bdata;
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	int idx, rx_data = 0;
 
 	idx = rbd->rbd_idx;
@@ -2784,7 +2785,7 @@
 {
 	struct bwi_ring_data *rd;
 	struct bwi_txbuf_data *tbd;
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	uint32_t state, val;
 	int i;
 
@@ -2959,8 +2960,8 @@
 	  struct ieee80211_node *ni)
 {
 	struct ieee80211vap *vap = ni->ni_vap;
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct bwi_ring_data *rd = &sc->sc_tx_rdata[BWI_TX_DATA_RING];
 	struct bwi_txbuf_data *tbd = &sc->sc_tx_bdata[BWI_TX_DATA_RING];
 	struct bwi_txbuf *tb = &tbd->tbd_buf[idx];
@@ -3319,7 +3320,7 @@
 static void
 bwi_txeof_status32(struct bwi_softc *sc)
 {
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	uint32_t val, ctrl_base;
 	int end_idx;
 
@@ -3347,7 +3348,7 @@
 static void
 _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt)
 {
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct bwi_txbuf_data *tbd;
 	struct bwi_txbuf *tb;
 	int ring_idx, buf_idx;
@@ -3439,7 +3440,7 @@
 static void
 bwi_txeof(struct bwi_softc *sc)
 {
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 
 	for (;;) {
 		uint32_t tx_status0, tx_status1;
@@ -3711,7 +3712,8 @@
 static void
 bwi_set_bssid(struct bwi_softc *sc, const uint8_t *bssid)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct bwi_mac *mac;
 	struct bwi_myaddr_bssid buf;
 	const uint8_t *p;
@@ -3744,7 +3746,7 @@
 bwi_updateslot(struct ifnet *ifp)
 {
 	struct bwi_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct bwi_mac *mac;
 
 	BWI_LOCK(sc);
@@ -3764,12 +3766,16 @@
 bwi_calibrate(void *xsc)
 {
 	struct bwi_softc *sc = xsc;
+#ifdef INVARIANTS
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
+#endif
 	struct bwi_mac *mac;
 
 	BWI_ASSERT_LOCKED(sc);
 
-	KASSERT(sc->sc_ic.ic_opmode != IEEE80211_M_MONITOR,
-	    ("opmode %d", sc->sc_ic.ic_opmode));
+	KASSERT(ic->ic_opmode != IEEE80211_M_MONITOR,
+	    ("opmode %d", ic->ic_opmode));
 
 	KASSERT(sc->sc_cur_regwin->rw_type == BWI_REGWIN_T_MAC,
 	    ("current regwin type %d", sc->sc_cur_regwin->rw_type));
@@ -3914,7 +3920,8 @@
 static void
 bwi_led_newstate(struct bwi_softc *sc, enum ieee80211_state nstate)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	uint16_t val;
 	int i;
 

==== //depot/projects/vap/sys/dev/bwi/if_bwivar.h#4 (text+ko) ====

@@ -545,7 +545,6 @@
 #define	BWI_VAP(vap)	((struct bwi_vap *)(vap))
 
 struct bwi_softc {
-	struct ieee80211com	sc_ic;		/* NB: must be first */
 	struct ifnet		*sc_ifp;
 	uint32_t		sc_flags;	/* BWI_F_ */
 	device_t		sc_dev;

==== //depot/projects/vap/sys/dev/ipw/if_ipw.c#10 (text+ko) ====

@@ -224,7 +224,7 @@
 {
 	struct ipw_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic;
 	struct ieee80211_channel *c;
 	uint16_t val;
 	int error, i;
@@ -285,6 +285,7 @@
 		device_printf(dev, "can not if_alloc()\n");
 		goto fail;
 	}
+	ic = ifp->if_l2com;
 
 	ifp->if_softc = sc;
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
@@ -392,8 +393,8 @@
 ipw_detach(device_t dev)
 {
 	struct ipw_softc *sc = device_get_softc(dev);
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	ipw_stop(sc);
 	callout_drain(&sc->sc_wdtimer);
@@ -777,7 +778,7 @@
 ipw_resume(device_t dev)
 {
 	struct ipw_softc *sc = device_get_softc(dev);
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
@@ -956,7 +957,8 @@
 ipw_rx_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf)
 {
 #define	IEEESTATE(vap)	ieee80211_state_name[vap->iv_state]
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	uint32_t state;
 
@@ -1045,7 +1047,8 @@
 static void
 ipw_setcurchan(struct ipw_softc *sc, struct ieee80211_channel *chan)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	ic->ic_curchan = chan;
 	sc->sc_rxtap.wr_chan_freq = sc->sc_txtap.wt_chan_freq =
@@ -1061,7 +1064,8 @@
 static void
 ipw_fix_channel(struct ipw_softc *sc, struct mbuf *m)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211_channel *c;
 	struct ieee80211_frame *wh;
 	uint8_t subtype;
@@ -1106,8 +1110,8 @@
 ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status,
     struct ipw_soft_bd *sbd, struct ipw_soft_buf *sbuf)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct mbuf *mnew, *m;
 	struct ieee80211_node *ni;
 	bus_addr_t physaddr;
@@ -1195,7 +1199,8 @@
 static void
 ipw_rx_intr(struct ipw_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	struct ipw_status *status;
 	struct ipw_soft_bd *sbd;
@@ -1299,7 +1304,7 @@
 static void
 ipw_tx_intr(struct ipw_softc *sc)
 {
-	struct ifnet *ifp = sc->sc_ic.ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
 	struct ipw_soft_bd *sbd;
 	uint32_t r, i;
 
@@ -1502,7 +1507,8 @@
 ipw_tx_start(struct ifnet *ifp, struct mbuf *m0, struct ieee80211_node *ni)
 {
 	struct ipw_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211_frame *wh;
 	struct ipw_soft_bd *sbd;
 	struct ipw_soft_hdr *shdr;
@@ -1696,8 +1702,8 @@
 ipw_watchdog(void *arg)
 {
 	struct ipw_softc *sc = arg;
-	struct ieee80211com *ic = &sc->sc_ic;
 	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 
 	IPW_LOCK_ASSERT(sc);
 
@@ -1727,7 +1733,8 @@
 ipw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
 	struct ipw_softc *sc = ifp->if_softc;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ifreq *ifr = (struct ifreq *) data;
 	int error = 0;
 	IPW_LOCK_DECL;
@@ -1970,7 +1977,8 @@
 static int
 ipw_setwepkeys(struct ipw_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	struct ipw_wep_key wepkey;
 	struct ieee80211_key *wk;
@@ -2127,7 +2135,8 @@
 static int
 ipw_setchannel(struct ipw_softc *sc, struct ieee80211_channel *chan)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	uint32_t data;
 	int error;
 
@@ -2142,9 +2151,9 @@
 static int
 ipw_config(struct ipw_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
-	struct ifnet *ifp = ic->ic_ifp;
 	struct ipw_security security;
 	struct ipw_configuration config;
 	uint32_t data;
@@ -2338,7 +2347,8 @@
 static int
 ipw_auth_and_assoc(struct ipw_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	struct ieee80211_node *ni = vap->iv_bss;
 	struct ipw_security security;
@@ -2426,7 +2436,8 @@
 static int
 ipw_disassociate(struct ipw_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	struct ieee80211_node *ni = vap->iv_bss;
 
@@ -2472,7 +2483,8 @@
 static void
 ipw_init_locked(struct ipw_softc *sc, int force)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	struct ifnet *ifp = ic->ic_ifp;
 	const struct firmware *fp;
@@ -2629,8 +2641,8 @@
 static void
 ipw_stop_locked(struct ipw_softc *sc)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ifnet *ifp = ic->ic_ifp;
+	struct ifnet *ifp = sc->sc_ifp;
+	struct ieee80211com *ic = ifp->if_l2com;
 	int i;
 
 	IPW_LOCK_ASSERT(sc);

==== //depot/projects/vap/sys/dev/ipw/if_ipwvar.h#8 (text+ko) ====

@@ -85,7 +85,6 @@
 #define	IPW_VAP(vap)	((struct ipw_vap *)(vap))
 
 struct ipw_softc {
-	struct ieee80211com		sc_ic;		/* NB: must be first */
 	struct ifnet			*sc_ifp;
 	device_t			sc_dev;
 

==== //depot/projects/vap/sys/dev/iwi/if_iwi.c#16 (text+ko) ====

@@ -263,7 +263,7 @@
 {
 	struct iwi_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp;
-	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211com *ic;
 	uint16_t val;
 	int i, error;
 	uint8_t bands;
@@ -357,7 +357,8 @@
 		device_printf(dev, "can not if_alloc()\n");
 		goto fail;
 	}
-	ic->ic_ifp = ifp;
+	ic = ifp->if_l2com;

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804042316.m34NGgvK031938>