On Mon, Oct 13, 2008 at 8:05 AM, <[email protected]> wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=11749
---
Bug description from kernel.org bugzilla
Latest working kernel version: None
Earliest failing kernel version: Unknow
Distribution: all
Hardware Environment: Atheros wireless chipset
Software Environment: Fedora
Problem Description: ath5k driver has many inperrupts per second although the
system is idle.
I used AspierOne to test it, interrupts are so many that CPU's C3 residence
time is only 20 milliseconds or less, there isn't any valid traffic on my
wireless network except beacon frame.
I tested X61 in the same wireless environment, number of interrupt is only 1
per second, X61 has the latest Intel wireless chipset and 2.6.27 kernel was
running.
So i think ath5k and ath9k should can do as Intel wireless driver does,
otherwise, CPU can't stay at C3 with longer time because of wireless
interrupts.
Steps to reproduce:
1. Enable wireless on platform with Atheros wireless chipset.
2. watch cat /proc/interrupts
---
Folks, ANI is not handled yet in ath5k (and won't be on 2.6.26). What
I recommend is to try disabling MIB interrupts on the stable kernels
where you won't make use of MIB statistics, which you need for ANI.
Once you have ANI please enable the MIB interrupt.
yang.y.yi, please try this patch (also attached for your convenience)
and let us know if you see a difference.
Luis
diff --git a/drivers/net/wireless/ath5k/base.c
b/drivers/net/wireless/ath5k/base.c
index 0676c6d..c18ead9 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -2246,8 +2246,7 @@ ath5k_init(struct ath5k_softc *sc)
* Enable interrupts.
*/
sc->imask = AR5K_INT_RX | AR5K_INT_TX | AR5K_INT_RXEOL |
- AR5K_INT_RXORN | AR5K_INT_FATAL | AR5K_INT_GLOBAL |
- AR5K_INT_MIB;
+ AR5K_INT_RXORN | AR5K_INT_FATAL | AR5K_INT_GLOBAL;
ath5k_hw_set_intr(sc->ah, sc->imask);
/* Set ack to be sent at low bit-rates */
2008/10/13 Luis R. Rodriguez <[email protected]>:
> On Mon, Oct 13, 2008 at 8:05 AM, <[email protected]> wrote:
>> http://bugzilla.kernel.org/show_bug.cgi?id=11749
>
> ---
> Bug description from kernel.org bugzilla
>
> Latest working kernel version: None
> Earliest failing kernel version: Unknow
> Distribution: all
> Hardware Environment: Atheros wireless chipset
> Software Environment: Fedora
> Problem Description: ath5k driver has many inperrupts per second although the
> system is idle.
>
> I used AspierOne to test it, interrupts are so many that CPU's C3 residence
> time is only 20 milliseconds or less, there isn't any valid traffic on my
> wireless network except beacon frame.
>
> I tested X61 in the same wireless environment, number of interrupt is only 1
> per second, X61 has the latest Intel wireless chipset and 2.6.27 kernel was
> running.
>
> So i think ath5k and ath9k should can do as Intel wireless driver does,
> otherwise, CPU can't stay at C3 with longer time because of wireless
> interrupts.
>
> Steps to reproduce:
> 1. Enable wireless on platform with Atheros wireless chipset.
> 2. watch cat /proc/interrupts
>
> ---
>
> Folks, ANI is not handled yet in ath5k (and won't be on 2.6.26). What
> I recommend is to try disabling MIB interrupts on the stable kernels
> where you won't make use of MIB statistics, which you need for ANI.
> Once you have ANI please enable the MIB interrupt.
>
> yang.y.yi, please try this patch (also attached for your convenience)
> and let us know if you see a difference.
>
> Luis
>
> diff --git a/drivers/net/wireless/ath5k/base.c
> b/drivers/net/wireless/ath5k/base.c
> index 0676c6d..c18ead9 100644
> --- a/drivers/net/wireless/ath5k/base.c
> +++ b/drivers/net/wireless/ath5k/base.c
> @@ -2246,8 +2246,7 @@ ath5k_init(struct ath5k_softc *sc)
> * Enable interrupts.
> */
> sc->imask = AR5K_INT_RX | AR5K_INT_TX | AR5K_INT_RXEOL |
> - AR5K_INT_RXORN | AR5K_INT_FATAL | AR5K_INT_GLOBAL |
> - AR5K_INT_MIB;
> + AR5K_INT_RXORN | AR5K_INT_FATAL | AR5K_INT_GLOBAL;
>
> ath5k_hw_set_intr(sc->ah, sc->imask);
> /* Set ack to be sent at low bit-rates */
>
Acked-by: Nick Kossifidis <[email protected]>
--
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
Hi Bob:
Please review below patch thanks.
From: Martin Xu <[email protected]>
Subject: disable beacon filter when station is not associated with any AP.
Ath5k driver has too many interrupts per second at idle
http://bugzilla.kernel.org/show_bug.cgi?id=11749
Signed-off-by: Martin Xu <[email protected]>
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 34cd1a4..37da7cc 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -241,6 +241,10 @@ static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
static void ath5k_reset_tsf(struct ieee80211_hw *hw);
static int ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb);
+static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *bss_conf,
+ u32 changes);
static struct ieee80211_ops ath5k_hw_ops = {
.tx = ath5k_tx,
@@ -2952,7 +2956,7 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
sc->opmode != NL80211_IFTYPE_MESH_POINT &&
test_bit(ATH_STAT_PROMISC, sc->status))
rfilt |= AR5K_RX_FILTER_PROM;
- if (sc->opmode == NL80211_IFTYPE_STATION ||
+ if ((sc->opmode == NL80211_IFTYPE_STATION && sc->assoc) ||
sc->opmode == NL80211_IFTYPE_ADHOC ||
sc->opmode == NL80211_IFTYPE_AP)
rfilt |= AR5K_RX_FILTER_BEACON;
@@ -3092,4 +3096,32 @@ ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb)
return ret;
}
+static void
+set_beacon_filter(struct ieee80211_hw *hw, bool enable)
+{
+ struct ath5k_softc *sc = hw->priv;
+ struct ath5k_hw *ah = sc->ah;
+ u32 rfilt;
+ rfilt = ath5k_hw_get_rx_filter(ah);
+ if (enable)
+ rfilt |= AR5K_RX_FILTER_BEACON;
+ else
+ rfilt &= ~AR5K_RX_FILTER_BEACON;
+ ath5k_hw_set_rx_filter(ah, rfilt);
+ sc->filter_flags = rfilt;
+}
+static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *bss_conf,
+ u32 changes)
+{
+ struct ath5k_softc *sc = hw->priv;
+ if (changes & BSS_CHANGED_ASSOC) {
+ mutex_lock(&sc->lock);
+ sc->assoc = bss_conf->assoc;
+ if (sc->opmode == NL80211_IFTYPE_STATION)
+ set_beacon_filter(hw, sc->assoc);
+ mutex_unlock(&sc->lock);
+ }
+}
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index 06d1054..facc60d 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -179,6 +179,7 @@ struct ath5k_softc {
struct timer_list calib_tim; /* calibration timer */
int power_level; /* Requested tx power in dbm */
+ bool assoc; /* assocate state */
};
#define ath5k_hw_hasbssidmask(_ah) \
On Fri, Nov 21, 2008 at 03:27:34PM -0500, John W. Linville wrote:
> > +static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
> > + struct ieee80211_vif *vif,
> > + struct ieee80211_bss_conf *bss_conf,
> > + u32 changes);
>
> This patch defines ath5k_bss_info_changed, but doesn't use it.
> Is that really what you meant to do?
The first version of this patch set .bss_info_changed but it looks
like it got lost along the way. Martin?
--
Bob Copeland %% http://www.bobcopeland.com
On Thu, Nov 13, 2008 at 1:12 AM, Xu, Martin <[email protected]> wrote:
> Hi all:
> I have a patch that can be used to fix the bug.
> The patch resolved the issue by disabling the beacon filter when disassociated with AP and enabling beacon when associate with AP.
> See http://bugzilla.kernel.org/show_bug.cgi?id=11749
> Please review it. Thanks!
Thanks for the patch!
I think the basic idea is ok (we only have beacons if PRBRESP_PROMISC is set
or if we are in STA mode _and_ associated, or in IBSS mode). However, there
are lots of CodingStyle issues with the patch. Please run
scripts/checkpatch.pl on it and fix the corresponding whitespace issues.
+static void
+enable_beacon_filter(struct ieee80211_hw *hw)
+{
+ struct ath5k_softc *sc = hw->priv;
+ struct ath5k_hw *ah = sc->ah;
+ u32 rfilt;
+ rfilt = ath5k_hw_get_rx_filter(ah);
+ if ( !(rfilt & AR5K_RX_FILTER_BEACON) ){
Probably not worth it to do the test, since this isn't going to get
called that often.
+ rfilt |= AR5K_RX_FILTER_BEACON;
+ ath5k_hw_set_rx_filter(ah,rfilt);
+ sc->filter_flags = rfilt;
+ }
+ rfilt = ath5k_hw_get_rx_filter(ah);
+ return;
Above two lines are unnecessary.
+}
You remove a heap of code by making this set_beacon_filter(hw, bool enable)
and cleaning up the branches in bss_info_changed. I believe this can race
with configure_filter as well (but configure_filter already races with
anything that touches sc->status...).
> @@ -179,6 +179,7 @@ struct ath5k_softc {
>
> struct timer_list calib_tim; /* calibration timer */
> int power_level; /* Requested tx power in dbm */
> + bool assoc; /* assocate state */
> };
s/assocate/associate. Also in ath5k we sometimes use sc->status for such
flags, though this could go either way.
--
Bob Copeland %% http://www.bobcopeland.com
Qm9iOg0KWW91IGFyZSByaWdodCwgdGhlIGJzc19pbmZvcl9jaGFuZ2VkIGlzIGxvc3Qgb24gdGhl
IHdheS4NClBsZWFzZSByZXZpZXcgYmVsb3cgcGF0Y2g6DQoNCkZyb206IE1hcnRpbiBYdSA8bWFy
dGluLnh1QGludGVsLmNvbT4NClN1YmplY3Q6IGRpc2FibGUgYmVhY29uIGZpbHRlciB3aGVuIHN0
YXRpb24gaXMgbm90IGFzc29jaWF0ZWQgd2l0aCBhbnkgQVAuDQoNCkF0aDVrIGRyaXZlciBoYXMg
dG9vIG1hbnkgaW50ZXJydXB0cyBwZXIgc2Vjb25kIGF0IGlkbGUNCmh0dHA6Ly9idWd6aWxsYS5r
ZXJuZWwub3JnL3Nob3dfYnVnLmNnaT9pZD0xMTc0OQ0KDQpTaWduZWQtb2ZmLWJ5OiBNYXJ0aW4g
WHUgPG1hcnRpbi54dUBpbnRlbC5jb20+DQoNCmRpZmYgLS1naXQgYS9kcml2ZXJzL25ldC93aXJl
bGVzcy9hdGg1ay9iYXNlLmMgYi9kcml2ZXJzL25ldC93aXJlbGVzcy9hdGg1ay9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IxLCAyMDA4
IGF0IDAzOjI3OjM0UE0gLTA1MDAsIEpvaG4gVy4gTGludmlsbGUgd3JvdGU6DQo+ID4gK3N0YXRp
YyB2b2lkIGF0aDVrX2Jzc19pbmZvX2NoYW5nZWQoc3RydWN0IGllZWU4MDIxMV9odyAqaHcsDQo+
ID4gKwkJCQlzdHJ1Y3QgaWVlZTgwMjExX3ZpZiAqdmlmLA0KPiA+ICsJCQkJc3RydWN0IGllZWU4
MDIxMV9ic3NfY29uZiAqYnNzX2NvbmYsDQo+ID4gKwkJCQl1MzIgY2hhbmdlcyk7DQo+IA0KPiBU
aGlzIHBhdGNoIGRlZmluZXMgYXRoNWtfYnNzX2luZm9fY2hhbmdlZCwgYnV0IGRvZXNuJ3QgdXNl
IGl0Lg0KPiBJcyB0aGF0IHJlYWxseSB3aGF0IHlvdSBtZWFudCB0byBkbz8NCg0KVGhlIGZpcnN0
IHZlcnNpb24gb2YgdGhpcyBwYXRjaCBzZXQgLmJzc19pbmZvX2NoYW5nZWQgYnV0IGl0IGxvb2tz
DQpsaWtlIGl0IGdvdCBsb3N0IGFsb25nIHRoZSB3YXkuICBNYXJ0aW4/DQoNCi0tIA0KQm9iIENv
cGVsYW5kICUlIHd3dy5ib2Jjb3BlbGFuZC5jb20NCg0KLS0NClRvIHVuc3Vic2NyaWJlIGZyb20g
dGhpcyBsaXN0OiBzZW5kIHRoZSBsaW5lICJ1bnN1YnNjcmliZSBsaW51eC13aXJlbGVzcyIgaW4N
CnRoZSBib2R5IG9mIGEgbWVzc2FnZSB0byBtYWpvcmRvbW9Admdlci5rZXJuZWwub3JnDQpNb3Jl
IG1ham9yZG9tbyBpbmZvIGF0ICBodHRwOi8vdmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZv
Lmh0bWwNCg==
On Thu, Nov 20, 2008 at 11:13:18AM +0800, Xu, Martin wrote:
> Hi Bob:
> Please review below patch thanks.
>
> From: Martin Xu <[email protected]>
> Subject: disable beacon filter when station is not associated with any AP.
>
> Ath5k driver has too many interrupts per second at idle
> http://bugzilla.kernel.org/show_bug.cgi?id=11749
>
> Signed-off-by: Martin Xu <[email protected]>
>
> diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
> index 34cd1a4..37da7cc 100644
> --- a/drivers/net/wireless/ath5k/base.c
> +++ b/drivers/net/wireless/ath5k/base.c
> @@ -241,6 +241,10 @@ static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
> static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
> static void ath5k_reset_tsf(struct ieee80211_hw *hw);
> static int ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb);
> +static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + struct ieee80211_bss_conf *bss_conf,
> + u32 changes);
>
> static struct ieee80211_ops ath5k_hw_ops = {
> .tx = ath5k_tx,
This patch defines ath5k_bss_info_changed, but doesn't use it.
Is that really what you meant to do?
John
--
John W. Linville Linux should be at the core
[email protected] of your literate lifestyle.
On Mon, Nov 17, 2008 at 03:35:07PM +0800, Xu, Martin wrote:
> Hi bob??
> Please review below patch which has been modified according to your comments.
Thanks, looks a lot better. I still have a few minor comments:
> +static void
> +set_beacon_filter(struct ieee80211_hw *hw, bool enable)
> +{
[...]
> + return;
> +}
Please don't use 'return' for void functions.
> +static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + struct ieee80211_bss_conf *bss_conf,
> + u32 changes)
> +{
> + struct ath5k_softc *sc = hw->priv;
> + if (changes & BSS_CHANGED_ASSOC) {
> + mutex_lock(&sc->lock);
> + sc->assoc = bss_conf->assoc;
> + if (sc->opmode == NL80211_IFTYPE_STATION) {
> + if (sc->assoc)
> + set_beacon_filter(hw, 1);
> + else
> + set_beacon_filter(hw, 0);
No need for test:
set_beacon_filter(hw, sc->assoc);
> + }
> + mutex_unlock(&sc->lock);
> + }
> + return;
ditto above comment
Thanks,
Bob
--
Bob Copeland %% http://www.bobcopeland.com
On Thu, Nov 20, 2008 at 02:01:19PM -0800, Bob Copeland wrote:
> Hi Martin,
>
> > From: Martin Xu <[email protected]>
> > Subject: disable beacon filter when station is not associated with any AP.
> >
> > Ath5k driver has too many interrupts per second at idle
> > http://bugzilla.kernel.org/show_bug.cgi?id=11749
> >
> > Signed-off-by: Martin Xu <[email protected]>
>
> Thanks for the cleanups. I don't have any objections to the patch.
> Anyone else want to weigh in?
Acked-by: Luis R. Rodriguez <[email protected]>
Please close the bug report too.
Luis
Hi Martin,
> From: Martin Xu <[email protected]>
> Subject: disable beacon filter when station is not associated with any AP.
>
> Ath5k driver has too many interrupts per second at idle
> http://bugzilla.kernel.org/show_bug.cgi?id=11749
>
> Signed-off-by: Martin Xu <[email protected]>
Thanks for the cleanups. I don't have any objections to the patch.
Anyone else want to weigh in?
Patch reproduced here:
>
> diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
> index 34cd1a4..37da7cc 100644
> --- a/drivers/net/wireless/ath5k/base.c
> +++ b/drivers/net/wireless/ath5k/base.c
> @@ -241,6 +241,10 @@ static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
> static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
> static void ath5k_reset_tsf(struct ieee80211_hw *hw);
> static int ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb);
> +static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + struct ieee80211_bss_conf *bss_conf,
> + u32 changes);
>
> static struct ieee80211_ops ath5k_hw_ops = {
> .tx = ath5k_tx,
> @@ -2952,7 +2956,7 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
> sc->opmode != NL80211_IFTYPE_MESH_POINT &&
> test_bit(ATH_STAT_PROMISC, sc->status))
> rfilt |= AR5K_RX_FILTER_PROM;
> - if (sc->opmode == NL80211_IFTYPE_STATION ||
> + if ((sc->opmode == NL80211_IFTYPE_STATION && sc->assoc) ||
> sc->opmode == NL80211_IFTYPE_ADHOC ||
> sc->opmode == NL80211_IFTYPE_AP)
> rfilt |= AR5K_RX_FILTER_BEACON;
> @@ -3092,4 +3096,32 @@ ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb)
>
> return ret;
> }
> +static void
> +set_beacon_filter(struct ieee80211_hw *hw, bool enable)
> +{
> + struct ath5k_softc *sc = hw->priv;
> + struct ath5k_hw *ah = sc->ah;
> + u32 rfilt;
> + rfilt = ath5k_hw_get_rx_filter(ah);
> + if (enable)
> + rfilt |= AR5K_RX_FILTER_BEACON;
> + else
> + rfilt &= ~AR5K_RX_FILTER_BEACON;
> + ath5k_hw_set_rx_filter(ah, rfilt);
> + sc->filter_flags = rfilt;
> +}
>
> +static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + struct ieee80211_bss_conf *bss_conf,
> + u32 changes)
> +{
> + struct ath5k_softc *sc = hw->priv;
> + if (changes & BSS_CHANGED_ASSOC) {
> + mutex_lock(&sc->lock);
> + sc->assoc = bss_conf->assoc;
> + if (sc->opmode == NL80211_IFTYPE_STATION)
> + set_beacon_filter(hw, sc->assoc);
> + mutex_unlock(&sc->lock);
> + }
> +}
> diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
> index 06d1054..facc60d 100644
> --- a/drivers/net/wireless/ath5k/base.h
> +++ b/drivers/net/wireless/ath5k/base.h
> @@ -179,6 +179,7 @@ struct ath5k_softc {
>
> struct timer_list calib_tim; /* calibration timer */
> int power_level; /* Requested tx power in dbm */
> + bool assoc; /* assocate state */
> };
>
> #define ath5k_hw_hasbssidmask(_ah) \
> _______________________________________________
> ath5k-devel mailing list
> [email protected]
> https://lists.ath5k.org/mailman/listinfo/ath5k-devel
>
--
Bob Copeland %% http://www.bobcopeland.com
SGkgYm9io7oNClBsZWFzZSByZXZpZXcgYmVsb3cgcGF0Y2ggd2hpY2ggaGFzIGJlZW4gbW9kaWZp
ZWQg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aGFuZ2VkLiAgSSBiZWxpZXZlIHRoaXMgY2FuIHJhY2UNCndpdGggY29uZmlndXJl
X2ZpbHRlciBhcyB3ZWxsIChidXQgY29uZmlndXJlX2ZpbHRlciBhbHJlYWR5IHJhY2VzIHdpdGgN
CmFueXRoaW5nIHRoYXQgdG91Y2hlcyBzYy0+c3RhdHVzLi4uKS4NCg0KPiBAQCAtMTc5LDYgKzE3
OSw3IEBAIHN0cnVjdCBhdGg1a19zb2Z0YyB7DQo+DQo+ICAgICAgICBzdHJ1Y3QgdGltZXJfbGlz
dCAgICAgICBjYWxpYl90aW07ICAgICAgLyogY2FsaWJyYXRpb24gdGltZXIgKi8NCj4gICAgICAg
IGludCAgICAgICAgICAgICAgICAgICAgIHBvd2VyX2xldmVsOyAgICAvKiBSZXF1ZXN0ZWQgdHgg
cG93ZXIgaW4gZGJtICovDQo+ICsgICAgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgYXNzb2M7
ICAgICAgICAgIC8qIGFzc29jYXRlIHN0YXRlICovDQo+ICB9Ow0KDQpzL2Fzc29jYXRlL2Fzc29j
aWF0ZS4gIEFsc28gaW4gYXRoNWsgd2Ugc29tZXRpbWVzIHVzZSBzYy0+c3RhdHVzIGZvciBzdWNo
DQpmbGFncywgdGhvdWdoIHRoaXMgY291bGQgZ28gZWl0aGVyIHdheS4NCg0KLS0gDQpCb2IgQ29w
ZWxhbmQgJSUgd3d3LmJvYmNvcGVsYW5kLmNvbQ0K
Hi all:
I have a patch that can be used to fix the bug.
The patch resolved the issue by disabling the beacon filter when disassociated with AP and enabling beacon when associate with AP.
See http://bugzilla.kernel.org/show_bug.cgi?id=11749
Please review it. Thanks!
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 34cd1a4..d774a6a 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -241,6 +241,10 @@ static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
static void ath5k_reset_tsf(struct ieee80211_hw *hw);
static int ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb);
+static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *bss_conf,
+ u32 changes);
static struct ieee80211_ops ath5k_hw_ops = {
.tx = ath5k_tx,
@@ -257,6 +261,7 @@ static struct ieee80211_ops ath5k_hw_ops = {
.get_tx_stats = ath5k_get_tx_stats,
.get_tsf = ath5k_get_tsf,
.reset_tsf = ath5k_reset_tsf,
+ .bss_info_changed = ath5k_bss_info_changed,
};
/*
@@ -2952,7 +2957,7 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
sc->opmode != NL80211_IFTYPE_MESH_POINT &&
test_bit(ATH_STAT_PROMISC, sc->status))
rfilt |= AR5K_RX_FILTER_PROM;
- if (sc->opmode == NL80211_IFTYPE_STATION ||
+ if ( (sc->opmode == NL80211_IFTYPE_STATION && sc->assoc) ||
sc->opmode == NL80211_IFTYPE_ADHOC ||
sc->opmode == NL80211_IFTYPE_AP)
rfilt |= AR5K_RX_FILTER_BEACON;
@@ -3093,3 +3098,54 @@ ath5k_beacon_update(struct ath5k_softc *sc, struct sk_buff *skb)
return ret;
}
+static void
+enable_beacon_filter(struct ieee80211_hw *hw)
+{
+ struct ath5k_softc *sc = hw->priv;
+ struct ath5k_hw *ah = sc->ah;
+ u32 rfilt;
+ rfilt = ath5k_hw_get_rx_filter(ah);
+ if ( !(rfilt & AR5K_RX_FILTER_BEACON) ){
+ rfilt |= AR5K_RX_FILTER_BEACON;
+ ath5k_hw_set_rx_filter(ah,rfilt);
+ sc->filter_flags = rfilt;
+ }
+ rfilt = ath5k_hw_get_rx_filter(ah);
+ return;
+}
+
+static void
+disable_beacon_filter(struct ieee80211_hw *hw)
+{
+ struct ath5k_softc *sc = hw->priv;
+ struct ath5k_hw *ah = sc->ah;
+ u32 rfilt;
+ rfilt = ath5k_hw_get_rx_filter(ah);
+ if ( rfilt & AR5K_RX_FILTER_BEACON ){
+ rfilt &= ~AR5K_RX_FILTER_BEACON;
+ ath5k_hw_set_rx_filter(ah,rfilt);
+ sc->filter_flags = rfilt;
+ }
+
+ return;
+}
+
+static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *bss_conf,
+ u32 changes)
+{
+ struct ath5k_softc *sc = hw->priv;
+ if (changes & BSS_CHANGED_ASSOC){
+ mutex_lock(&sc->lock);
+ sc->assoc = bss_conf->assoc;
+ if ( sc->opmode == NL80211_IFTYPE_STATION && sc-> assoc){
+ enable_beacon_filter(hw);
+ }
+ if ( sc->opmode == NL80211_IFTYPE_STATION && !sc-> assoc ){
+ disable_beacon_filter(hw);
+ }
+ mutex_unlock(&sc->lock);
+ }
+ return;
+}
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index 06d1054..facc60d 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -179,6 +179,7 @@ struct ath5k_softc {
struct timer_list calib_tim; /* calibration timer */
int power_level; /* Requested tx power in dbm */
+ bool assoc; /* assocate state */
};
#define ath5k_hw_hasbssidmask(_ah) \