diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2010-02-15 17:16:37 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2010-02-15 17:16:37 +0000 |
commit | 105823b115013ae932d1c4970a5eec712ec9b2b1 (patch) | |
tree | ad7092b8e3148f49f06a44bfff6a71b64806965a | |
parent | b5a080b794e031d881900e603cf4cd20afcd2a7d (diff) |
Properly detect when the band changes from 2GHz to 5GHz and
vice-versa, and do a full reset of the chip when it happens.
This does not affect the AR9280 since a full reset is always
necessary when the channel changes.
Should fix dual-band AR5416 devices (problem reported by Rivo Nurges).
-rw-r--r-- | sys/dev/ic/athn.c | 13 | ||||
-rw-r--r-- | sys/dev/ic/athnvar.h | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index 2985ae96b37..e2806b3c300 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.23 2010/02/15 17:00:41 damien Exp $ */ +/* $OpenBSD: athn.c,v 1.24 2010/02/15 17:16:36 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -1233,6 +1233,9 @@ athn_set_chan(struct athn_softc *sc, struct ieee80211_channel *c, if ((error = ops->set_synth(sc, c, extc)) != 0) return (error); + sc->curchan = c; + sc->curchanext = extc; + /* Set transmit power values for new channel. */ ops->set_txpower(sc, c, extc); @@ -1256,7 +1259,6 @@ int athn_switch_chan(struct athn_softc *sc, struct ieee80211_channel *c, struct ieee80211_channel *extc) { - struct ieee80211com *ic = &sc->sc_ic; int error, qid; /* Disable interrupts. */ @@ -1284,7 +1286,8 @@ athn_switch_chan(struct athn_softc *sc, struct ieee80211_channel *c, goto reset; /* If band or bandwidth changes, we need to do a full reset. */ - if (c->ic_flags != ic->ic_bss->ni_chan->ic_flags) { + if (c->ic_flags != sc->curchan->ic_flags || + ((extc != NULL) ^ (sc->curchanext != NULL))) { DPRINTFN(2, ("channel band switch\n")); goto reset; } @@ -4635,8 +4638,8 @@ athn_init(struct ifnet *ifp) struct ieee80211_channel *c, *extc; int i, error; - c = ic->ic_bss->ni_chan = ic->ic_ibss_chan; - extc = NULL; + c = sc->curchan = ic->ic_bss->ni_chan = ic->ic_ibss_chan; + extc = sc->curchanext = NULL; /* In case a new MAC address has been configured. */ IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl)); diff --git a/sys/dev/ic/athnvar.h b/sys/dev/ic/athnvar.h index 95f01507b8a..8b6fc424e0c 100644 --- a/sys/dev/ic/athnvar.h +++ b/sys/dev/ic/athnvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athnvar.h,v 1.7 2010/01/27 18:26:45 damien Exp $ */ +/* $OpenBSD: athnvar.h,v 1.8 2010/02/15 17:16:36 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -394,6 +394,9 @@ struct athn_softc { #define ATHN_CAL_ADC_GAIN (1 << 1) #define ATHN_CAL_ADC_DC (1 << 2) + struct ieee80211_channel *curchan; + struct ieee80211_channel *curchanext; + /* Open Loop Power Control. */ int8_t tx_gain_tbl[AR9280_TX_GAIN_TABLE_SIZE]; int8_t pdadc; |