Commit Graph

80 Commits

Author SHA1 Message Date
Jouni Malinen c6feaf806d ath: Modify ath_key_delete() to not need full key entry
commit 144cd24dbc36650a51f7fe3bf1424a1432f1f480 upstream.

tkip_keymap can be used internally to avoid the reference to key->cipher
and with this, only the key index value itself is needed. This allows
ath_key_delete() call to be postponed to be handled after the upper
layer STA and key entry have already been removed. This is needed to
make ath9k key cache management safer.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201214172118.18100-5-jouni@codeaurora.org
Cc: Pali Rohár <pali@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-26 08:36:11 -04:00
Jouni Malinen b7d593705e ath: Export ath_hw_keysetmac()
commit d2d3e36498dd8e0c83ea99861fac5cf9e8671226 upstream.

ath9k is going to use this for safer management of key cache entries.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201214172118.18100-4-jouni@codeaurora.org
Cc: Pali Rohár <pali@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-26 08:36:11 -04:00
Joe Perches a72c926291 ath: Remove unnecessary ath_bcast_mac and use eth_broadcast_addr
Remove the static array and use the generic routine to set the
Ethernet broadcast address.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-03-29 12:10:26 +03:00
Martin Blumenstingl b40ded2ad7 ath9k: add a helper to get the string representation of ath_bus_type
This can be used when the ath_bus_type has to be presented in a log
message or firmware filename.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-11-15 16:55:37 +02:00
Johannes Berg 57fbcce37b 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>
2016-04-12 15:56:15 +02:00
Nick Kossifidis 04a81e183d ath9k: Add a new debug flag for FFT spectral scan
FFT spectral scan is a functionality that makes sense to have its own
debug flag.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-05-09 16:46:08 +03:00
Oleksij Rempel 8badb50cfa ath9k_htc: add new WMI_REG_RMW_CMDID command
Since usb bus add extra delay on each request, a command
with read + write requests is too expensive. We can dramtically
reduce usb load by moving this command to firmware.

In my tests, this patch will reduce channel scan time
for about 5-10 seconds.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-03-30 11:31:18 +03:00
Sujith Manoharan 249943a221 ath9k: Check WOW triggers properly
This patch makes sure that valid WOW triggers
are present before trying to suspend the device.
Also, introduce and use ATH_OP_WOW_ENABLED to
bypass PCI suspend and clear it in resume().

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-02-03 15:31:04 +02:00
John W. Linville ab1f5a532c Merge commit '4e6ce4dc7ce71d0886908d55129d5d6482a27ff9' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2014-11-19 15:38:48 -05:00
Oleksij Rempel 0198c2e298 ath: add struct ath_ps_ops
we will need it to make common code

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-11-11 16:31:13 -05:00
Sujith Manoharan 62ae1aef20 ath9k: Fix address management
Since both the arguments need to satisfy
the alignment requirements of ether_addr_copy(),
use memcpy() in cases where there will be no
big performance benefit and make sure that
ether_addr_copy() calls use properly aligned
arguments.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-10-27 14:16:16 -04:00
Felix Fietkau 94e0590077 ath: use CTL region from cfg80211 if unset in EEPROM
Many AP devices do not have the proper regulatory domain programmed in
EEPROM. Instead they expect the software to set the appropriate region.
For these devices, the country code defaults to US, and the driver uses
the US CTL tables as well.
On devices bought in Europe this can lead to tx power being set too high
on the band edges, even if the cfg80211 regdomain is set correctly.
Fix this issue by taking into account the DFS region, but only when the
EEPROM regdomain is set to default.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-10-23 14:02:06 -04:00
Sujith Manoharan e6664dff06 ath: Add support for tracing
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-10-02 14:23:14 -04:00
Lorenzo Bianconi c774d57fd4 ath9k: add dynamic ACK timeout estimation
Add dynamic ACK timeout estimation algorithm based on ACK frame RX timestamp,
TX frame timestamp and frame duration.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Tested-by: Philippe Duchein <wireless-dev@duchein.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-09-16 16:18:30 -04:00
Sujith Manoharan 27328a75da ath9k: Add a debug level for channel context
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-28 14:41:57 -04:00
Felix Fietkau 26f16c246c ath9k: Add ATH_OP_MULTI_CHANNEL
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-06-19 15:49:18 -04:00
Oleksij Rempel eefa01ddd5 ath9k: move sc_flags to ath_common
we will need it for ath9k_htc, may be other drivers too

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-03-17 13:13:06 -04:00
Oleksij Rempel 13f71050c1 ath9k: move ath9k_init_channels_rates to common-init
and rename it to ath9k_cmn_init_channels_rates.
sbands are move to ath_common as well.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-28 14:33:12 -05:00
John W. Linville 9e4b4269ec Merge branch 'for-linville' of git://github.com/kvalo/ath 2014-02-24 15:02:36 -05:00
Kalle Valo ef8c00174a ath: remove camel case from struct reg_dmn_pair_mapping
Fixes a checkpatch warning in ath10k:

drivers/net/wireless/ath/ath10k/mac.c:1636: WARNING: Avoid CamelCase: <regpair->regDmnEnum>

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-02-14 13:20:32 +02:00
Oleksij Rempel 2f2cb326f9 ath: add last_rssi to ath_common
we need access to this variable from common functions.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12 15:35:56 -05:00
Oleksij Rempel f1d267cab2 ath: add common function ath_is_mybeacon
this function is used by most ath driver, so it can be moved here.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-01-16 14:55:44 -05:00
Sujith Manoharan 6308130542 ath9k: Cleanup WLAN/BT RX diversity
For single-chain WLAN+BT cards, the BT antenna can be used for
WLAN RX when the BT interface is disabled. Rename the modparam
"antenna_diversity" to "bt_ant_diversity" to clarify this.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-05 14:52:42 -04:00
Sujith Manoharan 1433531049 ath9k: Merge HWTIMER debug level with BTCOEX
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-06-18 14:46:44 -04:00
Sujith Manoharan e09f2dc73c ath9k: Add a module parameter to enable diversity
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-09-24 14:59:11 -04:00
Mohammed Shafi Shajakhan b3ba6c529b ath: Add Wake-on-Wireless debug mask
to help the developers and users to debug/know
whats happening with WoW

Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Cc: vadivel@qca.qualcomm.com
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-12 15:27:16 -04:00
Felix Fietkau bed3d9c0b7 ath9k: fix dynamic WEP related regression
commit 7a532fe713
ath9k_hw: fix interpretation of the rx KeyMiss flag

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

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

Reported-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-25 15:14:13 -04:00
Ben Greear 98b36a0295 ath9k: Add wiphy name to log messages.
On systems with multiple NICs, it's nice to know which
one is producing warnings.  Here is an example of the
new ouput:

ath: wiphy0: Failed to stop TX DMA, queues=0x005!

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-12 14:19:36 -04:00
Joe Perches d2182b69dc ath: Convert ath_dbg(bar, ATH_DBG_<FOO>, to ath_dbg(bar, FOO
Add ATH_DBG_ to macros to shorten the uses and
reduce the line count.

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

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-12-19 14:35:31 -05:00
Zefir Kurtisi 9b203c8fc2 ath: add a debug level for DFS
This can later be used by other drivers that implement
DFS support.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-12-15 14:46:37 -05:00
Luis R. Rodriguez 55e435de91 ath: document ATH_DBG_MCI
A debug level was added to the ath module for printing
MCI messages but no documentation was provided. Clarify that
MCI is the Message Coexistence Interface, a private protocol
used exclusively for WLAN-BT coexistence starting from
AR9462.

Cc: wtsao@qca.qualcomm.com
Cc: rmanohar@qca.qualcomm.com
Cc: mohammed@qca.qualcomm.com
Cc: senthilb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-12-15 14:46:37 -05:00
Luis R. Rodriguez de1c732b18 ath: optimize processing of CTLs for country IEs for world roaming cards
When we receive a country IE hint and we have a world roaming card
we can optimize output power further by ensuring that we use the
calibrated data for the country by using that country's own CTL data.
That is -- when world roaming and when we process a country IE we
no longer need to use the lowest output power of all CTLs instead
we use an optimized CTL output power for that specific country.

We accomplish this by copying the regulatory data prior on init
and restoring it when cfg80211 tells us it gets a core hint. Core
hints are only sent on init and when it wants to restore reguulatory
settings. We take advantage of this fact and apply the cached
regulatory data when we get a core hint. When we get a country IE
hint though we process the regulatory data as if programmed for
a specific country.

Tested-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-12-13 15:30:59 -05:00
John W. Linville 515db09338 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Conflicts:
	drivers/net/wireless/iwlegacy/iwl-debugfs.c
	drivers/net/wireless/iwlegacy/iwl-rx.c
	drivers/net/wireless/iwlegacy/iwl-scan.c
	drivers/net/wireless/iwlegacy/iwl-tx.c
	include/net/bluetooth/bluetooth.h
2011-11-22 14:05:46 -05:00
Rajkumar Manoharan 7dc181c273 ath9k: Add btcoex profile management support for AR9462
AR9462 chips have the capabilities to provoide bluetooth
profile information. For non-AR9462 btcoex chips, the BT
priority traffic was identified by periodically polling
the respective registers and updated dutycycle, stomptype,
etc. As AR9462 chip offers the BT profile informations,
let us make use of that to update aggregation limit,
dutycycle, stomptype and wieghtages.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-11-08 15:54:30 -05:00
Joe Perches b9075fa968 treewide: use __printf not __attribute__((format(printf,...)))
Standardize the style for compiler based printf format verification.
Standardized the location of __printf too.

Done via script and a little typing.

$ grep -rPl --include=*.[ch] -w "__attribute__" * | \
  grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
  xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'

[akpm@linux-foundation.org: revert arch bits]
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-10-31 17:30:54 -07:00
Felix Fietkau cd2ea0df68 ath: remove ath_regulatory::current_rd_ext
It is unused since the previous dead code that was using it had been
removed earlier.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-10-11 16:41:27 -04:00
Felix Fietkau ca2c68cc7b ath9k_hw: clean up tx power handling
The code for handling various restrictions concerning regulatory limits,
antenna gain, etc. is very convoluted and duplicated across various
EEPROM parsing implementations, making it hard to review.

This patch partially cleans up the mess by unifying regulatory limit
handling in one function and simplifying handling of antenna gain.
It also removes unused transmit power scaling arrays from the EEPROM code,
which belonged to an unimplemented API that isn't supposed to be in
the driver anyway.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-10-11 16:41:26 -04:00
Felix Fietkau 82b2d33431 ath9k: eliminate common->{rx,tx}_chainmask
we already have ah->{rx,tx}chainmask for the same purpose

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-09-14 13:56:19 -04:00
Joe Perches 29e76245d4 ath: Make ath_printk void not int and remove unused struct ath_common *
Changing the return type and removing the unused argument from
ath_printk reduces code size.

Add an __always_unused struct ath_common * to the macros
that call ath_printk to avoid unused variable warnings.

$ size drivers/net/wireless/ath/built-in.o*
   text	   data	    bss	    dec	    hex	filename
1159859	  16235	 212000	1388094	 152e3e	drivers/net/wireless/ath/built-in.o.new
1164175	  16235	 212032	1392442	 153f3a	drivers/net/wireless/ath/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-30 15:38:52 -04:00
Joe Perches 7b8112d6db ath: Make ath_dbg void not int
The return value is never used so make it void.

Reduces object size a tiny bit.

$ size drivers/net/wireless/ath/built-in.o*
   text	   data	    bss	    dec	    hex	filename
1164175	  16235	 212032	1392442	 153f3a	drivers/net/wireless/ath/built-in.o.new
1164819	  16235	 212032	1393086	 1541be	drivers/net/wireless/ath/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-30 15:38:52 -04:00
Mohammed Shafi Shajakhan 05c0be2f7f ath9k: Add a debug entry to start/stop ANI
this helps the user to start/stop ANI dynamically.

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-01 15:36:29 -04:00
Felix Fietkau 0cb9e06b63 ath: unshare struct ath_bus_ops between ath5k and ath9k
This struct is not used in any common code, and moving it out of
the ath header makes it easier to add more driver specific ops.

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>
2011-04-14 15:35:08 -04:00
Felix Fietkau 845e03c93d ath9k_hw: add a new register op for read-mask-write
Reduces the number of calls to register ops. On MIPS this reduces the
ath9k_hw binary size from 321k down to 310k

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-03-30 14:15:19 -04:00
Sujith Manoharan 09a525d338 ath9k_htc: Add multiple register read API
This would decrease latency in reading bulk registers.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-01-19 11:36:06 -05:00
John W. Linville b7613370db ath: fix build break with ATH_DBG_WARN_ON_ONCE
Description by Hauke:

"If CONFIG_ATH_DEBUG=y is set ATH_DBG_WARN_ON_ONCE uses WARN_ON_ONCE and
returns something, but if CONFIG_ATH_DEBUG is not set it does not return
anything. Now ATH_DBG_WARN_ON_ONCE is used in the boolean expression in
an if case and is not returning anything and causes a compile error.

  CC [M]  /drivers/net/wireless/ath/ath9k/main.o
/drivers/net/wireless/ath/ath9k/main.c: In function ‘ath_isr’:
/drivers/net/wireless/ath/ath9k/main.c:769: error: expected expression
before ‘do’
make[5]: *** [/drivers/net/wireless/ath/ath9k/main.o] Error 1
make[4]: *** [/drivers/net/wireless/ath/ath9k] Error 2"

Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-09 09:42:10 -05:00
Sujith Manoharan 0b5ead91cd ath9k_htc: Cleanup device identification
ath.ko is a common module shared between ath5k, ar9170usb, ath9k and ath9k_htc.
Adding driver specific data to the shared structure would impact all the
drivers. Handling USB device recognition for devices specific to ath9k_htc
can be handled within the driver itself.

Also, AR7010 refers to the processor used in both AR9280/AR9287 based
devices. Rename the device enumerations accordingly.

While at it, check properly for the bus type when choosing the EEPROM
base address for UB95.

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-07 17:08:06 -05:00
Ben Greear d7fd1b50a5 ath9k: Make DMA warning in ath_stoprecv WARN_ON_ONCE.
This decreases spammage in the log.  A single line message
will still be printed, so users can be aware that problem
exists.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-07 16:54:24 -05:00
Vasanthakumar Thiagarajan 8060e169e0 ath9k: Enable extended synch for AR9485 to fix L0s recovery issue
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-07 16:34:53 -05:00
Joe Perches 21a99f9349 ath: Add and use ath_printk and ath_<level>
Add ath_printk and ath_<level> similar to
dev_printk and dev_<level> from device.h

This allows a more gradual rename of ath_print
to to ath_dbg or perhaps ath_debug.

This basically removes debug.h leaving
only an #define ath_printk ath_dbg
there and moving all the ATH_DBG_<foo>
enums to ath.h

I do not think there's much purpose for struct
ath_common * being passed to the ath_printk
functions, but perhaps there might be.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-12-07 16:34:39 -05:00
Vasanthakumar Thiagarajan 8f5dcb1cfb ath9k: Reintroduce modparam to enable btcoex
It is not ideal to enable btcoex based on subsys id as it is
not unique, they are so random. It is also a pain keeping
all of them in a table to enable btcoex for a particular
hw. Going back to the old idea.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-29 15:24:36 -05:00