2010-03-01 09:17:44

by Sujith

[permalink] [raw]
Subject: [PATCH 1/7] ath9k: Add common code to lib

Move a few macros to the common library to be shared
between ath9k and ath9k_htc.

Signed-off-by: Sujith <[email protected]>
---
drivers/net/wireless/ath/ath9k/Makefile | 3 +-
drivers/net/wireless/ath/ath9k/ath9k.h | 33 +-------------
drivers/net/wireless/ath/ath9k/lib.h | 1 +
drivers/net/wireless/ath/ath9k/main.c | 70 +-----------------------------
drivers/net/wireless/ath/ath9k/virtual.c | 3 +-
5 files changed, 8 insertions(+), 102 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile
index b1af5d5..518ebb7 100644
--- a/drivers/net/wireless/ath/ath9k/Makefile
+++ b/drivers/net/wireless/ath/ath9k/Makefile
@@ -5,7 +5,8 @@ ath9k-y += beacon.o \
recv.o \
xmit.o \
virtual.o \
- rc.o
+ rc.o \
+ lib.o

ath9k-$(CONFIG_PCI) += pci.o
ath9k-$(CONFIG_ATHEROS_AR71XX) += ahb.o
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 83c7ea4..d3acf1c 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -23,6 +23,7 @@

#include "debug.h"
#include "common.h"
+#include "lib.h"

/*
* Header for the ath9k.ko driver core *only* -- hw code nor any other driver
@@ -55,9 +56,6 @@ struct ath_node;

#define A_MAX(a, b) ((a) > (b) ? (a) : (b))

-#define TSF_TO_TU(_h,_l) \
- ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
-
#define ATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1<<i))

struct ath_config {
@@ -294,8 +292,6 @@ struct ath_vif {
#define BSTUCK_THRESH (9 * ATH_BCBUF)
#define ATH_BCBUF 4
#define ATH_DEFAULT_BINTVAL 100 /* TU */
-#define ATH_DEFAULT_BMISS_LIMIT 10
-#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)

struct ath_beacon_config {
u16 beacon_interval;
@@ -332,18 +328,6 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif);
void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);
int ath_beaconq_config(struct ath_softc *sc);

-/*******/
-/* ANI */
-/*******/
-
-#define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */
-#define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */
-#define ATH_ANI_POLLINTERVAL 100 /* 100 ms */
-#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
-#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
-
-void ath_ani_calibrate(unsigned long data);
-
/**********/
/* BTCOEX */
/**********/
@@ -377,18 +361,6 @@ void ath9k_btcoex_timer_pause(struct ath_softc *sc);
/* LED Control */
/********************/

-#define ATH_LED_PIN_DEF 1
-#define ATH_LED_PIN_9287 8
-#define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */
-#define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */
-
-enum ath_led_type {
- ATH_LED_RADIO,
- ATH_LED_ASSOC,
- ATH_LED_TX,
- ATH_LED_RX
-};
-
struct ath_led {
struct ath_softc *sc;
struct led_classdev led_cdev;
@@ -549,8 +521,6 @@ void ath9k_deinit_device(struct ath_softc *sc);
const char *ath_mac_bb_name(u32 mac_bb_version);
const char *ath_rf_name(u16 rf_version);
void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw);
-void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw,
- struct ath9k_channel *ichan);
void ath_update_chainmask(struct ath_softc *sc, int is_ht);
int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
struct ath9k_channel *hchan);
@@ -599,6 +569,7 @@ void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue);
void ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue);

int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype);
+void ath_ani_calibrate(unsigned long data);

void ath_start_rfkill_poll(struct ath_softc *sc);
extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/ath/ath9k/lib.h b/drivers/net/wireless/ath/ath9k/lib.h
index 815d265..86dc86d 100644
--- a/drivers/net/wireless/ath/ath9k/lib.h
+++ b/drivers/net/wireless/ath/ath9k/lib.h
@@ -22,6 +22,7 @@
#define IEEE80211_WEP_NKID 4

#define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */
+#define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */
#define ATH_ANI_POLLINTERVAL 100 /* 100 ms */
#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 67ca4e5..050baf2 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -105,7 +105,7 @@ static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc,

chan_idx = curchan->hw_value;
channel = &sc->sc_ah->channels[chan_idx];
- ath9k_update_ichannel(sc, hw, channel);
+ ath9k_update_ichannel(hw, channel);
return channel;
}

@@ -545,48 +545,6 @@ chip_reset:
#undef SCHED_INTR
}

-static u32 ath_get_extchanmode(struct ath_softc *sc,
- struct ieee80211_channel *chan,
- enum nl80211_channel_type channel_type)
-{
- u32 chanmode = 0;
-
- switch (chan->band) {
- case IEEE80211_BAND_2GHZ:
- switch(channel_type) {
- case NL80211_CHAN_NO_HT:
- case NL80211_CHAN_HT20:
- chanmode = CHANNEL_G_HT20;
- break;
- case NL80211_CHAN_HT40PLUS:
- chanmode = CHANNEL_G_HT40PLUS;
- break;
- case NL80211_CHAN_HT40MINUS:
- chanmode = CHANNEL_G_HT40MINUS;
- break;
- }
- break;
- case IEEE80211_BAND_5GHZ:
- switch(channel_type) {
- case NL80211_CHAN_NO_HT:
- case NL80211_CHAN_HT20:
- chanmode = CHANNEL_A_HT20;
- break;
- case NL80211_CHAN_HT40PLUS:
- chanmode = CHANNEL_A_HT40PLUS;
- break;
- case NL80211_CHAN_HT40MINUS:
- chanmode = CHANNEL_A_HT40MINUS;
- break;
- }
- break;
- default:
- break;
- }
-
- return chanmode;
-}
-
static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key,
struct ath9k_keyval *hk, const u8 *addr,
bool authenticator)
@@ -1048,30 +1006,6 @@ int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc)
return qnum;
}

-/* XXX: Remove me once we don't depend on ath9k_channel for all
- * this redundant data */
-void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw,
- struct ath9k_channel *ichan)
-{
- struct ieee80211_channel *chan = hw->conf.channel;
- struct ieee80211_conf *conf = &hw->conf;
-
- ichan->channel = chan->center_freq;
- ichan->chan = chan;
-
- if (chan->band == IEEE80211_BAND_2GHZ) {
- ichan->chanmode = CHANNEL_G;
- ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM | CHANNEL_G;
- } else {
- ichan->chanmode = CHANNEL_A;
- ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM;
- }
-
- if (conf_is_ht(conf))
- ichan->chanmode = ath_get_extchanmode(sc, chan,
- conf->channel_type);
-}
-
/**********************/
/* mac80211 callbacks */
/**********************/
@@ -1619,7 +1553,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
curchan->center_freq);

/* XXX: remove me eventualy */
- ath9k_update_ichannel(sc, hw, &sc->sc_ah->channels[pos]);
+ ath9k_update_ichannel(hw, &sc->sc_ah->channels[pos]);

ath_update_chainmask(sc, conf_is_ht(conf));

diff --git a/drivers/net/wireless/ath/ath9k/virtual.c b/drivers/net/wireless/ath/ath9k/virtual.c
index a43fbf8..2b6ecf7 100644
--- a/drivers/net/wireless/ath/ath9k/virtual.c
+++ b/drivers/net/wireless/ath/ath9k/virtual.c
@@ -312,8 +312,7 @@ void ath9k_wiphy_chan_work(struct work_struct *work)
/* Change channels */
mutex_lock(&sc->mutex);
/* XXX: remove me eventually */
- ath9k_update_ichannel(sc, aphy->hw,
- &sc->sc_ah->channels[sc->chan_idx]);
+ ath9k_update_ichannel(aphy->hw, &sc->sc_ah->channels[sc->chan_idx]);

/* sync hw configuration for hw code */
common->hw = aphy->hw;
--
1.7.0.1



2010-03-03 14:00:39

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

On Wed, Mar 03, 2010 at 11:09:02AM +0530, Sujith wrote:
> Luis R. Rodriguez wrote:
> > Ah thanks. So why remove a library at the end if the driver hasn't
> > been merged yet, how about just do away with the library from the
> > start and add the stuff you need to ath9k_htc on the first patch.
>
> Ok.
>
> John, can you just drop everything ?
> I (or someone) will send fresh patches after we fix this mess.

Sure.

> I know you are probably seething with irritation now, but remember,
> I might save the world someday and you might not be on the hero's side ...

I may seem scratchy on the list, but I usually save the seething for
when I am attacked personally. :-)

Be ready, hero!

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2010-03-03 05:19:55

by Sujith

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

Luis R. Rodriguez wrote:
> Ah thanks. So why remove a library at the end if the driver hasn't
> been merged yet, how about just do away with the library from the
> start and add the stuff you need to ath9k_htc on the first patch.

Ok.

John, can you just drop everything ?
I (or someone) will send fresh patches after we fix this mess.

I know you are probably seething with irritation now, but remember,
I might save the world someday and you might not be on the hero's side ...

Sujith

2010-03-03 04:17:22

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

On Tue, Mar 2, 2010 at 7:50 PM, Sujith <[email protected]> wrote:
> Luis R. Rodriguez wrote:
>> Can I trouble you to repost a new series of patches required for
>> ath9k_htc which does not add/use a lib.c and instead stuffs
>> things into common from the start? If there are patches
>> which are cosmetic, can you send them as a second series
>> so that we are clear what stuff is 2.6.34-rc2 material or
>> not?
>
> I sent a mail yesterday to JWL, but forgot to CC the list.
> Here is the series.
>
> To clarify things, these are the pending patches for
> ath9k_htc (in order).
>
> [PATCH 1/3] ath9k_htc: Add ath9k_htc driver
> [PATCH 2/3] ath9k_hw: HW fixes for ath9k_htc
> [PATCH 3/3] ath9k: Fix HW deinit
>
> [PATCH 1/2] ath9k: Fix symbol collision between ath9k and ath9k_htc
> [PATCH 2/2] ath9k_htc: Remove library

Ah thanks. So why remove a library at the end if the driver hasn't
been merged yet, how about just do away with the library from the
start and add the stuff you need to ath9k_htc on the first patch.

Luis

2010-03-03 00:52:21

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

On Tue, Mar 02, 2010 at 02:33:05PM +0530, Sujith wrote:
> John,
>
> Can you drop this series (7/7) ?
> We had a bit of confusion regarding sharing code between
> ath9k and ath9k_htc. And it has been decided to just use
> ath9k_common.ko.
>
> Sorry for the trouble.

Sujith, I myself am a bit confused with the patches which
I should apply locally to get a clean history and move on with
development on ath9k.

Can I trouble you to repost a new series of patches required for
ath9k_htc which does not add/use a lib.c and instead stuffs
things into common from the start? If there are patches
which are cosmetic, can you send them as a second series
so that we are clear what stuff is 2.6.34-rc2 material or
not?

Luis

2010-03-01 17:40:03

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

On Mon, Mar 1, 2010 at 1:36 AM, Sujith <[email protected]> wrote:
> Move a few macros to the common library to be shared
> between ath9k and ath9k_htc.
>
> Signed-off-by: Sujith <[email protected]>

I think you forgot to git add the lib.[ch] files.

Luis

2010-03-03 03:31:11

by Sujith

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

Luis R. Rodriguez wrote:
> Can I trouble you to repost a new series of patches required for
> ath9k_htc which does not add/use a lib.c and instead stuffs
> things into common from the start? If there are patches
> which are cosmetic, can you send them as a second series
> so that we are clear what stuff is 2.6.34-rc2 material or
> not?

I sent a mail yesterday to JWL, but forgot to CC the list.
Here is the series.

To clarify things, these are the pending patches for
ath9k_htc (in order).

[PATCH 1/3] ath9k_htc: Add ath9k_htc driver
[PATCH 2/3] ath9k_hw: HW fixes for ath9k_htc
[PATCH 3/3] ath9k: Fix HW deinit

[PATCH 1/2] ath9k: Fix symbol collision between ath9k and ath9k_htc
[PATCH 2/2] ath9k_htc: Remove library

Sujith

2010-03-02 08:44:01

by Sujith

[permalink] [raw]
Subject: [PATCH 1/7] ath9k: Add common code to lib

John,

Can you drop this series (7/7) ?
We had a bit of confusion regarding sharing code between
ath9k and ath9k_htc. And it has been decided to just use
ath9k_common.ko.

Sorry for the trouble.

thanks,
Sujith

2010-03-01 22:33:44

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH 1/7] ath9k: Add common code to lib

On Mon, Mar 1, 2010 at 9:39 AM, Luis R. Rodriguez <[email protected]> wrote:
> On Mon, Mar 1, 2010 at 1:36 AM, Sujith <[email protected]> wrote:
>> Move a few macros to the common library to be shared
>> between ath9k and ath9k_htc.
>>
>> Signed-off-by: Sujith <[email protected]>
>
> I think you forgot to git add the lib.[ch] files.

Nevermind -- the code is already there on lib.c.

Luis