openwrt/staging/blogic.git
8 years agoath10k: define an enum to enable cycle counter wraparound logic
Vasanthakumar Thiagarajan [Tue, 7 Jun 2016 12:47:05 +0000 (15:47 +0300)]
ath10k: define an enum to enable cycle counter wraparound logic

QCA988X hw implements a different cycle counter wraparound
behaviour when compared to QCA4019. To properly handle different
wraparound logic for these chipsets replace already available
bool hw_params member, has_shifted_cc_wraparound, with an
enum which could be extended to handle different wraparound
behaviour. This patch keeps the existing logic functionally
same and a prepares cycle counter wraparound handling to
extend for other chips.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
[kvalo@qca.qualcomm.com: change also QCA9887 wrap type]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix CCK h/w rates for QCA99X0 and newer chipsets
Mohammed Shafi Shajakhan [Tue, 7 Jun 2016 12:47:04 +0000 (15:47 +0300)]
ath10k: fix CCK h/w rates for QCA99X0 and newer chipsets

CCK hardware table mapping from QCA99X0 onwards got revised.
The CCK hardware rate values are in a proper order wrt. to
rate and preamble as below

ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
ATH10K_HW_RATE_REV2_CCK_LP_2M = 2,
ATH10K_HW_RATE_REV2_CCK_LP_5_5M = 3,
ATH10K_HW_RATE_REV2_CCK_LP_11M = 4,
ATH10K_HW_RATE_REV2_CCK_SP_2M = 5,
ATH10K_HW_RATE_REV2_CCK_SP_5_5M = 6,
ATH10K_HW_RATE_REV2_CCK_SP_11M = 7,

This results in reporting of rx frames (with CCK rates)
totally wrong for QCA99X0, QCA4019. Fix this by having
separate CCK rate table for these chipsets with rev2 suffix
and registering the correct rate mapping to mac80211 based on
the new hw_param (introduced) 'cck_rate_map_rev2' which shall
be true for any newchipsets from QCA99X0 onwards

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove duplicate and unused rx rate flags
Mohammed Shafi Shajakhan [Tue, 7 Jun 2016 12:47:03 +0000 (15:47 +0300)]
ath10k: remove duplicate and unused rx rate flags

All these flags are not used and their use is completely
covered by 'ath10k_hw_rate_ofdm', 'ath10k_hw_rate_cck',
and RX_PPDU_START_RATE_FLAG

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix some of the macro definitions of HTT_RX_IND message
Vasanthakumar Thiagarajan [Tue, 7 Jun 2016 12:47:03 +0000 (15:47 +0300)]
ath10k: fix some of the macro definitions of HTT_RX_IND message

Only five bits are defined to pass tid information in HTT_RX_IND
message, so the mask which can be used to extract tid should be 0x1f
instead of the current 0x3f. Also, macros which can be used to extract
flush_valid and release_valid bits have to be left shifted one bit less
because these information follow the tid right after. This patch does
not really fix anything functionally because these macros are not used
currently.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add board data download from target
Sven Eckelmann [Thu, 2 Jun 2016 14:59:50 +0000 (17:59 +0300)]
ath10k: add board data download from target

The QCA9887 stores its calibration data (board.bin) inside the EEPROM of
the target. This has to be downloaded manually to allow the device to
initialize correctly.

Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
[kvalo@qca.qualcomm.com: handle -EOPNOTSUPP and s/fetch_board_data/fetch_cal_eeprom]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add QCA9887 chipset support
Sven Eckelmann [Thu, 2 Jun 2016 14:59:49 +0000 (17:59 +0300)]
ath10k: add QCA9887 chipset support

Add the hardware name, revision, firmware names and update the pci_id
table.

QA9887 HW1.0 is supposed to be similar to QCA988X HW2.0 . Details about
he firmware interface are currently unknown.

Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
[kvalo@qca.qualcomm.com: add a warning about experimental support]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: enable ipq4019 device probe in ahb module
Raja Mani [Mon, 30 May 2016 13:11:23 +0000 (18:41 +0530)]
ath10k: enable ipq4019 device probe in ahb module

All the necessary patches to make wifi running (over AHB)
on ipq4019 SoC are ready now. It's good to enable
ipq4019 wifi device probing in ahb module and
remove work in progress debug print.

Device tree change is there in the public review by
below commit message
"qcom: ipq4019: add wifi nodes to ipq4019 SoC device tree"

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add pdev param support to enable/disable btcoex
Rajkumar Manoharan [Fri, 27 May 2016 14:45:59 +0000 (20:15 +0530)]
ath10k: add pdev param support to enable/disable btcoex

10.4 firmware has support to enable or disable btcoex functionality
without reloading firmware via wmi pdev param. Add provision to send
pdev param command via existing btcoex knob.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: add new ATH10K_FW_FEATURE_BTCOEX_PARAM
Rajkumar Manoharan [Fri, 27 May 2016 14:45:58 +0000 (20:15 +0530)]
ath10k: add new ATH10K_FW_FEATURE_BTCOEX_PARAM

This feature flag will be used for firmware to support BT-Coex feature
without reloading firmware via WMI pdev param. To support Bluetooth
coexistence pdev param, WMI_COEX_GPIO_SUPPORT of extended resource
config should be enabled always. This firmware IE is used to configure
WMI_COEX_GPIO_SUPPORT.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: update module description
Rajkumar Manoharan [Fri, 27 May 2016 14:45:57 +0000 (20:15 +0530)]
ath10k: update module description

Update module description to advertise all supported QCA 802.11ac devices.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove unused phy_mode_to_band
Rajkumar Manoharan [Fri, 27 May 2016 14:45:56 +0000 (20:15 +0530)]
ath10k: remove unused phy_mode_to_band

Remove unused inline function phy_mode_to_band.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix operating irq mode for ahb device
Rajkumar Manoharan [Fri, 27 May 2016 14:45:55 +0000 (20:15 +0530)]
ath10k: fix operating irq mode for ahb device

Earlier when operating irq mode is legacy, interrupts are disabled
and re-enabled based on num_msi_intrs. commit cfe9011a05a8 ("ath10k:
remove MSI range support") replaced num_msi_intrs by oper_irq_mode.
Since oper_irq_mode is not initialized for ahb devices (i.e qca4019),
device boot up is failed during probe.

Fixes: cfe9011a05a8 ("ath10k: remove MSI range support")
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix error while writing 'simulate_fw_crash' debugfs
Mohammed Shafi Shajakhan [Sat, 28 May 2016 08:25:41 +0000 (11:25 +0300)]
ath10k: fix error while writing 'simulate_fw_crash' debugfs

Fix invalid argument error while writing 'simulate_fw_crash',
though the funcionality is working fine we get an error 'invalid
argument' because 'count' value is not returned properly
(no reason to reduce the count value for removing the newline)

Fixes the below write error:

/sys/kernel/debug/ieee80211/phy0/ath10k# echo hw-restart >
simulate_fw_crash
-bash: echo: write error: Invalid argument

Also move the 'conf_mutex' as it is really not required for
fetching the userspace buffer.

Reported-by: Maharaja Kennadyrajan <c_mkenna@qti.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Maharaja Kennadyrajan <c_mkenna@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix diag_read to collect data for larger memory
Ashok Raj Nagarajan [Sat, 28 May 2016 08:25:40 +0000 (11:25 +0300)]
ath10k: fix diag_read to collect data for larger memory

diag_read uses dma_alloc_coherent to allocate memory requested by the
caller. If this memory requested is larger, more than DIAG_TRANSFER_LIMIT
(2K), then it is likely that we may not get the requested memory and we
would fail.

To solve this, request dma_alloc_coherent for only DIAG_TRANSFER_LIMIT, and
reuse this buffer multiple times as needed to copy the data requested in
smaller chunks of size not more than DIAG_TRANSFER_LIMIT. Previously we
were reading into the caller's only after getting the complete requested
data.

Fixes: 68c03249f388 ('ath10k: convert pci_alloc_consistent() to dma_alloc_coherent()')
Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Proper TX99 interrupt ref count
Eduardo Abinader [Thu, 19 May 2016 15:15:29 +0000 (17:15 +0200)]
ath9k: Proper TX99 interrupt ref count

On TX99 mode, instead of assuming interrupt mask non ATH9K_INT_GLOBAL,
let ath9k_hw_disable_interrupts proper set interrupt ref count.
This prevents some PCI PERR occurring specialy when setting 11b and n rates.

Signed-off-by: Eduardo Abinader <eduardo.abinader@riverbed.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: simplify logical condition
Heinrich Schuchardt [Wed, 18 May 2016 00:24:17 +0000 (02:24 +0200)]
ath6kl: simplify logical condition

x <= 7 implies x < 8.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: fix typo
Julia Lawall [Tue, 17 May 2016 14:38:45 +0000 (16:38 +0200)]
ath6kl: fix typo

firmare -> firmware

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: align wil log functions to wil_dbg_ratelimited implementation
Maya Erez [Mon, 16 May 2016 19:23:35 +0000 (22:23 +0300)]
wil6210: align wil log functions to wil_dbg_ratelimited implementation

Change the implementation of wil log functions for consistency
with __wil_dbg_ratelimited.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: add pm_notify handling
Maya Erez [Mon, 16 May 2016 19:23:34 +0000 (22:23 +0300)]
wil6210: add pm_notify handling

Adding pm_notify to allow the following:
1. Check if suspend is allowed in an earlier stage to prevent
starting the suspend procedure in case it is not allowed
2. Notify the platform driver on the suspend request

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: fix dma mapping error cleanup in __wil_tx_vring_tso
Maya Erez [Mon, 16 May 2016 19:23:33 +0000 (22:23 +0300)]
wil6210: fix dma mapping error cleanup in __wil_tx_vring_tso

In case we fail to map one of the TSO SKB fragments, we need to
clear all the mapped descriptors, from swhead to swhead+descs_used-1.

Change the desc index calculation to
i = (swhead + descs_used - 1) % vring->size;
to prevent unmpping of (swhead + descs_used) descriptor that wasn't
mapped.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: protect wil_vring_fini_tx in parallel to tx completions
Maya Erez [Mon, 16 May 2016 19:23:32 +0000 (22:23 +0300)]
wil6210: protect wil_vring_fini_tx in parallel to tx completions

napi_synchronize is called before releasing the vring, with the
assumption that setting txdata->enabled to 0 will prevent handling
of this vring in the next scheduled napi.
To guarantee this assumption, a memory barrier is added after disabling
the txdata.
In addition, as the ctx is zeroed in wil_tx_complete after this
descriptor is handled (protected by wmb), ctx needs to be checked
before releasing this descriptor in wil_vring_free.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: guarantee safe access to rx descriptors shared memory
Maya Erez [Mon, 16 May 2016 19:23:31 +0000 (22:23 +0300)]
wil6210: guarantee safe access to rx descriptors shared memory

add memory barrier after allocating new rx descriptors, before
updating the hwtail.
This will guarantee that all writes to descriptors (shared memory)
are done before committing them to HW.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: fix race conditions between TX send and completion
Maya Erez [Mon, 16 May 2016 19:23:30 +0000 (22:23 +0300)]
wil6210: fix race conditions between TX send and completion

There are 2 possible race conditions, both are solved by addition of
memory barrier:
1. wil_tx_complete reads the swhead to determine if the vring is
empty. In case the swhead was updated before the descriptor update
was performed in __wil_tx_vring/__wil_tx_vring_tso, the completion
loop will not end and as the DU bit may still be set from a previous
run, this skb can be handled as completed before it was sent, which
will lead to double free of the same SKB.
2. __wil_tx_vring/__wil_tx_vring_tso calculate the number of available
descriptors according to the swtail. In case the swtail is updated
before memset of ctx to zero is completed, we can handle this
descriptor while later on ctx is zeroed.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: allow tx99 for ar9002 based cards
Eduardo Abinader [Mon, 9 May 2016 12:38:40 +0000 (14:38 +0200)]
ath9k: allow tx99 for ar9002 based cards

As there is current support for ar9002 tx99 mode, just allow
to init debugfs and enable tx99.

Signed-off-by: Eduardo Abinader <eduardo.abinader@riverbed.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Remove empty test condition
Eduardo Abinader [Mon, 2 May 2016 15:44:11 +0000 (17:44 +0200)]
ath9k: Remove empty test condition

Just some code cleanup to remove an empty if clause.

Signed-off-by: Eduardo Abinader <eduardo.abinader@riverbed.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: fix legacy rate packet debug messages
Mohammed Shafi Shajakhan [Mon, 23 May 2016 20:12:47 +0000 (23:12 +0300)]
ath10k: fix legacy rate packet debug messages

Legacy rate packets may not necessarily be having a rx status
flag of '0' always, for example management frame have flags
like RX_FLAG_ONLY_MONITOR / RX_FLAG_MACTIME_END also set

Just check 'VHT' and 'HT' flags are not set , and simply clasify it as
legacy rate packets

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: reduce warning messages during rx without proper channel context
Mohammed Shafi Shajakhan [Mon, 23 May 2016 20:12:46 +0000 (23:12 +0300)]
ath10k: reduce warning messages during rx without proper channel context

WARN_ON_ONCE when we receive packets for self peer when mac80211
had not assigned a proper channel context. This scenario happens
in QCA4019 when we start the AP via hostapd in background and start
it once again in the background without killing the previous instance!
This happens intermittently when we start / stop hostapd in a while loop
(incase the hostapd is not properly killed).  This results in mac80211
chancontext to be unassigned, while the self peer continuous receive
packets in target operating channel. This results in lot of call traces
in the rx path. Make this as a WARN_ON_ONCE to avoid flooding the console
which result in rebooting low memory systems, while still reporting the
warning once that we are receiving packets in target operating channel and
to indicate that something is happening which is not the expected result.

WARNING: CPU: 0 PID: 0 at ath/ath10k/htt_rx.c:803
[<c0318838>] (warn_slowpath_null) from [<bf4a0104>]
(ath10k_htt_rx_h_channel+0xe0/0x1b8 [ath10k_core])
[<bf4a0104>] (ath10k_htt_rx_h_channel [ath10k_core]) from
[<bf4a025c>] (ath10k_htt_rx_h_ppdu+0x80/0x288 [ath10k_core])
[<bf4a025c>] (ath10k_htt_rx_h_ppdu [ath10k_core]) from
[<bf4a1a9c>] (ath10k_htt_txrx_compl_task+0x724/0x9d4 [ath10k_core])
[<bf4a1a9c>] (ath10k_htt_txrx_compl_task [ath10k_core])

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: improve tx scheduling
Michal Kazior [Mon, 23 May 2016 20:12:45 +0000 (23:12 +0300)]
ath10k: improve tx scheduling

Recent changes revolving around implementing
wake_tx_queue support introduced a significant
performance regressions on some (slower, uni-proc)
systems.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: enable support for QCA9984
Vasanthakumar Thiagarajan [Mon, 23 May 2016 20:12:45 +0000 (23:12 +0300)]
ath10k: enable support for QCA9984

QCA9984 shares the same configuration with QCA99X0.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: define rx_ppdu_end for QCA9984
Vasanthakumar Thiagarajan [Mon, 23 May 2016 20:12:44 +0000 (23:12 +0300)]
ath10k: define rx_ppdu_end for QCA9984

QCA9984 Rx descriptor has two 32-bit words of location information
when compared to one 32-bit word in QCA99X0. To handle this difference in
rx descriptor ppdu_end, define a new ppdu_end for QCA9984 descriptor
which has the new structure to represent rx_location_info.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: clean up growing hw checks during safe and full reset
Vasanthakumar Thiagarajan [Mon, 23 May 2016 20:12:43 +0000 (23:12 +0300)]
ath10k: clean up growing hw checks during safe and full reset

Store pci chip secific reset funtions in struct ath10k_pci
as callbacks during early ath10k_pci_probe() and use the
callback to perform chip specific resets. This patch essentially
adds two callback in ath10k_pci, one for doing soft reset and
the other for hard reset. By using callbacks we can get rid of
those hw revision checks in ath10k_pci_safe_chip_reset() and
ath10k_pci_chip_reset(). As such this patch does not fix
any issue.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: move rx_location_info out of struct rx_pkt_end
Vasanthakumar Thiagarajan [Mon, 23 May 2016 20:12:43 +0000 (23:12 +0300)]
ath10k: move rx_location_info out of struct rx_pkt_end

Define rx_location_info in struct rx_ppdu_end_qca99x0 after
rx_pkt_end. This is to prepare rx_ppdu_end for QCA9984 chip.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoMerge ath-next from ath.git
Kalle Valo [Wed, 11 May 2016 20:23:51 +0000 (23:23 +0300)]
Merge ath-next from ath.git

ath.git patches for 4.7. Major changes:

ath6kl

* add ability to set debug uart baud rate with a module parameter

wil6210

* add debugfs file to configure firmware led functionality

8 years agoath10k: Fix survey reporting with QCA4019
Vasanthakumar Thiagarajan [Mon, 9 May 2016 18:57:14 +0000 (21:57 +0300)]
ath10k: Fix survey reporting with QCA4019

In QCA4019, cycle counter wraparound in same fashion
as QCA988X. When the cycle counter wraparound it
resets to 0x7fffffff. Set has_shifted_cc_wraparound to
true for QCA4019 to enable the code path to handle cycle
counter wraparound for consistent survey report.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: suppress warnings when getting wmi peer_rate_code_list event
Vasanthakumar Thiagarajan [Mon, 9 May 2016 18:57:14 +0000 (21:57 +0300)]
ath10k: suppress warnings when getting wmi peer_rate_code_list event

In 10.4, fw sends WMI PEER_RATECODE_LIST_EVENTID after successful
peer_assoc cmd. As of now this event is not of much use and not
implemented. Change the debug level and messsage as appropriate
to suppress "Unknown eventid: 36898".

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: add support for device led configuration
Maya Erez [Mon, 9 May 2016 18:57:11 +0000 (21:57 +0300)]
wil6210: add support for device led configuration

Add the ability to configure the device led to be used for notifying
the AP activity (60G device supports leds 0-2).
The host can also configure the blinking frequency of the led in
three states.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoatmel: potential underflow in atmel_set_freq()
Dan Carpenter [Tue, 10 May 2016 19:21:17 +0000 (22:21 +0300)]
atmel: potential underflow in atmel_set_freq()

Smatch complains that we cap the upper bound of "fwrq->m" but not the
lower bound.  I don't know if it can actually happen but it's simple
enough to check for negatives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoairo: prevent potential underflow in airo_set_freq()
Dan Carpenter [Tue, 10 May 2016 19:20:37 +0000 (22:20 +0300)]
airo: prevent potential underflow in airo_set_freq()

I'm not sure if this can underflow but Smatch complains.  It seems
harmless to add a check for negatives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fixup error messages
Wei-Ning Huang [Tue, 10 May 2016 06:21:23 +0000 (14:21 +0800)]
mwifiex: fixup error messages

Use dev_err instead of pr_err and add newline character at the end.

Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: pci: use dev_kfree_skb_irq instead of kfree_skb in rtl_pci_reset_trx_ring
wang yanqing [Fri, 6 May 2016 16:33:53 +0000 (00:33 +0800)]
rtlwifi: pci: use dev_kfree_skb_irq instead of kfree_skb in rtl_pci_reset_trx_ring

We can't use kfree_skb in irq disable context, because spin_lock_irqsave
make sure we are always in irq disable context, use dev_kfree_skb_irq
instead of kfree_skb is better than dev_kfree_skb_any.

This patch fix below kernel warning:
[ 7612.095528] ------------[ cut here ]------------
[ 7612.095546] WARNING: CPU: 3 PID: 4460 at kernel/softirq.c:150 __local_bh_enable_ip+0x58/0x80()
[ 7612.095550] Modules linked in: rtl8723be x86_pkg_temp_thermal btcoexist rtl_pci rtlwifi rtl8723_common
[ 7612.095567] CPU: 3 PID: 4460 Comm: ifconfig Tainted: G        W       4.4.0+ #4
[ 7612.095570] Hardware name: LENOVO 20DFA04FCD/20DFA04FCD, BIOS J5ET48WW (1.19 ) 08/27/2015
[ 7612.095574]  00000000 00000000 da37fc70 c12ce7c5 00000000 da37fca0 c104cc59 c19d4454
[ 7612.095584]  00000003 0000116c c19d4784 00000096 c10508a8 c10508a8 00000200 c1b42400
[ 7612.095594]  f29be780 da37fcb0 c104ccad 00000009 00000000 da37fcbc c10508a8 f21f08b8
[ 7612.095604] Call Trace:
[ 7612.095614]  [<c12ce7c5>] dump_stack+0x41/0x5c
[ 7612.095620]  [<c104cc59>] warn_slowpath_common+0x89/0xc0
[ 7612.095628]  [<c10508a8>] ? __local_bh_enable_ip+0x58/0x80
[ 7612.095634]  [<c10508a8>] ? __local_bh_enable_ip+0x58/0x80
[ 7612.095640]  [<c104ccad>] warn_slowpath_null+0x1d/0x20
[ 7612.095646]  [<c10508a8>] __local_bh_enable_ip+0x58/0x80
[ 7612.095653]  [<c16b7d34>] destroy_conntrack+0x64/0xa0
[ 7612.095660]  [<c16b300f>] nf_conntrack_destroy+0xf/0x20
[ 7612.095665]  [<c1677565>] skb_release_head_state+0x55/0xa0
[ 7612.095670]  [<c16775bb>] skb_release_all+0xb/0x20
[ 7612.095674]  [<c167760b>] __kfree_skb+0xb/0x60
[ 7612.095679]  [<c16776f0>] kfree_skb+0x30/0x70
[ 7612.095686]  [<f81b869d>] ? rtl_pci_reset_trx_ring+0x22d/0x370 [rtl_pci]
[ 7612.095692]  [<f81b869d>] rtl_pci_reset_trx_ring+0x22d/0x370 [rtl_pci]
[ 7612.095698]  [<f81b87f9>] rtl_pci_start+0x19/0x190 [rtl_pci]
[ 7612.095705]  [<f81970e6>] rtl_op_start+0x56/0x90 [rtlwifi]
[ 7612.095712]  [<c17e3f16>] drv_start+0x36/0xc0
[ 7612.095717]  [<c17f5ab3>] ieee80211_do_open+0x2d3/0x890
[ 7612.095725]  [<c16820fe>] ? call_netdevice_notifiers_info+0x2e/0x60
[ 7612.095730]  [<c17f60bd>] ieee80211_open+0x4d/0x50
[ 7612.095736]  [<c16891b3>] __dev_open+0xa3/0x130
[ 7612.095742]  [<c183fa53>] ? _raw_spin_unlock_bh+0x13/0x20
[ 7612.095748]  [<c1689499>] __dev_change_flags+0x89/0x140
[ 7612.095753]  [<c127c70d>] ? selinux_capable+0xd/0x10
[ 7612.095759]  [<c1689589>] dev_change_flags+0x29/0x60
[ 7612.095765]  [<c1700b93>] devinet_ioctl+0x553/0x670
[ 7612.095772]  [<c12db758>] ? _copy_to_user+0x28/0x40
[ 7612.095777]  [<c17018b5>] inet_ioctl+0x85/0xb0
[ 7612.095783]  [<c166e647>] sock_ioctl+0x67/0x260
[ 7612.095788]  [<c166e5e0>] ? sock_fasync+0x80/0x80
[ 7612.095795]  [<c115c99b>] do_vfs_ioctl+0x6b/0x550
[ 7612.095800]  [<c127c812>] ? selinux_file_ioctl+0x102/0x1e0
[ 7612.095807]  [<c10a8914>] ? timekeeping_suspend+0x294/0x320
[ 7612.095813]  [<c10a256a>] ? __hrtimer_run_queues+0x14a/0x210
[ 7612.095820]  [<c1276e24>] ? security_file_ioctl+0x34/0x50
[ 7612.095827]  [<c115cef0>] SyS_ioctl+0x70/0x80
[ 7612.095832]  [<c1001804>] do_fast_syscall_32+0x84/0x120
[ 7612.095839]  [<c183ff91>] sysenter_past_esp+0x36/0x55
[ 7612.095844] ---[ end trace 97e9c637a20e8348 ]---

Signed-off-by: Wang YanQing <udknight@gmail.com>
Cc: Stable <stable@vger.kernel.org>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: Remove double check for cnt_after_linked
wang yanqing [Thu, 5 May 2016 15:08:22 +0000 (23:08 +0800)]
rtlwifi: Remove double check for cnt_after_linked

rtl_lps_enter does two successive check for cnt_after_linked
to make sure some time has elapsed after linked. The second
check isn't necessary, because if cnt_after_linked is bigger
than 5, it is bigger than 2 of course!

This patch remove the second check code.

Signed-off-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Add 4356 sdio support
Christian Daudt [Thu, 5 May 2016 00:55:20 +0000 (17:55 -0700)]
brcmfmac: Add 4356 sdio support

This adds support for the 4356-sdio wireless chip.

Signed-off-by: Christian Daudt <csd@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: rtl818x: silence uninitialized variable warning
Dan Carpenter [Wed, 4 May 2016 06:16:39 +0000 (09:16 +0300)]
rtlwifi: rtl818x: silence uninitialized variable warning

What about if "rtlphy->pwrgroup_cnt" is 2?  In that case we would use an
uninitialized "chnlgroup" variable and probably crash.  Maybe that can't
happen for some reason which is not obvious but in that case this patch
is harmless.

Setting it to zero seems like a standard default in the surrounding code
so it's probably fine here as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: Drop unnecessary include pcieport_if.h
Lukas Wunner [Tue, 3 May 2016 19:44:40 +0000 (21:44 +0200)]
mwifiex: Drop unnecessary include pcieport_if.h

This header file is only needed for drivers binding to a PCI bridge
device allocated by drivers/pci/pcie/portdrv_core.c. The mwifiex driver
doesn't do that nor use any symbols defined in pcieport_if.h.

Cc: Amitkumar Karwar <akarwar@marvell.com>
Cc: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: Fix logic error in enter/exit power-save mode
wang yanqing [Mon, 2 May 2016 16:38:36 +0000 (00:38 +0800)]
rtlwifi: Fix logic error in enter/exit power-save mode

In commit a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and
rtl_lps_enter() to use work queue"), the tests for enter/exit
power-save mode were inverted. With this change applied, the
wifi connection becomes much more stable.

Fixes: a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue")
Signed-off-by: Wang YanQing <udknight@gmail.com>
CC: Stable <stable@vger.kernel.org> [3.10+]
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: rtl818x: constify rtl_intf_ops structures
Julia Lawall [Sun, 1 May 2016 19:57:44 +0000 (21:57 +0200)]
rtlwifi: rtl818x: constify rtl_intf_ops structures

The rtl_intf_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore/wl12xx: Fix fw logger over sdio
Guy Mishol [Thu, 14 Apr 2016 08:58:17 +0000 (11:58 +0300)]
wlcore/wl12xx: Fix fw logger over sdio

The commit fb724ed5c617 ("wlcore: Fix regression in
wlcore_set_partition()") fixed wl12xx functionality.
However, it reverted the support in fw logger
over sdio in wl18xx.

This patch reverts the changes made and also fixes
the original functionality issue introduced in wl12xx.

Fixes: fb724ed5c617 ("wlcore: Fix regression in wlcore_set_partition()")
Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge tag 'iwlwifi-next-for-kalle-2016-05-10' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 11 May 2016 17:54:07 +0000 (20:54 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2016-05-10' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

* work for RX multiqueue continues (Sara);
* dynamic queue allocation work continues (Liad);
* add Luca as maintainer;
* a bunch of fixes and improvements all over;

8 years agoMAINTAINERS: add myself as co-maintainer of the iwlwifi driver
Luca Coelho [Tue, 19 Apr 2016 09:03:45 +0000 (12:03 +0300)]
MAINTAINERS: add myself as co-maintainer of the iwlwifi driver

I'm starting to take a more active role in the iwlwifi driver
maintainership.

Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: add default value to disable_11ac mod param description
Emmanuel Grumbach [Mon, 14 Mar 2016 13:21:06 +0000 (15:21 +0200)]
iwlwifi: add default value to disable_11ac mod param description

Small change to make it clear that the default value is false.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: grab NIC access only once on RX init
Sara Sharon [Tue, 12 Apr 2016 15:41:32 +0000 (18:41 +0300)]
iwlwifi: pcie: grab NIC access only once on RX init

When initializing RX we grab NIC access for every read and
write. This is redundant - we can just grab access once.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: use shadow registers for updating write pointer
Sara Sharon [Sun, 17 Apr 2016 12:08:59 +0000 (15:08 +0300)]
iwlwifi: pcie: use shadow registers for updating write pointer

The RX queues have a shadow register for the write pointer
that enables updates without grabbing NIC access. Use them
instead of the periphery registers because accessing those
is much more expensive.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: support dqa-mode agg on non-shared queue
Liad Kaufman [Thu, 13 Aug 2015 16:16:08 +0000 (19:16 +0300)]
iwlwifi: mvm: support dqa-mode agg on non-shared queue

In non-shared queues, DQA requires re-configuring existing
queues to become aggregated rather than allocating a new
one. It also requires "un-aggregating" an existing queue
when aggregations are turned off.

Support this requirement for non-shared queues.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: avoid msleep() with short timeout
Johannes Berg [Wed, 13 Apr 2016 08:31:14 +0000 (10:31 +0200)]
iwlwifi: pcie: avoid msleep() with short timeout

Since msleep is based on jiffies, it can sleep for a long time.
Use usleep_range() instead to shorten the maximum time.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: extend device reset delay
Johannes Berg [Wed, 13 Apr 2016 08:24:59 +0000 (10:24 +0200)]
iwlwifi: pcie: extend device reset delay

Newer hardware generations will take longer to be accessible again
after reset, so we need to wait longer before continuing any flow
that did a reset.

Rather than make the wait time configurable, simply extend it for
all.

Since all of these code paths can sleep, use usleep_range() rather
than mdelay().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: turn on SGI support for VHT 160MHz
Gregory Greenman [Tue, 12 Apr 2016 12:16:24 +0000 (15:16 +0300)]
iwlwifi: turn on SGI support for VHT 160MHz

Devices supporting VHT 160MHz width are supporting also Short GI.
Turn on this capability in vht cap.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: make configuration structs smaller
Johannes Berg [Tue, 12 Apr 2016 10:36:01 +0000 (12:36 +0200)]
iwlwifi: make configuration structs smaller

Since we have a lot of configuration structs (almost 70) saving
some memory in each one of them leads to an overall saving of
~2.6KiB of memory.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: don't access a nonexistent register upon assert
Emmanuel Grumbach [Tue, 12 Apr 2016 10:07:52 +0000 (13:07 +0300)]
iwlwifi: don't access a nonexistent register upon assert

The commit below added code to dump the content of FIFOs
that are present only on dual CPU products (8000 and up).
This broke 7265D whose firmware does advertise
IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG but doesn't have 2
CPUs. The current code does check the length of the FIFO
before dumping them (and the nonexistent FIFO has a 0
length), but we still accessed a register to set the FIFO
number and that made the DMA unhappy.

The impact was a much longer recovery upon firmware assert.

Fixes: 5b086414293f ("iwlwifi: mvm: support dumping UMAC internal txfifos")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: remove IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
Emmanuel Grumbach [Sun, 10 Apr 2016 05:48:46 +0000 (08:48 +0300)]
iwlwifi: remove IWLWIFI_DEBUG_EXPERIMENTAL_UCODE

This Kconfig option allows to load a firmware for
debugging with a different name. This mechanism has not
been used for a few years now and replacing the firmware
file works as well.
Kill this Kconfig option and all the code that goes with it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: use helpers to get iwl_mvm_sta
Sara Sharon [Sun, 10 Apr 2016 12:51:54 +0000 (15:51 +0300)]
iwlwifi: mvm: use helpers to get iwl_mvm_sta

Getting the mvm station out of station id requires dereferencing
the station id to get ieee80211_sta, then checking for pointer
validity and only then extract mvm station out.
Given that there are helpers to do it - use them instead of
duplicating the code whenever we need only mvm station.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove redundant alloc_ctx parameter
Sara Sharon [Sun, 10 Apr 2016 13:02:12 +0000 (16:02 +0300)]
iwlwifi: mvm: remove redundant alloc_ctx parameter

iwl_phy_db_set_section() is get called only from atomic
context, the alloc_ctx parameter is not needed. Remove it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: make phy_db size dynamic
Sara Sharon [Sun, 10 Apr 2016 09:27:25 +0000 (12:27 +0300)]
iwlwifi: mvm: make phy_db size dynamic

Driver is agnostic to the number of the phy_db entries and
only serves the firmware as a pipe to move the data from init
image to RT image.
As the size of the arrays may change (as it does in 9000 device)
allocate it dynamically. Firmware sends the largest index first
so we can use this to know how much we should allocate.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: set correct vht capability
Sara Sharon [Thu, 7 Apr 2016 14:26:53 +0000 (17:26 +0300)]
iwlwifi: mvm: set correct vht capability

Our device supports only 160 GHz and not 80+80. Fix
VHT flag accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: loosen nssn comparison to reorder buffer head
Sara Sharon [Wed, 30 Mar 2016 17:04:48 +0000 (20:04 +0300)]
iwlwifi: mvm: loosen nssn comparison to reorder buffer head

Up till now, the reorder buffer uses standard spec based comparison
when comparing the buffer status to NSSN. This indeed works for the
regular case, since we shouldn't cross the 2048 boundary without
getting a frame release notification.
However, this is problematic due to packet filtering that may be
performed by the FW while we are in d0i3. Theoretically we may
filter over 2048 packets, and then the check of the NSSN will get
incorrect.
Change the comparison to always trust nssn unless it is 64 or less
frames behind the head - which might happen due to a timeout.
This new comparison is to be used only when comparing reorder buffer
head with nssn, and not when comparing the packet SN to nssn or
reorder buffer head.
Put this in a separate commit as the logic is a bit tricky and
stands for its own commit message.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: pcie: don't wake up the NIC when writing CSRs in MSIX mode
Haim Dreyfuss [Sun, 3 Apr 2016 17:15:26 +0000 (20:15 +0300)]
iwlwifi: pcie: don't wake up the NIC when writing CSRs in MSIX mode

CSR registers are always available even when the NIC is not awake, no
need to wake up the NIC before accessing them. This has a huge impact
when we re-enable an interrupt at the end of the ISR since waking up the
NIC can take some time.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: Fix firmware name maximum length definition
Haim Dreyfuss [Wed, 6 Apr 2016 07:45:05 +0000 (10:45 +0300)]
iwlwifi: Fix firmware name maximum length definition

Previous patch had changed firmware name convention for
new generation product. The firmware name is now longer
than the former convention. Adapt max firmware name length
to the new convention.

Fixes: e1ba684f762b ("iwlwifi: 8000: fix MODULE_FIRMWARE input")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: don't allow negative reference count
Sara Sharon [Mon, 4 Apr 2016 16:30:05 +0000 (19:30 +0300)]
iwlwifi: mvm: don't allow negative reference count

Currently code allows mvm reference to become negative and
only warns in case mvm reference is released while reference
counting is 0.
However, we better prevent this from happening at all since
iwl_mvm_unref() may race against iwl_mvm_unref_all_except()
which is called on restart.
As a result we might get the same reference unreferenced twice
ending with a negative value:
An example for an easily reproduced log:
    [ 2689.909166] iwl_mvm_ref Take mvm reference - type 8
    [ 2690.732716] iwl_mvm_unref_all_except Cleanup: remove mvm ref type 8 (1)
    [ 2690.849708] iwl_mvm_unref Leave mvm reference - type 8
    [ 2690.849721] WARNING: ... iwl_mvm_unref+0xb0/0xc0 [iwlmvm]()

If there will be yet another another restart iwl_mvm_unref_all_except
will run from 0 up to ref count, and since it is unsigned, we will throw
the transport ref count completely out of balance:
    iwl_mvm_unref_all_except[I] -- Cleanup: remove mvm ref type 8 (255)
    iwl_trans_slv_unref[I] -- rpm counter: 0
    iwl_trans_slv_unref[I] -- rpm counter: -1
    iwl_trans_slv_unref[I] -- rpm counter: -2
 ...
    iwl_trans_slv_unref[I] -- rpm counter: -253
    iwl_trans_slv_unref[I] -- rpm counter: -254

As there is no valid scenario where we can get to a negative
reference count - prevent it from happening.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add more registers to dump upon error
Golan Ben-Ami [Wed, 6 Apr 2016 08:59:50 +0000 (11:59 +0300)]
iwlwifi: mvm: add more registers to dump upon error

Add UREG, RXFC, RFH, WMAL and RL2P registers to the prph dump
upon error. These regesiters could help to debug MSI-X and other
issues.

These register should be dumped only when multi-queue rx is supported
so separate the prph ranges static array to two different arrays,
and enable dumping different prph ranges according to run-time
decision.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add a new mvm reference type for RX data
Luca Coelho [Wed, 30 Mar 2016 12:05:56 +0000 (15:05 +0300)]
iwlwifi: mvm: add a new mvm reference type for RX data

When a data packet is received, we need to make sure that we stay
awake until it can be processed and wait a while before trying to
enter runtime_suspend os system_suspend again.  To do so, add a new
reference type for RX data and take the reference when sending the
packet to mac80211.  We only do this for data packets, all the other
RX packets sent by the firmware (e.g. notifications) are not a reason
to prevent suspend.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: pass station to mac80211 RX where known
Johannes Berg [Thu, 10 Mar 2016 10:55:44 +0000 (11:55 +0100)]
iwlwifi: mvm: pass station to mac80211 RX where known

When we've already looked up the transmitter station, we can just
pass it to mac80211 using the new ieee80211_rx_napi(). This saves
the overhead of looking it up in mac80211 again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: consider VHT 160MHz while parsing NVM
Gregory Greenman [Sun, 3 Apr 2016 11:06:12 +0000 (14:06 +0300)]
iwlwifi: consider VHT 160MHz while parsing NVM

Devices belonging to 9000 family can support VHT 160MHz channel
width, so need to consider it when configuring VHT capabilities.
However, NVM file doesn't have a single bit specifying that 160MHz
is supported. This patch turns on 160MHz support in VHT capabilities
in case there's at least one channel supporting 160MHz.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: allow combining different phy images with mac images
Haim Dreyfuss [Sun, 3 Apr 2016 16:55:59 +0000 (19:55 +0300)]
iwlwifi: allow combining different phy images with mac images

Currently there is one to one function between device id to it's ucode.
The new generation devices allows to combine different phy and mac images.
Now we have two different ucode images with the same device id.
Read RF ID to identify phy image and overwrite it if needed.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: wake from runtime suspend before sending sync commands
Luca Coelho [Fri, 11 Mar 2016 10:12:16 +0000 (12:12 +0200)]
iwlwifi: wake from runtime suspend before sending sync commands

If a host command was queued while in runtime suspend, it would go out
before the D0I3_END_CMD was sent.  Sometimes it works, but sometimes
it fails, and it is obviously the wrong thing to do.

To fix this, have the opmode take a reference before sending a SYNC
command and make the pcie trans wait for the runtime state to become
active before actually queueing the command.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: allow a debug knob for Tx A-MSDU even if rate control forbids it
Emmanuel Grumbach [Sun, 3 Apr 2016 07:15:59 +0000 (10:15 +0300)]
iwlwifi: mvm: allow a debug knob for Tx A-MSDU even if rate control forbids it

There is a debugfs knob to configure the maximal length
of the A-MSDU. If this value is not 0 (which is the
default), allow Tx A-MSDU even if the rate control
disallows it.
While at it, add "unlikely" to the if that limits the
length of the A-MSDU based on the debugfs hook.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: Rename 9560 to 9260 and add new PCI IDs for it
Haim Dreyfuss [Sun, 3 Apr 2016 15:56:15 +0000 (18:56 +0300)]
iwlwifi: Rename 9560 to 9260 and add new PCI IDs for it

Rename 9560 to 9260.
Add new PCI ID for 9260 and change some entries from 5165 to 9260.
Also order the 9000 series.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add a flag to disable checksum
Sara Sharon [Sun, 3 Apr 2016 07:19:16 +0000 (10:19 +0300)]
iwlwifi: mvm: add a flag to disable checksum

Add a constant to allow disabling checksum. This will enable easier
debugging in early phases.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: advertise RSS queue usage
Johannes Berg [Wed, 30 Mar 2016 09:05:16 +0000 (11:05 +0200)]
iwlwifi: mvm: advertise RSS queue usage

In order for mac80211 to use per-CPU statistics for RSS RX, the
driver needs to advertise that it uses RSS. Do this when using
more than a single queue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: trans: don't call the trans-specific ref/unref directly
Luca Coelho [Wed, 30 Mar 2016 17:59:27 +0000 (20:59 +0300)]
iwlwifi: trans: don't call the trans-specific ref/unref directly

It's cleaner to always call the iwl_trans_ref/unref() functions
instead of sometimes calling the trans-specific ops directly.  This
also prepares for moving some of the code from the trans-specific ops
to the common trans code.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: support queue removal in ADD_STA hcmd
Liad Kaufman [Mon, 21 Sep 2015 12:14:23 +0000 (14:14 +0200)]
iwlwifi: mvm: support queue removal in ADD_STA hcmd

To indicate to the FW that a queue has been removed, an
existing flag in the ADD_STA HCMD (that hasn't been in use)
has been changed to indicate that a queue is being removed
from a STA.

Update this in the driver code.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: utilize the frame release infrastructure
Sara Sharon [Sun, 28 Feb 2016 13:41:47 +0000 (15:41 +0200)]
iwlwifi: mvm: utilize the frame release infrastructure

The firmware will send frame release notification in order
to release "stuck" frames on a queue where no more frames
arrive on.
Upon receiving the message the driver shall indicate the frames
up to the NSSN.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add reorder timeout per frame
Sara Sharon [Sun, 28 Feb 2016 18:28:17 +0000 (20:28 +0200)]
iwlwifi: mvm: add reorder timeout per frame

Add a timer in order to release expired frames from the
reorder buffer.
This is needed since some APs do not retransmit frames
to fill in the reorder holes and in TCP it results with
a complete stall of traffic.

This has a few side effects on the general design:

The nssn may not reflect the the head of the reorder buffer.
This situation is valid, and packets with SN lower than the
reorder buffer head will be dropped.

Another side effect is that since the reorder timer might expire
we need to lock the reorder buffer.
This however is fine since the locking is only inside a
single reorder buffer between RX path and reorder timeout and
there is no outside contention.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add reorder buffer per queue
Sara Sharon [Wed, 23 Mar 2016 14:32:02 +0000 (16:32 +0200)]
iwlwifi: mvm: add reorder buffer per queue

Next hardware will direct packets to core based on the TCP/UDP
streams.
This logic can create holes in reorder buffer since packets that
belong to other stream were directed to a different core.
However, those are valid holes and the packets can be indicated
in L3 order.

The hardware will utilize a mechanism of informing the driver of
the normalized ssn and the driver shall release all packets that
SN is lower than the nssn.
This enables managing the reorder across the queues without sharing
any data between them.

The reorder buffer is allocated and released directly in the RX path
in order to avoid various races between control path and rx path.
The code utilizes the internal messaging to notify rx queues of when
to delete the reorder buffer.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add firmware API name comment
Johannes Berg [Wed, 30 Mar 2016 09:57:01 +0000 (11:57 +0200)]
iwlwifi: mvm: add firmware API name comment

Add the firmware API name to the struct iwl_wowlan_gtk_status.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add infrastructure for tracking BA session in driver
Sara Sharon [Sun, 20 Mar 2016 14:23:41 +0000 (16:23 +0200)]
iwlwifi: mvm: add infrastructure for tracking BA session in driver

According to the spec when a BA session is started there
is a timeout set for the session in the ADDBA request.
If there is not activity on the TA/TID then the session
expires and a DELBA is sent.
In order to check for the timeout, data must be shared
among the rx queues.
Add a timer that runs as long as BA session is active
for the station and stops aggregation session if needed.
This patch also lays the infrastructure for the reordering
buffer which will be enabled in the next patches.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: change RX sync notification to be an attribute and not a type
Sara Sharon [Wed, 23 Mar 2016 14:31:43 +0000 (16:31 +0200)]
iwlwifi: mvm: change RX sync notification to be an attribute and not a type

Currently the sync notification is a type of notification. However, it
is better fitted as an attribute of a notification, since there might
be another message in the payload (delba for instance) that should be
sent while control path is waiting for all queues to process.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: implement driver RX queues sync command
Sara Sharon [Thu, 18 Feb 2016 12:21:12 +0000 (14:21 +0200)]
iwlwifi: mvm: implement driver RX queues sync command

mac80211 will call the driver whenever there is a race between
RSS queues and control path that requires a processing of all
pending frames in RSS queues.
Implement that by utilizing the internal notification mechanism:
queue a message to all queues. When the message is received on
a queue it decrements the atomic counter. This guarantees that
all pending frames in the RX queue were processed since the message
is in order inside the queue.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agomwifiex: change sleep cookie poll count
Shengzhen Li [Tue, 26 Apr 2016 14:25:45 +0000 (07:25 -0700)]
mwifiex: change sleep cookie poll count

Sometimes current polling count is not sufficient.
This patch increases it to 100.

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoiwlwifi: Edit the 8265 SDIO ID
Mordechai Goodstein [Tue, 29 Mar 2016 11:41:49 +0000 (14:41 +0300)]
iwlwifi: Edit the 8265 SDIO ID

Add new 8265 series SDIO ID.

Signed-off-by: Mordechai Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: support p2p device frames tx on dqa queue #2
Liad Kaufman [Sun, 9 Aug 2015 16:26:56 +0000 (19:26 +0300)]
iwlwifi: mvm: support p2p device frames tx on dqa queue #2

Support sending P2P device frames should be sent from
queue #2, as required in DQA mode.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: allocate queue for probe response in dqa mode
Liad Kaufman [Tue, 4 Aug 2015 12:19:18 +0000 (15:19 +0300)]
iwlwifi: mvm: allocate queue for probe response in dqa mode

In DQA mode, allocate a dedicated queue (#9) for P2P GO/soft
AP probe responses.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoMerge tag 'iwlwifi-for-kalle-2016-05-04' of git://git.kernel.org/pub/scm/linux/kernel...
Luca Coelho [Tue, 10 May 2016 08:56:24 +0000 (11:56 +0300)]
Merge tag 'iwlwifi-for-kalle-2016-05-04' of git://git./linux/kernel/git/iwlwifi/iwlwifi-fixes

* fix P2P rates (and possibly other issues)

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoMerge tag 'mac80211-next-for-davem-2016-04-13' of git://git.kernel.org/pub/scm/linux...
Luca Coelho [Tue, 10 May 2016 07:30:56 +0000 (10:30 +0300)]
Merge tag 'mac80211-next-for-davem-2016-04-13' of git://git./linux/kernel/git/jberg/mac80211-next into master

To synchronize with Kalle, here's just a big change that affects
all drivers - removing the duplicated enum ieee80211_band and
replacing it by enum nl80211_band. On top of that, just a small
documentation update.

8 years agoath9k: Fix symbol overlap window for half/quarter channels
Helmut Schaa [Fri, 29 Apr 2016 13:06:34 +0000 (15:06 +0200)]
ath9k: Fix symbol overlap window for half/quarter channels

Since commit cd6cfd7311a385144a2f9c74f692ae2df3ae033f
"ath9k: do not set half/quarter channel flags in AR_PHY_MODE" the
condition "rfMode & (AR_PHY_MODE_QUARTER | AR_PHY_MODE_HALF)" would
never evaluate to true.

Fix this by using the available IS_CHAN_HALF_RATE and IS_CHAN_QUARTER_RATE
marcros instead.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Simplify ar9003_hw_tx99_set_txpower
Helmut Schaa [Thu, 28 Apr 2016 14:45:06 +0000 (16:45 +0200)]
ath9k: Simplify ar9003_hw_tx99_set_txpower

There's no need to keep the same for loop twice in the code.
Move the txpower cap before the loop to reduce code complexity.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Move TX99 config option under ath9k debugging
Helmut Schaa [Thu, 28 Apr 2016 14:45:05 +0000 (16:45 +0200)]
ath9k: Move TX99 config option under ath9k debugging

Since ATH9K_TX99 depends on ATH9K_DEBUGFS anyway move it there
such that "make menuconfig" will indent TX99 support below ath9k
debugging.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: reuse ar9003_hw_tx_power_regwrite for tx99 setup
Helmut Schaa [Thu, 28 Apr 2016 14:45:04 +0000 (16:45 +0200)]
ath9k: reuse ar9003_hw_tx_power_regwrite for tx99 setup

The same functionality as ar9003_hw_tx_power_regwrite is hardcoded in
ar9003_hw_tx99_set_txpower. Just reuse the existing ar9003_hw_tx_power_regwrite
for TX99 setup too.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: release pre_cal_file while unloading driver
Rajkumar Manoharan [Wed, 27 Apr 2016 10:56:26 +0000 (16:26 +0530)]
ath10k: release pre_cal_file while unloading driver

Failing to release pre_cal_file caldata on deinit causes memory leak.

Fixes: b131129d9657 ("ath10k: fix calibration init sequence of qca99x0")
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: update bss channel survey information
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:22 +0000 (16:23 +0530)]
ath10k: update bss channel survey information

During hw scan, firmware sends two channel information events (pre-
complete, complete) to host for each channel change. The snap shot of cycle
counters (rx_clear and total) between these two events are given for
survey dump. In order to get latest survey statistics of all channels, a
scan request has to be issued. In general, an AP DUT is brought up, it
won't leave BSS channel except few cases like overlapping bss or radar
detection. So survey statistics of bss channel is always referring to
older data that are collected before starting AP (either ACS/OBSS scan).

To collect latest survey information from target, firmware provides WMI
interface to read cycle counters from hardware. For each survey dump
request, BSS channel cycle counters are read and cleared in hardware.
This makes sure that behavior is in align with ath9k survey report.
So survey dump always gives snap shot of cycle counters b/w two survey
requests.

Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: handle pdev_chan_info wmi event
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:21 +0000 (16:23 +0530)]
ath10k: handle pdev_chan_info wmi event

Add handler to process bss channel information wmi event that
will be received upon sending pdev_chan_info_request wmi command.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: implement wmi_pdev_bss_chan_info_request
Rajkumar Manoharan [Wed, 27 Apr 2016 10:53:20 +0000 (16:23 +0530)]
ath10k: implement wmi_pdev_bss_chan_info_request

Add WMI ops to send pdev_bss_chan_info_request command to target.
This command will be used to retrieve updated cycle counters and noise
floor value of current operating channel (bss channel).

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>