Steve Iribarne | 1 Aug 2008 01:27

kconfig questions

I am trying to build the ath9k into my kernel.

I have 2.6.17. 

 

I have a MIPS based processor (Cavium). 

I have the latest code received this morning using git.

 

I then modified ./drivers/net/wireless/Kconfig and Makefile (using the patch file)

I copied the ath9k directory into the right place.

 

Now I’ve notice with my kernel that MAC80211 and WLAN_80211 are not defined anywhere.  I believe the MAC80211 is IEEE80211.  This has either been recently renamed to MAC80211 or the kernel version has recently changed this from MAC80211 to IEEE80211.  It was easy to check because I am following instructions on a website and it pretty much spells out what I am suppose to have checked off.

So I think I can just fix that.

 

However, the trouble I am having is trying to determine where WLAN_80211 is setup.  Did this change or is this not in my kernel at all?  So can someone tell me where the heck that is defined?  Is it NET_RADIO???

 

Thanks.

 

-stv

 

P Please consider your environmental responsibility before printing this e-mail & any document

Steve Iribarne

Advanced Technologies Group

Office: +1 510 279 3365
Email: steve.iribarne <at> u4eatech.com

http://www.u4eatech.com

 

_______________________________________________
ath9k-devel mailing list
ath9k-devel <at> lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Alexandros C. Couloumbis | 1 Aug 2008 12:18
Favicon

expand_expr_real_1 internal compiler error on mips/openwrt

Greetings,

A few days ago I've filed the following bug:
https://dev.openwrt.org/cgi-bin/trac.fcgi/ticket/3816

regards,

--
Alexandros C. Couloumbis
http://dev.ozo.com/
Kevin Mitchell | 1 Aug 2008 13:38
Picon

Re: kconfig questions

I doubt you're going to get this up and running on that kernel. There
have been significant changes in the wireless stack since then. The
mac80211 subsystem upon which ath9k is built was not included until
sometime in the .20's I believe. Intel is working on backporting it
but they only have it back to 2.6.18:

http://intellinuxwireless.org/?p=mac80211&n=HOWTO-mac80211

However since ath9k won't even build on an unmodified 2.6.26,  I'm
doubt even that will work without some significant tinkering.

Kevin

2008/7/31 Steve Iribarne <Steve.Iribarne <at> u4eatech.com>:
> I am trying to build the ath9k into my kernel.
>
> I have 2.6.17.
>
>
>
> I have a MIPS based processor (Cavium).
>
> I have the latest code received this morning using git.
>
>
>
> I then modified ./drivers/net/wireless/Kconfig and Makefile (using the patch
> file)
>
> I copied the ath9k directory into the right place.
>
>
>
> Now I've notice with my kernel that MAC80211 and WLAN_80211 are not defined
> anywhere.  I believe the MAC80211 is IEEE80211.  This has either been
> recently renamed to MAC80211 or the kernel version has recently changed this
> from MAC80211 to IEEE80211.  It was easy to check because I am following
> instructions on a website and it pretty much spells out what I am suppose to
> have checked off.
>
> So I think I can just fix that.
>
>
>
> However, the trouble I am having is trying to determine where WLAN_80211 is
> setup.  Did this change or is this not in my kernel at all?  So can someone
> tell me where the heck that is defined?  Is it NET_RADIO???
>
>
>
> Thanks.
>
>
>
> -stv
>
>
>
> P Please consider your environmental responsibility before printing this
> e-mail & any document
>
> Steve Iribarne
>
> Advanced Technologies Group
>
> Office: +1 510 279 3365
> Email: steve.iribarne <at> u4eatech.com
>
> http://www.u4eatech.com
>
>
>
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel <at> lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>
>
Steve Iribarne | 1 Aug 2008 16:49

Re: kconfig questions

Shoot.  I think I found the problem last night. I read somewhere that I need to have kernel 2.6.18 or better.  Is that true?

 

From: ath9k-devel-bounces <at> lists.ath9k.org [mailto:ath9k-devel-bounces <at> lists.ath9k.org] On Behalf Of Steve Iribarne
Sent: Thursday, July 31, 2008 4:27 PM
To: ath9k-devel <at> lists.ath9k.org
Subject: [ath9k-devel] kconfig questions

 

I am trying to build the ath9k into my kernel.

I have 2.6.17. 

 

I have a MIPS based processor (Cavium). 

I have the latest code received this morning using git.

 

I then modified ./drivers/net/wireless/Kconfig and Makefile (using the patch file)

I copied the ath9k directory into the right place.

 

Now I’ve notice with my kernel that MAC80211 and WLAN_80211 are not defined anywhere.  I believe the MAC80211 is IEEE80211.  This has either been recently renamed to MAC80211 or the kernel version has recently changed this from MAC80211 to IEEE80211.  It was easy to check because I am following instructions on a website and it pretty much spells out what I am suppose to have checked off.

So I think I can just fix that.

 

However, the trouble I am having is trying to determine where WLAN_80211 is setup.  Did this change or is this not in my kernel at all?  So can someone tell me where the heck that is defined?  Is it NET_RADIO???

 

Thanks.

 

-stv

 

P Please consider your environmental responsibility before printing this e-mail & any document

Steve Iribarne

Advanced Technologies Group

Office: +1 510 279 3365
Email: steve.iribarne <at> u4eatech.com

http://www.u4eatech.com

 

_______________________________________________
ath9k-devel mailing list
ath9k-devel <at> lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Steve Iribarne | 1 Aug 2008 16:49

Re: kconfig questions

Thanks Kevin.  :)

-----Original Message-----
From: ath9k-devel-bounces <at> lists.ath9k.org
[mailto:ath9k-devel-bounces <at> lists.ath9k.org] On Behalf Of Kevin Mitchell
Sent: Friday, August 01, 2008 4:39 AM
To: Steve Iribarne
Cc: ath9k-devel <at> lists.ath9k.org
Subject: Re: [ath9k-devel] kconfig questions

I doubt you're going to get this up and running on that kernel. There
have been significant changes in the wireless stack since then. The
mac80211 subsystem upon which ath9k is built was not included until
sometime in the .20's I believe. Intel is working on backporting it
but they only have it back to 2.6.18:

http://intellinuxwireless.org/?p=mac80211&n=HOWTO-mac80211

However since ath9k won't even build on an unmodified 2.6.26,  I'm
doubt even that will work without some significant tinkering.

Kevin

2008/7/31 Steve Iribarne <Steve.Iribarne <at> u4eatech.com>:
> I am trying to build the ath9k into my kernel.
>
> I have 2.6.17.
>
>
>
> I have a MIPS based processor (Cavium).
>
> I have the latest code received this morning using git.
>
>
>
> I then modified ./drivers/net/wireless/Kconfig and Makefile (using the
patch
> file)
>
> I copied the ath9k directory into the right place.
>
>
>
> Now I've notice with my kernel that MAC80211 and WLAN_80211 are not
defined
> anywhere.  I believe the MAC80211 is IEEE80211.  This has either been
> recently renamed to MAC80211 or the kernel version has recently
changed this
> from MAC80211 to IEEE80211.  It was easy to check because I am
following
> instructions on a website and it pretty much spells out what I am
suppose to
> have checked off.
>
> So I think I can just fix that.
>
>
>
> However, the trouble I am having is trying to determine where
WLAN_80211 is
> setup.  Did this change or is this not in my kernel at all?  So can
someone
> tell me where the heck that is defined?  Is it NET_RADIO???
>
>
>
> Thanks.
>
>
>
> -stv
>
>
>
> P Please consider your environmental responsibility before printing
this
> e-mail & any document
>
> Steve Iribarne
>
> Advanced Technologies Group
>
> Office: +1 510 279 3365
> Email: steve.iribarne <at> u4eatech.com
>
> http://www.u4eatech.com
>
>
>
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel <at> lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>
>
_______________________________________________
ath9k-devel mailing list
ath9k-devel <at> lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel
Luis R. Rodriguez | 3 Aug 2008 01:48
Favicon

[PATCH 00/12] ath9k: more cleanups for 2.6.27

Here's another round of cleanups a few fixes for 2.6.27.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Luis R. Rodriguez | 3 Aug 2008 01:48
Favicon

[PATCH 02/12] ath9k: Update rate control after association

From: Sujith Manoharan <smanoharan@...>

Rate control node has to be updated after setting the channel.
And remove an unused variable in ath_rate_newstate(). Be sure
to have a proper rate table for 11a mode before updating the
rate control based on the new mode.

Signed-off-by: Sujith <Sujith.Manoharan@...>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@...>
Signed-off-by: Luis R. Rodriguez <lrodriguez@...>
---
 drivers/net/wireless/ath9k/core.c |    2 +-
 drivers/net/wireless/ath9k/core.h |    1 +
 drivers/net/wireless/ath9k/main.c |   11 ++++++-----
 drivers/net/wireless/ath9k/rc.c   |    7 ++++---
 drivers/net/wireless/ath9k/rc.h   |    3 ++-
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index 587f307..6a61064 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
 <at>  <at>  -595,7 +595,7  <at>  <at>  int ath_vap_listen(struct ath_softc *sc, int if_id)
 #endif

 	/* update ratectrl about the new state */
-	ath_rate_newstate(sc, avp, 0);
+	ath_rate_newstate(sc, avp);

 	rfilt = ath_calcrxfilter(sc);
 	ath9k_hw_setrxfilter(ah, rfilt);
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index fdd0f87..e2b42f2 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
 <at>  <at>  -792,6 +792,7  <at>  <at>  struct ath_vap {
 						transmit queue */
 	struct ath_vap_config           av_config;  /* vap configuration
 					parameters from 802.11 protocol layer*/
+	struct ath_rate_node            *rc_node;
 };

 int ath_vap_attach(struct ath_softc *sc,
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 7ef0d58..c47ef50 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
 <at>  <at>  -447,7 +447,7  <at>  <at>  static void ath9k_remove_interface(struct ieee80211_hw *hw,
 #endif

 	/* Update ratectrl */
-	ath_rate_newstate(sc, avp, 0);
+	ath_rate_newstate(sc, avp);

 	/* Reclaim beacon resources */
 	if (sc->sc_opmode == HAL_M_HOSTAP || sc->sc_opmode == HAL_M_IBSS) {
 <at>  <at>  -513,7 +513,7  <at>  <at>  static int ath9k_config_interface(struct ieee80211_hw *hw,
 		case IEEE80211_IF_TYPE_STA:
 		case IEEE80211_IF_TYPE_IBSS:
 			/* Update ratectrl about the new state */
-			ath_rate_newstate(sc, avp, 0);
+			ath_rate_newstate(sc, avp);

 			/* Set rx filter */
 			rfilt = ath_calcrxfilter(sc);
 <at>  <at>  -788,9 +788,6  <at>  <at>  static void ath9k_bss_assoc_info(struct ath_softc *sc,
 			return;
 		}

-		/* Update ratectrl about the new state */
-		ath_rate_newstate(sc, avp, 1);
-
 		/* New association, store aid */
 		if (avp->av_opmode == HAL_M_STA) {
 			sc->sc_curaid = bss_conf->aid;
 <at>  <at>  -828,6 +825,10  <at>  <at>  static void ath9k_bss_assoc_info(struct ath_softc *sc,
 			DPRINTF(sc, ATH_DBG_FATAL,
 				"%s: Unable to set channel\n",
 				__func__);
+
+		ath_rate_newstate(sc, avp);
+		/* Update ratectrl about the new state */
+		ath_rc_node_update(hw, avp->rc_node);
 	} else {
 		DPRINTF(sc, ATH_DBG_CONFIG,
 		"%s: Bss Info DISSOC\n", __func__);
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 83b8f2d..ecab05f 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
 <at>  <at>  -797,6 +797,8  <at>  <at>  static struct ath_rate_node *ath_rate_node_alloc(struct ath_vap *avp,

 	anode->avp = avp;
 	anode->asc = rsc;
+	avp->rc_node = anode;
+
 	return anode;
 }

 <at>  <at>  -838,7 +840,7  <at>  <at>  u_int8_t ath_rate_findrateix(struct ath_softc *sc,
  * with an AP.  Otherwise this gets called, for example, when
  * the we transition to run state when operating as an AP.
  */
-void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp, int up)
+void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp)
 {
 	struct ath_rate_softc *asc = sc->sc_rc;

 <at>  <at>  -1833,8 +1835,7  <at>  <at>  static void ath_setup_rates(struct ieee80211_local *local, struct sta_info *sta)
 	rc_priv->neg_rates.rs_nrates = j;
 }

-static void ath_rc_node_update(struct ieee80211_hw *hw,
-				struct ath_rate_node *rc_priv)
+void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv)
 {
 	struct ath_softc *sc = hw->priv;
 	u_int32_t capflag = 0;
diff --git a/drivers/net/wireless/ath9k/rc.h b/drivers/net/wireless/ath9k/rc.h
index 3ed04b2..1c54924 100644
--- a/drivers/net/wireless/ath9k/rc.h
+++ b/drivers/net/wireless/ath9k/rc.h
 <at>  <at>  -294,7 +294,8  <at>  <at>  void ath_rate_detach(struct ath_rate_softc *asc);
  * Important mostly as the analog to ath_rate_newassoc when operating
  * in station mode.
  */
-void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp, int up);
+void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv);
+void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp);

 /*
  * Return the tx rate series.
--

-- 
1.5.6.rc2.15.g457bb.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Luis R. Rodriguez | 3 Aug 2008 01:48
Favicon

[PATCH 03/12] ath9k: Channel cleanup

From: Sujith Manoharan <smanoharan@...>

Rename hal_channel_internal as ath9k_channel and remove
a few unused variables.

Signed-off-by: Sujith <Sujith.Manoharan@...>
Signed-off-by: Luis R. Rodriguez <lrodriguez@...>
---
 drivers/net/wireless/ath9k/ath9k.h |   18 +++-------
 drivers/net/wireless/ath9k/hw.c    |   70 ++++++++++++++++++------------------
 drivers/net/wireless/ath9k/phy.c   |    6 ++--
 drivers/net/wireless/ath9k/phy.h   |    6 ++--
 drivers/net/wireless/ath9k/regd.c  |   24 ++++++------
 5 files changed, 58 insertions(+), 66 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index c3294c0..de80a66 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
 <at>  <at>  -469,29 +469,21  <at>  <at>  struct hal_channel {
 	 CHANNEL_HT40PLUS |			\
 	 CHANNEL_HT40MINUS)

-struct hal_channel_internal {
+struct ath9k_channel {
 	u_int16_t channel;
 	u_int32_t channelFlags;
 	u_int8_t privFlags;
 	int8_t maxRegTxPower;
 	int8_t maxTxPower;
 	int8_t minTxPower;
-	bool bssSendHere;
-	u_int8_t gainI;
-	bool iqCalValid;
 	int32_t CalValid;
 	bool oneTimeCalsDone;
 	int8_t iCoff;
 	int8_t qCoff;
 	int16_t rawNoiseFloor;
-	int16_t noiseFloorAdjust;
 	int8_t antennaMax;
 	u_int32_t regDmnFlags;
 	u_int32_t conformanceTestLimit;
-	u_int64_t ah_tsf_last;
-	u_int64_t ah_channel_time;
-	u_int16_t mainSpur;
-	u_int64_t dfsTsf;
 #ifdef ATH_NF_PER_CHAN
 	struct hal_nfcal_hist nfCalHist[NUM_NF_READINGS];
 #endif
 <at>  <at>  -902,9 +894,9  <at>  <at>  struct ath_hal {
 	char ah_iso[4];
 	enum start_adhoc_option ah_adHocMode;
 	bool ah_commonMode;
-	struct hal_channel_internal ah_channels[150];
+	struct ath9k_channel ah_channels[150];
 	u_int ah_nchan;
-	struct hal_channel_internal *ah_curchan;
+	struct ath9k_channel *ah_curchan;
 	u_int16_t ah_rfsilent;
 	bool ah_rfkillEnabled;
 	bool ah_isPciExpress;
 <at>  <at>  -1077,7 +1069,7  <at>  <at>  bool ath9k_hw_gettxqueueprops(struct ath_hal *ah, int q,
 			      struct hal_txq_info *qInfo);
 bool ath9k_hw_settxqueueprops(struct ath_hal *ah, int q,
 			      const struct hal_txq_info *qInfo);
-struct hal_channel_internal *ath9k_regd_check_channel(struct ath_hal *ah,
+struct ath9k_channel *ath9k_regd_check_channel(struct ath_hal *ah,
 					      const struct hal_channel *c);
 void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
 			    u_int pktLen, enum hal_pkt_type type,
 <at>  <at>  -1133,7 +1125,7  <at>  <at>  const char *ath9k_hw_probe(u_int16_t vendorid, u_int16_t devid);
 bool ath9k_hw_disable(struct ath_hal *ah);
 void ath9k_hw_rfdetach(struct ath_hal *ah);
 void ath9k_hw_get_channel_centers(struct ath_hal *ah,
-				  struct hal_channel_internal *chan,
+				  struct ath9k_channel *chan,
 				  struct chan_centers *centers);
 bool ath9k_get_channel_edges(struct ath_hal *ah,
 			     u_int16_t flags, u_int16_t *low,
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c
index a16dbfb..35b9445 100644
--- a/drivers/net/wireless/ath9k/hw.c
+++ b/drivers/net/wireless/ath9k/hw.c
 <at>  <at>  -483,7 +483,7  <at>  <at>  static u_int8_t ath9k_hw_get_num_ant_config(struct ath_hal_5416 *ahp,

 static enum hal_status
 ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal_5416 *ahp,
-				struct hal_channel_internal *chan,
+				struct ath9k_channel *chan,
 				u_int8_t index,
 				u_int16_t *config)
 {
 <at>  <at>  -556,7 +556,7  <at>  <at>  static inline bool ath9k_hw_fill_eeprom(struct ath_hal *ah)
 /* XXX: Clean me up, make me more legible */
 static bool
 ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
-				 struct hal_channel_internal *chan)
+				 struct ath9k_channel *chan)
 {
 	struct modal_eep_header *pModal;
 	int i, regChainOffset;
 <at>  <at>  -1662,7 +1662,7  <at>  <at>  static bool ath9k_hw_set_reset_reg(struct ath_hal *ah,
 	}
 }

-static inline struct hal_channel_internal *ath9k_hw_check_chan(
+static inline struct ath9k_channel *ath9k_hw_check_chan(
 			struct ath_hal *ah, struct hal_channel *chan)
 {
 	if ((IS(chan, CHANNEL_2GHZ) ^ IS(chan, CHANNEL_5GHZ)) == 0) {
 <at>  <at>  -1848,7 +1848,7  <at>  <at>  static void ar5416GetNoiseFloor(struct ath_hal *ah,

 static bool
 getNoiseFloorThresh(struct ath_hal *ah,
-		    const struct hal_channel_internal *chan,
+		    const struct ath9k_channel *chan,
 		    int16_t *nft)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
 <at>  <at>  -1886,7 +1886,7  <at>  <at>  static void ath9k_hw_start_nfcal(struct ath_hal *ah)
 }

 static void
-ath9k_hw_loadnf(struct ath_hal *ah, struct hal_channel_internal *chan)
+ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan)
 {
 	struct hal_nfcal_hist *h;
 	int i, j;
 <at>  <at>  -1945,7 +1945,7  <at>  <at>  ath9k_hw_loadnf(struct ath_hal *ah, struct hal_channel_internal *chan)
 }

 static int16_t ath9k_hw_getnf(struct ath_hal *ah,
-			      struct hal_channel_internal *chan)
+			      struct ath9k_channel *chan)
 {
 	int16_t nf, nfThresh;
 	int16_t nfarray[NUM_NF_READINGS] = { 0 };
 <at>  <at>  -2032,7 +2032,7  <at>  <at>  static void ath9k_hw_disable_mib_counters(struct ath_hal *ah)
 }

 static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah,
-					struct hal_channel_internal *chan)
+					struct ath9k_channel *chan)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
 	int i;
 <at>  <at>  -2355,7 +2355,7  <at>  <at>  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 hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;
 	struct ar5416AniState *aniState;
 	enum wireless_mode mode;
 	int32_t rssi;
 <at>  <at>  -2431,7 +2431,7  <at>  <at>  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 hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;
 	struct ar5416AniState *aniState;
 	enum wireless_mode mode;
 	int32_t rssi;
 <at>  <at>  -2473,7 +2473,7  <at>  <at>  static void ath9k_ani_reset(struct ath_hal *ah)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
 	struct ar5416AniState *aniState;
-	struct hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;
 	int index;

 	if (!DO_ANI(ah))
 <at>  <at>  -3581,7 +3581,7  <at>  <at>  static inline bool ath9k_hw_fill_vpd_table(u_int8_t pwrMin,

 static inline void
 ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hal *ah,
-				    struct hal_channel_internal *chan,
+				    struct ath9k_channel *chan,
 				    struct cal_data_per_freq *pRawDataSet,
 				    u_int8_t *bChans,
 				    u_int16_t availPiers,
 <at>  <at>  -3764,7 +3764,7  <at>  <at>  ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hal *ah,
 static inline bool
 ath9k_hw_set_power_cal_table(struct ath_hal *ah,
 			     struct ar5416_eeprom *pEepData,
-			     struct hal_channel_internal *chan,
+			     struct ath9k_channel *chan,
 			     int16_t *pTxPowerIndexOffset)
 {
 	struct cal_data_per_freq *pRawDataset;
 <at>  <at>  -3966,7 +3966,7  <at>  <at>  void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore)

 static inline void
 ath9k_hw_get_legacy_target_powers(struct ath_hal *ah,
-				  struct hal_channel_internal *chan,
+				  struct ath9k_channel *chan,
 				  struct cal_target_power_leg *powInfo,
 				  u_int16_t numChannels,
 				  struct cal_target_power_leg *pNewPower,
 <at>  <at>  -4032,7 +4032,7  <at>  <at>  ath9k_hw_get_legacy_target_powers(struct ath_hal *ah,

 static inline void
 ath9k_hw_get_target_powers(struct ath_hal *ah,
-			   struct hal_channel_internal *chan,
+			   struct ath9k_channel *chan,
 			   struct cal_target_power_ht *powInfo,
 			   u_int16_t numChannels,
 			   struct cal_target_power_ht *pNewPower,
 <at>  <at>  -4130,7 +4130,7  <at>  <at>  ath9k_hw_get_max_edge_power(u_int16_t freq,
 static inline bool
 ath9k_hw_set_power_per_rate_table(struct ath_hal *ah,
 				  struct ar5416_eeprom *pEepData,
-				  struct hal_channel_internal *chan,
+				  struct ath9k_channel *chan,
 				  int16_t *ratesArray,
 				  u_int16_t cfgCtl,
 				  u_int8_t AntennaReduction,
 <at>  <at>  -4458,7 +4458,7  <at>  <at>  ath9k_hw_set_power_per_rate_table(struct ath_hal *ah,
 static enum hal_status
 ath9k_hw_set_txpower(struct ath_hal *ah,
 		     struct ar5416_eeprom *pEepData,
-		     struct hal_channel_internal *chan,
+		     struct ath9k_channel *chan,
 		     u_int16_t cfgCtl,
 		     u_int8_t twiceAntennaReduction,
 		     u_int8_t twiceMaxRegulatoryPower,
 <at>  <at>  -4621,7 +4621,7  <at>  <at>  static inline void ath9k_hw_get_delta_slope_vals(struct ath_hal *ah,

 static void
 ath9k_hw_set_delta_slope(struct ath_hal *ah,
-			 struct hal_channel_internal *chan)
+			 struct ath9k_channel *chan)
 {
 	u_int32_t coef_scaled, ds_coef_exp, ds_coef_man;
 	u_int32_t clockMhzScaled = 0x64000000;
 <at>  <at>  -4656,7 +4656,7  <at>  <at>  ath9k_hw_set_delta_slope(struct ath_hal *ah,

 static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah,
 					struct hal_channel *chan,
-					struct hal_channel_internal *ichan)
+					struct ath9k_channel *ichan)
 {
 	int bb_spur = AR_NO_SPUR;
 	int freq;
 <at>  <at>  -5141,7 +5141,7  <at>  <at>  static inline void ath9k_hw_init_chain_masks(struct ath_hal *ah)
 }

 static void ath9k_hw_set_addac(struct ath_hal *ah,
-			       struct hal_channel_internal *chan)
+			       struct ath9k_channel *chan)
 {
 	struct modal_eep_header *pModal;
 	struct ath_hal_5416 *ahp = AH5416(ah);
 <at>  <at>  -5213,7 +5213,7  <at>  <at>  static u_int ath9k_hw_mac_usec(struct ath_hal *ah, u_int clks)

 static u_int ath9k_hw_mac_to_usec(struct ath_hal *ah, u_int clks)
 {
-	struct hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;

 	if (chan && IS_CHAN_HT40(chan))
 		return ath9k_hw_mac_usec(ah, clks) / 2;
 <at>  <at>  -5234,7 +5234,7  <at>  <at>  static u_int ath9k_hw_mac_clks(struct ath_hal *ah, u_int usecs)

 static u_int ath9k_hw_mac_to_clks(struct ath_hal *ah, u_int usecs)
 {
-	struct hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;

 	if (chan && IS_CHAN_HT40(chan))
 		return ath9k_hw_mac_clks(ah, usecs) * 2;
 <at>  <at>  -5330,7 +5330,7  <at>  <at>  static inline void ath9k_hw_init_user_settings(struct ath_hal *ah)
 static inline enum hal_status
 ath9k_hw_process_ini(struct ath_hal *ah,
 		     struct hal_channel *chan,
-		     struct hal_channel_internal *ichan,
+		     struct ath9k_channel *ichan,
 		     enum hal_ht_macmode macmode)
 {
 	int i, regWrites = 0;
 <at>  <at>  -5517,7 +5517,7  <at>  <at>  static inline void ath9k_hw_reset_calibration(struct ath_hal *ah,

 static inline void
 ath9k_hw_per_calibration(struct ath_hal *ah,
-			 struct hal_channel_internal *ichan,
+			 struct ath9k_channel *ichan,
 			 u_int8_t rxchainmask,
 			 struct hal_cal_list *currCal,
 			 bool *isCalDone)
 <at>  <at>  -5563,7 +5563,7  <at>  <at>  static inline bool ath9k_hw_run_init_cals(struct ath_hal *ah,
 					  int init_cal_count)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct hal_channel_internal ichan;
+	struct ath9k_channel ichan;
 	bool isCalDone;
 	struct hal_cal_list *currCal = ahp->ah_cal_list_curr;
 	const struct hal_percal_data *calData = currCal->calData;
 <at>  <at>  -5608,7 +5608,7  <at>  <at>  static inline bool ath9k_hw_run_init_cals(struct ath_hal *ah,
 static inline bool
 ath9k_hw_channel_change(struct ath_hal *ah,
 			struct hal_channel *chan,
-			struct hal_channel_internal *ichan,
+			struct ath9k_channel *ichan,
 			enum hal_ht_macmode macmode)
 {
 	u_int32_t synthDelay, qnum;
 <at>  <at>  -5788,7 +5788,7  <at>  <at>  static inline bool ath9k_hw_init_cal(struct ath_hal *ah,
 				     struct hal_channel *chan)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct hal_channel_internal *ichan =
+	struct ath9k_channel *ichan =
 		ath9k_regd_check_channel(ah, chan);

 	REG_WRITE(ah, AR_PHY_AGC_CONTROL,
 <at>  <at>  -5857,8 +5857,8  <at>  <at>  bool ath9k_hw_reset(struct ath_hal *ah, enum hal_opmode opmode,
 #define FAIL(_code)     do { ecode = _code; goto bad; } while (0)
 	u_int32_t saveLedState;
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct hal_channel_internal *ichan;
-	struct hal_channel_internal *curchan = ah->ah_curchan;
+	struct ath9k_channel *ichan;
+	struct ath9k_channel *curchan = ah->ah_curchan;
 	u_int32_t saveDefAntenna;
 	u_int32_t macStaId1;
 	enum hal_status ecode;
 <at>  <at>  -6080,7 +6080,7  <at>  <at>  ath9k_hw_calibrate(struct ath_hal *ah, struct hal_channel *chan,
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
 	struct hal_cal_list *currCal = ahp->ah_cal_list_curr;
-	struct hal_channel_internal *ichan =
+	struct ath9k_channel *ichan =
 		ath9k_regd_check_channel(ah, chan);

 	*isCalDone = true;
 <at>  <at>  -6396,7 +6396,7  <at>  <at>  ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u_int8_t numChains)
 bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u_int32_t limit)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct hal_channel_internal *ichan = ah->ah_curchan;
+	struct ath9k_channel *ichan = ah->ah_curchan;
 	struct hal_channel *chan = (struct hal_channel *) ichan;

 	ah->ah_powerLimit = min(limit, (u_int32_t) MAX_RATE_POWER);
 <at>  <at>  -6416,7 +6416,7  <at>  <at>  bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u_int32_t limit)

 void
 ath9k_hw_get_channel_centers(struct ath_hal *ah,
-			     struct hal_channel_internal *chan,
+			     struct ath9k_channel *chan,
 			     struct chan_centers *centers)
 {
 	int8_t extoff;
 <at>  <at>  -6456,7 +6456,7  <at>  <at>  ath9k_hw_reset_calvalid(struct ath_hal *ah, struct hal_channel *chan,
 			bool *isCalDone)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct hal_channel_internal *ichan =
+	struct ath9k_channel *ichan =
 		ath9k_regd_check_channel(ah, chan);
 	struct hal_cal_list *currCal = ahp->ah_cal_list_curr;

 <at>  <at>  -6754,7 +6754,7  <at>  <at>  enum hal_status
 ath9k_hw_select_antconfig(struct ath_hal *ah, u_int32_t cfg)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
-	struct hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;
 	const struct hal_capabilities *pCap = &ah->ah_caps;
 	u_int16_t ant_config;
 	u_int32_t halNumAntConfig;
 <at>  <at>  -7648,7 +7648,7  <at>  <at>  bool ath9k_hw_resettxqueue(struct ath_hal *ah, u_int q)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
 	struct hal_capabilities *pCap = &ah->ah_caps;
-	struct hal_channel_internal *chan = ah->ah_curchan;
+	struct ath9k_channel *chan = ah->ah_curchan;
 	struct hal_tx_queue_info *qi;
 	u_int32_t cwMin, chanCwMin, value;

 <at>  <at>  -8448,7 +8448,7  <at>  <at>  u_int ath9k_hw_mhz2ieee(struct ath_hal *ah, u_int freq, u_int flags)
 int16_t
 ath9k_hw_getchan_noise(struct ath_hal *ah, struct hal_channel *chan)
 {
-	struct hal_channel_internal *ichan;
+	struct ath9k_channel *ichan;

 	ichan = ath9k_regd_check_channel(ah, chan);
 	if (ichan == NULL) {
diff --git a/drivers/net/wireless/ath9k/phy.c b/drivers/net/wireless/ath9k/phy.c
index 6751bed..0e70f47 100644
--- a/drivers/net/wireless/ath9k/phy.c
+++ b/drivers/net/wireless/ath9k/phy.c
 <at>  <at>  -29,7 +29,7  <at>  <at>  ath9k_hw_write_regs(struct ath_hal *ah, u_int modesIndex, u_int freqIndex,
 }

 bool
-ath9k_hw_set_channel(struct ath_hal *ah, struct hal_channel_internal *chan)
+ath9k_hw_set_channel(struct ath_hal *ah, struct ath9k_channel *chan)
 {
 	u_int32_t channelSel = 0;
 	u_int32_t bModeSynth = 0;
 <at>  <at>  -105,7 +105,7  <at>  <at>  ath9k_hw_set_channel(struct ath_hal *ah, struct hal_channel_internal *chan)

 bool
 ath9k_hw_ar9280_set_channel(struct ath_hal *ah,
-			    struct hal_channel_internal *chan)
+			    struct ath9k_channel *chan)
 {
 	u_int16_t bMode, fracMode, aModeRefSel = 0;
 	u_int32_t freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0;
 <at>  <at>  -202,7 +202,7  <at>  <at>  ath9k_phy_modify_rx_buffer(u_int32_t *rfBuf, u_int32_t reg32,
 }

 bool
-ath9k_hw_set_rf_regs(struct ath_hal *ah, struct hal_channel_internal *chan,
+ath9k_hw_set_rf_regs(struct ath_hal *ah, struct ath9k_channel *chan,
 		     u_int16_t modesIndex)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
diff --git a/drivers/net/wireless/ath9k/phy.h b/drivers/net/wireless/ath9k/phy.h
index 6c05257..77dffcd 100644
--- a/drivers/net/wireless/ath9k/phy.h
+++ b/drivers/net/wireless/ath9k/phy.h
 <at>  <at>  -18,14 +18,14  <at>  <at> 
 #define PHY_H

 bool ath9k_hw_ar9280_set_channel(struct ath_hal *ah,
-					  struct hal_channel_internal
+					  struct ath9k_channel
 					  *chan);
 bool ath9k_hw_set_channel(struct ath_hal *ah,
-				   struct hal_channel_internal *chan);
+				   struct ath9k_channel *chan);
 void ath9k_hw_write_regs(struct ath_hal *ah, u_int modesIndex,
 			 u_int freqIndex, int regWrites);
 bool ath9k_hw_set_rf_regs(struct ath_hal *ah,
-				   struct hal_channel_internal *chan,
+				   struct ath9k_channel *chan,
 				   u_int16_t modesIndex);
 void ath9k_hw_decrease_chain_power(struct ath_hal *ah,
 				   struct hal_channel *chan);
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
index 8a99365..425450d 100644
--- a/drivers/net/wireless/ath9k/regd.c
+++ b/drivers/net/wireless/ath9k/regd.c
 <at>  <at>  -22,8 +22,8  <at>  <at> 

 static int ath9k_regd_chansort(const void *a, const void *b)
 {
-	const struct hal_channel_internal *ca = a;
-	const struct hal_channel_internal *cb = b;
+	const struct ath9k_channel *ca = a;
+	const struct ath9k_channel *cb = b;

 	return (ca->channel == cb->channel) ?
 	    (ca->channelFlags & CHAN_FLAGS) -
 <at>  <at>  -372,7 +372,7  <at>  <at>  ath9k_regd_get_eeprom_reg_ext_bits(struct ath_hal *ah,

 #ifdef ATH_NF_PER_CHAN

-static void ath9k_regd_init_rf_buffer(struct hal_channel_internal *ichans,
+static void ath9k_regd_init_rf_buffer(struct ath9k_channel *ichans,
 				      int nchans)
 {
 	int i, j, next;
 <at>  <at>  -405,10 +405,10  <at>  <at>  ath9k_regd_add_channel(struct ath_hal *ah,
 		       struct RegDmnFreqBand *fband,
 		       struct regDomain *rd,
 		       const struct cmode *cm,
-		       struct hal_channel_internal *ichans,
+		       struct ath9k_channel *ichans,
 		       bool enableExtendedChannels)
 {
-	struct hal_channel_internal icv;
+	struct ath9k_channel icv;

 	if (!(c_lo <= c && c <= c_hi)) {
 		DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
 <at>  <at>  -539,7 +539,7  <at>  <at>  ath9k_regd_add_channel(struct ath_hal *ah,
 	}

 	memcpy(&ichans[pos], &icv,
-	       sizeof(struct hal_channel_internal));
+	       sizeof(struct ath9k_channel));

 	return true;
 }
 <at>  <at>  -586,7 +586,7  <at>  <at>  ath9k_regd_init_channels(struct ath_hal *ah,
 	struct country_code_to_enum_rd *country = NULL;
 	struct regDomain rd5GHz, rd2GHz;
 	const struct cmode *cm;
-	struct hal_channel_internal *ichans = &ah->ah_channels[0];
+	struct ath9k_channel *ichans = &ah->ah_channels[0];
 	int next = 0, b;
 	u_int8_t ctl;
 	int regdmn;
 <at>  <at>  -843,7 +843,7  <at>  <at>  done:
 		ath9k_regd_init_rf_buffer(ichans, next);
 #endif
 		ath9k_regd_sort(ichans, next,
-				sizeof(struct hal_channel_internal),
+				sizeof(struct ath9k_channel),
 				ath9k_regd_chansort);
 		ah->ah_nchan = next;

 <at>  <at>  -883,11 +883,11  <at>  <at>  done:
 	return next != 0;
 }

-struct hal_channel_internal*
+struct ath9k_channel*
 ath9k_regd_check_channel(struct ath_hal *ah,
 			 const struct hal_channel *c)
 {
-	struct hal_channel_internal *base, *cc;
+	struct ath9k_channel *base, *cc;

 	int flags = c->channelFlags & CHAN_FLAGS;
 	int n, lim;
 <at>  <at>  -940,7 +940,7  <at>  <at>  u_int
 ath9k_regd_get_antenna_allowed(struct ath_hal *ah,
 			       struct hal_channel *chan)
 {
-	struct hal_channel_internal *ichan = NULL;
+	struct ath9k_channel *ichan = NULL;

 	ichan = ath9k_regd_check_channel(ah, chan);
 	if (!ichan)
 <at>  <at>  -952,7 +952,7  <at>  <at>  ath9k_regd_get_antenna_allowed(struct ath_hal *ah,
 u_int ath9k_regd_get_ctl(struct ath_hal *ah, struct hal_channel *chan)
 {
 	u_int ctl = NO_CTL;
-	struct hal_channel_internal *ichan;
+	struct ath9k_channel *ichan;

 	if (ah->ah_countryCode == CTRY_DEFAULT && isWwrSKU(ah)) {
 		if (IS_CHAN_B(chan))
--

-- 
1.5.6.rc2.15.g457bb.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Luis R. Rodriguez | 3 Aug 2008 01:48
Favicon

[PATCH 04/12] ath9k: Fix channel registration

From: Sujith Manoharan <smanoharan@...>

Register channels in a cleaner way and
assign maxTxPower, minTxPower directly.

Signed-off-by: Sujith <Sujith.Manoharan@...>
Signed-off-by: Luis R. Rodriguez <lrodriguez@...>
---
 drivers/net/wireless/ath9k/ath9k.h |    4 --
 drivers/net/wireless/ath9k/core.c  |  102 ++++++++++++++++++++++-------------
 drivers/net/wireless/ath9k/core.h  |   13 -----
 drivers/net/wireless/ath9k/main.c  |   90 -------------------------------
 drivers/net/wireless/ath9k/phy.c   |   15 -----
 drivers/net/wireless/ath9k/regd.c  |   16 ++----
 6 files changed, 69 insertions(+), 171 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index de80a66..98466fd 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
 <at>  <at>  -955,7 +955,6  <at>  <at>  struct ath_hal *ath9k_hw_attach(u_int16_t devid,
 				void __iomem *mem,
 				enum hal_status *error);
 bool ath9k_regd_init_channels(struct ath_hal *ah,
-			      struct hal_channel *chans,
 			      u_int maxchans, u_int *nchans,
 			      u_int8_t *regclassids,
 			      u_int maxregids, u_int *nregids,
 <at>  <at>  -1130,7 +1129,4  <at>  <at>  void ath9k_hw_get_channel_centers(struct ath_hal *ah,
 bool ath9k_get_channel_edges(struct ath_hal *ah,
 			     u_int16_t flags, u_int16_t *low,
 			     u_int16_t *high);
-bool ath9k_hw_get_chip_power_limits(struct ath_hal *ah,
-				    struct hal_channel *chans,
-				    u_int32_t nchans);
 #endif
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index 6a61064..1849e03 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
 <at>  <at>  -168,60 +168,89  <at>  <at>  static int ath_rate_setup(struct ath_softc *sc, enum wireless_mode mode)

 /*
  *  Set up channel list
- *
- *  Determines the proper set of channelflags based on the selected mode,
- *  allocates a channel array, and passes it to the HAL for initialization.
- *  If successful, the list is passed to the upper layer, then de-allocated.
-*/
-
-static int ath_getchannels(struct ath_softc *sc,
-			   u_int cc,
-			   bool outDoor,
-			   bool xchanMode)
+ */
+static int ath_setup_channels(struct ath_softc *sc)
 {
 	struct ath_hal *ah = sc->sc_ah;
-	struct hal_channel *chans;
-	int nchan;
+	int nchan, i, a = 0, b = 0;
 	u_int8_t regclassids[ATH_REGCLASSIDS_MAX];
 	u_int nregclass = 0;
+	struct ieee80211_supported_band *band_2ghz;
+	struct ieee80211_supported_band *band_5ghz;
+	struct ieee80211_channel *chan_2ghz;
+	struct ieee80211_channel *chan_5ghz;
+	struct ath9k_channel *c;

-	chans = kmalloc(ATH_CHAN_MAX * sizeof(struct hal_channel), GFP_KERNEL);
-	if (chans == NULL) {
-		DPRINTF(sc, ATH_DBG_FATAL,
-			"%s: unable to allocate channel table\n", __func__);
-		return -ENOMEM;
-	}
-
+	/* Fill in ah->ah_channels */
 	if (!ath9k_regd_init_channels(ah,
-				      chans,
 				      ATH_CHAN_MAX,
 				      (u_int *)&nchan,
 				      regclassids,
 				      ATH_REGCLASSIDS_MAX,
 				      &nregclass,
-				      cc,
+				      CTRY_DEFAULT,
 				      ATH9K_MODE_SEL_ALL,
-				      outDoor,
-				      xchanMode)) {
+				      false,
+				      1)) {
 		u_int32_t rd = ah->ah_currentRD;

 		DPRINTF(sc, ATH_DBG_FATAL,
-			"%s: unable to collect channel list from hal; "
+			"%s: unable to collect channel list; "
 			"regdomain likely %u country code %u\n",
-			__func__, rd, cc);
-		kfree(chans);
+			__func__, rd, CTRY_DEFAULT);
 		return -EINVAL;
 	}

-	ath_setup_channel_list(sc,
-			       CLIST_UPDATE,
-			       chans,
-			       nchan,
-			       regclassids,
-			       nregclass,
-			       CTRY_DEFAULT);
+	band_2ghz = &sc->sbands[IEEE80211_BAND_2GHZ];
+	band_5ghz = &sc->sbands[IEEE80211_BAND_5GHZ];
+	chan_2ghz = sc->channels[IEEE80211_BAND_2GHZ];
+	chan_5ghz = sc->channels[IEEE80211_BAND_5GHZ];
+
+	for (i = 0; i < nchan; i++) {
+		c = &ah->ah_channels[i];
+		if (IS_CHAN_2GHZ(c)) {
+			chan_2ghz[a].band = IEEE80211_BAND_2GHZ;
+			chan_2ghz[a].center_freq = c->channel;
+			chan_2ghz[a].max_power = c->maxTxPower;
+
+			if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
+				chan_2ghz[a].flags |=
+					IEEE80211_CHAN_NO_IBSS;
+			if (c->channelFlags & CHANNEL_PASSIVE)
+				chan_2ghz[a].flags |=
+					IEEE80211_CHAN_PASSIVE_SCAN;
+
+			band_2ghz->n_channels = ++a;
+
+			DPRINTF(sc, ATH_DBG_CONFIG,
+				"%s: 2MHz channel: %d, "
+				"channelFlags: 0x%x\n",
+				__func__,
+				c->channel,
+				c->channelFlags);
+		} 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;
+
+			if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
+				chan_5ghz[b].flags |=
+					IEEE80211_CHAN_NO_IBSS;
+			if (c->channelFlags & CHANNEL_PASSIVE)
+				chan_5ghz[b].flags |=
+					IEEE80211_CHAN_PASSIVE_SCAN;
+
+			band_5ghz->n_channels = ++b;
+
+			DPRINTF(sc, ATH_DBG_CONFIG,
+				"%s: 5MHz channel: %d, "
+				"channelFlags: 0x%x\n",
+				__func__,
+				c->channel,
+				c->channelFlags);
+		}
+	}

-	kfree(chans);
 	return 0;
 }

 <at>  <at>  -1175,10 +1204,7  <at>  <at>  int ath_init(u_int16_t devid, struct ath_softc *sc)
 	 */
 	rd = ah->ah_currentRD;

-	error = ath_getchannels(sc,
-				CTRY_DEFAULT,
-				ath_outdoor,
-				1);
+	error = ath_setup_channels(sc);
 	if (error)
 		goto bad;

diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index e2b42f2..281dc76 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
 <at>  <at>  -907,12 +907,6  <at>  <at>  enum PROT_MODE {
 	PROT_M_CTSONLY
 };

-enum ieee80211_clist_cmd {
-	CLIST_UPDATE,
-	CLIST_DFS_UPDATE,
-	CLIST_NEW_COUNTRY
-};
-
 enum RATE_TYPE {
 	NORMAL_RATE = 0,
 	HALF_RATE,
 <at>  <at>  -1064,13 +1058,6  <at>  <at>  int ath_reset(struct ath_softc *sc);
 void ath_scan_start(struct ath_softc *sc);
 void ath_scan_end(struct ath_softc *sc);
 int ath_set_channel(struct ath_softc *sc, struct hal_channel *hchan);
-void ath_setup_channel_list(struct ath_softc *sc,
-			    enum ieee80211_clist_cmd cmd,
-			    const struct hal_channel *chans,
-			    int nchan,
-			    const u_int8_t *regclassids,
-			    u_int nregclass,
-			    int countrycode);
 void ath_setup_rate(struct ath_softc *sc,
 		    enum wireless_mode wMode,
 		    enum RATE_TYPE type,
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index c47ef50..a5ece47 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
 <at>  <at>  -41,20 +41,6  <at>  <at>  static struct pci_device_id ath_pci_id_table[] __devinitdata = {
 	{ 0 }
 };

-static int test_update_chan(enum ieee80211_band band,
-			    const struct hal_channel *chan,
-			    struct ath_softc *sc)
-{
-	int i;
-
-	for (i = 0; i < sc->sbands[band].n_channels; i++) {
-		if (sc->channels[band][i].center_freq == chan->channel)
-			return 1;
-	}
-
-	return 0;
-}
-
 static int ath_check_chanflags(struct ieee80211_channel *chan,
 			       u_int32_t mode,
 			       struct ath_softc *sc)
 <at>  <at>  -1036,82 +1022,6  <at>  <at>  u_int32_t ath_chan2flags(struct ieee80211_channel *chan,
 	}
 }

-void ath_setup_channel_list(struct ath_softc *sc,
-			    enum ieee80211_clist_cmd cmd,
-			    const struct hal_channel *chans,
-			    int nchan,
-			    const u_int8_t *regclassids,
-			    u_int nregclass,
-			    int countrycode)
-{
-	const struct hal_channel *c;
-	int i, a = 0, b = 0, flags;
-
-	if (countrycode == CTRY_DEFAULT) {
-		for (i = 0; i < nchan; i++) {
-			c = &chans[i];
-			flags = 0;
-			/* XXX: Ah! make more readable, and
-			 * idententation friendly */
-			if (IS_CHAN_2GHZ(c) &&
-			    !test_update_chan(IEEE80211_BAND_2GHZ, c, sc)) {
-				sc->channels[IEEE80211_BAND_2GHZ][a].band =
-					IEEE80211_BAND_2GHZ;
-				sc->channels[IEEE80211_BAND_2GHZ][a].
-					center_freq =
-					c->channel;
-				sc->channels[IEEE80211_BAND_2GHZ][a].max_power =
-					c->maxTxPower;
-				sc->channels[IEEE80211_BAND_2GHZ][a].hw_value =
-					c->channelFlags;
-
-				if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
-					flags |= IEEE80211_CHAN_NO_IBSS;
-				if (IS_CHAN_PASSIVE(c))
-					flags |= IEEE80211_CHAN_PASSIVE_SCAN;
-
-				sc->channels[IEEE80211_BAND_2GHZ][a].flags =
-					flags;
-				sc->sbands[IEEE80211_BAND_2GHZ].n_channels++;
-				a++;
-				DPRINTF(sc, ATH_DBG_CONFIG,
-					"%s: 2MHz channel: %d, "
-					"channelFlags: 0x%x\n",
-					__func__,
-					c->channel,
-					c->channelFlags);
-			} else if (IS_CHAN_5GHZ(c) &&
-			 !test_update_chan(IEEE80211_BAND_5GHZ, c, sc)) {
-				sc->channels[IEEE80211_BAND_5GHZ][b].band =
-					IEEE80211_BAND_5GHZ;
-				sc->channels[IEEE80211_BAND_5GHZ][b].
-					center_freq =
-					c->channel;
-				sc->channels[IEEE80211_BAND_5GHZ][b].max_power =
-					c->maxTxPower;
-				sc->channels[IEEE80211_BAND_5GHZ][b].hw_value =
-					c->channelFlags;
-
-				if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
-					flags |= IEEE80211_CHAN_NO_IBSS;
-				if (IS_CHAN_PASSIVE(c))
-					flags |= IEEE80211_CHAN_PASSIVE_SCAN;
-
-				sc->channels[IEEE80211_BAND_5GHZ][b].
-					flags = flags;
-				sc->sbands[IEEE80211_BAND_5GHZ].n_channels++;
-				b++;
-				DPRINTF(sc, ATH_DBG_CONFIG,
-					"%s: 5MHz channel: %d, "
-					"channelFlags: 0x%x\n",
-					__func__,
-					c->channel,
-					c->channelFlags);
-			}
-		}
-	}
-}
-
 void ath_get_beaconconfig(struct ath_softc *sc,
 			  int if_id,
 			  struct ath_beacon_config *conf)
diff --git a/drivers/net/wireless/ath9k/phy.c b/drivers/net/wireless/ath9k/phy.c
index 0e70f47..28953a8 100644
--- a/drivers/net/wireless/ath9k/phy.c
+++ b/drivers/net/wireless/ath9k/phy.c
 <at>  <at>  -312,21 +312,6  <at>  <at>  ath9k_hw_rfdetach(struct ath_hal *ah)
 	}
 }

-bool
-ath9k_hw_get_chip_power_limits(struct ath_hal *ah,
-			       struct hal_channel *chans, u_int32_t nchans)
-{
-	bool retVal = true;
-	int i;
-
-	for (i = 0; i < nchans; i++) {
-		chans[i].maxTxPower = AR5416_MAX_RATE_POWER;
-		chans[i].minTxPower = AR5416_MAX_RATE_POWER;
-	}
-	return retVal;
-}
-
-
 bool ath9k_hw_init_rf(struct ath_hal *ah, enum hal_status *status)
 {
 	struct ath_hal_5416 *ahp = AH5416(ah);
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
index 425450d..f40cd66 100644
--- a/drivers/net/wireless/ath9k/regd.c
+++ b/drivers/net/wireless/ath9k/regd.c
 <at>  <at>  -17,6 +17,7  <at>  <at> 
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include "core.h"
+#include "hw.h"
 #include "regd.h"
 #include "regd_common.h"

 <at>  <at>  -495,6 +496,9  <at>  <at>  ath9k_regd_add_channel(struct ath_hal *ah,
 	icv.antennaMax = fband->antennaMax;
 	icv.regDmnFlags = rd->flags;
 	icv.conformanceTestLimit = ctl;
+	icv.maxTxPower = AR5416_MAX_RATE_POWER;
+	icv.minTxPower = AR5416_MAX_RATE_POWER;
+
 	if (fband->usePassScan & rd->pscan)
 		icv.channelFlags |= CHANNEL_PASSIVE;
 	else
 <at>  <at>  -575,7 +579,7  <at>  <at>  static bool ath9k_regd_japan_check(struct ath_hal *ah,

 bool
 ath9k_regd_init_channels(struct ath_hal *ah,
-			 struct hal_channel *chans, u_int maxchans,
+			 u_int maxchans,
 			 u_int *nchans, u_int8_t *regclassids,
 			 u_int maxregids, u_int *nregids, u_int16_t cc,
 			 u_int32_t modeSelect, bool enableOutdoor,
 <at>  <at>  -853,16 +857,6  <at>  <at>  done:
 				"chan: %d flags: 0x%x\n",
 				ichans[i].channel,
 				ichans[i].channelFlags);
-			chans[i].channel = ichans[i].channel;
-			chans[i].channelFlags = ichans[i].channelFlags;
-			chans[i].privFlags = ichans[i].privFlags;
-			chans[i].maxRegTxPower = ichans[i].maxRegTxPower;
-		}
Luis R. Rodriguez | 3 Aug 2008 01:48
Favicon

[PATCH 06/12] ath9k: Pass channel mode when setting a channel

From: Sujith Manoharan <smanoharan@...>

Signed-off-by: Sujith <Sujith.Manoharan@...>
Signed-off-by: Luis R. Rodriguez <lrodriguez@...>
---
 drivers/net/wireless/ath9k/ath9k.h |    9 ++-
 drivers/net/wireless/ath9k/main.c  |  132 +++++++++++++++---------------------
 2 files changed, 60 insertions(+), 81 deletions(-)

diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index c99c6ba..8e86e11 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
 <at>  <at>  -424,6 +424,7  <at>  <at>  struct hal_11n_rate_series {
 struct hal_channel {
 	u_int16_t channel;
 	u_int32_t channelFlags;
+	u_int32_t chanmode;
 	u_int8_t privFlags;
 	int8_t maxRegTxPower;
 	int8_t maxTxPower;
 <at>  <at>  -517,10 +518,10  <at>  <at>  struct ath9k_channel {
 			  || (((_c)->channelFlags & CHANNEL_HT40MINUS) != 0))
 #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c)))
 #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)
-#define IS_CHAN_A_5MHZ_SPACED(_c) \
-	((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \
-	(((_c)->channel % 20) != 0) &&	\
-	(((_c)->channel % 10) != 0))
+#define IS_CHAN_A_5MHZ_SPACED(_c)			\
+	((((_c)->channelFlags & CHANNEL_5GHZ) != 0) &&	\
+	 (((_c)->channel % 20) != 0) &&			\
+	 (((_c)->channel % 10) != 0))

 struct hal_keyval {
 	u_int8_t kv_type;
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index a5ece47..b899611 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
 <at>  <at>  -41,27 +41,57  <at>  <at>  static struct pci_device_id ath_pci_id_table[] __devinitdata = {
 	{ 0 }
 };

-static int ath_check_chanflags(struct ieee80211_channel *chan,
-			       u_int32_t mode,
-			       struct ath_softc *sc)
+static int ath_get_chanflags(struct ath_softc *sc,
+			     struct ieee80211_channel *chan)
 {
-	struct ieee80211_hw *hw = sc->hw;
-	struct ieee80211_supported_band *band;
-	struct ieee80211_channel *band_channel;
 	int i;

-	band = hw->wiphy->bands[chan->band];
+	for (i = 0; i < sc->sc_ah->ah_nchan; i++) {
+		if (sc->sc_ah->ah_channels[i].channel == chan->center_freq)
+			return sc->sc_ah->ah_channels[i].channelFlags;
+	}

-	for (i = 0; i < band->n_channels; i++) {
-		band_channel = &band->channels[i];
+	return 0;
+}

-		if ((band_channel->center_freq == chan->center_freq) &&
-		    ((band_channel->hw_value & mode) == mode))
-			return 1;
+static u_int32_t ath_get_extchanmode(struct ath_softc *sc,
+				     struct ieee80211_channel *chan)
+{
+	u_int32_t chanmode = 0;
+	u_int8_t ext_chan_offset = sc->sc_ht_info.ext_chan_offset;
+	enum hal_ht_macmode tx_chan_width = sc->sc_ht_info.tx_chan_width;
+
+	switch (chan->band) {
+	case IEEE80211_BAND_2GHZ:
+		if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE) &&
+		    (tx_chan_width == HAL_HT_MACMODE_20))
+			chanmode = CHANNEL_G_HT20;
+		if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) &&
+		    (tx_chan_width == HAL_HT_MACMODE_2040))
+			chanmode = CHANNEL_G_HT40PLUS;
+		if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) &&
+		    (tx_chan_width == HAL_HT_MACMODE_2040))
+			chanmode = CHANNEL_G_HT40MINUS;
+		break;
+	case IEEE80211_BAND_5GHZ:
+		if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_NONE) &&
+		    (tx_chan_width == HAL_HT_MACMODE_20))
+			chanmode = CHANNEL_A_HT20;
+		if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_ABOVE) &&
+		    (tx_chan_width == HAL_HT_MACMODE_2040))
+			chanmode = CHANNEL_A_HT40PLUS;
+		if ((ext_chan_offset == IEEE80211_HT_IE_CHA_SEC_BELOW) &&
+		    (tx_chan_width == HAL_HT_MACMODE_2040))
+			chanmode = CHANNEL_A_HT40MINUS;
+		break;
+	default:
+		break;
 	}
-	return 0;
+
+	return chanmode;
 }

+
 static int ath_setkey_tkip(struct ath_softc *sc,
 			   struct ieee80211_key_conf *key,
 			   struct hal_keyval *hk,
 <at>  <at>  -313,7 +343,9  <at>  <at>  static int ath9k_start(struct ieee80211_hw *hw)
 	/* setup initial channel */

 	hchan.channel = curchan->center_freq;
-	hchan.channelFlags = ath_chan2flags(curchan, sc);
+	hchan.channelFlags = ath_get_chanflags(sc, curchan);
+	hchan.chanmode = (curchan->band == IEEE80211_BAND_2GHZ) ?
+		CHANNEL_G : CHANNEL_A;

 	/* open ath_dev */
 	error = ath_open(sc, &hchan);
 <at>  <at>  -465,7 +497,9  <at>  <at>  static int ath9k_config(struct ieee80211_hw *hw,
 		curchan->center_freq);

 	hchan.channel = curchan->center_freq;
-	hchan.channelFlags = ath_chan2flags(curchan, sc);
+	hchan.channelFlags = ath_get_chanflags(sc, curchan);
+	hchan.chanmode = (curchan->band == IEEE80211_BAND_2GHZ) ?
+		CHANNEL_G : CHANNEL_A;
 	sc->sc_config.txpowlimit = 2 * conf->power_level;

 	/* set h/w channel */
 <at>  <at>  -804,7 +838,12  <at>  <at>  static void ath9k_bss_assoc_info(struct ath_softc *sc,
 			curchan->center_freq);

 		hchan.channel = curchan->center_freq;
-		hchan.channelFlags = ath_chan2flags(curchan, sc);
+		hchan.channelFlags = ath_get_chanflags(sc, curchan);
+		if (hw->conf.ht_conf.ht_supported)
+			hchan.chanmode = ath_get_extchanmode(sc, curchan);
+		else
+			hchan.chanmode = (curchan->band == IEEE80211_BAND_2GHZ)
+				? CHANNEL_G : CHANNEL_A;

 		/* set h/w channel */
 		if (ath_set_channel(sc, &hchan) < 0)
 <at>  <at>  -961,67 +1000,6  <at>  <at>  static struct ieee80211_ops ath9k_ops = {
 	.ampdu_action       = ath9k_ampdu_action
 };

-u_int32_t ath_chan2flags(struct ieee80211_channel *chan,
-				struct ath_softc *sc)
-{
-	struct ieee80211_hw *hw = sc->hw;
-	struct ath_ht_info *ht_info = &sc->sc_ht_info;
-
-	if (sc->sc_scanning) {
-		if (chan->band == IEEE80211_BAND_5GHZ) {
-			if (ath_check_chanflags(chan, CHANNEL_A_HT20, sc))
-				return CHANNEL_A_HT20;
-			else
-				return CHANNEL_A;
-		} else {
-			if (ath_check_chanflags(chan, CHANNEL_G_HT20, sc))
-				return CHANNEL_G_HT20;
-			else if (ath_check_chanflags(chan, CHANNEL_G, sc))
-				return CHANNEL_G;
-			else
-				return CHANNEL_B;
-		}
-	} else {
-		if (chan->band == IEEE80211_BAND_2GHZ) {
-			if (!hw->conf.ht_conf.ht_supported) {
-				if (ath_check_chanflags(chan, CHANNEL_G, sc))
-					return CHANNEL_G;
-				else
-					return CHANNEL_B;
-			}
-			if ((ht_info->ext_chan_offset ==
-			     IEEE80211_HT_IE_CHA_SEC_NONE) &&
-			    (ht_info->tx_chan_width == HAL_HT_MACMODE_20))
-				return CHANNEL_G_HT20;
-			if ((ht_info->ext_chan_offset ==
-			     IEEE80211_HT_IE_CHA_SEC_ABOVE) &&
-			    (ht_info->tx_chan_width == HAL_HT_MACMODE_2040))
-				return CHANNEL_G_HT40PLUS;
-			if ((ht_info->ext_chan_offset ==
-			     IEEE80211_HT_IE_CHA_SEC_BELOW) &&
-			    (ht_info->tx_chan_width == HAL_HT_MACMODE_2040))
-				return CHANNEL_G_HT40MINUS;
-			return CHANNEL_B;
-		} else {
-			if (!hw->conf.ht_conf.ht_supported)
-				return CHANNEL_A;
-			if ((ht_info->ext_chan_offset ==
-			     IEEE80211_HT_IE_CHA_SEC_NONE) &&
-			    (ht_info->tx_chan_width == HAL_HT_MACMODE_20))
-				return CHANNEL_A_HT20;
-			if ((ht_info->ext_chan_offset ==
-			     IEEE80211_HT_IE_CHA_SEC_ABOVE) &&
-			    (ht_info->tx_chan_width == HAL_HT_MACMODE_2040))
-				return CHANNEL_A_HT40PLUS;
-			if ((ht_info->ext_chan_offset ==
-			     IEEE80211_HT_IE_CHA_SEC_BELOW) &&
-			    (ht_info->tx_chan_width == HAL_HT_MACMODE_2040))
-				return CHANNEL_A_HT40MINUS;
-			return CHANNEL_A;
-		}
-	}
-}

Gmane