linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] ath9k: first series for regulatory cleanup
@ 2008-12-20  5:55 Luis R. Rodriguez
  2008-12-20  5:55 ` [PATCH 01/16] mac80211: add HT conf helpers Luis R. Rodriguez
  2008-12-20 19:10 ` [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
  0 siblings, 2 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

This is the first series of general cleanup to get us into
abandon our complex internal regulatory infrastructure. This is
quite a lot of work as we rely on our own internal "mode" stuff
and our own ath9k_channel heavily.

We start this work by ditching the mode stuff where we can
and set a staging ground for us to abandon our own internal
ath9k_channel. The values which we want to actually keep from
ath9k_channel are the calibration data. Since it seems other
drivers can make use of this we add a priv section to
ieee80211_channel and start making use of this in ath9k.

The next series will deal more with this and then slowly start
to nuke our complex regulatory infrastructure in favor for
internal generic CRDA/cfg80211 regulatory infrastructure.

This work is all being done so we won't have to malloc() all
over again our new set of channels on country IE changes as
doing that would be a bit messy. We will instead prefer to use
static channels.

This should not have any major functional changes, its mostly
cleanup stuff. I've tested HT20 on 2 GHz, will test 5 GHz tomorrow
with the HT20/HT40 configurations but I figured I'll get this out
today. If someone beats me to testing 5 GHz HT20/HT40 configs me
please let me know.

Luis R. Rodriguez (16):
  mac80211: add HT conf helpers
  ath9k: use hw->conf on ath_setcurmode()
  ath9k: remove cache of rate preference when using 11g protection
  ath9k: Rename ath_setcurmode() to ath_cache_conf_rate()
  wireless: allow for private channel area
  ath9k: start making use of channel->priv
  ath9k: consolidate arguments on hw reset
  ath9k: make request to get the noisefloor threshold band specific
  ath9k: use ieee80211_conf on ath9k_hw_iscal_supported()
  ath9k: make use of conf_is_ht40() in the rest of the driver
  ath9k: Make ANI CCK and OFDM error triggers band specific
  ath9k: remove mode specific default noise floor values
  ath9k: remove ath9k_hw_chan2wmode()
  ath9k: remove ath9k_hw_check_chan()
  ath9k: remove superfluous check on changing channel
  ath9k: fix sparse warnings

 drivers/net/wireless/ath9k/ani.c    |   12 +-
 drivers/net/wireless/ath9k/ath9k.h  |   13 +-
 drivers/net/wireless/ath9k/calib.c  |  103 +++++-------
 drivers/net/wireless/ath9k/core.h   |    1 -
 drivers/net/wireless/ath9k/eeprom.c |   30 ++--
 drivers/net/wireless/ath9k/hw.c     |  210 +++++++-----------------
 drivers/net/wireless/ath9k/hw.h     |    8 +
 drivers/net/wireless/ath9k/main.c   |  317 +++++++++++++++-------------------
 drivers/net/wireless/ath9k/xmit.c   |   27 ++--
 include/net/mac80211.h              |   40 +++++
 include/net/wireless.h              |    3 +
 11 files changed, 334 insertions(+), 430 deletions(-)


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 01/16] mac80211: add HT conf helpers
  2008-12-20  5:55 [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
@ 2008-12-20  5:55 ` Luis R. Rodriguez
  2008-12-20  5:55   ` [PATCH 02/16] ath9k: use hw->conf on ath_setcurmode() Luis R. Rodriguez
  2008-12-20 21:06   ` [PATCH 01/16] mac80211: add HT conf helpers Tomas Winkler
  2008-12-20 19:10 ` [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
  1 sibling, 2 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville, johannes
  Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel, buytenh

In HT capable drivers you often need to check if you
are currently using HT20 or HT40. This adds a few small
helpers to let drivers figure that out.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/net/mac80211.h |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b3bd00a..33891f9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1963,4 +1963,44 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
 int ieee80211_rate_control_register(struct rate_control_ops *ops);
 void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
 
+static inline bool
+conf_is_ht20(struct ieee80211_conf *conf)
+{
+	if (conf->ht.channel_type == NL80211_CHAN_HT20)
+		return true;
+	return false;
+}
+
+static inline bool
+conf_is_ht40_minus(struct ieee80211_conf *conf)
+{
+	if (conf->ht.channel_type == NL80211_CHAN_HT40MINUS)
+		return true;
+	return false;
+}
+
+static inline bool
+conf_is_ht40_plus(struct ieee80211_conf *conf)
+{
+	if (conf->ht.channel_type == NL80211_CHAN_HT40PLUS)
+		return true;
+	return false;
+}
+
+static inline bool
+conf_is_ht40(struct ieee80211_conf *conf)
+{
+	if (conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf))
+		return true;
+	return false;
+}
+
+static inline bool
+conf_is_ht(struct ieee80211_conf *conf)
+{
+	if (conf_is_ht20(conf) || conf_is_ht40(conf))
+		return true;
+	return false;
+}
+
 #endif /* MAC80211_H */
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 02/16] ath9k: use hw->conf on ath_setcurmode()
  2008-12-20  5:55 ` [PATCH 01/16] mac80211: add HT conf helpers Luis R. Rodriguez
@ 2008-12-20  5:55   ` Luis R. Rodriguez
  2008-12-20  5:55     ` [PATCH 03/16] ath9k: remove cache of rate preference when using 11g protection Luis R. Rodriguez
  2008-12-20 21:06   ` [PATCH 01/16] mac80211: add HT conf helpers Tomas Winkler
  1 sibling, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

We don't need to use our own mode for setting the
the routine tries to do, in fact lets remove ath_chan2mode() now as
we can simply use the currently set band and the HT configuration
provided by mac80211 through the ieee80211_conf. This works on
changing channels as well as the internal ath9k_channel we use is
based on the ieee80211_channel in the config.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/main.c |   70 ++++++++++++++++++++-----------------
 1 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 70affb7..a1bd611 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -59,41 +59,45 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
 		*csz = DEFAULT_CACHELINE >> 2;   /* Use the default size */
 }
 
-static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode)
+static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
 {
-	sc->cur_rate_table = sc->hw_rate_table[mode];
 	/*
 	 * All protection frames are transmited at 2Mb/s for
 	 * 11g, otherwise at 1Mb/s.
 	 * XXX select protection rate index from rate table.
 	 */
-	sc->sc_protrix = (mode == ATH9K_MODE_11G ? 1 : 0);
-}
-
-static enum wireless_mode ath_chan2mode(struct ath9k_channel *chan)
-{
-	if (chan->chanmode == CHANNEL_A)
-		return ATH9K_MODE_11A;
-	else if (chan->chanmode == CHANNEL_G)
-		return ATH9K_MODE_11G;
-	else if (chan->chanmode == CHANNEL_B)
-		return ATH9K_MODE_11B;
-	else if (chan->chanmode == CHANNEL_A_HT20)
-		return ATH9K_MODE_11NA_HT20;
-	else if (chan->chanmode == CHANNEL_G_HT20)
-		return ATH9K_MODE_11NG_HT20;
-	else if (chan->chanmode == CHANNEL_A_HT40PLUS)
-		return ATH9K_MODE_11NA_HT40PLUS;
-	else if (chan->chanmode == CHANNEL_A_HT40MINUS)
-		return ATH9K_MODE_11NA_HT40MINUS;
-	else if (chan->chanmode == CHANNEL_G_HT40PLUS)
-		return ATH9K_MODE_11NG_HT40PLUS;
-	else if (chan->chanmode == CHANNEL_G_HT40MINUS)
-		return ATH9K_MODE_11NG_HT40MINUS;
-
-	WARN_ON(1); /* should not get here */
-
-	return ATH9K_MODE_11B;
+	sc->sc_protrix = 0;
+	switch (conf->channel->band) {
+	case IEEE80211_BAND_2GHZ:
+		/* If the IEEE ends up deciding to support HT40 on 2 GHz
+		 * then we can map the HT40+ or HT40- to the appropriate rate
+		 * table then. For now only HT20 is only supported by
+		 * mac80211 */
+		if (conf_is_ht20(conf))
+			sc->cur_rate_table =
+			  sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
+		else {
+			sc->sc_protrix = 1;
+			sc->cur_rate_table =
+			  sc->hw_rate_table[ATH9K_MODE_11G];
+		}
+		break;
+	case IEEE80211_BAND_5GHZ:
+		if (conf_is_ht20(conf))
+			sc->cur_rate_table =
+			  sc->hw_rate_table[ATH9K_MODE_11NA_HT20];
+		else if (conf_is_ht40_minus(conf))
+			sc->cur_rate_table =
+			  sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS];
+		else if (conf_is_ht40_plus(conf))
+			sc->cur_rate_table =
+			  sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
+		else
+			sc->cur_rate_table = sc->hw_rate_table[ATH9K_MODE_11A];
+		break;
+	default:
+		break;
+	}
 }
 
 static void ath_update_txpow(struct ath_softc *sc)
@@ -258,6 +262,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
 {
 	struct ath_hal *ah = sc->sc_ah;
 	bool fastcc = true, stopped;
+	struct ieee80211_hw *hw = sc->hw;
 
 	if (sc->sc_flags & SC_OP_INVALID)
 		return -EIO;
@@ -316,7 +321,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
 			return -EIO;
 		}
 
-		ath_setcurmode(sc, ath_chan2mode(hchan));
+		ath_setcurmode(sc, &hw->conf);
 		ath_update_txpow(sc);
 		ath9k_hw_set_interrupts(ah, sc->sc_imask);
 	}
@@ -1621,6 +1626,7 @@ detach:
 int ath_reset(struct ath_softc *sc, bool retry_tx)
 {
 	struct ath_hal *ah = sc->sc_ah;
+	struct ieee80211_hw *hw = sc->hw;
 	int status;
 	int error = 0;
 
@@ -1648,7 +1654,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 	 * that changes the channel so update any state that
 	 * might change as a result.
 	 */
-	ath_setcurmode(sc, ath_chan2mode(sc->sc_ah->ah_curchan));
+	ath_setcurmode(sc, &hw->conf);
 
 	ath_update_txpow(sc);
 
@@ -1945,7 +1951,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	    !sc->sc_config.swBeaconProcess)
 		sc->sc_imask |= ATH9K_INT_TIM;
 
-	ath_setcurmode(sc, ath_chan2mode(init_channel));
+	ath_setcurmode(sc, &hw->conf);
 
 	sc->sc_flags &= ~SC_OP_INVALID;
 
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 03/16] ath9k: remove cache of rate preference when using 11g protection
  2008-12-20  5:55   ` [PATCH 02/16] ath9k: use hw->conf on ath_setcurmode() Luis R. Rodriguez
@ 2008-12-20  5:55     ` Luis R. Rodriguez
  2008-12-20  5:55       ` [PATCH 04/16] ath9k: Rename ath_setcurmode() to ath_cache_conf_rate() Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

No need to cache when we want to use 2Mbit/s for all protection
frames for 802.11g as we can determine that dynamically on
ath_buf_set_rate() itself.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/core.h |    1 -
 drivers/net/wireless/ath9k/main.c |   16 ++++------------
 drivers/net/wireless/ath9k/xmit.c |   13 ++++++++++---
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 4ca2aed..2bb35dd 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -718,7 +718,6 @@ struct ath_softc {
 	u32 sc_keymax;
 	DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);
 	u8 sc_splitmic;
-	u8 sc_protrix;
 	enum ath9k_int sc_imask;
 	enum PROT_MODE sc_protmode;
 	enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index a1bd611..04ca86f 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -61,26 +61,18 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
 
 static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
 {
-	/*
-	 * All protection frames are transmited at 2Mb/s for
-	 * 11g, otherwise at 1Mb/s.
-	 * XXX select protection rate index from rate table.
-	 */
-	sc->sc_protrix = 0;
 	switch (conf->channel->band) {
 	case IEEE80211_BAND_2GHZ:
 		/* If the IEEE ends up deciding to support HT40 on 2 GHz
-		 * then we can map the HT40+ or HT40- to the appropriate rate
-		 * table then. For now only HT20 is only supported by
-		 * mac80211 */
+		 * we can map the HT40+ or HT40- to the appropriate rate
+		 * table then. For now mac8021 only supports HT20 on
+		 * 2 GHz */
 		if (conf_is_ht20(conf))
 			sc->cur_rate_table =
 			  sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
-		else {
-			sc->sc_protrix = 1;
+		else
 			sc->cur_rate_table =
 			  sc->hw_rate_table[ATH9K_MODE_11G];
-		}
 		break;
 	case IEEE80211_BAND_5GHZ:
 		if (conf_is_ht20(conf))
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 3bfc3b9..8bb125d 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -557,7 +557,8 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
 	struct ieee80211_tx_info *tx_info;
 	struct ieee80211_tx_rate *rates;
 	struct ieee80211_hdr *hdr;
-	int i, flags, rtsctsena = 0;
+	struct ieee80211_hw *hw = sc->hw;
+	int i, flags, rtsctsena = 0, enable_g_protection = 0;
 	u32 ctsduration = 0;
 	u8 rix = 0, cix, ctsrate = 0;
 	__le16 fc;
@@ -589,6 +590,12 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
 	flags = (bf->bf_flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA));
 	cix = rt->info[rix].ctrl_rate;
 
+	/* All protection frames are transmited at 2Mb/s for 802.11g,
+	 * otherwise we transmit them at 1Mb/s */
+	if (hw->conf.channel->band == IEEE80211_BAND_2GHZ &&
+	  !hw->conf.ht.enabled)
+		enable_g_protection = 1;
+
 	/*
 	 * If 802.11g protection is enabled, determine whether to use RTS/CTS or
 	 * just CTS.  Note that this is only done for OFDM/HT unicast frames.
@@ -601,7 +608,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
 		else if (sc->sc_protmode == PROT_M_CTSONLY)
 			flags = ATH9K_TXDESC_CTSENA;
 
-		cix = rt->info[sc->sc_protrix].ctrl_rate;
+		cix = rt->info[enable_g_protection].ctrl_rate;
 		rtsctsena = 1;
 	}
 
@@ -619,7 +626,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
 	if (sc->sc_config.ath_aggr_prot &&
 	    (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) {
 		flags = ATH9K_TXDESC_RTSENA;
-		cix = rt->info[sc->sc_protrix].ctrl_rate;
+		cix = rt->info[enable_g_protection].ctrl_rate;
 		rtsctsena = 1;
 	}
 
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 04/16] ath9k: Rename ath_setcurmode() to ath_cache_conf_rate()
  2008-12-20  5:55     ` [PATCH 03/16] ath9k: remove cache of rate preference when using 11g protection Luis R. Rodriguez
@ 2008-12-20  5:55       ` Luis R. Rodriguez
  2008-12-20  5:55         ` [PATCH 05/16] wireless: allow for private channel area Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

ath_setcurmode() is a bit misleading, all we are doing is
caching the rate for the corresponding configuration we
are using.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/main.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 04ca86f..dddcb4f 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -59,7 +59,8 @@ static void bus_read_cachesize(struct ath_softc *sc, int *csz)
 		*csz = DEFAULT_CACHELINE >> 2;   /* Use the default size */
 }
 
-static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
+static void ath_cache_conf_rate(struct ath_softc *sc,
+				struct ieee80211_conf *conf)
 {
 	switch (conf->channel->band) {
 	case IEEE80211_BAND_2GHZ:
@@ -88,6 +89,7 @@ static void ath_setcurmode(struct ath_softc *sc, struct ieee80211_conf *conf)
 			sc->cur_rate_table = sc->hw_rate_table[ATH9K_MODE_11A];
 		break;
 	default:
+		BUG_ON(1);
 		break;
 	}
 }
@@ -313,7 +315,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
 			return -EIO;
 		}
 
-		ath_setcurmode(sc, &hw->conf);
+		ath_cache_conf_rate(sc, &hw->conf);
 		ath_update_txpow(sc);
 		ath9k_hw_set_interrupts(ah, sc->sc_imask);
 	}
@@ -1646,7 +1648,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 	 * that changes the channel so update any state that
 	 * might change as a result.
 	 */
-	ath_setcurmode(sc, &hw->conf);
+	ath_cache_conf_rate(sc, &hw->conf);
 
 	ath_update_txpow(sc);
 
@@ -1943,7 +1945,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	    !sc->sc_config.swBeaconProcess)
 		sc->sc_imask |= ATH9K_INT_TIM;
 
-	ath_setcurmode(sc, &hw->conf);
+	ath_cache_conf_rate(sc, &hw->conf);
 
 	sc->sc_flags &= ~SC_OP_INVALID;
 
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 05/16] wireless: allow for private channel area
  2008-12-20  5:55       ` [PATCH 04/16] ath9k: Rename ath_setcurmode() to ath_cache_conf_rate() Luis R. Rodriguez
@ 2008-12-20  5:55         ` Luis R. Rodriguez
  2008-12-20  5:55           ` [PATCH 06/16] ath9k: start making use of channel->priv Luis R. Rodriguez
  2008-12-21 10:34           ` [PATCH 05/16] wireless: allow for private channel area Johannes Berg
  0 siblings, 2 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville, johannes
  Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel, kalle.valo

Wireless drivers tend to require calibration or noise floor
checks. Some of these operations are channel specific. Instead
of forcing each driver to keep a separate map for these values
per channel allow for a private area on the ieee80211_channel to
reduce code overhead and size.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/net/wireless.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/net/wireless.h b/include/net/wireless.h
index aedefa5..ecb5cf1 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -71,6 +71,8 @@ enum ieee80211_channel_flags {
  * @max_power: maximum transmission power (in dBm)
  * @orig_mag: internal use
  * @orig_mpwr: internal use
+ * @priv: used by the driver for any of its own needs,
+ * 	could be used for example for calibration data.
  */
 struct ieee80211_channel {
 	enum ieee80211_band band;
@@ -82,6 +84,7 @@ struct ieee80211_channel {
 	int max_power;
 	u32 orig_flags;
 	int orig_mag, orig_mpwr;
+	void *priv;
 };
 
 /**
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 06/16] ath9k: start making use of channel->priv
  2008-12-20  5:55         ` [PATCH 05/16] wireless: allow for private channel area Luis R. Rodriguez
@ 2008-12-20  5:55           ` Luis R. Rodriguez
  2008-12-20  5:55             ` [PATCH 07/16] ath9k: consolidate arguments on hw reset Luis R. Rodriguez
  2008-12-21 10:34           ` [PATCH 05/16] wireless: allow for private channel area Johannes Berg
  1 sibling, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

We start consolidating our internal channel by linking
it to the standard ieee80211_channel in the private area.
We can now slowly start removing redundant data.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/ath9k.h |    2 +-
 drivers/net/wireless/ath9k/hw.c    |   50 +++--------------
 drivers/net/wireless/ath9k/main.c  |  106 ++++++++++++++++--------------------
 drivers/net/wireless/ath9k/xmit.c  |    2 +-
 4 files changed, 59 insertions(+), 101 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index d278135..cd11eaf 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -843,7 +843,7 @@ void ath9k_hw_rfdetach(struct ath_hal *ah);
 
 /* HW Reset */
 
-bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
+bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 		    enum ath9k_ht_macmode macmode,
 		    u8 txchainmask, u8 rxchainmask,
 		    enum ath9k_ht_extprotspacing extprotspacing,
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index d2b0ecf..d9f810a 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -199,46 +199,6 @@ u16 ath9k_hw_computetxtime(struct ath_hal *ah,
 	return txTime;
 }
 
-u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags)
-{
-	if (flags & CHANNEL_2GHZ) {
-		if (freq == 2484)
-			return 14;
-		if (freq < 2484)
-			return (freq - 2407) / 5;
-		else
-			return 15 + ((freq - 2512) / 20);
-	} else if (flags & CHANNEL_5GHZ) {
-		if (ath9k_regd_is_public_safety_sku(ah) &&
-		    IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) {
-			return ((freq * 10) +
-				(((freq % 5) == 2) ? 5 : 0) - 49400) / 5;
-		} else if ((flags & CHANNEL_A) && (freq <= 5000)) {
-			return (freq - 4000) / 5;
-		} else {
-			return (freq - 5000) / 5;
-		}
-	} else {
-		if (freq == 2484)
-			return 14;
-		if (freq < 2484)
-			return (freq - 2407) / 5;
-		if (freq < 5000) {
-			if (ath9k_regd_is_public_safety_sku(ah)
-			    && IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) {
-				return ((freq * 10) +
-					(((freq % 5) ==
-					  2) ? 5 : 0) - 49400) / 5;
-			} else if (freq > 4900) {
-				return (freq - 4000) / 5;
-			} else {
-				return 15 + ((freq - 2512) / 20);
-			}
-		}
-		return (freq - 5000) / 5;
-	}
-}
-
 void ath9k_hw_get_channel_centers(struct ath_hal *ah,
 				  struct ath9k_channel *chan,
 				  struct chan_centers *centers)
@@ -2223,7 +2183,7 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
 	REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
 }
 
-bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
+bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 		    enum ath9k_ht_macmode macmode,
 		    u8 txchainmask, u8 rxchainmask,
 		    enum ath9k_ht_extprotspacing extprotspacing,
@@ -2232,11 +2192,19 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
 	u32 saveLedState;
 	struct ath_hal_5416 *ahp = AH5416(ah);
 	struct ath9k_channel *curchan = ah->ah_curchan;
+	struct ath9k_channel *chan;
 	u32 saveDefAntenna;
 	u32 macStaId1;
 	int ecode;
 	int i, rx_chainmask;
 
+	if (!channel->priv) {
+		ecode = -EINVAL;
+		goto bad;
+	}
+
+	chan = (struct ath9k_channel *) channel->priv;
+
 	ahp->ah_extprotspacing = extprotspacing;
 	ahp->ah_txchainmask = txchainmask;
 	ahp->ah_rxchainmask = rxchainmask;
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index dddcb4f..67c7b48 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -215,6 +215,7 @@ static int ath_setup_channels(struct ath_softc *sc)
 			chan_2ghz[a].band = IEEE80211_BAND_2GHZ;
 			chan_2ghz[a].center_freq = c->channel;
 			chan_2ghz[a].max_power = c->maxTxPower;
+			chan_2ghz[a].priv = c;
 
 			if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
 				chan_2ghz[a].flags |= IEEE80211_CHAN_NO_IBSS;
@@ -223,13 +224,13 @@ static int ath_setup_channels(struct ath_softc *sc)
 
 			band_2ghz->n_channels = ++a;
 
-			DPRINTF(sc, ATH_DBG_CONFIG, "2MHz channel: %d, "
-				"channelFlags: 0x%x\n",
-				c->channel, c->channelFlags);
+			DPRINTF(sc, ATH_DBG_CONFIG, "2MHz channel: %d\n",
+				chan_2ghz[a].center_freq);
 		} else if (IS_CHAN_5GHZ(c)) {
 			chan_5ghz[b].band = IEEE80211_BAND_5GHZ;
 			chan_5ghz[b].center_freq = c->channel;
 			chan_5ghz[b].max_power = c->maxTxPower;
+			chan_5ghz[b].priv = c;
 
 			if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
 				chan_5ghz[b].flags |= IEEE80211_CHAN_NO_IBSS;
@@ -238,9 +239,8 @@ static int ath_setup_channels(struct ath_softc *sc)
 
 			band_5ghz->n_channels = ++b;
 
-			DPRINTF(sc, ATH_DBG_CONFIG, "5MHz channel: %d, "
-				"channelFlags: 0x%x\n",
-				c->channel, c->channelFlags);
+			DPRINTF(sc, ATH_DBG_CONFIG, "5MHz channel: %d\n",
+				chan_5ghz[b].center_freq);
 		}
 	}
 
@@ -252,15 +252,21 @@ static int ath_setup_channels(struct ath_softc *sc)
  * by reseting the chip.  To accomplish this we must first cleanup any pending
  * DMA, then restart stuff.
 */
-static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
+static int ath_set_channel(struct ath_softc *sc, struct ieee80211_channel *c)
 {
 	struct ath_hal *ah = sc->sc_ah;
 	bool fastcc = true, stopped;
 	struct ieee80211_hw *hw = sc->hw;
+	struct ath9k_channel *hchan;
 
 	if (sc->sc_flags & SC_OP_INVALID)
 		return -EIO;
 
+	if (!c->priv)
+		return -EINVAL;
+
+	hchan = (struct ath9k_channel *) c->priv;
+
 	if (hchan->channel != sc->sc_ah->ah_curchan->channel ||
 	    hchan->channelFlags != sc->sc_ah->ah_curchan->channelFlags ||
 	    (sc->sc_flags & SC_OP_CHAINMASK_UPDATE) ||
@@ -287,20 +293,20 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
 			fastcc = false;
 
 		DPRINTF(sc, ATH_DBG_CONFIG,
-			"(%u MHz) -> (%u MHz), cflags:%x, chanwidth: %d\n",
+			"(%u MHz) -> (%u MHz), chanwidth: %d\n",
 			sc->sc_ah->ah_curchan->channel,
-			hchan->channel, hchan->channelFlags, sc->tx_chan_width);
+			c->center_freq, sc->tx_chan_width);
 
 		spin_lock_bh(&sc->sc_resetlock);
-		if (!ath9k_hw_reset(ah, hchan, sc->tx_chan_width,
+		if (!ath9k_hw_reset(ah, c, sc->tx_chan_width,
 				    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
 				    sc->sc_ht_extprotspacing, fastcc, &status)) {
 			DPRINTF(sc, ATH_DBG_FATAL,
 				"Unable to reset channel %u (%uMhz) "
-				"flags 0x%x hal status %u\n",
-				ath9k_hw_mhz2ieee(ah, hchan->channel,
-						  hchan->channelFlags),
-				hchan->channel, hchan->channelFlags, status);
+				"hal status %u\n",
+				ieee80211_frequency_to_channel(c->center_freq),
+				c->center_freq,
+				status);
 			spin_unlock_bh(&sc->sc_resetlock);
 			return -EIO;
 		}
@@ -608,19 +614,6 @@ static irqreturn_t ath_isr(int irq, void *dev)
 	return IRQ_HANDLED;
 }
 
-static int ath_get_channel(struct ath_softc *sc,
-			   struct ieee80211_channel *chan)
-{
-	int i;
-
-	for (i = 0; i < sc->sc_ah->ah_nchan; i++) {
-		if (sc->sc_ah->ah_channels[i].channel == chan->center_freq)
-			return i;
-	}
-
-	return -1;
-}
-
 static u32 ath_get_extchanmode(struct ath_softc *sc,
 			       struct ieee80211_channel *chan,
 			       enum nl80211_channel_type channel_type)
@@ -1068,10 +1061,11 @@ fail:
 static void ath_radio_enable(struct ath_softc *sc)
 {
 	struct ath_hal *ah = sc->sc_ah;
+	struct ieee80211_channel *c = sc->hw->conf.channel;
 	int status;
 
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(ah, ah->ah_curchan,
+	if (!ath9k_hw_reset(ah, c,
 			    sc->tx_chan_width,
 			    sc->sc_tx_chainmask,
 			    sc->sc_rx_chainmask,
@@ -1079,12 +1073,10 @@ static void ath_radio_enable(struct ath_softc *sc)
 			    false, &status)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to reset channel %u (%uMhz) "
-			"flags 0x%x hal status %u\n",
-			ath9k_hw_mhz2ieee(ah,
-					  ah->ah_curchan->channel,
-					  ah->ah_curchan->channelFlags),
-			ah->ah_curchan->channel,
-			ah->ah_curchan->channelFlags, status);
+			"hal status %u\n",
+			ieee80211_frequency_to_channel(c->center_freq),
+			c->center_freq,
+			status);
 	}
 	spin_unlock_bh(&sc->sc_resetlock);
 
@@ -1112,9 +1104,10 @@ static void ath_radio_enable(struct ath_softc *sc)
 static void ath_radio_disable(struct ath_softc *sc)
 {
 	struct ath_hal *ah = sc->sc_ah;
+	struct ieee80211_conf *conf = &sc->hw->conf;
+	struct ieee80211_channel *c = conf->channel;
 	int status;
 
-
 	ieee80211_stop_queues(sc->hw);
 
 	/* Disable LED */
@@ -1129,7 +1122,7 @@ static void ath_radio_disable(struct ath_softc *sc)
 	ath_flushrecv(sc);		/* flush recv queue */
 
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(ah, ah->ah_curchan,
+	if (!ath9k_hw_reset(ah, c,
 			    sc->tx_chan_width,
 			    sc->sc_tx_chainmask,
 			    sc->sc_rx_chainmask,
@@ -1137,12 +1130,10 @@ static void ath_radio_disable(struct ath_softc *sc)
 			    false, &status)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to reset channel %u (%uMhz) "
-			"flags 0x%x hal status %u\n",
-			ath9k_hw_mhz2ieee(ah,
-				ah->ah_curchan->channel,
-				ah->ah_curchan->channelFlags),
-			ah->ah_curchan->channel,
-			ah->ah_curchan->channelFlags, status);
+			"hal status %u\n",
+			ieee80211_frequency_to_channel(c->center_freq),
+			c->center_freq,
+			status);
 	}
 	spin_unlock_bh(&sc->sc_resetlock);
 
@@ -1630,7 +1621,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 	ath_flushrecv(sc);
 
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(ah, sc->sc_ah->ah_curchan,
+	if (!ath9k_hw_reset(ah, hw->conf.channel,
 			    sc->tx_chan_width,
 			    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
 			    sc->sc_ht_extprotspacing, false, &status)) {
@@ -1851,24 +1842,23 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	struct ath_softc *sc = hw->priv;
 	struct ieee80211_channel *curchan = hw->conf.channel;
 	struct ath9k_channel *init_channel;
-	int error = 0, pos, status;
+	int error = 0, status;
 
 	DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with "
 		"initial channel: %d MHz\n", curchan->center_freq);
 
 	/* setup initial channel */
 
-	pos = ath_get_channel(sc, curchan);
-	if (pos == -1) {
+	if (!curchan->priv) {
 		DPRINTF(sc, ATH_DBG_FATAL, "Invalid channel: %d\n", curchan->center_freq);
 		error = -EINVAL;
 		goto error;
 	}
 
 	sc->tx_chan_width = ATH9K_HT_MACMODE_20;
-	sc->sc_ah->ah_channels[pos].chanmode =
+	init_channel = (struct ath9k_channel *) curchan->priv;
+	init_channel->chanmode =
 		(curchan->band == IEEE80211_BAND_2GHZ) ? CHANNEL_G : CHANNEL_A;
-	init_channel = &sc->sc_ah->ah_channels[pos];
 
 	/* Reset SERDES registers */
 	ath9k_hw_configpcipowersave(sc->sc_ah, 0);
@@ -1881,14 +1871,14 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	 * and then setup of the interrupt mask.
 	 */
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(sc->sc_ah, init_channel,
+	if (!ath9k_hw_reset(sc->sc_ah, curchan,
 			    sc->tx_chan_width,
 			    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
 			    sc->sc_ht_extprotspacing, false, &status)) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to reset hardware; hal status %u "
-			"(freq %u flags 0x%x)\n", status,
-			init_channel->channel, init_channel->channelFlags);
+			"(freq %u)\n", status,
+			curchan->center_freq);
 		error = -EIO;
 		spin_unlock_bh(&sc->sc_resetlock);
 		goto error;
@@ -2137,14 +2127,14 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 	mutex_lock(&sc->mutex);
 	if (changed & (IEEE80211_CONF_CHANGE_CHANNEL |
 		       IEEE80211_CONF_CHANGE_HT)) {
-		struct ieee80211_channel *curchan = hw->conf.channel;
-		int pos;
+		struct ieee80211_channel *curchan = conf->channel;
+		struct ath9k_channel *priv_channel;
 
 		DPRINTF(sc, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
 			curchan->center_freq);
 
-		pos = ath_get_channel(sc, curchan);
-		if (pos == -1) {
+		priv_channel = (struct ath9k_channel *) curchan->priv;
+		if (!priv_channel) {
 			DPRINTF(sc, ATH_DBG_FATAL, "Invalid channel: %d\n",
 				curchan->center_freq);
 			mutex_unlock(&sc->mutex);
@@ -2152,7 +2142,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 		}
 
 		sc->tx_chan_width = ATH9K_HT_MACMODE_20;
-		sc->sc_ah->ah_channels[pos].chanmode =
+		priv_channel->chanmode =
 			(curchan->band == IEEE80211_BAND_2GHZ) ?
 			CHANNEL_G : CHANNEL_A;
 
@@ -2161,12 +2151,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 			    conf->ht.channel_type == NL80211_CHAN_HT40MINUS)
 				sc->tx_chan_width = ATH9K_HT_MACMODE_2040;
 
-			sc->sc_ah->ah_channels[pos].chanmode =
+			priv_channel->chanmode =
 				ath_get_extchanmode(sc, curchan,
 						    conf->ht.channel_type);
 		}
 
-		if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) {
+		if (ath_set_channel(sc, curchan) < 0) {
 			DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n");
 			mutex_unlock(&sc->mutex);
 			return -EINVAL;
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 8bb125d..030f49d 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -1171,7 +1171,7 @@ static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
 
 		spin_lock_bh(&sc->sc_resetlock);
 		if (!ath9k_hw_reset(ah,
-				    sc->sc_ah->ah_curchan,
+				    sc->hw->conf.channel,
 				    sc->tx_chan_width,
 				    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
 				    sc->sc_ht_extprotspacing, true, &status)) {
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 07/16] ath9k: consolidate arguments on hw reset
  2008-12-20  5:55           ` [PATCH 06/16] ath9k: start making use of channel->priv Luis R. Rodriguez
@ 2008-12-20  5:55             ` Luis R. Rodriguez
  2008-12-20  5:55               ` [PATCH 08/16] ath9k: make request to get the noisefloor threshold band specific Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

HW reset calls pass the same variables or structs
which we can obtain easily from ah, this also applies
during channel changes as we always follow the ieee80211_conf
channel so consolidate the arguments.

We now also now propagate the hw reset errors down.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/ath9k.h |    7 +---
 drivers/net/wireless/ath9k/hw.c    |   76 +++++++++++++----------------------
 drivers/net/wireless/ath9k/main.c  |   78 +++++++++++++-----------------------
 drivers/net/wireless/ath9k/xmit.c  |   14 ++-----
 4 files changed, 61 insertions(+), 114 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index cd11eaf..823f1d6 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -842,12 +842,7 @@ void ath9k_hw_rfdetach(struct ath_hal *ah);
 
 
 /* HW Reset */
-
-bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
-		    enum ath9k_ht_macmode macmode,
-		    u8 txchainmask, u8 rxchainmask,
-		    enum ath9k_ht_extprotspacing extprotspacing,
-		    bool bChannelChange, int *status);
+int ath9k_hw_reset(struct ath_hal *ah, bool bChannelChange);
 
 /* Key Cache Management */
 
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index d9f810a..60cc0ba 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -2183,31 +2183,28 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
 	REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
 }
 
-bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
-		    enum ath9k_ht_macmode macmode,
-		    u8 txchainmask, u8 rxchainmask,
-		    enum ath9k_ht_extprotspacing extprotspacing,
-		    bool bChannelChange, int *status)
+int ath9k_hw_reset(struct ath_hal *ah, bool bChannelChange)
 {
 	u32 saveLedState;
+	struct ath_softc *sc = ah->ah_sc;
 	struct ath_hal_5416 *ahp = AH5416(ah);
+	struct ieee80211_channel *channel;
 	struct ath9k_channel *curchan = ah->ah_curchan;
 	struct ath9k_channel *chan;
 	u32 saveDefAntenna;
 	u32 macStaId1;
-	int ecode;
-	int i, rx_chainmask;
+	int i, rx_chainmask, r;
 
-	if (!channel->priv) {
-		ecode = -EINVAL;
-		goto bad;
-	}
+	channel = sc->hw->conf.channel;
+
+	if (!channel->priv)
+		return -EINVAL;
 
 	chan = (struct ath9k_channel *) channel->priv;
 
-	ahp->ah_extprotspacing = extprotspacing;
-	ahp->ah_txchainmask = txchainmask;
-	ahp->ah_rxchainmask = rxchainmask;
+	ahp->ah_extprotspacing = sc->sc_ht_extprotspacing;
+	ahp->ah_txchainmask = sc->sc_tx_chainmask;
+	ahp->ah_rxchainmask = sc->sc_rx_chainmask;
 
 	if (AR_SREV_9280(ah)) {
 		ahp->ah_txchainmask &= 0x3;
@@ -2218,14 +2215,11 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 		DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
 			"invalid channel %u/0x%x; no mapping\n",
 			chan->channel, chan->channelFlags);
-		ecode = -EINVAL;
-		goto bad;
+		return -EINVAL;
 	}
 
-	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
-		ecode = -EIO;
-		goto bad;
-	}
+	if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
+		return -EIO;
 
 	if (curchan)
 		ath9k_hw_getnf(ah, curchan);
@@ -2239,10 +2233,10 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 	    (!AR_SREV_9280(ah) || (!IS_CHAN_A_5MHZ_SPACED(chan) &&
 				   !IS_CHAN_A_5MHZ_SPACED(ah->ah_curchan)))) {
 
-		if (ath9k_hw_channel_change(ah, chan, macmode)) {
+		if (ath9k_hw_channel_change(ah, chan, sc->tx_chan_width)) {
 			ath9k_hw_loadnf(ah, ah->ah_curchan);
 			ath9k_hw_start_nfcal(ah);
-			return true;
+			return 0;
 		}
 	}
 
@@ -2260,8 +2254,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 
 	if (!ath9k_hw_chip_reset(ah, chan)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_RESET, "chip reset failed\n");
-		ecode = -EINVAL;
-		goto bad;
+		return -EINVAL;
 	}
 
 	if (AR_SREV_9280(ah)) {
@@ -2277,11 +2270,9 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 		ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
 	}
 
-	ecode = ath9k_hw_process_ini(ah, chan, macmode);
-	if (ecode != 0) {
-		ecode = -EINVAL;
-		goto bad;
-	}
+	r = ath9k_hw_process_ini(ah, chan, sc->tx_chan_width);
+	if (r)
+		return r;
 
 	if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
 		ath9k_hw_set_delta_slope(ah, chan);
@@ -2294,8 +2285,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 	if (!ath9k_hw_eeprom_set_board_values(ah, chan)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
 			"error setting board options\n");
-		ecode = -EIO;
-		goto bad;
+		return -EIO;
 	}
 
 	ath9k_hw_decrease_chain_power(ah, chan);
@@ -2323,15 +2313,11 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 	REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR);
 
 	if (AR_SREV_9280_10_OR_LATER(ah)) {
-		if (!(ath9k_hw_ar9280_set_channel(ah, chan))) {
-			ecode = -EIO;
-			goto bad;
-		}
+		if (!(ath9k_hw_ar9280_set_channel(ah, chan)))
+			return -EIO;
 	} else {
-		if (!(ath9k_hw_set_channel(ah, chan))) {
-			ecode = -EIO;
-			goto bad;
-		}
+		if (!(ath9k_hw_set_channel(ah, chan)))
+			return -EIO;
 	}
 
 	for (i = 0; i < AR_NUM_DCU; i++)
@@ -2365,10 +2351,8 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 
 	ath9k_hw_init_bb(ah, chan);
 
-	if (!ath9k_hw_init_cal(ah, chan)){
-		ecode = -EIO;;
-		goto bad;
-	}
+	if (!ath9k_hw_init_cal(ah, chan))
+		return -EIO;;
 
 	rx_chainmask = ahp->ah_rxchainmask;
 	if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) {
@@ -2397,11 +2381,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ieee80211_channel *channel,
 #endif
 	}
 
-	return true;
-bad:
-	if (status)
-		*status = ecode;
-	return false;
+	return 0;
 }
 
 /************************/
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 67c7b48..57d5178 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -258,6 +258,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ieee80211_channel *c)
 	bool fastcc = true, stopped;
 	struct ieee80211_hw *hw = sc->hw;
 	struct ath9k_channel *hchan;
+	int r;
 
 	if (sc->sc_flags & SC_OP_INVALID)
 		return -EIO;
@@ -271,7 +272,6 @@ static int ath_set_channel(struct ath_softc *sc, struct ieee80211_channel *c)
 	    hchan->channelFlags != sc->sc_ah->ah_curchan->channelFlags ||
 	    (sc->sc_flags & SC_OP_CHAINMASK_UPDATE) ||
 	    (sc->sc_flags & SC_OP_FULL_RESET)) {
-		int status;
 		/*
 		 * This is only performed if the channel settings have
 		 * actually changed.
@@ -298,17 +298,17 @@ static int ath_set_channel(struct ath_softc *sc, struct ieee80211_channel *c)
 			c->center_freq, sc->tx_chan_width);
 
 		spin_lock_bh(&sc->sc_resetlock);
-		if (!ath9k_hw_reset(ah, c, sc->tx_chan_width,
-				    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-				    sc->sc_ht_extprotspacing, fastcc, &status)) {
+
+		r = ath9k_hw_reset(ah, fastcc);
+		if (r) {
 			DPRINTF(sc, ATH_DBG_FATAL,
 				"Unable to reset channel %u (%uMhz) "
 				"hal status %u\n",
 				ieee80211_frequency_to_channel(c->center_freq),
 				c->center_freq,
-				status);
+				r);
 			spin_unlock_bh(&sc->sc_resetlock);
-			return -EIO;
+			return r;
 		}
 		spin_unlock_bh(&sc->sc_resetlock);
 
@@ -1062,22 +1062,17 @@ static void ath_radio_enable(struct ath_softc *sc)
 {
 	struct ath_hal *ah = sc->sc_ah;
 	struct ieee80211_channel *c = sc->hw->conf.channel;
-	int status;
+	int r;
 
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(ah, c,
-			    sc->tx_chan_width,
-			    sc->sc_tx_chainmask,
-			    sc->sc_rx_chainmask,
-			    sc->sc_ht_extprotspacing,
-			    false, &status)) {
+	r = ath9k_hw_reset(ah, false);
+	if (r)
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to reset channel %u (%uMhz) "
 			"hal status %u\n",
 			ieee80211_frequency_to_channel(c->center_freq),
 			c->center_freq,
-			status);
-	}
+			r);
 	spin_unlock_bh(&sc->sc_resetlock);
 
 	ath_update_txpow(sc);
@@ -1106,7 +1101,7 @@ static void ath_radio_disable(struct ath_softc *sc)
 	struct ath_hal *ah = sc->sc_ah;
 	struct ieee80211_conf *conf = &sc->hw->conf;
 	struct ieee80211_channel *c = conf->channel;
-	int status;
+	int r;
 
 	ieee80211_stop_queues(sc->hw);
 
@@ -1122,19 +1117,14 @@ static void ath_radio_disable(struct ath_softc *sc)
 	ath_flushrecv(sc);		/* flush recv queue */
 
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(ah, c,
-			    sc->tx_chan_width,
-			    sc->sc_tx_chainmask,
-			    sc->sc_rx_chainmask,
-			    sc->sc_ht_extprotspacing,
-			    false, &status)) {
+	r = ath9k_hw_reset(ah, false);
+	if (r)
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to reset channel %u (%uMhz) "
 			"hal status %u\n",
 			ieee80211_frequency_to_channel(c->center_freq),
 			c->center_freq,
-			status);
-	}
+			r);
 	spin_unlock_bh(&sc->sc_resetlock);
 
 	ath9k_hw_phy_disable(ah);
@@ -1612,8 +1602,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 {
 	struct ath_hal *ah = sc->sc_ah;
 	struct ieee80211_hw *hw = sc->hw;
-	int status;
-	int error = 0;
+	int r = 0;
 
 	ath9k_hw_set_interrupts(ah, 0);
 	ath_draintxq(sc, retry_tx);
@@ -1621,14 +1610,10 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 	ath_flushrecv(sc);
 
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(ah, hw->conf.channel,
-			    sc->tx_chan_width,
-			    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-			    sc->sc_ht_extprotspacing, false, &status)) {
+	r = ath9k_hw_reset(ah, false);
+	if (r)
 		DPRINTF(sc, ATH_DBG_FATAL,
-			"Unable to reset hardware; hal status %u\n", status);
-		error = -EIO;
-	}
+			"Unable to reset hardware; hal status %u\n", r);
 	spin_unlock_bh(&sc->sc_resetlock);
 
 	if (ath_startrecv(sc) != 0)
@@ -1659,7 +1644,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
 		}
 	}
 
-	return error;
+	return r;
 }
 
 /*
@@ -1842,7 +1827,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	struct ath_softc *sc = hw->priv;
 	struct ieee80211_channel *curchan = hw->conf.channel;
 	struct ath9k_channel *init_channel;
-	int error = 0, status;
+	int r;
 
 	DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with "
 		"initial channel: %d MHz\n", curchan->center_freq);
@@ -1851,8 +1836,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 
 	if (!curchan->priv) {
 		DPRINTF(sc, ATH_DBG_FATAL, "Invalid channel: %d\n", curchan->center_freq);
-		error = -EINVAL;
-		goto error;
+		return -EINVAL;
 	}
 
 	sc->tx_chan_width = ATH9K_HT_MACMODE_20;
@@ -1871,17 +1855,14 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	 * and then setup of the interrupt mask.
 	 */
 	spin_lock_bh(&sc->sc_resetlock);
-	if (!ath9k_hw_reset(sc->sc_ah, curchan,
-			    sc->tx_chan_width,
-			    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-			    sc->sc_ht_extprotspacing, false, &status)) {
+	r = ath9k_hw_reset(sc->sc_ah, false);
+	if (r) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to reset hardware; hal status %u "
-			"(freq %u)\n", status,
+			"(freq %u)\n", r,
 			curchan->center_freq);
-		error = -EIO;
 		spin_unlock_bh(&sc->sc_resetlock);
-		goto error;
+		return r;
 	}
 	spin_unlock_bh(&sc->sc_resetlock);
 
@@ -1901,8 +1882,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	if (ath_startrecv(sc) != 0) {
 		DPRINTF(sc, ATH_DBG_FATAL,
 			"Unable to start recv logic\n");
-		error = -EIO;
-		goto error;
+		return -EIO;
 	}
 
 	/* Setup our intr mask. */
@@ -1946,11 +1926,9 @@ static int ath9k_start(struct ieee80211_hw *hw)
 	ieee80211_wake_queues(sc->hw);
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-	error = ath_start_rfkill_poll(sc);
+	r = ath_start_rfkill_poll(sc);
 #endif
-
-error:
-	return error;
+	return r;
 }
 
 static int ath9k_tx(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 030f49d..8b4fa34 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -1151,7 +1151,7 @@ static void ath_tx_stopdma(struct ath_softc *sc, struct ath_txq *txq)
 static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
 {
 	struct ath_hal *ah = sc->sc_ah;
-	int i, status, npend = 0;
+	int i, r, npend = 0;
 
 	if (!(sc->sc_flags & SC_OP_INVALID)) {
 		for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
@@ -1170,16 +1170,10 @@ static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
 		DPRINTF(sc, ATH_DBG_XMIT, "Unable to stop TxDMA. Reset HAL!\n");
 
 		spin_lock_bh(&sc->sc_resetlock);
-		if (!ath9k_hw_reset(ah,
-				    sc->hw->conf.channel,
-				    sc->tx_chan_width,
-				    sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-				    sc->sc_ht_extprotspacing, true, &status)) {
-
+		r = ath9k_hw_reset(ah, true);
+		if (r)
 			DPRINTF(sc, ATH_DBG_FATAL,
-				"Unable to reset hardware; hal status %u\n",
-				status);
-		}
+				"Unable to reset hardware; hal status %u\n", r);
 		spin_unlock_bh(&sc->sc_resetlock);
 	}
 
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 08/16] ath9k: make request to get the noisefloor threshold band specific
  2008-12-20  5:55             ` [PATCH 07/16] ath9k: consolidate arguments on hw reset Luis R. Rodriguez
@ 2008-12-20  5:55               ` Luis R. Rodriguez
  2008-12-20  5:55                 ` [PATCH 09/16] ath9k: use ieee80211_conf on ath9k_hw_iscal_supported() Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

Lets make the request to get the current noise floor threshold
from the EEPROM band specific as it is band specific, not mode
specific.

This also adds a backpointer on the private channel structure
back to the ieee80211_channel structure as this is now needed during
hw reset when it tries to get the current EEPROM noise floor threshold.

Finally we note that calibration always works on the current channel
and because of this the "internal" channel will always be the current
channel. Because this is true we don't need to clear the CHANNEL_CW_INT
flag anymore. This is currently unused but can be used later in AP mode.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/ath9k.h |    3 ++-
 drivers/net/wireless/ath9k/calib.c |   27 ++++++++++-----------------
 drivers/net/wireless/ath9k/hw.c    |    2 +-
 drivers/net/wireless/ath9k/main.c  |    2 ++
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 823f1d6..8e47802 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -453,6 +453,7 @@ struct ath9k_11n_rate_series {
 	 CHANNEL_HT40MINUS)
 
 struct ath9k_channel {
+	struct ieee80211_channel *chan;
 	u16 channel;
 	u32 channelFlags;
 	u8 privFlags;
@@ -951,7 +952,7 @@ void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
 void ath9k_hw_start_nfcal(struct ath_hal *ah);
 void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan);
 int16_t ath9k_hw_getnf(struct ath_hal *ah,
-		       struct ath9k_channel *chan);
+		       struct ieee80211_channel *c);
 void ath9k_init_nfcal_hist_buffer(struct ath_hal *ah);
 s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan);
 bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c
index 3c7454f..c72bf10 100644
--- a/drivers/net/wireless/ath9k/calib.c
+++ b/drivers/net/wireless/ath9k/calib.c
@@ -168,26 +168,18 @@ static void ath9k_hw_do_getnf(struct ath_hal *ah,
 }
 
 static bool getNoiseFloorThresh(struct ath_hal *ah,
-				const struct ath9k_channel *chan,
+				enum ieee80211_band band,
 				int16_t *nft)
 {
-	switch (chan->chanmode) {
-	case CHANNEL_A:
-	case CHANNEL_A_HT20:
-	case CHANNEL_A_HT40PLUS:
-	case CHANNEL_A_HT40MINUS:
+	switch (band) {
+	case IEEE80211_BAND_5GHZ:
 		*nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_5);
 		break;
-	case CHANNEL_B:
-	case CHANNEL_G:
-	case CHANNEL_G_HT20:
-	case CHANNEL_G_HT40PLUS:
-	case CHANNEL_G_HT40MINUS:
+	case IEEE80211_BAND_2GHZ:
 		*nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_2);
 		break;
 	default:
-		DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-			"invalid channel flags 0x%x\n", chan->channelFlags);
+		BUG_ON(1);
 		return false;
 	}
 
@@ -687,11 +679,12 @@ void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan)
 }
 
 int16_t ath9k_hw_getnf(struct ath_hal *ah,
-		       struct ath9k_channel *chan)
+		       struct ieee80211_channel *c)
 {
 	int16_t nf, nfThresh;
 	int16_t nfarray[NUM_NF_READINGS] = { 0 };
 	struct ath9k_nfcal_hist *h;
+	struct ath9k_channel *chan = (struct ath9k_channel *) c->priv;
 	u8 chainmask;
 
 	if (AR_SREV_9280(ah))
@@ -709,7 +702,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
 	} else {
 		ath9k_hw_do_getnf(ah, nfarray);
 		nf = nfarray[0];
-		if (getNoiseFloorThresh(ah, chan, &nfThresh)
+		if (getNoiseFloorThresh(ah, c->band, &nfThresh)
 		    && nf > nfThresh) {
 			DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
 				"noise floor failed detected; "
@@ -805,13 +798,13 @@ bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
 	}
 
 	if (longcal) {
-		ath9k_hw_getnf(ah, ichan);
+		BUG_ON(chan != ichan);
+		ath9k_hw_getnf(ah, ichan->chan);
 		ath9k_hw_loadnf(ah, ah->ah_curchan);
 		ath9k_hw_start_nfcal(ah);
 
 		if ((ichan->channelFlags & CHANNEL_CW_INT) != 0) {
 			chan->channelFlags |= CHANNEL_CW_INT;
-			ichan->channelFlags &= ~CHANNEL_CW_INT;
 		}
 	}
 
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 60cc0ba..eb0ec06 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -2222,7 +2222,7 @@ int ath9k_hw_reset(struct ath_hal *ah, bool bChannelChange)
 		return -EIO;
 
 	if (curchan)
-		ath9k_hw_getnf(ah, curchan);
+		ath9k_hw_getnf(ah, curchan->chan);
 
 	if (bChannelChange &&
 	    (ahp->ah_chipFullSleep != true) &&
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 57d5178..0d47936 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -216,6 +216,7 @@ static int ath_setup_channels(struct ath_softc *sc)
 			chan_2ghz[a].center_freq = c->channel;
 			chan_2ghz[a].max_power = c->maxTxPower;
 			chan_2ghz[a].priv = c;
+			c->chan = &chan_2ghz[a];
 
 			if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
 				chan_2ghz[a].flags |= IEEE80211_CHAN_NO_IBSS;
@@ -231,6 +232,7 @@ static int ath_setup_channels(struct ath_softc *sc)
 			chan_5ghz[b].center_freq = c->channel;
 			chan_5ghz[b].max_power = c->maxTxPower;
 			chan_5ghz[b].priv = c;
+			c->chan = &chan_5ghz[a];
 
 			if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
 				chan_5ghz[b].flags |= IEEE80211_CHAN_NO_IBSS;
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 09/16] ath9k: use ieee80211_conf on ath9k_hw_iscal_supported()
  2008-12-20  5:55               ` [PATCH 08/16] ath9k: make request to get the noisefloor threshold band specific Luis R. Rodriguez
@ 2008-12-20  5:55                 ` Luis R. Rodriguez
  2008-12-20  5:55                   ` [PATCH 10/16] ath9k: make use of conf_is_ht40() in the rest of the driver Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

ath9k_hw_iscal_supported() just needs to be aware of your band
and if HT20 is being used so lets abandon our internal channel
HT appended values and internal mode values and use ieee80211_conf
which already carries this information. This works as calibration
is being done for the currently configured channel.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/ath9k.h |    3 +-
 drivers/net/wireless/ath9k/calib.c |   67 +++++++++++++++++------------------
 drivers/net/wireless/ath9k/main.c  |    3 +-
 3 files changed, 35 insertions(+), 38 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 8e47802..10c61ed 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -947,8 +947,7 @@ void ath9k_hw_ani_detach(struct ath_hal *ah);
 
 /* Calibration */
 
-void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
-			     bool *isCalDone);
+bool ath9k_hw_reset_calvalid(struct ath_hal *ah);
 void ath9k_hw_start_nfcal(struct ath_hal *ah);
 void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan);
 int16_t ath9k_hw_getnf(struct ath_hal *ah,
diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c
index c72bf10..74369c1 100644
--- a/drivers/net/wireless/ath9k/calib.c
+++ b/drivers/net/wireless/ath9k/calib.c
@@ -277,27 +277,24 @@ static void ath9k_hw_per_calibration(struct ath_hal *ah,
 	}
 }
 
+/* Assumes you are talking about the currently configured channel */
 static bool ath9k_hw_iscal_supported(struct ath_hal *ah,
-				     struct ath9k_channel *chan,
 				     enum hal_cal_types calType)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	bool retval = false;
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
 
 	switch (calType & ahp->ah_suppCals) {
-	case IQ_MISMATCH_CAL:
-		if (!IS_CHAN_B(chan))
-			retval = true;
-		break;
+	case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */
+		return true;
 	case ADC_GAIN_CAL:
 	case ADC_DC_CAL:
-		if (!IS_CHAN_B(chan)
-		    && !(IS_CHAN_2GHZ(chan) && IS_CHAN_HT20(chan)))
-			retval = true;
+		if (conf->channel->band == IEEE80211_BAND_5GHZ &&
+		  conf_is_ht20(conf))
+			return true;
 		break;
 	}
-
-	return retval;
+	return false;
 }
 
 static void ath9k_hw_iqcal_collect(struct ath_hal *ah)
@@ -565,50 +562,52 @@ static void ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u8 numChains)
 		  AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE);
 }
 
-void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
-			     bool *isCalDone)
+/* This is done for the currently configured channel */
+bool ath9k_hw_reset_calvalid(struct ath_hal *ah)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct ath9k_channel *ichan =
-		ath9k_regd_check_channel(ah, chan);
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+	struct ath9k_channel *chan;
+	struct ath9k_channel *ichan;
 	struct hal_cal_list *currCal = ahp->ah_cal_list_curr;
 
-	*isCalDone = true;
+	if (!conf->channel->priv)
+		return true;
+
+	chan = (struct ath9k_channel *) conf->channel->priv;
+	ichan = ath9k_regd_check_channel(ah, chan);
 
 	if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah))
-		return;
+		return true;
 
 	if (currCal == NULL)
-		return;
+		return true;
 
-	if (ichan == NULL) {
+	if (!ichan) {
 		DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-			"invalid channel %u/0x%x; no mapping\n",
-			chan->channel, chan->channelFlags);
-		return;
+			"invalid channel %u; no mapping\n",
+			conf->channel->center_freq);
+		return true;
 	}
 
-
 	if (currCal->calState != CAL_DONE) {
 		DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
 			"Calibration state incorrect, %d\n",
 			currCal->calState);
-		return;
+		return true;
 	}
 
-
-	if (!ath9k_hw_iscal_supported(ah, chan, currCal->calData->calType))
-		return;
+	if (!ath9k_hw_iscal_supported(ah, currCal->calData->calType))
+		return true;
 
 	DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-		"Resetting Cal %d state for channel %u/0x%x\n",
-		currCal->calData->calType, chan->channel,
-		chan->channelFlags);
+		"Resetting Cal %d state for channel %u\n",
+		currCal->calData->calType, conf->channel->center_freq);
 
 	ichan->CalValid &= ~currCal->calData->calType;
 	currCal->calState = CAL_WAITING;
 
-	*isCalDone = false;
+	return false;
 }
 
 void ath9k_hw_start_nfcal(struct ath_hal *ah)
@@ -933,19 +932,19 @@ bool ath9k_hw_init_cal(struct ath_hal *ah,
 	ahp->ah_cal_list = ahp->ah_cal_list_last = ahp->ah_cal_list_curr = NULL;
 
 	if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
-		if (ath9k_hw_iscal_supported(ah, chan, ADC_GAIN_CAL)) {
+		if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
 			INIT_CAL(&ahp->ah_adcGainCalData);
 			INSERT_CAL(ahp, &ahp->ah_adcGainCalData);
 			DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
 				"enabling ADC Gain Calibration.\n");
 		}
-		if (ath9k_hw_iscal_supported(ah, chan, ADC_DC_CAL)) {
+		if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) {
 			INIT_CAL(&ahp->ah_adcDcCalData);
 			INSERT_CAL(ahp, &ahp->ah_adcDcCalData);
 			DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
 				"enabling ADC DC Calibration.\n");
 		}
-		if (ath9k_hw_iscal_supported(ah, chan, IQ_MISMATCH_CAL)) {
+		if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
 			INIT_CAL(&ahp->ah_iqCalData);
 			INSERT_CAL(ahp, &ahp->ah_iqCalData);
 			DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 0d47936..54c6d60 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -376,8 +376,7 @@ static void ath_ani_calibrate(unsigned long data)
 	} else {
 		if ((timestamp - sc->sc_ani.sc_resetcal_timer) >=
 		    ATH_RESTART_CALINTERVAL) {
-			ath9k_hw_reset_calvalid(ah, ah->ah_curchan,
-						&sc->sc_ani.sc_caldone);
+			sc->sc_ani.sc_caldone = ath9k_hw_reset_calvalid(ah);
 			if (sc->sc_ani.sc_caldone)
 				sc->sc_ani.sc_resetcal_timer = timestamp;
 		}
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 10/16] ath9k: make use of conf_is_ht40() in the rest of the driver
  2008-12-20  5:55                 ` [PATCH 09/16] ath9k: use ieee80211_conf on ath9k_hw_iscal_supported() Luis R. Rodriguez
@ 2008-12-20  5:55                   ` Luis R. Rodriguez
  2008-12-20  5:55                     ` [PATCH 11/16] ath9k: Make ANI CCK and OFDM error triggers band specific Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

Use shiny new conf_is_ht40()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/main.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 54c6d60..1385343 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -2126,8 +2126,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 			CHANNEL_G : CHANNEL_A;
 
 		if (conf->ht.enabled) {
-			if (conf->ht.channel_type == NL80211_CHAN_HT40PLUS ||
-			    conf->ht.channel_type == NL80211_CHAN_HT40MINUS)
+			if (conf_is_ht40(conf))
 				sc->tx_chan_width = ATH9K_HT_MACMODE_2040;
 
 			priv_channel->chanmode =
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 11/16] ath9k: Make ANI CCK and OFDM error triggers band specific
  2008-12-20  5:55                   ` [PATCH 10/16] ath9k: make use of conf_is_ht40() in the rest of the driver Luis R. Rodriguez
@ 2008-12-20  5:55                     ` Luis R. Rodriguez
  2008-12-20  5:55                       ` [PATCH 12/16] ath9k: remove mode specific default noise floor values Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

The CCK and OFDM ANI error triggers are not mode specific but rather
band specific so just make use of the already available band from
ieee80211_conf.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/ani.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ani.c b/drivers/net/wireless/ath9k/ani.c
index 251e2d9..4dd0860 100644
--- a/drivers/net/wireless/ath9k/ani.c
+++ b/drivers/net/wireless/ath9k/ani.c
@@ -279,9 +279,8 @@ static void ath9k_ani_restart(struct ath_hal *ah)
 static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct ath9k_channel *chan = ah->ah_curchan;
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
 	struct ar5416AniState *aniState;
-	enum wireless_mode mode;
 	int32_t rssi;
 
 	if (!DO_ANI(ah))
@@ -336,8 +335,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
 					     aniState->firstepLevel + 1);
 		return;
 	} else {
-		mode = ath9k_hw_chan2wmode(ah, chan);
-		if (mode == ATH9K_MODE_11G || mode == ATH9K_MODE_11B) {
+		if (conf->channel->band == IEEE80211_BAND_2GHZ) {
 			if (!aniState->ofdmWeakSigDetectOff)
 				ath9k_hw_ani_control(ah,
 				     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
@@ -353,9 +351,8 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
 static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct ath9k_channel *chan = ah->ah_curchan;
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
 	struct ar5416AniState *aniState;
-	enum wireless_mode mode;
 	int32_t rssi;
 
 	if (!DO_ANI(ah))
@@ -381,8 +378,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah)
 			ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
 					     aniState->firstepLevel + 1);
 	} else {
-		mode = ath9k_hw_chan2wmode(ah, chan);
-		if (mode == ATH9K_MODE_11G || mode == ATH9K_MODE_11B) {
+		if (conf->channel->band == IEEE80211_BAND_2GHZ) {
 			if (aniState->firstepLevel > 0)
 				ath9k_hw_ani_control(ah,
 					     ATH9K_ANI_FIRSTEP_LEVEL, 0);
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 12/16] ath9k: remove mode specific default noise floor values
  2008-12-20  5:55                     ` [PATCH 11/16] ath9k: Make ANI CCK and OFDM error triggers band specific Luis R. Rodriguez
@ 2008-12-20  5:55                       ` Luis R. Rodriguez
  2008-12-20  5:55                         ` [PATCH 13/16] ath9k: remove ath9k_hw_chan2wmode() Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

The NOISE_FLOOR array we have is mode specific, and the only
possible indexed values are A, B and G. The mode routine only
can return G or A, so this is band specific. Then since the
values for A and G (5ghz or 2ghz) are the same (-96) we simply
remove the array and use a static value.

If we later determine we want to use special values for
HT configurations we can use the new mac80211 conf_is_ht*()
helpers.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/calib.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c
index 74369c1..f82554b 100644
--- a/drivers/net/wireless/ath9k/calib.c
+++ b/drivers/net/wireless/ath9k/calib.c
@@ -19,8 +19,6 @@
 #include "reg.h"
 #include "phy.h"
 
-static const int16_t NOISE_FLOOR[] = { -96, -93, -98, -96, -93, -96 };
-
 /* We can tune this as we go by monitoring really low values */
 #define ATH9K_NF_TOO_LOW	-60
 
@@ -752,10 +750,9 @@ s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan)
 			chan->channel, chan->channelFlags);
 		return ATH_DEFAULT_NOISE_FLOOR;
 	}
-	if (ichan->rawNoiseFloor == 0) {
-		enum wireless_mode mode = ath9k_hw_chan2wmode(ah, chan);
-		nf = NOISE_FLOOR[mode];
-	} else
+	if (ichan->rawNoiseFloor == 0)
+		nf = -96;
+	else
 		nf = ichan->rawNoiseFloor;
 
 	if (!ath9k_hw_nf_in_range(ah, nf))
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 13/16] ath9k: remove ath9k_hw_chan2wmode()
  2008-12-20  5:55                       ` [PATCH 12/16] ath9k: remove mode specific default noise floor values Luis R. Rodriguez
@ 2008-12-20  5:55                         ` Luis R. Rodriguez
  2008-12-20  5:55                           ` [PATCH 14/16] ath9k: remove ath9k_hw_check_chan() Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

The only left users are for timing for ACK timeout, slotime and
CTS timeout. We currently use an array CLOCK_RATE to keep
these values per mode and since as only will use A and G
we can depend on the band to get the appropriate values.

We note that we should be using a different clock rate value
for CCK, we can do this in separate patch, currently this is
being disregarded and should only affect when we want to
change the default ACK/CTS timeout or slot time and stuck
with using using 802.11b.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/hw.c |   46 ++++++++++++++++----------------------
 1 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index eb0ec06..436fbc8 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -23,7 +23,9 @@
 #include "phy.h"
 #include "initvals.h"
 
-static const u8 CLOCK_RATE[] = { 40, 80, 22, 44, 88, 40 };
+#define ATH9K_CLOCK_RATE_CCK		22
+#define ATH9K_CLOCK_RATE_5GHZ_OFDM	40
+#define ATH9K_CLOCK_RATE_2GHZ_OFDM	44
 
 extern struct hal_percal_data iq_cal_multi_sample;
 extern struct hal_percal_data iq_cal_single_sample;
@@ -48,17 +50,18 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
 
 static u32 ath9k_hw_mac_usec(struct ath_hal *ah, u32 clks)
 {
-	if (ah->ah_curchan != NULL)
-		return clks / CLOCK_RATE[ath9k_hw_chan2wmode(ah, ah->ah_curchan)];
-	else
-		return clks / CLOCK_RATE[ATH9K_MODE_11B];
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+	if (!ah->ah_curchan) /* should really check for CCK instead */
+		return clks / ATH9K_CLOCK_RATE_CCK;
+	if (conf->channel->band == IEEE80211_BAND_2GHZ)
+		return clks / ATH9K_CLOCK_RATE_2GHZ_OFDM;
+	return clks / ATH9K_CLOCK_RATE_5GHZ_OFDM;
 }
 
 static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks)
 {
-	struct ath9k_channel *chan = ah->ah_curchan;
-
-	if (chan && IS_CHAN_HT40(chan))
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+	if (conf_is_ht40(conf))
 		return ath9k_hw_mac_usec(ah, clks) / 2;
 	else
 		return ath9k_hw_mac_usec(ah, clks);
@@ -66,34 +69,23 @@ static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks)
 
 static u32 ath9k_hw_mac_clks(struct ath_hal *ah, u32 usecs)
 {
-	if (ah->ah_curchan != NULL)
-		return usecs * CLOCK_RATE[ath9k_hw_chan2wmode(ah,
-			ah->ah_curchan)];
-	else
-		return usecs * CLOCK_RATE[ATH9K_MODE_11B];
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+	if (!ah->ah_curchan) /* should really check for CCK instead */
+		return usecs *ATH9K_CLOCK_RATE_CCK;
+	if (conf->channel->band == IEEE80211_BAND_2GHZ)
+		return usecs *ATH9K_CLOCK_RATE_2GHZ_OFDM;
+	return usecs *ATH9K_CLOCK_RATE_5GHZ_OFDM;
 }
 
 static u32 ath9k_hw_mac_to_clks(struct ath_hal *ah, u32 usecs)
 {
-	struct ath9k_channel *chan = ah->ah_curchan;
-
-	if (chan && IS_CHAN_HT40(chan))
+	struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+	if (conf_is_ht40(conf))
 		return ath9k_hw_mac_clks(ah, usecs) * 2;
 	else
 		return ath9k_hw_mac_clks(ah, usecs);
 }
 
-enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah,
-			       const struct ath9k_channel *chan)
-{
-	if (IS_CHAN_B(chan))
-		return ATH9K_MODE_11B;
-	if (IS_CHAN_G(chan))
-		return ATH9K_MODE_11G;
-
-	return ATH9K_MODE_11A;
-}
-
 bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val)
 {
 	int i;
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 14/16] ath9k: remove ath9k_hw_check_chan()
  2008-12-20  5:55                         ` [PATCH 13/16] ath9k: remove ath9k_hw_chan2wmode() Luis R. Rodriguez
@ 2008-12-20  5:55                           ` Luis R. Rodriguez
  2008-12-20  5:55                             ` [PATCH 15/16] ath9k: remove superfluous check on changing channel Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

The only check we care about in ath9k_hw_check_chan() is
the internal regulatory check so use that.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/hw.c |   30 +++---------------------------
 1 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 436fbc8..7d5ca81 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -1627,30 +1627,6 @@ static bool ath9k_hw_chip_reset(struct ath_hal *ah,
 	return true;
 }
 
-static struct ath9k_channel *ath9k_hw_check_chan(struct ath_hal *ah,
-						 struct ath9k_channel *chan)
-{
-	if (!(IS_CHAN_2GHZ(chan) ^ IS_CHAN_5GHZ(chan))) {
-		DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-			"invalid channel %u/0x%x; not marked as "
-			"2GHz or 5GHz\n", chan->channel, chan->channelFlags);
-		return NULL;
-	}
-
-	if (!IS_CHAN_OFDM(chan) &&
-	    !IS_CHAN_B(chan) &&
-	    !IS_CHAN_HT20(chan) &&
-	    !IS_CHAN_HT40(chan)) {
-		DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-			"invalid channel %u/0x%x; not marked as "
-			"OFDM or CCK or HT20 or HT40PLUS or HT40MINUS\n",
-			chan->channel, chan->channelFlags);
-		return NULL;
-	}
-
-	return ath9k_regd_check_channel(ah, chan);
-}
-
 static bool ath9k_hw_channel_change(struct ath_hal *ah,
 				    struct ath9k_channel *chan,
 				    enum ath9k_ht_macmode macmode)
@@ -2203,10 +2179,10 @@ int ath9k_hw_reset(struct ath_hal *ah, bool bChannelChange)
 		ahp->ah_rxchainmask &= 0x3;
 	}
 
-	if (ath9k_hw_check_chan(ah, chan) == NULL) {
+	if (ath9k_regd_check_channel(ah, chan) == NULL) {
 		DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-			"invalid channel %u/0x%x; no mapping\n",
-			chan->channel, chan->channelFlags);
+			"invalid channel %u; no mapping\n",
+			channel->center_freq);
 		return -EINVAL;
 	}
 
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 15/16] ath9k: remove superfluous check on changing channel
  2008-12-20  5:55                           ` [PATCH 14/16] ath9k: remove ath9k_hw_check_chan() Luis R. Rodriguez
@ 2008-12-20  5:55                             ` Luis R. Rodriguez
  2008-12-20  5:55                               ` [PATCH 16/16] ath9k: fix sparse warnings Luis R. Rodriguez
  0 siblings, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

When we try to change the channel in ath9k its because
either the configuration indicates we *have* changed
channels or HT configuration has changed. In both cases
we want to do a reset. Either way mac80211 will inform us
when we want to actually change the channel so trust those
calls.

Although in the patch it may seem as I am doing more code
changes I am not, all I am doing is removing the initial
branch conditional and shifting the code to the left.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/main.c |  101 +++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 53 deletions(-)

diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 1385343..1f58d4b 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -270,63 +270,58 @@ static int ath_set_channel(struct ath_softc *sc, struct ieee80211_channel *c)
 
 	hchan = (struct ath9k_channel *) c->priv;
 
-	if (hchan->channel != sc->sc_ah->ah_curchan->channel ||
-	    hchan->channelFlags != sc->sc_ah->ah_curchan->channelFlags ||
-	    (sc->sc_flags & SC_OP_CHAINMASK_UPDATE) ||
-	    (sc->sc_flags & SC_OP_FULL_RESET)) {
-		/*
-		 * This is only performed if the channel settings have
-		 * actually changed.
-		 *
-		 * To switch channels clear any pending DMA operations;
-		 * wait long enough for the RX fifo to drain, reset the
-		 * hardware at the new frequency, and then re-enable
-		 * the relevant bits of the h/w.
-		 */
-		ath9k_hw_set_interrupts(ah, 0);
-		ath_draintxq(sc, false);
-		stopped = ath_stoprecv(sc);
+	/*
+	 * This is only performed if the channel settings have
+	 * actually changed.
+	 *
+	 * To switch channels clear any pending DMA operations;
+	 * wait long enough for the RX fifo to drain, reset the
+	 * hardware at the new frequency, and then re-enable
+	 * the relevant bits of the h/w.
+	 */
+	ath9k_hw_set_interrupts(ah, 0);
+	ath_draintxq(sc, false);
+	stopped = ath_stoprecv(sc);
 
-		/* XXX: do not flush receive queue here. We don't want
-		 * to flush data frames already in queue because of
-		 * changing channel. */
+	/* XXX: do not flush receive queue here. We don't want
+	 * to flush data frames already in queue because of
+	 * changing channel. */
 
-		if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
-			fastcc = false;
+	if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
+		fastcc = false;
 
-		DPRINTF(sc, ATH_DBG_CONFIG,
-			"(%u MHz) -> (%u MHz), chanwidth: %d\n",
-			sc->sc_ah->ah_curchan->channel,
-			c->center_freq, sc->tx_chan_width);
+	DPRINTF(sc, ATH_DBG_CONFIG,
+		"(%u MHz) -> (%u MHz), chanwidth: %d\n",
+		sc->sc_ah->ah_curchan->channel,
+		c->center_freq, sc->tx_chan_width);
 
-		spin_lock_bh(&sc->sc_resetlock);
+	spin_lock_bh(&sc->sc_resetlock);
 
-		r = ath9k_hw_reset(ah, fastcc);
-		if (r) {
-			DPRINTF(sc, ATH_DBG_FATAL,
-				"Unable to reset channel %u (%uMhz) "
-				"hal status %u\n",
-				ieee80211_frequency_to_channel(c->center_freq),
-				c->center_freq,
-				r);
-			spin_unlock_bh(&sc->sc_resetlock);
-			return r;
-		}
+	r = ath9k_hw_reset(ah, fastcc);
+	if (r) {
+		DPRINTF(sc, ATH_DBG_FATAL,
+		  "Unable to reset channel %u (%uMhz) "
+		  "hal status %u\n",
+		  ieee80211_frequency_to_channel(c->center_freq),
+		  c->center_freq, r);
 		spin_unlock_bh(&sc->sc_resetlock);
+		return r;
+	}
+	spin_unlock_bh(&sc->sc_resetlock);
 
-		sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE;
-		sc->sc_flags &= ~SC_OP_FULL_RESET;
-
-		if (ath_startrecv(sc) != 0) {
-			DPRINTF(sc, ATH_DBG_FATAL,
-				"Unable to restart recv logic\n");
-			return -EIO;
-		}
+	sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE;
+	sc->sc_flags &= ~SC_OP_FULL_RESET;
 
-		ath_cache_conf_rate(sc, &hw->conf);
-		ath_update_txpow(sc);
-		ath9k_hw_set_interrupts(ah, sc->sc_imask);
+	if (ath_startrecv(sc) != 0) {
+		DPRINTF(sc, ATH_DBG_FATAL,
+			"Unable to restart recv logic\n");
+		return -EIO;
 	}
+
+	ath_cache_conf_rate(sc, &hw->conf);
+	ath_update_txpow(sc);
+	ath9k_hw_set_interrupts(ah, sc->sc_imask);
+
 	return 0;
 }
 
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 16/16] ath9k: fix sparse warnings
  2008-12-20  5:55                             ` [PATCH 15/16] ath9k: remove superfluous check on changing channel Luis R. Rodriguez
@ 2008-12-20  5:55                               ` Luis R. Rodriguez
  0 siblings, 0 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20  5:55 UTC (permalink / raw)
  To: linville, linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

Fix sparse warnings:

drivers/net/wireless/ath9k/hw.c:1850:17: warning: symbol 'tmp' shadows an earlier one
drivers/net/wireless/ath9k/hw.c:1713:6: originally declared here
drivers/net/wireless/ath9k/hw.c:2051:17: warning: symbol 'tmp' shadows an earlier one
drivers/net/wireless/ath9k/hw.c:1961:6: originally declared here

drivers/net/wireless/ath9k/eeprom.c:195:6: warning: symbol 'ath9k_fill_eeprom' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:463:5: warning: symbol 'ath9k_check_eeprom' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:1219:6: warning: symbol 'ath9k_hw_set_def_power_per_rate_table' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:1510:6: warning: symbol 'ath9k_hw_set_4k_power_per_rate_table' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2007:5: warning: symbol 'ath9k_set_txpower' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2106:6: warning: symbol 'ath9k_set_addac' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2543:6: warning: symbol 'ath9k_eeprom_set_board_values' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2606:5: warning: symbol 'ath9k_get_eeprom_antenna_cfg' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2622:4: warning: symbol 'ath9k_hw_get_4k_num_ant_config' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2628:4: warning: symbol 'ath9k_hw_get_def_num_ant_config' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2647:4: warning: symbol 'ath9k_get_num_ant_config' was not declared. Should it be static?
drivers/net/wireless/ath9k/eeprom.c:2790:5: warning: symbol 'ath9k_get_eeprom' was not declared. Should it be static?

drivers/net/wireless/ath9k/calib.c:962:30: warning: symbol 'iq_cal_multi_sample' was not declared. Should it be static?
drivers/net/wireless/ath9k/calib.c:969:30: warning: symbol 'iq_cal_single_sample' was not declared. Should it be static?
drivers/net/wireless/ath9k/calib.c:976:30: warning: symbol 'adc_gain_cal_multi_sample' was not declared. Should it be static?
drivers/net/wireless/ath9k/calib.c:983:30: warning: symbol 'adc_gain_cal_single_sample' was not declared. Should it be static?
drivers/net/wireless/ath9k/calib.c:990:30: warning: symbol 'adc_dc_cal_multi_sample' was not declared. Should it be static?
drivers/net/wireless/ath9k/calib.c:997:30: warning: symbol 'adc_dc_cal_single_sample' was not declared. Should it be static?
drivers/net/wireless/ath9k/calib.c:1004:30: warning: symbol 'adc_init_dc_cal' was not declared. Should it be static?

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/eeprom.c |   30 ++++++++++++++++--------------
 drivers/net/wireless/ath9k/hw.c     |   16 ++++------------
 drivers/net/wireless/ath9k/hw.h     |    8 ++++++++
 3 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath9k/eeprom.c b/drivers/net/wireless/ath9k/eeprom.c
index 14f8d40..ccf57c3 100644
--- a/drivers/net/wireless/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath9k/eeprom.c
@@ -192,7 +192,7 @@ static bool ath9k_hw_fill_def_eeprom(struct ath_hal *ah)
 #undef SIZE_EEPROM_DEF
 }
 
-bool (*ath9k_fill_eeprom[]) (struct ath_hal *) = {
+static bool (*ath9k_fill_eeprom[]) (struct ath_hal *) = {
 	ath9k_hw_fill_def_eeprom,
 	ath9k_hw_fill_4k_eeprom
 };
@@ -460,7 +460,7 @@ static int ath9k_hw_check_4k_eeprom(struct ath_hal *ah)
 #undef EEPROM_4K_SIZE
 }
 
-int (*ath9k_check_eeprom[]) (struct ath_hal *) = {
+static int (*ath9k_check_eeprom[]) (struct ath_hal *) = {
 	ath9k_hw_check_def_eeprom,
 	ath9k_hw_check_4k_eeprom
 };
@@ -1216,7 +1216,7 @@ static bool ath9k_hw_set_4k_power_cal_table(struct ath_hal *ah,
 	return true;
 }
 
-bool ath9k_hw_set_def_power_per_rate_table(struct ath_hal *ah,
+static bool ath9k_hw_set_def_power_per_rate_table(struct ath_hal *ah,
 				       struct ath9k_channel *chan,
 				       int16_t *ratesArray,
 				       u16 cfgCtl,
@@ -1507,7 +1507,7 @@ bool ath9k_hw_set_def_power_per_rate_table(struct ath_hal *ah,
 	return true;
 }
 
-bool ath9k_hw_set_4k_power_per_rate_table(struct ath_hal *ah,
+static bool ath9k_hw_set_4k_power_per_rate_table(struct ath_hal *ah,
 				       struct ath9k_channel *chan,
 				       int16_t *ratesArray,
 				       u16 cfgCtl,
@@ -2004,7 +2004,7 @@ static int ath9k_hw_4k_set_txpower(struct ath_hal *ah,
 	return 0;
 }
 
-int (*ath9k_set_txpower[]) (struct ath_hal *,
+static int (*ath9k_set_txpower[]) (struct ath_hal *,
 			    struct ath9k_channel *,
 			    u16, u8, u8, u8) = {
 	ath9k_hw_def_set_txpower,
@@ -2103,7 +2103,7 @@ static void ath9k_hw_set_4k_addac(struct ath_hal *ah,
 	}
 }
 
-void (*ath9k_set_addac[]) (struct ath_hal *, struct ath9k_channel *) = {
+static void (*ath9k_set_addac[]) (struct ath_hal *, struct ath9k_channel *) = {
 	ath9k_hw_set_def_addac,
 	ath9k_hw_set_4k_addac
 };
@@ -2540,7 +2540,7 @@ static bool ath9k_hw_eeprom_set_4k_board_values(struct ath_hal *ah,
 	return true;
 }
 
-bool (*ath9k_eeprom_set_board_values[])(struct ath_hal *,
+static bool (*ath9k_eeprom_set_board_values[])(struct ath_hal *,
 					struct ath9k_channel *) = {
 	ath9k_hw_eeprom_set_def_board_values,
 	ath9k_hw_eeprom_set_4k_board_values
@@ -2603,7 +2603,8 @@ static int ath9k_hw_get_4k_eeprom_antenna_cfg(struct ath_hal *ah,
 	return -EINVAL;
 }
 
-int (*ath9k_get_eeprom_antenna_cfg[])(struct ath_hal *, struct ath9k_channel *,
+static int (*ath9k_get_eeprom_antenna_cfg[])(struct ath_hal *,
+				      struct ath9k_channel *,
 				      u8, u16 *) = {
 	ath9k_hw_get_def_eeprom_antenna_cfg,
 	ath9k_hw_get_4k_eeprom_antenna_cfg
@@ -2619,13 +2620,13 @@ int ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
 							     index, config);
 }
 
-u8 ath9k_hw_get_4k_num_ant_config(struct ath_hal *ah,
+static u8 ath9k_hw_get_4k_num_ant_config(struct ath_hal *ah,
 			       enum ieee80211_band freq_band)
 {
 	return 1;
 }
 
-u8 ath9k_hw_get_def_num_ant_config(struct ath_hal *ah,
+static u8 ath9k_hw_get_def_num_ant_config(struct ath_hal *ah,
 			       enum ieee80211_band freq_band)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
@@ -2644,9 +2645,10 @@ u8 ath9k_hw_get_def_num_ant_config(struct ath_hal *ah,
 	return num_ant_config;
 }
 
-u8 (*ath9k_get_num_ant_config[])(struct ath_hal *, enum ieee80211_band) = {
-	ath9k_hw_get_def_num_ant_config,
-	ath9k_hw_get_4k_num_ant_config
+static u8 (*ath9k_get_num_ant_config[])(struct ath_hal *,
+	enum ieee80211_band) = {
+	  ath9k_hw_get_def_num_ant_config,
+	  ath9k_hw_get_4k_num_ant_config
 };
 
 u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah,
@@ -2787,7 +2789,7 @@ static u32 ath9k_hw_get_eeprom_def(struct ath_hal *ah,
 	}
 }
 
-u32 (*ath9k_get_eeprom[])(struct ath_hal *, enum eeprom_param) = {
+static u32 (*ath9k_get_eeprom[])(struct ath_hal *, enum eeprom_param) = {
 	ath9k_hw_get_eeprom_def,
 	ath9k_hw_get_eeprom_4k
 };
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index 7d5ca81..75ab052 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
@@ -27,14 +27,6 @@
 #define ATH9K_CLOCK_RATE_5GHZ_OFDM	40
 #define ATH9K_CLOCK_RATE_2GHZ_OFDM	44
 
-extern struct hal_percal_data iq_cal_multi_sample;
-extern struct hal_percal_data iq_cal_single_sample;
-extern struct hal_percal_data adc_gain_cal_multi_sample;
-extern struct hal_percal_data adc_gain_cal_single_sample;
-extern struct hal_percal_data adc_dc_cal_multi_sample;
-extern struct hal_percal_data adc_dc_cal_single_sample;
-extern struct hal_percal_data adc_init_dc_cal;
-
 static bool ath9k_hw_set_reset_reg(struct ath_hal *ah, u32 type);
 static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan,
 			      enum ath9k_ht_macmode macmode);
@@ -1847,9 +1839,9 @@ static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel
 		if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
 
 			/* workaround for gcc bug #37014 */
-			volatile int tmp = abs(cur_vit_mask - bin);
+			volatile int tmp_v = abs(cur_vit_mask - bin);
 
-			if (tmp < 75)
+			if (tmp_v < 75)
 				mask_amt = 1;
 			else
 				mask_amt = 0;
@@ -2048,9 +2040,9 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
 		if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
 
 			/* workaround for gcc bug #37014 */
-			volatile int tmp = abs(cur_vit_mask - bin);
+			volatile int tmp_v = abs(cur_vit_mask - bin);
 
-			if (tmp < 75)
+			if (tmp_v < 75)
 				mask_amt = 1;
 			else
 				mask_amt = 0;
diff --git a/drivers/net/wireless/ath9k/hw.h b/drivers/net/wireless/ath9k/hw.h
index 91d8f59..3ae3b88 100644
--- a/drivers/net/wireless/ath9k/hw.h
+++ b/drivers/net/wireless/ath9k/hw.h
@@ -20,6 +20,14 @@
 #include <linux/if_ether.h>
 #include <linux/delay.h>
 
+extern const struct hal_percal_data iq_cal_multi_sample;
+extern const struct hal_percal_data iq_cal_single_sample;
+extern const struct hal_percal_data adc_gain_cal_multi_sample;
+extern const struct hal_percal_data adc_gain_cal_single_sample;
+extern const struct hal_percal_data adc_dc_cal_multi_sample;
+extern const struct hal_percal_data adc_dc_cal_single_sample;
+extern const struct hal_percal_data adc_init_dc_cal;
+
 struct ar5416_desc {
 	u32 ds_link;
 	u32 ds_data;
-- 
1.5.6.rc2.15.g457bb.dirty


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/16] ath9k: first series for regulatory cleanup
  2008-12-20  5:55 [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
  2008-12-20  5:55 ` [PATCH 01/16] mac80211: add HT conf helpers Luis R. Rodriguez
@ 2008-12-20 19:10 ` Luis R. Rodriguez
  2008-12-22 15:57   ` Luis R. Rodriguez
  1 sibling, 1 reply; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-20 19:10 UTC (permalink / raw)
  To: linville; +Cc: Luis R. Rodriguez, linux-wireless, ath9k-devel

On Fri, Dec 19, 2008 at 9:55 PM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:

> This should not have any major functional changes, its mostly
> cleanup stuff. I've tested HT20 on 2 GHz, will test 5 GHz tomorrow
> with the HT20/HT40 configurations but I figured I'll get this out
> today. If someone beats me to testing 5 GHz HT20/HT40 configs me
> please let me know.

OK I've tested 5 GHz 802.11a, and 11NAHT40MINUS and found no
regressions. My AP didn't like to set itself to 11NAHT40PLUS but I
think that should be OK.

  Luis

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 01/16] mac80211: add HT conf helpers
  2008-12-20  5:55 ` [PATCH 01/16] mac80211: add HT conf helpers Luis R. Rodriguez
  2008-12-20  5:55   ` [PATCH 02/16] ath9k: use hw->conf on ath_setcurmode() Luis R. Rodriguez
@ 2008-12-20 21:06   ` Tomas Winkler
  2008-12-21 10:32     ` Johannes Berg
  1 sibling, 1 reply; 22+ messages in thread
From: Tomas Winkler @ 2008-12-20 21:06 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linville, johannes, linux-wireless, ath9k-devel, buytenh

On Sat, Dec 20, 2008 at 7:55 AM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:
> In HT capable drivers you often need to check if you
> are currently using HT20 or HT40. This adds a few small
> helpers to let drivers figure that out.
>
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> ---
>  include/net/mac80211.h |   40 ++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 40 insertions(+), 0 deletions(-)
>
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index b3bd00a..33891f9 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -1963,4 +1963,44 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
>  int ieee80211_rate_control_register(struct rate_control_ops *ops);
>  void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
>
> +static inline bool
> +conf_is_ht20(struct ieee80211_conf *conf)
> +{
> +       if (conf->ht.channel_type == NL80211_CHAN_HT20)

why not just
          return (conf->ht.channel_type == NL80211_CHAN_HT20);

Tomas

>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 01/16] mac80211: add HT conf helpers
  2008-12-20 21:06   ` [PATCH 01/16] mac80211: add HT conf helpers Tomas Winkler
@ 2008-12-21 10:32     ` Johannes Berg
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Berg @ 2008-12-21 10:32 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Luis R. Rodriguez, linville, linux-wireless, ath9k-devel, buytenh

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

On Sat, 2008-12-20 at 23:06 +0200, Tomas Winkler wrote:

> > +static inline bool
> > +conf_is_ht20(struct ieee80211_conf *conf)
> > +{
> > +       if (conf->ht.channel_type == NL80211_CHAN_HT20)
> 
> why not just
>           return (conf->ht.channel_type == NL80211_CHAN_HT20);

I agree, the if looks pretty odd.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 05/16] wireless: allow for private channel area
  2008-12-20  5:55         ` [PATCH 05/16] wireless: allow for private channel area Luis R. Rodriguez
  2008-12-20  5:55           ` [PATCH 06/16] ath9k: start making use of channel->priv Luis R. Rodriguez
@ 2008-12-21 10:34           ` Johannes Berg
  1 sibling, 0 replies; 22+ messages in thread
From: Johannes Berg @ 2008-12-21 10:34 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless, ath9k-devel, kalle.valo

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]

On Fri, 2008-12-19 at 21:55 -0800, Luis R. Rodriguez wrote:
> Wireless drivers tend to require calibration or noise floor
> checks. Some of these operations are channel specific. Instead
> of forcing each driver to keep a separate map for these values
> per channel allow for a private area on the ieee80211_channel to
> reduce code overhead and size.
> 
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>

I don't like this much. This is prone to abuse, it'll only be right when
you have allocated channel arrays statically.

Can't you do something like I do in ar9170 and put the other information
into a table that is indexed by hw_key_idx? That even reduces the memory
usage :)

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 00/16] ath9k: first series for regulatory cleanup
  2008-12-20 19:10 ` [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
@ 2008-12-22 15:57   ` Luis R. Rodriguez
  0 siblings, 0 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2008-12-22 15:57 UTC (permalink / raw)
  To: linville@tuxdriver.com
  Cc: Luis Rodriguez, linux-wireless@vger.kernel.org,
	ath9k-devel@lists.ath9k.org

On Sat, Dec 20, 2008 at 11:10:19AM -0800, Luis Rodriguez wrote:
> On Fri, Dec 19, 2008 at 9:55 PM, Luis R. Rodriguez
> <lrodriguez@atheros.com> wrote:
> 
> > This should not have any major functional changes, its mostly
> > cleanup stuff. I've tested HT20 on 2 GHz, will test 5 GHz tomorrow
> > with the HT20/HT40 configurations but I figured I'll get this out
> > today. If someone beats me to testing 5 GHz HT20/HT40 configs me
> > please let me know.
> 
> OK I've tested 5 GHz 802.11a, and 11NAHT40MINUS and found no
> regressions. My AP didn't like to set itself to 11NAHT40PLUS but I
> think that should be OK.

John,

I'll resubmit with the few changes pointed out by Tomas/Johannes and Jouni.

  Luis

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2008-12-22 15:57 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-20  5:55 [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
2008-12-20  5:55 ` [PATCH 01/16] mac80211: add HT conf helpers Luis R. Rodriguez
2008-12-20  5:55   ` [PATCH 02/16] ath9k: use hw->conf on ath_setcurmode() Luis R. Rodriguez
2008-12-20  5:55     ` [PATCH 03/16] ath9k: remove cache of rate preference when using 11g protection Luis R. Rodriguez
2008-12-20  5:55       ` [PATCH 04/16] ath9k: Rename ath_setcurmode() to ath_cache_conf_rate() Luis R. Rodriguez
2008-12-20  5:55         ` [PATCH 05/16] wireless: allow for private channel area Luis R. Rodriguez
2008-12-20  5:55           ` [PATCH 06/16] ath9k: start making use of channel->priv Luis R. Rodriguez
2008-12-20  5:55             ` [PATCH 07/16] ath9k: consolidate arguments on hw reset Luis R. Rodriguez
2008-12-20  5:55               ` [PATCH 08/16] ath9k: make request to get the noisefloor threshold band specific Luis R. Rodriguez
2008-12-20  5:55                 ` [PATCH 09/16] ath9k: use ieee80211_conf on ath9k_hw_iscal_supported() Luis R. Rodriguez
2008-12-20  5:55                   ` [PATCH 10/16] ath9k: make use of conf_is_ht40() in the rest of the driver Luis R. Rodriguez
2008-12-20  5:55                     ` [PATCH 11/16] ath9k: Make ANI CCK and OFDM error triggers band specific Luis R. Rodriguez
2008-12-20  5:55                       ` [PATCH 12/16] ath9k: remove mode specific default noise floor values Luis R. Rodriguez
2008-12-20  5:55                         ` [PATCH 13/16] ath9k: remove ath9k_hw_chan2wmode() Luis R. Rodriguez
2008-12-20  5:55                           ` [PATCH 14/16] ath9k: remove ath9k_hw_check_chan() Luis R. Rodriguez
2008-12-20  5:55                             ` [PATCH 15/16] ath9k: remove superfluous check on changing channel Luis R. Rodriguez
2008-12-20  5:55                               ` [PATCH 16/16] ath9k: fix sparse warnings Luis R. Rodriguez
2008-12-21 10:34           ` [PATCH 05/16] wireless: allow for private channel area Johannes Berg
2008-12-20 21:06   ` [PATCH 01/16] mac80211: add HT conf helpers Tomas Winkler
2008-12-21 10:32     ` Johannes Berg
2008-12-20 19:10 ` [PATCH 00/16] ath9k: first series for regulatory cleanup Luis R. Rodriguez
2008-12-22 15:57   ` Luis R. Rodriguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).