GitHub/moto-9609/android_kernel_motorola_exynos9610.git
7 years agoMerge tag 'iwlwifi-next-for-kalle-2017-02-08' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 8 Feb 2017 19:28:36 +0000 (21:28 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2017-02-08' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Some patches focusing on bugfixes for v4.11:

  * Fix 802.11w, which was failing to due an IGTK bug;
  * A few more bugzilla bug fixes;
  * A channel-switch race condition fix;
  * Some fixes related to suspend/resume with new HW;
  * The RF-kill saga continues;
  * And some other fixes here and there...

7 years agoiwlwifi: mvm: avoid exceeding the allowed print length
Golan Ben-Ami [Wed, 25 Jan 2017 13:11:30 +0000 (15:11 +0200)]
iwlwifi: mvm: avoid exceeding the allowed print length

Divide a mfuart related print so it won't exceed the allowed
MAX_MSG_LEN (110 bytes) per print.

Fixes: 19f63c531b85 ("iwlwifi: mvm: support v2 of mfuart load notification")
Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: Fix removal of IGTK
Ilan Peer [Mon, 16 Jan 2017 13:07:03 +0000 (15:07 +0200)]
iwlwifi: mvm: Fix removal of IGTK

When removing an IGTK, iwl_mvm_send_sta_igtk() was
called before station ID was retrieved, so the function
was invoked with an invalid station ID. Fix this by first
getting the station ID.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=192411
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: avoid race condition in ADD_STA.
Goodstein, Mordechay [Sun, 15 Jan 2017 14:00:12 +0000 (16:00 +0200)]
iwlwifi: mvm: avoid race condition in ADD_STA.

The race happens when we send ADD_STA(auth->assoc) -> LQ_CMD
between the commands the FW sometimes loses the medium for AUX, and
sends a ndp to the AP and the flow becomes, ADD_STA -> send ndp -> LQ_CMD
the problem is that there's no rates yet defined for sending the ndp and
FW generates an assert.

The fix: change the order of the commands to LQ_CMD -> ADD_STA

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: Fix CSA received immediately after association
Avraham Stern [Mon, 9 Jan 2017 13:39:15 +0000 (15:39 +0200)]
iwlwifi: mvm: Fix CSA received immediately after association

The session protection set for association is only removed when
BSS_CHANGED_BEACON_INFO is set and BSS_CHANGED_ASSOC is not set.

However, mac80211 may set both on association (in case a beacon was
already received). In this case, mac80211 will not set
BSS_CHANGED_BEACON_INFO on the next beacons because it has already
notified the beacon change, so the session protection is never removed
(until the session protection ends).

When a CSA is received within this time, the station will fail to
folllow the channel switch because it cannot schedule the time event.

Fix this by removing the session protection when
BSS_CHANGED_BEACON_INFO and BSS_CHANGED_ASSOC are both set.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: set STATUS_RFKILL immediately after interrupt
Golan Ben Ami [Sun, 11 Dec 2016 15:12:47 +0000 (17:12 +0200)]
iwlwifi: pcie: set STATUS_RFKILL immediately after interrupt

Currently, when getting a RFKILL interrupt, the transport enters a flow
in which it stops the device, disables other interrupts, etc. After
stopping the device, the transport resets the hw, and sleeps. During
the sleep, a context switch occurs and host commands are sent by upper
layers (e.g. mvm) to the fw. This is possible since the op_mode layer
and the transport layer hold different mutexes.

Since the STATUS_RFKILL bit isn't set, the transport layer doesn't
recognize that RFKILL was toggled on, and no commands can actually be
sent, so it enqueues the command to the tx queue and sets a timer on
the queue.

After switching context back to stopping the device, STATUS_RFKILL is
set, and then the transport can't send the command to the fw.
This eventually results in a queue hang.

Fix this by setting STATUS_RFKILL immediately when
the interrupt is fired.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: don't call << operator with a negative value
Emmanuel Grumbach [Sat, 7 Jan 2017 17:57:46 +0000 (19:57 +0200)]
iwlwifi: mvm: don't call << operator with a negative value

In https://bugzilla.kernel.org/show_bug.cgi?id=177341 Bob
reported a UBSAN WARNING on rs.c in iwldvm.
Fix the same bug in iwlmvm.

This because
i = index - 1;
for (mask = (1 << i); i >= 0; i--, mask >>= 1)

is unsafe: i could be negative and hence we can call <<
on a negative value.
This bug doesn't have any real impact since the condition
of the for loop will prevent any usage of mask.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177341
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: dvm: don't call << operator with a negative value
Emmanuel Grumbach [Sat, 7 Jan 2017 17:57:46 +0000 (19:57 +0200)]
iwlwifi: dvm: don't call << operator with a negative value

In https://bugzilla.kernel.org/show_bug.cgi?id=177341 Bob
reported a UBSAN WARNING on rs.c.

Undefined behaviour in drivers/net/wireless/intel/iwlwifi/dvm/rs.c:746:18

This because
i = index - 1;
for (mask = (1 << i); i >= 0; i--, mask >>= 1)

is unsafe: i could be negative and hence we can call <<
on a negative value.
This bug doesn't have any real impact since the condition
of the for loop will prevent any usage of mask.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177341
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: make RTPM depend on EXPERT
Emmanuel Grumbach [Sat, 7 Jan 2017 21:03:40 +0000 (23:03 +0200)]
iwlwifi: make RTPM depend on EXPERT

Enabling the RTPM Kconfig option can be fairly risky.
Runtime PM must be validated against a specific platform
before it can be safely enabled. Hence, it makes no sense
for distros and other big OS vendors to enable it since
they ship code to various systems and unknown platform.

Make sure that this is hinted properly by making the
IWLWIFI_PCIE_RTPM Kconfig option depend on EXPERT.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=172411
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: don't increment / decrement a bool
Emmanuel Grumbach [Sat, 7 Jan 2017 18:11:47 +0000 (20:11 +0200)]
iwlwifi: pcie: don't increment / decrement a bool

David reported that the code I added uses the decrement
and increment operator on a boolean variable.

Fix that.

Fixes: 0cd58eaab148 ("iwlwifi: pcie: allow the op_mode to block the tx queues")
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 8 Feb 2017 15:46:02 +0000 (17:46 +0200)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.11. Major changes:

ath10k

* add debugfs file peer_debug_trigger for debugging firmware

7 years agort2x00: remove queue_entry from skbdesc
Stanislaw Gruszka [Wed, 8 Feb 2017 12:51:31 +0000 (13:51 +0100)]
rt2x00: remove queue_entry from skbdesc

queue_entry field of skbdesc is not read any more, remove it to allow
skbdesc contain other data.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: call entry directly in rt2x00_dump_frame
Stanislaw Gruszka [Wed, 8 Feb 2017 12:51:30 +0000 (13:51 +0100)]
rt2x00: call entry directly in rt2x00_dump_frame

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort61pci: use entry directly
Stanislaw Gruszka [Wed, 8 Feb 2017 12:51:29 +0000 (13:51 +0100)]
rt61pci: use entry directly

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00usb: fix anchor initialization
Stanislaw Gruszka [Wed, 8 Feb 2017 11:18:10 +0000 (12:18 +0100)]
rt2x00usb: fix anchor initialization

If device fail to initialize we can OOPS in rt2x00lib_remove_dev(), due
to using uninitialized usb_anchor structure:

[  855.435820] ieee80211 phy3: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x1000 with error -19
[  855.435826] ieee80211 phy3: rt2800_probe_rt: Error - Invalid RT chipset 0x0000, rev 0000 detected
[  855.435829] ieee80211 phy3: rt2x00lib_probe_dev: Error - Failed to allocate device
[  855.435845] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028
[  855.435900] IP: _raw_spin_lock_irq+0xd/0x30
[  855.435926] PGD 0
[  855.435953] Oops: 0002 [#1] SMP
<snip>
[  855.437011] Call Trace:
[  855.437029]  ? usb_kill_anchored_urbs+0x27/0xc0
[  855.437061]  rt2x00lib_remove_dev+0x190/0x1c0 [rt2x00lib]
[  855.437097]  rt2x00lib_probe_dev+0x246/0x7a0 [rt2x00lib]
[  855.437149]  ? ieee80211_roc_setup+0x9e/0xd0 [mac80211]
[  855.437183]  ? __kmalloc+0x1af/0x1f0
[  855.437207]  ? rt2x00usb_probe+0x13d/0xc50 [rt2x00usb]
[  855.437240]  rt2x00usb_probe+0x155/0xc50 [rt2x00usb]
[  855.437273]  rt2800usb_probe+0x15/0x20 [rt2800usb]
[  855.437304]  usb_probe_interface+0x159/0x2d0
[  855.437333]  driver_probe_device+0x2bb/0x460

Patch changes initialization sequence to fix the problem.

Cc: Vishal Thanki <vishalthanki@gmail.com>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00usb: do not anchor rx and tx urb's
Stanislaw Gruszka [Wed, 8 Feb 2017 11:18:09 +0000 (12:18 +0100)]
rt2x00usb: do not anchor rx and tx urb's

We might kill TX or RX urb during rt2x00usb_flush_entry(), what can
cause anchor list corruption like shown below:

[ 2074.035633] WARNING: CPU: 2 PID: 14480 at lib/list_debug.c:33 __list_add+0xac/0xc0
[ 2074.035634] list_add corruption. prev->next should be next (ffff88020f362c28), but was dead000000000100. (prev=ffff8801d161bb70).
<snip>
[ 2074.035670] Call Trace:
[ 2074.035672]  [<ffffffff813bde47>] dump_stack+0x63/0x8c
[ 2074.035674]  [<ffffffff810a2231>] __warn+0xd1/0xf0
[ 2074.035676]  [<ffffffff810a22af>] warn_slowpath_fmt+0x5f/0x80
[ 2074.035678]  [<ffffffffa073855d>] ? rt2x00usb_register_write_lock+0x3d/0x60 [rt2800usb]
[ 2074.035679]  [<ffffffff813dbe4c>] __list_add+0xac/0xc0
[ 2074.035681]  [<ffffffff81591c6c>] usb_anchor_urb+0x4c/0xa0
[ 2074.035683]  [<ffffffffa07322af>] rt2x00usb_kick_rx_entry+0xaf/0x100 [rt2x00usb]
[ 2074.035684]  [<ffffffffa0732322>] rt2x00usb_clear_entry+0x22/0x30 [rt2x00usb]

To fix do not anchor TX and RX urb's, it is not needed as during
shutdown we kill those urbs in rt2x00usb_free_entries().

Cc: Vishal Thanki <vishalthanki@gmail.com>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Move items out of rtl_pci_priv and rtl_usb_priv
Larry Finger [Tue, 7 Feb 2017 15:14:21 +0000 (09:14 -0600)]
rtlwifi: Move items out of rtl_pci_priv and rtl_usb_priv

In commit 6773386f977c ("rtlwifi: rtl8192c-common: Fix "BUG: KASAN:"),
a BUG detected when CONFIG_KASAN=y was fixed by reordering the layouts
of struct rtl_pci_priv, and struct rtl_usb_priv so that the variables
used by both PCI and USB drivers have the same offsets in both structs.
The better fix of relocating the critical variables into struct rtl_priv
was deferred as these changes do not have to be applied to stable
kernels.

This change also removes CamelCase variables with pLed0 => pled0.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: merge two remaining brcmf_err macros
Rafał Miłecki [Thu, 2 Feb 2017 21:33:15 +0000 (22:33 +0100)]
brcmfmac: merge two remaining brcmf_err macros

Now we always have __brcmf_err function we can do perfectly fine with
just one macro.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: switch to C function (__brcmf_err) for printing errors
Rafał Miłecki [Thu, 2 Feb 2017 21:33:14 +0000 (22:33 +0100)]
brcmfmac: switch to C function (__brcmf_err) for printing errors

This will allow extending code and using more detailed messages e.g.
with the help of dev_err.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: merge two brcmf_err macros into one
Rafał Miłecki [Thu, 2 Feb 2017 21:33:13 +0000 (22:33 +0100)]
brcmfmac: merge two brcmf_err macros into one

This allows simplifying the code by adding a simple IS_ENABLED check for
CONFIG_BRCMDB symbol.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoath10k: select WANT_DEV_COREDUMP
Johannes Berg [Tue, 7 Feb 2017 22:29:33 +0000 (23:29 +0100)]
ath10k: select WANT_DEV_COREDUMP

This is necessary so that - if ath10k is the only driver using
dev_coredump*() - the functionality is built into the kernel.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: include moduleparam.h
Johannes Berg [Tue, 7 Feb 2017 14:33:28 +0000 (15:33 +0100)]
wil6210: include moduleparam.h

This now declares a module parameter, so include the necessary
header file for that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: remove unneeded semicolon
Waldemar Rymarkiewicz [Thu, 2 Feb 2017 17:53:42 +0000 (18:53 +0100)]
ath10k: remove unneeded semicolon

Remove redundant semicolon after switch statement.

Signed-off-by: Waldemar Rymarkiewicz <ext.waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoiwlwifi: mvm: use the PROBE_RESP_QUEUE to send deauth to unknown station
Emmanuel Grumbach [Wed, 28 Dec 2016 08:43:02 +0000 (10:43 +0200)]
iwlwifi: mvm: use the PROBE_RESP_QUEUE to send deauth to unknown station

When we send a deauth to a station we don't know about, we
need to use the PROBE_RESP queue. This can happen when we
send a deauth to a station that is not associated to us.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix reorder timer re-arming
Sara Sharon [Tue, 3 Jan 2017 19:03:35 +0000 (21:03 +0200)]
iwlwifi: mvm: fix reorder timer re-arming

When NSSN is behind the reorder buffer due to timeout
the reorder timer isn't getting re-armed until NSSN
catches up. Fix it.

Fixes: 0690405fef29 ("iwlwifi: mvm: add reorder timeout per frame")

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix references to first_agg_queue in DQA mode
Sara Sharon [Sun, 1 Jan 2017 16:42:23 +0000 (18:42 +0200)]
iwlwifi: mvm: fix references to first_agg_queue in DQA mode

In DQA mode, first_agg_queue is initialized to
IWL_MVM_DQA_MIN_DATA_QUEUE. This causes two bugs in the tx response
flow:

1. When TX fails, we set IEEE80211_TX_STAT_AMPDU_NO_BACK regardless
   if we actually have aggregation open on the queue. This causes
   mac80211 to send a BAR frame even though there is no aggregation
   open.
   Fix that by simply checking the AMPDU flag that is set on by
   mac80211 for AMPDU packets.

2. When reclaiming frames in aggregation mode, we reclaim based on
   scheduler ssn and not the SN.
   The reason is that scheduler ssn may be ahead of SN due to a hole
   in the BA window that was filled.
   However, if we have aggregations open on IWL_MVM_DQA_BSS_CLIENT_QUEUE
   the reclaim flow will still go to the code of non-aggregation
   instead of the aggregation code since IWL_MVM_DQA_BSS_CLIENT_QUEUE
   is smaller than IWL_MVM_DQA_MIN_DATA_QUEUE, although it is a valid
   aggregation queue.
   Fix that by always using the aggregation reclaim code by default in
   DQA mode (currently it is implicitly used by default for all queues
   except the reserved BSS queue).

Fixes: cf961e16620f ("iwlwifi: mvm: support dqa-mode agg on non-shared queue")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix a print of NSS for HT rate
Gregory Greenman [Wed, 21 Dec 2016 14:18:44 +0000 (16:18 +0200)]
iwlwifi: mvm: fix a print of NSS for HT rate

Handling of the number of space time streams was missing for HT rate in
rate printing function. Fix it.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: Re-configure IVAR table after stop device
Golan Ben Ami [Thu, 15 Dec 2016 08:22:36 +0000 (10:22 +0200)]
iwlwifi: pcie: Re-configure IVAR table after stop device

When getting RF_KILL and disabling radio, the device gets stopped
and reset. This erases the IVAR table that matches the interrupt
to its cause, and is essential for MSIX proper functionality.
Till now, the table wasn't re-configured after the reset, and
therefore the interrupt that enabled radio didn't fire on the
right irq, and the driver didn't handle it correctly.

To fix this, configure the IVAR table again after resetting the
device.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: re-configure IVAR table after suspend-resume
Haim Dreyfuss [Mon, 12 Dec 2016 12:09:49 +0000 (14:09 +0200)]
iwlwifi: pcie: re-configure IVAR table after suspend-resume

During the suspend/resume flow some HW blocks are reset.  This causes
the IVAR table to be completely erased.  This table is where interrupt
causes are bound to specific IRQs.  When the table is empty the
interrupt handlers are not called correctly.  Fix this by reconfiguring
the IVAR table after resume.

Fixes: 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: separate between SW and HW MSIX configuration
Haim Dreyfuss [Tue, 13 Dec 2016 10:40:34 +0000 (12:40 +0200)]
iwlwifi: pcie: separate between SW and HW MSIX configuration

The MSIX configuration flow includes two different stages:
configuring the HW by writing to the IVAR table and configuring the SW
to reflect the HW configuration.
The HW configuration is needed on each HW reset,
whereas the SW configuration is only needed during the init flow.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: move msix conf functions above other functions
Haim Dreyfuss [Mon, 12 Dec 2016 11:57:02 +0000 (13:57 +0200)]
iwlwifi: pcie: move msix conf functions above other functions

msix configuration functions should be called by other functions.
For example by pcie_d3_resume, move it above to enable it.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoath9k: fix race condition in enabling/disabling IRQs
Felix Fietkau [Thu, 2 Feb 2017 09:14:52 +0000 (10:14 +0100)]
ath9k: fix race condition in enabling/disabling IRQs

The code currently relies on refcounting to disable IRQs from within the
IRQ handler and re-enabling them again after the tasklet has run.

However, due to race conditions sometimes the IRQ handler might be
called twice, or the tasklet may not run at all (if interrupted in the
middle of a reset).

This can cause nasty imbalances in the irq-disable refcount which will
get the driver permanently stuck until the entire radio has been stopped
and started again (ath_reset will not recover from this).

Instead of using this fragile logic, change the code to ensure that
running the irq handler during tasklet processing is safe, and leave the
refcount untouched.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k_hw: check if the chip failed to wake up
Felix Fietkau [Thu, 2 Feb 2017 09:14:51 +0000 (10:14 +0100)]
ath9k_hw: check if the chip failed to wake up

In an RFC patch, Sven Eckelmann and Simon Wunderlich reported:

"QCA 802.11n chips (especially AR9330/AR9340) sometimes end up in a
state in which a read of AR_CFG always returns 0xdeadbeef.
This should not happen when when the power_mode of the device is
ATH9K_PM_AWAKE."

Include the check for the default register state in the existing MAC
hang check.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: rename tx_complete_work to hw_check_work
Felix Fietkau [Thu, 2 Feb 2017 09:14:50 +0000 (10:14 +0100)]
ath9k: rename tx_complete_work to hw_check_work

Also include common MAC alive check. This should make the hang checks
more reliable for modes where beacons are not sent and is used as a
starting point for further hang check improvements

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowcn36xx: Implement cancel_hw_scan
Bjorn Andersson [Wed, 1 Feb 2017 15:27:47 +0000 (07:27 -0800)]
wcn36xx: Implement cancel_hw_scan

In the even that the wcn36xx interface is brought down while a hw_scan
is active we must abort and wait for the ongoing scan to signal
completion to mac80211.

Reported-by: Mart Raudsepp <leio@gentoo.org>
Fixes: 886039036c20 ("wcn36xx: Implement firmware assisted scan")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix reading sram contents for QCA4019
Ashok Raj Nagarajan [Tue, 31 Jan 2017 18:36:51 +0000 (00:06 +0530)]
ath10k: fix reading sram contents for QCA4019

With QCA4019 platform, SRAM address can be accessed directly from host but
currently, we are assuming sram addresses cannot be accessed directly and
hence we convert the addresses.

While there, clean up growing hw checks during conversion of target CPU
address to CE address. Now we have function pointer pertaining to different
chips.

Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix boot failure in UTF mode/testmode
Tamizh chelvam [Thu, 2 Feb 2017 06:32:18 +0000 (08:32 +0200)]
ath10k: fix boot failure in UTF mode/testmode

Rx filter reset and the dynamic tx switch mode (EXT_RESOURCE_CFG)
configuration are causing the following errors when UTF firmware
is loaded to the target.

Error message 1:
[ 598.015629] ath10k_pci 0001:01:00.0: failed to ping firmware: -110
[ 598.020828] ath10k_pci 0001:01:00.0: failed to reset rx filter: -110
[ 598.141556] ath10k_pci 0001:01:00.0: failed to start core (testmode): -110

Error message 2:
[ 668.615839] ath10k_ahb a000000.wifi: failed to send ext resource cfg command : -95
[ 668.618902] ath10k_ahb a000000.wifi: failed to start core (testmode): -95

Avoiding these configurations while bringing the target in
testmode is solving the problem.

Cc: stable@vger.kernel.org
Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: add debugfs support to get per peer tids log via tracing
Maharaja Kennadyrajan [Thu, 2 Feb 2017 06:32:19 +0000 (08:32 +0200)]
ath10k: add debugfs support to get per peer tids log via tracing

This patch provides support to get per peer tids log.

echo 1 > /sys/kernel/debug/ieee80211/phyX/netdev\:wlanX/stations/
XX:XX/peer_debug_trigger

These logs will be the part of FWLOGS which we collect the logs
via tracing interface. Here we will get the peer tigd logs only
once(not repeatedly) when we write 1 to the debugfs file.

Signed-off-by: Maharaja Kennadyrajan <c_mkenna@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: few whitespace fixes
Kalle Valo [Thu, 2 Feb 2017 10:48:08 +0000 (12:48 +0200)]
ath10k: few whitespace fixes

Fixes checkpatch warnings:

drivers/net/wireless/ath/ath10k/pci.c:1593: Statements should start on a tabstop
drivers/net/wireless/ath/ath10k/ce.c:962: Alignment should match open parenthesis

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: use names in function definition arguments
Kalle Valo [Thu, 2 Feb 2017 10:47:56 +0000 (12:47 +0200)]
ath10k: use names in function definition arguments

Fixes new checkpatch warnings:

drivers/net/wireless/ath/ath10k/htt.h:1823: function definition argument 'struct sk_buff *' should also have an identifier name
drivers/net/wireless/ath/ath10k/wmi.h:6607: function definition argument 'struct wmi_start_scan_arg *' should also have an identifier name

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: prefer unsigned int over just unsigned
Kalle Valo [Thu, 2 Feb 2017 10:47:45 +0000 (12:47 +0200)]
ath10k: prefer unsigned int over just unsigned

Fixes new checkpatch warnings:

drivers/net/wireless/ath/ath10k/htt.h:1639: Prefer 'unsigned int' to bare use of 'unsigned'
drivers/net/wireless/ath/ath10k/htt.h:1660: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agortlwifi: rtl8192c-common: Fix "BUG: KASAN:
Larry Finger [Sun, 5 Feb 2017 16:24:22 +0000 (10:24 -0600)]
rtlwifi: rtl8192c-common: Fix "BUG: KASAN:

Kernels built with CONFIG_KASAN=y report the following BUG for rtl8192cu
and rtl8192c-common:

==================================================================
BUG: KASAN: slab-out-of-bounds in rtl92c_dm_bt_coexist+0x858/0x1e40
     [rtl8192c_common] at addr ffff8801c90edb08
Read of size 1 by task kworker/0:1/38
page:ffffea0007243800 count:1 mapcount:0 mapping:          (null)
     index:0x0 compound_mapcount: 0
flags: 0x8000000000004000(head)
page dumped because: kasan: bad access detected
CPU: 0 PID: 38 Comm: kworker/0:1 Not tainted 4.9.7-gentoo #3
Hardware name: Gigabyte Technology Co., Ltd. To be filled by
     O.E.M./Z77-DS3H, BIOS F11a 11/13/2013
Workqueue: rtl92c_usb rtl_watchdog_wq_callback [rtlwifi]
  0000000000000000 ffffffff829eea33 ffff8801d7f0fa30 ffff8801c90edb08
  ffffffff824c0f09 ffff8801d4abee80 0000000000000004 0000000000000297
  ffffffffc070b57c ffff8801c7aa7c48 ffff880100000004 ffffffff000003e8
Call Trace:
  [<ffffffff829eea33>] ? dump_stack+0x5c/0x79
  [<ffffffff824c0f09>] ? kasan_report_error+0x4b9/0x4e0
  [<ffffffffc070b57c>] ? _usb_read_sync+0x15c/0x280 [rtl_usb]
  [<ffffffff824c0f75>] ? __asan_report_load1_noabort+0x45/0x50
  [<ffffffffc06d7a88>] ? rtl92c_dm_bt_coexist+0x858/0x1e40 [rtl8192c_common]
  [<ffffffffc06d7a88>] ? rtl92c_dm_bt_coexist+0x858/0x1e40 [rtl8192c_common]
  [<ffffffffc06d0cbe>] ? rtl92c_dm_rf_saving+0x96e/0x1330 [rtl8192c_common]
...

The problem is due to rtl8192ce and rtl8192cu sharing routines, and having
different layouts of struct rtl_pci_priv, which is used by rtl8192ce, and
struct rtl_usb_priv, which is used by rtl8192cu. The problem was resolved
by placing the struct bt_coexist_info at the head of each of those private
areas.

Reported-and-tested-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org> # 4.0+
Cc: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Convert halbtcoutsrc.c to use standard debugging
Larry Finger [Fri, 3 Feb 2017 17:35:21 +0000 (11:35 -0600)]
rtlwifi: btcoexist: Convert halbtcoutsrc.c to use standard debugging

The routines in btcoexist use different debugging routines than are used
in the other drivers. This patch converts halbtcoutsrc.c to use the
standard routines. It also deletes the definitions of the now-unused
debugging macros, and turns on compilation of all the routines in
btcoexist.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Convert halbtc8821a2ant.c to use standard debugging
Larry Finger [Fri, 3 Feb 2017 17:35:20 +0000 (11:35 -0600)]
rtlwifi: btcoexist: Convert halbtc8821a2ant.c to use standard debugging

The routines in btcoexist use different debugging routines than are used
in the other drivers. This patch converts halbtc8821a2ant.c to use the
standard routines.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Convert halbtc8821a1ant.c to use standard debugging
Larry Finger [Fri, 3 Feb 2017 17:35:19 +0000 (11:35 -0600)]
rtlwifi: btcoexist: Convert halbtc8821a1ant.c to use standard debugging

The routines in btcoexist use different debugging routines than are used
in the other drivers. This patch converts halbtc8821a1ant.c to use the
standard routines.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Convert halbtc8723b2ant.c to use standard debugging
Larry Finger [Fri, 3 Feb 2017 17:35:18 +0000 (11:35 -0600)]
rtlwifi: btcoexist: Convert halbtc8723b2ant.c to use standard debugging

The routines in btcoexist use different debugging routines than are used
in the other drivers. This patch converts halbtc8723b2ant.c to use the
standard routines.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Convert halbtc8723b1ant.c to use standard debugging
Larry Finger [Fri, 3 Feb 2017 17:35:17 +0000 (11:35 -0600)]
rtlwifi: btcoexist: Convert halbtc8723b1ant.c to use standard debugging

The routines in btcoexist use different debugging routines than are used
in the other drivers. This patch converts halbtc8723b1ant.c to use the
standard routines.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Convert halbtc8192e2ant.c to use standard debugging
Larry Finger [Fri, 3 Feb 2017 17:35:16 +0000 (11:35 -0600)]
rtlwifi: btcoexist: Convert halbtc8192e2ant.c to use standard debugging

The routines in btcoexist use different debugging routines than are used
in the other drivers. This patch converts halbtc8192e2ant.c to use the
standard routines.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8821ae: Fix typo in symbol for bandwidth numbers
Larry Finger [Fri, 3 Feb 2017 17:35:15 +0000 (11:35 -0600)]
rtlwifi: rtl8821ae: Fix typo in symbol for bandwidth numbers

In several places, "BANDWITH" is used when "BANDWIDTH" should have been
used.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Avoid skipping WEP key deletion for AP
Ganapathi Bhat [Fri, 3 Feb 2017 13:00:22 +0000 (18:30 +0530)]
mwifiex: Avoid skipping WEP key deletion for AP

This patch fixes the issue specific to AP. AP is started with WEP
security and external station is connected to it. Data path works
in this case. Now if AP is restarted with WPA/WPA2 security,
station is able to connect but ping fails.

Driver skips the deletion of WEP keys if interface type is AP.
Removing that redundant check resolves the issue.

Fixes: e57f1734d87a ("mwifiex: add key material v2 support")
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: avoid introducing a USB dependency in the rt2x00lib module
Stanislaw Gruszka [Thu, 2 Feb 2017 09:57:40 +0000 (10:57 +0100)]
rt2x00: avoid introducing a USB dependency in the rt2x00lib module

As reported by Felix:

Though protected by an ifdef, introducing an usb symbol dependency in
the rt2x00lib module is a major inconvenience for distributions that
package kernel modules split into individual packages.

Get rid of this unnecessary dependency by calling the usb related
function from a more suitable place.

Cc: Vishal Thanki <vishalthanki@gmail.com>
Reported-by: Felix Fietkau <nbd@nbd.name>
Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: use wiphy_read_of_freq_limits to respect limits from DT
Rafał Miłecki [Tue, 17 Jan 2017 22:35:50 +0000 (23:35 +0100)]
brcmfmac: use wiphy_read_of_freq_limits to respect limits from DT

This new helper reads extra frequency limits specified in DT and
disables unavailable chanels. This is useful for devices (like home
routers) with chipsets limited e.g. by board design.

In order to respect info read from DT we simply need to check for
IEEE80211_CHAN_DISABLED bit when constructing channel info.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: don't include mac80211.h
Johannes Berg [Thu, 5 Jan 2017 12:38:35 +0000 (13:38 +0100)]
mwifiex: don't include mac80211.h

This driver doesn't use mac80211, so it shouldn't include mac80211.h,
include only the necessary cfg80211.h instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge tag 'iwlwifi-next-for-kalle-2017-02-06' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Tue, 7 Feb 2017 07:30:26 +0000 (09:30 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2017-02-06' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Second batch of improvements and fixes for v4.11.

  * A bunch of bugfixes for the DQA code;
  * Work on support for new A000 devices continues;
  * Some clean-ups and general improvements

7 years agortlwifi: Add work queue for c2h cmd.
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:08 +0000 (21:30 -0600)]
rtlwifi: Add work queue for c2h cmd.

btcoex needs to sleep, thus it must run in thread context.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8723be: fix ant_sel code
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:07 +0000 (21:30 -0600)]
rtlwifi: rtl8723be: fix ant_sel code

When ant_sel is set, we need to fill single_ant_path to select correct
antenna path.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoex: move bt_type declaration
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:06 +0000 (21:30 -0600)]
rtlwifi: btcoex: move bt_type declaration

Routine rtl_get_hwpg_bt_type() is better in halbtcoutsrc.c than in
rtl_btc.c.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8723be: btcoex: add package_type function to btcoex
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:05 +0000 (21:30 -0600)]
rtlwifi: rtl8723be: btcoex: add package_type function to btcoex

The new code handles the package-type of the chip.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: move btcoex's ant_num declaration
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:04 +0000 (21:30 -0600)]
rtlwifi: move btcoex's ant_num declaration

File halbtcoutsrc.c is a better place for routine rtl_get_hwpg_ant_num()
than file rtl_btc.c.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8723be: btcoexist: Add single_ant_path
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:03 +0000 (21:30 -0600)]
rtlwifi: rtl8723be: btcoexist: Add single_ant_path

Some devices with RTL8732BE wifi/Bluetooth adapters are shipped with only
a single antenna. On a subset of these, the EEPROM is incorectly coded
to indicate the wrong connection. The resulting problems have been fixed
for wifi. This change handles them for BT.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Change logging in halbtc8192e2ant.c
Larry Finger [Tue, 7 Feb 2017 03:30:02 +0000 (21:30 -0600)]
rtlwifi: btcoexist: Change logging in halbtc8192e2ant.c

This routine uses its own debugging macros These are changed to use the
the recently rewritten RT_TRACE macro. There are also some renamed
variables that were missed in the previous step.

The only functional change is that some debugging statements have been
dropped based on the final code supplied by Realtek.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: btcoexist: Add vendor definition for new btcoexist
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:01 +0000 (21:30 -0600)]
rtlwifi: btcoexist: Add vendor definition for new btcoexist

Routine halbtc_get() will need to be able to get the vendor ID.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add a new enumeration value to btc_set_type
Ping-Ke Shih [Tue, 7 Feb 2017 03:30:00 +0000 (21:30 -0600)]
rtlwifi: Add a new enumeration value to btc_set_type

The new value is needed for future capability.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Set retry limit depends on vif type.
Ping-Ke Shih [Tue, 7 Feb 2017 03:29:59 +0000 (21:29 -0600)]
rtlwifi: Set retry limit depends on vif type.

We assign different retry limit according to vif type, because
it can boost performance in field.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Fix programing CAM content sequence.
Ping-Ke Shih [Tue, 7 Feb 2017 03:29:58 +0000 (21:29 -0600)]
rtlwifi: Fix programing CAM content sequence.

There is a potential race condition when the control byte of a CAM
entry is written first. Write in reverse order to correct the condition.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoiwlwifi: mvm: support new beacon template command
Sara Sharon [Thu, 8 Dec 2016 09:44:20 +0000 (11:44 +0200)]
iwlwifi: mvm: support new beacon template command

Support new version of beacon template command which deprecates
the use of the tx command inside.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: fix another RF-kill race
Johannes Berg [Tue, 13 Dec 2016 09:29:07 +0000 (10:29 +0100)]
iwlwifi: pcie: fix another RF-kill race

When resuming, it's possible for the following scenario to occur:

 * iwl_pci_resume() enables the RF-kill interrupt
 * iwl_pci_resume() reads the RF-kill state (e.g. to 'radio enabled')
 * RF_KILL interrupt triggers, and iwl_pcie_irq_handler() reads the
   state, now 'radio disabled', and acquires the &trans_pcie->mutex.
 * iwl_pcie_irq_handler() further calls iwl_trans_pcie_rf_kill() to
   indicate to the higher layers that the radio is now disabled (and
   stops the device while at it)
 * iwl_pcie_irq_handler() drops the mutex
 * iwl_pci_resume() continues, acquires the mutex and calls the higher
   layers to indicate that the radio is enabled.

At this point, the device is stopped but the higher layers think it's
available, and can call deeply into the driver to try to enable it.
However, this will fail since the device is actually disabled.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: support two phys for a000 devices
Sara Sharon [Wed, 23 Nov 2016 15:08:20 +0000 (17:08 +0200)]
iwlwifi: support two phys for a000 devices

Support differentiating between two phys for a000 devices
in order to load the correct firmware.
Eventually when moving completely to the new phy we will be
able to remove this.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: remove unnecessary cfg element in iwl_drv
Luca Coelho [Tue, 13 Dec 2016 07:56:07 +0000 (09:56 +0200)]
iwlwifi: remove unnecessary cfg element in iwl_drv

The iwl_drv structure contains trans which already contains cfg, so
storing cfg separately in iwl_drv is redundant.  Remove it and access
trans->cfg instead.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: remove unnecessary argument to iwl_drv_start()
Luca Coelho [Tue, 13 Dec 2016 07:48:57 +0000 (09:48 +0200)]
iwlwifi: remove unnecessary argument to iwl_drv_start()

When iwl_drv_start() is called, trans->cfg must already be set, so
there's no need to pass cfg separately, since it can be accessed
directly from trans->cfg.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: cleanup iwl_mvm_tx_mpdu a bit
Sara Sharon [Thu, 8 Dec 2016 08:43:40 +0000 (10:43 +0200)]
iwlwifi: mvm: cleanup iwl_mvm_tx_mpdu a bit

Unify code, remove redundant assignments.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: align copy-break SKB payload for MQ RX
Johannes Berg [Thu, 8 Dec 2016 09:38:08 +0000 (10:38 +0100)]
iwlwifi: mvm: align copy-break SKB payload for MQ RX

When a small frame is copied completely into the skb->head, the code
doesn't take alignment into account, making mac80211 copy it again
later on architectures that need the alignment. Avoid this by taking
the PAD flag from the device into account when copying.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix pending frame counter calculation
Sara Sharon [Wed, 7 Dec 2016 13:04:37 +0000 (15:04 +0200)]
iwlwifi: mvm: fix pending frame counter calculation

In DQA mode the check whether to decrement the pending frames
counter relies on the tid status and not on the txq id.
This may result in an inconsistent state of the pending frames
counter in case frame is queued on a non aggregation queue but
with this TID, and will be followed by a failure to remove the
station and later on SYSASSERT 0x3421 when trying to remove the
MAC.
Such frames are for example bar and qos NDPs.
Fix it by aligning the condition of incrementing the counter
with the condition of decrementing it - rely on TID state for
DQA mode.
Also, avoid internal error like this affecting station removal
for DQA mode - since we can know for sure it is an internal
error.

Fixes: cf961e16620f ("iwlwifi: mvm: support dqa-mode agg on non-shared queue")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: fix the set of DMA memory mask
Sara Sharon [Wed, 7 Dec 2016 10:22:11 +0000 (12:22 +0200)]
iwlwifi: pcie: fix the set of DMA memory mask

Our 9000 device supports 64 bit DMA address for RX only, and
not for TX.
Setting DMA mask to 64 for the whole device is erroneous - we
can do it only for a000 devices where device is capable of
both RX & TX DMA with 64 bit address space.

Fixes: 96a6497bc3ed ("iwlwifi: pcie: add 9000 series multi queue rx DMA support")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: release static queues on bcast release
Liad Kaufman [Thu, 24 Nov 2016 13:31:00 +0000 (15:31 +0200)]
iwlwifi: mvm: release static queues on bcast release

A few of the static queues are enabled along with the bcast
STA. Make sure they are removed along with it, rather than
waiting for the mac ctxt release.

This is needed because we sometimes have a STA being removed
and then added again (either with the same sta_id or a
different one). If we wait for the mac ctxt release we will
try to allocate the queues again (as this is currently done
in the STA allocation and not in the MAC init) although
they weren't freed, and even if the sta_id of the STA has
changed.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm/pcie: adjust A-MSDU tx_cmd length in PCIe
Johannes Berg [Fri, 2 Dec 2016 09:04:49 +0000 (10:04 +0100)]
iwlwifi: mvm/pcie: adjust A-MSDU tx_cmd length in PCIe

Instead of setting the tx_cmd length in the mvm code, which is
complicated by the fact that DQA may want to temporarily store
the SKB on the side, adjust the length in the PCIe code which
also knows about this since it's responsible for duplicating
all those headers that are account for in this code.

As the PCIe code already relies on the tx_cmd->len field, this
doesn't really introduce any new dependencies.

To make this possible we need to move the memcpy() of the TX
command until after it was updated.

This does even simplify the code though, since the PCIe code
already does a lot of manipulations to build A-MSDUs correctly
and changing the length becomes a simple operation to see how
much was added/removed, rather than predicting it.

Fixes: 24afba7690e4 ("iwlwifi: mvm: support bss dynamic alloc/dealloc of queues")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: overwrite skb info later
Johannes Berg [Fri, 2 Dec 2016 08:57:40 +0000 (09:57 +0100)]
iwlwifi: mvm: overwrite skb info later

We don't really need clear the skb's status area nor store the
dev_cmd into it until we really commit to the frame by handing
it to the transport - defer those operations until just before
we do that.

This doesn't entirely fix the bug with frames not getting sent
out after having been deferred due to DQA, because it doesn't
restore the info->driver_data[0] place that was already set to
zero (or another value) by the A-MSDU logic.

Fixes: 24afba7690e4 ("iwlwifi: mvm: support bss dynamic alloc/dealloc of queues")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: set AID to firmware only for associated stations
Johannes Berg [Thu, 1 Dec 2016 15:25:30 +0000 (16:25 +0100)]
iwlwifi: mvm: set AID to firmware only for associated stations

The firmware will soon actually look at the AID field, and
when it does that it'll try to ensure that the AID is never
changing. Due to the way the station is added, it may start
with an invalid AID before it's associated, so to ensure a
constant AID (once it becomes non-zero), track the station
state and set the AID only when the station is associated
and when it disassociates.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix D3 replay counter value
Johannes Berg [Wed, 30 Nov 2016 16:04:52 +0000 (17:04 +0100)]
iwlwifi: mvm: fix D3 replay counter value

This fixes a long-standing bug that was introduced when this code
was introduced: cfg80211 passes a pointer, but we treat it as if
it was passing a value. The result is that we pass the pointer to
the firmware, instead of the value. It's not clear how this could
ever have worked, unless the firmware is ignoring this value.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: synchronize firmware DMA paging memory
Sara Sharon [Wed, 30 Nov 2016 14:49:11 +0000 (16:49 +0200)]
iwlwifi: mvm: synchronize firmware DMA paging memory

When driver needs to access the contents of a streaming DMA buffer
without unmapping it it should call dma_sync_single_for_cpu().
Once the call has been made, the CPU "owns" the DMA buffer and can
work with it as needed.
Before the device accesses the buffer, however, ownership should be
transferred back to it with dma_sync_single_for_device().
Both calls weren't performed by the driver, resulting with odd paging
errors on some platforms. Fix it.

Fixes: a6c4fb4441f4 ("iwlwifi: mvm: Add FW paging mechanism for the UMAC on PCI")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new alive notification
Sara Sharon [Thu, 24 Nov 2016 11:48:27 +0000 (13:48 +0200)]
iwlwifi: mvm: support new alive notification

Support getting alive from two LMACs and dumping debug
data from both.
Deprecate older alive notifications no one is using.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: reduce usage of IEEE80211_SKB_CB()
Johannes Berg [Fri, 2 Dec 2016 12:33:40 +0000 (13:33 +0100)]
iwlwifi: mvm: reduce usage of IEEE80211_SKB_CB()

There's already a variable with the result in scope, use that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: always free inactive queue when moving ownership
Sara Sharon [Wed, 16 Nov 2016 15:04:36 +0000 (17:04 +0200)]
iwlwifi: mvm: always free inactive queue when moving ownership

If iwl_mvm_find_free_queue() doesn't find a free queue, it will
return an inactive one.
However, not all the call paths free this queue before reassigning
it, which is a bug.
Check it in other paths and act accordingly.

Fixes: 9794c64f302d ("iwlwifi: mvm: support dqa queue inactivation upon timeout")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new scan API
Sara Sharon [Thu, 17 Nov 2016 09:35:05 +0000 (11:35 +0200)]
iwlwifi: mvm: support new scan API

For CDB devices we will want to configure scan parameters
per band.
Support the new scan API for now. Logic per band will be
added in the future.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new statistics APIs
Sara Sharon [Thu, 8 Sep 2016 14:32:19 +0000 (17:32 +0300)]
iwlwifi: mvm: support new statistics APIs

For CDB arch there is another auxiliary mac.
Support statistics APIs that were changed to reflect that.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: cleanup incorrect and redundant define
Sara Sharon [Sun, 20 Nov 2016 11:50:39 +0000 (13:50 +0200)]
iwlwifi: mvm: cleanup incorrect and redundant define

Currently we have up to 3 phy contexts - defined by NUM_PHY_CTX.
However - some code paths validate the ID by using MAX_PHYS define
which is set to 4.
While there is no harm it is incorrect - since the maximum is 3.
Remove the define and use the correct one.
Cleanup the code a bit while at it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: Use aux queue for offchannel frames in dqa
Beni Lev [Thu, 17 Nov 2016 12:03:17 +0000 (14:03 +0200)]
iwlwifi: mvm: Use aux queue for offchannel frames in dqa

Since offchannel activity doesn't always require a BSS, e.g. ANQP
sessions, offchannel frames should not use the BSS queue, because it
might not be initialized.
Use the auxilary queue instead

Fixes: e3118ad74d7e ("iwlwifi: mvm: support tdls in dqa mode")
Signed-off-by: Beni Lev <beni.lev@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support v2 of mfuart load notification
Golan Ben-Ami [Mon, 7 Nov 2016 15:40:43 +0000 (17:40 +0200)]
iwlwifi: mvm: support v2 of mfuart load notification

Add to the v1 of the mfuart loading notification, the size
of the mfuart image, and write it to dmesg once the notification
is received.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support unification of INIT and RT images
Sara Sharon [Wed, 31 Aug 2016 15:13:57 +0000 (18:13 +0300)]
iwlwifi: mvm: support unification of INIT and RT images

For a000 devices the INIT and RT images are unified to one
image.
The changes in the flow are the following:
* Driver load only RT firmware - meaning that the nvm access
  command will be done in the RT image load flow.
* A new command (NVM_ACCESS_COMPLETE) now signals to the FW that
  the driver is done accessing the NVM and FW can proceed with phy
  calibrations.
* Phy DB is no longer sent from INIT FW to be restored by driver
  for the RT FW - all the phy DB is now internal to the FW.
  INIT complete will now follow the NVM access command, without
  phy DB calls before.
* Paging command is sent earlier in the flow before NVM access
  to enable a complete load of FW.
* caution must be care when restart is called since we may have
  not completed init flow even though we are in RT firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix PS-Poll enablement
Emmanuel Grumbach [Wed, 26 Oct 2016 11:21:27 +0000 (14:21 +0300)]
iwlwifi: mvm: fix PS-Poll enablement

We added the uAPSD enabled ACs and that made the
firmware choose to pull frames with uAPSD trigger
frames instead of PS-Poll.
Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agobrcmfmac: be more verbose when PSM's watchdog fires
Rafał Miłecki [Mon, 30 Jan 2017 15:09:52 +0000 (16:09 +0100)]
brcmfmac: be more verbose when PSM's watchdog fires

It's important to inform user so he knows things went wrong. He may also
want to get memory dump for further debugging purposes.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: check brcmf_bus_get_memdump result for error
Rafał Miłecki [Mon, 30 Jan 2017 15:09:51 +0000 (16:09 +0100)]
brcmfmac: check brcmf_bus_get_memdump result for error

This method may be unsupported (see: USB bus) or may just fail (see:
SDIO bus).
While at it rework logic in brcmf_sdio_bus_get_memdump function to avoid
too many conditional code nesting levels.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agonet: phy: broadcom: rehook BCM54612E specific init
Rafał Miłecki [Tue, 31 Jan 2017 21:54:54 +0000 (22:54 +0100)]
net: phy: broadcom: rehook BCM54612E specific init

This extra BCM54612E code in PHY driver isn't really aneg specific. Even
without it aneg works OK but the problem is no packets pass through PHY.

Moreover putting this code inside config_aneg callback didn't allow
resuming PHY correctly. When driver called phy_stop and phy_start it was
putting PHY machine into RESUMING state. After that machine was
switching into AN and NOLINK without ever calling phy_start_aneg. This
prevented this extra setup from being called and PHY didn't work.

This change has been verified to fix network on BCM47186B0 SoC device
with BCM54612E.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'act_sample-Little-fixes'
David S. Miller [Wed, 1 Feb 2017 19:10:04 +0000 (14:10 -0500)]
Merge branch 'act_sample-Little-fixes'

Yotam Gigi says:

====================
net/sched: act_sample: Little fixes

Little fixes in sample tc action.
====================

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/sched: act_psample: Remove unnecessary ASSERT_RTNL
Yotam Gigi [Tue, 31 Jan 2017 09:33:54 +0000 (11:33 +0200)]
net/sched: act_psample: Remove unnecessary ASSERT_RTNL

The ASSERT_RTNL is not necessary in the init function, as it does not
touch any rtnl protected structures, as opposed to the mirred action which
does have to hold a net device.

Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet/sched: act_sample: Fix error path in init
Yotam Gigi [Tue, 31 Jan 2017 09:33:53 +0000 (11:33 +0200)]
net/sched: act_sample: Fix error path in init

Fix error path of in sample init, by releasing the tc hash in case of
failure in psample_group creation.

Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action")
Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'sh_eth-fixes-for-MagicPacket-handling'
David S. Miller [Wed, 1 Feb 2017 17:53:59 +0000 (12:53 -0500)]
Merge branch 'sh_eth-fixes-for-MagicPacket-handling'

Niklas Söderlund says:

====================
sh_eth: fixes for MagicPacket handling

This series contain two fixes for MagicPacket handling. It's based on
top of net-next and is tested on Koelsch.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosh_eth: fix wakeup event reporting from MagicPacket
Niklas Söderlund [Wed, 1 Feb 2017 14:41:55 +0000 (15:41 +0100)]
sh_eth: fix wakeup event reporting from MagicPacket

If a link change interrupt happens along side the MagicPacket interrupt
and the link change interrupt is ignored the interrupt handler will
return and the wakeup event is not registered. Fix this by moving the
MagicPacket check before the link change check.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosh_eth: align usage of sh_eth_modify() with rest of driver
Niklas Söderlund [Wed, 1 Feb 2017 14:41:54 +0000 (15:41 +0100)]
sh_eth: align usage of sh_eth_modify() with rest of driver

To be consistent with the rest of the driver when setting bits using
sh_eth_modify() the same bit should also be cleared. This have no
functional change and should have been done from the start.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Suggested-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge tag 'wireless-drivers-next-for-davem-2017-02-01' of git://git.kernel.org/pub...
David S. Miller [Wed, 1 Feb 2017 17:46:17 +0000 (12:46 -0500)]
Merge tag 'wireless-drivers-next-for-davem-2017-02-01' of git://git./linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for 4.11

It's nice to see rt2x00 development has becoming active, for example
adding support for a new chip version. Also wcn36xx has been converted
to use the recently merged QCOM_SMD subsystem. Otherwise new features
and fixes it lots of drivers.

Major changes:

iwlwifi

* some more work in preparation for A000 family support
* add support for radiotap timestamps
* some work on our firmware debugging capabilities

wcn36xx

* convert to a proper QCOM_SMD driver (from the platform_driver interface)

ath10k

* VHT160 support
* dump Copy Engine registers during firmware crash
* search board file extension from SMBIOS

wil6210

* add disable_ap_sme module parameter

rt2x00

* support RT3352 with external PA
* support for RT3352 with 20MHz crystal
* add support for RT5350 WiSoC

brcmfmac

* add support for BCM43455 sdio device

rtl8xxxu

* add support for D-Link DWA-131 rev E1, TP-Link TL-WN822N v4 and others
====================

Signed-off-by: David S. Miller <davem@davemloft.net>