Commit graph

4517 commits

Author SHA1 Message Date
Felix Fietkau 7f329bbb3d ath9k: remove sc->config.cabqReadyTime
It is not exposed as a configuration option anyway

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:59 -04:00
Felix Fietkau 45c67f6fec ath9k: move channel change code to ath_set_channel
Preparation for adding the scanning state machine to ath9k

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:59 -04:00
Felix Fietkau 2297f1c7be ath9k: make ath9k_cmn_update_ichannel static
Rework its wrapper function to make it more generic, using it as a
replacement for previous calls to ath9k_cmn_update_ichannel.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:59 -04:00
Felix Fietkau 6b21fd2027 ath9k_hw: simplify channel flags
There was some duplication between channelFlags and chanmode, as well as
a lot of redundant checks based on the combinations of flags.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Felix Fietkau 81c507a8b0 ath9k_hw: remove IS_CHAN_OFDM()
The hardware is always configured with OFDM support enabled

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Felix Fietkau 1a5e63265f ath9k_hw: remove IS_CHAN_B()
Hardware 802.11b-only mode isn't supported by the driver (the device is
configured for 802.11n/g instead). Simplify the code by removing checks
for it.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Felix Fietkau 8896934c16 ath9k_hw: remove direct accesses to channel mode flags
Use wrappers where available. Simplifies code and helps with further
improvements to the channel data structure

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Felix Fietkau 1a04d59d3e ath9k: use a separate data structure for rx buffers
There's no shared code for handling both rx and tx buffers, and tx
buffers require a lot more metadata than rx buffers.
Using a separate data structure for rx reduces memory usage and improves
cache footprint.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Fengguang Wu 50d60c6322 wcn36xx: fix coccinelle warnings
drivers/net/wireless/ath/wcn36xx/debug.c:27:11-31: WARNING opportunity for simple_open, see also structure on line 106
/c/kernel-tests/src/i386/drivers/net/wireless/ath/wcn36xx/debug.c:27:11-31: WARNING opportunity for simple_open, see also structure on line 148

 This removes an open coded simple_open() function
 and replaces file operations references to the function
 with simple_open() instead.

Generated by: coccinelle/api/simple_open.cocci

CC: Eugene Krasnikov <k.eugene.e@gmail.com>
CC: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-14 13:39:58 -04:00
Michael Opdenacker 73678804f4 treewide: fix "usefull" typo
Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-10-14 15:44:24 +02:00
Masanari Iida 6d3be300c6 treewide: Fix typo in printk
Correct spelling typo within various part of the kernel

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-10-14 15:24:22 +02:00
Eugene Krasnikov 8e84c25821 wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware
This is a mac80211 driver for Qualcomm WCN3660/WCN3680 devices. So
far WCN3660/WCN3680 is available only on MSM platform.

Firmware can be found here:
https://www.codeaurora.org/cgit/external/hisense/platform/vendor/qcom-opensource/wlan/prima/tree/firmware_bin?h=8130_CS

Wiki page is available here:
http://wireless.kernel.org/en/users/Drivers/wcn36xx

A lot people made a contribution to this driver. Here is the list in
alphabetical order:

Eugene Krasnikov <k.eugene.e@gmail.com>
Kalle Valo <kvalo@qca.qualcomm.com>
Olof Johansson <dev@skyshaper.net>
Pontus Fuchs <pontus.fuchs@gmail.com>
Yanbo Li <yanbol@qti.qualcomm.com>

Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-10 13:43:35 -04:00
Fengguang Wu e05634ee6c ath10k: remove unneded semicolon from ath10k_core_fetch_firmware_api_n()
drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon

 Removes unneeded semicolon.

Generated by: coccinelle/misc/semicolon.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-09 17:16:15 +03:00
Kalle Valo 60631c5c10 ath10k: fix ath10k_debug_start() locking
ath10k_debug_start() was not called with conf_mutex, fix that. Also there was a
deadlock in ath10k_debug_stop(), rename it to ath10k_debug_destroy() and call
it only when the device is destroyed.

Reported-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-09 17:14:55 +03:00
David S. Miller 53af53ae83 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	include/linux/netdevice.h
	net/core/sock.c

Trivial merge issues.

Removal of "extern" for functions declaration in netdevice.h
at the same time "const" was added to an argument.

Two parallel line additions in net/core/sock.c

Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-08 23:07:53 -04:00
Sujith Manoharan a24b88b560 ath10k: Fix bug in max. VHT A-MPDU size
For VHT peers, the maximum A-MPDU size has to be calculated
from the VHT capabilities element and not the HT-cap. The formula
is the same, but a higher value is used in VHT, allowing larger
aggregates to be transmitted.

The patch contains a workaround for some Netgear/Linksys APs that
report Rx A-MPDU factor incorrectly.

Tested-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-08 22:10:22 +03:00
Michal Kazior 0d1a28f241 ath10k: fix RX performance when using AP 10.X FW
Due to oversight AP 10.X support was merged with
Ethernet RX decap mode.

Only Native Wifi RX decap mode guarantees IP
header is properly aligned and avoids sk_buff data
realignment (which is very expensive
performance-wise) in mac80211.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-08 15:22:33 +03:00
Michal Kazior 9bab1cc010 ath10k: fix possible memory leak in new FW loading
Some failpaths did `return` instead of a `goto`
leaking requested firmware.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-08 15:13:53 +03:00
Michal Kazior fd9c4864a7 ath10k: fix printf format string
size_t corresponds to %zu not %d. Compiler was
complaining about it.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-08 15:13:53 +03:00
David S. Miller 7009deab19 Merge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
Conflicts:
	drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
	drivers/net/wireless/rtlwifi/rtl8188ee/phy.h
	drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
	drivers/net/wireless/rtlwifi/rtl8192de/phy.h
	drivers/net/wireless/rtlwifi/rtl8723ae/phy.h

Just some minor conflicts between the wireless-next changes
and Joe Perches's "extern" removal from function prototypes
in header files.

John W. Linville says:

====================
Regarding the Bluetooth bits, Gustavo says:

"The big work here is from Marcel and Johan. They did a lot of work
in the L2CAP, HCI and MGMT layers. The most important ones are the
addition of a new MGMT command to enable/disable LE advertisement
and the introduction of the HCI user channel to allow applications
to get directly and exclusive access to Bluetooth devices."

As to the ath10k bits, Kalle says:

"Bartosz dropped support for qca98xx hw1.0 hardware from ath10k, it's
just too much to support it. Michal added support for the new firmware
interface. Marek fixed WEP in AP and IBSS mode. Rest of the changes are
minor fixes or cleanups."

And also:

"Major changes are:

* throughput improvements including aligning the RX frames correctly and
  optimising HTT layer (Michal)

* remove qca98xx hw1.0 support (Bartosz)

* add support for firmware version 999.999.0.636 (Michal)

* firmware htt statistics support (Kalle)

* fix WEP in AP and IBSS mode (Marek)

* fix a mutex unlock balance in debugfs file (Shafi)

And of course there's a lot of smaller fixes and cleanup."

For the wl12xx bits, Luca says:

"Here are some patches intended for 3.13.  Eliad is upstreaming a bunch
of patches that have been pending in the internal tree.  Mostly bugfixes
and other small improvements."

Along with that...

Arend and friends bring us a batch of brcmfmac updates, Larry Finger
offers some rtlwifi refactoring, and Sujith sends the usual batch of
ath9k updates.  As usual, there are a number of other small updates
from a variety of players as well.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-07 15:40:44 -04:00
Felix Fietkau ec30326ea7 ath9k: fix tx queue scheduling after channel changes
Otherwise, if queues are full during a scan, tx scheduling does not
resume after switching back to the home channel.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-10-07 13:34:43 -04:00
Michal Kazior 3efcb3b40c ath10k: remove num_sends_allowed
The value provided by num_sends_allowed is now
derived from CE source ringbuffer state.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-07 15:28:02 +03:00
Michal Kazior 2e761b5a52 ath10k: remove ce_sendlist_send
It is completely pointless to keep this function
around. It doesn't do anything different than
ce_send except it introduces more overhead.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-07 15:28:02 +03:00
Michal Kazior ddb6ad77b4 ath10k: split vdev_id calculation from tx function
Tidy up ath10k_tx().

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-07 15:28:02 +03:00
Michal Kazior 42c3aa6f6a ath10k: split tid calculation from tx function
Tidy up ath10k_tx().

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-07 15:28:01 +03:00
Bartosz Markowski c322892fa7 ath10k: extend the max_scan time
It was observed few times, the artificial max_scan limit we
are using mainly to detect FW hangs, can be not enough for
instance while being associated and during heavy traffic.

What we do if the FW won't return with scan results within
the max_time time is a scan abort.

This is especially visible with 10.X fw which in combination
with dual band HW (scanning 32 channels) can end up with
hw_scan close to 10 seconds.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-07 15:23:53 +03:00
Bartosz Markowski 8acd3c97ff ath10k: enable 10.x firmware branch support
Since the WMI API has been added and we can detect from the
FW IEs what firmware variant we deal with, turn on support
for 10.x firmware branch in ath10k_wmi_attach().

kvalo: improve the commit log

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-07 15:22:06 +03:00
John W. Linville 75ae83d686 Merge tag 'for-linville-20131001' of git://github.com/kvalo/ath 2013-10-03 16:16:34 -04:00
Joe Perches 7b4371ea48 ath10k: wmi: Convert use of 6 to ETH_ALEN
Use the appropriate define instead of 6.

Signed-off-by: Joe Perches <joe@perches.com>
Noticed-by: Julia Lawall <julia.lawall@lip6.fr> via spatch script
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-02 23:41:53 -04:00
Joe Perches d458cdf712 net:drivers/net: Miscellaneous conversions to ETH_ALEN
Convert the memset/memcpy uses of 6 to ETH_ALEN
where appropriate.

Also convert some struct definitions and u8 array
declarations of [6] to ETH_ALEN.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-02 17:04:45 -04:00
David S. Miller 4fbef95af4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
	drivers/net/ethernet/emulex/benet/be.h
	drivers/net/usb/qmi_wwan.c
	drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
	include/net/netfilter/nf_conntrack_synproxy.h
	include/net/secure_seq.h

The conflicts are of two varieties:

1) Conflicts with Joe Perches's 'extern' removal from header file
   function declarations.  Usually it's an argument signature change
   or a function being added/removed.  The resolutions are trivial.

2) Some overlapping changes in qmi_wwan.c and be.h, one commit adds
   a new value, another changes an existing value.  That sort of
   thing.

Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-01 17:06:14 -04:00
Vladimir Murzin a07b5b840c ath6kl: fix compilation warning in ath6kl_htc_pipe_conn_service
Fix the warning

drivers/net/wireless/ath/ath6kl/htc_pipe.c: In function
'ath6kl_htc_pipe_conn_service':
drivers/net/wireless/ath/ath6kl/htc_pipe.c:1293:26: warning: integer overflow
in expression [-Woverflow]

by giving a hint to compiler about unsigned nature of
HTC_CONN_FLGS_SET_RECV_ALLOC_MASK

Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-10-01 19:42:28 +03:00
Felix Fietkau f69727fd78 ath9k: fix powersave response handling for BA session packets
When a packet is passed from mac80211 to the driver with the
IEEE80211_TX_CTL_PS_RESPONSE flag set, it bypasses the normal driver
internal queueing and goes directly to the UAPSD queue.

When that happens, packets that are part of a BlockAck session still
need to be tracked as such inside the driver, otherwise it will create
discrepancies in the receiver BA reorder window, causing traffic stalls.
This only happens in AP mode with powersave-enabled clients.

This patch fixes the regression introduced in the commit
"ath9k: use software queues for un-aggregated data packets"

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-30 16:19:29 -04:00
Kalle Valo 1a222435a1 ath10k: implement firmware IE container support
Firmware IE containers can dynamically provide various information what
firmware supports. Also it can embed more than one image so updating firmware
is easy, user just needs to update one file in /lib/firmware/.

The firmware API 2 or higher will use the IE container format, the current API
1 will not use the new format but it still is supported for some time. FW API 2
files are named as firmware-2.bin (which contains both firmware and otp images)
and API 1 files are firmware.bin and otp.bin.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-30 22:03:31 +03:00
Kalle Valo 958df3a00a ath10k: store separate pointers for firmware data
Needed for firmware IE formatted images.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-30 22:03:31 +03:00
Kalle Valo 365279167c ath10k: rename board_data in struct ath10k
I will use board_data for something else in the following patch
so I need to rename it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-30 22:03:31 +03:00
Bartosz Markowski 89b7e766c8 ath10k: handle FW API differences for scan structures
The wmi_start_scan_cmd has an extra filed in our main
firmware track, reflact that to not have a mismatch in
case of 10.x track.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:15 +03:00
Bartosz Markowski 226a339ba8 ath10k: introduce dynamic pdev parameters
This is done exactly the same way as for vdev.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:15 +03:00
Bartosz Markowski 6d1506e788 ath10k: introduce dynamic vdev parameters
Both firmwares (main and 10.x) have different set of vdev
parameters. To stay in sync with FW API, this patch introduces
a dynamic registering method.

ath10k_wmi_vdev_set_param() takes now indirect u32 value
to identify the Vdev parameter it want's to set.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:15 +03:00
Bartosz Markowski ec6a73f00e ath10k: add TARGET values for 10.x firmware
Introduce all TARGET specific values for 10.x firmware.
Some of them are common for both firmwares we will support,
but to avoid confusion, define everything with prefix 10X_.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:15 +03:00
Bartosz Markowski 12b2b9e33a ath10k: split wmi_cmd_init path
Due to API differences in initialization structures for
main and 10.x firmwares we need to split the wmi_init_cmd
and wmi_resource_config  structures.

This will be usefull also when setting the correct TARGET values,
like: number of peers, vdevs, pdevs etc.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:15 +03:00
Bartosz Markowski 5e00d31a0f ath10k: bring back the WMI path for mgmt frames
This is still the only way to submit mgmt frames in case
of 10.X firmware.

This patch introduces wmi_mgmt_tx queue, because of the
fact WMI command can block. This is a problem for
ath10k_tx_htt(), since it's called from atomic context.
The skb queue and worker are introduced to move the mgmt
frame handling out of .tx callback context and not block.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:14 +03:00
Bartosz Markowski b3effe61a1 ath10k: implement host memory chunks
10.X firmware can request a memory pool from host to offload
it's own resources. This is a feature designed especially
for AP mode where the target has to deal with large number
of peers.

So we allocate and map a consistent DMA memory which FW can
use to store e.g. peer rate contol maps.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:14 +03:00
Bartosz Markowski 08ba7b6b6f ath10k: drop the fw versioning sanity check
It was corrupted and leading to compilation warning
core.c: In function 'ath10k_check_fw_version':
core.c:79: warning: comparison is always true due to limited range of data type

Since we are going to support new FW track in the driver,
the sanity check for fw version number would be an overkill
then. This is just for information purposes anyway.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:14 +03:00
Bartosz Markowski 6f97d256b7 ath10k: split ath10k_wmi_service_ready_event_rx
Since the both firmwares we are going to support,
have significantly different APIs (WMI and shared
structures), it's easier to actually split the whole
event handling functions, instead cutting them inside.

The fork starts now on ath10k_wmi_process_rx().

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:14 +03:00
Bartosz Markowski 8a6618b00f ath10k: implement WMI events handling frame for both firmwares
We still use the same function handlers for both main and 10.X
paths. Next step is to track down and make the split needed.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:14 +03:00
Bartosz Markowski 553215592f ath10k: warn if give WMI command is not supported
This will show and make it easier to track the API
differences in the new AP firmware.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:14 +03:00
Bartosz Markowski b7e3adf907 ath10k: add wmi_10x_<cmd/event> definitions
Introduce the cmd and events definitions for 10.X FW API
and make up the wmi_10x_cmd_map. This is the core of
host-firmware WMI interface for 10.X FW branch.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:13 +03:00
Bartosz Markowski ce42870efb ath10k: introduce dynamic WMI structures
This is the initial framework to implement dynamic
WMI API in order to support new firmware (from so
called 10.X branch)

The realization is to have a static WMI cmd map for
each of the firmwares, registered upom wmi init.

This patch creates such map for MAIN FW, updates
wmi_cmd_send() calls to take as a parameter
the map value instead of direct WMI enum.

As soon as complete 10.X API will be on place,
we will introduce the FW IE mechanics to dynamicaly
identify which FW is being used and based on that
we will use correct map, API, structures, etc.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-27 14:58:13 +03:00
Sujith Manoharan 551ed40969 ath9k: Remove incorrect diversity initialization
Fast antenna diversity is required only for single chain
chips and the diversity initialization is done in the
per-family board setup routines. Enabling of diversity
should be done based on the calibrated EEPROM/OTP data,
doing it for all chips is incorrect.

Remove the code that sets the fast_div bit for all cards, since
the documentation for the AR_PHY_CCK_DETECT register says:

reg 642: sig_detect_cck
enable_ant_fast_div : Only used for single chain chips.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:50 -04:00
Sujith Manoharan c6cc47b101 ath9k: Handle FATAL interrupts correctly
When a FATAL interrupt is received, a full chip reset is
required, which is done in the main tasklet. But since
the reset routine is scheduled as a work item, make sure
that interrupts are not enabled in the tasklet before the
reset is done.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:49 -04:00
Sujith Manoharan 8a5b7ab36b ath9k: Fix NF calibration for single stream cards
Rather than using the chip ID to read only chain-0 CCA
registers and avoid reading chain-1, use the RX chainmask
instead. There are some 1-stream PCI devices based on AR9287
such as TL-WN751ND. Improper NF calibration might result in
DMA errors/timeouts.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:49 -04:00
Chris Metcalf 8e70eb8092 ath9k: mark wmi_event_swba as __packed
The other structures in wmi.h are already marked this way.
Without this marking, we get an unaliged access panic in the tilegx kernel:

Starting stack dump of tid 0, pid 0 (swapper) on cpu 35 at cycle 198675113844
  frame 0: 0xfffffff7103ada90 ath9k_htc_swba+0x120/0x618 [ath9k_htc]
  frame 1: 0xfffffff7103a4b10 ath9k_wmi_event_tasklet+0x1b0/0x270 [ath9k_htc]
  frame 2: 0xfffffff700326570 tasklet_action+0x148/0x298
  [...]

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:48 -04:00
Sujith Manoharan 3001f0d00b ath9k: Fix PeakDetect calibration for AR9462
Since HW PeakDetect calibration is turned on for AR9462,
various conditions have to be handled in the driver:

* Enable agc_cal when loading RTT fails.
* Disable SW PeakDetect calibration when RTT calibration is not enabled.
* Keep SW PeakDetect calibration result in driver.
* Update RTT table according to the saved value.
* Write RTT back after modifying SW RTT table.
* Enable local mode for PeakDetect calibration and restore values.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:47 -04:00
Sujith Manoharan 4b9b42bfe0 ath9k: Use bitops for calibration flags
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:47 -04:00
Sujith Manoharan 1e516ca7c9 ath9k: Handle abnormal NAV in AP mode
Beacon transmission would get stuck if the NAV is
an invalid value for some reason. Check and correct
the NAV value in the HW when this happens.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:46 -04:00
Sujith Manoharan 9ef4893234 ath9k: Fix issue with parsing malformed CFP IE
All QCA chips have the ability to parse the CF Parameter Set
IE in beacons. If the IE is malformed in the beacons from some
APs [1], the HW locks up. In AP mode, a beacon stuck would happen
and in client mode, a disconnection usually is the result.

To fix this issue, set the AR_PCU_MISC_MODE2_CFP_IGNORE to ignore
the CFP IE in beacons - this is applicable for all chips. For
AP mode, if this issue happens, the NAV is also corrupted and has
to be reset - this will be done in a subsequent patch.

[1] : http://msujith.org/ath9k/cfp/Malformed-CF-Param.png

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:46 -04:00
Sujith Manoharan c694545568 ath9k: Fix calibration for AR9462
TX IQ calibration is disabled by default for AR9462, this
is done using the initvals (reg 0xa644).

But, to compensate for this, the AR_PHY_RX_DELAY register
should be set to the max allowed value when performing
calibration.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:46 -04:00
Jingoo Han 3f06534183 wireless: wil6210: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:43 -04:00
Jingoo Han 1348088d6f wireless: ath10k: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:43 -04:00
Jingoo Han 8f616c6d31 wireless: ath9k: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:38 -04:00
Jingoo Han b920e375be wireless: ath5k: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:37 -04:00
Sachin Kamat 5bb4101bc9 net: ath9k: Use NULL instead of false
The function returns a pointer. Hence return NULL instead of false.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:37 -04:00
Albert Pool 38e05a0e52 ar5523: Add USB ID of D-Link WUA-2340 rev A1
Signed-off-by: Albert Pool <albertpool@solcon.nl>
Reported-by: Michael Landrum <landrummd@gmail.com>
Acked-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:37 -04:00
Zefir Kurtisi 5e88ba6228 ath9k: replace snprintf() with scnprintf()
Whenever the return value of snprintf() is used to calculate
remaining buffer-space, we wanted to use sncprintf() instead.

Indentation is adapted where possible. Some lines exceed the
line width limit, either they did it already before, or
since they can not be broken reasonably well.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:35 -04:00
Sujith Manoharan bf7c756c5d ath9k: Add DELL 1707 to supported card table
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:35 -04:00
Sujith Manoharan 7c9a72013b ath9k: Update AR9485 1.1 initvals
* Remove duplicate array mappings.
* Fix ETSI CCA compliance.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:31 -04:00
Sujith Manoharan 6d5228fe20 ath9k: Add and use initvals for channel 14
This is missing for AR9565.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:30 -04:00
Sujith Manoharan d3b371cb03 ath9k: Fix regulatory compliance for AR9462/AR9565
Adjust the CCA values based on the regulatory domain
present in the EEPROM.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:30 -04:00
Sujith Manoharan 3fcdd0a12e ath9k: Identify WB335 Antenna configuration
There are 2 types of WB335 cards, 1-antenna and 2-antenna.
Identify them based on PCI subsystem IDs, this will be used
for MCI/BTCOEX tweaks.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:30 -04:00
Sujith Manoharan 10631336eb ath9k: Identify CUS252 cards
These cards are based on WB335/AR9565.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:29 -04:00
Sujith Manoharan 1823a4212b ath9k: Enable antenna diversity for WB335
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:29 -04:00
Sujith Manoharan f96bd2ad22 ath9k: Add support for AR9565 v1.0.1 LNA diversity
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:28 -04:00
Sujith Manoharan 6ac2150927 ath9k: Use correct RX gain table for AR9565
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:28 -04:00
Sujith Manoharan c946868228 ath9k: Fix antenna diversity init for AR9565
Program the HW registers (AR_PHY_CCK_DETECT, AR_PHY_MC_GAIN_CTRL)
with the correct values for AR9565 to allow LNA combining.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:28 -04:00
Sujith Manoharan 7e12d6a496 ath9k: Bypass EEPROM for diversity cap for AR9565
Use a default antenna diversity value for AR9565 instead
of relying on the EEPROM/OTP programmed value.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:27 -04:00
Sujith Manoharan 1c6bbe4739 ath9k: Update initvals for AR9565 1.0
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 15:13:27 -04:00
John W. Linville 98497bb241 Merge branch 'for-linville' of git://github.com/kvalo/ath 2013-09-26 14:54:17 -04:00
Felix Fietkau 919123d246 ath9k: add txq locking for ath_tx_aggr_start
Prevents race conditions when un-aggregated frames are pending in the
driver.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 14:02:30 -04:00
Felix Fietkau 20e6e55aaa ath9k: don't use BAW tracking on PS responses for non-AMPDU packets
When .release_buffered_frames was implemented, only A-MPDU packets were
buffered internally. Now that this has changed, the BUF_AMPDU flag needs
to be checked before calling ath_tx_addto_baw

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 14:02:29 -04:00
Sujith Manoharan d29a5fd888 ath9k: Fix regression in LNA diversity
The commit "ath9k: Optimize LNA check" tried
to use the "rs_firstaggr" flag to optimize the LNA
combining algorithm when processing subframes in
an A-MPDU. This doesn't appear to work well in practice,
so revert it and use the old method of relying on
"rs_moreaggr".

Cc: stable@vger.kernel.org # 3.11
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 14:02:29 -04:00
Felix Fietkau 440c1c874a ath9k: do not link bf_next across multiple A-MPDUs
This might trip up tx completion processing, although the condition that
triggers this should not (yet) occur in practice.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 14:02:28 -04:00
Felix Fietkau 86c7d8d416 ath9k: fix stale flag handling on buffer clone
Fixes a regression from commit
"ath9k: shrink a few data structures by reordering fields"

When cloning a buffer, the stale flag (part of bf_state now) needs to be
reset after copying the state to prevent tx processing hangs.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26 14:02:28 -04:00
Marek Puzyniak 52fa019155 ath10k: make monitor vdev down before stoping it
Following sequence causes FW crash:
-monitor vdev up,
-monitor vdev stop,
-monitor vdev delete.
Making monitor vdev down before stoping it works ok:
-monitor vdev up,
-monitor vdev down,
-monitor vdev stop,
-monitor vdev delete.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 17:30:24 +03:00
Michal Kazior 6e712d427c ath10k: replenish HTT RX buffers in a tasklet
This starves FW RX ring buffer in case of
excessive RX. This prevents from CPU being
overwhelmed by RX indications/completions by
naturally forbiddin FW to submit more RX.

This fixes RX starvation on slow machines when
under heavy RX traffic.

kvalo: remove extra newline

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 17:22:54 +03:00
Michal Kazior 4d316c79a5 ath10k: align RX frames properly
Ethernet-like decapping mode leaves IP protocol
frame not aligned to 4-byte boundaries. This leads
to re-aligning in mac80211 which in turn leads to
poor CPU cache behaviour on some machines.

Since HW doesn't allow to change payload offset
properly the solution is to force HW to decap in
Native Wifi mode which always has 24-bytes long
802.11 header (even for QoS frames). This means IP
frame is properly aligned in this decap mode.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 10:12:24 +03:00
Michal Kazior 784f69d31b ath10k: fix Native Wifi decap mode RX
NWifi decap mode always reports 802.11 Data
Frames, even when QoS Data Frames are actually
received.

This made mac80211 not report frame priority
properly (since there was no QoS Control field).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 10:12:23 +03:00
Michal Kazior e3fbf8d22a ath10k: cleanup RX decap handling
Simplify decapping code and make it easier to
understand.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 10:12:23 +03:00
Michal Kazior 26d1e9c261 ath10k: document decap modes
Clarify how each decap mode works in one place.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 10:12:23 +03:00
Michal Kazior f6dc2095a0 ath10k: report A-MSDU subframes individually
HW reports each A-MSDU subframe as a separate
sk_buff. It is impossible to configure it to
behave differently.

Until now ath10k was reconstructing A-MSDUs from
subframes which involved a lot of memory
operations. This proved to be a significant
contributor to degraded RX performance.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-26 10:12:22 +03:00
Joe Perches a3dabaf02d ath: Remove extern from function prototypes
There are a mix of function prototypes with and without extern
in the kernel sources.  Standardize on not using extern for
function prototypes.

Function prototypes don't need to be written with extern.
extern is assumed by the compiler.  Its use is as unnecessary as
using auto to declare automatic/local variables in a block.

Signed-off-by: Joe Perches <joe@perches.com>
2013-09-24 16:52:29 -07:00
Michal Kazior 1f8bb1518e ath10k: use msdu headroom to store txfrag
Instead of allocating sk_buff for a mere 16-byte
tx fragment list buffer use headroom of the
original msdu sk_buff.

This decreases CPU cache pressure and improves
performance.

Measured improvement on AP135 is 560mbps ->
590mbps of UDP TX briding traffic.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 08:18:10 +03:00
Michal Kazior 2f3773bcaf ath10k: cleanup HTT TX functions
Use a saner goto scheme for failure handling. Also
group operations more sensibly.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 08:18:10 +03:00
Michal Kazior 0a89f8a01d ath10k: decouple HTT TX completions
Until now the all MSDU transfer related structures
were freed when all resources were unreferenced.

Now HTC transfer is freed independently and HTT
transfer is so too.

This yields a way more simpler ath10k_skb_cb and
should possibly enable parallel pipe processing
(which is now serialized in
ath10k_pci_process_ce routine).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 08:18:09 +03:00
Michal Kazior 27bb178dae ath10k: avoid needless memset on TX path
This reduces number of memory accesses and
hopefully contributes to better performance in the
future.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 08:18:09 +03:00
Michal Kazior 0945baf7d4 ath10k: use num_pending_tx instead of msdu id bitmap
It's more efficient to simply check num_pending_tx
value instead of traversing whole bitmap of
msdu ids.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 08:18:09 +03:00
Michal Kazior 1073ab2e9b ath10k: fix num_sends_allowed replenishing
Commit e9bb0aa39 ("ath10k: delete struct ce_sendlist") broke
num_sends_allowed incrementing. num_sends_allowed
exceeded initial values and could overflow.

This code was supposed to replenish
num_sends_allowed for partial sendlist items (i.e.
before final sendlist item from a sendlist was
completed and could be processed by completion
handlers).

Fortunately it seems it did not cause any major breakage,
yet.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 08:04:31 +03:00
Michal Kazior 9e84f653ac ath10k: fix tracing build for ath10k_wmi_cmd
Commit be8b394390 ("ath10k: make WMI commands block by design") broke
the build if CONFIG_ATH10K_TRACING was enabled.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-20 07:59:29 +03:00
Michal Kazior 5c6c82df6b ath10k: remove wmi event worker thread
It's not really necessary to have this processed
in a worker. There are no sleepable calls (and
actually shouldn't be).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:46 +03:00
Michal Kazior 7cc2301636 ath10k: remove wmi pending count limit
It is no longer used nor necessary since WMI
commands can block.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:46 +03:00
Michal Kazior ed54388a38 ath10k: improve beacon submission latency
The patch prevents beacon misses in some case of
heavy load on a system.

If a beacon can't be transmitted directly from an
SWBA event it will be left in arvif->beacon and
transmission will be retried once TX credits
become available.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:46 +03:00
Michal Kazior 12acbc43c1 ath10k: simplify HTC command submitting
The patch removes HTC endpoint tx workers in
favour of direct command submission. This makes a
lot more sense for data path.

mac80211 queues are effectively stopped/woken up
in a more timely fashion preventing build up of
frames. It's possible to push more traffic than
the device/system is able to handle and have no
hiccups or performance degradation with UDP
traffic.

WMI commands will now report errors properly and
possibly block as they actively can wait for tx
credits to become available.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:46 +03:00
Michal Kazior be8b394390 ath10k: make WMI commands block by design
This will be necessary for further changes in
command submission scheme.

Once HTC is cleaned up WMI commands will finally
block.

This requires for SWBA to be processed in a
non-atomic context for now. Once other necessary
changes are in this will be reverted.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:46 +03:00
Michal Kazior 88e65fc337 ath10k: add HTC TX credits replenishing notification
This will allow higher layers to anticipate and
act upon TX credits renewal. This will be
important for some future rework of WMI command
submission.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:46 +03:00
Michal Kazior eeed3765f3 ath10k: simplify HTC credits calculation
Credit calculation was overly complex
unnecessarily. Now skb dequeing is more unified.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-16 19:47:45 +03:00
Jingoo Han 3699ddc55f wireless: ath10k: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 19:22:08 +03:00
Kalle Valo e9bb0aa39b ath10k: delete struct ce_sendlist
struct ce_sendlist is useless as we always add just one buffer onto it.
And most importantly, it's ugly as it doesn't use skb properly.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 19:20:30 +03:00
Sujith Manoharan 7cc45e98e5 ath10k: Calculate correct peer PHY mode for VHT
The peer PHY mode for 11ac operation needs to be determined
properly based on the channel bandwidth being used. Fix
this so that the proper mode is given to the firmware.

kvalo: earlier we used 11na-ht20 in STA mode for 11ac AP peer, this
patch changes that to 11ac-vht80. I didn't notice any change in
throughput in my tests, but nevertheless it's the right thing
to do.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 19:12:52 +03:00
Kalle Valo 38a1d47ed5 ath10k: print phymode as a string
Makes it easier to read debug logs.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:37 +03:00
Kalle Valo 60c3daa888 ath10k: clean mac.c debug messages
Just to unify with the rest of debug messages. Minimal functional changes,
only major ones are removal of the awkward "else" style in debug
messages.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:37 +03:00
Kalle Valo aad0b65f5c ath10k: add boot messages to htt.c
To unify the boot debug level.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:37 +03:00
Kalle Valo 42a2efbc57 ath10k: add boot debug messages to htc.c
To unify the boot debug level.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:37 +03:00
Kalle Valo 24cfade11e ath10k: add boot debug messages to pci.c and ce.c
To unify all boot related debug messages into one debug
level.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:37 +03:00
Kalle Valo effea9688d ath10k: cleanup debug messages in core.c
Fix them to follow the general logging style in ath10k.

While at it, add print id chip_id to the debug log.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:37 +03:00
Kalle Valo b52b7688ac ath10k: rename ATH10K_DBG_CORE to BOOT
core.c mostly deals with driver and firmware starting related
actions. And we can use the boot level also in other components,
like PCI and HTT.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:36 +03:00
Kalle Valo f0bbea9981 ath10k: add BMI log level
Also clean BMI log messages and add few more.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-12 18:21:36 +03:00
Bartosz Markowski 4ed998dcbf ath10k: define ath10k_debug_start/_stop as static inline
Otherwise if CONFIG_ATH10K_DEBUGFS won't be set we will
end up with multiple definitions and compilation failure
in each place the header is included.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-10 01:28:29 +03:00
Michal Kazior 5440ce2537 ath10k: prevent CE from looping indefinitely
The double while() could end up running forever.
Inner while() would complete very fast. However
the completion processing could take enough time
for more completions to flow in. In that case the
outer while() would not terminate and run again,
and again. This could happen especially on a slow
host system.

This could lead to a system freeze during heavy
traffic. Note: this doesn't solve all known
starvation issues yet.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-08 17:59:32 +03:00
Bartosz Markowski b8a1e00f1a ath10k: remove obsolete INIT STATUS definitions
There's no functional changes. Just a small cleanup.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06 12:50:46 +03:00
Bartosz Markowski 03fc137b50 ath10k: set the UART baud rate to 19200
When configuring the host_interests over BMI, set the UART
baud rate to 19200. This is valid for QCA988X_2.0 devices.

kvalo: found during code review, there should not be any functionality
changes

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06 12:49:17 +03:00
Kalle Valo a3d135e566 ath10k: add htt_stats_enable debugfs file
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06 12:42:26 +03:00
Kalle Valo db66ea0442 ath10k: implement ath10k_debug_start/stop()
Needed for the HTT stats implementation.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06 12:42:26 +03:00
Kalle Valo a9bf05062d ath10k: add trace event ath10k_htt_stats
For analysing various data path statistics in user space.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06 12:42:25 +03:00
Dave Jones 55d761b878 ath10k: add missing braces to ath10k_pci_tx_pipe_cleanup
The indentation here implies this was meant to be
a multi-statement if, but it lacks the braces.

kvalo: add "ath10k: " prefix

Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-06 12:31:10 +03:00
Joe Perches 7367d0b573 drivers/net: Convert uses of 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: (and a little typing)

$ 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>
2013-09-03 22:28:04 -04:00
Kalle Valo 763b8cd314 ath10k: add chip_id file to debugfs
So that's it's possible to query chip id from ath10k anytime.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:59:53 +03:00
Kalle Valo e01ae68c5d ath10k: check chip id from the soc register during probe
ath10k doesn't support qca988x hw1.0 boards anymore. Unfortunately
the PCI id is the same in hw1.0 and hw2.0 so ath10k tries to use
hw1.0 boards anyway. But without hw1.0 workarounds in place
ath10k just crashes horribly.

To avoid using hw1.0 boards at all add a chip id detection
and fail the probe if hw1.0 is detected:

[ 5265.786408] ath10k: ERROR: qca988x hw1.0 is not supported
[ 5265.786497] ath10k: Unsupported chip id 0x043200ff
[ 5265.786574] ath10k: could not register driver core (-95)
[ 5265.793191] ath10k_pci: probe of 0000:02:00.0 failed with error -95

Also add a warning if there's an unknown chip id but continue
the boot process normally anyway.

Reported-by: Zaki Bakar <zaki.bm@gmail.com>
Tested-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:54:16 +03:00
Kalle Valo e9780367b0 ath10k: simplify ath10k_ce_init() wake up handling
ath10k_ce_init() and the functions it calls wakeup
the chip multiple times. Simplify that to call
ath10k_pci_wake() only once. This also makes it
easier to add error handling when wakeup fails.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:08 +03:00
Kalle Valo 3aebe54b1c ath10k: convert ath10k_pci_wake() to return
We should not try to access hw if wakeup fails so add
proper error checking for that. Also add the timeout lenght
to the warning message.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:08 +03:00
Kalle Valo a40d3e420d ath10k: clean up ath10k_ce_completed_send_next_nolock()
The error handling was just weird, simplify it.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo e479ed437b ath10k: convert ath10k_pci_reg_read/write32() to take struct ath10k
This is consistent with all other functions.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo aa5c1db445 ath10k: remove void pointer from struct ath10k_pci_compl
Void pointers are bad, mmkay.

No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo d88effbaa6 ath10k: make target_ce_config_wlan more readable
It's easier to read t if the field names are visible.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo 48e9c225ab ath10k: pci: make host_ce_config_wlan[] more readable
It's much more readable if struct entries in host_ce_config_wlan
are explicitly set.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-03 09:49:07 +03:00
Kalle Valo a18b5ed8d2 ath10k: remove un ar_pci->cacheline_sz field
cacheline_sz is not used anywhere and can be removed.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:38:18 +03:00
Michal Kazior d21fb959d1 ath10k: rename ce_ring_state to ath10k_ce_ring
The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:28:47 +03:00
Michal Kazior 2aa3911573 ath10k: rename ce_state to ath10k_ce_pipe
The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:50 +03:00
Michal Kazior 87263e5bb4 ath10k: rename hif_ce_pipe_info to ath10k_pci_pipe
The new naming makes more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:49 +03:00
Michal Kazior 6702bad406 ath10k: remove unused ce_attr parameters
Some parameters were unused and are not required.
They have no representation in firmware. Clean
them up.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:49 +03:00
Michal Kazior 774c7e8c2b ath10k: remove ce_op_state
It was only written to and never read back. No use
to keep it around.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:27:49 +03:00
Michal Kazior 39e4086a73 ath10k: use inline ce_state structure
Simplifies memory managament of ce_state.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-09-01 09:21:45 +03:00
Sujith Manoharan 27251e0087 ath9k: Enable D3/L1 ASPM fix for AR9462
AR9462 requires this HW fix for ASPM to work properly.
Also, since WARegVal is used only for the AR8003 family,
use AR_SREV_9300_20_OR_LATER.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 13:58:27 -04:00
Sujith Manoharan 65c1a4de59 ath9k: Remove unused ANI commands
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 13:58:27 -04:00
John W. Linville f3e979a52c Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next 2013-08-28 13:51:40 -04:00
John W. Linville 53b2f82848 ath9k: ar9003_eeprom.c:3618 fix variable name typo
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c: In function 'ar9003_hw_ant_ctrl_apply':
>> drivers/net/wireless/ath/ath9k/ar9003_eeprom.c:3618: warning: 'regval' is used uninitialized in this function

It seems obvious that 'regval' should have been 'value'...

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-28 11:05:36 -04:00
John W. Linville b35c809708 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Conflicts:
	drivers/net/wireless/iwlwifi/pcie/trans.c
	net/mac80211/ibss.c
2013-08-28 10:36:09 -04:00
Mohammed Shafi Shajakhan e2951f7ff8 ath10k: Fix mutex unlock balance
ath10k_debug_read_target_stats is properly
protected by data_lock (spinlock). Remove
the unwanted mutex_unlock(&ar->conf_mutex)

[ BUG: bad unlock balance detected! ]
-------------------------------------
kworker/u4:0/12459 is trying to release lock
(&ar->conf_mutex) at:
[<c16a170d>] mutex_unlock+0xd/0x10
but there are no more locks to release!

 Call Trace:
  [<c16a170d>] ? mutex_unlock+0xd/0x10
  [<c10b697d>] __lock_release+0x4d/0xe0
  [<f88ca0fc>] ? ath10k_debug_read_target_stats+0xac/0x290

  [<c16a170d>] ? mutex_unlock+0xd/0x10
  [<c10b6a5b>] lock_release+0x4b/0x150
  [<c16a1580>] __mutex_unlock_slowpath+0x70/0x150
  [<f88ca0fc>] ? ath10k_debug_read_target_stats+0xac/0x290

  [<c10b456b>] ? trace_hardirqs_on+0xb/0x10
  [<c16a170d>] mutex_unlock+0xd/0x10
  [<f88ca107>] ath10k_debug_read_target_stats+0xb7/0x290

  [<f88d337a>] ath10k_wmi_event_process+0x3fa/0x6e0

  [<c10b456b>] ? trace_hardirqs_on+0xb/0x10
  [<f88d36e1>] ath10k_wmi_event_work+0x21/0x40
               [ath10k_core]

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2013-08-28 07:08:27 +03:00
Sujith Manoharan e5614a91be ath9k: Fix DEBUG_FS dependency for ath9k
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-26 14:10:39 -04:00
Sujith Manoharan d4c04ba141 ath9k: Fix TX poll work locking
There is no need to call ath_txq_unlock_complete() in the
TX poll routine - frame completion is not done here,
so use ath_txq_unlock().

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-26 14:09:07 -04:00
Sujith Manoharan d1ae25a017 ath9k: Fix ASPM workaround usage
The PCIE Workaround register (AR_WA/0x4004) is used to handle
various hardware quirks. For AR9002 chips, AR_WA_D3_L1_DISABLE
is used to prevent the HW from automatically entering L1 state
when D3 is enforced.

AR_WA_D3_L1_DISABLE has to be enabled for a few AR9280 based
cards, mark them based on their PCI subdevice/subvendor IDs
and enforce it in ar9002_hw_configpcipowersave().

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-08-26 14:09:06 -04:00