History log of /linux-master/drivers/net/wireless/ath/ath5k/base.c
Revision Date Author Comments
# 2703bc85 12-Oct-2023 Kalle Valo <quic_kvalo@quicinc.com>

wifi: mac80211: rename ieee80211_tx_status() to ieee80211_tx_status_skb()

make htmldocs warns:

Documentation/driver-api/80211/mac80211:109: ./include/net/mac80211.h:5170: WARNING: Duplicate C declaration, also defined at mac80211:1117.
Declaration is '.. c:function:: void ieee80211_tx_status (struct ieee80211_hw *hw, struct sk_buff *skb)'.

This is because there's a function named ieee80211_tx_status() and a struct named
ieee80211_tx_status. This has been discussed previously but no solution found:

https://lore.kernel.org/all/20220521114629.6ee9fc06@coco.lan/

There's also a bug open for three years with no solution in sight:

https://github.com/sphinx-doc/sphinx/pull/8313

So I guess we have no other solution than to a workaround this in the code,
for example to rename the function to ieee80211_tx_status_skb() to avoid the
name conflict. I got the idea for the name from ieee80211_tx_status_noskb() in
which the skb is not provided as an argument, instead with
ieee80211_tx_status_skb() the skb is provided.

Compile tested only.

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20231012114229.2931808-2-kvalo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4bd0f7d0 18-Sep-2023 Wu Yunchuan <yunchuan@nfschina.com>

wifi: ath5k: remove unnecessary (void*) conversions

No need cast (void *) to (struct ath5k_hw *).

Signed-off-by: Wu Yunchuan <yunchuan@nfschina.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230919044959.523576-1-yunchuan@nfschina.com


# eaedf62f 15-Jul-2022 Jilin Yuan <yuanjilin@cdjrlc.com>

wifi: ath5k: fix repeated words in comments

Delete the redundant word 'don't' and 'but'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220708154929.19199-1-yuanjilin@cdjrlc.com


# 6e8912a5 06-Jun-2022 Shaul Triebitz <shaul.triebitz@intel.com>

wifi: mac80211: return a beacon for a specific link

Pass the link id through to the get_beacon and return
the beacon for a specific link id.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a5d862da 17-Dec-2021 Jonas Jelonek <jelonek.jonas@gmail.com>

ath5k: switch to rate table based lookup

Switching from legacy usage of ieee80211_get_tx_rates() lookup to direct
rate table lookup in struct ieee80211_sta->rates.

The current rate control API allows drivers to directly get rates from
ieee80211_sta->rates. ath5k is currently one of the legacy drivers that
perform translation/merge with the internal rate table via
ieee80211_get_tx_rates provided by rate control API.
For our upcoming changes to rate control API and the implementation of
transmit power control, this patch changes the behaviour. The call to
ieee80211_get_tx_rates and subsequent calls are also avoided. ath5k now
directly reads rates from sta->rates into its internal rate table. Cause
ath5k does not rely on the rate array in SKB->CB, this is not considered
anymore except for the first entry (used for probing).

Tested this on a PCEngines ALIX with CMP9-GP miniPCI wifi card (Atheros
AR5213A). Generated traffic between AP and multiple STAs before and
after applying the patch and simultaneously measured throughput and
captured rc_stats. Comparison resulted in same rate selection and no
performance loss between both runs.

Co-developed-by: Thomas Huehn <thomas.huehn@hs-nordhausen.de>
Signed-off-by: Thomas Huehn <thomas.huehn@hs-nordhausen.de>
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20211215215042.637-1-jelonek.jonas@gmail.com


# 6417f031 16-Mar-2021 Leon Romanovsky <leon@kernel.org>

module: remove never implemented MODULE_SUPPORTED_DEVICE

MODULE_SUPPORTED_DEVICE was added in pre-git era and never was
implemented. We can safely remove it, because the kernel has grown
to have many more reliable mechanisms to determine if device is
supported or not.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# c068a9ec 17-Aug-2020 Allen Pais <allen.lkml@gmail.com>

ath5k: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200817090637.26887-2-allen.cryptic@gmail.com


# 1d4f5c15 13-Aug-2020 Lee Jones <lee.jones@linaro.org>

ath5k: Fix kerneldoc formatting issue

Kerneldoc expects attributes/parameters to be in '@*.: ' format and
gets confused if the variable does not follow the type/attribute
definitions.

Fixes the following W=1 kernel build warning(s):

drivers/net/wireless/ath/ath5k/base.c:1111: warning: Function parameter or member 'ah' not described in 'ath5k_drain_tx_buffs'

Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@winlab.rutgers.edu>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200814113933.1903438-21-lee.jones@linaro.org


# fb24ea52 22-Feb-2019 Will Deacon <will@kernel.org>

drivers: Remove explicit invocations of mmiowb()

mmiowb() is now implied by spin_unlock() on architectures that require
it, so there is no reason to call it from driver code. This patch was
generated using coccinelle:

@mmiowb@
@@
- mmiowb();

and invoked as:

$ for d in drivers include/linux/qed sound; do \
spatch --include-headers --sp-file mmiowb.cocci --dir $d --in-place; done

NOTE: mmiowb() has only ever guaranteed ordering in conjunction with
spin_unlock(). However, pairing each mmiowb() removal in this patch with
the corresponding call to spin_unlock() is not at all trivial, so there
is a small chance that this change may regress any drivers incorrectly
relying on mmiowb() to order MMIO writes between CPUs using lock-free
synchronisation. If you've ended up bisecting to this commit, you can
reintroduce the mmiowb() calls using wmb() instead, which should restore
the old behaviour on all architectures other than some esoteric ia64
systems.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>


# 2ef00c53 23-Mar-2018 Joe Perches <joe@perches.com>

wireless: Use octal not symbolic permissions

Prefer the direct use of octal for permissions.

Done with checkpatch -f --types=SYMBOLIC_PERMS --fix-inplace
and some typing.

Miscellanea:

o Whitespace neatening around these conversions.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# da6a4352 25-Apr-2017 Johannes Berg <johannes.berg@intel.com>

mac80211: separate encoding/bandwidth from flags

We currently use a lot of flags that are mutually incompatible,
separate this out into actual encoding and bandwidth enum values.

Much of this again done with spatch, with manual post-editing,
mostly to add the switch statements and get rid of the conversions.

@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_80MHZ
+status->bw = RATE_INFO_BW_80
@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_40MHZ
+status->bw = RATE_INFO_BW_40
@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_20MHZ
+status->bw = RATE_INFO_BW_20
@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_160MHZ
+status->bw = RATE_INFO_BW_160
@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_5MHZ
+status->bw = RATE_INFO_BW_5
@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_10MHZ
+status->bw = RATE_INFO_BW_10

@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_VHT
+status->encoding = RX_ENC_VHT
@@
expression status;
@@
-status->enc_flags |= RX_ENC_FLAG_HT
+status->encoding = RX_ENC_HT
@@
expression status;
@@
-status.enc_flags |= RX_ENC_FLAG_VHT
+status.encoding = RX_ENC_VHT
@@
expression status;
@@
-status.enc_flags |= RX_ENC_FLAG_HT
+status.encoding = RX_ENC_HT

@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_HT)
+(status->encoding == RX_ENC_HT)
@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_VHT)
+(status->encoding == RX_ENC_VHT)

@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_5MHZ)
+(status->bw == RATE_INFO_BW_5)
@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_10MHZ)
+(status->bw == RATE_INFO_BW_10)
@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_40MHZ)
+(status->bw == RATE_INFO_BW_40)
@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_80MHZ)
+(status->bw == RATE_INFO_BW_80)
@@
expression status;
@@
-(status->enc_flags & RX_ENC_FLAG_160MHZ)
+(status->bw == RATE_INFO_BW_160)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7fdd69c5 26-Apr-2017 Johannes Berg <johannes.berg@intel.com>

mac80211: clean up rate encoding bits in RX status

In preparation for adding support for HE rates, clean up
the driver report encoding for rate/bandwidth reporting
on RX frames.

Much of this patch was done with the following spatch:

@@
expression status;
@@
-status->flag & (RX_FLAG_HT | RX_FLAG_VHT)
+status->enc_flags & (RX_ENC_FLAG_HT | RX_ENC_FLAG_VHT)

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_SHORTPRE
+status->enc_flags op RX_ENC_FLAG_SHORTPRE
@@
expression status;
@@
-status->flag & RX_FLAG_SHORTPRE
+status->enc_flags & RX_ENC_FLAG_SHORTPRE

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_HT
+status->enc_flags op RX_ENC_FLAG_HT
@@
expression status;
@@
-status->flag & RX_FLAG_HT
+status->enc_flags & RX_ENC_FLAG_HT

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_40MHZ
+status->enc_flags op RX_ENC_FLAG_40MHZ
@@
expression status;
@@
-status->flag & RX_FLAG_40MHZ
+status->enc_flags & RX_ENC_FLAG_40MHZ

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_SHORT_GI
+status->enc_flags op RX_ENC_FLAG_SHORT_GI
@@
expression status;
@@
-status->flag & RX_FLAG_SHORT_GI
+status->enc_flags & RX_ENC_FLAG_SHORT_GI

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_HT_GF
+status->enc_flags op RX_ENC_FLAG_HT_GF
@@
expression status;
@@
-status->flag & RX_FLAG_HT_GF
+status->enc_flags & RX_ENC_FLAG_HT_GF

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_VHT
+status->enc_flags op RX_ENC_FLAG_VHT
@@
expression status;
@@
-status->flag & RX_FLAG_VHT
+status->enc_flags & RX_ENC_FLAG_VHT

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_STBC_MASK
+status->enc_flags op RX_ENC_FLAG_STBC_MASK
@@
expression status;
@@
-status->flag & RX_FLAG_STBC_MASK
+status->enc_flags & RX_ENC_FLAG_STBC_MASK

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_LDPC
+status->enc_flags op RX_ENC_FLAG_LDPC
@@
expression status;
@@
-status->flag & RX_FLAG_LDPC
+status->enc_flags & RX_ENC_FLAG_LDPC

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_10MHZ
+status->enc_flags op RX_ENC_FLAG_10MHZ
@@
expression status;
@@
-status->flag & RX_FLAG_10MHZ
+status->enc_flags & RX_ENC_FLAG_10MHZ

@@
assignment operator op;
expression status;
@@
-status->flag op RX_FLAG_5MHZ
+status->enc_flags op RX_ENC_FLAG_5MHZ
@@
expression status;
@@
-status->flag & RX_FLAG_5MHZ
+status->enc_flags & RX_ENC_FLAG_5MHZ

@@
assignment operator op;
expression status;
@@
-status->vht_flag op RX_VHT_FLAG_80MHZ
+status->enc_flags op RX_ENC_FLAG_80MHZ
@@
expression status;
@@
-status->vht_flag & RX_VHT_FLAG_80MHZ
+status->enc_flags & RX_ENC_FLAG_80MHZ

@@
assignment operator op;
expression status;
@@
-status->vht_flag op RX_VHT_FLAG_160MHZ
+status->enc_flags op RX_ENC_FLAG_160MHZ
@@
expression status;
@@
-status->vht_flag & RX_VHT_FLAG_160MHZ
+status->enc_flags & RX_ENC_FLAG_160MHZ

@@
assignment operator op;
expression status;
@@
-status->vht_flag op RX_VHT_FLAG_BF
+status->enc_flags op RX_ENC_FLAG_BF
@@
expression status;
@@
-status->vht_flag & RX_VHT_FLAG_BF
+status->enc_flags & RX_ENC_FLAG_BF

@@
assignment operator op;
expression status, STBC;
@@
-status->flag op STBC << RX_FLAG_STBC_SHIFT
+status->enc_flags op STBC << RX_ENC_FLAG_STBC_SHIFT

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_SHORTPRE
+status.enc_flags op RX_ENC_FLAG_SHORTPRE
@@
expression status;
@@
-status.flag & RX_FLAG_SHORTPRE
+status.enc_flags & RX_ENC_FLAG_SHORTPRE

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_HT
+status.enc_flags op RX_ENC_FLAG_HT
@@
expression status;
@@
-status.flag & RX_FLAG_HT
+status.enc_flags & RX_ENC_FLAG_HT

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_40MHZ
+status.enc_flags op RX_ENC_FLAG_40MHZ
@@
expression status;
@@
-status.flag & RX_FLAG_40MHZ
+status.enc_flags & RX_ENC_FLAG_40MHZ

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_SHORT_GI
+status.enc_flags op RX_ENC_FLAG_SHORT_GI
@@
expression status;
@@
-status.flag & RX_FLAG_SHORT_GI
+status.enc_flags & RX_ENC_FLAG_SHORT_GI

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_HT_GF
+status.enc_flags op RX_ENC_FLAG_HT_GF
@@
expression status;
@@
-status.flag & RX_FLAG_HT_GF
+status.enc_flags & RX_ENC_FLAG_HT_GF

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_VHT
+status.enc_flags op RX_ENC_FLAG_VHT
@@
expression status;
@@
-status.flag & RX_FLAG_VHT
+status.enc_flags & RX_ENC_FLAG_VHT

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_STBC_MASK
+status.enc_flags op RX_ENC_FLAG_STBC_MASK
@@
expression status;
@@
-status.flag & RX_FLAG_STBC_MASK
+status.enc_flags & RX_ENC_FLAG_STBC_MASK

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_LDPC
+status.enc_flags op RX_ENC_FLAG_LDPC
@@
expression status;
@@
-status.flag & RX_FLAG_LDPC
+status.enc_flags & RX_ENC_FLAG_LDPC

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_10MHZ
+status.enc_flags op RX_ENC_FLAG_10MHZ
@@
expression status;
@@
-status.flag & RX_FLAG_10MHZ
+status.enc_flags & RX_ENC_FLAG_10MHZ

@@
assignment operator op;
expression status;
@@
-status.flag op RX_FLAG_5MHZ
+status.enc_flags op RX_ENC_FLAG_5MHZ
@@
expression status;
@@
-status.flag & RX_FLAG_5MHZ
+status.enc_flags & RX_ENC_FLAG_5MHZ

@@
assignment operator op;
expression status;
@@
-status.vht_flag op RX_VHT_FLAG_80MHZ
+status.enc_flags op RX_ENC_FLAG_80MHZ
@@
expression status;
@@
-status.vht_flag & RX_VHT_FLAG_80MHZ
+status.enc_flags & RX_ENC_FLAG_80MHZ

@@
assignment operator op;
expression status;
@@
-status.vht_flag op RX_VHT_FLAG_160MHZ
+status.enc_flags op RX_ENC_FLAG_160MHZ
@@
expression status;
@@
-status.vht_flag & RX_VHT_FLAG_160MHZ
+status.enc_flags & RX_ENC_FLAG_160MHZ

@@
assignment operator op;
expression status;
@@
-status.vht_flag op RX_VHT_FLAG_BF
+status.enc_flags op RX_ENC_FLAG_BF
@@
expression status;
@@
-status.vht_flag & RX_VHT_FLAG_BF
+status.enc_flags & RX_ENC_FLAG_BF

@@
assignment operator op;
expression status, STBC;
@@
-status.flag op STBC << RX_FLAG_STBC_SHIFT
+status.enc_flags op STBC << RX_ENC_FLAG_STBC_SHIFT

@@
@@
-RX_FLAG_STBC_SHIFT
+RX_ENC_FLAG_STBC_SHIFT

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ae44b502 09-Feb-2017 Andrew Zaborowski <andrew.zaborowski@intel.com>

wireless: Set NL80211_EXT_FEATURE_CQM_RSSI_LIST in multiple drivers

Set the NL80211_EXT_FEATURE_CQM_RSSI_LIST wiphy extended feature
wholesale in all mac80211-based drivers that do not set the
IEEE80211_VIF_BEACON_FILTER flags on their interfaces. mac80211 will
be processing supplied RSSI values in ieee80211_rx_mgmt_beacon and
will detect when the thresholds set by
ieee80211_set_cqm_rssi_range_config are crossed. Remaining (few)
drivers need code to enable the firmware to monitor the thresholds.
This is mostly only compile-tested.

Signed-off-by: Andrew Zaborowski <andrew.zaborowski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 57fbcce3 12-Apr-2016 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove enum ieee80211_band

This enum is already perfectly aliased to enum nl80211_band, and
the only reason for it is that we get IEEE80211_NUM_BANDS out of
it. There's no really good reason to not declare the number of
bands in nl80211 though, so do that and remove the cfg80211 one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 410d13a6 19-Nov-2015 Bob Copeland <me@bobcopeland.com>

ath5k: fix RTS/CTS by using proper rate flags

The rates in the tx control rateset do not have the protection
flags applied, so RTS/CTS would never get enabled if requested.

Fix by using the rate flags in the rates returned by
ieee80211_get_tx_rates().

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 46f26ddf 19-Aug-2015 Johannes Berg <johannes.berg@intel.com>

ath5k: use DECLARE_EWMA

This reduces code size slightly (at least on x86/64) while also
removing memory consumption by two unsigned long values for each
ath5k device.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 30686bf7 02-Jun-2015 Johannes Berg <johannes.berg@intel.com>

mac80211: convert HW flags to unsigned long bitmap

As we're running out of hardware capability flags pretty quickly,
convert them to use the regular test_bit() style unsigned long
bitmaps.

This introduces a number of helper functions/macros to set and to
test the bits, along with new debugfs code.

The occurrences of an explicit __clear_bit() are intentional, the
drivers were never supposed to change their supported bits on the
fly. We should investigate changing this to be a per-frame flag.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ab5e290a 03-Mar-2015 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath5k: fix reset race

To prepare for reset ath5k should finish all asynchronous tasks. At
first, it disables the interrupt generation, then it waits for the
interrupt handler and tasklets completion, and then proceeds to the HW
configuration update. But it does not consider that the interrupt
handler or tasklet re-enables the interrupt generation. And we fall in a
situation when ath5k assumes that interrupts are disabled, but it is
not.

This can lead to different consequences, such as reception of the frame,
when we do not expect it. Under certain circumstances, this can lead to
the following warning:

WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
invalid hw_rix: 1a
[..]
Call Trace:
[<802656a8>] show_stack+0x48/0x70
[<802dd92c>] warn_slowpath_common+0x88/0xbc
[<802dd98c>] warn_slowpath_fmt+0x2c/0x38
[<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
[<8028ac64>] tasklet_action+0x8c/0xf0
[<80075804>] __do_softirq+0x180/0x32c
[<80196ce8>] irq_exit+0x54/0x70
[<80041848>] ret_from_irq+0x0/0x4
[<80182fdc>] ioread32+0x4/0xc
[<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
[<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
[<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
[<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
[<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
[<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
[<8022c3f4>] process_one_work+0x28c/0x400
[<802df8f8>] worker_thread+0x258/0x3c0
[<801b5710>] kthread+0xe0/0xec
[<800418a8>] ret_from_kernel_thread+0x14/0x1c

Fix this issue by adding a new status flag, which forbids to re-enable
the interrupt generation until the HW configuration is completed.

Note: previous patch, which reorders the Rx disable code helps to avoid
the above warning, but not fixes the root cause of unexpected frame
receiving.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 4a2f248f 03-Mar-2015 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath5k: channel change fix

ath5k updates the channel pointer and after that it stops the Rx logic
and apply channel to HW. In case of channel switch, such sequence
creates a small window when a frame, which is received on the old
channel is considered as a frame received on the new one.

The most notable consequence of this situation occurs during the switch
from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
with CCK rate, e.g. beacon received at the 1mbps, causes the following
warning:

WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
invalid hw_rix: 1a
[..]
Call Trace:
[<802656a8>] show_stack+0x48/0x70
[<802dd92c>] warn_slowpath_common+0x88/0xbc
[<802dd98c>] warn_slowpath_fmt+0x2c/0x38
[<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
[<8028ac64>] tasklet_action+0x8c/0xf0
[<80075804>] __do_softirq+0x180/0x32c
[<80196ce8>] irq_exit+0x54/0x70
[<80041848>] ret_from_irq+0x0/0x4
[<80182fdc>] ioread32+0x4/0xc
[<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
[<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
[<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
[<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
[<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
[<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
[<8022c3f4>] process_one_work+0x28c/0x400
[<802df8f8>] worker_thread+0x258/0x3c0
[<801b5710>] kthread+0xe0/0xec
[<800418a8>] ret_from_kernel_thread+0x14/0x1c

The easiest way to reproduce this warning is to run scan with dualband
NIC in noisy environments, when the channel 11 runs multiple APs. In my
tests if the APs num >= 12, the warning appears in the first few
seconds of scanning.

In order to fix this, the Rx disable code moved to a higher level and
placed before the channel pointer update. This is also makes the code a
bit more symmetrical, since we disable and enable the Rx in the same
function.

In fact, at the pointer update time new frames should not appear,
because interrupt generation at this point should already be disabled.
The next patch should address this issue.

CC: Jiri Slaby <jirislaby@gmail.com>
CC: Nick Kossifidis <mickflemm@gmail.com>
CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
Tested-by: Eric Bree <ebree@nltinc.com>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 93803b33 02-Mar-2015 Joe Perches <joe@perches.com>

wireless: Use eth_<foo>_addr instead of memset

Use the built-in function instead of memset.

Miscellanea:

Add #include <linux/etherdevice.h> where appropriate
Use ETH_ALEN instead of 6

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 164a9748 28-Oct-2014 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath5k: update dependencies

- Use config symbol defined in the driver instead of arch specific one for
conditional compilation.
- Rename the ATHEROS_AR231X config symbol to ATH25.
- Fix include (ar231x_platform.h -> ath25_platform.h).
- Some of AR231x SoCs (e.g. AR2315) have PCI bus support, so remove !PCI
dependency, which block AHB support build.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Acked-by: John W. Linville <linville@tuxdriver.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: linux-wireless@vger.kernel.org
Cc: ath5k-devel@lists.ath5k.org
Cc: Linux MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/8248/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 0e5d3ab5 28-Oct-2014 Sergey Ryazanov <ryazanov.s.a@gmail.com>

ath5k: revert AHB bus support removing

This reverts commit 093ec3c5337434f40d77c1af06c139da3e5ba6dc.

AHB bus code has been removed, since we did not have support Atheros
AR231x SoC, required for building the AHB version of ath5k. Now that
support WiSoC chips added we can restore functionality back.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Acked-by: John W. Linville <linville@tuxdriver.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: linux-wireless@vger.kernel.org
Cc: ath5k-devel@lists.ath5k.org
Cc: Linux MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/8247/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 093ec3c5 10-Sep-2014 Paul Bolle <pebolle@tiscali.nl>

ath5k: Remove AHB bus support

AHB bus support was added in v2.6.38, through commit a0b907ee2a71
("ath5k: Add AHB bus support."). That code can only be build if the
Kconfig symbol ATHEROS_AR231X is set. But that symbol has never been
added to the tree. So AHB bus support has always been dead code.

Let's remove all code that depends on ATHEROS_AR231X. If that symbol
ever gets added to the tree the AHB bus support can be re-added too.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e6938ea4 22-Aug-2014 Bob Copeland <me@bobcopeland.com>

ath5k: drop useless comparison

rxs->rate_idx is unsigned, so it will always be >= 0.
Found by Coverity.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b76ff0d2 13-Jun-2014 Mathy Vanhoef <vanhoefm@gmail.com>

ath5k: capture CCK and OFDM restarts

Treat frames that underwent a CCK or OFDM restart as frames with an invalid CRC.

Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 41881354 13-Jun-2014 Mathy Vanhoef <vanhoefm@gmail.com>

ath5k: support for FIF_FCSFAIL filter

When the FIF_FCSFAIL filter flag is set, pass frames with CRC errors.

Signed-off-by: Mathy Vanhoef <vanhoefm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b499abdc 11-Mar-2014 John Greene <jogreene@redhat.com>

ath5k: add missing dma_map_error call

Trivial patch to address this trace. Now calls dma_mapping_error and
return -ENOSPC if a problem found.

WARNING: at lib/dma-debug.c:933 check_unmap+0x47b/0x960()
Hardware name: Aspire 5515
ath5k 0000:02:00.0: DMA-API: device driver failed to check map
error[device address=0x00000000874fcd42] [size=45 bytes] [mapped as
single]
Modules linked in: bnep bluetooth ebtable_filter ebtables
ip6table_filter ip6_tables be2iscsi iscsi_boot_sysfs bnx2i cnic uio
cxgb4i cxgb4 cxgb3i cxgb3 mdio libcxgbi ib_iser rdma_cm ib_addr iw_cm
ib_cm ib_sa ib_mad ib_core iscsi_tcp libiscsi_tcp libiscsi
scsi_transport_iscsi arc4 snd_hda_codec_realtek snd_hda_intel
snd_hda_codec snd_hwdep snd_seq snd_seq_device ath5k ath snd_pcm
sparse_keymap snd_page_alloc mac80211 snd_timer sp5100_tco snd edac_core
k8temp soundcore edac_mce_amd i2c_piix4 cfg80211 rfkill shpchp vhost_net
tun macvtap macvlan kvm_amd kvm uinput dm_crypt ata_generic pata_acpi
radeon i2c_algo_bit pata_atiixp drm_kms_helper ttm drm r8169 mii
i2c_core wmi video sunrpc
Pid: 820, comm: firewalld Not tainted 3.9.0-0.rc3.git1.4.fc19.x86_64 #1
Call Trace:
<IRQ> [<ffffffff81068df0>] warn_slowpath_common+0x70/0xa0
[<ffffffff81068e6c>] warn_slowpath_fmt+0x4c/0x50
[<ffffffff8137ebeb>] check_unmap+0x47b/0x960
[<ffffffff81021cf5>] ? native_sched_clock+0x15/0x80
[<ffffffff81021d69>] ? sched_clock+0x9/0x10
[<ffffffff8137f12f>] debug_dma_unmap_page+0x5f/0x70
[<ffffffffa048fa07>] ath5k_tasklet_tx+0x157/0x3f0 [ath5k]
[<ffffffff810acc0d>] ? sched_clock_local+0x1d/0x80
[<ffffffff81072aa6>] ? tasklet_action+0x56/0x210
[<ffffffff81072ae7>] tasklet_action+0x97/0x210
[<ffffffff8107343f>] __do_softirq+0xff/0x400
[<ffffffff81073905>] irq_exit+0xb5/0xc0
[<ffffffff81728916>] do_IRQ+0x56/0xc0
[<ffffffff8171dc32>] common_interrupt+0x72/0x72
<EOI> [<ffffffff811f1f81>] ? dput+0x111/0x310
[<ffffffff811f1ea7>] ? dput+0x37/0x310
[<ffffffff811e75e8>] link_path_walk+0x528/0x910
[<ffffffff811ea624>] path_openat+0x94/0x530
[<ffffffff811eb148>] do_filp_open+0x38/0x80
[<ffffffff811e1dda>] open_exec+0x4a/0x130
[<ffffffff81238be3>] load_elf_binary+0x7f3/0x18e0
[<ffffffff81021d69>] ? sched_clock+0x9/0x10
[<ffffffff810acc0d>] ? sched_clock_local+0x1d/0x80
[<ffffffff810acd98>] ? sched_clock_cpu+0xa8/0x100
[<ffffffff810d515d>] ? trace_hardirqs_off+0xd/0x10
[<ffffffff810acedf>] ? local_clock+0x5f/0x70
[<ffffffff810d5dbf>] ? lock_release_holdtime.part.28+0xf/0x190
[<ffffffff812383f0>] ? elf_core_dump+0x1980/0x1980
[<ffffffff811e1151>] search_binary_handler+0x1a1/0x4f0
[<ffffffff811e1017>] ? search_binary_handler+0x67/0x4f0
[<ffffffff811e28fc>] do_execve_common.isra.26+0x64c/0x710
[<ffffffff811e23c2>] ? do_execve_common.isra.26+0x112/0x710
[<ffffffff811e2cc6>] sys_execve+0x36/0x50
[<ffffffff81727249>] stub_execve+0x69/0xa0

Signed-off-by: John Greene <jogreene@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d44efe21 15-Jan-2014 Oleksij Rempel <linux@rempel-privat.de>

ath5k: use ath_is_mybeacon

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 685328b2 06-Jan-2014 Johannes Berg <johannes.berg@intel.com>

mac80211: remove channel_change_time

This value is no longer used by mac80211, and practically no
driver ever set it to a correct value anyway, so remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f90e29f3 30-Dec-2013 Julia Lawall <Julia.Lawall@lip6.fr>

ath5k: use ether_addr_equal_64bits

Ether_addr_equal_64bits is more efficient than ether_addr_equal, and can be
used when each argument is an array within a structure that contains at
least two bytes of data beyond the array.

The structures involved are:
ieee80211_mgmt defined in include/linux/ieee80211.h and
ath_common defined in drivers/net/wireless/ath/ath.h

This was done using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7ede612f 14-Oct-2013 Felix Fietkau <nbd@openwrt.org>

ath5k: fix regression in tx status processing

The regression was introduced in the following commit:

0967e01e8e713ed2982fb4eba8ba13794e9a6e89
"ath5k: make use of the new rate control API"

ath5k_tx_frame_completed saves the intended per-rate retry counts before
they are cleared by ieee80211_tx_info_clear_status, however at this
point the information in info->status.rates is incomplete.

This causes significant throughput degradation and excessive packet loss
on links where high bit rates don't work properly.

Move the copy from bf->rates a few lines up to ensure that the saved
retry counts are updated, and that they are really cleared in
info->status.rates after the call to ieee80211_tx_info_clear_status.

Cc: stable@vger.kernel.org # 3.10+
Cc: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Cc: Benjamin Vahl <bvahl@net.t-labs.tu-berlin.de>
Reported-by: Ben West <ben@gowasabi.net>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4d70f2fb 14-Aug-2013 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

ath5k: enable support for 5 MHz and 10 MHz channels

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6a09ae95 14-Aug-2013 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

ath5k: set 5/10 MHz supported channels and fix duration

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 312a6443 14-Aug-2013 Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>

ath5k: report 5/10 MHz channels

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0967e01e 11-Jun-2013 Thomas Huehn <thomas@net.t-labs.tu-berlin.de>

ath5k: make use of the new rate control API

This patch enabels ath5k to use the new rate table to lookup each
mrr rate and retry information per packet.

Signed-off-by: Benjamin Vahl <bvahl@net.t-labs.tu-berlin.de>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# db178340 02-May-2013 Stanislaw Gruszka <sgruszka@redhat.com>

ath5k: do not reschedule tx_complete_work on stop

This patch claim to fix "WARNING: at net/mac80211/util.c:599
ieee80211_can_queue_work.isra.7+0x30/0x40", which was reported at:

https://bugzilla.redhat.com/show_bug.cgi?id=922295

We use ATH_STAT_STARTED flag to disallow to perform
ath5k_tx_complete_poll_work() code, hence reschedule
ah->tx_complete_work, when we stop device. This flag was defined in
ath5k code, but it was not used.

I didn't get feedback if the fix works, so patch is compile only tested.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 675a0b04 25-Mar-2013 Karl Beldan <karl.beldan@rivierawaves.com>

mac80211: Use a cfg80211_chan_def in ieee80211_hw_conf_chan

Drivers that don't use chanctxes cannot perform VHT association because
they still use a "backward compatibility" pair of {ieee80211_channel,
nl80211_channel_type} in ieee80211_conf and ieee80211_local.

Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com>
[fix kernel-doc]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 0c0280bd 11-Jan-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com>

wireless: make the reg_notifier() void

The reg_notifier()'s return value need not be checked
as it is only supposed to do post regulatory work and
that should never fail. Any behaviour to regulatory
that needs to be considered before cfg80211 does work
to a driver should be specified by using the already
existing flags, the reg_notifier() just does post
processing should it find it needs to.

Also make lbs_reg_notifier static.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[move lbs_reg_notifier to not break compile]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e576defd 10-Dec-2012 Thomas Pedersen <thomas@cozybit.com>

ath5k: RX timestamp is reported at end of frame

This is true for at least AR5213, and shouldn't be different for other
ath5k PHYs. Tested on AR2413 and AR5414.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Tested-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 596ab5ec 10-Dec-2012 Felix Fietkau <nbd@openwrt.org>

ath5k: fix tx path skb leaks

ieee80211_free_txskb() needs to be used instead of dev_kfree_skb_any for
tx packets passed to the driver from mac80211

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e829cf96 03-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

ath5k: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Cc: linux-wireless@vger.kernel.org
Cc: ath5k-devel@lists.ath5k.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f4bda337 13-Nov-2012 Thomas Pedersen <thomas@cozybit.com>

mac80211: support RX_FLAG_MACTIME_END

Allow drivers to indicate their mactime is at RX completion and adjust
for this in mac80211. Also rename the existing RX_FLAG_MACTIME_MPDU to
RX_FLAG_MACTIME_START to clarify its intent. Based on similar code by
Johannes Berg.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
[fix docs, atheros drivers]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8b2c9824 06-Nov-2012 Johannes Berg <johannes.berg@intel.com>

mac80211: clarify interface iteration and make it configurable

During hardware restart, all interfaces are iterated even
though they haven't been re-added to the driver, document
this behaviour. The same also happens during resume, which
is even more confusing since all of the interfaces were
previously removed from the driver. Make this optional so
drivers relying on the current behaviour can still use it,
but to let drivers that don't want this behaviour disable
it.

Also convert all API users, keeping the old semantics
except in hwsim, where the new normal ones are desired.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9c371f99 07-Oct-2012 Wei Yongjun <yongjun_wei@trendmicro.com.cn>

ath5k: fix potential NULL pointer dereference in ath5k_beacon_update()

The dereference should be moved below the NULL test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 90e6274d 14-Sep-2012 Chun-Yeow Yeoh <yeohchunyeow@gmail.com>

ath5k: disable HW crypto in management frame

Hardware support for MFP is not available in ath5k. Thus,
this implementation allows the mac80211 stack to do the
actuall crypto operation.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7dd6753f 12-Aug-2012 Bob Copeland <me@bobcopeland.com>

ath5k: fix spin_lock_irqsave/spin_lock_bh nesting in mesh

Lockdep found an inconsistent lock state when joining a mesh with
ath5k. The problem is that ath5k takes the lock for its beacon state,
ah->block, with spin_lock_irqsave(), while mesh internally takes the
sync_offset_lock with spin_lock_bh() in mesh_sync_offset_adjust_tbtt(),
which in turn is called under ah->block.

This could deadlock if the beacon tasklet was run on the processor
that held the beacon lock during the do_softirq() in spin_unlock_bh().

We probably shouldn't hold the lock around the callbacks, but the
easiest fix is to switch to spin_lock_bh for ah->block: it doesn't
need interrupts disabled anyway as the data in question is only accessed
in softirq or process context.

Fixes the following lockdep warning:

[ 446.892304] WARNING: at kernel/softirq.c:159 _local_bh_enable_ip+0x38/0xa6()
[ 446.892306] Hardware name: MacBook1,1
[ 446.892309] Modules linked in: tcp_lp fuse sunrpc cpufreq_ondemand acpi_cpufreq mperf ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 nf_conntrack_ipv4 ip6table_filter nf_defrag_ipv4 xt_state nf_conntrack ip6_tables ext2 arc4 btusb bluetooth snd_hda_codec_idt snd_hda_intel carl9170 snd_hda_codec coretemp joydev ath5k snd_hwdep snd_seq isight_firmware ath snd_seq_device snd_pcm applesmc appletouch mac80211 input_polldev snd_timer microcode cfg80211 snd lpc_ich pcspkr i2c_i801 mfd_core soundcore rfkill snd_page_alloc sky2 tpm_infineon virtio_net kvm_intel kvm i915 drm_kms_helper drm i2c_algo_bit i2c_core video
[ 446.892385] Pid: 1892, comm: iw Not tainted 3.6.0-rc1-wl+ #296
[ 446.892387] Call Trace:
[ 446.892394] [<c0432958>] warn_slowpath_common+0x7c/0x91
[ 446.892398] [<c04399d7>] ? _local_bh_enable_ip+0x38/0xa6
[ 446.892403] [<c04399d7>] ? _local_bh_enable_ip+0x38/0xa6
[ 446.892459] [<f7f9ae3b>] ? mesh_sync_offset_adjust_tbtt+0x95/0x99 [mac80211]
[ 446.892464] [<c043298f>] warn_slowpath_null+0x22/0x24
[ 446.892468] [<c04399d7>] _local_bh_enable_ip+0x38/0xa6
[ 446.892473] [<c0439a52>] local_bh_enable_ip+0xd/0xf
[ 446.892479] [<c088004f>] _raw_spin_unlock_bh+0x34/0x37
[ 446.892527] [<f7f9ae3b>] mesh_sync_offset_adjust_tbtt+0x95/0x99 [mac80211]
[ 446.892569] [<f7f7650f>] ieee80211_beacon_get_tim+0x28f/0x4e0 [mac80211]
[ 446.892575] [<c047ceeb>] ? trace_hardirqs_on_caller+0x10e/0x13f
[ 446.892591] [<f7fdc541>] ath5k_beacon_update+0x40/0x26b [ath5k]
[ 446.892597] [<c047ad67>] ? lock_acquired+0x1f5/0x21e
[ 446.892612] [<f7fdf9fb>] ? ath5k_bss_info_changed+0x167/0x1b2 [ath5k]
[ 446.892617] [<c087f9ea>] ? _raw_spin_lock_irqsave+0x78/0x82
[ 446.892632] [<f7fdf9fb>] ? ath5k_bss_info_changed+0x167/0x1b2 [ath5k]
[ 446.892647] [<f7fdfa09>] ath5k_bss_info_changed+0x175/0x1b2 [ath5k]
[ 446.892651] [<c0479dd4>] ? lock_is_held+0x73/0x7b
[ 446.892662] [<c0458fd5>] ? __might_sleep+0xa7/0x17a
[ 446.892698] [<f7f5d8f7>] ieee80211_bss_info_change_notify+0x1ed/0x21a [mac80211]
[ 446.892703] [<c0449875>] ? queue_work+0x24/0x32
[ 446.892718] [<f7fdf894>] ? ath5k_configure_filter+0x163/0x163 [ath5k]
[ 446.892766] [<f7f95fa4>] ieee80211_start_mesh+0xb9/0xbd [mac80211]
[ 446.892806] [<f7f6e610>] ieee80211_join_mesh+0x10c/0x116 [mac80211]
[ 446.892834] [<f7a96b90>] __cfg80211_join_mesh+0x176/0x1b3 [cfg80211]
[ 446.892855] [<f7a96c1c>] cfg80211_join_mesh+0x4f/0x6a [cfg80211]
[ 446.892875] [<f7a89891>] nl80211_join_mesh+0x1de/0x1ed [cfg80211]
[ 446.892908] [<f7a8db99>] ? nl80211_set_wiphy+0x4cf/0x4cf [cfg80211]
[ 446.892919] [<c07cfa36>] genl_rcv_msg+0x1d5/0x1f3
[ 446.892940] [<c07cf861>] ? genl_rcv+0x25/0x25
[ 446.892946] [<c07cf009>] netlink_rcv_skb+0x37/0x78
[ 446.892950] [<c07cf85a>] genl_rcv+0x1e/0x25
[ 446.892955] [<c07cebf3>] netlink_unicast+0xc3/0x12d
[ 446.892959] [<c07cee46>] netlink_sendmsg+0x1e9/0x213
[ 446.892966] [<c079f282>] sock_sendmsg+0x79/0x96
[ 446.892972] [<c04eb90d>] ? might_fault+0x9d/0xa3
[ 446.892978] [<c07a81d8>] ? copy_from_user+0x8/0xa
[ 446.892983] [<c07a852c>] ? verify_iovec+0x43/0x77
[ 446.892987] [<c079f4d8>] __sys_sendmsg+0x180/0x215
[ 446.892993] [<c045f107>] ? sched_clock_cpu+0x134/0x144
[ 446.892997] [<c047992f>] ? trace_hardirqs_off+0xb/0xd
[ 446.893002] [<c047bf88>] ? __lock_acquire+0x46b/0xb6e
[ 446.893006] [<c047992f>] ? trace_hardirqs_off+0xb/0xd
[ 446.893010] [<c045f149>] ? local_clock+0x32/0x49
[ 446.893015] [<c0479ec1>] ? lock_release_holdtime.part.9+0x4b/0x51
[ 446.893020] [<c0479dd4>] ? lock_is_held+0x73/0x7b
[ 446.893025] [<c050d127>] ? fcheck_files+0x97/0xcd
[ 446.893029] [<c050d4df>] ? fget_light+0x2d/0x81
[ 446.893034] [<c07a01f3>] sys_sendmsg+0x3b/0x52
[ 446.893038] [<c07a07b4>] sys_socketcall+0x238/0x2a2
[ 446.893044] [<c0885edf>] sysenter_do_call+0x12/0x38
[ 446.893047] ---[ end trace a9af5998f929270f ]---
[ 447.627222]
[ 447.627232] =================================
[ 447.627237] [ INFO: inconsistent lock state ]
[ 447.627244] 3.6.0-rc1-wl+ #296 Tainted: G W
[ 447.627248] ---------------------------------
[ 447.627253] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[ 447.627260] swapper/0/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
[ 447.627264] (&(&ah->block)->rlock){+.?...}, at: [<f7fdd2d1>] ath5k_tasklet_beacon+0x91/0xa7 [ath5k]
[ 447.627299] {SOFTIRQ-ON-W} state was registered at:
[ 447.627304] [<c047cdbf>] mark_held_locks+0x59/0x77
[ 447.627316] [<c047ceeb>] trace_hardirqs_on_caller+0x10e/0x13f
[ 447.627324] [<c047cf27>] trace_hardirqs_on+0xb/0xd
[ 447.627332] [<c0439a3d>] _local_bh_enable_ip+0x9e/0xa6
[ 447.627342] [<c0439a52>] local_bh_enable_ip+0xd/0xf
[ 447.627349] [<c088004f>] _raw_spin_unlock_bh+0x34/0x37
[ 447.627359] [<f7f9ae3b>] mesh_sync_offset_adjust_tbtt+0x95/0x99 [mac80211]
[ 447.627451] [<f7f7650f>] ieee80211_beacon_get_tim+0x28f/0x4e0 [mac80211]
[ 447.627526] [<f7fdc541>] ath5k_beacon_update+0x40/0x26b [ath5k]
[ 447.627547] [<f7fdfa09>] ath5k_bss_info_changed+0x175/0x1b2 [ath5k]
[ 447.627569] [<f7f5d8f7>] ieee80211_bss_info_change_notify+0x1ed/0x21a [mac80211]
[ 447.627628] [<f7f95fa4>] ieee80211_start_mesh+0xb9/0xbd [mac80211]
[ 447.627712] [<f7f6e610>] ieee80211_join_mesh+0x10c/0x116 [mac80211]
[ 447.627782] [<f7a96b90>] __cfg80211_join_mesh+0x176/0x1b3 [cfg80211]
[ 447.627816] [<f7a96c1c>] cfg80211_join_mesh+0x4f/0x6a [cfg80211]
[ 447.627845] [<f7a89891>] nl80211_join_mesh+0x1de/0x1ed [cfg80211]
[ 447.627872] [<c07cfa36>] genl_rcv_msg+0x1d5/0x1f3
[ 447.627881] [<c07cf009>] netlink_rcv_skb+0x37/0x78
[ 447.627891] [<c07cf85a>] genl_rcv+0x1e/0x25
[ 447.627898] [<c07cebf3>] netlink_unicast+0xc3/0x12d
[ 447.627907] [<c07cee46>] netlink_sendmsg+0x1e9/0x213
[ 447.627915] [<c079f282>] sock_sendmsg+0x79/0x96
[ 447.627926] [<c079f4d8>] __sys_sendmsg+0x180/0x215
[ 447.627934] [<c07a01f3>] sys_sendmsg+0x3b/0x52
[ 447.627941] [<c07a07b4>] sys_socketcall+0x238/0x2a2
[ 447.627949] [<c0885edf>] sysenter_do_call+0x12/0x38
[ 447.627959] irq event stamp: 1929200
[ 447.627963] hardirqs last enabled at (1929200): [<c043a0e9>] tasklet_hi_action+0x3e/0xbf
[ 447.627972] hardirqs last disabled at (1929199): [<c043a0c0>] tasklet_hi_action+0x15/0xbf
[ 447.627981] softirqs last enabled at (1929196): [<c043999d>] _local_bh_enable+0x12/0x14
[ 447.627989] softirqs last disabled at (1929197): [<c040443b>] do_softirq+0x63/0xb8
[ 447.627999]
[ 447.627999] other info that might help us debug this:
[ 447.628004] Possible unsafe locking scenario:
[ 447.628004]
[ 447.628009] CPU0
[ 447.628012] ----
[ 447.628016] lock(&(&ah->block)->rlock);
[ 447.628023] <Interrupt>
[ 447.628027] lock(&(&ah->block)->rlock);
[ 447.628034]
[ 447.628034] *** DEADLOCK ***

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 987af54f 05-Aug-2012 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Put power_level where it belongs and rename it

Put power_level to ah_txpower struct with the rest tx power infos and
also rename it to txp_requested to make more sense.

v2 make sure we don't memset it to zero on reset

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2f8684ce 06-Jul-2012 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>

ath5k: replace modparam_all_channels with CONFIG_ATH5K_TEST_CHANNELS

This stashes away this feature from standard kernel builds.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6617942e 15-Jun-2012 Bob Copeland <me@bobcopeland.com>

ath5k: remove _bh from inner locks

spin_unlock_bh(&txq->lock) already disables softirqs so we don't want
to do it here. Fixes smatch warnings:

drivers/net/wireless/ath/ath5k/base.c:1048 ath5k_drain_tx_buffs() error: double lock 'bottom_half:'
drivers/net/wireless/ath/ath5k/base.c:1056 ath5k_drain_tx_buffs() error: double unlock 'bottom_half:'

Reported-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9b4760e3 16-Apr-2012 Felix Fietkau <nbd@openwrt.orq>

ath5k: add possible wiphy interface combinations

Signed-off-by: Felix Fietkau <nbd@openwrt.org>


# 2e42e474 09-May-2012 Joe Perches <joe@perches.com>

drivers/net: Convert compare_ether_addr to ether_addr_equal

Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.

Done via cocci script:

$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)

@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)

@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 94c84ee6 12-Apr-2012 Jonathan Bither <jonbither@gmail.com>

ath5k: use compare_ether_addr on MAC addresses instead of memcmp

Following Felix's recent patchset as an example I have replaced memcmp with
compare_ether_addr.

"Because of the constant size and guaranteed 16 bit alignment, the inline
compare_ether_addr function is much cheaper than calling memcmp."

Signed-off-by: Jonathan Bither <jonbither@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 227842d1 18-Mar-2012 Joe Perches <joe@perches.com>

ath5k: Introduce _ath5k_printk to reduce code/text

Macros can be converted to functions to reduce overall object size.

Convert the ATH5K_PRINTK macro to use _ath5k_printk.

Allyesconfig size is reduced ~10%

$ size drivers/net/wireless/ath/ath5k/built-in.o*
text data bss dec hex filename
211557 2032 40672 254261 3e135 drivers/net/wireless/ath/ath5k/built-in.o.new
235412 2032 47296 284740 45844 drivers/net/wireless/ath/ath5k/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 516304b0 18-Mar-2012 Joe Perches <joe@perches.com>

ath: Add and use pr_fmt, convert printks to pr_<level>

Use a more current logging style.
Make sure all output is prefixed appropriately.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 62e2c102 06-Mar-2012 Felix Fietkau <nbd@openwrt.org>

ath5k: do not stop queues for full calibration

Some calibration types interfere with tx activity, but the queue stop does
not prevent that. In fact, some calibration types need tx activity to properly
function, so stopping the queues for them is counterproductive.
In some tests this patch has been shown to improve stability, especially in
AP or ad-hoc mode.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# da473b61 02-Mar-2012 Chun-Yeow Yeoh <yeohchunyeow@gmail.com>

ath5k: allow AP and mesh mode to operate simultaneously

This patch allows the possibility of having the mesh point and AP to be operated
simultaneously in one single radio. Previously, mesh point fails to generate the
mesh beacon if virtual AP is created for the same radio.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 11deb533 24-Jan-2012 John W. Linville <linville@tuxdriver.com>

ath5k: use bool type for no_hw_rfkill_switch module parameter

Avoids this:

CC [M] drivers/net/wireless/ath/ath5k/base.o
drivers/net/wireless/ath/ath5k/base.c: In function ‘__check_no_hw_rfkill_switch’:
drivers/net/wireless/ath/ath5k/base.c:85:1: warning: return from incompatible pointer type

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f9972577 14-Jan-2012 Antonio Quartulli <ordex@autistici.org>

ath5k: claim support for IBSS RSN

Disable group keys programming when using IBSS RSN. Keys will be managed using
software. In this way IBSS RSN can correctly work.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# eb939922 19-Dec-2011 Rusty Russell <rusty@rustcorp.com.au>

module_param: make bool parameters really bool (net & drivers/net)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

(Thanks to Joe Perches for suggesting coccinelle for 0/1 -> true/false).

Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 86f62d9b 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: MRR support and 2GHz radio override belong in ah_capabilities

MRR support and 2GHz radio override belong in ah_capabilities and we
should use them (e.g. so far we used to set mrr descriptor without
checking if MRR support is enabled + we checked for MRR support 2
times, one by trying to set up an MRR descriptor and another one based
on MAC version).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 84e1e737 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Add a module parameter to disable hw rf kill switch

Add a module parameter to disable hw rf kill switch (GPIO interrupt) because
in some cases when the card doesn't come with the laptop, EEPROM configuration
doesn't match laptop's configuration and rf kill interrupt always fires up and
disables hw. I thought of moving this to debugfs and make it per-card but
this way it's easier for users and distros to handle.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c47faa36 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Cleanups v2 + add kerneldoc on all hw functions

No functional changes

Add kernel doc for all ath5k_hw_* functions and strcucts. Also do some cleanup,
rename ath5k_hw_init_beacon to ath5k_hw_init_beacon_timers, remove an unused
variable from ath5k_hw_pcu_init and a few obsolete macros, mostly related to XR.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ce169aca 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Calibration re-work

Noise floor calibration does not interfere with traffic and should run more
often as part of our "short calibration". The full calibration is not the
noise floor calibration but the AGC + Gain_F (on RF5111 and RF5112) calibration
and should run less often because it does interfere with traffic.

So

Short calibration -> I/Q & NF Calibration
Long calibration -> Short + AGC + Gain_F

This patch was for some time on my pub/ dir on www.kernel.org and has been tested
by a few people and me. I think it's O.K. to go in.

I also changed ah_calibration to ah_iq_cal_needed to make more sense.

v2 Use a workqueue instead of a tasklet for calibration

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 34ce644a 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Cleanups v1

No functional changes, just a few comments/documentation/cleanup

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7ff7c82e 25-Nov-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers

Since card has 12 tx queues and we want to keep track of the interrupts
per queue we can't fit all these interrupt bits on a single register.
So we have 5 registers, the primary interrupt status register (PISR) and
the 4 secondary interupt status registers (SISRs).

In order to be able to read them all at once (atomic operation) Atheros
introduced the Read-And-Clear registers to make things easier. So when
reading RAC_PISR register, hw does a read on PISR and all SISRs, returns
the value of PISR, copies all SISR values to their shadow copies (RAC_SISRx)
and clears PISR and SISRs. This saves us from reading PISR/SISRs in a sequence.

So far we 've used this approach and MadWiFi/Windows driver etc also used it
for years.

It turns out this operation is not atomic after all (at least not on all cards)
That means it's possible to loose some interrupts because they came after the
copy step and hw cleared them on the clean step !

That's probably the reason we got missed beacons, got stuck queues etc and
couldn't figure out what was going on.

With this patch we switch from RaC operation to an alternative method (that
makes more sense IMHO anyway, I just chose to be on the safe side so far).
Instead of reading RAC registers, we read the normal PISR/SISR registers and
clear any bits we got by writing them back on the register. This will clear only
the bits we got on our read step and leave any new bits unaffected (at least
that's what docs say). So if any new interrupts come up we won't miss it.

I've tested this with an AR5213 and an AR2425 and it seems O.K.

Many thanks to Adrian Chadd for debuging this and reviewing the patch !

v2: Make sure we don't clear PISR bits that map to SISR generated interrupts
(added a comment on the code for this)

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8fb7475b 04-Oct-2011 Dan Carpenter <dan.carpenter@oracle.com>

ath5k: remove some unneeded error handling code

th5k_hw_setup_tx_queue() returns a valid offset into the ah->ah_txq[]
array. The ah->ah_txq[] and the ah->txqs[] array are the same size.
Both have AR5K_NUM_TX_QUEUES elements. So this error handling code
will never trigger.

Also it's wrong. The call to ath5k_hw_release_tx_queue() with a qnum
of AR5K_NUM_TX_QUEUES or more will just trigger a WARN_ON() and
return. Or if it missed the WARN_ON(), it would just corrupt some
memory and return.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bdc71bc5 07-Aug-2011 Bob Copeland <me@bobcopeland.com>

ath5k: fix error handling in ath5k_beacon_send

This cleans up error handling for the beacon in case of dma mapping
failure. We need to free the skb when dma mapping fails instead of
nulling and leaking the pointer, and we should bail out to avoid
giving the hardware the bad descriptor.

Finally, we need to perform the null check after trying to update
the beacon, or else beacons will never be sent after a single
mapping failure.

Cc: stable@kernel.org
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bb1f3ad9 26-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: remove last references to "softc"

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 931be260 26-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: clean up base.h and its use

Remove unnecessary includes from base.h. Add includes to other files as
necessary. Don't include base.h unless needed.

Move declarations for functions in base.c from ath5k.h to base.h.

Use a better named define to protect base.h against double inclusion.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 32c25464 23-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value

When checking for the band, use channel->band.

Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take
ieee80211_channel. Change ath5k_hw_radio_revision() to take
ieee80211_band.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2972cc18 23-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: remove unused and write-only structures and fields

struct ath5k_avg_val is unused.

In struct ath5k_hw, lladdr, ah_radar and ah_mac_revision are write-only,
rxbufsize is unused, ah_phy is write-only and referenced by unused
macros.

In struct ath5k_vif, lladdr is write-only.

Remove AR5K_TUNE_RADAR_ALERT, which has no effect.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# fabba048 21-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: merge ath5k_{init, deinit}_hw() with their thin wrappers

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e0d687bd 14-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: merge ath5k_hw and ath5k_softc

Both ath5k_hw and ath5k_softc represent one instance of the hardware.
This duplication is historical and is not needed anymore.

Keep the name "ath5k_hw" for the merged structure and "ah" for the
variable pointing to it. "ath5k_hw" is shorter than "ath5k_softc", more
descriptive and more widely used.

Put the combined structure to ath5k.h where the old ath5k_softc used to
be. Move some code from base.h to ath5k.h as needed.

Remove memory allocation for struct ath5k_hw and the corresponding error
handling. Merge iobase and ah_iobase fields.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4e868796 11-Jul-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: do not call ieee80211_stop_queue for queues not managed by mac80211

Instead of using ieee80211_stop_queue, check the configured tx queue
limit before calling ieee80211_get_buffered_bc.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# fe00deb3 11-Jul-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: delay full calibration after reset

During scans the full calibration usually does not make much sense,
PAPD probing and IQ calibration should be deferred until there is
enough time to complete them. Adding 100 ms to the initial full
calibration delay should be enough to do this.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 26d16d23 11-Jul-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: initialize common->clockrate

Fixes a division by zero when setting distance before activating the
device for the first time.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6a2a0e73 08-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: fix typos, bad comment formatting and GHz in place of MHz

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4fc5401c 07-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: read sc->imask with sc->irqlock held

Signed-off-by: Pavel Roskin <proski@gnu.org>

sc->imask may change if ath5k_set_current_imask() races against itself.
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e4bbf2f5 07-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: fix formatting errors found by checkpatch.pl

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d2c7f773 07-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: fix misplaced or extraneous braces found by checkpatch.pl

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 633d006e 07-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: use parentheses around macro definitions

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 25380d80 07-Jul-2011 Pavel Roskin <proski@gnu.org>

ath5k: use DEFINE_PCI_DEVICE_TABLE in led.c, mark users with __devinit

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b7f080cf 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>


# 0e8d1602 17-Jun-2011 John W. Linville <linville@tuxdriver.com>

ath5k: free sc->ah in ath5k_deinit_softc

Nothing else is freeing it, and this mirrors the error handling path
already in ath5k_init_softc.

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

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Reported-by: Tsyvarev Andrey <tsyvarev@ispras.ru>


# f5cbc8ba 15-Jun-2011 Pavel Roskin <proski@gnu.org>

ath5k: minor cleanup

Move an extern variable declaration to a header file. Prefix all
functions with "ath5k_". Make ath5k_intr() static. Remove unneeded
forward declarations. Remove pointless "extern" in a function
declaration.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a99168ee 01-Jun-2011 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Disable fast channel switching by default

Disable fast channel change by default on AR2413/AR5413 due to
some bug reports (it still works for me but it's better to be safe).
Add a module parameter "fastchanswitch" in case anyone wants to enable
it and play with it.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d381f221 06-May-2011 Ben Greear <greearb@candelatech.com>

ath5k: Fix lockup due to un-init spinlock.

This was introduced in 2.6.39-rc1 it seems.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# fa9bfd61 13-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: add a new bus op for reading the mac address

On AHB, the calibration data usually does not contain a valid MAC address,
the correct MAC address is stored in the board config.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c266c71a 10-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: reduce interrupt load caused by rx/tx interrupts

While the rx/tx tasklet is pending, new unnecessary interrupts may arrive.
Decrease the load by temporarily disabling the interrupts until the tasklet
has completed.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5b7916ad 10-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: clean up debugfs code

The pointers to the debugfs entries do not need to be saved, because they
will be recursively removed when the wiphy is unregistered.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ed895085 10-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: remove ts_retry from ath5k_tx_status

Reusing the configured retry counts from the skb cb is more efficient than
reloading the data from uncached memory.
Replace ts_longretry (unused) with ts_final_retry which contains the retry
count for the final rate only

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6d7b97b2 09-Apr-2011 Felix Fietkau <nbd@openwrt.org>

ath5k: fix tx status reporting issues

During normal operation, minstrel was showing suspicious EWMA probabilities
exceeding 100%. It looks like the tx status reporting in ath5k was not
properly clearing the rate index for rates which were never attempted.

This is caused by uninitialized stale data in the on-stack tx status
information, which is reused when more frames are received.

To fix this, rely on ts->ts_final_idx to select the last attempted rate,
instead of checking whether ts->ts_rate is set.

Additionally, the conversion from the driver rate index back to the
mac80211 rate index can be dropped, as the mac80211 tx status will still
have the original rate index which was used to set up the descriptor.

Additionally, one more inaccuracy was fixed - the final rate attempt
count only needs to be increased by one if the transmission attempt was
successful.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 81266baf 07-Mar-2011 John W. Linville <linville@tuxdriver.com>

ath5k: implement ieee80211_ops->{get,set}_ringparam

set_ringparam only allows changes to tx ring at this time.

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e4b0b32a 03-Mar-2011 Ben Greear <greearb@candelatech.com>

ath5k: Put hardware in PROMISC mode if there is more than 1 stations.

It seems ath5k has issues receiving broadcast packets (ARPs) when
using multiple STA interfaces associated with multiple APs.
This patch ensures the NIC is always in PROMISC mode if there
are more than 1 stations associated.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7bb45683 24-Feb-2011 Johannes Berg <johannes.berg@intel.com>

mac80211: make tx() operation return void

The return value of the tx operation is commonly
misused by drivers, leading to errors. All drivers
will drop frames if they fail to TX the frame, and
they must also properly manage the queues (if they
didn't, mac80211 would already warn).

Removing the ability for drivers to return a BUSY
value also allows significant cleanups of the TX
TX handling code in mac80211.

Note that this also fixes a bug in ath9k_htc, the
old "return -1" there was wrong.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com> [ath5k]
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> [rt2x00]
Acked-by: Larry Finger <Larry.Finger@lwfinger.net> [b43, rtl8187, rtlwifi]
Acked-by: Luciano Coelho <coelho@ti.com> [wl12xx]
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6ebacbb7 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>


# 76a9f6fd 28-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Fix short and long retry configuration

The register definition for retry configuration on AR5212 was wrong, and simply
copied over from AR5210. Update the register definitions from the documentation.

Let the short and long retries be configured from mac80211 and use the standard
values of 7 and 4 by default. Also we need to make sure we don't export more
retries than we are configured for to mac80211 (and the rate module) in
hw->max_rate_tries.

Also clean up the code by removing unused defines and variables and drop the
different values for "station retries" - if these need to be different it can
be handled tru ah_retry_long/short.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0e472252 24-Jan-2011 Bob Copeland <me@bobcopeland.com>

ath5k: use tracing for packet tx/rx dump

This adds a few tracepoints to ath5k driver transmit and
receive callbacks in order to record packet traffic.
We record the entire packet in the trace buffer so that
the data can be extracted with trace-cmd and external
plugins.

Compared to the previous debugging calls, this approach
removes an out-of-line function call from the tx and rx
paths in the compiled-in-but-disabled case, while
improving the ability to process the logged data.

A new option, CONFIG_ATH5K_TRACER, is added so that one
may disable the tracepoints completely.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 97d9c3a3 19-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: ath5k_setup_channels cleanup and whitespace

Remove useless test_bit - it's not going to happen because of the way this
function is called only when that bit is set.

And fix some whitespace.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2b1351a3 20-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Simplify loop when setting up channels

Simplify confusing code and get rid of an unnecessary variable.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 930a7622 19-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Remove redundant sc->curband

Remove sc->curband because the band is already stored in the current channel.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4b3721ce 19-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Remove unused sc->curmode

sc->curmode is set but never used. Remove it and the helper function. Also the
ath5k_rate_update which is refered to in the comment does not exist (any more?)
so we don't need to setup the band in that place.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 410e6120 19-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Add 802.11j 4.9GHz channels to allowed channels

Add the 802.11j (20MHz channel width) channels to the allowed channels. This
still does not enable 802.11j in ath5k since these frequencies are out of the
configured range. A later patch will deal with that.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 08105690 19-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Rename ath5k_copy_channels

Rename ath5k_copy_channels() to ath5k_setup_channels() - nothing is copied
here.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 90c02d72 19-Jan-2011 Bruno Randolf <br1@einfach.org>

ath5k: Use mac80211 channel mapping function

Use mac80211 channel mapping function instead of own homegrown version.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 599b13ad 18-Jan-2011 Bob Copeland <me@bobcopeland.com>

ath5k: fix locking in tx_complete_poll_work

ath5k_reset must be called with sc->lock. Since the tx queue
watchdog runs in a workqueue and accesses sc, it's appropriate
to just take the lock over the whole function.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 18cb6e32 05-Jan-2011 John W. Linville <linville@tuxdriver.com>

ath5k: qualify global modparam_nohwcrypt variable

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# bb007554 25-Dec-2010 Bob Copeland <me@bobcopeland.com>

ath5k: fix cycle counter inconsistent locking

ath5k_reset is called from process context and takes the cc_lock
with plain spin_lock(), but cc_lock can also be taken from tasklets
in softirq context. Thus we need to at least use spin_lock_bh.

This fixes the following lockdep warning:

[ 19.967874] sky2 0000:01:00.0: eth0: enabling interface
[ 19.982761] ieee80211 phy0: device now idle
[ 20.904809] NET: Registered protocol family 17
[ 21.243857] ieee80211 phy0: device no longer idle - scanning
[ 21.404343]
[ 21.404346] =================================
[ 21.404450] [ INFO: inconsistent lock state ]
[ 21.404518] 2.6.37-rc7-wl+ #242
[ 21.404582] ---------------------------------
[ 21.404650] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[ 21.404721] kworker/u:4/982 [HC0[0]:SC1[3]:HE1:SE0] takes:
[ 21.404792] (&(&common->cc_lock)->rlock){+.?...}, at: [<f8115780>] ath5k_ani_calibration+0x29/0x5d9 [ath5k]
[ 21.405011] {SOFTIRQ-ON-W} state was registered at:
[ 21.405011] [<c105cadd>] __lock_acquire+0x62f/0x13c1
[ 21.405011] [<c105d944>] lock_acquire+0xd5/0xf1
[ 21.405011] [<c12c978d>] _raw_spin_lock+0x45/0x72
[ 21.405011] [<f8111533>] ath5k_reset+0x2c0/0x349 [ath5k]
[ 21.405011] [<f8111a7a>] ath5k_start+0xb8/0x139 [ath5k]
[ 21.405011] [<f849c714>] ieee80211_do_open+0x13f/0x819 [mac80211]
[ 21.405011] [<f849ce51>] ieee80211_open+0x63/0x66 [mac80211]
[ 21.405011] [<c1258b2e>] __dev_open+0x8d/0xb6
[ 21.405011] [<c1255c64>] __dev_change_flags+0x9d/0x114
[ 21.405011] [<c1258a75>] dev_change_flags+0x18/0x44
[ 21.405011] [<c1262990>] do_setlink+0x23f/0x521
[ 21.405011] [<c1262d58>] rtnl_setlink+0xe6/0xea
[ 21.405011] [<c126347c>] rtnetlink_rcv_msg+0x18a/0x1a0
[ 21.405011] [<c126d5f0>] netlink_rcv_skb+0x35/0x7b
[ 21.405011] [<c12632eb>] rtnetlink_rcv+0x20/0x27
[ 21.405011] [<c126d370>] netlink_unicast+0x1bb/0x21e
[ 21.405011] [<c126db21>] netlink_sendmsg+0x23b/0x288
[ 21.405011] [<c124823c>] sock_sendmsg+0xac/0xc4
[ 21.405011] [<c1248680>] sys_sendmsg+0x152/0x1a2
[ 21.405011] [<c1249b0d>] sys_socketcall+0x214/0x275
[ 21.405011] [<c10029d0>] sysenter_do_call+0x12/0x36
[ 21.405011] irq event stamp: 138032
[ 21.405011] hardirqs last enabled at (138032): [<c12ca252>] _raw_spin_unlock_irqrestore+0x3b/0x5e
[ 21.405011] hardirqs last disabled at (138031): [<c12c98cc>] _raw_spin_lock_irqsave+0x18/0x7e
[ 21.405011] softirqs last enabled at (138024): [<f84a570e>] ieee80211_tx_skb+0x47/0x49 [mac80211]
[ 21.405011] softirqs last disabled at (138027): [<c100452b>] do_softirq+0x63/0xb4
[ 21.405011]
[ 21.405011] other info that might help us debug this:
[ 21.405011] 3 locks held by kworker/u:4/982:
[ 21.405011] #0: (name){+.+.+.}, at: [<c1046158>] process_one_work+0x1b8/0x41b
[ 21.405011] #1: ((&(&local->scan_work)->work)){+.+.+.}, at: [<c1046158>] process_one_work+0x1b8/0x41b
[ 21.405011] #2: (&local->mtx){+.+.+.}, at: [<f84920fb>] ieee80211_scan_work+0x32/0x4a4 [mac80211]
[ 21.405011]
[ 21.405011] stack backtrace:
[ 21.405011] Pid: 982, comm: kworker/u:4 Not tainted 2.6.37-rc7-wl+ #242
[ 21.405011] Call Trace:
[ 21.405011] [<c12c6e68>] ? printk+0x1d/0x25
[ 21.405011] [<c105a742>] print_usage_bug+0x181/0x18b
[ 21.405011] [<c105b196>] ? check_usage_forwards+0x0/0xb6
[ 21.405011] [<c105a9ec>] mark_lock+0x2a0/0x4aa
[ 21.405011] [<c1059f6d>] ? trace_hardirqs_off+0xb/0xd
[ 21.405011] [<c105ca68>] __lock_acquire+0x5ba/0x13c1
[ 21.405011] [<c1059eed>] ? trace_hardirqs_off_caller+0x18/0x8d
[ 21.405011] [<c1059f6d>] ? trace_hardirqs_off+0xb/0xd
[ 21.405011] [<c1050411>] ? local_clock+0x2c/0x4f
[ 21.405011] [<c1059e00>] ? save_trace+0x2/0xa0
[ 21.405011] [<c105ac39>] ? mark_held_locks+0x43/0x5b
[ 21.405011] [<c12ca252>] ? _raw_spin_unlock_irqrestore+0x3b/0x5e
[ 21.405011] [<f8115780>] ? ath5k_ani_calibration+0x29/0x5d9 [ath5k]
[ 21.405011] [<c105d944>] lock_acquire+0xd5/0xf1
[ 21.405011] [<f8115780>] ? ath5k_ani_calibration+0x29/0x5d9 [ath5k]
[ 21.405011] [<c12c9b1a>] _raw_spin_lock_bh+0x4a/0x77
[ 21.405011] [<f8115780>] ? ath5k_ani_calibration+0x29/0x5d9 [ath5k]
[ 21.405011] [<f8115780>] ath5k_ani_calibration+0x29/0x5d9 [ath5k]
[ 21.405011] [<c105ac39>] ? mark_held_locks+0x43/0x5b
[ 21.405011] [<f8113496>] ath5k_tasklet_ani+0x1d/0x27 [ath5k]
[ 21.405011] [<c1037304>] tasklet_action+0x96/0x137
[ 21.405011] [<c10379b5>] __do_softirq+0xde/0x1c3
[ 21.405011] [<c10b0cef>] ? arch_get_unmapped_area_topdown+0x3b/0x127
[ 21.405011] [<c10378d7>] ? __do_softirq+0x0/0x1c3
[ 21.405011] <IRQ> [<c1036dee>] ? irq_exit+0x3d/0x49
[ 21.405011] [<c1003b4f>] ? do_IRQ+0x98/0xac
[ 21.405011] [<c1002eee>] ? common_interrupt+0x2e/0x34
[ 21.405011] [<c103007b>] ? sys_unshare+0x57/0x226
[ 21.405011] [<c1047fee>] ? queue_delayed_work+0x1/0x27
[ 21.405011] [<f84a83a0>] ? ieee80211_queue_delayed_work+0x2e/0x33 [mac80211]
[ 21.405011] [<f8492528>] ? ieee80211_scan_work+0x45f/0x4a4 [mac80211]
[ 21.405011] [<c104620e>] ? process_one_work+0x26e/0x41b
[ 21.405011] [<c1046158>] ? process_one_work+0x1b8/0x41b
[ 21.405011] [<f84920c9>] ? ieee80211_scan_work+0x0/0x4a4 [mac80211]
[ 21.405011] [<c10466b6>] ? worker_thread+0x18a/0x2a5
[ 21.405011] [<c12ca25e>] ? _raw_spin_unlock_irqrestore+0x47/0x5e
[ 21.405011] [<c104652c>] ? worker_thread+0x0/0x2a5
[ 21.405011] [<c104abe7>] ? kthread+0x67/0x6c
[ 21.405011] [<c104ab80>] ? kthread+0x0/0x6c
[ 21.405011] [<c1002efa>] ? kernel_thread_helper+0x6/0x10

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cd2c5486 22-Dec-2010 Bruno Randolf <br1@einfach.org>

ath5k: Move mac80211 functions into new file

Move mac80211 functions into new file mac80211-ops.c to have a better
separation and to make base.c smaller.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3de135db 15-Dec-2010 Bruno Randolf <br1@einfach.org>

ath5k: Set available antenna information for cfg80211

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f15a4bb2 16-Dec-2010 Bruno Randolf <br1@einfach.org>

ath5k: Fix survey

The old survey implementation was broken and returned nonsense data.

Clear cycle counters and survey data on reset. Since the cycle counters easily
overflow it's better to keep a local version of collected survey data (in ms
resolution, instead of clockrate) and update this every time survey is
retrieved. If survey is retrieved often enough to avoid cycle counter overflows
this works fine, otherwise we could update survey more often, like ath9k does.
Still only the survey for the current channel is kept.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b93996cf 07-Dec-2010 Javier Cardona <javier@cozybit.com>

ath5k: Put the right tsf value in mesh beacons

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c26d5339 07-Dec-2010 Javier Cardona <javier@cozybit.com>

ath5k: Prevent mesh interfaces from being counted as ad-hoc

This results in an erroneus num_adhoc_vifs count, as the this counter
was incremented but not decremented for mesh interfaces.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d82b577b 07-Dec-2010 Javier Cardona <javier@cozybit.com>

ath5k: Fix beaconing in mesh mode

This patch fixes the oops below when attempting to bring up a mesh
interface on ath5k hardware.

[ 128.933099] kernel BUG at drivers/net/wireless/ath/ath5k/base.c:197!
[ 128.933099] invalid opcode: 0000 [#1]
(...)
[ 128.933099] Call Trace:
[ 128.933099] [<c83b77fa>] ? ath5k_beacon_update+0x57/0x1f8 [ath5k]
[ 128.933099] [<c02d9a40>] ? __sysfs_add_one+0x28/0x76
[ 128.933099] [<c83b830e>] ? ath5k_bss_info_changed+0x13f/0x173
[ath5k]
[ 128.933099] [<c82ff629>] ? ieee80211_config_beacon+0xc0/0x17e
[mac80211]
[ 128.933099] [<c82f073e>] ?
ieee80211_bss_info_change_notify+0x182/0x18b [mac80211]
[ 128.933099] [<c83b81cf>] ? ath5k_bss_info_changed+0x0/0x173 [ath5k]
[ 128.933099] [<c82ff6d6>] ? ieee80211_config_beacon+0x16d/0x17e
[mac80211]
[ 128.933099] [<c82ff753>] ? ieee80211_add_beacon+0x34/0x39 [mac80211]
[ 128.933099] [<c830a4ed>] ? ieee80211s_init+0xf8/0x10f [mac80211]
[ 128.933099] [<c830a5df>] ? ieee80211_mesh_init_sdata+0xdb/0x154 [mac80211]

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 22d8d9f8 06-Dec-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use capabilities information for the number of TX queues

One thing I missed in my WME series: Older hardware does not have enough
hardware queues to support WME. In this case we just set up one data queue. Use
the capability information to decide how many queues to set up.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b7555ec7 07-Dec-2010 John W. Linville <linville@tuxdriver.com>

ath5k: remove MODULE_VERSION

Since this is updated manually and sporadically, it is fairly useless
anyway.

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 226afe68 02-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>


# b9e61f11 02-Dec-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Include tx ack reporting on hw flags

* Since we report tx acks to the protocol stack, add the needed
flag to hw_flags. This way we'll also use the new AP probing mechanism.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 344b54b9 02-Dec-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Disable ANI during reset

* Stop ANI durring reset to prevent false PHY error reports

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 19252ecb 02-Dec-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Always free tx buffers before reset

* Always free tx buffers before reset, since we also empty hw queues.
If we don't and a queue gets stuck, we'll never decrease txq_len and sw
will keep thinking the queue is still stuck even after reset.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5dcc03fe 02-Dec-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use EWMA factor of 1024 instead of 1000

This prepares the only place which uses the EWMA library so far for the
performance improved implementation coming up, which requires factor and
weight to be a power of two.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4cebb34c 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Fix reset and interrupts for AHB type of devices.

On WiSoc we cannot access mac register before it is resetted.
It will crash hardware otherwise.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a0b907ee 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Add AHB bus support.

AHB specific functions are now in ahb.c file. AHB bus is
compiled in when CONFIG_ATHEROS_AR231X is set in kernel.
All other platforms will use PCI bus.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e5b046d8 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Move PCI bus functions to separate file.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 132b1c3e 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Introduce ath5k_init_softc function as in ath9k

Split pci initialization into hardware specific
functions and softc structure initialization.
Make function naming similar to ones ath9k.
Introduce ath_bus_opts in ath5k for later
AHB bus integration.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# aeae4ac9 02-Dec-2010 Felix Fietkau <nbd@openwrt.org>

ath5k: Use Generic DMA for later support of AHB bus.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8c2b418a 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Clean up turbo mode initvals/rfregs

* Clean up what's left of turbo mode, since we handle all
register modifications (rfbuffer comes next) on code there
is no need to have duplicated arrays.

* Rename change_channel to skip_pcu on initvals.c as we did
on reset.c

Signed-off-by: Nick Kossifidis <micklfemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# acb091d6 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Cleanup turbo channel flags

* Clean up CHANNEL_T(URBO), use AR5K_BWMODE_40MHZ instead

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8aec7af9 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Support synth-only channel change for AR2413/AR5413

* Add synth-only channel change for AR2413/5413. When we call
ath5k_reset with a channel ath5k_hw_reset will first try to
set channel on PHY while PHY is running instead of doing a normal
full reset. To do this phy_init has to change to implement this
functionality.

* Clean up change_channel flag, what it really did was skip PCU
registers when setting initvals. This is done because on reset
PCU registers are not affected (except the registers we set
in pcu init and -due to hw problems- TSF). Use a new skip_pcu
flag that's not misleading instead. In the future we might use
that to also skip PCU reset and save us the TSF etc problems
(needs testing because standard practice is to reset everything).

* Use fast channel change only when setting channel, and set skip_pcu
to false only on init. When we reset the card due to DMA or PHY
problems skip pcu but never do a fast channel change.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 61cde037 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Extend rate_duration

* Extend ieee80211_generic_frame_duration to support the various
bwmodes.

* Better document what's going on with ack bitrates and update
write_rate_duration to support the standard ack bitrates (when
we don't set the high bit).

* Get rid of set_ack_bitrate_high and introduce a flag on ath5k_hw
for this (we only called the function on init anyway so there is no
difference).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 14fae2d4 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Use new function to stop beacon queue

* Since we only use ath5k_hw_stop_tx_dma to stop the beacon
queue, introduce a new function ath5k_hw_stop_beacon_queue so
that we can use that instead and have better control. In the future
we can add more beacon queue specific stuff there (maybe tweak
beacon timers or something), for now just call ath5k_hw_stop_tx_dma.

* Also since we don't call ath5k_hw_stop_rx/tx_dma from outside
dma.c, make them static.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 80dac9ee 23-Nov-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: Use new dma_stop function on base.c

* Since we stop rx/tx dma and pcu durring reset there is no need to
call ath5k_hw_stop_rx/tx_dma before, also there is no need to call
them durring stop_locked since we can use ath5k_hw_dma_stop for
both.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# eef39bef 15-Nov-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use generic EWMA library

Remove ath5k's private moving average implementation in favour of the generic
library version.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7afbb2f0 10-Nov-2010 Ben Greear <greearb@candelatech.com>

ath5k: Cleanup opmode setting logic.

An earlier review suggested moving the code in a small
method that was only called once inline. This patch
accomplishes that.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 72a80110 09-Nov-2010 Bruno Randolf <br1@einfach.org>

ath5k: Add support for antenna configuration

Support setting the antenna configuration via cfg/mac80211. At the moment only
allow the simple pre-defined configurations we already have (fixed antenna A/B
or diversity), but more advanced settings are possible to implement.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 14fb7c17 20-Oct-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: make ath5k_update_bssid_mask_and_opmode() static

This fixes this sparse warning:

CHECK drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/base.c:569:6: warning: symbol
'ath5k_update_bssid_mask_and_opmode' was not declared. Should it be static?

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


# edb40a23 19-Oct-2010 Bruno Randolf <br1@einfach.org>

ath5k: Add channel time to survey data

Include the channel utilization (busy, rx, tx) in the survey results.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9192f715 15-Oct-2010 Ben Greear <greearb@candelatech.com>

ath5k: Properly initialize ath_common->cc_lock.

Otherwise, lockdep splats, at the least:

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
Pid: 0, comm: swapper Not tainted 2.6.36-rc8-wl+ #32
Call Trace:
[<c075d940>] ? printk+0xf/0x17
[<c045507a>] register_lock_class+0x5a/0x29e
[<c0456af5>] __lock_acquire+0xa2/0xb8c
[<c0455be2>] ? mark_lock+0x1e/0x1de
[<c041a540>] ? acpi_get_override_irq+0x85/0x8c
[<c0455536>] ? trace_hardirqs_off+0xb/0xd
[<c0457639>] lock_acquire+0x5a/0x78
[<f8126835>] ? ath5k_ani_calibration+0x24/0x52b [ath5k]
[<c075f6ed>] _raw_spin_lock_bh+0x20/0x2f
[<f8126835>] ? ath5k_ani_calibration+0x24/0x52b [ath5k]
[<f8126835>] ath5k_ani_calibration+0x24/0x52b [ath5k]
[<c0438f99>] ? tasklet_action+0x3b/0xc6
[<f8123c2b>] ath5k_tasklet_ani+0x18/0x22 [ath5k]
[<c0438fd1>] tasklet_action+0x73/0xc6
[<c043945f>] __do_softirq+0x86/0x111
[<c0439520>] do_softirq+0x36/0x5a
[<c0439659>] irq_exit+0x35/0x69
[<c0403fb9>] do_IRQ+0x86/0x9a
[<c04034ee>] common_interrupt+0x2e/0x40
[<c045007b>] ? do_adjtimex+0x223/0x55e
[<c0408245>] ? mwait_idle+0x5c/0x6c
[<c040227f>] cpu_idle+0x4e/0x6b
[<c074b6e9>] rest_init+0x8d/0x92
[<c09758ea>] start_kernel+0x320/0x325
[<c09750d0>] i386_start_kernel+0xd0/0xd7

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d84a35d1 12-Oct-2010 Ben Greear <greearb@candelatech.com>

ath5k: Move debugfs under ieee80211/[wiphy-name]

This automatically keeps things proper when wiphy
is renamed.

Based on patch by Johannes Berg <johannes@sipsolutions.net>

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 908ebfb9 12-Oct-2010 Joe Perches <joe@perches.com>

ath5k: fix build break from "ath5k: Print out opmode in debugfs"

Also improve ath_opmode_to_string usage by having it return UNKNOWN
rather than NULL in the event of failure to map the opmode value to a
representative string.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 62c58fb4 08-Oct-2010 Ben Greear <greearb@candelatech.com>

ath5k: Adjust opmode when interfaces are removed.

Otherwise, if there is an AP and a STATION, and AP
is removed, the NIC will not revert back to STATION mode.

Reported-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4198a8d0 04-Oct-2010 Bruno Randolf <br1@einfach.org>

ath5k: Don't wake internal queues

We should only wake up queues which mac80211 knows about (queues 0-3). We have
another internal queue ("CAB", queue number 6) which we use for power-saved
frames. When transmitted frames are processed from this queue, we have to make
sure we don't bother mac80211 with waking a queue it doesn't know about.

this fixes:

WARNING: at /home/br1/ath/wireless-testing/net/mac80211/util.c:275
__ieee80211_wake_queue+0xd6/0xe0 [mac80211]()

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b72acddb 01-Oct-2010 Ben Greear <greearb@candelatech.com>

ath5k: Print rx/tx bytes in debugfs

This adds counters for tx and rx bytes, including any
errored packets as well as all wireless headers.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b1ae1edf 30-Sep-2010 Ben Greear <greearb@candelatech.com>

ath5k: Allow ath5k to support virtual STA and AP interfaces.

Support up to 4 virtual APs and as many virtual STA interfaces
as desired.

This patch is ported forward from a patch that Patrick McHardy
did for me against 2.6.31.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 11f21df3 26-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Increase "fudge" for beacon timers

We use FUDGE to make sure the next TBTT is ahead of the current TU.
Since we later substract AR5K_TUNE_SW_BEACON_RESP (10) in the timer
configuration we need to make sure it is bigger than that.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 7f896126 26-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Check and fix ATIM window

This patch adds sanity-checks for the beacon timers and especially the ATIM
window to ath5k. It is basically the same what i did for madwifi two years ago
and fixes a problem in IBSS mode which has been described as "ramping" pings.

See the code comments for a more detailed description and these links:

http://madwifi-project.org/ticket/1154
http://madwifi-project.org/changeset/3867
http://thread.gmane.org/gmane.linux.drivers.madwifi.devel/6066

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e0b1cc52 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Add tx queue configuration function

Add the mac80211 callback function to configure the tx queue properties like
cw_min, cw_max and aifs.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# de8af455 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Simplify cw_min/max and AIFS configuration

Get rid of overly complicated cw_min/max and AIFS configuration:

* Validate values in ath5k_hw_set_tx_queueprops(), so we can use them directly
without further checks or computation in ath5k_hw_reset_tx_queue().

* Simplifiy by using AR5K_TUNE_AIFS|CWMIN|CWMAX variables directly since we
don't support XR or B channels. That way we can also remove
AR5K_TXQ_USEDEFAULT and the confusing logic around it.

* Update data types: AIFS is u8, CW's are u16.

* Remove now unneeded variables in ath5k_hw.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 23413296 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Keep last descriptor in queue

If we return a TX descriptor to the pool of available descriptors, while a
queues TXDP still points to it we could potentially run into all sorts of
troube.

It has been suggested that there is hardware which can set the descriptors
done bit before it reads ds_link and moves on to the next descriptor. While the
documentation says this is not true for newer chipsets (the descriptor contents
are copied to some internal memory), we don't know about older hardware.

To be safe, we always keep the last descriptor in the queue, and avoid dangling
TXDP pointers. Unfortunately this does not fully resolve the problem - queues
still get stuck!

This is similar to what ath9k does.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 923e5b3d 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Count how many times a queue got stuck

Add a counter to show how many times a queue got stuck in the debugfs queue
file.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4edd761f 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Add watchdog for stuck TX queues

Since we do not know any better solution to the problem that TX queues can get
stuck, this adds a timer-based watchdog, which will check for stuck queues and
reset the hardware if necessary.

Ported from ath9k commit 164ace38536849966ffa377b1b1132993a5a375d.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1440401e 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Move tx frame completion into separate function

Clearer separation between queue handling and what we do with completed frames.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 651d9375 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Fix TX queues stopping

It does not make sense to stop queues for NF calibration. This will not stop
transmissions from the card, if there are queued packets.

If we run out of TX buffers we need to stop all queues, not only one.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 925e0b06 16-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use four hardware queues

Prepare ath5k for WME by using four hardware queues.

The way we set up our queues matches the mac80211 queue priority 1:1, so we
don't have to do any mapping for queue numbers.

Every queue uses 50 of the total 200 available transmit buffers, so the DMA
memory usage does not increase with this patch, but it might be good to
fine-tune the number of buffers per queue later (depending on the CPU speed and
load, and the speed of the medium access, it might not be big enough).

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8a63facc 16-Sep-2010 Bob Copeland <me@bobcopeland.com>

ath5k: reorder base.c to remove fwd decls

This change reorganizes the main ath5k file in order to re-group
related functions and remove most of the forward declarations
(from 61 down to 3). This is, unfortunately, a lot of churn, but
there should be no functional changes.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 781f3136 08-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use common crypt capabilities flags

Replace ah_aes_support and ah_combined_mic with common ath_crypt_caps
ATH_CRYPT_CAP_CIPHER_AESCCM and ATH_CRYPT_CAP_MIC_COMBINED.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e0f8c2a9 08-Sep-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use common ath key management functions

Use common ath key management functions in ath5k. This fixes problems with HW
encryption in AP mode, which was broken in the ath5k implementation.

Before (with the ath5k implementation) only one client could connect to the AP
using HW encryption and WPA. When a second client connected, the first client
was not able to send/receive any more packets. Because of the problems with HW
encryption, software encryption was always used in AP mode, which resulted in a
high CPU load (and/or low thruput) on embedded devices. Instead of trying to
fix the implementation in ath5k it makes more sense to share the code with
ath9k.

This also enables HW encryption for AP mode again.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d8e1ba76 24-Aug-2010 John W. Linville <linville@tuxdriver.com>

ath5k: check return value of ieee80211_get_tx_rate

This avoids a NULL pointer dereference as reported here:

https://bugzilla.redhat.com/show_bug.cgi?id=625889

When the WARN condition is hit in ieee80211_get_tx_rate, it will return
NULL. So, we need to check the return value and avoid dereferencing it
in that case.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Cc: stable@kernel.org
Acked-by: Bob Copeland <me@bobcopeland.com>


# df1c2986 21-Aug-2010 Dan Carpenter <error27@gmail.com>

ath5k: re-order one of the frees on unwind

There was a small misordering here. In the original code, if we were to
go to err_free_ah then it wouldn't free the irq.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 30bf4169 15-Aug-2010 Bob Copeland <me@bobcopeland.com>

ath5k: don't enable probe request rx for STAs

AR5K_RX_FILTER_PROBEREQ enables reception of probe requests,
but the filter flag FIF_BCN_PRBRESP_PROMISC is actually about
receiving beacons and probe _responses_, so we shouldn't
turn on the filter when scanning.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 4afd89d9 15-Aug-2010 Bob Copeland <me@bobcopeland.com>

ath5k: remove all mention of monitor iftype

Monitor interfaces are never seen by the driver so these
cases are never reached.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 23538c26 15-Aug-2010 Bob Copeland <me@bobcopeland.com>

ath5k: remove monitor check in receive_frame_ok filter

Monitor interfaces are never seen by the driver, so tests based on
that opmode don't make sense. Also, we already pass all mic
failure packets.

Consequently this code is actually accepting any frames with just
crypto errors and rejecting those with CRC, FIFO, and PHY errors for
all interface types. Adjust the code and comment accordingly.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a180a130 15-Aug-2010 Bob Copeland <me@bobcopeland.com>

ath5k: clean up some comments

This fixes a few misspellings, word repetitions, and some grammar
nits in ath5k comments. No code changes.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b6127980 15-Aug-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: remove own (wrong) IEEE80211_MAX_LEN

Use the version already supplied in include/linux/ieee80211.h.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 418de6d9 15-Aug-2010 Nick Kossifidis <mickflemm@gmail.com>

ath5k: rename ath5k_hw_set_associd to _set_bssid

Although the named function also sets the aid, its main
purpose is configuring the bssid and we use that
everywhere else.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 97359d12 10-Aug-2010 Johannes Berg <johannes.berg@intel.com>

mac80211: use cipher suite selectors

Currently, mac80211 translates the cfg80211
cipher suite selectors into ALG_* values.
That isn't all too useful, and some drivers
benefit from the distinction between WEP40
and WEP104 as well. Therefore, convert it
all to use the cipher suite selectors.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6ccf15a1 13-Aug-2010 Maxim Levitsky <maximlevitsky@gmail.com>

ath5k: disable ASPM L0s for all cards

Atheros PCIe wireless cards handled by ath5k do require L0s disabled.
For distributions shipping with CONFIG_PCIEASPM (this will be enabled
by default in the future in 2.6.36) this will also mean both L1 and L0s
will be disabled when a pre 1.1 PCIe device is detected. We do know L1
works correctly even for all ath5k pre 1.1 PCIe devices though but cannot
currently undue the effect of a blacklist, for details you can read
pcie_aspm_sanity_check() and see how it adjusts the device link
capability.

It may be possible in the future to implement some PCI API to allow
drivers to override blacklists for pre 1.1 PCIe but for now it is
best to accept that both L0s and L1 will be disabled completely for
distributions shipping with CONFIG_PCIEASPM rather than having this
issue present. Motivation for adding this new API will be to help
with power consumption for some of these devices.

Example of issues you'd see:

- On the Acer Aspire One (AOA150, Atheros Communications Inc. AR5001
Wireless Network Adapter [168c:001c] (rev 01)) doesn't work well
with ASPM enabled, the card will eventually stall on heavy traffic
with often 'unsupported jumbo' warnings appearing. Disabling
ASPM L0s in ath5k fixes these problems.

- On the same card you would see a storm of RXORN interrupts
even though medium is idle.

Credit for root causing and fixing the bug goes to Jussi Kivilinna.

Cc: David Quan <David.Quan@atheros.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Tim Gardner <tim.gardner@canonical.com>
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Cc: stable@kernel.org
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b3f194e5 13-Jul-2010 Bruno Randolf <br1@einfach.org>

ath5k: clean up rxlink handling

There were a few places where the sc->rxlink pointer was set to NULL "just in
case". This helps nothing - quite to the contrary it is problematic since it
can create self-linked rx descriptors in the middle of the list of receive
buffers.

Here is an example how this could happen (thanks Bob!):

cpu 0: cpu 1:

ath5k_rx_stop
ath5k_tasklet_rx
sc->rxlink = NULL; /* just in case */
// following doesn't link used
// buffer to prev.
ath5k_rxbuf_setup()

In the case of ath5k_rx_stop() and ath5k_stop_locked() buffers/descriptors are
not changed so rxlink should not be changed as well.

In ath5k_intr() we seem to try to work around a hardware bug, as the comment
(which is copied 1:1 from the HAL) suggests. I don't see how this could help.
Also the HAL does not set rxlink in this case (So where does this code come
from? It has been there since the first import of ath5k). Changed to just
increment a statistics counter.

After this patch rxlink is only set to NULL before we initialize rx descriptors
and updated when the descriptors are linked together.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 450464de 13-Jul-2010 Bob Copeland <me@bobcopeland.com>

ath5k: disable tasklets during reset

Based on a patch from Bruno Randolf, attempting useful
work while we are resetting the chip just leads to interface
lockups and bad descriptor data, and possibly DMAing to
freed buffers. Let's suspend all tasklets while
reprogramming the registers in the card to avoid such
problems.

In the future we can convert the tasklets to threaded
interrupt handlers to simplify things.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5faaff74 13-Jul-2010 Bob Copeland <me@bobcopeland.com>

ath5k: move reset to mac80211 workqueue

We currently trigger a reset via a tasklet when certain error
conditions are detected so that the card will (eventually)
restart. Unfortunately this makes locking complicated since
reset can also be called in process context (e.g. for channel
change). Currently nothing protects against concurrent resets,
which can be the source of corruption bugs.

Reset takes too long to spinlock the whole thing, so this
patch moves deferred resets into the mac80211 workqueue to
enable use of sc->lock mutex.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a6668193 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: use direct function calls for descriptors when possible

Use direct function calls for ath5k_hw_setup_rx_desc() and
ath5k_hw_setup_mrr_tx_desc() instead of a function pointer which always pointed
to the same function in the case of ath5k_hw_setup_rx_desc() and which is
easily unified in the case of ath5k_hw_setup_mrr_tx_desc().

Also simplify the initialization function for the remaining function pointers.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 02a78b42 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: move checks and stats into new function

Create a new function ath5k_receive_frame_ok() which checks for errors, updates
error statistics and tells us if we want to further "receive" this frame or
not. This way we can avoid a goto and have a cleaner separation between buffer
handling and other things.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8a89f063 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: split descriptor handling and frame receive

Move frame reception into it's own function to have a clearer separation
between buffer and descriptor handling and things that are done when we
actually receive a frame.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b16062fa 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: unify rx descriptor error handling

There is no reason for a special handling (return) here, just break like we do
with the checks before.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 39d63f2a 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: reset more pointers after we free skbs

After we free skbs for receive or transmit descriptors, make sure we have no
pointers to the now invalid memory address.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0452d4a5 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: print more errors when decriptor setup fails

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# beade636 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: fix some comment typos

Fix comment about dma sizes, brackets were missing. Replace 'insure' with
'ensure'.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9e4e43f2 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: rename ath5k_txbuf_free() to ath5k_txbuf_free_skb()

Rename ath5k_txbuf_free() to ath5k_txbuf_free_skb() since this is what it does:
it frees the skb and not the buf. Same for ath5k_rxbuf_free().

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8d67a031 16-Jun-2010 Bruno Randolf <br1@einfach.org>

ath5k: more debug prints for resets

Add a debug print for every case of reset.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6b5dcccb 04-Jun-2010 Bob Copeland <me@bobcopeland.com>

ath5k: retain promiscuous setting

Commit 56d1de0a21db28e41741cfa0a66e18bc8d920554, "ath5k: clean up
filter flags setting" introduced a regression in monitor mode such
that the promisc filter flag would get lost.

Although we set the promisc flag when it changed, we did not
preserve it across subsequent calls to configure_filter. This patch
restores the original functionality.

Cc: stable@kernel.org
Bisected-by: weedy2887@gmail.com
Tested-by: weedy2887@gmail.com
Tested-by: Rick Farina <sidhayn@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e307139d 29-May-2010 Tobias Doerffel <tobias.doerffel@gmail.com>

ath5k: depend on CONFIG_PM_SLEEP for suspend/resume functions

When building a kernel with CONFIG_PM=y but neither suspend nor
hibernate support, the compiler complains about the static functions
ath5k_pci_suspend() and ath5k_pci_resume() not being used:

drivers/net/wireless/ath/ath5k/base.c:713:12: warning: ‘ath5k_pci_suspend’ defined but not used
drivers/net/wireless/ath/ath5k/base.c:722:12: warning: ‘ath5k_pci_resume’ defined but not used

Depending on CONFIG_PM_SLEEP rather than CONFIG_PM fixes the issue.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 40ca22ea 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: add sysfs files for ANI parameters

/sys/class/ieee80211/phy0/device/ani/ani_mode
/sys/class/ieee80211/phy0/device/ani/noise_immunity_level
/sys/class/ieee80211/phy0/device/ani/spur_level
/sys/class/ieee80211/phy0/device/ani/firstep_level
/sys/class/ieee80211/phy0/device/ani/ofdm_weak_signal_detection
/sys/class/ieee80211/phy0/device/ani/cck_weak_signal_detection
/sys/class/ieee80211/phy0/device/ani/noise_immunity_level_max
/sys/class/ieee80211/phy0/device/ani/spur_level_max
/sys/class/ieee80211/phy0/device/ani/firstep_level_max

sysfs has a lot of symlinks, so you can find the files also in other locations,
like (by PCI ID) /sys/devices/pci0000:00/0000:00:11.0/ani and others.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6673e2e8 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: use ath5k_softc as driver data

It's our "private driver data"... It's used more often and hw is the mac80211
part. This makes more sense with the next (sysfs) patch.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# afe86286 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: run NF calibration only every 60 seconds

Since NF calibration interferes with TX and RX and also has been the cause of
other problems (when it's run concurrently with ath5k_reset) we want to run it
less often - every 60 seconds for now.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0e8e02dd 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: Stop queues only for NF calibration

As far as we know, only NF calibration interferes with RX/TX so we can
leave the queues enabled for the other calibrations.

BTW: Stopping the queues is not enough for avoiding transmissions, since there
might be packets in the queue + beacons are also sent regularly! But i leave it
like this until we have a better solution (stopping TX DMA?).

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9e04a7eb 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: move noise floor calibration into tasklet

Seperate noise floor calibration from other PHY calibration and move it to the
tasklet. This is the first step to more separation of different calibrations.

Also move out ath5k_hw_request_rfgain_probe(ah) so we have one clean function
for I/Q calibration on 5111x parts.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ac559526 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: initialize calibration timers

Initialize calibration timers on reset, since otherwise they might be in the
future and the calibration tasklet might not be scheduled for a long time.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 397f385b 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: wake queues on reset

We can wake all queues after a chip reset since everything should be set up and
we are ready to transmit. If we don't do that we might end up starting up with
stopped queues, not beeing able to transmit. (This started to happen after
"ath5k: clean up queue manipulation" but since periodic calibration also
stopped and started the queues this effect was hidden most of the time).

This way we can also get rid of the superfluous ath5k_reset_wake() function.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b5eae9ff 18-May-2010 Bruno Randolf <br1@einfach.org>

ath5k: consistently use rx_bufsize for RX DMA

We should use the same buffer size we set up for DMA also in the hardware
descriptor. Previously we used common->rx_bufsize for setting up the DMA
mapping, but used skb_tailroom(skb) for the size we tell to the hardware in the
descriptor itself. The problem is that skb_tailroom(skb) can give us a larger
value than the size we set up for DMA before. This allows the hardware to write
into memory locations not set up for DMA. In practice this should rarely happen
because all packets should be smaller than the maximum 802.11 packet size.

On the tested platform rx_bufsize is 2528, and we allocated an skb of 2559
bytes length (including padding for cache alignment) but sbk_tailroom() was
2592. Just consistently use rx_bufsize for all RX DMA memory sizes.

Also use the return value of the descriptor setup function.

Cc: stable@kernel.org
Signed-off-by: Bruno Randolf <br1@einfach.org>
Reviewed-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9637e516 10-May-2010 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: drop warning on jumbo frames

Jumbo frames are not supported, and if they are seen it is likely
a bogus frame so just silently discard them instead of warning on
them all time. Also, instead of dropping them immediately though
move the check *after* we check for all sort of frame errors. This
should enable us to discard these frames if the hardware picks
other bogus items first. Lets see if we still get those jumbo
counters increasing still with this.

Jumbo frames would happen if we tell hardware we can support
a small 802.11 chunks of DMA'd frame, hardware would split RX'd
frames into parts and we'd have to reconstruct them in software.
This is done with USB due to the bulk size but with ath5k we
already provide a good limit to hardware and this should not be
happening.

This is reported quite often and if it fills the logs then this
needs to be addressed and to avoid spurious reports.

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


# f5c044e5 30-Apr-2010 John W. Linville <linville@tuxdriver.com>

mac80211: remove deprecated noise field from ieee80211_rx_status

Also remove associated IEEE80211_HW_NOISE_DBM from ieee80211_hw_flags.

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 54c7c91e 26-Apr-2010 John W. Linville <linville@tuxdriver.com>

ath5k: remove usage of deprecated noise value

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 55ee82b5 19-Apr-2010 Holger Schurig <holgerschurig@gmail.com>

ath5k: basic support for survey

This adds the first element of survey data, the noise floor figure.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 87d77c4e 12-Apr-2010 Bruno Randolf <br1@einfach.org>

ath5k: treat RXORN as non-fatal

We get RXORN interrupts when all receive buffers are full. This is not
necessarily a fatal situation. It can also happen when the bus is busy or the
CPU is not fast enough to process all frames.

Older chipsets apparently need a reset to come out of this situration, but on
newer chips we can treat RXORN like RX, as going thru a full reset does more
harm than good, there.

The exact chip revisions which need a reset are unknown - this guess
AR5K_SREV_AR5212 ("venice") is copied from the HAL.

Inspired by openwrt 413-rxorn.patch:
"treat rxorn like rx, reset after rxorn seems to do more harm than good"

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0edc9a67 12-Apr-2010 Bruno Randolf <br1@einfach.org>

ath5k: Use high bitrates for ACK/CTS

There was a confusion in the usage of the bits AR5K_STA_ID1_ACKCTS_6MB and
AR5K_STA_ID1_BASE_RATE_11B. If they are set (1), we will get lower bitrates for
ACK and CTS. Therefore ath5k_hw_set_ack_bitrate_high(ah, false) actually
resulted in high bitrates, which i think is what we want anyways. Cleared the
confusion and added some documentation.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a05988bb 07-Apr-2010 Bob Copeland <me@bobcopeland.com>

ath5k: fix race condition in tx desc processing

As pointed out by Benoit Papillault, there is a potential
race condition between the host and the hardware in reading
the next link in the transmit descriptor list:

cpu0 hw
tx for buf completed
raise tx_ok interrupt
process buf
buf->ds_link = 0
read buf->ds_link

This change checks txdp before processing a descriptor
(if there are any subsequent descriptors) to see if
hardware moved on. We'll then process this descriptor on
the next tasklet.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6b5d117e 07-Apr-2010 Bob Copeland <me@bobcopeland.com>

ath5k: clean up queue manipulation

Review spotted a couple of strange invocations to
ieee80211_wake_queues that could potentially cause problems:

- queues are awakened in the calibration tasklet before
phy calibration, and then again after calibration

- queues are awakened inside reset when we're trying to
drain the ath5k transmit queues, and again after
reset is completed (in callers to ath5k_reset_wake).

In both cases the first wake is unnecessary, so remove it.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2111ac0d 02-Apr-2010 Bruno Randolf <br1@einfach.org>

ath5k: Adaptive Noise Immunity (ANI) Implementation

This is an Adaptive Noise Imunity (ANI) implementation for ath5k. I have looked
at both ath9k and HAL sources (they are nearly the same), and even though i
have implemented some things differently, the basic algorithm is practically
the same, for now. I hope that this can serve as a clean start to improve the
algorithm later.

This also adds a possibility to manually control ANI settings, right now only
thru a debugfs file:
* set lowest sensitivity (=highest noise immunity):
echo sens-low > /sys/kernel/debug/ath5k/phy0/ani
* set highest sensitivity (=lowest noise immunity):
echo sens-high > /sys/kernel/debug/ath5k/phy0/ani
* automatically control immunity (default):
echo ani-on > /sys/kernel/debug/ath5k/phy0/ani
* to see the parameters in use and watch them change:
cat /sys/kernel/debug/ath5k/phy0/ani

Manually setting sensitivity will turn the automatic control off. You can also
control each of the five immunity parameters (noise immunity, spur immunity,
firstep, ofdm weak signal detection, cck weak signal detection) manually thru
the debugfs file.

This is tested on AR5414 and nearly doubles the thruput in a noisy 2GHz band.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 22bedad3 01-Apr-2010 Jiri Pirko <jpirko@redhat.com>

net: convert multicast list to list_head

Converts the list and the core manipulating with it to be the same as uc_list.

+uses two functions for adding/removing mc address (normal and "global"
variant) instead of a function parameter.
+removes dev_mcast.c completely.
+exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for
manipulation with lists on a sandbox (used in bonding and 80211 drivers)

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# da35111a 24-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: update phy errors codes

Update PHY error codes from the HAL, and keep them in statistics for debugging
via the 'frameerrors' file. This will also be used by ANI.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 495391d7 24-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: simplify MIB counters

Let's keep MIB counter statistics in our own statistics structure and only
convert it to ieee80211_low_level_stats when needed by mac80211. Also we don't
need to read profile count registers in the MIB interrupt (they don't trigger
MIB interrupts).

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b4ea449d 24-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: keep beacon RSSI average

Keep an exponentially weighted moving average of the beacon RSSI in our BSS.
It will be used by the ANI implementation.

The averaging algorithm is copied from rt2x00, Thanks :)

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6a8a3f6b 24-Mar-2010 Bruno Randolf <br1@thinktube.com>

ath5k: move ath5k_hw_calibration_poll to base.c

It's not a phy related funtion; It has more to do with the interrupt handler
and tasklet scheduling, so it belongs to base.c.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e65e1d77 24-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: remove the use of SWI interrupt

We don't need to generate a software interrupt (SWI) just to schedule a tasklet
- we can just schedule the tasklet directly.

Rename constants, names, etc to reflect the fact that we don't use SWI any more.

Also move the flag handling into the tasklet and prepare it to behave correctly
when there are multiple flags present.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1063b176 24-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: remove static calibration interval variable

Remove static variable ath5k_calinterval which was used as a constant. Use a
#define instead. Also we don't need ah_cal_intval.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 7644395f 09-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: add debugfs file frameerrors

add a debugfs file to see different RX and TX errors as reported in our status
descriptors. this can help to diagnose driver problems.

statistics can be cleared by writing 'clear' into the frameerrors file.

example:

# cat /sys/kernel/debug/ath5k/phy0/frameerrors
RX
---------------------
CRC 27 (11%)
PHY 3 (1%)
FIFO 0 (0%)
decrypt 0 (0%)
MIC 0 (0%)
process 0 (0%)
jumbo 0 (0%)
[RX all 245]

TX
---------------------
retry 2 (9%)
FIFO 0 (0%)
filter 0 (0%)
[TX all 21]

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ccfe5552 09-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: remove double opmode definition

opmode (operating mode) was defined in struct ath5k_hw and struct ath5k_softc.
remove it from ath5k_hw and use only from ath5k_softc (sc->opmode).

(btw: what's the meaning of opmode when we have multiple interfaces?)

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# caec9112 09-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: preserve antenna settings

save antenna settings and preserve across resets.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 604eeadd 09-Mar-2010 Bruno Randolf <br1@einfach.org>

ath5k: add antenna statistics and debugfs file for antenna settings

keep statistics about which antenna was used for TX and RX. this is used only
for debugging right now, but might have other applications later.

add a new file 'antenna' in debugfs (/sys/kernel/debug/ath5k/phy0/antenna) to show
antenna use statistics and antenna diversity related register values. it can
also be used to set the antenna mode until we have proper support for that in
iw:
- echo diversity > antenna: use default antenna mode (RX and TX diversity)
- echo fixed-a > antenna: use fixed antenna A for RX and TX
- echo fixed-b > antenna: use fixed antenna B for RX and TX
- echo clear > antenna: reset antenna statistics

Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8127fbdc 27-Feb-2010 Benoit Papillault <benoit.papillault@free.fr>

ath5k: Fix TX/RX padding for all frames

Currently, the padding position is based on
ieee80211_get_hdrlen_from_skb(). This is not correct since the HW does
padding on RX (and expect the same padding to be present on TX) at the
following position :

- management : 24 + 6 if 4-addr format
- control : 24 + 6 if 4-addr format
- data : 24 + 6 if 4-addr format + 2 if QoS
- invalid : 24 + 6 if 4-addr format

whereas ieee80211_get_hdrlen_from_skb() is :

- management : 24
- control : 16 except for ACK/CTS where it is 10
- data : 24 + 6 if 4-addr format + 2 if QoS + 2 if QoS & order
- invalid : 24

So, correct frames are not affected : management frames do not use
4-addr format, control frames have no body and invalid frames are ...
not valid by definition. However, in order to use monitor interface for
debugging purpose, one must be able to send/receive any frames, be it
correct or not. Such frames are affected by incorrect padding.

Moreover, since padding is added on TX, we need to remove it before
calling ieee80211_tx_status. This affect TX packets received by monitor
interfaces.

It has been tested between an ath5k based card (AR5212) and an ar9170usb
based card (netgear WNDA3100) using a frame generator and a monitor
interface for each card.

v2: Added ath5k_add_padding / ath5k_remove_padding

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 626ede6b 18-Feb-2010 Pavel Roskin <proski@gnu.org>

ath5k: remove stale function declarations, make some functions static

Remove all unnecessary function declarations from ath5k.h. Comment out
unused functions. Remove ath5k_hw_get_tsf32(), which is too trivial to
be commented out. Make functions static if suggested by sparse. Make
ath5k_pm_ops static.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2ac2927a 09-Feb-2010 Bob Copeland <me@bobcopeland.com>

ath5k: use correct packet type when transmitting

The hardware needs to know what type of frames are being
sent in order to fill in various fields, for example the
timestamp in probe responses (before this patch, it was
always 0). Set it correctly when initializing the TX
descriptor.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3b211909 07-Feb-2010 Kalle Valo <kalle.valo@iki.fi>

ath5k: remove get_tx_stats() mac80211 op

get_tx_stats() will be removed from mac80211.

Compile-tested only.

Cc: Jiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Kalle Valo <kalle.valo@iki.fi>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a951ae21 20-Jan-2010 Bob Copeland <me@bobcopeland.com>

ath5k: fix setup for CAB queue

The beacon sent gating doesn't seem to work with any combination
of flags. Thus, buffered frames tend to stay buffered forever,
using up tx descriptors.

Instead, use the DBA gating and hold transmission of the buffered
frames until 80% of the beacon interval has elapsed using the ready
time. This fixes the following error in AP mode:

ath5k phy0: no further txbuf available, dropping packet

Add a comment to acknowledge that this isn't the best solution.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6e08d228 21-Dec-2009 Lukáš Turek <8an@praha12.net>

ath5k: Implement mac80211 callback set_coverage_class

The callback sets slot time as specified in IEEE 802.11-2007 section
17.3.8.6 (for 20MHz channels only for now) and raises ACK and CTS
timeouts accordingly. The values are persistent, they are restored after
device reset.

Signed-off-by: Lukas Turek <8an@praha12.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a3aa1884 07-Jan-2010 Alexey Dobriyan <adobriyan@gmail.com>

drivers/net/: use DEFINE_PCI_DEVICE_TABLE()

Use DEFINE_PCI_DEVICE_TABLE() so we get place PCI ids table into correct section
in every case.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1ed32e4f 23-Dec-2009 Johannes Berg <johannes@sipsolutions.net>

mac80211: remove struct ieee80211_if_init_conf

All its members (vif, mac_addr, type) are now available
in the vif struct directly, so we can pass that instead
of the conf struct. I generated this patch (except the
mac80211 and header file changes) with this semantic
patch:

@@
identifier conf, fn, hw;
type tp;
@@
tp fn(struct ieee80211_hw *hw,
-struct ieee80211_if_init_conf *conf)
+struct ieee80211_vif *vif)
{
<...
(
-conf->type
+vif->type
|
-conf->mac_addr
+vif->addr
|
-conf->vif
+vif
)
...>
}

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 671adc93 23-Dec-2009 Johannes Berg <johannes@sipsolutions.net>

wireless: remove remaining qual code

This removes the remaining users of the rx status
'qual' field and the field itself.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 242ab7ad 21-Dec-2009 Bob Copeland <me@bobcopeland.com>

ath5k: fix SWI calibration interrupt storm

The calibration period is now invoked by triggering a software
interrupt from within the ISR by ath5k_hw_calibration_poll()
instead of via a timer.

However, the calibration interval isn't initialized before
interrupts are enabled, so we can have a situation where an
interrupt occurs before the interval is assigned, so the
interval is actually negative. As a result, the ISR will
arm a software interrupt to schedule the tasklet, and then
rearm it when the SWI is processed, and so on, leading to a
softlockup at modprobe time.

Move the initialization order around so the calibration interval
is set before interrupts are active. Another possible fix
is to schedule the tasklet directly from the poll routine,
but I think there are additional plans for the SWI.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# dc1e001b 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: use the common->keymap

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


# dd849782 04-Nov-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: remove double cache alignment, ath_rxbuf_alloc() already does it

ath5k is using the (csz - 1) twice as ath_rxbuf_alloc() already allocates
and moves skb->data accordingly. Remove the extra (csz -1).

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


# cc861f74 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>


# bcfc56a8 08-Nov-2009 Bob Copeland <me@bobcopeland.com>

ath5k: don't reset mcast filter when configuring the mode

We should not zero out the multicast hash when configuring
the operating mode, since a zero value means all multicast
frames will get dropped. Also, ath5k_mode_setup() gets
called after any reset, so the hash already set up in
configure_filter() is lost.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8ce54c5a 06-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: enable Power-Save Polls by setting the association ID

mac80211 has long provided us the association ID. This isn't useful except
for Power-Save polling which now gets enabled. We can now poll for our
pending frames on the AP during power save.

You can review the details of Power-Save on the wireless wiki:

http://wireless.kernel.org/en/developers/Documentation/ieee80211/power-savings

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


# be5d6b75 06-Oct-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: simplify passed params to ath5k_hw_set_associd()

We have access to common->curbssid and common->curaid so just
use those. Note that common->curaid is always 0 so this keeps
our current behaviour of always using 0 for now. Once we fix
storing the association ID passed by mac80211 this will
require no changes here.

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


# baee1f3c 04-Oct-2009 Rafael J. Wysocki <rjw@rjwysocki.net>

Wireless / ath5k: Simplify suspend and resume callbacks

Simplify the suspend and resume callbacks of ath5k by converting the
driver to struct dev_pm_ops and allowing the PCI PM core to do the
PCI-specific suspend/resume handling.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# b002a4a9 13-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

atheros: add ieee80211_hw to ath_common

Make use of it on hw code in ath9k to avoid
using the ath9k ath_softc.

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


# 13b81559 10-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>


# e5aa8474 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: define ath_common ops

Only common ath read/write ops go through the common ops.

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


# 9adca126 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: allocate ath5k_hw prior to initializing hw

We can propagate better errors upon failed hw initialization,
and set up the ath_common structure for attach purposes. This
will become important once we start using the ath_common
for read/write ops.

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


# db719718 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: move ath_common to ath5k_hw

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


# 954fecea 10-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: use common curbssid, bssidmask and macaddr

The ah_sta_id was really being used as the macaddr.
ath5k still does not use the association ID now passed
up by mac80211, that can be fixed later.

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


# 17753748 09-Sep-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath: move ath_bcast_mac to common header

This is used by both ath5k and ath9k to set the first bssid mask.

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


# 97a81f5c 26-Aug-2009 Pavel Roskin <proski@gnu.org>

ath5k: don't use PCI ID to find the chip revision

AR5K_SREV is available even if the chip has been put to sleep. Relying
on the chip register allows binding non-standard PCI IDs by

echo VENDOR_ID PRODUCT_ID >/sys/bus/pci/drivers/ath5k/new_id

without having to specify the driver data as well.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1c818740 24-Aug-2009 Bob Copeland <me@bobcopeland.com>

ath5k: add hardware CCMP encyption support

Recent ath5k hardware is capable of doing CCMP acceleration.
Enable it for the cards that support it.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1c5256bb 24-Aug-2009 Bob Copeland <me@bobcopeland.com>

ath5k: use the skb->cb directly for RX status

Save a memcpy by just storing updates directly in the skb
control block.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 56d1de0a 24-Aug-2009 Bob Copeland <me@bobcopeland.com>

ath5k: clean up filter flags setting

The maze of if() statements in configure_filter is confusing.
Reorganizing it as a switch statement makes it more apparent what
is going on and reveals several suspicious settings. This has no
functional changes, though it does remove some redundant flags
that are set earlier.

Also now that we can sleep, protect sc->filter_flags with the
sc lock.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 608b88cb 17-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath: move regulatory info into shared common structure

This moves the shared regulatory structure into the
common structure. We will use this ongoing for common
data.

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


# 3ac64bee 17-Aug-2009 Johannes Berg <johannes@sipsolutions.net>

mac80211: allow configure_filter callback to sleep

Over time, a whole bunch of drivers have come up
with their own scheme to delay the configure_filter
operation to a workqueue. To be able to simplify
things, allow configure_filter to sleep, and add
a new prepare_multicast callback that drivers that
need the multicast address list implement. This new
callback must be atomic, but most drivers either
don't care or just calculate a hash which can be
done atomically and then uploaded to the hardware
non-atomically.

A cursory look suggests that at76c50x-usb, ar9170,
mwl8k (which is actually very broken now), rt2x00,
wl1251, wl1271 and zd1211 should make use of this
new capability.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 13311b00 12-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: use bit shift operators for cache line size

This matches ath9k, providing consistency when reading both drivers.

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


# aeb63cfd 12-Aug-2009 Luis R. Rodriguez <lrodriguez@atheros.com>

ath5k: use common ath.ko ath_rxbuf_alloc()

Now that its shared we can remove ath5k's own implementation.

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


# 6e220662 09-Aug-2009 Nick Kossifidis <mick@madwifi-project.org>

ath5k: Use SWI to trigger calibration

* Get rid of calibration timer, instead use a software interrupt
to schedule the calibration tasklet.

a) We don't need a timer for this, there is no need for accuracy
even with round_jiffies i think this is a waste of resources.
Also we don't need to run calibration if we are idle (no
interrupts).

b) When we add ANI support we 'll just extend the poll function
and calibration tasklet and handle all periodic phy calibration
on one place (much cleaner).

c) Having calibration on a tasklet is better since during calibration
we can't transmit or receive (antennas are detached to measure
noise floor), previously calibration could run in parallel with
tx/rx and interfere (packet loss).

v2: kill tasklet on stop_hw, stop/wake queues
v3: use time_is_before_eq_jiffies to compare timestamp with current
time

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# edd7fc70 09-Aug-2009 Nick Kossifidis <mick@madwifi-project.org>

ath5k: Wakeup fixes

* Don't put chip to full sleep because there are problems during
wakeup. Instead hold MAC/Baseband on warm reset state via a new
function ath5k_hw_on_hold.

* Minor cleanups

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Tested-by: Ben Greear <greearb@candelatech.com>
Tested-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e30eb4ab 04-Aug-2009 Joerg Albert <jal2@gmx.de>

ath5k: fix missing output in monitor mode after ifconfig up

Let ath5k_chan_set() always call ath5k_reset().
This fixes the bug that we don't
get any packets in monitor mode after:

ifconfig wlan0 down
iwconfig wlan0 mode monitor channel 1
ifconfig wlan0 up

but they arrive after

iwconfig wlan0 channel 2

Signed-off-by: Joerg Albert <jal2@gmx.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8784d2ee 29-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: fix CAB queue operation

We need to process tx descriptors for all queues (currently main tx
queue and cabq) which may have triggered the TX completion interrupt.
Otherwise, the queues can get stuck after sending a few frames.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# ae6f53f2 29-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: update PCU opmode whenever a new interface is added

Previously, we would store the operating mode at interface up time,
but only update the PCU registers when the next reset happened.
The result is that if beacon configuration (ops->bss_info_changed)
happens before ops->config, we will program the wrong things into
the timer registers. Consequently, beacons won't work in AP mode
until after a reset (channel change, scan etc.).

This is fragile anyway so just program the opmode as soon as
mac80211 gives it to us.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 65b5a698 13-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: temporarily disable crypto for AP mode

Pavel Roskin reported some issues with using AP mode without
nohwcrypt=1. Most likely this is similar to the problem fixed
some time ago in ath9k by 3f53dd64f192450cb331c0fecfc26ca952fb242f,
"ath9k: Fix hw crypto configuration for TKIP in AP mode."

That only affects TKIP but it's easiest to just disable that and
WEP too until we get a proper fix in.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 3355443a 04-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: write PCU registers on initial reset

"Ath5k: unify resets"
introduced a regression into 2.6.28 where the PCU registers are never
initialized, due to ath5k_reset() always passing true for change_channel.
We subsequently program a lot of these registers but several may start
in an unknown state.

Cc: stable@kernel.org
Reported-by: Forrest Zhang <forrest@hifulltech.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 0d0cd72f 03-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: do not release irq across suspend/resume

Paraphrasing Rafael J. Wysocki: "drivers should not release PCI IRQs
in suspend." Doing so causes a warning during suspend/resume on some
platforms.

Cc: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 21800491 03-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: rework beacon configuration

Using the enable_beacon flag allows some simplifications and fixes
some corner cases in beacon handling. This change adds a state
variable for beaconing in ath5k_beacon_config and handles both
enabling and disabling, thus eliminating the need for
ath5k_beacon_disable. We also now configure the beacon when any
of the beacon parameters change, so ath5k_beacon_reconfig is no
longer needed (its mmiowb gets moved to ath5k_beacon_config).
Finally, by locking around the whole config function, we don't
need to worry about clearing the interrupt mask register before
installing the new mask.

The upshot is this correctly disables beaconing when the interfaces
are taken down, it fixes a potential restarting of beaconing
when ath5k_reset() is called, and ensures that updates to the
beacon interval take effect immediately.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# cec8db23 03-Jul-2009 Bob Copeland <me@bobcopeland.com>

ath5k: send buffered frames after the beacon

Enable the "Content" After Beacon queue and utilize it to send
any buffered frames for power-saving clients.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# f1d58c25 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>


# f0f3d388 10-Jun-2009 Bob Copeland <me@bobcopeland.com>

ath5k: enable hardware LEDs

Cardbus and some PCI cards use hardware LEDs rather than software GPIOs.
Program them with the proper blink patterns when idle, scanning or
associated. Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13288.

Tested-by: Frans Pop <elendil@planet.nl>
Tested-by: Mark Hindley <mark@hindley.org.uk>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# eab0cd49 18-Jun-2009 Jiri Slaby <jirislaby@kernel.org>

ath5k: fix beacon_int handling

73ca5203366235f8a43e490767284ba8cfd8c479
(ath5k: remove conf->beacon_int usage)
removed bintval setting from ath5k_config. We need to init the
interval earlier and don't touch it in add_interface anymore.

Otherwise it will be set only once by upper layer through
bss_info_changed but not on second and further hostap executions.

We ended up having bintval 1000 which rendered the AP useless on
many clients.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Cc: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8451d22d 16-Jun-2009 Jouni Malinen <jouni.malinen@atheros.com>

ath5k: avoid PCI FATAL interrupts by restoring RETRY_TIMEOUT disabling

This reverts 'ath5k: remove dummy PCI "retry timeout" fix' on the
same theory as in 'ath9k: Fix PCI FATAL interrupts by restoring
RETRY_TIMEOUT disabling'.

Reported-by: Bob Copeland <me@bobcopeland.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a6ae0716 09-Jun-2009 Bob Copeland <me@bobcopeland.com>

ath5k: minor rfkill cleanup

Always enable rfkill since the ifdefs in the code is not really worth
the Kconfig option. Also fix a few code style things, and remove the
usage of the ah_gpio[] array so we can remove it later.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# e6a3b616 09-Jun-2009 Tobias Doerffel <tobias.doerffel@gmail.com>

ath5k: added cfg80211 based rfkill support

This patch introduces initial rfkill support for the ath5k driver
based on rfkill support in the cfg80211 framework.
All rfkill related code is separated into newly created rfkill.c.

Changes to existing code are minimal:

* added a new data structure ath5k_rfkill to the ath5k_softc structure
* inserted calls to HW rfkill init/deinit routines
* ath5k_intr() has been extended to handle AR5K_INT_GPIO interrupts

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 72828b1b 02-Jun-2009 Bob Copeland <me@bobcopeland.com>

ath5k: disable beacon interrupt when interface is down

When we remove the active interface, there's no need to continue
sending beacons; doing so would cause a null pointer deref in
ieee80211_beacon_get(). Disable the interrupt in remove_interface
and add a WARN_ON(!vif) in case there are other instances lurking.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 73ca5203 28-May-2009 Bob Copeland <me@bobcopeland.com>

ath5k: remove conf->beacon_int usage

ieee80211_conf->beacon_int was deprecated and removed in a cleanup
patch, however it was accidentally added back to ath5k in the change
"ath5k: Allow user/driver to set txpower." Remove it once more,
fixing the following warning:

[13091.968902] WARNING: at drivers/net/wireless/ath/ath5k/base.c:2167 warn_slowpath_null+0x15/0x1a()
[13091.968906] Hardware name: MacBook1,1
[13091.968909] Modules linked in: usb_storage fuse i915 drm af_packet acpi_cpufreq binfmt_misc dm_mirror dm_region_hash dm_log dm_multipath dm_mod snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_seq_dummy hid_apple arc4 ecb snd_seq_oss snd_seq_midi_event usbhid snd_seq ath5k mac80211 appletouch snd_seq_device snd_pcm_oss snd_mixer_oss sky2 snd_pcm ath processor cfg80211 snd_timer sg ohci1394 snd uhci_hcd bitrev ieee1394 joydev ehci_hcd crc32 snd_page_alloc button ac thermal battery sr_mod applesmc cdrom evdev input_polldev unix [last unloaded: microcode]
[13091.968985] Pid: 2132, comm: phy0 Tainted: G W 2.6.30-rc5-wl #118
[13091.968988] Call Trace:
[13091.968994] [<c0125884>] warn_slowpath_fmt+0x77/0xa6
[13091.969003] [<c03557d8>] ? _spin_unlock+0x2c/0x41
[13091.969008] [<c0355a56>] ? _spin_lock_irqsave+0x15/0x69
[13091.969012] [<c0355783>] ? _spin_unlock_irqrestore+0x34/0x5d
[13091.969019] [<c01445bb>] ? trace_hardirqs_off+0xb/0xd
[13091.969024] [<c0355783>] ? _spin_unlock_irqrestore+0x34/0x5d
[13091.969029] [<c01445bb>] ? trace_hardirqs_off+0xb/0xd
[13091.969034] [<c0355783>] ? _spin_unlock_irqrestore+0x34/0x5d
[13091.969039] [<c01258c8>] warn_slowpath_null+0x15/0x1a
[13091.969054] [<f965846d>] ath5k_beacon_update_timers+0x44/0x27f [ath5k]
[13091.969059] [<c0126370>] ? vprintk+0x2dd/0x312
[13091.969063] [<c0125e50>] ? release_console_sem+0x1a6/0x1d3
[13091.969076] [<f96586c5>] ath5k_reset_tsf+0x1d/0x2c [ath5k]
[13091.969095] [<f93f4426>] __ieee80211_sta_join_ibss+0x35/0x3aa [mac80211]
[13091.969102] [<c0252793>] ? extract_entropy+0x47/0x8a
[13091.969121] [<f93f4b21>] ieee80211_sta_find_ibss+0x2de/0x32f [mac80211]
[13091.969126] [<c035422c>] ? mutex_lock_nested+0x28b/0x2a5
[13091.969145] [<f93f4b8e>] ? ieee80211_ibss_notify_scan_completed+0x1c/0x6f [mac80211]
[13091.969164] [<f93f4bc9>] ieee80211_ibss_notify_scan_completed+0x57/0x6f [mac80211]
[13091.969182] [<f93f26da>] ieee80211_scan_completed+0x31a/0x33f [mac80211]
[13091.969201] [<f93f27ca>] ieee80211_scan_work+0xcb/0x18b [mac80211]
[13091.969207] [<c0133a6a>] worker_thread+0x1b1/0x28e
[13091.969212] [<c0133a25>] ? worker_thread+0x16c/0x28e
[13091.969230] [<f93f26ff>] ? ieee80211_scan_work+0x0/0x18b [mac80211]
[13091.969237] [<c013736e>] ? autoremove_wake_function+0x0/0x38
[13091.969242] [<c01338b9>] ? worker_thread+0x0/0x28e
[13091.969246] [<c0137031>] kthread+0x4a/0x70
[13091.971460] [<c0136fe7>] ? kthread+0x0/0x70
[13091.971467] [<c0103527>] kernel_thread_helper+0x7/0x10
[13091.971470] ---[ end trace 8defaa5d15c50cef ]---

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 55aa4e0f 25-May-2009 John W. Linville <linville@tuxdriver.com>

ath5k: avoid leaking mutex in ath5k_config

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1071db86 18-May-2009 Bob Copeland <me@bobcopeland.com>

ath5k: update beacons in AP mode

ath5k only generated the beacon when bss_info_changed() was called,
but for AP mode this is not enough, because the TIM IE would never
get updated and consequently PS mode clients wouldn't know about
buffered frames. Instead, get a new beacon on every SWBA interrupt.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2bed03eb 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org>

ath5k: Implement antenna control

* Add code to support the various antenna scenarios supported by hw

* For now hardcode the default scenario (single or dual omnis with
tx/rx diversity working and tx antenna handled by session -hw keeps
track on which antenna it got ack from each ap/station and maps each
ap/station to one of the antennas-).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6f5f39c9 30-Apr-2009 Jiri Slaby <jirislaby@kernel.org>

ath5k: Enable AP mode

After some debuging we were hitting the following bugs so far...

* Due to huge channel list hostapd couldn't get infos from the driver
and couldn't set the channel. If we manualy set the channel after
hostapd starts (by setting channel to 0 -auto), beacons are sent
but they wont show up on scan because they are malformed (they have
channel = 0 because hostapd doesn't update the channel info -this is
probably a hostapd bug so i'm CCing Jouni) and they get dropped. Bob
fixed this by only allowing standard channels to be registered so
now hostapd works as expected.

* Docs (and HAL source) say that we must write 0 on timer0 when
operating on AP mode to start TSF increment but this seems to
mess with DBA in many cases and beacon queue never gets started.
We fixed that on the previous patch.

We have some more things to deal with...

* For some reason (hw bug or something else) after restarting hostapd
a few times, beacon inteval seems to change from 100ms to a sec
(we get one beacon per sec).

* We need to set sleep timers on STA mode and enable power saving +
support PCF.

...but i think it's time we enable AP support "officialy" so that
we can get more feedback from users. I ran ath5k with the mentioned
patches + hostapd 0.6.8 and AP mode worked fine (it had some less
throughput on my tests than IBSS but it worked).

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 428cbd4f 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org>

ath5k: Beaconing fixes

* Write next beacon timer even on AP mode since without this we get
no beacons + ath9k does it too. Docs say that we must write 0 on
this register on AP mode to start TSF increment, we do both to be
on the safe side.

* Fix num_tx_pending function, we never read the register :P that's
why we got all those "beacon queue 7 didn't stop messages".

* Put full prioriy on beacon queue, lock all queues with lower
priority using the arblock and also bypass any arblock by seting
the arblock ignore flag.

* For the CAB queue (do we need this thing ?, it seems crap) since
it's supposed to fire up after each beacon (we don't use it on driver
part, ath9k/MadWiFi does), don't make it DBA gated but instead make
it fire after each beacon by using the beacon sent gated flag.

* Increase bmiss threshold to 10, that's what we used on MadWiFi for
a long time. Also when we have pending frames on the beacon queue (we
got a beacon that didn't make it on the air) it's more likely that
the beacon queue never started, probably due to faulty DBA setting,
so change that "beacon queue didn't stop" message.

Tested this with AP mode and IBSS mode and seems to work fine ;-)

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# a0823810 30-Apr-2009 Nick Kossifidis <mick@madwifi-project.org>

ath5k: Allow user/driver to set txpower

* Now that we have regulatory control enable the driver to set
txpower on hw

* Also use txpower table offset so that we can match
power range set by user/driver with indices on power table.

Tested 2 different cards (a CM9 and an RF5112-based ubnt) and got
the same output using a remote machine to measure per-packet rssi
(conected the cards using attenuators). I also switched between
various tx power levels and i saw an equal power change on the remote
machine (so txpower changes as expected) and verified that we have
the same output on each rate.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2516baa6 27-Apr-2009 Bob Copeland <me@bobcopeland.com>

ath5k: correct interrupt storm warning

Ben Greear points out that the "too many interrupts" message will
never print in the intended case since the interrupt counter
will be -1 after the loop. Change it to pre-decrement so it will
be 0 on the thousandth iteration.

Cc: Ben Greear <greearb@candelatech.com>

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 2d0ddec5 23-Apr-2009 Johannes Berg <johannes@sipsolutions.net>

mac80211: unify config_interface and bss_info_changed

The config_interface method is a little strange, it contains the
BSSID and beacon updates, while bss_info_changed contains most
other BSS information for each interface. This patch removes
config_interface and rolls all the information it previously
passed to drivers into bss_info_changed.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 57c4d7b4 23-Apr-2009 Johannes Berg <johannes@sipsolutions.net>

mac80211: clean up beacon interval settings

We currently have two beacon interval configuration knobs:
hw.conf.beacon_int and vif.bss_info.beacon_int. This is
rather confusing, even though the former is used when we
beacon ourselves and the latter when we are associated to
an AP.

This just deprecates the hw.conf.beacon_int setting in favour
of always using vif.bss_info.beacon_int. Since it touches all
the beaconing IBSS code anyway, we can also add support for
the cfg80211 IBSS beacon interval configuration easily.

NOTE: The hw.conf.beacon_int setting is retained for now due
to drivers still using it -- I couldn't untangle all
drivers, some are updated in this patch.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 26925042 15-Apr-2009 Bob Copeland <me@bobcopeland.com>

ath5k: manipulate rxlink and descriptor address under rxbuf lock

Grabbing an ath5k_buf then dropping the lock is racy because the
referenced descriptor can be obtained in another thread and released
before the buffer is handed to the hardware. Likewise, manipulating
sc->rxlink without the lock can lead to having multiple self-linked
hardware descriptors.

Changes-licensed-under: 3-Clause-BSD

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# c57ca815 15-Apr-2009 Bob Copeland <me@bobcopeland.com>

ath5k: use rx hw descriptor pointer for self-linked check

This patch simplifies the code used to detect when the
self-linked DMA buffer is still in use by hardware, by
checking the hardware's rxdp register instead of looking
at the software buffer list.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 46802a4f 15-Apr-2009 Bob Copeland <me@bobcopeland.com>

ath5k: use bool for modparams

Current code uses int types, but both modparams are boolean values.

Changes-licensed-under: 3-Clause-BSD

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 56d2ac76 15-Apr-2009 Bob Copeland <me@bobcopeland.com>

ath5k: use tasklet_hi_schedule for beacon queue

For embedded platforms, beacon transmission can be starved when
flooded with data packets. Prioritize beacons by giving the beacon
queue the first shot when the isr completes.

Changes-licensed-under: 3-Clause-BSD

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 203c4805 30-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>