platform/adaptation/renesas_rcar/renesas_kernel.git
10 years agoath10k: fix core init failpath
Michal Kazior [Fri, 8 Nov 2013 07:05:18 +0000 (08:05 +0100)]
ath10k: fix core init failpath

HIF was not stopped properly in
ath10k_core_start() upon failure. This could cause
memory leaks of CE completions entries and
possibly other issues as well.

Move the HIF start/stop out of
ath10k_htc_wait_target(). The ctl_resp completion
is already prepared in ath10k_htc_init.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: reset device upon stopping/power down
Michal Kazior [Fri, 8 Nov 2013 07:01:35 +0000 (08:01 +0100)]
ath10k: reset device upon stopping/power down

This should make sure the device won't issue any
interrupts nor access any memory after the driver
is stopped/freed thus avoid memory corruption in
some cases.

Reported-By: Ben Greear <greearb@candelatech.com>
Reported-By: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add and fix some PCI prints
Michal Kazior [Fri, 8 Nov 2013 07:01:34 +0000 (08:01 +0100)]
ath10k: add and fix some PCI prints

Add missing error reporting and adjust other
prints to make everything more consistent.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: re-arrange PCI init code
Michal Kazior [Fri, 8 Nov 2013 07:01:33 +0000 (08:01 +0100)]
ath10k: re-arrange PCI init code

This patch moves irq registering after necessary
structures have been allocated and initialized.
This should prevent interrupts from causing
tasklet access invalid memory pointers.

Reported-By: Ben Greear <greearb@candelatech.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: guard against CE corruption from firmware
Michal Kazior [Fri, 8 Nov 2013 07:01:32 +0000 (08:01 +0100)]
ath10k: guard against CE corruption from firmware

In case firmware crashes it may report CE
completions for entries that were never
submitted/filled with meaningful data. This in
turn led to NULL dereferences.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: propagate ath10k_ce_disable_interrupts() errors
Michal Kazior [Fri, 8 Nov 2013 07:01:31 +0000 (08:01 +0100)]
ath10k: propagate ath10k_ce_disable_interrupts() errors

This shouldn't be silenced. This will be necessary
for PCI init code reordering.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: use ath10k_do_pci_wake/sleep
Michal Kazior [Fri, 8 Nov 2013 07:01:30 +0000 (08:01 +0100)]
ath10k: use ath10k_do_pci_wake/sleep

This removes some remaining direct use of the wake
register which could interfere with power state
tracking of the target device. This will allow
initialization code reordering.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: remove meaningless check
Michal Kazior [Fri, 8 Nov 2013 07:01:29 +0000 (08:01 +0100)]
ath10k: remove meaningless check

The check doesn't make much sense. If the address
were to be 0x0000 the check would fail. In this
case a 0 address isn't wrong.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix ath10k_ce_init() failpath
Michal Kazior [Fri, 8 Nov 2013 07:01:28 +0000 (08:01 +0100)]
ath10k: fix ath10k_ce_init() failpath

Make sure to put target back to sleep. This was a
minor issue as it didn't really matter if we put
target back to sleep at this point. It just looked
wrong.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: make sure to mask all CE irqs
Michal Kazior [Fri, 8 Nov 2013 07:01:27 +0000 (08:01 +0100)]
ath10k: make sure to mask all CE irqs

CE error interrupts were not disabled. This could
lead to invalid memory accesses / memory
corruption.

Also make sure CE watermark interrupts are also
disabled.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: rename ath10k_pci_reset_target()
Michal Kazior [Fri, 8 Nov 2013 07:01:26 +0000 (08:01 +0100)]
ath10k: rename ath10k_pci_reset_target()

What the function does is to actually wait for the
firmware indication bit to be set. Prerequisite
for this is having interrupts registered.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: split tasklet killing function
Michal Kazior [Fri, 8 Nov 2013 07:01:25 +0000 (08:01 +0100)]
ath10k: split tasklet killing function

The function will soon be called from more than 1
place.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: don't forget to kill fw error tasklet
Michal Kazior [Fri, 8 Nov 2013 07:01:24 +0000 (08:01 +0100)]
ath10k: don't forget to kill fw error tasklet

It was possible for FW error tasklet to be
executed during teardown. This could lead to
system crashes and/or memory corruption.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: remove ar_pci->ce_count
Michal Kazior [Fri, 8 Nov 2013 07:01:23 +0000 (08:01 +0100)]
ath10k: remove ar_pci->ce_count

It wasn't really useful to have it to begin with.
This makes it a little simpler to re-arrange PCI
init code as some function depended on
ar_pci->ce_count being set.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add logging to better determine some VIF/STA creation failures
Ben Greear [Mon, 4 Nov 2013 17:19:34 +0000 (09:19 -0800)]
ath10k: add logging to better determine some VIF/STA creation failures

Not all errors were properly notified, fix that.

kvalo: use ath10k_warn() for all messages, cosmetic changes to some of the messages

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: Fix un-initialized debug objects.
Ben Greear [Mon, 4 Nov 2013 17:18:16 +0000 (09:18 -0800)]
ath10k: Fix un-initialized debug objects.

If the 'ar' registration fails early, the debug
objects were not initialized, and trouble ensued when
the object was later destroyed and the un-initialized
objects were accessed.

Per Kalle's suggestion, move the debug_destroy to the
core_unregister method.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix possible memory leak in ath10k_pci_probe()
Wei Yongjun [Wed, 30 Oct 2013 05:24:39 +0000 (13:24 +0800)]
ath10k: fix possible memory leak in ath10k_pci_probe()

memory is malloced in ath10k_pci_probe() and should be freed before
leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: plug memory leak on beacon tx
Michal Kazior [Mon, 28 Oct 2013 06:18:14 +0000 (07:18 +0100)]
ath10k: plug memory leak on beacon tx

If beacon tx command failed the wmi command buffer
was not freed. This led to OOM in the long run.
This became aparent when stress testing
multi-BSSID.

Reported-By: Tomasz Skapski <tomasz.skapski@tieto.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: plug memory leak in wmi mgmt tx worker
Michal Kazior [Mon, 28 Oct 2013 06:18:13 +0000 (07:18 +0100)]
ath10k: plug memory leak in wmi mgmt tx worker

sk_buff was not freed in some cases. The patch
unifies the msdu freeing.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: respect power_level values
Michal Kazior [Wed, 23 Oct 2013 11:02:15 +0000 (04:02 -0700)]
ath10k: respect power_level values

This allows txpower limits other than regulatory
to be applied (e.g. user txpower limit provided
via iw/nl80211).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: use proper tx power unit
Michal Kazior [Wed, 23 Oct 2013 11:02:14 +0000 (04:02 -0700)]
ath10k: use proper tx power unit

It was previously thought that FW expects tx power
in quarters of dBm.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: setup min channel power to a reasonable value
Michal Kazior [Wed, 23 Oct 2013 11:02:13 +0000 (04:02 -0700)]
ath10k: setup min channel power to a reasonable value

This will be needed for proper support of (user)
configurable tx power level.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: Initialize list-head on vif creation.
Ben Greear [Tue, 22 Oct 2013 21:54:14 +0000 (14:54 -0700)]
ath10k: Initialize list-head on vif creation.

If the creation fails, this keeps us from crashing later when
trying to do a list_del(arvif->list).

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add error handling to ath10k_pci_wait()
Kalle Valo [Thu, 17 Oct 2013 08:36:15 +0000 (11:36 +0300)]
ath10k: add error handling to ath10k_pci_wait()

ath10k_pci_wait() didn't notify any errors to callers, it
just printed a warning so add proper error handling. This fixes
a crash Ben reported:

ath10k: MSI-X interrupt handling (8 intrs)
ath10k: Unable to wakeup target
ath10k: target took longer 5000 us to wake up (awake count 1)
ath10k: Failed to get pcie state addr: -16
ath10k: early firmware event indicated
BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
IP: [<ffffffffa06ae46c>] ath10k_ce_completed_send_next+0x47/0x122 [ath10k_pci]

Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix FW crashes on heavy TX on 10.1.389 AP FW
Michal Kazior [Wed, 16 Oct 2013 13:46:24 +0000 (16:46 +0300)]
ath10k: fix FW crashes on heavy TX on 10.1.389 AP FW

10.1.389 firmware has some differences in
calculation of number of outstanding HTT TX
completions. This led to FW crashes of 10.1.389
while main firmware branch was unnaffected.

The patch makes sure ath10k doesn't queue up more
MSDUs than it should.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: implement ath10k_pci_soc_read/write32()
Kalle Valo [Wed, 16 Oct 2013 13:46:11 +0000 (16:46 +0300)]
ath10k: implement ath10k_pci_soc_read/write32()

To make it easier to access SOC registers. No functional
changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix NULL deref upon early FW crash
Michal Kazior [Wed, 16 Oct 2013 13:46:05 +0000 (16:46 +0300)]
ath10k: fix NULL deref upon early FW crash

If firmware crashes during FW probing it would try
to perform FW recovery which uses mac80211
workqueue before registering to mac80211.

Using internal workqueue solves the problem.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix NSS reporting in RX
Michal Kazior [Wed, 16 Oct 2013 13:45:59 +0000 (16:45 +0300)]
ath10k: fix NSS reporting in RX

NSTS values reported in the VHT-SIG-A1 are 0
through 7 but they actually describe number of
streams 1 through 8.

1SS frames were dropped. This patch fixes this.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix endianess in prints
Michal Kazior [Wed, 16 Oct 2013 13:45:53 +0000 (16:45 +0300)]
ath10k: fix endianess in prints

This fixes incorrect values being printed on
big-endian hosts.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: add sanity checks for monitor management
Michal Kazior [Wed, 16 Oct 2013 13:45:48 +0000 (16:45 +0300)]
ath10k: add sanity checks for monitor management

Add a few checks and warnings to make it easier to
track any kind of monitor vdev mismanagement.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: prevent starting monitor without a vdev
Michal Kazior [Wed, 16 Oct 2013 13:45:41 +0000 (16:45 +0300)]
ath10k: prevent starting monitor without a vdev

This fixes issue with interface bridging.

Linux bridging sets promiscuous mode for all
interfaces that are in a bridge. This translates
to configure_filter() being called in a mac80211
driver.

Before the patch operational interface would be
started and upped again when promiscuous mode was
enabled causing all sorts of strange issues:

 * no HTT RX happening (i.e. no traffic)
 * FW crash upon driver reload/unload

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agort2x00: rt2800pci: use module_pci_driver macro
Gabor Juhos [Thu, 17 Oct 2013 07:42:35 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use module_pci_driver macro

Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move SoC specific code into a separate module
Gabor Juhos [Thu, 17 Oct 2013 07:42:34 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move SoC specific code into a separate module

The PCI and SoC specific drivers are using separate
code now so it is not reasonable to use the same
module for both drivers anymore.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use separate hwcrypt_disabled callback for SoC devices
Gabor Juhos [Thu, 17 Oct 2013 07:42:33 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use separate hwcrypt_disabled callback for SoC devices

The 'rt2800pci_hwcrypt_disabled' function is the
only PCI specific callback which is used by the
SoC driver. Create a clone of that to get rid of
the dependency.

Even though the two functions are using the same
variable, but the SoC specific code will be moved
into a separate module which will have its own
'modparam_nohwcrypt' variable.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move rt2800mmio_enable_radio function to another module
Gabor Juhos [Thu, 17 Oct 2013 07:42:32 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move rt2800mmio_enable_radio function to another module

Move the function into the rt2800mmio module, in order
to make it usable from other modules.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: split rt2800pci_enable_radio function
Gabor Juhos [Thu, 17 Oct 2013 07:42:31 +0000 (09:42 +0200)]
rt2x00: rt2800pci: split rt2800pci_enable_radio function

The function is called for PCI and SoC devices
however the MCU related part of the function
has no effect on SoC devices. Move the common
part of the function into a separate helper and
use that for the SoC devices.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: rename rt2800pci_disable_radio function
Gabor Juhos [Thu, 17 Oct 2013 07:42:30 +0000 (09:42 +0200)]
rt2x00: rt2800pci: rename rt2800pci_disable_radio function

The function contain code for SoC devices only.
Rename the function to 'rt2800soc_disable_radio'
and move it to the SoC specific section. Use
the renamed function in the SoC specific code
only and remove the 'if rt2x00_is_soc(rt2x00dev)'
condition from the function body.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use separate set_state callback for SoC devices
Gabor Juhos [Thu, 17 Oct 2013 07:42:29 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use separate set_state callback for SoC devices

The 'rt2800pci_set_state' function uses MCU commands
to set the device state, however these have no effect
on SoC devices. Use a different set_state callback
which does not use the MCU fcuntions.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use separate firmware callbacks for SoC devices
Gabor Juhos [Thu, 17 Oct 2013 07:42:28 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use separate firmware callbacks for SoC devices

Use empty firmware callbacks for SoC devices because those
don't require firmware.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use separate read_eeprom callback for SoC devices
Gabor Juhos [Thu, 17 Oct 2013 07:42:27 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use separate read_eeprom callback for SoC devices

Rename the 'rt2800pci_read_eeprom_soc function' to
'rt2800soc_read_eeprom' and use that directly in the
SoC specific 'rt2800_ops' structure. Also move the
'rt2800pci_eeprom_read' function into an 'ifdef PCI'
section and remove the 'rt2800pci_read_eeprom_soc'
call from that.

Additionally, remove the dummy inline eeprom functions.
Those are not used anymore.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use separate ops for the SoC driver
Gabor Juhos [Thu, 17 Oct 2013 07:42:26 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use separate ops for the SoC driver

This makes it possible to use different callback
functions for PCI and SoC devices which will allow
to move the SoC driver into a separate module.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move initialization functions to the rt2800mmio module
Gabor Juhos [Thu, 17 Oct 2013 07:42:25 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move initialization functions to the rt2800mmio module

Move the functions into a separate module, in order
to make those usable from other modules.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use rt2800mmio prefix for initialization functions
Gabor Juhos [Thu, 17 Oct 2013 07:42:24 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use rt2800mmio prefix for initialization functions

The functions are used for devices with memory
mapped I/O and contain no PCI specific code at
all. Use rt2800mmio prefix instead of rt2800pci
in the function names to reflect that.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move queue functions to the rt2800mmio module
Gabor Juhos [Thu, 17 Oct 2013 07:42:23 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move queue functions to the rt2800mmio module

Move the functions into a separate module, in order
to make those usable from other modules. Also move
the queue register offset macros from rt2800pci.h
into rt2800mmio.h.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use rt2800mmio prefix for queue functions
Gabor Juhos [Thu, 17 Oct 2013 07:42:22 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use rt2800mmio prefix for queue functions

The functions are used for devices with memory
mapped I/O and contain no PCI specific code at
all. Use rt2800mmio prefix instead of rt2800pci
in the function names to reflect that.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move interrupt functions to the rt2800mmio module
Gabor Juhos [Thu, 17 Oct 2013 07:42:21 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move interrupt functions to the rt2800mmio module

Move the functions into a separate module, in order
to make those usable from other modules.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use rt2800mmio prefix for interrupt functions
Gabor Juhos [Thu, 17 Oct 2013 07:42:20 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use rt2800mmio prefix for interrupt functions

The functions are used for devices with memory
mapped I/O and contain no PCI specific code at
all. Use rt2800mmio prefix instead of rt2800pci
in the function names to reflect that.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move RX control handler functions to the rt2800mmio module
Gabor Juhos [Thu, 17 Oct 2013 07:42:19 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move RX control handler functions to the rt2800mmio module

Move the functions into a separate module, in order
to make those usable from other modules. Also move
the RX descriptor related defines from rt2800pci.h
into rt2800mmio.h

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use rt2800mmio prefix for RX control handler functions
Gabor Juhos [Thu, 17 Oct 2013 07:42:18 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use rt2800mmio prefix for RX control handler functions

The functions are used for devices with memory
mapped I/O and contain no PCI specific code at
all. Use rt2800mmio prefix instead of rt2800pci
in the function names to reflect that.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: move TX descriptor functions to the rt2800mmio module
Gabor Juhos [Thu, 17 Oct 2013 07:42:17 +0000 (09:42 +0200)]
rt2x00: rt2800pci: move TX descriptor functions to the rt2800mmio module

Move the functions into a separate module, in order
to make those usable from other modules. Also move
the TX descriptor related defines from rt2800pci.h
into rt2800mmio.h.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800pci: use rt2800mmio prefix for TX descriptor functions
Gabor Juhos [Thu, 17 Oct 2013 07:42:16 +0000 (09:42 +0200)]
rt2x00: rt2800pci: use rt2800mmio prefix for TX descriptor functions

The functions are used for devices with memory
mapped I/O and contain no PCI specific code at
all. Use rt2800mmio prefix instead of rt2800pci
in the function names to reflect that.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: create a new module for rt2800 MMIO code
Gabor Juhos [Thu, 17 Oct 2013 07:42:15 +0000 (09:42 +0200)]
rt2x00: create a new module for rt2800 MMIO code

Create a new module for common code which can be used
for rt2800 device with memory mapped I/O. It is an empty
module for now, but it will be populated by subsequent
patches.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agodrivers: net: wireless: Fix wrong check for reassociation request retry counter
Felipe Pena [Wed, 16 Oct 2013 00:07:47 +0000 (21:07 -0300)]
drivers: net: wireless: Fix wrong check for reassociation request retry counter

There is a typo where the checking for priv->ReAssociationRequestRetryCnt must
be, it was checking for priv->AssociationRequestRetryCnt instead.

Signed-off-by: Felipe Pena <felipensp@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support
Arend van Spriel [Tue, 15 Oct 2013 13:44:57 +0000 (15:44 +0200)]
brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support

If the SDIO host controller does not support scatter-gather the glom
superframe must be transfered from the device and the data for each
packet in the queue must be extracted from it.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: fix brcmf_sdio_txpkt_prep() for host without sg support
Arend van Spriel [Tue, 15 Oct 2013 13:44:56 +0000 (15:44 +0200)]
brcmfmac: fix brcmf_sdio_txpkt_prep() for host without sg support

When running on a host controller that does not support scatter-gather
transfers the function brcmf_sdio_txpkt_prep() should not add tail
padding buffers.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: fix brcmf_sdcard_send_pkt() for host without sg support
Arend van Spriel [Tue, 15 Oct 2013 13:44:55 +0000 (15:44 +0200)]
brcmfmac: fix brcmf_sdcard_send_pkt() for host without sg support

If the host does not support scatter-gather transmit the packets
in the pktq individually using brcmf_sdio_buffrw().

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove stale code from brcmf_sdcard_recv_chain()
Arend van Spriel [Tue, 15 Oct 2013 13:44:54 +0000 (15:44 +0200)]
brcmfmac: remove stale code from brcmf_sdcard_recv_chain()

The function brcmf_sdcard_recv_chain() has been reworked with
commit "brcmfmac: add sdio sg list support", but the incr_fix
variable is only assigned but not used so removing it now.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: verify result of brcmf_sdio_addrprep() calls
Arend van Spriel [Tue, 15 Oct 2013 13:44:53 +0000 (15:44 +0200)]
brcmfmac: verify result of brcmf_sdio_addrprep() calls

Not all calls to the function brcmf_sdio_addrprep() check
the return value, but it may fail so better verify it.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: rework single packet transfers
Arend van Spriel [Tue, 15 Oct 2013 13:44:52 +0000 (15:44 +0200)]
brcmfmac: rework single packet transfers

The function brcmf_sdio_sglist_rw() does a different code path
when packet queue length is 1. Move this to a separate function
reducing overhead in the calling context.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: rename brcmf_sdio_buffrw()
Arend van Spriel [Tue, 15 Oct 2013 13:44:51 +0000 (15:44 +0200)]
brcmfmac: rename brcmf_sdio_buffrw()

The function brcmf_sdio_buffrw() is intended to be used for
transfering list of packets using scatter-gather functionality.
Rename function to brcmf_sdio_sglist_rw() to clarify this.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: rework scatter-gather code in brcmf_sdio_buffrw()
Arend van Spriel [Tue, 15 Oct 2013 13:44:50 +0000 (15:44 +0200)]
brcmfmac: rework scatter-gather code in brcmf_sdio_buffrw()

Moving a number of assignments outside of the loop as they are
the same for each request.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: determine host controller related variables during probe
Arend van Spriel [Tue, 15 Oct 2013 13:44:49 +0000 (15:44 +0200)]
brcmfmac: determine host controller related variables during probe

Instead of determining the limits for scatter-gather MMC transfer
request upon each transmit it is now determined during the probe
of the SDIO function.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: rename variable max_seg_sz to max_seg_cnt for clarity
Arend van Spriel [Tue, 15 Oct 2013 13:44:48 +0000 (15:44 +0200)]
brcmfmac: rename variable max_seg_sz to max_seg_cnt for clarity

The variable max_seg_sz in brcmf_sdio_buffrw() respresents the maximum
number of buffers that can be sent in one MMC transfer request. Rename
it to max_seg_cnt to avoid confusion.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: add tracepoint for capturing the SDPCM header
Arend van Spriel [Tue, 15 Oct 2013 13:44:47 +0000 (15:44 +0200)]
brcmfmac: add tracepoint for capturing the SDPCM header

Having the SDPCM header information in the traces is a valuable
piece of information.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: store address in trace_brcmf_hexdump()
Arend van Spriel [Tue, 15 Oct 2013 13:44:46 +0000 (15:44 +0200)]
brcmfmac: store address in trace_brcmf_hexdump()

The trace function trace_brcmf_hexdump() stores the length, but
having the address of the buffer being dumped helps putting it
in context.

Reviewed-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add TX99 support
Luis R. Rodriguez [Tue, 15 Oct 2013 00:42:11 +0000 (17:42 -0700)]
ath9k: add TX99 support

TX99 support enables Specific Absorption Rate (SAR) testing.
SAR is the unit of measurement for the amount of radio frequency(RF)
absorbed by the body when using a wireless device. The RF
exposure limits used are expressed in the terms of SAR, which is a
measure of the electric and magnetic field strength and power density
for transmitters operating at frequencies from 300 kHz to 100 GHz.

Regulatory bodies around the world require that wireless device
be evaluated to meet the RF exposure limits set forth in the
governmental SAR regulations.

In the examples below, for more bit rate options see the iw TX bitrate
setting documentation:

http://wireless.kernel.org/en/users/Documentation/iw#Modifying_transmit_bitrates

Example usage:

iw phy phy0 interface add moni0 type monitor
ip link set dev moni0 up

iw dev moni0 set channel 36 HT40+
iw set bitrates mcs-5 4

echo 10 > /sys/kernel/debug/ieee80211/phy0/ath9k/tx99_power
echo 1  > /sys/kernel/debug/ieee80211/phy0/ath9k/tx99

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: check for NULL rate when using ieee80211_get_rts_cts_rate()
Luis R. Rodriguez [Tue, 15 Oct 2013 00:42:10 +0000 (17:42 -0700)]
ath9k: check for NULL rate when using ieee80211_get_rts_cts_rate()

ieee80211_get_rts_cts_rate() can return NULL, so don't rely
on its members when it does return NULL.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath: add support for proper dynamic regulatory hints
Luis R. Rodriguez [Tue, 15 Oct 2013 00:42:09 +0000 (17:42 -0700)]
ath: add support for proper dynamic regulatory hints

This enables support for dynamic user regulatory hints.
This is enabled only when CFG80211_CERTIFICATION_ONUS
is selected. For US and JP this is explicitly disabled
unless the systems are being used for strict controlled
testing.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath: split user and driver reguluatory hint parsing
Luis R. Rodriguez [Tue, 15 Oct 2013 00:42:08 +0000 (17:42 -0700)]
ath: split user and driver reguluatory hint parsing

On the regulatory notifier split up the parsing of the
hints coming from drivers or user. We'll treat these
separately.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath: move common dynamic regulatory domain setting to a helper
Luis R. Rodriguez [Tue, 15 Oct 2013 00:42:07 +0000 (17:42 -0700)]
ath: move common dynamic regulatory domain setting to a helper

This moves the dynamic regulatory domain selection code into
a helper.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocfg80211: export reg_initiator_name()
Luis R. Rodriguez [Tue, 15 Oct 2013 00:42:06 +0000 (17:42 -0700)]
cfg80211: export reg_initiator_name()

Drivers can now use this to parse the regulatory request and
be more verbose when needed.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800lib: autodetect 5GHz band support
Gabor Juhos [Mon, 14 Oct 2013 19:59:52 +0000 (21:59 +0200)]
rt2x00: rt2800lib: autodetect 5GHz band support

If the RF chip supports more than 14 channels that
indirectly means that it supports the 5GHz band.
Use this fact to enable 5GHz band support instead
of setting SUPPORT_BAND_5GHZ separately for each
RF chip.

Also move the setup code of the 2GHz band to the
same place.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800lib: use switch statement for RF specific setup
Gabor Juhos [Mon, 14 Oct 2013 19:59:51 +0000 (21:59 +0200)]
rt2x00: rt2800lib: use switch statement for RF specific setup

It is much more readable than multiple if-else-if
statements.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800lib: use {tx,rx}_chain_num to avoid superfluous EEPROM access
Gabor Juhos [Mon, 14 Oct 2013 19:59:50 +0000 (21:59 +0200)]
rt2x00: rt2800lib: use {tx,rx}_chain_num to avoid superfluous EEPROM access

The {rx,tx}_chain_num fields of rt2x00dev->default_ant
contains the number of RX and TX chains already when the
rt2800_probe_hw_mode() function runs. Use those values
instead of parsing the EEPROM configuration values again.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k/ath: move dfs pattern detector to ath
Janusz Dziedzic [Mon, 14 Oct 2013 09:06:06 +0000 (11:06 +0200)]
ath9k/ath: move dfs pattern detector to ath

Move the DFS pattern detector code to the ath module so
the other Atheros drivers can make us of it. This makes
no functional changes.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: dfs use CFG80211_CERTIFICATION_ONUS flag
Janusz Dziedzic [Mon, 14 Oct 2013 09:06:05 +0000 (11:06 +0200)]
ath9k: dfs use CFG80211_CERTIFICATION_ONUS flag

Use CFG80211_CERTIFICATION_ONUS flag in the DFS
detector code. This is required as a preparation
for moving DFS detector code from ath9k to ath
module.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: dfs move ath_dfs_pool_stats
Janusz Dziedzic [Mon, 14 Oct 2013 09:06:04 +0000 (11:06 +0200)]
ath9k: dfs move ath_dfs_pool_stats

Move ath_dfs_pool_stats to dfs_pattern_detector
code to be not specyfic only for ath9k.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: dfs kill ath9k specyfic code
Janusz Dziedzic [Mon, 14 Oct 2013 09:06:03 +0000 (11:06 +0200)]
ath9k: dfs kill ath9k specyfic code

Kill of using ath9k_hw_common() function
in dfs detector code.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agolibertas: move firmware lifetime handling to firmware.c
Dan Williams [Mon, 14 Oct 2013 22:51:55 +0000 (17:51 -0500)]
libertas: move firmware lifetime handling to firmware.c

Previously, each bus type was responsible for freeing the firmware
structure, but some did that badly.  Move responsibility for freeing
firmware into firmware.c so that it's done once and correctly, instead
of happening in multiple places in bus-specific code.

This fixes a use-after-free bug found by Dr. H. Nikolaus Schaller where
the SDIO code forgot to NULL priv->helper_fw after freeing it.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add HT40 spectral scan capability
Lorenzo Bianconi [Fri, 11 Oct 2013 12:09:55 +0000 (14:09 +0200)]
ath9k: add HT40 spectral scan capability

Add spectral scan feature on HT40 channels for ath9k. This patch extends
previous capability added by Simon Wunderlich

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Reviewed-by: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Tested-by: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: add noise floor parameter to ath9k_hw_getchan_noise
Lorenzo Bianconi [Fri, 11 Oct 2013 12:09:54 +0000 (14:09 +0200)]
ath9k: add noise floor parameter to ath9k_hw_getchan_noise

Add nf parameter to ath9k_hw_getchan_noise() in order to compute NF for EXT
chains with the same scale of noise floor calculated on CTL chains.
ath9k_hw_getchan_noise() will be used in ath_process_fft() for spectral scan on
HT40 channels

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge tag 'nfc-next-3.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
John W. Linville [Fri, 18 Oct 2013 17:59:28 +0000 (13:59 -0400)]
Merge tag 'nfc-next-3.13-1' of git://git./linux/kernel/git/sameo/nfc-next

Samuel Ortiz <sameo@linux.intel.com> says:

"This is the first NFC pull request for the 3.13 kernel.
It's a fairly big one, with the following highlights:

- NFC digital layer implementation: Most NFC chipsets implement the NFC
  digital layer in firmware, but others have more basic functionalities
  and expect the host to implement the digital layer. This layer sits
  below the NFC core.

- Sony's port100 support: This is "soft" NFC USB dongle that expects the
  digital layer to be implemented on the host. This is the first user of
  our NFC digital stack implementation.

- Secure element API: We now provide a netlink API for enabling,
  disabling and discovering NFC attached (embedded or UICC ones) secure
  elements. With some userspace help, this allows us to support NFC
  payments.
  Only the pn544 driver currently supports that API.

- NCI SPI fixes and improvements: In order to support NCI devices over
  SPI, we fixed and improved our NCI/SPI implementation. The currently
  most deployed NFC NCI chipset, Broadcom's bcm2079x, supports that mode
  and we're planning to use our NCI/SPI framework to implement a
  driver for it.

- pn533 fragmentation support in target mode: This was the only missing
  feature from our pn533 impementation. We now support fragmentation in
  both Tx and Rx modes, in target mode."

Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Fri, 18 Oct 2013 17:58:13 +0000 (13:58 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

11 years agoMerge branch 'for-linville' of git://github.com/kvalo/ath
John W. Linville [Fri, 18 Oct 2013 17:57:09 +0000 (13:57 -0400)]
Merge branch 'for-linville' of git://github.com/kvalo/ath

11 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Fri, 18 Oct 2013 17:56:17 +0000 (13:56 -0400)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

11 years agoiwlwifi: mvm: fix operator precedence
David Spinadel [Thu, 17 Oct 2013 06:49:12 +0000 (09:49 +0300)]
iwlwifi: mvm: fix operator precedence

Integers need to be multiplied before division.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: mvm: fix fw_rx_stats debugfs entry
Luciano Coelho [Mon, 14 Oct 2013 10:18:41 +0000 (13:18 +0300)]
iwlwifi: mvm: fix fw_rx_stats debugfs entry

The fw_rx_stats entry in debugfs was getting truncated because the
internal buffer used to hold the string was too short.  The
calculation of the needed buffer size was rather bogus.

Simplify the calculation by multiplying the number of entries in the
entire structure by the size of each data line and adding the size of
the header lines.

Additionally, add the mac_id value, which was missing.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: mvm: BT Coex - enable Tx power based on BT status
Emmanuel Grumbach [Tue, 15 Oct 2013 09:37:38 +0000 (12:37 +0300)]
iwlwifi: mvm: BT Coex - enable Tx power based on BT status

The activity grading indication from the firmware should
not be used in this case, but the bt_status in the firwmare
notification.
Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: mvm: BT Coex - always set mandatory fields
Emmanuel Grumbach [Mon, 14 Oct 2013 15:52:23 +0000 (18:52 +0300)]
iwlwifi: mvm: BT Coex - always set mandatory fields

The firmware always expects the Coex Mode to be set.
Moreover, the firmware expects bit 0 is the valid bits to
be set all the times.
I misunderstood the API and didn't set these bits when
commands are sent to update the paramters of the Coex. As
a result, the firmware understood that the BT Coex was
disabled (Coex mode = 0) and ignored all the updates (valid
bit 0 clear).

Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: mvm: NVM - increase max section size
Idan Kahlon [Wed, 9 Oct 2013 14:09:13 +0000 (16:09 +0200)]
iwlwifi: mvm: NVM - increase max section size

Section size limitation to 6000 is incorrect.
NVM file need to support bigger sections in order
to support PAPD tables.

Signed-off-by: Idan Kahlon <idanx.kahlon@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Maor Perez <maorx.perez@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoath10k: add might_sleep() to ath10k_wmi_cmd_send()
Kalle Valo [Wed, 16 Oct 2013 12:44:47 +0000 (15:44 +0300)]
ath10k: add might_sleep() to ath10k_wmi_cmd_send()

ath10k_wmi_cmd_send() will now sleep if there are no credits available.
To make it easier to catch callers in atomic context add might_sleep()
to the function.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix ath10k_bss_assoc() to not sleep in atomic context
Kalle Valo [Wed, 16 Oct 2013 12:44:46 +0000 (15:44 +0300)]
ath10k: fix ath10k_bss_assoc() to not sleep in atomic context

ath10k_bss_assoc() was calling ath10k_peer_assoc(), which can sleep, under
atomic rcu_read_lock() and causing scheduing while atomic errors. Workaround
that by delaying the call to ath10k_wmi_peer_assoc().

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: remove unnecessary checks
Michal Kazior [Wed, 16 Oct 2013 12:44:46 +0000 (15:44 +0300)]
ath10k: remove unnecessary checks

mac80211 interface iteration functions that were
used originally iterated over interfaces that
weren't re-added to the driver during recovery.

Since internal vif list is now used it's safe to
remove the safe-guard as internal vif list is
based on add/remove_interface function which
guarantees that vdev is created in FW before it is
iterated over.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix scheduling while atomic config bug
Michal Kazior [Wed, 16 Oct 2013 12:44:46 +0000 (15:44 +0300)]
ath10k: fix scheduling while atomic config bug

Recent HTC/WMI changes introduced the bug. ath10k
was using _atomic iteration function with
sleepable functions.

mac80211 provides another iteration function but
it cannot be safely called in hw_config() callback
due to local->iflist_mtx being possibly acquired
already.

The patch uses internal vif list for iteration
purposes and removes/refactors no longer necessary
_iter functions.

Reported-By: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: track vif list internally
Michal Kazior [Wed, 16 Oct 2013 12:44:45 +0000 (15:44 +0300)]
ath10k: track vif list internally

mac80211 interface interations functions have
peculiar locking issues. This patch introduces
internal (to ath10k) vif list that will be used
for vif iteration purposes.

kvalo: remove extra INIT_LIST_HEAD()

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: fix add_interface failure handling
Michal Kazior [Wed, 16 Oct 2013 12:44:45 +0000 (15:44 +0300)]
ath10k: fix add_interface failure handling

If something failed along add_interface() setup it
was possible to leak a vdev id, vdev and peer.

This could end up with leaked FW state or FW crash
(assuming add_interface() failure wasn't a result of
a crash).

kvalo: rebased, whitespace fixes

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: use workqueue to set WEP TX key
Michal Kazior [Wed, 16 Oct 2013 12:44:45 +0000 (15:44 +0300)]
ath10k: use workqueue to set WEP TX key

Recent WMI/HTC changes made it possible for WMI
commands to sleep (if there's not enough HTC TX
credits to submit a command). TX path is in an
atomic context so calling WMI commands in it is
wrong.

This simply moves WEP key index update to a worker
and fixes the 'scheduling while atomic' bug.

This still leaves multiple WEP key handling laggy,
i.e. some frames may be TXed with an old/different
key (although recipient should still be able to RX
them).

kvalo: changed the title

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: return better errno for unsupported pdev params
Bartosz Markowski [Tue, 15 Oct 2013 07:55:32 +0000 (09:55 +0200)]
ath10k: return better errno for unsupported pdev params

Return -EOPNOTSUPP if given parameter is not supported by firmware.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: rename WMI_CMD_UNDEFINED
Bartosz Markowski [Tue, 15 Oct 2013 07:55:31 +0000 (09:55 +0200)]
ath10k: rename WMI_CMD_UNDEFINED

Rename WMI_CMD_UNDEFINED to WMI_CMD_UNSUPPORTED. This is more
accurate here. Also return -EOPNOTSUPP instead of -EINVAL in
wmi_cmd_send().

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath10k: do not warn about unsupported vdev param
Bartosz Markowski [Tue, 15 Oct 2013 07:26:20 +0000 (09:26 +0200)]
ath10k: do not warn about unsupported vdev param

10.X firmware does not support WMI_VDEV_PARAM_TX_ENCAP_TYPE.
It's a known limitation and we should not warn about this.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>