PERFORCE change 80698 for review
Sam Leffler
sam at FreeBSD.org
Thu Jul 21 20:07:49 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=80698
Change 80698 by sam at sam_ebb on 2005/07/21 20:06:53
checkpoint old mods
Affected files ...
.. //depot/projects/vap/sys/conf/files#4 edit
.. //depot/projects/vap/sys/dev/ath/if_ath.c#17 edit
.. //depot/projects/vap/sys/dev/ath/if_athvar.h#8 edit
.. //depot/projects/vap/sys/dev/iwi/if_iwi.c#5 edit
.. //depot/projects/vap/sys/dev/wi/if_wi.c#6 edit
Differences ...
==== //depot/projects/vap/sys/conf/files#4 (text+ko) ====
@@ -1384,6 +1384,7 @@
net80211/ieee80211_ioctl.c optional wlan
net80211/ieee80211_node.c optional wlan
net80211/ieee80211_output.c optional wlan
+net80211/ieee80211_power.c optional wlan
net80211/ieee80211_proto.c optional wlan
net80211/ieee80211_regdomain.c optional wlan
net80211/ieee80211_scan.c optional wlan
==== //depot/projects/vap/sys/dev/ath/if_ath.c#17 (text+ko) ====
@@ -516,6 +516,7 @@
| IEEE80211_C_WPA /* capable of WPA1+WPA2 */
| IEEE80211_C_BGSCAN /* capable of bg scanning */
| IEEE80211_C_WDS /* 4-address frames supported */
+ | IEEE80211_C_PMGT /* power management supported */
;
/*
* Query the hal to figure out h/w crypto support.
@@ -1284,7 +1285,7 @@
* (and system). This varies by chip and is mostly an
* issue with newer parts that go to sleep more quickly.
*/
- ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP, 0);
+ ath_hal_setpower(sc->sc_ah, HAL_PM_FULL_SLEEP);
}
ATH_UNLOCK(sc);
}
@@ -4193,9 +4194,9 @@
* Calculate Atheros packet type from IEEE80211 packet header,
* setup for rate calculations, and select h/w transmit queue.
*/
+ subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
switch (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) {
case IEEE80211_FC0_TYPE_MGT:
- subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
if (subtype == IEEE80211_FC0_SUBTYPE_BEACON)
atype = HAL_PKT_TYPE_BEACON;
else if (subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP)
@@ -4204,6 +4205,7 @@
atype = HAL_PKT_TYPE_ATIM;
else
atype = HAL_PKT_TYPE_NORMAL; /* XXX */
+ mgtframe:
rix = sc->sc_minrateix;
txrate = rt->info[rix].rateCode;
if (shortPreamble)
@@ -4221,6 +4223,8 @@
break;
case IEEE80211_FC0_TYPE_DATA:
atype = HAL_PKT_TYPE_NORMAL; /* default */
+ if (subtype == IEEE80211_FC0_SUBTYPE_NODATA)
+ goto mgtframe;
/*
* Data frames; consult the rate control module.
*/
@@ -4600,6 +4604,8 @@
bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap,
BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap);
+ if (bf->bf_m->m_flags & M_PWR_DOWN)
+ sc->sc_pwrdownrdy = 1;
m_freem(bf->bf_m);
bf->bf_m = NULL;
bf->bf_node = NULL;
@@ -4624,6 +4630,23 @@
return (txqs & (1<<qnum));
}
+static void
+tx_proc_finish(struct ath_softc *sc, struct ifnet *ifp)
+{
+ ifp->if_flags &= ~IFF_OACTIVE;
+ ath_start(ifp);
+
+ if (sc->sc_softled)
+ ath_led_event(sc, ATH_LED_TX);
+
+ if (sc->sc_dopwrsav && sc->sc_pwrdownrdy) {
+if_printf(ifp, "%s: power down\n", __func__);/*XXX*/
+ ath_hal_setpower(sc->sc_ah, HAL_PM_NETWORK_SLEEP);
+ sc->sc_pwrdownrdy = 0;
+ sc->sc_dopwrsav = 0;
+ }
+}
+
/*
* Deferred processing of transmit interrupt; special-cased
* for a single hardware transmit queue (e.g. 5210 and 5211).
@@ -4641,11 +4664,7 @@
if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum))
ath_tx_processq(sc, sc->sc_cabq);
- ifp->if_flags &= ~IFF_OACTIVE;
- ath_start(ifp);
-
- if (sc->sc_softled)
- ath_led_event(sc, ATH_LED_TX);
+ tx_proc_finish(sc, ifp);
}
/*
@@ -4674,11 +4693,7 @@
if (txqactive(sc->sc_ah, sc->sc_cabq->axq_qnum))
ath_tx_processq(sc, sc->sc_cabq);
- ifp->if_flags &= ~IFF_OACTIVE;
- ath_start(ifp);
-
- if (sc->sc_softled)
- ath_led_event(sc, ATH_LED_TX);
+ tx_proc_finish(sc, ifp);
}
/*
@@ -4700,11 +4715,7 @@
if (ATH_TXQ_SETUP(sc, i) && txqactive(sc->sc_ah, i))
ath_tx_processq(sc, &sc->sc_txq[i]);
- ifp->if_flags &= ~IFF_OACTIVE;
- ath_start(ifp);
-
- if (sc->sc_softled)
- ath_led_event(sc, ATH_LED_TX);
+ tx_proc_finish(sc, ifp);
}
static void
@@ -5074,6 +5085,20 @@
ieee80211_state_name[nstate]);
callout_stop(&sc->sc_cal_ch);
+ if (vap->iv_state == IEEE80211_S_SLEEP) {
+ /*
+ * We were asleep, wake the chip up before
+ * touching any hardware.
+ */
+ sc->sc_dopwrsav = 0;
+ ath_hal_setpower(ah, HAL_PM_AWAKE);
+ /*
+ * SLEEP -> RUN just involves waking the hardware and
+ * restarting the calibration timer, so we're done...
+ */
+ if (nstate == IEEE80211_S_RUN)
+ goto done;
+ }
ath_hal_setledstate(ah, leds[nstate]); /* set LED */
if (nstate == IEEE80211_S_INIT) {
@@ -5089,6 +5114,10 @@
ath_rate_newstate(vap, nstate);
goto done;
}
+ if (nstate == IEEE80211_S_SLEEP) {
+ sc->sc_dopwrsav = 1; /* defer to after null data frame */
+ goto done;
+ }
ni = vap->iv_bss;
rfilt = ath_calcrxfilter(sc);
==== //depot/projects/vap/sys/dev/ath/if_athvar.h#8 (text+ko) ====
@@ -252,7 +252,9 @@
sc_hasbmask: 1, /* bssid mask support */
sc_hastsfadd:1, /* tsf adjust support */
sc_scanning: 1, /* scanning active */
- sc_syncbeacon:1;/* sync/resync beacon timers */
+ sc_syncbeacon:1,/* sync/resync beacon timers */
+ sc_dopwrsav: 1, /* pwr save switch pending */
+ sc_pwrdownrdy:1;/* ready to power down */
/* rate tables */
const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX];
const HAL_RATE_TABLE *sc_currates; /* current rate table */
@@ -411,8 +413,8 @@
((*(_ah)->ah_getPendingInterrupts)((_ah), (_pmask)))
#define ath_hal_updatetxtriglevel(_ah, _inc) \
((*(_ah)->ah_updateTxTrigLevel)((_ah), (_inc)))
-#define ath_hal_setpower(_ah, _mode, _sleepduration) \
- ((*(_ah)->ah_setPowerMode)((_ah), (_mode), AH_TRUE, (_sleepduration)))
+#define ath_hal_setpower(_ah, _mode) \
+ ((*(_ah)->ah_setPowerMode)((_ah), (_mode), AH_TRUE))
#define ath_hal_keycachesize(_ah) \
((*(_ah)->ah_getKeyCacheSize)((_ah)))
#define ath_hal_keyreset(_ah, _ix) \
==== //depot/projects/vap/sys/dev/iwi/if_iwi.c#5 (text+ko) ====
@@ -112,7 +112,8 @@
{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
static struct ieee80211vap *iwi_vap_create(struct ieee80211com *,
- const char name[IFNAMSIZ], int unit, int opmode);
+ const char name[IFNAMSIZ], int unit, int opmode,
+ int flags);
static void iwi_vap_delete(struct ieee80211vap *);
static int iwi_dma_alloc(struct iwi_softc *);
static void iwi_release(struct iwi_softc *);
@@ -322,7 +323,7 @@
}
/* IBSS channel undefined for now */
- ic->ic_ibss_chan = &ic->ic_channels[0];
+ ic->ic_bsschan = &ic->ic_channels[0];
ieee80211_ifattach(ic);
ic->ic_vap_create = iwi_vap_create;
@@ -407,7 +408,7 @@
static struct ieee80211vap *
iwi_vap_create(struct ieee80211com *ic,
- const char name[IFNAMSIZ], int unit, int opmode)
+ const char name[IFNAMSIZ], int unit, int opmode, int flags)
{
struct ieee80211vap *vap;
==== //depot/projects/vap/sys/dev/wi/if_wi.c#6 (text+ko) ====
@@ -2770,6 +2770,7 @@
case IEEE80211_S_SCAN:
case IEEE80211_S_AUTH:
case IEEE80211_S_ASSOC:
+ case IEEE80211_S_SLEEP: /* XXX? */
vap->iv_state = nstate; /* NB: skip normal ieee80211 handling */
break;
More information about the p4-projects
mailing list