OSDN Git Service

android-x86/kernel.git
8 years agoath10k: process htt rx indication as batch mode
Rajkumar Manoharan [Fri, 12 Feb 2016 06:10:59 +0000 (11:40 +0530)]
ath10k: process htt rx indication as batch mode

On multicore systems, it is possible that txrx tasket can run
in parallel with pci tasklet (i.e smp affinity of ath10k irq is
assigned to multiple CPUs). Feeding and consuming from the same
rx completion list leads to txrx tasklet runs for longer period.
Prevent this by processing a snapshot of rx queue by moving list
into temporary list. Consecutive received frames will be processed
in next batch.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: reduce rx_lock contention for htt rx indication
Rajkumar Manoharan [Fri, 12 Feb 2016 06:10:58 +0000 (11:40 +0530)]
ath10k: reduce rx_lock contention for htt rx indication

Received frame indications are queued into a skb list and latest
processed by txrx tasklet. This skb queue is protected by htt rx lock.
Since the entire rx processing till delivering frame to mac80211 and
replenish tasks are processed under rx_lock protection, there might be
some delay in queuing newly received rx frame into that list on
multicore systems. Optimize this by using skb list lock while accessing
rx completion queue instead of htt rx lock.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix erroneous return value
Anton Protopopov [Wed, 10 Feb 2016 16:58:55 +0000 (11:58 -0500)]
ath10k: fix erroneous return value

The ath10k_pci_hif_exchange_bmi_msg() function may return the positive
value EIO instead of -EIO in case of error.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add hw_rev to trace events to support pktlog
Ashok Raj Nagarajan [Fri, 5 Feb 2016 15:42:49 +0000 (21:12 +0530)]
ath10k: add hw_rev to trace events to support pktlog

pktlog data is different between firmware variants (eg. 10.2 vs 10.4). To
have a unified user space script to decode pktlog trace events generated,
it is desirable to know which firmware variant has provided the events and
thereby decode the pktlogs appropriately. Hardware revision (hw_rev) helps
to determine the firmware variant sending these trace events. So add hw_rev
to trace events.

Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix pktlog in QCA99X0
Ashok Raj Nagarajan [Fri, 5 Feb 2016 15:42:48 +0000 (21:12 +0530)]
ath10k: fix pktlog in QCA99X0

Currently, we are providing wrong payload data of pktlog to trace points.
Data we receive from FW through copy engine 8 contains pktlog data alone.
We don't need to parse anything in driver before handing it to trace
points.

Fixes: afb0bf7f530b ("ath10k: add support for pktlog in QCA99X0")
Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix pointless update of peer stats list
Mohammed Shafi Shajakhan [Wed, 3 Feb 2016 15:37:43 +0000 (21:07 +0530)]
ath10k: fix pointless update of peer stats list

We periodically receive f/w stats event for updating
the rx duration and there is no reason to keep on appending
the f/w stats peer list, as this gets completely cleaned up when
the user polls for f/w stats {pdev, vdev, peer stats}. Only don't
print the warning message in the case PEER_STATS service is enabled

Fixes: 856e7c3 ("ath10k: add debugfs support for Per STA total rx duration")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix updating peer stats rx duration
Mohammed Shafi Shajakhan [Wed, 3 Feb 2016 15:37:42 +0000 (21:07 +0530)]
ath10k: fix updating peer stats rx duration

We are not updating peer stats rx_duration periodically
unless the user one polls for fw_stats, this is because
we discard the update event since pdev list is empty. Fix
this by updating rx duration periodically irrepective of checks
for pdev list (irrespective of ping-pong response)

Fixes: 856e7c3 ("ath10k: add debugfs support for Per STA total rx duration")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove impossible code
Sudip Mukherjee [Tue, 2 Feb 2016 07:14:40 +0000 (12:44 +0530)]
ath10k: remove impossible code

len has been initialized with a value of 0 and buf_len with 4096. There
is no way that this condition (len > buf_len) can be true now.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: populate qca4019 fw specific wmi init params
Raja Mani [Fri, 29 Jan 2016 11:05:12 +0000 (16:35 +0530)]
ath10k: populate qca4019 fw specific wmi init params

Some of the parameter like tx/rx chain mask, number of htt tx desc,
qcache active peer count, etc goes via wmi init cmd to qca4019 firmware
are different.

To make use of 10.4 gen_init function for qca4019, change wmi service
ready handler and 10.4 wmi init functions to adapt qca4019 specific
init values.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add qca4019 hw params
Raja Mani [Fri, 29 Jan 2016 11:05:11 +0000 (16:35 +0530)]
ath10k: add qca4019 hw params

Add a new entry in hw_params_list for qca4019 with list of
it's own details.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add abstraction layer for vdev subtype
Peter Oh [Thu, 28 Jan 2016 21:54:10 +0000 (13:54 -0800)]
ath10k: add abstraction layer for vdev subtype

Abstraction layer for vdev subtype is added to solve
subtype mismatch and to give flexible compatibility
among different firmware revisions.

For instance, 10.2 and 10.4 firmware has different
definition of their vdev subtypes for Mesh.
10.4 defined subtype 6 for 802.11s Mesh while 10.2 uses 5.
Hence use the abstraction API to get right subtype to use.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: use vif->type and vif->p2p for P2P_GO check
Peter Oh [Thu, 28 Jan 2016 21:54:09 +0000 (13:54 -0800)]
ath10k: use vif->type and vif->p2p for P2P_GO check

Interface type P2P_GO can be checked by either arvif->vdev_type
and arvif->vdev_subtype or vif->type and vif->p2p.
Use later one to avoid more cpu consumption that could happen
when subtype abstraction layer change is introduced.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: update 10.4 WMI service map
Peter Oh [Thu, 28 Jan 2016 21:54:08 +0000 (13:54 -0800)]
ath10k: update 10.4 WMI service map

Update 10.4 WMI service map to sync to the latest 10.4 firmware
as of 1/20/2016.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: rename Mesh related service names
Peter Oh [Thu, 28 Jan 2016 21:54:07 +0000 (13:54 -0800)]
ath10k: rename Mesh related service names

WMI_10_4_SERVICE_MESH bit is for non IEEE802.11s Mesh.
Hence rename it to WMI_10_4_SERVICE_MESH_NON_11S.
Also add _11S as post-fix to each of WMI_SERVICE_MESH and
WMI_VDEV_SUBTYPE_MESH specifying the service is for 11s Mesh.
This will help users to distinguish 11s Mesh from non 11s Mesh.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: TX vring optimization
Hamad Kadmany [Thu, 28 Jan 2016 17:24:05 +0000 (19:24 +0200)]
wil6210: TX vring optimization

Tx vring needs to be enlarged to get better
performance for traffic over 2Gbps.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: protect synchronous wmi commands handling
Maya Erez [Thu, 28 Jan 2016 17:24:04 +0000 (19:24 +0200)]
wil6210: protect synchronous wmi commands handling

In case there are multiple WMI commands with the same reply_id,
the following scenario can occur:
- Driver sends the first command to the device
- The reply didn’t get on time and there is timeout
- Reply_id, reply_buf and reply_size are set to 0
- Driver sends second wmi command with the same reply_id as the first
- Driver sets wil->reply_id
- Reply for the first wmi command arrives and handled by wmi_recv_cmd
- As its ID fits the reply_id but the reply_buf is not set yet it is
handled as a reply with event handler, and WARN_ON is printed

This patch guarantee atomic setting of all the reply variables and
prevents the above scenario.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: wait for disconnect completion
Vladimir Kondratiev [Thu, 28 Jan 2016 17:24:03 +0000 (19:24 +0200)]
wil6210: wait for disconnect completion

cfg80211_ops.disconnect() should wait for disconnect flow to
complete. If it does not, internal state becomes out of sync with
one in cfg80211. If one does stress test connect/disconnect
sequence, cfg80211 will issue next connect before disconnect
completed internally.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: prevent access to vring_tx_data lock during its init
Maya Erez [Thu, 28 Jan 2016 17:24:02 +0000 (19:24 +0200)]
wil6210: prevent access to vring_tx_data lock during its init

wil_tx_vring locks the vring_tx_data lock before accessing the TX
vring to check if it is enabled and valid for use.
In case of quick disconnect / connect events for the same station,
spin_lock(&txdata->lock) can be called during the lock initialization
in the vring init function.
To prevent such a race, the TX vrings spin lock should be initialized
once during wil6210 driver initialization.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: do not limit the number of DFS channel interfaces to 1
Felix Fietkau [Fri, 22 Jan 2016 00:56:30 +0000 (01:56 +0100)]
ath9k: do not limit the number of DFS channel interfaces to 1

I think this limit was added when CSA with multiple interfaces wasn't
working yet. It should no longer be necessary

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: expose hif ops for ahb
Raja Mani [Wed, 27 Jan 2016 09:54:33 +0000 (15:24 +0530)]
ath10k: expose hif ops for ahb

Like how pci.c exposes hif ops for the bus specific operation,
expose similar hif ops table for ahb with all required functions
linked to it. Many ath10k_pci_* functions are reused here in hif ops
table. If something is not sharable, new functions are added for ahb
and linked to hif ops table.

Finally, make ath10k_ahb_probe/remove() to perform what is expected
out of it.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add resource init and deinit in ahb
Raja Mani [Wed, 27 Jan 2016 09:54:32 +0000 (15:24 +0530)]
ath10k: add resource init and deinit in ahb

Add function to gather resources required for qca4019 to operate
(memory, irq, dma setting, clock init , rest control init) and
function release those resources when it's not needed.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: include irq related functions in ahb
Raja Mani [Wed, 27 Jan 2016 09:54:31 +0000 (15:24 +0530)]
ath10k: include irq related functions in ahb

Add irq related functions to register,handle,release,disable interrupt.

qca4019 supports msi interrupt, but it has the problem. Until the issue
gets sorted out, only legacy interrupt model is enabled and used.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add chip and bus halt logic in ahb
Raja Mani [Wed, 27 Jan 2016 09:54:30 +0000 (15:24 +0530)]
ath10k: add chip and bus halt logic in ahb

Add function to perform chip halt sequence and function to halt axi
bus in ahb module. Mainly used in the scenario like driver unload.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add reset ctrl related functions in ahb
Raja Mani [Wed, 27 Jan 2016 09:54:29 +0000 (15:24 +0530)]
ath10k: add reset ctrl related functions in ahb

To perform reset on qca4019 wifi, multiple reset lines needs
to be toggled in a sequence with help of reset controller support
in the kernel. This patch adds functions to reset control init/deinit
and release reset.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add clock ctrl related functions in ahb
Raja Mani [Wed, 27 Jan 2016 09:54:28 +0000 (15:24 +0530)]
ath10k: add clock ctrl related functions in ahb

pre qca4019 chipsets has/uses internal clock generator for
the operation. But, qca4019 uses external clocks supplied from
outside of target (ie, outside of wifi core). Three different clocks
(cmd clock, ref clock, rtc clock) comes into picture in qca4019.
All those clocks needs to configured with help of global clock
controller (gcc) to make qca4019 functioning.

Add functions for clock init/deinit, clock enable/disable in ahb.
This is just a preparation, functions added in this patch will be
used in later patches.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add helper functions in ahb.c for reg rd/wr
Raja Mani [Wed, 27 Jan 2016 09:54:27 +0000 (15:24 +0530)]
ath10k: add helper functions in ahb.c for reg rd/wr

qca4019 deals with below register memory region to control the clock,
reset, etc.

        - Memory to control wifi core
        - gcc (outside of wifi)
        - tcsr (outside of wifi)

Add new helper functions to perform read/write in above registers
spaces. Actual ioremap for above registers are done in later patch.
Struct ath10k_ahb is introduced to maintain ahb specific info and
memory this struct will be allocated in the continuation of struct
ath10k_pci (again, memory ath10k_ahb is allocated in the later patch).

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: include qca4019 register map table
Raja Mani [Wed, 27 Jan 2016 09:54:26 +0000 (15:24 +0530)]
ath10k: include qca4019 register map table

New register table is added for qca4019 to tell about it's
register mapping details.

Nothing much other than this.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add basic skeleton to support ahb
Raja Mani [Wed, 27 Jan 2016 09:54:25 +0000 (15:24 +0530)]
ath10k: add basic skeleton to support ahb

qca4019 uses ahb instead of pci where it slightly differs in device
enumeration, clock control, reset control, etc. Good thing is that
ahb also uses copy engine for the data transaction. So, the most of
the stuff implemented in pci.c/ce.c are reusable in ahb case too.

Device enumeration in ahb case comes through platform driver/device
model. All resource details like irq, memory map, clocks, etc for
qca4019 can be fetched from of_node of platform device.

Simply flow would look like,

 device tree => platform device (kernel) => platform driver (ath10k)

Device tree entry will have all qca4019 resource details and the same
info will be passed to kernel. Kernel will prepare new platform device
for that entry and expose DT info to of_node in platform device.
Later, ath10k would register platform driver with unique compatible name
and then kernels binds to corresponding compatible entry & calls ath10k
ahb probe functions. From there onwards, ath10k will take control of it
and move forward.

New bool flag CONFIG_ATH10K_AHB is added in Kconfig to conditionally
enable ahb support in ath10k. On enabling this flag, ath10k_pci.ko
will have ahb support. This patch adds only basic skeleton and few
macros to support ahb in the context of qca4019.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: pull reusable code from pci probe and remove for ahb
Raja Mani [Wed, 27 Jan 2016 09:54:24 +0000 (15:24 +0530)]
ath10k: pull reusable code from pci probe and remove for ahb

Some of the code present in ath10k_pci_{probe|remove} are reusable
in ahb case too. To avoid code duplication, move reusable code to
new functions. Later, those new functions can be called from ahb
module's probe and exit functions.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: make ath10k_pci_read32/write32() ops more generic
Raja Mani [Wed, 27 Jan 2016 09:54:23 +0000 (15:24 +0530)]
ath10k: make ath10k_pci_read32/write32() ops more generic

ath10k_pci_read32/write32() does work more specific to
PCI by ensuring pci wake/sleep for every read and write.
There is a plan to use most of stuff available in pci.c
(irq stuff, copy engine, etc) for AHB case. Such kind
of pci wake/sleep for every read/write is not required
in AHB case (qca4019). All those reusable areas in pci.c
and ce.c calls ath10k_pci_read32/write32() for low level
read and write.

In fact, ath10k_pci_read32/write32() should do what it does
today for PCI case. But for AHB, it has to do differently.
To make ath10k_pci_read32/write32() more generic, new function
pointers are added in ar_pci for the function which does
operation more close to the bus. Later, corresponding bus
specific read and write function will be mapped to that.

ath10k_pci_read32/write32() are changed to call directly
those function pointers without worrying which bus underlying
to it. Also, the function to get number of bank is changed
in the same way.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: make some of ath10k_pci_* func reusable
Raja Mani [Wed, 27 Jan 2016 09:54:22 +0000 (15:24 +0530)]
ath10k: make some of ath10k_pci_* func reusable

Some of static functions present in pci.c file are reusable
in ahb (qca4019) case. Remove static word for those reusable
functions and have those function prototype declaration in
pci.h file. So that, pci.h header file can be included in
ahb module and reused. There is no functionality changes done
in this patch.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: implement basic support for new tx path firmware
Michal Kazior [Thu, 21 Jan 2016 13:13:27 +0000 (14:13 +0100)]
ath10k: implement basic support for new tx path firmware

This allows to use the new firmware which
implements the new tx data path. Without this
patch firmware supporting new tx path stops
responding shortly after booting.

This patch doesn't implement the entire pull-push
logic available in the new firmware. This will be
done in subsequent patches.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: clean up cont frag desc init code
Michal Kazior [Thu, 21 Jan 2016 13:13:26 +0000 (14:13 +0100)]
ath10k: clean up cont frag desc init code

This makes the code easier to extend and re-use.

While at it fix _warn to _err. Other than that
there are no functional changes.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add new FW_FEATURE_PEER_FLOW_CONTROL
Michal Kazior [Thu, 21 Jan 2016 13:13:25 +0000 (14:13 +0100)]
ath10k: add new FW_FEATURE_PEER_FLOW_CONTROL

This feature flag will be used for firmware which
supports pull-push model where host shares it's
software queue state with firmware and firmware
generates fetch requests telling host which queues
to dequeue tx from.

Primary function of this is improved MU-MIMO
performance with multiple clients.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add new htt definitions
Michal Kazior [Thu, 21 Jan 2016 13:13:24 +0000 (14:13 +0100)]
ath10k: add new htt definitions

These definitions are associated with some
improvements upcomming for 10.4 and QCA99X0.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: rename some HTT events
Michal Kazior [Thu, 21 Jan 2016 13:13:23 +0000 (14:13 +0100)]
ath10k: rename some HTT events

New names make a bit more sense.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: fix data bus error on ar9300 and ar9580
Miaoqing Pan [Mon, 18 Jan 2016 01:33:50 +0000 (09:33 +0800)]
ath9k: fix data bus error on ar9300 and ar9580

One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
the data bus error, due to RTC_RC reg write not happen properly.

Warm Reset trigger in continuous beacon stuck for one of the customer for
other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
DMA did not complete when RTC was put in reset.

So, before resetting the MAC need to make sure there are no pending DMA
transactions because this reset does not reset all parts of the chip.

The 12th and 11th bit of MAC _DMA_CFG register used to do that.
12 cfg_halt_ack 0x0
0 DMA has not yet halted
1 DMA has halted
11 cfg_halt_req 0x0
0 DMA logic operates normally
1 Request DMA logic to stop so software can reset the MAC

The Bit [12] of this register indicates when the halt has taken effect or
not. the DMA halt IS NOT recoverable; once software sets bit [11] to
request a DMA halt, software must wait for bit [12] to be set and reset
the MAC.

So, the same thing we implemented for ar9580 chip.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: fix inconsistent use of tab and space in indentation
Miaoqing Pan [Mon, 18 Jan 2016 01:33:49 +0000 (09:33 +0800)]
ath9k: fix inconsistent use of tab and space in indentation

Minor changes for indenting.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: do not reset while BB panic(0x4000409) on ar9561
Miaoqing Pan [Mon, 18 Jan 2016 01:33:48 +0000 (09:33 +0800)]
ath9k: do not reset while BB panic(0x4000409) on ar9561

BB panic(0x4000409) observed while AP enabling/disabling
bursting.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: clean up ANI per-channel pointer checking
Miaoqing Pan [Mon, 18 Jan 2016 01:33:47 +0000 (09:33 +0800)]
ath9k: clean up ANI per-channel pointer checking

commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
removed per-channel handling, the code to check 'curchan' also
should be removed as never used.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: avoid ANI restart if no trigger
Miaoqing Pan [Mon, 18 Jan 2016 01:33:46 +0000 (09:33 +0800)]
ath9k: avoid ANI restart if no trigger

Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")

Call ath9k_ani_restart() only when the phy error rate reach the
ANI immunity threshold. Sync the logic with internal code base.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Drop useless const on chanctx_event_delta() return type
Geert Uytterhoeven [Fri, 15 Jan 2016 13:41:30 +0000 (14:41 +0100)]
ath9k: Drop useless const on chanctx_event_delta() return type

drivers/net/wireless/ath/ath9k/channel.c:230: warning: type qualifiers ignored on function return type

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k_hw: add low power tx gain table for AR953x
Felix Fietkau [Thu, 14 Jan 2016 02:15:13 +0000 (03:15 +0100)]
ath9k_hw: add low power tx gain table for AR953x

Used in some newer TP-Link AR9533 devices.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: handle multiple connect/disconnect events
Maya Erez [Sun, 17 Jan 2016 10:39:10 +0000 (12:39 +0200)]
wil6210: handle multiple connect/disconnect events

In the current solution wil6210 configures the vring in a worker
and holds only one pending CID. This implementation may lead to
race conditions between connect and disconnect events of multiple
stations or fast connect/disconnect events of the same station.

In order to allow the removal of the connect worker and handling of
WMI_VRING_CFG_DONE_EVENTID in the connect event, the WMI replies
that provide the reply in a given buffer needs to be handled
immediately in the WMI event interrupt thread.
To prevent deadlocks, WMI replies that requires additional
handling are still handled via the events list.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: find TX vring only if vring_tx_data is enabled
Maya Erez [Sun, 17 Jan 2016 10:39:09 +0000 (12:39 +0200)]
wil6210: find TX vring only if vring_tx_data is enabled

In TX vring allocation, vring_tx->va is allocated before WMI command to
configure the vring is sent to the device. As the WMI command can take
time to complete, it can lead to scenarios where vring_tx->va is not NULL
but vring is still not enabled.

This patch adds a check that vring_tx_data is enabled before returning
a valid TX vring.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: handle tx completions only if vring tx data is enabled
Maya Erez [Sun, 17 Jan 2016 10:39:08 +0000 (12:39 +0200)]
wil6210: handle tx completions only if vring tx data is enabled

wil_vring_fini_tx is called in disconnect in order to free the
allocated vrings.
wil_vring_fini_tx is disabling the vring_tx_data before napi_synchronize
is called in order to avoid the tx handling of this vring, while
wil_vring_free is called only after napi finished the current handling
of the tx completed packets.
Due to that, in case of disconnect, wil6210_netdev_poll_tx can be called
when vring->va is not NULL but vring_tx_data[i]->enabled is already
disabled.

This patch checks vring_tx_data[i]->enabled in wil6210_netdev_poll_tx
to prevent handling of disabled vrings.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: use extra IEs from probe response
Lior David [Sun, 17 Jan 2016 10:39:07 +0000 (12:39 +0200)]
wil6210: use extra IEs from probe response

In the start_ap/change_beacon API, when we set up probe response
offloading, we only use the IE list from the probe response
template and not the IE list from the proberesp_ies argument.
As a result, we miss important IEs and it causes problems with
some scenarios such as P2P.
With this change, we merge the list of IEs from the probe response
template and proberesp_ies and send the merged list to the FW
for offloading. It is still FW responsibility to filter out
irrelevant IEs when sending probe response, based on the actual
contents of the probe request.
Also in case association response termplate is not provided,
we will use the merged list of IEs from probe response in the
association response as well.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: fix privacy flag calculation in change_beacon
Lior David [Sun, 17 Jan 2016 10:39:06 +0000 (12:39 +0200)]
wil6210: fix privacy flag calculation in change_beacon

Currently the privacy flag calculation in change_beacon
checks for RSN IE inside proberesp_ies, but normally it
is not found there. It works today because of code inside
the function wil_fix_bcon, but wil_fix_bcon is not directly
related to change_beacon, and it may be changed or removed
in the future and break the calculation.
To fix this issue, change the privacy flag calculation
to check RSN IE inside the beacon itself. The new check is more
reliable and will not be sensitive to changes in wil_fix_bcon.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k_htc: add device ID for Toshiba WLM-20U2/GN-1080
Alexander Tsoy [Thu, 7 Jan 2016 22:26:03 +0000 (01:26 +0300)]
ath9k_htc: add device ID for Toshiba WLM-20U2/GN-1080

This device is available under different marketing names:
WLM-20U2 - Wireless USB Dongle for Toshiba TVs
GN-1080 - Wireless LAN Module for Toshiba MFPs.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: request NOA update when chanctx active
Kalle Valo [Fri, 27 Nov 2015 08:37:14 +0000 (09:37 +0100)]
ath9k: request NOA update when chanctx active

Request NOA update when chanctx active, also in case
of STA.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove the p2p notice of absence info from 10.2.4 FW beacon info
Yanbo Li [Thu, 14 Jan 2016 23:39:19 +0000 (15:39 -0800)]
ath10k: remove the p2p notice of absence info from 10.2.4 FW beacon info

The p2p NOA never been supported at 10.2.4 FW, remove it to avoid SWBA
event parse error for multi beacon interval case.

Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add debugfs support for Per STA total rx duration
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:34 +0000 (21:16 +0530)]
ath10k: add debugfs support for Per STA total rx duration

Add debugfs support for per client total rx duration, track this
via the report of Peer stats rx duration reported for every 500ms

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: enable periodic peer stats update
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:33 +0000 (21:16 +0530)]
ath10k: enable periodic peer stats update

Register for 500ms as periodic peer stats update period,
and parameters like rx_duration that needs to be tracked
in host can be achieved by this provision, also periodic
stats update is the future of fw_stats and shall be extended
for pdev / vdev stats irrespecitive PEER_STATS service is enabled
or not

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
[kvalo@qca.qualcomm.com: fix a checkpatch warning]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: provision to support periodic peer stats update
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:32 +0000 (21:16 +0530)]
ath10k: provision to support periodic peer stats update

Enable support for periodic peer stats update when peer stats
service is enabled. The host to update the peer stats received
from the firmware periodically, since firmware will reset this to zero
after sometime (due to memory constraints)

While enabling periodic peer / vdev stats cleanup the existing
list in debugfs if max limit is reached, so that the new stats is
updated.

Ideally speaking based on 'Michal Kazior's' suggestion
we need to completely move to periodic update of all the stats making
the 'ping - pong' method obselete. This requires a bit of re-work and
some testing as well, also confirmation regarding backward comptability
for various firmware and chipsets. Hence allow periodic update only
for peer_stats.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: rename few function names of firmware stats
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:31 +0000 (21:16 +0530)]
ath10k: rename few function names of firmware stats

Prerequisite patch to address checkpatch errors for the next patch
in this series, this function names are bit too long, make it short

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: cleanup setting pdev paramaters
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:30 +0000 (21:16 +0530)]
ath10k: cleanup setting pdev paramaters

Replace the local variable 'burst_enable' with 'param'
for mapping and setting pdev paraemeters and with this patch
pretty easy to extend support for new parameters adhering to
linux kernel coding guidelines

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix naming Peer stats rssi_changed field in 10.2.4
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:29 +0000 (21:16 +0530)]
ath10k: fix naming Peer stats rssi_changed field in 10.2.4

Fix naming of peer stats rssi_changed field in 10.2.4 to make it
more readable. As of now this field is not used, but necessary to
pull in fw_stats with appropriate length.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add support for parsing per STA rx_duration for 10.2.4
Mohammed Shafi Shajakhan [Wed, 13 Jan 2016 15:46:28 +0000 (21:16 +0530)]
ath10k: add support for parsing per STA rx_duration for 10.2.4

Add support for parsing 'peer_rx_duration' as part
of 10.2.4 peer_stats. Also register PEER_STATS service
for parsing 'rx_duration' (and for any new fields to be added
as part of peer_stats). Have checks for backward compatibility with
older 10.2.4 firmware incase PEER_STATS service is not enabled

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: prevent txrx running for too long
Michal Kazior [Wed, 13 Jan 2016 13:52:52 +0000 (14:52 +0100)]
ath10k: prevent txrx running for too long

On multicore systems it was possible for the txrx
tasklet to keep on running for long periods of
time on a single CPU due to tx completion
processing. Another CPU could feed the running
tasklet for an indefinite amount of time.

The tasklet is now guaranteed to run a finite
amount of time and is limited by HTT CE Rx ring
depth.

This improves behavior when RPS is used on target
system and might improve TCP handling as well.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agodt: bindings: add bindings for ipq4019 wifi block
Raja Mani [Wed, 13 Jan 2016 05:56:44 +0000 (11:26 +0530)]
dt: bindings: add bindings for ipq4019 wifi block

Add device tree binding documentation details for wifi block present
in Qualcomm IPQ4019 SoC into "qcom,ath10k.txt".

Right now, ath10k wireless driver has support for PCI based wlan devices.
There is a plan to extend ath10k driver to support wifi devices which are
connected over AHB as well (enumeration will happen via device tree node).
For AHB based devices (ie, ipq4019), all wifi properties are supplied via
device tree (including irq, reg addr, cal data,etc).

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Acked-by: Rob Herring <robh@kernel.org>
[kvalo@qca.qualcomm.com: fixed typos noticed by Rob]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agobrcmfmac: Do not handle link downs for ibss.
Hante Meuleman [Tue, 5 Jan 2016 10:05:50 +0000 (11:05 +0100)]
brcmfmac: Do not handle link downs for ibss.

Sometimes on module reload and reconnect to ibss a deauth from
other station can be received. This is treated as a link down but
for ibss this is wrong. It will close the interface and no data
is possible. Ignore the firmware generated link down events in
ibss mode, as ibss is always teared down by cfg80211.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: use jiffies for timeout in btcoex
Arend van Spriel [Tue, 5 Jan 2016 10:05:49 +0000 (11:05 +0100)]
brcmfmac: use jiffies for timeout in btcoex

The btcoex uses a timeout which was in milliseconds and got
converted to jiffies upon using timer api. Instead, convert
it to jiffies and treat it as such further.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: use msecs_to_jiffies() in macro definitions
Arend van Spriel [Tue, 5 Jan 2016 10:05:48 +0000 (11:05 +0100)]
brcmfmac: use msecs_to_jiffies() in macro definitions

Instead to having macro definition for millisecond timeout have
the definition directly in jiffies. This makes the unit of the
value immediately clear and may result in code that is bit more
compact.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: change brcmf_sdio_wd_timer() prototype
Arend van Spriel [Tue, 5 Jan 2016 10:05:47 +0000 (11:05 +0100)]
brcmfmac: change brcmf_sdio_wd_timer() prototype

The function brcmf_sdio_wd_timer() has wdtick parameter. However, it
is only called with two values and as such the parameter is replaced
with boolean value indicating the timer should be active or not.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Reshuffle functions to avoid forward declarations
Hante Meuleman [Tue, 5 Jan 2016 10:05:46 +0000 (11:05 +0100)]
brcmfmac: Reshuffle functions to avoid forward declarations

Function prototype forward declarations are to be avoided. This
patch shuffles some of the functions so the forward declarations
can be removed.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Add wowl net detect support
Hante Meuleman [Tue, 5 Jan 2016 10:05:45 +0000 (11:05 +0100)]
brcmfmac: Add wowl net detect support

With wowl net detect it becomes possible to scan for specific ssids
and wakeup once found.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge tag 'iwlwifi-next-for-kalle-2016-01-07_2' of https://git.kernel.org/pub/scm...
Kalle Valo [Thu, 7 Jan 2016 21:04:07 +0000 (23:04 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2016-01-07_2' of https://git./linux/kernel/git/iwlwifi/iwlwifi-next

* bug fixes and improvements for firmware debug system (Golan and myself)
* fixes for D0i3 (Eliad)
* prevent muliple stations with the same MAC address
* advertise support for Rx A-MSDU in A-MPDU
* scan related fixes
* support -20.ucode
* fix WoWLAN for iwldvm
* preparations towards multiple Rx queues
* platform power improvements for GO mode when no clients are associated

8 years agoMerge ath-next from ath.git
Kalle Valo [Thu, 7 Jan 2016 20:54:46 +0000 (22:54 +0200)]
Merge ath-next from ath.git

No major changes to list.

8 years agoiwlwifi: pcie: properly configure the debug buffer size for 8000
Emmanuel Grumbach [Tue, 5 Jan 2016 13:25:43 +0000 (15:25 +0200)]
iwlwifi: pcie: properly configure the debug buffer size for 8000

8000 device family has a new debug engine that needs to be
configured differently than 7000's.
The debug engine's DMA works in chunks of memory and the
size of the buffer really means the start of the last
chunk. Since one chunk is 256-byte long, we should
configure the device to write to buffer_size - 256.
This fixes a situation were the device would write to
memory it is not allowed to access.

CC: <stable@vger.kernel.org> [4.1+]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: fix memory leaks in error paths upon fw error dump
Emmanuel Grumbach [Tue, 5 Jan 2016 07:35:21 +0000 (09:35 +0200)]
iwlwifi: mvm: fix memory leaks in error paths upon fw error dump

When iwl_mvm_fw_error_dump fails, it needs to clear the
state in mvm, which includes:
* clear IWL_MVM_STATUS_DUMPING_FW_LOG
* set mvm->fw_dump_trig to NULL
* free the description

While at it, remove a NULL check in
iwl_mvm_free_fw_dump_desc since kfree is NULL safe.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c
Emmanuel Grumbach [Tue, 5 Jan 2016 07:14:08 +0000 (09:14 +0200)]
iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c

The debug functions of fw-dbg.c don't really need to modify
the trigger and the description they receive as a parameter.
Constify the pointers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: check minimum temperature notification length
Johannes Berg [Tue, 5 Jan 2016 15:16:31 +0000 (16:16 +0100)]
iwlwifi: mvm: check minimum temperature notification length

This notification will be extended with extra data, so just
check that it has a minimum length, not the exact length;
we might later add handling for the extra fields added and
have more code to handle both versions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: initialize gtkdata->mvm correctly
Eliad Peller [Thu, 31 Dec 2015 13:19:32 +0000 (15:19 +0200)]
iwlwifi: mvm: initialize gtkdata->mvm correctly

gtkdata->mvm wasn't set in iwl_mvm_d0i3_update_keys,
resulting in kernel panic in some flows (when mvm
is actually used...)

Fixes: a3f7ba5c8825 ("iwlwifi: update key params on d0i3 entrance/exit")
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: check PN for CCMP/GCMP in the driver
Johannes Berg [Sun, 6 Dec 2015 12:58:08 +0000 (14:58 +0200)]
iwlwifi: mvm: check PN for CCMP/GCMP in the driver

As we're working on multi-queue RX, we want to parallelise checking
the PN in order to avoid having to serialise the RX processing.

It may seem that doing parallel PN checking is insecure, but it turns
out to be OK because queue assignment is done based on the data in the
frame (IP/TCP) and thus cannot be manipulated by an attacker, since
the data is encrypted and must first have been decrypted successfully.

There are some corner cases, in particular when the peer starts using
fragmentation which redirects the packet to the default queue. However
this redirection is remembered (for the STA, per TID) and thus cannot
be exploited by an attacker either.

Leave checking on the default queue (queue 0) to mac80211, since we
get fragmented packets there and those are subject to stricter checks
during reassembly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta
Ayala Beker [Sun, 20 Dec 2015 07:27:50 +0000 (09:27 +0200)]
iwlwifi: mvm: don't ask beacons when P2P GO vif and no assoc sta

The commit below called iwl_mvm_mac_ctxt_changed() to handle
a case that the vif is a P2P GO.
However iwl_mvm_mac_ctxt_cmd_go() ignores the number of
associated stations and asks the FW to pass beacons anyways.

Fix this by checking ap_assoc_sta_count parameter, in iwl_mvm_mac_ctxt_cmd_go()
as well, and ask the FW to pass beacons only when there's
at least one associated station.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: prevent multiple stations with the same address
Johannes Berg [Thu, 24 Sep 2015 16:14:55 +0000 (18:14 +0200)]
iwlwifi: mvm: prevent multiple stations with the same address

As the device (and parts of the driver) cannot deal with having the
same MAC address for two stations (on two virtual interfaces), add
some explicit code to prevent this case.

Note that in practice this cannot happen since the device doesn't
support operating with two AP/GO interfaces at the same time either,
and other scenarios for this are, while not impossible, not going to
happen in practice.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination
Emmanuel Grumbach [Thu, 24 Dec 2015 06:48:46 +0000 (08:48 +0200)]
iwlwifi: mvm: remove useless WARN_ON and rely on cfg80211's combination

We advertise one STATION vif only, so this just can't
happen. Remove this useless WARN_ON.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: support A-MSDU in A-MPDU
Johannes Berg [Mon, 21 Sep 2015 12:09:17 +0000 (14:09 +0200)]
iwlwifi: mvm: support A-MSDU in A-MPDU

Since A-MPDU deaggregation is done in hardware, and A-MSDU deaggregation
is done in software, there's no reason not to support A-MSDU in A-MPDU;
set the flag to support it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: add a non-trigger window to fw dbg triggers
Golan Ben-Ami [Wed, 25 Nov 2015 09:44:57 +0000 (11:44 +0200)]
iwlwifi: mvm: add a non-trigger window to fw dbg triggers

Allow the user to configure a non-trigger session - a window
between triggers in which the driver won't collect fw debug data.
This can be useful when the frequent collection of fw data
has an impact on the performance, such as debugging
tx flows.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: dump the radio registers when the firmware crashes
Emmanuel Grumbach [Mon, 28 Dec 2015 13:22:28 +0000 (15:22 +0200)]
iwlwifi: mvm: dump the radio registers when the firmware crashes

Dumping the content of the radio registers greatly helps
to debug PHY issues, which can lead to TFD queue hang.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: fix extended dwell time
David Spinadel [Sun, 3 Jan 2016 15:08:32 +0000 (17:08 +0200)]
iwlwifi: mvm: fix extended dwell time

FW adds 10 msec for every dwell time in low band, so we need
to set 10 msec less.
Don't use extended dwell time when fragmented scan is needed
because FW adds 3 msec per probe and it can easily exceed
max out of channel time.

Fixes: c3e230b167a9 ("iwlwifi: mvm: add extended dwell time")
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: nvm: fix loading default NVM file
Oren Givon [Wed, 25 Nov 2015 09:17:41 +0000 (11:17 +0200)]
iwlwifi: nvm: fix loading default NVM file

Fix loading the default NVM file, in the case where the
requested NVM file isn't found in the file system.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: bump max API to 20
Emmanuel Grumbach [Tue, 5 Jan 2016 14:30:04 +0000 (16:30 +0200)]
iwlwifi: mvm: bump max API to 20

7265D and up are now able to handle -20.ucode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: set max firmware version of 7265 to 17
Emmanuel Grumbach [Mon, 4 Jan 2016 08:19:17 +0000 (10:19 +0200)]
iwlwifi: set max firmware version of 7265 to 17

Just like 7260, 7265 will not have firmware releases newer
than iwlwifi-7265-17.ucode. 7265D is still supported in
latest firmware releases.

Fixes: 628a2918afe4 ("iwlwifi: separate firmware version for 7260 devices")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: reset mvm->scan_type when firmware is started
Emmanuel Grumbach [Sun, 3 Jan 2016 20:23:40 +0000 (22:23 +0200)]
iwlwifi: mvm: reset mvm->scan_type when firmware is started

If we don't reset the scan type when the firmware is
started, we will think the firmware is still configured
after the interface has been brought down. When we will
bring it up again, we will not configure the scan type
in firmware and it will crash with the following assert:

0x0000100A | ADVANCED_SYSASSERT

Fixes: 355346ba3050 ("iwlwifi: mvm: configure scheduled scan according to traffic conditions")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: change mcc update API
Matti Gottlieb [Mon, 4 Jan 2016 11:38:41 +0000 (13:38 +0200)]
iwlwifi: mvm: change mcc update API

New functionality for testing that is not relevant for
this driver has been added. This required an API change.

Add new cmd & response versions for the MCC update cmd & response.
Add new TLV indicating that the FW is using the new API.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: let the firmware choose the antenna for beacons
Emmanuel Grumbach [Sun, 13 Dec 2015 07:35:30 +0000 (09:35 +0200)]
iwlwifi: mvm: let the firmware choose the antenna for beacons

The firmware knows better what antenna to choose.
Old firmware still need the setting, so use a flag to know
if the driver should choose the antenna or if the firmware
can do it iself.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: update and fix 7265 series PCI IDs
Oren Givon [Thu, 17 Dec 2015 12:17:00 +0000 (14:17 +0200)]
iwlwifi: update and fix 7265 series PCI IDs

Update and fix some 7265 PCI IDs entries.

CC: <stable@vger.kernel.org> [3.13+]
Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: dvm: fix WoWLAN
Emmanuel Grumbach [Sun, 20 Dec 2015 06:45:40 +0000 (08:45 +0200)]
iwlwifi: dvm: fix WoWLAN

My commit below introduced a mutex in the transport to
prevent concurrent operations. To do so, it added a flag
(is_down) to make sure the transport is in the right state.
This uncoverred an bug that didn't cause any harm until
now: iwldvm calls stop_device and then starts the firmware
without calling start_hw in between. While this flow is
fine from the device configuration point of view (register,
etc...), it is now forbidden by the new is_down flag.
This led to this error to appear:
iwlwifi 0000:05:00.0: Can't start_fw since the HW hasn't been started
and the suspend would fail.

This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=109591

CC: <stable@vger.kernel.org> [4.3+]
Reported-by: Bogdan Bogush <bogdan.s.bogush@gmail.com>
Fixes=fa9f3281cbb1 ("iwlwifi: pcie: lock start_hw / start_fw / stop_device")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agowcn36xx: split DMA mask register writing.
Fengwei Yin [Sun, 20 Dec 2015 13:20:41 +0000 (21:20 +0800)]
wcn36xx: split DMA mask register writing.

Per comments from Bjorn Andersson <bjorn.andersson@sonymobile.com>,
split DMA mask register writing as seperate patch in case we need
bi-sect in the furture.

Signed-off-by: Fengwei Yin <fengwei.yin@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowcn36xx: handle rx skb allocation failure to avoid system crash
Fengwei Yin [Sun, 20 Dec 2015 13:20:40 +0000 (21:20 +0800)]
wcn36xx: handle rx skb allocation failure to avoid system crash

Lawrence reported that git clone could make system crash on a
Qualcomm ARM soc based device (DragonBoard, 1G memory without
swap) running 64bit Debian.

It's turned out the crash is related with rx skb allocation
failure. git could consume more than 600MB anonymous memory.
And system is in extremely memory shortage case.

But driver didn't handle the rx allocation failure case. This patch
doesn't submit skb to upper layer if rx skb allocation fails.
Instead, it reuse the old skb for rx DMA again. It's more like
drop the packets if system is in memory shortage case.

With this change, git clone is OOMed instead of system crash.

Reported-by: King, Lawrence <lking@qti.qualcomm.com>
Signed-off-by: Fengwei Yin <fengwei.yin@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: fix ath9k_hw_nvram_check_version()
Dan Carpenter [Sat, 19 Dec 2015 10:59:19 +0000 (13:59 +0300)]
ath9k: fix ath9k_hw_nvram_check_version()

There is a type bug so it always returns success.

Fixes: 6fa658fd5ab2 ('ath9k: Simplify and fix eeprom endianness swapping')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Enable support for cloned SKBS
Pawel Kulakowski [Fri, 18 Dec 2015 09:48:57 +0000 (10:48 +0100)]
ath9k: Enable support for cloned SKBS

Ath9k driver does not modify tx skbs, so SUPPORTS_CLONED_SKBS
flag can be set. Enabling this flag significant reduce number
of copy operation during TCP Tx. This is especially noticeable
on platforms with slower CPU (lower CPU usage brings
profits in better TCP Tx troughput results).

Tested on MIPS with 560 MHz clock
Without CLONED_SKBS flag:
TCP Tx 145 Mb/s (iperf result)
__copy_user_common consumes 12.9% of CPU (result from perf tool)
0% CPU Idle

With CLONED_SKBS flag:
TCP Tx 170 Mb/s (iperf result)
__copy_user_common consumes 1.8% of CPU (result from perf tool)
12% CPU Idle

Signed-off-by: Pawel Kulakowski <pawel.kulakowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: support for platform specific crash recovery
Lior David [Wed, 16 Dec 2015 15:51:46 +0000 (17:51 +0200)]
wil6210: support for platform specific crash recovery

Added a simple interface for platform to perform crash
recovery.
When firmware crashes, wil driver can notify the platform
which can trigger a crash recovery process. During
the process the platform can request a ram dump
from the wil driver as well as control when firmware
recovery will start. This interface allows the platform
to implement a more advanced crash recovery, for
example to reset dependent subsystems in proper order, or
to provide its own notifications during the recovery process.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: fix kernel OOPS when stopping interface during Rx traffic
Hamad Kadmany [Wed, 16 Dec 2015 15:51:45 +0000 (17:51 +0200)]
wil6210: fix kernel OOPS when stopping interface during Rx traffic

When network interface is stopping, some resources may
be already released by the network stack, and Rx frames
cause kernel OOPS (observed one is in netfilter code)

Proper solution is to drop packets pending in reorder buffer.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: set SM power save disabled to default value
Peter Oh [Thu, 31 Dec 2015 13:26:20 +0000 (15:26 +0200)]
ath10k: set SM power save disabled to default value

Use SMPS disabled as default because FW does not indicate
any support of SMPS.

This change will help STAs out that don’t support SMPS from
sticking on 1SS, since they don’t have method to change it
back to multiple chains.

This change also should not affect power consumption of STAs
supporting SMPS, because they are capable to switch the mode
to dynamic or static either at the end of frame sequence or
by using SMPS action frame.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agort2x00pci: Disable memory-write-invalidate when the driver exits
Jia-Ju Bai [Mon, 4 Jan 2016 07:55:38 +0000 (15:55 +0800)]
rt2x00pci: Disable memory-write-invalidate when the driver exits

The driver calls pci_set_mwi to enable memory-write-invalidate when it
is initialized, but does not call pci_clear_mwi when it is removed. Many
other drivers calls pci_clear_mwi when pci_set_mwi is called, such as
r8169, 8139cp and e1000.

This patch adds pci_clear_mwi in error handling and removal procedure,
which can fix the problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: introduce module parameter to force successful probe
Arend van Spriel [Sat, 2 Jan 2016 08:41:42 +0000 (09:41 +0100)]
brcmfmac: introduce module parameter to force successful probe

The module parameter can be used to ensure the probe succeeds thus
claiming the device and allowing post-mortem debugging in case of
firmware crash. It is only available when select CONFIG_BRCMDBG.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Move all module parameters to one place
Hante Meuleman [Sat, 2 Jan 2016 08:41:41 +0000 (09:41 +0100)]
brcmfmac: Move all module parameters to one place

Module parameters are defined in several files. Move them in one
place and make them device specific or global. This makes it
easier to override device specific settings by external data like
platform data in the future.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Fix warn trace on module unload while in ibss mode
Hante Meuleman [Sat, 2 Jan 2016 08:41:40 +0000 (09:41 +0100)]
brcmfmac: Fix warn trace on module unload while in ibss mode

When the driver is being unloaded a situation can occur where the
wirelesss core (cfg80211) wants to remove the ibss, but the state
of brcmfmac has already been set to down. When an error is
returned in that situation then that will result in a stack
trace on removal of the wiphy object. This is avoided by
returning 0 when device is down on a leave_ibss call.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>