History log of /drivers/net/wireless/ath/ath9k/recv.c
Revision Date Author Comments
e5982925c66c542aa41b17ee35fc233ae1521898 27-Jun-2012 Tom Hughes <tom@compton.nu> ath9k: fix panic caused by returning a descriptor we have queued for reuse

commit 6bb51c70cabaadddc54a6454844eceba91a56083 upstream.

Commit 3a2923e83c introduced a bug when a corrupt descriptor
is encountered - although the following descriptor is discarded
and returned to the queue for reuse the associated frame is
also returned for processing. This leads to a panic:

BUG: unable to handle kernel NULL pointer dereference at 000000000000003a
IP: [<ffffffffa02599a5>] ath_rx_tasklet+0x165/0x1b00 [ath9k]
Call Trace:
<IRQ>
[<ffffffff812d7fa0>] ? map_single+0x60/0x60
[<ffffffffa028f044>] ? ath9k_ioread32+0x34/0x90 [ath9k]
[<ffffffffa0292eec>] athk9k_tasklet+0xdc/0x160 [ath9k]
[<ffffffff8105e133>] tasklet_action+0x63/0xd0
[<ffffffff8105dbc0>] __do_softirq+0xc0/0x1e0
[<ffffffff8101a873>] ? native_sched_clock+0x13/0x80
[<ffffffff815f9d5c>] call_softirq+0x1c/0x30
[<ffffffff810151f5>] do_softirq+0x75/0xb0
[<ffffffff8105df95>] irq_exit+0xb5/0xc0
[<ffffffff815fa5b3>] do_IRQ+0x63/0xe0
[<ffffffff815f0cea>] common_interrupt+0x6a/0x6a
<EOI>
[<ffffffff8131840a>] ? intel_idle+0xea/0x150
[<ffffffff813183eb>] ? intel_idle+0xcb/0x150
[<ffffffff814a1db9>] cpuidle_enter+0x19/0x20
[<ffffffff814a23d9>] cpuidle_idle_call+0xa9/0x240
[<ffffffff8101c4bf>] cpu_idle+0xaf/0x120
[<ffffffff815cda8e>] rest_init+0x72/0x74
[<ffffffff81cf4c1a>] start_kernel+0x3b7/0x3c4
[<ffffffff81cf4662>] ? repair_env_string+0x5e/0x5e
[<ffffffff81cf4346>] x86_64_start_reservations+0x131/0x135
[<ffffffff81cf444a>] x86_64_start_kernel+0x100/0x10f

Making sure bf is cleared to NULL in this case restores the
old behaviour.

Signed-off-by: Tom Hughes <tom@compton.nu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Cc: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
aeb0da0b585868aed04e53afd1234791efcfac08 23-Jun-2012 Felix Fietkau <nbd@openwrt.org> ath9k: fix dynamic WEP related regression

commit bed3d9c0b71f9afbfec905cb6db3b9f16be29d4d upstream.

commit 7a532fe7131216a02c81a6c1b1f8632da1195a58
ath9k_hw: fix interpretation of the rx KeyMiss flag

This commit used the rx key miss indication to detect packets that were
passed from the hardware without being decrypted, however it seems that
this bit is not only undefined in the static WEP case, but also for
dynamically allocated WEP keys. This caused a regression when using
WEP-LEAP.

This patch fixes the regression by keeping track of which key indexes
refer to CCMP keys and only using the key miss indication for those.

Reported-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b5447ff92b5169eab843a76d83e98d0cd7b7f5b6 15-Mar-2012 Eric Dumazet <eric.dumazet@gmail.com> ath9k: fix a memory leak in ath_rx_tasklet()

commit 0d95521ea7 (ath9k: use split rx buffers to get rid of order-1 skb
allocations) added in memory leak in error path.

sc->rx.frag should be cleared after the pskb_expand_head() call, or else
we jump to requeue_drop_frag and leak an skb.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jouni Malinen <jouni@qca.qualcomm.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Trond Wuellner <trond@chromium.org>
Cc: Grant Grundler <grundler@chromium.org>
Cc: Paul Stewart <pstew@chromium.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ffb1c56a9706c7e4f1911faa14626b2bb3973479 10-Mar-2012 Ashok Nagarajan <ashok@cozybit.com> ath9k: Fix mactime from being clobbered in rx_status

mactime was being overwritten by the function ath9k_rx_skb_preprocess. Fixed by
memsetting rx_status in ath_rx_tasklet.

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2ef167557c0a26c88162ecffb017bfcc51eb7b29 03-Mar-2012 Felix Fietkau <nbd@openwrt.org> ath9k: fix signal strength reporting issues

On A-MPDU frames, the hardware only reports valid signal strength data for
the last subframe. The driver also mangled rx_stats->rs_rssi using the
ATH_EP_RND macro in a way that may make sense for ANI, but definitely
not for reporting to mac80211.
This patch changes the code to calculate the signal strength from the rssi
directly instead of taking the average value, and flag everything but
the last subframe in an A-MPDU to tell mac80211 to ignore the signal strength
entirely, fixing signal strength fluctuation issues reported by various
users.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3a2923e83c6036f55ad4a39c8ee9a7d4accd9539 03-Mar-2012 Felix Fietkau <nbd@openwrt.org> ath9k: get rid of double queueing of rx frames on EDMA

Process rx status directly instead of separating the completion test from
the actual rx status processing.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6a01f0c08d20a2b1356c1cb90ef97a0dc412b64c 28-Feb-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: make use of list_for_each_entry_safe

this does the same thing as the previous code

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f88373fa47f3ce6590fdfaa742d0ddacc2ae017f 05-Feb-2012 Felix Fietkau <nbd@openwrt.org> ath9k: fix a WEP crypto related regression

commit b4a82a0 "ath9k_hw: fix interpretation of the rx KeyMiss flag"
fixed the interpretation of the KeyMiss flag for keycache based lookups,
however WEP encryption uses a static index, so KeyMiss is always asserted
for it, even though frames are decrypted properly.
Fix this by clearing the ATH9K_RXERR_KEYMISS flag if no keycache based
lookup was performed.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@vger.kernel.org
Reported-by: Laurent Bonnans <bonnans.l@gmail.com>
Reported-by: Jurica Vukadin <u.ra604@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d2182b69dcb6a68b1ef6070b2efd094e13dea3f1 15-Dec-2011 Joe Perches <joe@perches.com> ath: Convert ath_dbg(bar, ATH_DBG_<FOO>, to ath_dbg(bar, FOO

Add ATH_DBG_ to macros to shorten the uses and
reduce the line count.

Coalesce ath_dbg formats.
Add missing spaces to coalesced formats.
Add missing newline terminations to ath_dbg formats.
Align ath_dbg arguments where appropriate.
Standardize ath_dbg formats without periods.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
356cb55d81d1692bd74b96c71deeb7e1cf956196 07-Dec-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: validate for non-zero BSSID

before concluding that the recieved beacon is for us, let us make sure
that the BSSID is non-zero. when I configured ad-hoc mode as creator and
left it for some time without joining I found we recieved few frames whose
BSSID is zero, which we concluded wrongly as 'my_beacons'

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7468722b681ff4ea3f2cb612a28943c01c1b492a 30-Nov-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: minor cleanup

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
eb840a80d2e5f446ad58a6d4f14dcaa3d877a362 29-Nov-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: change the default antenna settings based on diversity

change the AR_DEF_ANTENNA register settings i.e setting default antenna
setting only for antenna diversity enabled chipsets. no point in
doing this for MIMO chipsets

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
83c76570961573e56a238d84ba18f2581ef1e6b5 16-Nov-2011 Zefir Kurtisi <zefir.kurtisi@neratec.com> ath9k: trivial: reorder rx_tasklet processing

DFS events are reported as PHY errors and need to be processed
with a correct timestamp set before ath9k_skb_preprocess() is
called and the frame is possibly dropped.

This patch puts the rxs->mactime calculation before the skb
is preprocessed to prepare for DFS event reporting.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ec205999d31bbb1208ab59c3b6d22c47cca74257 08-Oct-2011 Felix Fietkau <nbd@openwrt.org> ath9k: only send FCS-fail packets to mac80211 if requested

Prevents lots of broken frames from showing up on monitor interfaces
by default.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
846d9363505d14e591a427619ccb7ffe6a7a3541 08-Oct-2011 Felix Fietkau <nbd@openwrt.org> ath9k_hw: fix a regression in key miss handling

The commit "ath9k_hw: Fix incorrect key_miss handling" changed the code
to only report key miss errors if a MIC error wasn't reported.
When checking the flags in that order in the MAC code, it might miss some
real events, because the value of the MIC error flag is undefined under
some conditions.

The primary issue addressed by the previous commit is making sure that
MIC errors are properly reported on the STA side. This can be fixed in
a better way by adding a separate rx status flag for key miss and
ignoring it for multicast frames.

This fix slightly improves stability in AP mode on some older hardware,
like AR9132.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
72d874c67c3cdf21ca95045baabac6a5843222d8 08-Oct-2011 Felix Fietkau <nbd@openwrt.org> ath9k_hw: make ath9k_hw_set_interrupts use ah->imask by default

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ac06697c79bad09e44a8b1d52104014016fb90de 08-Oct-2011 Felix Fietkau <nbd@openwrt.org> ath9k: disable unnecessary PHY error reporting

PHY errors relevant for ANI are always tracked by hardware counters, the
bits that allow them to pass through the rx filter are independent of that.
Enabling PHY errors in the rx filter often creates lots of useless DMA traffic
and might be responsible for some of the rx dma stop failure warnings.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f73c604cfbf7f611e3ec129a0548fcbe8574d180 26-Sep-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com> ath9k: Remove redundant my beacon check at ath_rx_ps_beacon

Make use of the rx status's is_mybeacon in order to avoid
redundant memcmp.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ba54238552625aad2d75f455a4d3db18ea7dec68 23-Sep-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: Fix a dma warning/memory leak

proper dma_unmapping and freeing of skb's has to be done in the rx
cleanup for EDMA chipsets when the device is unloaded and this also
seems to address the following warning which shows up occasionally when
the device is unloaded

Call Trace:
[<c0148cd2>] warn_slowpath_common+0x72/0xa0
[<c03b669c>] ? dma_debug_device_change+0x19c/0x200
[<c03b669c>] ? dma_debug_device_change+0x19c/0x200
[<c0148da3>] warn_slowpath_fmt+0x33/0x40
[<c03b669c>] dma_debug_device_change+0x19c/0x200
[<c0657f12>] notifier_call_chain+0x82/0xb0
[<c0171370>] __blocking_notifier_call_chain+0x60/0x90
[<c01713bf>] blocking_notifier_call_chain+0x1f/0x30
[<c044f594>] __device_release_driver+0xa4/0xc0
[<c044f647>] driver_detach+0x97/0xa0
[<c044e65c>] bus_remove_driver+0x6c/0xe0
[<c029af0b>] ? sysfs_addrm_finish+0x4b/0x60
[<c0450109>] driver_unregister+0x49/0x80
[<c0299f54>] ? sysfs_remove_file+0x14/0x20
[<c03c3ab2>] pci_unregister_driver+0x32/0x80
[<f92c2162>] ath_pci_exit+0x12/0x20 [ath9k]
[<f92c8467>] ath9k_exit+0x17/0x36 [ath9k]
[<c06523cd>] ? mutex_unlock+0xd/0x10
[<c018e27f>] sys_delete_module+0x13f/0x200
[<c02139bb>] ? sys_munmap+0x4b/0x60
[<c06547c5>] ? restore_all+0xf/0xf
[<c0657a20>] ? spurious_fault+0xe0/0xe0
[<c01832f4>] ? trace_hardirqs_on_caller+0xf4/0x180
[<c065b863>] sysenter_do_call+0x12/0x38
---[ end trace 16e1c1521c06bcf9 ]---
Mapped at:
[<c03b7938>] debug_dma_map_page+0x48/0x120
[<f92ba3e8>] ath_rx_init+0x3f8/0x4b0 [ath9k]
[<f92b5ae4>] ath9k_init_device+0x4c4/0x7b0 [ath9k]
[<f92c2813>] ath_pci_probe+0x263/0x330 [ath9k]

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3483288caf3d979e6b032d62f75f57893adf0d53 14-Sep-2011 Felix Fietkau <nbd@openwrt.org> ath9k: ensure that rx is not enabled during a reset

During a reset, rx buffers are flushed after rx has been disabled. To avoid
race conditions, rx needs to stay disabled during the reset, so avoid any
calls to ath9k_hw_rxena in that case.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
43c3528430bd29f5e52438cad7cf7c0c62bf4583 03-Sep-2011 Felix Fietkau <nbd@openwrt.org> ath9k: implement .get_antenna and .set_antenna

On MIMO chips this can be used to enable/disable hardware chains, ensuring
that the MCS information is updated accordingly.
On non-MIMO chips with rx diversity (e.g. 9285), this configures the rx
input antenna.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cf3af74824b1bf2bd60eb6a0dd82b27f9e9236ac 27-Aug-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com> ath9k: Add debugfs support for mac/baseband samples

This patch keep track of number of samples that includes
DMA debugs registers, PCU observe, CR, channel noise,
cycle conters, noisefloor history buffer and last N number
of tx and rx descriptor status. These samples are grouped
in table manner which dumping in debgufs.

Debugfs file location:
<debugfs_mnt>/ieee80211/phy#/ath9k/samples

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9976f62e7c4e77248b84a35ab0e87e6bc4682ca0 26-Aug-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: use appropriate debug mask

in the Rx path of the driver it would be better to use ATH_DBG_ANY
rather than ATH_DBG_XMIT for printing debug messages

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
152e585dc9fe2c3436e87cc982f2446697778228 19-Aug-2011 Bill Jordan <bjordan@rajant.com> ath9k: fix MGMT packets when using TKIP

Prevent 8 bytes from being truncated from MGMT packets
when using TKIP.

Signed-off-by: Bill Jordan <bjordan@rajant.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3de2111697ffca5b9b2fba452bced812725524de 13-Aug-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com> ath9k: Remove unused argument tsf from ath9k_hw_rxprocdesc

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
29ab0b3632293b506d85adc9dcb323c79f40d428 13-Aug-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com> ath9k: Re-enable RXOEL interrupt after processing rx buffers

Once RXEOL was disabled, it never be enabled again. This patch
re-enables rxeol at the end of rx tasklet.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6a6767b046e2d336e2af06cb605106ed44a852b6 10-Aug-2011 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com> ath9k: remove obselete comments

the comments are obselete as the virtual wiphy support was removed from
the driver

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e8fe7336849e469978c9bbcc435903595912c4d3 05-Aug-2011 Rajkumar Manoharan <rmanohar@qca.qualcomm.com> ath9k: Use atomic reference count for interrupt ops

Let us enable/disable interrupts based on reference count.
By doing this we can ensure that interrupts are never be
enabled in the middle of tasklet processing. Instead of
addressing corner cases like "ath9k: avoid enabling interrupts
while processing rx", this approach handles it in generic manner.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f749b94679c71a9c74ad9509dbbf00d8f3d620ad 28-Jul-2011 Felix Fietkau <nbd@openwrt.org> ath9k: use the new channel noise value for signal strength and survey info

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
66760eac005d569393bac34136bcbb8af55d8a5a 13-Jul-2011 Felix Fietkau <nbd@openwrt.org> ath9k: improve reliability of MIC error detection

For unicast the hardware sometimes reports MIC errors even though the
frame that it received actually contains a valid MIC - on some chips this
can happen frequently enough to trigger TKIP countermeasures.
Fix this issue by not reporting MIC errors for unicast frames with a
valid key, letting mac80211 validate the MIC instead.

Additionally, strip the MIC for all frames that the hardware considers
valid to avoid wasting CPU cycles re-validating it.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e7ef5bc079672058dcb791a378dc3beb134bd84e 21-Jun-2011 Gabor Juhos <juhosg@openwrt.org> ath9k: add fast_div_bias configuration for diversity group 1

The patch adds the missing configuration code for diversity
group 1.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
223c5a87851369de99fa6e6f22c443ed08a0332b 21-Jun-2011 Gabor Juhos <juhosg@openwrt.org> ath9k: remove superfluous parentheses

Also remove two empty lines.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
66ce235a9d6ea8a7b7089d29000eb715c66a6221 21-Jun-2011 Gabor Juhos <juhosg@openwrt.org> ath9k: add a missing case statement to ath_ant_div_comb_alt_check

The 'ar9003_hw_antdiv_comb_conf_get' function sets div_group to 2
however that value is not used in 'ath_ant_div_comb_alt_check'.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b7f080cfe223b3b7424872639d153695615a9255 16-Jun-2011 Alexey Dobriyan <adobriyan@gmail.com> net: remove mm.h inclusion from netdevice.h

Remove linux/mm.h inclusion from netdevice.h -- it's unused (I've checked manually).

To prevent mm.h inclusion via other channels also extract "enum dma_data_direction"
definition into separate header. This tiny piece is what gluing netdevice.h with mm.h
via "netdevice.h => dmaengine.h => dma-mapping.h => scatterlist.h => mm.h".
Removal of mm.h from scatterlist.h was tried and was found not feasible
on most archs, so the link was cutoff earlier.

Hope people are OK with tiny include file.

Note, that mm_types.h is still dragged in, but it is a separate story.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5b68138e5659cbfd5df2879d17f9ba0b66477fec 17-May-2011 Sujith Manoharan <Sujith.Manoharan@atheros.com> ath9k: Drag the driver to the year 2011

The Times They Are a-Changin'.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
21e8ee6d207f6d384689571101436eb9070c22ca 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k: make sure main_rssi is positive

some times the rssi control descriptor for the main antenna may be
negative like that of alternate antenna, hence before incrementing
packet counts/rssi of main/alternate antenna make sure both main_rssi
and alt_rssi are positive only. this avoids wrong selection of antenna
due to diversity

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3e9a212a9e21266115bad2982016950fb2bf29c2 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k: configure fast_div_bias based on diversity group

configure fast diversity bias based on the antenna diversity group and
based on main/alt LNA configurations. also configure main antenna and
alternate antenna to gain-table 0 for diversity group 2(AR9485)

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b85c5734f00886ee0f33ef4d0038ed9a278eefce 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k: Implement an API to swap main/ALT LNA's

for the diversity group 2(AR9485) we swap the LNA's of main/ALT antenna
based on alternate antenna's rssi average in comparision with main
antenna's rssi, while for AR9285(antenna diversity group 0)we still
follow the older method of looking at the packet count in alternate
antenna

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8afbcc8bfb549a522298fa4a31ee5155c2b5f7a0 13-May-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k_hw: define antenna diversity group

AR9285 belongs to diversity group 0 and AR9485 belongs to diversity
group 2. Based on the diversity group we configure certain antenna
diversity paramaters such as lna1_lna2_delta and fast diversity
bias values. For AR9485 we have some gain table parameter which
selects the gain table 0/1 for main and alternate antenna

Cc: Gabriel Tseng <Gabriel.Tseng@Atheros.com>
Cc: Senthilkumar Balasubramanian <Senthilkumar.Balasubramanian@Atheros.com>
Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2b892a98db269b96ed097d560aaaa371907d20f5 09-May-2011 Rajkumar Manoharan <rmanoharan@atheros.com> ath9k: Fix rssi update in ad-hoc mode

The average beacon rssi which will be used by ani is not updated
in adhoc mode.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
deb751880af6f2dce6cdc232a7b023f2b58cd815 06-May-2011 Rajkumar Manoharan <rmanoharan@atheros.com> ath9k: avoid enabling interrupts while processing rx

The assumsion is that while processing ath9k tasklet,
interrupts were already disabled and it will be enabled
at the completion of ath9k tasklet. But whenever TSFOOR is raised,
the driver configures the beacon timers after having received a
beacon frame from the AP which inturn enables the interrupts.

Cc: stable@kernel.org
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cedc7e3d0c847d602d2970120d0e4cca72f364a4 22-Apr-2011 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k: remove the unlikely check for autosleep

newer chipsets support auto sleep feature, so remove the
unlikely check which does not seems to help anything

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0ff2b5c05d4dd84222a8e163335c5b550e2ca195 20-Apr-2011 Sujith Manoharan <Sujith.Manoharan@atheros.com> ath9k: Fix warnings from -Wunused-but-set-variable

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2232d31bf18ba02f5cd632bbfc3466aeca394c75 15-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath9k: fix the return value of ath_stoprecv

The patch 'ath9k_hw: fix stopping rx DMA during resets' added code to detect
a condition where rx DMA was stopped, but the MAC failed to enter the idle
state. This condition requires a hardware reset, however the return value
of ath_stoprecv was 'true' in that case, which allowed it to skip the reset
when issuing a fast channel change.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Reported-by: Paul Stewart <pstew@google.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
952949738aba19f84dae9def18e0baa58f0ce0b8 07-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath9k: fix too early enabling of rx during ath_startrecv()

rx should only be enabled after enough rx buffers have been given to the
hardware, however ath_rx_buf_link was calling ath9k_hw_rxena after every
single added buffer.
Fix this by calling ath9k_hw_rxena directly from the rx tasklet after
completion instead.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
264bbec811024e39fe8f9e7a45743f81f373529e 07-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath9k: fix PS-Poll reception on AR9160 and earlier

I can't find any valid reason for not setting the ATH9K_RX_FILTER_PSPOLL
flag on older hardware and neither the documentation nor the reference
code mention any reason for excluding older hardware here.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5882da02e9d9089b7e8c739f3e774aaeeff8b7ba 08-Apr-2011 Felix Fietkau <nbd@openwrt.org> ath9k_hw: fix stopping rx DMA during resets

During PHY errors, the MAC can sometimes fail to enter an idle state on older
hardware (before AR9380) after an rx stop has been requested.

This typically shows up in the kernel log with messages like these:

ath: Could not stop RX, we could be confusing the DMA engine when we start RX up
------------[ cut here ]------------
WARNING: at drivers/net/wireless/ath/ath9k/recv.c:504 ath_stoprecv+0xcc/0xf0 [ath9k]()
Call Trace:
[<8023f0e8>] dump_stack+0x8/0x34
[<80075050>] warn_slowpath_common+0x78/0xa4
[<80075094>] warn_slowpath_null+0x18/0x24
[<80d66d60>] ath_stoprecv+0xcc/0xf0 [ath9k]
[<80d642cc>] ath_set_channel+0xbc/0x270 [ath9k]
[<80d65254>] ath_radio_disable+0x4a4/0x7fc [ath9k]

When this happens, the state that the MAC enters is easy to identify and
does not result in bogus DMA traffic, however to ensure a working state
after a channel change, the hardware should still be reset.

This patch adds detection for this specific MAC state, after which the above
warnings completely disappear in my tests.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Cc: Kyungwan Nam <Kyungwan.Nam@Atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
99e4d43ad5ff5778f92ee3bc40a29ac7cd8a28f4 04-Apr-2011 Rajkumar Manoharan <rmanoharan@atheros.com> ath9k: configure beacons based on hw opmode

Current ath9k code does not handle beacon timers on opmode
specific. One such example is that a STA beacon config overwrites
already configured AP vif's beacon timers during scan.

On multi station vif case, configure beacon timers beased
on primary vif selected. This also helps while moving back
to single STA vif from multi STA vifs, where the power save
is enabled and hw has to be reconfigured with proper
beacon and bssid/aid. Otherwise connection poll will be triggered
so frequently due to beacon loss.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2e286947f1294239527c11f9f466ddce6466455b 09-Mar-2011 Felix Fietkau <nbd@openwrt.org> ath9k: remove support for the FIF_PROMISC_IN_BSS filter flag

The hardware rx filter flag triggered by FIF_PROMISC_IN_BSS is overly broad
and covers even frames with PHY errors. When this flag is enabled, this message
shows up frequently during scanning or hardware resets:

ath: Could not stop RX, we could be confusing the DMA engine when we start RX up

Since promiscuous mode is usually not particularly useful, yet enabled by
default by bridging (either used normally in 4-addr mode, or with hacks
for various virtualization software), we should sacrifice it for better
reliability during normal operation.

This patch leaves it enabled if there are active monitor mode interfaces, since
it's very useful for debugging.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6ebacbb79d2d05978ba50a24d8cbe2a76ff2014c 23-Feb-2011 Johannes Berg <johannes.berg@intel.com> mac80211: rename RX_FLAG_TSFT

The flag isn't very descriptive -- the intention
is that the driver provides a TSF timestamp at
the beginning of the MPDU -- make that clearer
by renaming the flag to RX_FLAG_MACTIME_MPDU.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0d95521ea74735826cb2e28bebf6a07392c75bfa 26-Jan-2011 Felix Fietkau <nbd@openwrt.org> ath9k: use split rx buffers to get rid of order-1 skb allocations

With this change, less CPU time is spent trying to look for consecutive
pages for rx skbs. This also reduces the socket memory required for IP/UDP
reassembly.
Only two buffers per frame are supported. Frames spanning more buffers
will be dropped, but the buffer size is enough to handle the required
AMSDU size.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9ac58615d93c8a28b1c649a90a5e2ede4dfd368a 24-Jan-2011 Felix Fietkau <nbd@openwrt.org> ath9k: fold struct ath_wiphy into struct ath_softc

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7545daf498c43e548506212310e6c75382d2731d 24-Jan-2011 Felix Fietkau <nbd@openwrt.org> ath9k: remove support for virtual wiphys

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4801416c76a3a355076d6d371c00270dfe332e1c 15-Jan-2011 Ben Greear <greearb@candelatech.com> ath9k: Fix up hardware mode and beacons with multiple vifs.

When using a mixture of AP and Station interfaces,
the hardware mode was using the type of the
last VIF registered. Instead, we should keep track
of the number of different types of vifs and set the
mode accordingly.

In addtion, use the vif type instead of hardware opmode
when dealing with beacons.

Attempt to move some of the common setup code into smaller
methods so we can re-use it when changing vif mode as
well as adding/deleting vifs.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d584747be838775cebbf5937c20b24da6899e3e8 20-Dec-2010 Rajkumar Manoharan <rmanoharan@atheros.com> ath9k: Fix warnings on card removal

The recently added warning message on power change failure
is not needed on device removal.

ath: Failed to wakeup in 500us
------------[ cut here ]------------
WARNING: at drivers/net/wireless/ath/ath9k/hw.c:1618
ath9k_hw_setpower+0x61f/0x630 [ath9k_hw]()
Hardware name: 64756D6
Pid: 540, comm: kworker/u:3 Not tainted 2.6.37-rc6-wl #37
Call Trace:
[<ffffffff810501aa>] warn_slowpath_common+0x7a/0xb0
[<ffffffffa056e280>] ? ath9k_iowrite32+0x0/0x90 [ath9k]
[<ffffffff810501f5>] warn_slowpath_null+0x15/0x20
[<ffffffffa05226ef>] ath9k_hw_setpower+0x61f/0x630 [ath9k_hw]
[<ffffffffa05700e5>] ath9k_ps_wakeup+0x85/0xd0 [ath9k]
[<ffffffffa0570685>] ath9k_configure_filter+0x25/0x80 [ath9k]
[<ffffffffa04dde43>] ieee80211_configure_filter+0x133/0x190 [mac80211]
[<ffffffffa04ee502>] ieee80211_do_stop+0x132/0x540 [mac80211]
[<ffffffff813466ff>] ? _raw_spin_unlock_bh+0x1f/0x30
[<ffffffff812b6923>] ? dev_deactivate+0x1c3/0x1e0
[<ffffffffa04ee925>] ieee80211_stop+0x15/0x20 [mac80211]
[<ffffffff8129d1b6>] __dev_close+0x56/0x90

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cae6b74d907e2abd22d496fe30417b088d3302cf 07-Dec-2010 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k: Remove dead code in recv.c

The structure struct ieee80211_rx_status *rxs is no longer needed to be
passed to ath_rx_send_to_mac80211 function

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
aaef24b4c9f5db726e618977b74ffef924360de5 07-Dec-2010 Mohammed Shafi Shajakhan <mshajakhan@atheros.com> ath9k: Properly use unlikely check macro

AUTOSLEEP feature is enabled only for AR9271 and AR9003 version
chipsets.So unlikely macro should be used only to check whether
auto-sleep feature is enabled

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d7fd1b50a51be3fe6554fbab8953fa8a3ff4009b 06-Dec-2010 Ben Greear <greearb@candelatech.com> ath9k: Make DMA warning in ath_stoprecv WARN_ON_ONCE.

This decreases spammage in the log. A single line message
will still be printed, so users can be aware that problem
exists.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
226afe68fdbd1aa3680158aca0a3631cbd019626 03-Dec-2010 Joe Perches <joe@perches.com> ath: Convert ath_print to ath_dbg

Remove ath/debug.h and the includes of these files.
Coalesce long formats.
Correct a few misspellings and missing "\n"s from these logging messages.
Remove unnecessary trailing space before a newline.
Remove ARRAY_SIZE casts, use printf type %zu

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3800276a40751539a920ef8e0537ef2e19126799 03-Dec-2010 Joe Perches <joe@perches.com> ath: Convert ath_print(.., ATH_DBG_FATAL to ath_err

So these errors are always emitted at KERN_ERR level.
Remove ARRAY_SIZE casts, use printf type %zu

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
38852b20c8b6d97618204ac64abbf14f0080393e 06-Dec-2010 Senthil Balasubramanian <senthilkumar@atheros.com> ath9k: Fix STA disconnect issue due to received MIC failed bcast frames

AR_RxKeyIdxValid will not be set for bcast/mcast frames and so relying
this status for MIC failed frames is buggy.

Due to this, MIC failure events for broadcast frames are not sent to
supplicant resulted in AP disconnecting the STA.

Able to pass Wifi Test case 5.2.18 with this fix.

Cc: Stable <stable@kernel.org> (2.6.36+)
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d89197c7f34934fbb0f96d938a0d6cfe0b8bcb1c 02-Dec-2010 John W. Linville <linville@tuxdriver.com> Revert "ath9k: Fix STA disconnect issue due to received MIC failed bcast frames"

This reverts commit 916448e77f6bcaaa7f13c3de0c3851783ae2bfd0.

"As far as I can tell, either of these patches breaks multiple VIF
scenarios. I'm not sure exactly why, but I had to revert this to
get any of my interfaces to associate."
-- Ben Greear <greearb@candelatech.com>

http://marc.info/?l=linux-wireless&m=129123368719339&w=2

Signed-off-by: John W. Linville <linville@tuxdriver.com>
916448e77f6bcaaa7f13c3de0c3851783ae2bfd0 30-Nov-2010 Senthil Balasubramanian <senthilkumar@atheros.com> ath9k: Fix STA disconnect issue due to received MIC failed bcast frames

AR_RxKeyIdxValid will not be set for bcast/mcast frames and so relying
this status for MIC failed frames is buggy.

Due to this, MIC failure events for broadcast frames are not sent to
supplicant resulted in AP disconnecting the STA.

Able to pass Wifi Test case 5.2.18 with this fix.

Cc: Stable <stable@kernel.org> (2.6.36+)
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d47844a014fada1a788719f6426bc7044f2a0fd8 20-Nov-2010 Felix Fietkau <nbd@openwrt.org> ath9k: fix timeout on stopping rx dma

It seems that using ath9k_hw_stoppcurecv to stop rx dma is not enough.
When it's time to stop DMA, the PCU is still busy, so the rx enable
bit never clears.
Using ath9k_hw_abortpcurecv helps with getting rx stopped much faster,
with this change, I cannot reproduce the rx stop related WARN_ON anymore.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4bdd1e978ede034c1211957eb17eaf50de00d234 27-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move the PCU lock to the sc structure

The PCU lock should be used to contend TX DMA as well,
this will be done next.

This is part of a series of patches which fix stopping
TX DMA completley when requested on the driver.
For more details about this issue refer to this thread:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2

Tested-by: Ben Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Cc: stable@kernel.org
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
78a7685e1e44c6d4b6f79c73687b9322e40b040e 21-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: add a debug warning when we cannot stop RX

We have seen several DMA races when we race against
stopping and starting the PCU. I suspect that when
we cannot stop the PCU we may hit some of these same
races so warn against them for now but only when
debugging (CONFIG_ATH_DEBUG) is enabled.

If you run into this warning and are a developer,
please fix the cause of the warning. The potential
here, although I cannot prove yet, is that the DMA
engine can be confused and start writing to a buffer
that was already DMA'd before and at least the kernel
assumes is not being accessed by hardware anymore.

Cc: Ben Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9fa23e1741404207c414fad69212a8763c138bf0 15-Oct-2010 Felix Fietkau <nbd@openwrt.org> ath9k: optimize/fix ANI RSSI processing

ANI needs the RSSI average only in station mode, and only for tracking
the signal strength of beacons of the AP that it is connected to.
Adjust the code to track on the beacon RSSI, and store the average of that
in the ath_wiphy struct.
With these changes, we can get rid of this extra station lookup in the
rx path, which saves precious CPU cycles.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5f841b4130a639e5f0fbcf4a9b26045d734e4ee6 27-Oct-2010 Rajkumar Manoharan <rmanoharan@atheros.com> ath9k: Avoid HW opmode overridden on monitor mode changes

The HW opmode is blindly set to monitor type on monitor mode
change notification. This overrides the opmode when one of the
interfaces is still running as non-monitor iftype. So the monitoring
information needs to be maintained seperately.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5e848f789d60000d39d9a5f26ab02dbdd963f6cd 21-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: lock reset and PCU start/stopping

Apart from locking the start and stop PCU we need
to ensure we also content starting and stopping the PCU
between hardware resets.

This is part of a series that will help resolve the bug:

https://bugzilla.kernel.org/show_bug.cgi?id=14624

For more details about this issue refer to:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2

Cc: stable@kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b79b33c4baf2532aac2c0924dce5a738099b888c 21-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: rename rxflushlock to pcu_lock

The real way to lock RX is to contend on the PCU
and reset, this will be fixed in the next patch but for
now just do the renames so that the next patch which changes
the locking order is crystal clear.

This is part of a series that will help resolve the bug:

https://bugzilla.kernel.org/show_bug.cgi?id=14624

For more details about this issue refer to:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2

Cc: stable@kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7583c550c3e635dcc61ab127c36ecefd59fb8dc8 21-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: add locking for starting the PCU on RX

There was some locking for starting some parts of
RX but not for starting the PCU. Include this otherwise
we can content against stopping the PCU.

This can potentially lead to races against different
buffers on the PCU which can lead to to the DMA RX
engine writing to buffers which are already freed.

This is part of a series that will help resolve the bug:

https://bugzilla.kernel.org/show_bug.cgi?id=14624

For more details about this issue refer to:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2

Cc: stable@kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1e450285281bdf766272c181ecd43d4f2f0711ce 21-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: add locking for stopping RX

ath9k locks for starting RX but not for stopping RX. We could
potentially run into a situation where tried to stop RX
but immediately started RX. This allows for races on the
the RX engine deciding what buffer we last left off on
and could potentially cause ath9k to DMA into already
free'd memory or in the worst case at a later time to
already given memory to other drivers.

Fix this by locking stopping RX.

This is part of a series that will help resolve the bug:

https://bugzilla.kernel.org/show_bug.cgi?id=14624

For more details about this issue refer to:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2

Cc: stable@kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6cf9e995f91e5bbffb2bef85feef490e5b67605d 14-Oct-2010 Ben Greear <greearb@candelatech.com> ath9k: Null out references to stale pointers.

This doesn't fix any problem that I'm aware of, but should
make it harder to add use-after-free type bugs in the
future.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c1739eb3e61e160f124bc842c219011916f63068 14-Oct-2010 Ben Greear <greearb@candelatech.com> ath9k: Remove bf_dmacontext.

The bf_dmacontext seems to be totally useless and duplicated
by bf_buf_addr. Remove it entirely, use bf_buf_addr in its
place.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9c1d8e4affe6748d884a677cf5db19ae0c20ef07 13-Oct-2010 Jouni Malinen <jouni.malinen@atheros.com> ath9k: Set RX filter for Probe Request based on filter flag

This allows mac80211 to enable receiving of Probe Request frames in
station mode which is needed for P2P.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
686b9cb994f5f74be790df4cd12873dfdc8a6984 23-Sep-2010 Ben Greear <greearb@candelatech.com> mac80211/ath9k: Support AMPDU with multiple VIFs.

The old ieee80211_find_sta_by_hw method didn't properly
find VIFS when there was more than one per AP. This caused
AMPDU logic in ath9k to get the wrong VIF when trying to
account for transmitted SKBs.

This patch changes ieee80211_find_sta_by_hw to take a
localaddr argument to distinguish between VIFs with the
same AP but different local addresses. The method name
is changed to ieee80211_find_sta_by_ifaddr.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e17f83eafd37129f9e09425136e59bc4333bdb9c 22-Sep-2010 Felix Fietkau <nbd@openwrt.org> ath9k_hw: simplify revision checks for AR9285

Since AR9285 v1.0 and v1.1 were never sold (and the initvals removed),
its revision checks can be simplified similar to AR9280

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7a37081e2e25e58701b17c41579fd06bc353b392 22-Sep-2010 Felix Fietkau <nbd@openwrt.org> ath9k_hw: simplify revision checks for AR9280

Since AR9280 v1.0 was never sold (and the initvals removed), v1.0 specific
revision checks can be removed and the 'v2.0 or later' check can be
simplified to a check for AR9280 or later.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3fac6dfdcd2b893c22b20a03dd1bf1af8b627c4b 16-Sep-2010 Senthil Balasubramanian <senthilkumar@atheros.com> ath9k: fix regression which prevents chip sleep after CAB data

The patch:

commit 293dc5dfdbcc16cde06e40a688394cc8ab083e48
Author: Gabor Juhos <juhosg@openwrt.org>
Date: Fri Jun 19 12:17:48 2009 +0200

ath9k: remove ath_rx_ps_back_to_sleep helper

This helper only clears the SC_OP_WAIT_FOR_{BEACON,CAB} flags.
Remove it and clear these flags directly in the approptiate
places instead.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

introduced a regression which forgot to lift the beacon flag
after we received all broadcast and multicast data. This meant
we never went to sleep consuming about ~650mW on idle. This pretty
much broke power save completely.

This patch has fixes for stable kernels [2.6.32+].

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Sameer Nanda <snanda@google.com>
Cc: Gabor Juhos <juhosg@openwrt.org>
Cc: Amod Bodas <amod.bodas@atheros.com>
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
48a6a468198aadb54bc5d3fdd065364d43ff5197 16-Sep-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: fix enabling ANI / tx monitor after bg scan

ath9k's entire logic with SC_OP_SCANNING is incorrect due to the
way mac80211 currently implements the scan complete callback and
we handle it in ath9k. This patch removes the flag completely in
preference for the SC_OP_OFFCHANNEL which is really what we wanted.

The scanning flag was used to ensure we reset ANI to the old values
when we go back to the home channel, but if we are offchannel we
use some defaults. The flag was also used to re-enable the TX monitor.

Without this patch we simply never re-enabled ANI and the TX monitor
after going offchannel. This means that after one background
scan we are prone to noise issues and if we had a TX hang we would
not recover. To get this to work properly we must enable ANI after
we have configured the beacon timers, otherwise hardware acts really
oddly.

This patch has stable fixes which apply down to [2.6.36+], there
*may* be a to fix this on older kernels but requires a bit of
work since this patch relies on the new mac80211 flag
IEEE80211_CONF_OFFCHANNEL which was introduced as of 2.6.36.

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Amod Bodas <amod.bodas@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8ab2cd09fecc8819bbaee2d0fd8f3a092d866ce3 16-Sep-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: fix power save race conditions

ath9k has a race on putting the chip into network sleep and
having registers read from hardware. The race occurs because
although ath9k_ps_restore() locks its own callers it makes use
of some variables which get altered in the driver at different
code paths. The variables are the ps_enabled and ps_flags.

This is easily reprodicible in large network environments when
roaming with the wpa_supplicant simple bgscan. You'd get some
0xdeadbeef read out on certain registers such as:

ath: timeout (100000 us) on reg 0x806c: 0xdeadbeef & 0x01f00000 != 0x00000000
ath: RX failed to go idle in 10 ms RXSM=0xdeadbeef

ath: timeout (100000 us) on reg 0x7000: 0xdeadbeef & 0x00000003 != 0x00000000
ath: Chip reset failed

The fix is to protect the ath9k_config(hw, IEEE80211_CONF_CHANGE_PS)
calls with a spin_lock_irqsave() which will disable contendors for
these variables from interrupt context, timers, re-entry from mac80211
on the same callback, and most importantly from ath9k_ps_restore()
which is the only call which will put the device into network sleep.

There are quite a few threads and bug reports on these a few of them are:

https://bugs.launchpad.net/ubuntu/karmic/+source/linux/+bug/407040
http://code.google.com/p/chromium-os/issues/detail?id=5709
http://code.google.com/p/chromium-os/issues/detail?id=5943

Stable fixes apply to [2.6.32+]

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Amod Bodas <amod.bodas@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9bad82b8ae0e96483507e09463d8520bcfa78cc3 15-Sep-2010 John W. Linville <linville@tuxdriver.com> ath9k: make ath_ant_div_conf_fast_divbias static

CHECK drivers/net/wireless/ath/ath9k/recv.c
drivers/net/wireless/ath/ath9k/recv.c:1341:6: warning: symbol 'ath_ant_div_conf_fast_divbias' was not declared. Should it be static?

Signed-off-by: John W. Linville <linville@tuxdriver.com>
cfda669519241fccd5aa66c5a12bdae3dd04d5cd 14-Sep-2010 Ben Greear <greearb@candelatech.com> ath9k: calcrxfilter should take multiple VIFs into account.

When there is more than one VIF, listen for all beacons
and ensure ATH9K_RX_FILTER_MCAST_BCAST_ALL is set.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
364734fafbba0c3133e482db78149b9a823ae7a5 14-Sep-2010 Felix Fietkau <nbd@openwrt.org> ath9k_hw: remove useless hw capability flags

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
102885a5d114abad8f9d4101f94ce5b28c232231 02-Sep-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Implement an algorithm for Antenna diversity and combining

This algorithm chooses the best main and alt lna out of
LNA1, LNA2, LNA1+LNA2 and LNA1-LNA2 to improve rx for single
chain chips(AR9285). This would greatly improve rx when there
is only one antenna is connected with AR9285.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
56363ddeeed3afc5277ca227209773bc1042cc7b 28-Aug-2010 Felix Fietkau <nbd@openwrt.org> ath9k: fix spurious MIC failure reports

According to the hardware documentation, the MIC failure bit is only
valid if the frame was decrypted using a valid TKIP key and is not a
fragment.
In some setups I've seen hardware-reported MIC failures on an AP that
was configured for CCMP only, so it's clear that additional checks are
necessary.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c8f3b7213342d905cbb75d6c8820d9141205f3a0 02-Aug-2010 Jan Friedrich <jft@dev2day.de> ath9k: fix erased ieee80211_rx_status.mactime

ath9k_rx_skb_preprocess nulls rxs and the mactime is never set again -
mactime is always 0. This causes problems in IBSS mode.

ieee80211_rx_bss_info uses mactime to decide if an IBSS merge is needed.
Without this patch the merge is triggered by each beacon received.

This can be recognized by the "beacon TSF higher than local TSF - IBSS
merge with BSSID" log message accompanying each beacon.

This problem was not completely fixed in commit
a6d2055b02dde1067075795274672720baadd3ca and is not a stable kernel fix.
It is solely intended for wireless-testing.

Signed-off-by: Jan Friedrich <jft@dev2day.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f792af250de54309e4bc9f238db3623ead0a4507 14-May-2010 Ming Lei <tom.leiming@gmail.com> ath9k: fix dma direction for map/unmap in ath_rx_tasklet

For edma, we should use DMA_BIDIRECTIONAL, or else use
DMA_FROM_DEVICE.

This is found to address "BUG at arch/x86/mm/physaddr.c:5"
as described here:

http://lkml.org/lkml/2010/7/14/21

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
96d159d03c5b849fa39dc7305e04ebf374085e4a 12-Jun-2010 Felix Fietkau <nbd@openwrt.org> ath9k_hw: remove a useless function for setting the mac address

ath9k_hw_setmac() only copies the mac address it is called with into
common->macaddr, yet in all call sites, the supplied mac address pointer
is already common->macaddr.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a6d2055b02dde1067075795274672720baadd3ca 12-Jun-2010 Felix Fietkau <nbd@openwrt.org> ath9k: fix extending the rx timestamp with the hardware TSF

AR5416 and all newer chipsets use a 32 bit rx timestamp, so there
is no need to keep the 15 bit timestamp extending logic around.

This patch removes ath9k_hw_extend_tsf (replaced by a call to
ath9k_hw_gettsf64), and reduces the frequency of TSF reads, which
can improve performance in some cases.

This change also has the side effect of making rx timestamps
more accurate.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
40346b66799b7d382e61bbb68a6b6bbdd20f320e 12-Jun-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k_hw: inform ANI calibration when scanning

The new ANI implementation will use this to skip ANI
calibration upon a scan. This cannot be ported to the
older ANI implementation unless default ANI values from
the ANI are also used upon a scan. This is essentially
what one of the things thenew ANI does.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ce9426d1908001fb2f7b0152fbe4184bbc0c7b68 15-May-2010 Ming Lei <tom.leiming@gmail.com> ath9k: fix dma sync in rx path

If buffer is to be accessed by cpu after dma is over, but
between dma mapping and dma unmapping, we should use
dma_sync_single_for_cpu to sync the buffer between cpu with
device. And dma_sync_single_for_device is used to let
device gain the buffer again.

v2: Felix pointed out dma_sync_single_for_device is needed to return
buffer to device if an unsuccessful status bit check is found.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b7b1b512287d6917d4976a4ee0e7d72c4edf52eb 20-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Fix bug in validating received data length for edma

The rx status length should also be taken into account while
validating the length of a received frame.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5c6dd921776946d12cbbae8ab92c5d6773b25810 20-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Fix bug in accessing skb->data of rx frame for edma

Skip the rx status portion in skb->data before accessing ieee80211
frame header.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9f167f6480c87e22ce1b934cc839d1786b373b70 20-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Clean up few function parameters in recv.c

ath9k_rx_skb_preprocess() needs only ieee80211 frame header,
pass only frame headers instead of skb to that function. Also
remove ineffective frame dump in ath9k_process_rate().

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d435700fcdf03646ff070b35ea19dd5501c4b946 20-May-2010 Sujith <Sujith.Manoharan@atheros.com> ath9k: Move ath9k specific RX code to driver

This patch relocates RX processing code from the
common module to ath9k. This reduces the size
of the common module which is also used by ath9k_htc.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
56824223ac97ca845652c59bed9ce139e100261b 14-May-2010 Ming Lei <tom.leiming@gmail.com> ath9k: fix dma direction for map/unmap in ath_rx_tasklet

For edma, we should use DMA_BIDIRECTIONAL, or else use
DMA_FROM_DEVICE.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ededf1f82ac8f06a0311097a68ccb582d32e70d5 23-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Fix rx of mcast/bcast frames in PS mode with auto sleep

The functionality to keep the device awake until it is done with
the rx of any mcast/bcast frames which are pending on AP should
also be added to the hardwares which support auto sleep feature.
This patch fixes frequent failures in ARP resolution when it is
initiated by the other end. Currently auto sleep is enabled only
for ar9003 in ath9k.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b29e7eb4b8b3e5f4ff8066af648e9fe2fc707b16 11-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Remove unused rx_edma in ath_rx_addbuffer_edma()

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
083e3e8d3dfeb191f349081c052ad3d20e8861f3 11-May-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Fix bug in handling rx frames with invalid descriptor content

Don't send them for further processing.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4adfcdedd4e0c05c1b659da5f2b8bc4e2d4a86df 15-Apr-2010 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Setup appropriate tx desc for regular dma and edma

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b622a720b45def8dce816244a83b82992da4fe20 15-Apr-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k_hw: move AR9002 mac ops to its own file

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b5c80475abaad015699384ca64ef8229fdd88758 15-Apr-2010 Felix Fietkau <nbd@openwrt.org> ath9k: Add Rx EDMA support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
29bffa96e9bef4fb84740a49e93d5bd6ca126bac 30-Mar-2010 Felix Fietkau <nbd@openwrt.org> ath9k: allocate tx and rx status information on stack

ath_tx_status and ath_rx_status data are only necessary for a short
time, until they have been processed and converted into mac80211 data
structures.
Because of that, it makes no sense to keep them tied to the DMA
descriptor, that only wastes precious memory.
This patch allocates the data on stack in the functions that call the
conversion functions from ath9k_hw.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8e6f5aa250d6013ec0d66f9f45f376678d3fc4ab 30-Mar-2010 Felix Fietkau <nbd@openwrt.org> ath9k: split out access to rx status information

This patch passes in a pointer to the ath_rx_status data structure for
functions that need it, instead of letting them grab it directly from
the ath_desc struct. This is useful for making it possible to allocate
the intermediate rx status data separately.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f643e51d717b52ac28830e8bb98559b006a73bf4 29-Jan-2010 Pavel Roskin <proski@gnu.org> ath: make gcc check format arguments of ath_print(), fix all misuses

Numeric channel is hard to get, so it won't be printed. Replace Mhz
with MHz on the affected lines and add commas as needed.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1395d3f00a4164caae168b041855d48e0fa9ea4c 08-Jan-2010 Sujith <Sujith.Manoharan@atheros.com> ath9k: Add debugfs file for RX errors

This file can be used to track frame reception errors.
PHY error counts are also added.

Location: ath9k/phy#/recv

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1b04b9308ebc7f6accb319cf51c9b8ec29f79707 08-Jan-2010 Sujith <Sujith.Manoharan@atheros.com> ath9k: Cleanup Powersave flags

sc_flags has slowly become a kitchen sink over time.
Move powersave related flags to a separate variable.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
db86f07ec6cdea9670a0928bd1289109d2a989dc 05-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k_common: add new module to share 802.11n driver helpers

ath9k and ath9k_htc share a lot of common hardware characteristics.
They only differ in that ath9k_htc works with a target CPU and ath9k
works directly with the hardware. ath9k_htc will do *some* things in
the firmware, but a lot of others on the host.

The common 802.11n hardware code is already shared through the ath9k_hw
module. Common helpers amongst all Atheros drivers can use the ath module,
this includes ath5k and ar9170 as users. But there is some common driver
specific helpers which are not exactly hardware code which ath9k and
ath9k_htc can share. We'll be using ath9k_common for this to avoid
bloating the ath module and the common 802.11n hardware module ath9k_hw.

We start by sharing skb pre and post processing in preparation for a hand
off to mac80211.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c9b1417055cd2518e8a3b4b27e1f8e4b72821dff 05-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move RX skb post processing to a helper

Use a helper for the RX skb post processing,
ath9k_rx_skb_postprocess().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7e86c1048a9f5f1e157daf28411f3526f0b9f7b6 05-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move driver keymap, keymax and splitmic to common

This will make sharing code easier between ath9k and ath9k_htc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1e875e9f16e3138d0e23cbf806a6d9520b622db2 05-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: rename ath_rx_prepare() to ath9k_rx_skb_preprocess()

And change the return value to something more obvious.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2c74aa4d73dbed2e879e7eb5ee9de95d40e5298d 05-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move the max rx buffer size check to ath9k_rx_accept()

While at it flip the order, seems easier to read and also
add some better description as to why we do this check.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cc861f7468724e66567baf087b4e413e91b18150 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath: move the rx bufsize to common to share with ath5k/ath9k

This will also be used by ath9k_htc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0a45da765e4bf5e8a7705266fa36e0f44787b0a1 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move the rx_stats->rs_datalen check to ath9k_rx_accept()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5ca42627f3ddc0e4fc3e62d879cc35ab5beaaa8b 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: avoid the copy skb->cb on every RX'd skb

The skb->cb (control buffer, 48 bytes) is available to the skb
upon skb allocation. You can fill it up imediately after skb
allocation. ath9k was copying onto the skb->cb the data from the
processed skb for mac80211 from a stack struct ieee80211_rx_status
structure. This is unnecessary, instead use the skb->cb for the
rx status immediately after the skb becomes available and DMA
synched.

Additionally, avoid the copy of the skb->cb also for virtual wiphys
as skb_copy() will copy over the skb->cb for us as well.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
dbfc22df1afbeb91d528e2f84d6603ac9ce98bc2 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move rssi processing into a helper

This moves all the RX processing of RSSI into a helper,
ath_rx_prepare(). ath_rx_prepare() should now be really
easy to read and follow.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
21b22738068366d7740b4b7cf55ce270f479543a 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move qual processing into a helper

This moves the qual computing into a small helper,
ath9k_compute_qual()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9878841e1360266fa4522fbdc2448fcdce95e0dd 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move rate descriptor reading into a helper

ath9k_process_rate() now does all the rx status processing to
read the rate the hardware passed and translate it to whatever
mac80211 wants.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14077f5b7a28bdcd166faed2c0b36fad9f3eadda 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: remove temp variable ratecode from ath_rx_prepare()

Its just a distraction when reading the code, instead use the
rx_stats->rs_rate directly.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
207e96854e39380fce8b589bbbdaf6e9a83b9151 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move RX check code into helper ath9k_rx_accept()

This does sanity checking on the skb and RX status descriptor
prior to processing.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
712c13a86affe69dd8462631808edd5825b5e1cb 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: use the ieee80211_hw to get to an sband on ath_rx_prepare()

No need to use the private driver structure to get to an sband.
This will make it easier to share this code with ath9k_htc.

With the sc gone we can now just pass the common structure to
ath_rx_prepare().

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3d536acf45ba65acb15fc65bf46f8d6c7ad6c463 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move struct ath_ani to common area

This can be shared between ath9k and ath9k_htc. It will also
help with sharing routine helpers on the RX path.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
30cbd42265546a3efa146d4eb3456165325c83a7 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k_hw: move ath_extend_tsf() to hw code to share as ath9k_hw_extend_tsf()

This will be shared between ath9k and ath9k_htc.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
26ab2645b478fd98aa1d10a07eb07f2235bc1f1c 03-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: do not pass the entire descriptor to ath_rx_prepare()

Its not needed, so just pass the hardware RX status.
We'll be simplfying ath_rx_prepare() with code we can share
between ath9k and ath9k_htc. This will help make that code
easier to read and manage.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cee71d6c1471953239ea4c13306888cf2b36426e 02-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: use the passed ieee80211_hw on ath_rx_prepare()

this now uses the proper hw which should mean finding the
right sta when using ath9k virtual wiphy stuff. Only
advantage I see here is getting the rssi properly updated
so the 'fix' itself isn't that great, but at least this
is correct.

Cc: Jouni.Malinen <Jouni.Malinen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b4afffc0cfa3f35ee011d5ed4153e49f5cc3bc96 02-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: simpify RX by calling ath_get_virt_hw() once

ath_get_virt_hw() is required on RX to determine for which virtual
wiphy an skb came in for. Instead of searching for the hw twice do
it only once.

Cc: Jouni.Malinen <Jouni.Malinen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5ed176e1c425f9bd1af161d66d348f6116a04fc6 04-Nov-2009 Johannes Berg <johannes@sipsolutions.net> mac80211: make ieee80211_find_sta per virtual interface

Since we have a TODO item to make all station
management dependent on virtual interfaces, I
figured I'd start with pushing such a change
to drivers before more drivers start using the
ieee80211_find_sta() API with a hw pointer and
cause us grief later on.

For now continue exporting the old API in form
of ieee80211_find_sta_by_hw(), but discourage
its use strongly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
66afad0156a0b673688f309147e57c3a85541329 18-Sep-2009 Senthil Balasubramanian <senthilkumar@atheros.com> ath9k: Allow PSPOLL only when the interface is configured in AP mode

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9680e8a391078a2bfa099b2c59542a6916a023ed 14-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: remove driver ASSERT, just use BUG_ON()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
c46917bb53a546f60c7d3103407fe953c418dd5b 13-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros: add common debug printing

ath9k uses this for now, ath9k_htc is expected to re-use this
as well. We lave ath5k as is, but it certainly can also be
converted later.

The ath9k module parameter and debugfs entry is kept.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13b81559200b8e54473e5b140323cbb5f2bb21c0 11-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros: define shared bssidmask setting

Also make ath5k and ath9k use it, and share register definitions.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
27c51f1a349f3e4eb9c1d6d3a548eafe1828cc7a 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: move ath_common to ath_hw

This ensures that we can access common on hw related code
independent of the driver core.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1510718d0fd6e20803aac95fe1d8a44846098a34 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros/ath9k: move macaddr, curaid, curbssid and bssidmask to common

These are common amongst ath9k and ath5k, so put them into the
common structure and make ath9k to use it. ar9170 can use macaddr,
and curbssid. We'll change ath5k and ar9170 separately.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f2b2143e60651228945f361c09de7ee752360cd1 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: make ath9k_hw_setbssidmask() and ath9k_hw_write_associd() use ath_hw

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4d6b228d84ba992ee13c90312c1ed539191c94b1 07-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: use ath_hw for DPRINTF() and debug init/exit

DPRINTF() is used in hw specific related code, as such
ensure we don't rely on the private driver core ath_softc
struct when calling it. Drivers can then implement their
own DPRINTF() as they see fit.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7ea310be65bfcbc6e2395844fd3498762dc2aea6 02-Sep-2009 Sujith <Sujith.Manoharan@atheros.com> ath9k: Fix RX Filter handling for BAR

BAR frames have to be sent to mac80211 only if the
current channel is HT. Also, move the macro to
enum ath9k_rx_filter.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5eb6ba83aa326e2f2cf9109d20df5d6a497b36bb 21-Aug-2009 Javier Cardona <javier@cozybit.com> ath9k: Add support FIF_OTHER_BSS filtering mode.

Support for FIF_OTHER_BSS was missing. This patch adds support for this
filtering mode which in turn resolves a problem where mesh interfaces would not
receive broadcast traffic.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
22e66a4c15b063aee5d03991c4b9629a3b0c4556 19-Aug-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Nuke struct ath9k_node_stats

Other than ns_avgbrssi (Average beacon rssi) no data of
ath9k_node_stats is being used anywhere. Nuke this structure
and move its only useful member to ar5416Anistate. Also cleanup
this redundant data in ath_softc.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d15dd3e5d74186a3b0a4db271b440bbdc0f6da36 12-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath: add common ath_rxbuf_alloc() and make ath9k use it

Turns out ath5k and ath9k can share the same helper to
allocates RX skbs. We allocate skbs aligned to the cache line
size. This requirement seems to have come from AR5210; when
this was not done it seems sometimes we'd get bogus data. I'm
also told it may have been a performance enhancement
consideration. In the end I can't be sure we can remove this
on new hardware so just keep this and start sharing it through
ath.ko.

Make ath9k start using this, ath5k is next.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5e32b1ed7e81558b09bf0a6bf9e73c34db3c337c 07-Aug-2009 Sujith <Sujith.Manoharan@atheros.com> ath9k: Update beacon RSSI

ANI uses the beacon RSSI for its operation.
Update this properly.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
87b5bee86d281383ac2e5cae20ec47afa8fa374a 07-Aug-2009 Sujith <Sujith.Manoharan@atheros.com> ath9k: Remove unneeded assignment of protocol field

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
63b08b8d97a2a5ff23436cd52e8cd70c1de0319c 04-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: use new FIF_PSPOLL configure filter

We used to set pspoll filter on ath9k on AP mode but
we no longer need this mode specific check as mac80211
now does the check for us and informs us when we should
enable pspoll through FIF_PSPOLL.

Cc: Igor Perminov <igor.perminov@inbox.ru>
Cc: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a59b5a5e684652eec035c869ab8911a1689c8f53 15-Jul-2009 Senthil Balasubramanian <senthilkumar@atheros.com> ath9k: Manipulate and report the correct RSSI

RSSI reported by the RX descriptor requires little manipulation.
Manipulate and report the correct RSSI to the stack. This will
fix the improper signal levels reported by iwconfig iw dev wlanX
station dump. Also the Link Quality reported seems to be varying
(falls to zero also sometimes) when iperf is run from STA to AP.

Also use the default noise floor for now as the one reported
during the caliberation seems to be wrong.

The Signal and Link Quality before this patch (taken while TX is
in progress from STA to AP)

09:59:13.285428037 Link Quality=29/70 Signal level=-81 dBm
09:59:13.410660084 Link Quality=20/70 Signal level=-90 dBm
09:59:13.586864392 Link Quality=21/70 Signal level=-89 dBm
09:59:13.710296281 Link Quality=21/70 Signal level=-89 dBm
09:59:13.821683064 Link Quality=25/70 Signal level=-85 dBm
09:59:13.933402989 Link Quality=24/70 Signal level=-86 dBm
09:59:14.045839276 Link Quality=26/70 Signal level=-84 dBm
09:59:14.193926673 Link Quality=23/70 Signal level=-87 dBm
09:59:14.306230262 Link Quality=31/70 Signal level=-79 dBm
09:59:14.419459667 Link Quality=26/70 Signal level=-84 dBm
09:59:14.530711167 Link Quality=37/70 Signal level=-73 dBm
09:59:14.642593962 Link Quality=29/70 Signal level=-81 dBm
09:59:14.754361169 Link Quality=21/70 Signal level=-89 dBm
09:59:14.866217355 Link Quality=21/70 Signal level=-89 dBm
09:59:14.976963623 Link Quality=28/70 Signal level=-82 dBm
09:59:15.089149809 Link Quality=26/70 Signal level=-84 dBm
09:59:15.205039887 Link Quality=27/70 Signal level=-83 dBm
09:59:15.316368003 Link Quality=23/70 Signal level=-87 dBm
09:59:15.427684036 Link Quality=36/70 Signal level=-74 dBm
09:59:15.539756380 Link Quality=21/70 Signal level=-89 dBm
09:59:15.650549093 Link Quality=22/70 Signal level=-88 dBm
09:59:15.761171672 Link Quality=32/70 Signal level=-78 dBm
09:59:15.872793750 Link Quality=23/70 Signal level=-87 dBm
09:59:15.984421694 Link Quality=22/70 Signal level=-88 dBm
09:59:16.097315093 Link Quality=21/70 Signal level=-89 dBm

The link quality and signal level after this patch (take while
TX is in progress from STA to AP)

17:21:25.627848091 Link Quality=65/70 Signal level=-45 dBm
17:21:25.762805607 Link Quality=65/70 Signal level=-45 dBm
17:21:25.875521888 Link Quality=66/70 Signal level=-44 dBm
17:21:25.987468448 Link Quality=66/70 Signal level=-44 dBm
17:21:26.100628151 Link Quality=66/70 Signal level=-44 dBm
17:21:26.213129671 Link Quality=66/70 Signal level=-44 dBm
17:21:26.324923070 Link Quality=65/70 Signal level=-45 dBm
17:21:26.436831357 Link Quality=65/70 Signal level=-45 dBm
17:21:26.610356973 Link Quality=65/70 Signal level=-45 dBm
17:21:26.723340047 Link Quality=65/70 Signal level=-45 dBm
17:21:26.835715293 Link Quality=64/70 Signal level=-46 dBm
17:21:26.949542748 Link Quality=64/70 Signal level=-46 dBm
17:21:27.062261613 Link Quality=65/70 Signal level=-45 dBm
17:21:27.174511563 Link Quality=64/70 Signal level=-46 dBm
17:21:27.287616232 Link Quality=64/70 Signal level=-46 dBm
17:21:27.400598119 Link Quality=64/70 Signal level=-46 dBm
17:21:27.511381404 Link Quality=64/70 Signal level=-46 dBm
17:21:27.624530421 Link Quality=65/70 Signal level=-45 dBm
17:21:27.737807109 Link Quality=64/70 Signal level=-46 dBm
17:21:27.850861352 Link Quality=65/70 Signal level=-45 dBm
17:21:27.963369436 Link Quality=64/70 Signal level=-46 dBm
17:21:28.076582289 Link Quality=64/70 Signal level=-46 dBm

Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
7d5ca3b8b2b38ab676d0adc268a3c6a82e7a7588 19-Jun-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath9k: differentiate quality reporting between legacy and HT configurations

We were not differentiating quality between legacy and HT
configurations. We change this to consider the differences.

New theory for reporting quality:

At a hardware RSSI of 45 you will be able to use MCS 7 reliably.
At a hardware RSSI of 45 you will be able to use MCS 15 reliably.
At a hardware RSSI of 35 you should be able use 54 Mbps reliably.

MCS 7 is the highets MCS index usable by a 1-stream device.
MCS 15 is the highest MCS index usable by a 2-stream device.

All ath9k devices are either 1-stream or 2-stream.

How many bars you see is derived from the qual reporting.

A more elaborate scheme can be used here but it requires tables
of SNR/throughput for each possible mode used. For the MCS table
you can refer to the wireless wiki:

http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n

This should fix this bug report:

http://bugzilla.kernel.org/show_bug.cgi?id=13537

Cc: Janath.Peiris@atheros.com
Cc: Matt.Smith@atheros.com
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
293dc5dfdbcc16cde06e40a688394cc8ab083e48 19-Jun-2009 Gabor Juhos <juhosg@openwrt.org> ath9k: remove ath_rx_ps_back_to_sleep helper

This helper only clears the SC_OP_WAIT_FOR_{BEACON,CAB} flags.
Remove it and clear these flags directly in the approptiate
places instead.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
b7351a003ca29ac4372393040ffb06dc04309e2e 19-Jun-2009 Gabor Juhos <juhosg@openwrt.org> ath9k: remove unnecessary clearing of SC_OP_WAIT_{BEACON,CAB} flags

All SC_OP_WAIT_* flags will be cleared in 'ath9k_conf' when PS mode
is disabled, so we don't have to clear it here.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f1d58c2521eb160178b2151d6326d8dc5d7c8560 17-Jun-2009 Johannes Berg <johannes@sipsolutions.net> mac80211: push rx status into skb->cb

Within mac80211, we often need to copy the rx status into
skb->cb. This is wasteful, as drivers could be building it
in there to start with. This patch changes the API so that
drivers are expected to pass the RX status in skb->cb, now
accessible as IEEE80211_SKB_RXCB(skb). It also updates all
drivers to pass the rx status in there, but only by making
them memcpy() it into place before the call to the receive
function (ieee80211_rx(_irqsafe)). Each driver can now be
optimised on its own schedule.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
58f5fffdc3b8567b3fa8ed77d75699db87e2d1d4 17-Jun-2009 Gabor Juhos <juhosg@openwrt.org> ath9k: wait for beacon frame along with CAB

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f0e9a8606ce60880249fd570fbebf4472c3d37c0 15-Jun-2009 Gabor Juhos <juhosg@openwrt.org> ath9k: process rx packet if we are waiting for CAB

If we are in PS mode, we have to process the received frame if
the SC_OP_WAIT_FOR_CAB bit is set.

Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ccdfeab6536ae55d43436ffaae949afde6e962ca 20-May-2009 Jouni Malinen <jouni.malinen@atheros.com> ath9k: Update Beacon timers based on timestamp from the AP

Some APs seem to drift away from the expected TBTT (timestamp %
beacon_int_in_usec differs quite a bit from zero) which can result in
us waking up way too early to receive a Beacon frame. In order to work
around this, re-configure the Beacon timers after having received a
Beacon frame from the AP (i.e., when we know the offset between the
expected TBTT and the actual time the AP is sending out the Beacon
frame).

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9a23f9ca50943c1b4535d22b3acda3c31b4ad072 19-May-2009 Jouni Malinen <jouni.malinen@atheros.com> ath9k: Wake up for TX in mac80211 timeout=0 sleep mode

When using timeout=0 (PS-Poll) with mac80211, the driver will need to
wake up for TX requests and remain awake until the TX has been
completed (ACK received or timeout) or until the buffer frame(s) have
been received (in case the TX is for a PS-Poll frame).

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
153e080da6a07ed888a0a59c45e28bc7351407ff 15-May-2009 Vasanthakumar Thiagarajan <vasanth@atheros.com> ath9k: Move PS wakeup/restore calls from isr to tasklet

We do not need to do this in ath_isr() and it looks like the modified
version ends up being more stable as far as being able receive beacon
frames is concerned. Furthermore, this reduces need to move between
AWAKE and NETWORK SLEEP states when processing some unrelated
interrupts.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
cc65965cbb24d2ca2bb70f26cac9d7243349e7e3 14-May-2009 Jouni Malinen <jouni.malinen@atheros.com> ath9k: Fix PS mode operation to receive buffered broadcast/multicast frames

The previous implementation was moving back to NETWORK SLEEP state
immediately after receiving a Beacon frame. This means that we are
unlikely to receive all the buffered broadcast/multicast frames that
would be sent after DTIM Beacon frames. Fix this by parsing the Beacon
frame and remaining awake, if needed, to receive the buffered
broadcast/multicast frames. The last buffered frame will trigger the
move back into NETWORK SLEEP state.

If the last broadcast/multicast frame is not received properly (or if
the AP fails to send it), the next Beacon frame will work as a backup
trigger for returning into NETWORK SLEEP.

A new debug type, PS (debug=0x800 module parameter), is added to make
it easier to debug potential power save issues in the
future. Currently, this is only used for the Beacon frame and buffered
broadcast/multicast receiving.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
9d64a3cfaf3edb548b68ef4eedbadbb875eaa10e 14-May-2009 Jouni Malinen <jouni.malinen@atheros.com> ath9k: Clean up RX processing a bit

This makes use of the local fc variable in bit more places and uses a
common helper macro. The part of RX process that delivers skb's to
mac80211 is moved to a separate function in preparation for future
changes that will need to do this from two places. The modifications
here should not result in any functional changes.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d8959fbfbad5f75c7df673aaf5112ba5e405ad34 14-May-2009 Jouni Malinen <jouni.malinen@atheros.com> ath9k: Fix a check for multicast address for virtual wiphy

The broadcast bit is in the first, not the last octet..

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
203c4805e91786f9a010bc7945a0fde70c9da28e 31-Mar-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros: put atheros wireless drivers into ath/

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>