]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agomwifiex: avoid double-disable_irq() race
Brian Norris [Fri, 18 Nov 2016 17:13:25 +0000 (22:43 +0530)]
mwifiex: avoid double-disable_irq() race

We have a race where the wakeup IRQ might be in flight while we're
calling mwifiex_disable_wake() from resume(). This can leave us
disabling the IRQ twice.

Let's disable the IRQ and enable it in case if we have double-disabled
it.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: cleanup wake-IRQ handling if suspend fails
Brian Norris [Fri, 18 Nov 2016 17:13:24 +0000 (22:43 +0530)]
mwifiex: cleanup wake-IRQ handling if suspend fails

We don't want to leave the wake IRQ enabled.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add support for 802.11d
Prameela Rani Garnepudi [Fri, 18 Nov 2016 10:38:43 +0000 (16:08 +0530)]
rsi: Add support for 802.11d

Transmit power level in a channel is determined based on the dfs region.
To support regulatory rules dfs region should be configured to device during
set channel request. Also antenna gain values are taken from the mac80211
channel parameters instead of fixed values.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add support for antenna selection
Prameela Rani Garnepudi [Fri, 18 Nov 2016 10:38:22 +0000 (16:08 +0530)]
rsi: Add support for antenna selection

RSI 9113 device supports single antenna for tx and rx. Support for using
external is added. This can be configured from user space using iw.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add support for configuring tx power
Prameela Rani Garnepudi [Fri, 18 Nov 2016 10:38:04 +0000 (16:08 +0530)]
rsi: Add support for configuring tx power

TX power can be configured from iwconfig, iw or from mac80211 when
regulatory changes are done. Hence support for configuring tx power
to device is added using the RADIO_PARAMS_UPDATE command frame.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Add support to filter rx frames
Prameela Rani Garnepudi [Fri, 18 Nov 2016 10:37:09 +0000 (16:07 +0530)]
rsi: Add support to filter rx frames

Filtering rx frames after connection in station mode avoids the
overhead of processing un-necessary frames. Hence rx filter frame
is added which can be configured to device at suitable times.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: disable CCK rates on HT
Stanislaw Gruszka [Fri, 18 Nov 2016 09:44:01 +0000 (10:44 +0100)]
rt2800: disable CCK rates on HT

Sending frames in CCK rates on HT can cause performance problems.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: tune *_PROT_CFG parameters
Stanislaw Gruszka [Fri, 18 Nov 2016 09:44:00 +0000 (10:44 +0100)]
rt2800: tune *_PROT_CFG parameters

Use RTS/CTS protection for TXOP on all rates modes as default and
disable CCK rates (this cause performance problems).

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: use RTS/CTS protection instead of CTS-to-self
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:59 +0000 (10:43 +0100)]
rt2800: use RTS/CTS protection instead of CTS-to-self

Change default to RTS/CTS protection. This has a cost of transmitting
one more control frame (RTS) however protect us from traffic from
hidden node.

On station mode will use CTS-to-self if AP will configure that
for the network.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: correct TX_SW_CFG1 for 5592
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:58 +0000 (10:43 +0100)]
rt2800: correct TX_SW_CFG1 for 5592

Those TX_SW_CFG1 values are used in vendor driver.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: correct AUTO_RSP_CFG
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:57 +0000 (10:43 +0100)]
rt2800: correct AUTO_RSP_CFG

Initialize AUTO_RSP_CFG register to similar value as vendor driver does.

Do not set BAC_ACK_POLICY based on short preamble setting, those are
unrelated.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: do not overwrite WPDMA_GLO_CFG_WP_DMA_BURST_SIZE
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:56 +0000 (10:43 +0100)]
rt2800: do not overwrite WPDMA_GLO_CFG_WP_DMA_BURST_SIZE

We already initlized WPDMA_GLO_CFG_WP_DMA_BURST_SIZE to 3 on
rt2800_init_registers() for USB devices. For PCI devices we will use
HW default setting, which is 2, so patch does not change behaviour
on PCI devices.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: OFDM rates are mandatory
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:55 +0000 (10:43 +0100)]
rt2800: OFDM rates are mandatory

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800usb: do not wipe out USB_DMA_CFG settings
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:54 +0000 (10:43 +0100)]
rt2800usb: do not wipe out USB_DMA_CFG settings

We should not reset USB_DMA_CFG on rt2800usb_init_registers() as this
function is called indirectly from rt2800_enable_radio(). If we
do so, we wipe out USB_DMA_CFG settings from rt2800usb_enable_radio().

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: correctly report MCS TX parameters
Stanislaw Gruszka [Fri, 18 Nov 2016 09:43:53 +0000 (10:43 +0100)]
rt2800: correctly report MCS TX parameters

We should only set IEEE80211_HT_MCS_TX_RX_DIF when TX and RX MCS sets
are not equal, i.e. when number of tx streams is different than
number of RX streams.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: update beacon IE after bss up and clear when AP stopped
Wright Feng [Fri, 18 Nov 2016 01:59:52 +0000 (09:59 +0800)]
brcmfmac: update beacon IE after bss up and clear when AP stopped

Firmware doesn't update beacon/Probe Response vendor IEs correctly when
bss is down, so we move brcmf_config_ap_mgmt_ie after BSS up. And host
driver should clear IEs when AP stopped so that the IEs in host side will
be synced with in firmware side.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: Fix incorrect usage of CONFIG_RT2X00_LIB_USB
Vishal Thanki [Wed, 16 Nov 2016 16:01:54 +0000 (17:01 +0100)]
rt2x00: Fix incorrect usage of CONFIG_RT2X00_LIB_USB

In device removal routine, usage of "#ifdef CONFIG_RT2X00_LIB_USB"
will not cover the case when it is configured as module. This will
omit the entire if-block which does cleanup of URBs and cancellation
of pending work. Changing the #ifdef to #if IS_ENABLED() to fix it.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 23 Nov 2016 12:51:38 +0000 (14:51 +0200)]
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for 4.10. Major changes:

ath9k

* add device tree bindings
* switch to use mac80211 intermediate software queues to reduce
  latency and fix bufferbloat

7 years agomwifiex: pcie: stop checking for NULL adapter->card
Brian Norris [Fri, 18 Nov 2016 14:00:34 +0000 (19:30 +0530)]
mwifiex: pcie: stop checking for NULL adapter->card

It should never be NULL here, and to think otherwise makes things
confusing.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: stop checking for NULL drvata/intfdata
Brian Norris [Fri, 18 Nov 2016 14:00:33 +0000 (19:30 +0530)]
mwifiex: stop checking for NULL drvata/intfdata

These are never NULL, so stop making people think they might be.

I don't change this for SDIO because SDIO has a racy card-reset handler
that reallocates this struct. I'd rather not touch that mess right now.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: sdio: don't check for NULL sdio_func
Brian Norris [Fri, 18 Nov 2016 14:00:32 +0000 (19:30 +0530)]
mwifiex: sdio: don't check for NULL sdio_func

sdio_func is retrieved via container_of() and should never be NULL.
Checking for NULL just makes the logic more confusing than necessary.
Stop doing that.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: usb: handle HS failures
Brian Norris [Fri, 18 Nov 2016 14:00:31 +0000 (19:30 +0530)]
mwifiex: usb: handle HS failures

SDIO and PCIe drivers handle this. Let's imitate it.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: reset card->adapter during device unregister
Xinming Hu [Fri, 18 Nov 2016 14:00:30 +0000 (19:30 +0530)]
mwifiex: reset card->adapter during device unregister

card->adapter gets initialized in mwifiex_register_dev(). As it's not
cleared in mwifiex_unregister_dev(), we may end up accessing the memory
which is already free in below scenario.

Scenario: Driver initialization is failed due to incorrect firmware or
some other reason. Meanwhile device reboot/unload occurs.

This is safe, now that we've properly synchronized suspend() and
remove() with the FW initialization thread; now that code can simply
check for 'card->adapter == NULL' and exit safely.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: resolve suspend() race with async FW init failure
Brian Norris [Fri, 18 Nov 2016 14:00:29 +0000 (19:30 +0530)]
mwifiex: resolve suspend() race with async FW init failure

Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: don't pretend to resume while remove()'ing
Brian Norris [Fri, 18 Nov 2016 14:00:28 +0000 (19:30 +0530)]
mwifiex: don't pretend to resume while remove()'ing

The device core will not allow suspend() to race with remove().

Signed-off-by: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: remove redundant pdev check in suspend/resume handlers
Amitkumar Karwar [Fri, 18 Nov 2016 14:00:27 +0000 (19:30 +0530)]
mwifiex: remove redundant pdev check in suspend/resume handlers

to_pci_dev() would just do struct offset arithmetic on struct
device to get 'pdev' pointer. We never get NULL pdev pointer.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: resolve races between async FW init (failure) and device removal
Brian Norris [Fri, 18 Nov 2016 14:00:26 +0000 (19:30 +0530)]
mwifiex: resolve races between async FW init (failure) and device removal

It's possible for the FW init sequence to fail, which will trigger a
device cleanup sequence in mwifiex_fw_dpc(). This sequence can race with
device suspend() or remove() (e.g., reboot or unbind), and can trigger
use-after-free issues. Currently, this driver attempts (poorly) to
synchronize remove() using a semaphore, but it doesn't protect some of
the critical sections properly. Particularly, we grab a pointer to the
adapter struct (card->adapter) without checking if it's being freed or
not. We later do a NULL check on the adapter, but that doesn't work if
the adapter was freed.

Also note that the PCIe interface driver doesn't ever set card->adapter
to NULL, so even if we get the synchronization right, we still might try
to redo the cleanup in ->remove(), even if the FW init failure sequence
already did it.

This patch replaces the static semaphore with a per-device completion
struct, and uses that completion to synchronize the remove() thread with
the mwifiex_fw_dpc(). A future patch will utilize this completion to
synchronize the suspend() thread as well.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: complete blocked power save handshake in main process
Shengzhen Li [Fri, 18 Nov 2016 14:00:25 +0000 (19:30 +0530)]
mwifiex: complete blocked power save handshake in main process

Power save handshake with firmware might be blocked by on-going
data transfer.
this patch check the PS status in main process and complete
previous blocked PS handshake.
this patch also remove redudant check before call
mwifiex_check_ps_cond function.

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Shengzhen Li <szli@marvell.com>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: check tx_hw_pending before downloading sleep confirm
Shengzhen Li [Fri, 18 Nov 2016 14:00:24 +0000 (19:30 +0530)]
mwifiex: check tx_hw_pending before downloading sleep confirm

We may get SLEEP event from firmware even if TXDone interrupt
for last Tx packet is still pending. In this case, we may
end up accessing PCIe memory for handling TXDone after power
save handshake is completed. This causes kernel crash with
external abort.

This patch will only allow downloading sleep confirm
when no tx done interrupt is pending in the hardware.

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Shengzhen Li <szli@marvell.com>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Enable WoWLAN for both sdio and pcie
Rajat Jain [Tue, 15 Nov 2016 13:36:04 +0000 (19:06 +0530)]
mwifiex: Enable WoWLAN for both sdio and pcie

Commit ce4f6f0c353b ("mwifiex: add platform specific wakeup interrupt
support") added WoWLAN feature only for sdio. This patch moves that
code to the common module so that all the interface drivers can use
it for free. It enables pcie and sdio for its use currently.

Signed-off-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Introduce mwifiex_probe_of() to parse common properties
Rajat Jain [Tue, 15 Nov 2016 13:36:03 +0000 (19:06 +0530)]
mwifiex: Introduce mwifiex_probe_of() to parse common properties

Introduce function mwifiex_probe_of() to parse common properties.
Interface drivers get to decide whether or not the device tree node
was a valid one (depending on the compatible property),
Lets fill "adapter->dt_node" in mwifiex_add_card().

The function mwifiex_probe_of() is currently only a place holder with
the next patch adding content to it.

Signed-off-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Allow mwifiex early access to device structure
Rajat Jain [Tue, 15 Nov 2016 13:36:02 +0000 (19:06 +0530)]
mwifiex: Allow mwifiex early access to device structure

Today all the interface drivers (usb/pcie/sdio) assign the
adapter->dev in the register_dev() callback, although they
have this piece of info well before hand.

This patch makes the device structure available for mwifiex
right at the beginning, so that it can be used for early
initialization if needed.

This is needed for subsequent patches in this patchset that
intend to unify and consolidate some of the code that would
otherwise have to be duplicated among the interface drivers
(sdio, pcie, usb).

Signed-off-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: parse device tree node for PCIe
Xinming Hu [Fri, 18 Nov 2016 12:37:04 +0000 (18:07 +0530)]
mwifiex: parse device tree node for PCIe

This patch derives device tree node from pcie bus layer framework.
Device tree bindings file has been renamed(marvell-sd8xxx.txt ->
marvell-8xxx.txt) to accommodate PCIe changes.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: don't do unbalanced free()'ing in cleanup_if()
Brian Norris [Wed, 26 Oct 2016 23:29:20 +0000 (16:29 -0700)]
mwifiex: don't do unbalanced free()'ing in cleanup_if()

The cleanup_if() callback is the inverse of init_if(). We allocate our
'card' interface structure in the probe() function, but we free it in
cleanup_if(). That gives a few problems:
(a) we leak this memory if probe() fails before we reach init_if()
(b) we can't safely utilize 'card' after cleanup_if() -- namely, in
    remove() or suspend(), both of which might race with the cleanup
    paths in our asynchronous FW initialization path

Solution: just use devm_kzalloc(), which will free this structure
properly when the device is removed -- and drop the set_drvdata(...,
NULL), since the driver core does this for us. This also removes the
temptation to use drvdata == NULL as a hack for checking if the device
has been "cleaned up."

I *do* leave the set_drvdata(..., NULL) for the hacky SDIO
mwifiex_recreate_adapter(), since the device core won't be able to clear
that one for us.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: ignore calibration data failure
Amitkumar Karwar [Fri, 21 Oct 2016 15:15:48 +0000 (20:45 +0530)]
mwifiex: ignore calibration data failure

Firmware may reject calibration data from host for certain OTP
settings. In that case, we should continue initialisation ignoring
the failure.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: add power save parameters in hs_cfg cmd
Shengzhen Li [Fri, 14 Oct 2016 10:20:09 +0000 (15:50 +0530)]
mwifiex: add power save parameters in hs_cfg cmd

This patch adds power save parameters(hs_wake_interval and
hs_inactivity_timeout) in host sleep cfg cmd.

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix memory leak in mwifiex_save_hidden_ssid_channels()
Ricky Liang [Wed, 9 Nov 2016 03:37:28 +0000 (11:37 +0800)]
mwifiex: fix memory leak in mwifiex_save_hidden_ssid_channels()

kmemleak reports memory leak in mwifiex_save_hidden_ssid_channels():

unreferenced object 0xffffffc0a2914780 (size 192):
  comm "ksdioirqd/mmc2", pid 2004, jiffies 4307182506 (age 820.684s)
  hex dump (first 32 bytes):
    00 06 47 49 4e 2d 32 67 01 03 c8 60 6c 03 01 40  ..GIN-2g...`l..@
    07 10 54 57 20 34 04 1e 64 05 24 84 03 24 95 04  ..TW 4..d.$..$..
  backtrace:
    [<ffffffc0003375f4>] create_object+0x164/0x2b4
    [<ffffffc0008e3530>] kmemleak_alloc+0x50/0x88
    [<ffffffc000335120>] __kmalloc_track_caller+0x1bc/0x264
    [<ffffffc00030899c>] kmemdup+0x38/0x64
    [<ffffffbffc2311cc>] mwifiex_fill_new_bss_desc+0x3c/0x130 [mwifiex]
    [<ffffffbffc22ee9c>] mwifiex_save_curr_bcn+0x4ec/0x640 [mwifiex]
    [<ffffffbffc22f45c>] mwifiex_handle_event_ext_scan_report+0x1d4/0x268 [mwifiex]
    [<ffffffbffc2375d0>] mwifiex_process_sta_event+0x378/0x898 [mwifiex]
    [<ffffffbffc224dc8>] mwifiex_process_event+0x1a8/0x1e8 [mwifiex]
    [<ffffffbffc2228f0>] mwifiex_main_process+0x258/0x534 [mwifiex]
    [<ffffffbffc258858>] 0xffffffbffc258858
    [<ffffffc00071ee90>] process_sdio_pending_irqs+0xf8/0x160
    [<ffffffc00071efdc>] sdio_irq_thread+0x9c/0x1a4
    [<ffffffc000240d08>] kthread+0xf4/0x100
    [<ffffffc0002043fc>] ret_from_fork+0xc/0x50
    [<ffffffffffffffff>] 0xffffffffffffffff

Signed-off-by: Ricky Liang <jcliang@chromium.org>
Acked-by: Amitkumar Karwar <akarwar@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agossb: Fix error routine when fallback SPROM fails
Larry Finger [Sat, 5 Nov 2016 19:08:57 +0000 (14:08 -0500)]
ssb: Fix error routine when fallback SPROM fails

When there is a CRC error in the SPROM read from the device, the code
attempts to handle a fallback SPROM. When this also fails, the driver
returns zero rather than an error code.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Use dev_kfree_skb_irq instead of kfree_skb
Wei Yongjun [Tue, 1 Nov 2016 14:48:40 +0000 (14:48 +0000)]
rtlwifi: Use dev_kfree_skb_irq instead of kfree_skb

It is not allowed to call kfree_skb() from hardware interrupt
context or with interrupts being disabled, spin_lock_irqsave()
make sure always in irq disable context. So the kfree_skb()
should be replaced with dev_kfree_skb_irq().

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agocw1200: fix bogus maybe-uninitialized warning
Arnd Bergmann [Tue, 25 Oct 2016 20:21:04 +0000 (22:21 +0200)]
cw1200: fix bogus maybe-uninitialized warning

On x86, the cw1200 driver produces a rather silly warning about the
possible use of the 'ret' variable without an initialization
presumably after being confused by the architecture specific definition
of WARN_ON:

drivers/net/wireless/st/cw1200/wsm.c: In function ‘wsm_handle_rx’:
drivers/net/wireless/st/cw1200/wsm.c:1457:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

We have already checked that 'count' is larger than 0 here, so
we know that 'ret' is initialized. Changing the 'for' loop
into do/while also makes this clear to the compiler.

Suggested-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowireless: fix bogus maybe-uninitialized warning
Arnd Bergmann [Mon, 24 Oct 2016 15:38:35 +0000 (17:38 +0200)]
wireless: fix bogus maybe-uninitialized warning

The hostap_80211_rx() function is supposed to set up the mac addresses
for four possible cases, based on two bits of input data. For
some reason, gcc decides that it's possible that none of the these
four cases apply and the addresses remain uninitialized:

drivers/net/wireless/intersil/hostap/hostap_80211_rx.c: In function ‘hostap_80211_rx’:
arch/x86/include/asm/string_32.h:77:14: warning: ‘src’ may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/net/wireless/intel/ipw2x00/libipw_rx.c: In function ‘libipw_rx’:
arch/x86/include/asm/string_32.h:77:14: error: ‘dst’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
arch/x86/include/asm/string_32.h:78:22: error: ‘*((void *)&dst+4)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This warning is clearly nonsense, but changing the last case into
'default' makes it obvious to the compiler too, which avoids the
warning and probably leads to better object code too.

The same code is duplicated several times in the kernel, so this
patch uses the same workaround for all copies. The exact configuration
was hit only very rarely in randconfig builds and I only saw it
in three drivers, but I assume that all of them are potentially
affected, and it's better to keep the code consistent.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agop54: memset(0) whole array
Jiri Slaby [Fri, 14 Oct 2016 09:23:09 +0000 (11:23 +0200)]
p54: memset(0) whole array

gcc 7 complains:
drivers/net/wireless/intersil/p54/fwio.c: In function 'p54_scan':
drivers/net/wireless/intersil/p54/fwio.c:491:4: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]

Fix that by passing the correct size to memset.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Christian Lamparter <chunkeey@googlemail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: print name of connect status event
Rafał Miłecki [Fri, 14 Oct 2016 07:45:59 +0000 (09:45 +0200)]
brcmfmac: print name of connect status event

This simplifies debugging. Format %s (%u) comes from similar debugging
message in brcmf_fweh_event_worker.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Host to device command frame vap_capabilites modified with new field vap status
Prameela Rani Garnepudi [Thu, 13 Oct 2016 11:26:45 +0000 (16:56 +0530)]
rsi: Host to device command frame vap_capabilites modified with new field vap status

* Command frame vap_capabilites is modified to use for vap add, vap delete
  and vap update in firmware, hence new filed vap status is added.
* When interface is down this frame needs to be send with vap status delete.
  Otherwise it is considered as wrong frame for the same interface in firmware.
* vap_update status is reserved for future.

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agorsi: Fix memory leak in module unload
Prameela Rani Garnepudi [Thu, 13 Oct 2016 11:25:46 +0000 (16:55 +0530)]
rsi: Fix memory leak in module unload

Observed crash when module is unloaded if CONFIG_RSI_DEBUGSFS is not set.
Fix: Debugfs entry removal moved inside CONFIG_RSI_DEBUGSFS flag in
             function rsi_mac80211_detach()
Memory leak found and fixed for below structures in function rsi_mac80211_detach()
* channel list for each supported band
* rsi debugfs info

Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowlcore: Allow scans when in AP mode
James Minor [Fri, 7 Oct 2016 15:45:57 +0000 (10:45 -0500)]
wlcore: Allow scans when in AP mode

When in AP mode, scans can be done without changing firmware to
the multi-role firmware. Allow the interface to scan if forced
in the scan request.

Signed-off-by: James Minor <james.minor@ni.com>
Signed-off-by: Xander Huff <xander.huff@ni.com>
Reviewed-by: Ben Shelton <ben.shelton@ni.com>
Reviewed-by: Jaeden Amero <jaeden.amero@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:10 +0000 (23:08 -0500)]
rtlwifi: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8192c: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:09 +0000 (23:08 -0500)]
rtlwifi: rtl8192c: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8188ee: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:08 +0000 (23:08 -0500)]
rtlwifi: rtl8188ee: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8723ae: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:07 +0000 (23:08 -0500)]
rtlwifi: rtl8723ae: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8192cu: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:06 +0000 (23:08 -0500)]
rtlwifi: rtl8192cu: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8192ce: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:05 +0000 (23:08 -0500)]
rtlwifi: rtl8192ce: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8192se: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:04 +0000 (23:08 -0500)]
rtlwifi: rtl8192se: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: rtl8192de: Remove address of Free Software Foundation
Larry Finger [Wed, 5 Oct 2016 04:08:03 +0000 (23:08 -0500)]
rtlwifi: rtl8192de: Remove address of Free Software Foundation

Since this driver was added to the kernel, the checkpatch script was
modified to request that the address of the FSF not be included.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: report wakeup for wowlan
Rajat Jain [Tue, 4 Oct 2016 20:37:42 +0000 (13:37 -0700)]
mwifiex: report wakeup for wowlan

Register the WLAN device as a wakeup source since it can
wake the system via wake-on-wireless-lan. In an actual wowlan
event, notify the PM core that we are the current wakeup source.
This allows the PM core to update the wakeup attributes in /sys.

This was causing wakeup issues on chromeos as the system was
apparently confused about the wakeup source.

Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
Signed-off-by: Rajat Jain <rajatja@google.com>
Tested-by: Wei-Ning Huang <wnhuang@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Acked-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event
Maxim Altshul [Sun, 21 Aug 2016 11:24:25 +0000 (14:24 +0300)]
wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event

This event is used by the Firmware to limit the RX BA win size
for a specific link.

The event handler updates the new size in the mac's sta->sta struct.

BA sessions opened for that link will use the new restricted
win_size. This limitation remains until a new update is received or
until the link is closed.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agowlcore: Pass win_size taken from ieee80211_sta to FW
Maxim Altshul [Sun, 21 Aug 2016 11:24:24 +0000 (14:24 +0300)]
wlcore: Pass win_size taken from ieee80211_sta to FW

When starting a new BA session, we must pass the win_size to the FW.

To do this we take max_rx_aggregation_subframes (BA RX win size)
which is stored in ieee80211_sta structure (e.g per link and not per HW)

We will use the value stored per link when passing the win_size to
firmware through the ACX_BA_SESSION_RX_SETUP command.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoath10k: use the right length of "background"
Nicolas Iooss [Sat, 29 Oct 2016 11:17:37 +0000 (13:17 +0200)]
ath10k: use the right length of "background"

The word "background" contains 10 characters so the third argument of
strncmp() need to be 10 in order to match this prefix correctly.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Fixes: 855aed1220d2 ("ath10k: add spectral scan feature")
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: remove extraneous error message in tx alloc
Mohammed Shafi Shajakhan [Wed, 9 Nov 2016 01:40:59 +0000 (03:40 +0200)]
ath10k: remove extraneous error message in tx alloc

Remove extraneous error message in 'ath10k_htt_tx_alloc_cont_frag_desc'
as the caller 'ath10k_htt_tx_alloc' already dumps a proper error
message

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: clean up HTT tx buffer allocation and free
Mohammed Shafi Shajakhan [Wed, 9 Nov 2016 01:40:58 +0000 (03:40 +0200)]
ath10k: clean up HTT tx buffer allocation and free

cleanup 'ath10k_htt_tx_alloc' by introducing the API's
'ath10k_htt_tx_alloc/free_{cont_txbuf, txdone_fifo} and
re-use them whereever needed

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix failure to send NULL func frame for 10.4
Mohammed Shafi Shajakhan [Wed, 9 Nov 2016 01:40:57 +0000 (03:40 +0200)]
ath10k: fix failure to send NULL func frame for 10.4

This partially reverts 'commit 2cdce425aa33
("ath10k: Fix broken NULL func data frame status for 10.4")'
Unfortunately this breaks sending NULL func and the existing
issue of obtaining proper tx status for NULL function will be
fixed. Also update the comments for feature flag added to be
useless and not working

Fixes: 2cdce425aa33 "ath10k: Fix broken NULL func data frame status for
10.4"
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: Switch to using mac80211 intermediate software queues.
Toke Høiland-Jørgensen [Wed, 9 Nov 2016 11:31:49 +0000 (12:31 +0100)]
ath9k: Switch to using mac80211 intermediate software queues.

This switches ath9k over to using the mac80211 intermediate software
queueing mechanism for data packets. It removes the queueing inside the
driver, except for the retry queue, and instead pulls from mac80211 when
a packet is needed. The retry queue is used to store a packet that was
pulled but can't be sent immediately.

The old code path in ath_tx_start that would queue packets has been
removed completely, as has the qlen limit tunables (since there's no
longer a queue in the driver to limit).

The mac80211 intermediate software queues offer significant latency
reductions, and this patch allows ath9k to realise them. The exact gains
from this varies with the test scenario, but in an access point scenario
we have seen latency reductions ranging from 1/3 to as much as an order
of magnitude. We also achieve slightly better aggregation.

Median latency (ping) figures with this patch applied at the access point,
with two high-rate stations and one low-rate station (HT20 5Ghz), running
a Flent rtt_fair_var_up test with one TCP flow and one ping flow going to
each station:

                                 Fast station        Slow station
Default pfifo_fast qdisc:            430.4 ms            638.7 ms
fq_codel qdisc on iface:              35.5 ms            211.8 ms
This patch set:                       22.4 ms             38.2 ms

Median aggregation sizes over the same test:

Default pfifo_fast qdisc:            9.5 pkts            1.9 pkts
fq_codel qdisc on iface:            11.2 pkts            1.9 pkts
This patch set:                     13.9 pkts            1.9 pkts

This patch is based on Tim's original patch set, but reworked quite
thoroughly.

Cc: Tim Shepard <shep@alum.mit.edu>
Cc: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k_htc: fix minor mistakes in dev_err messages
Colin Ian King [Mon, 31 Oct 2016 15:12:47 +0000 (09:12 -0600)]
ath9k_htc: fix minor mistakes in dev_err messages

Add missing space in a dev_err message and join wrapped text so
it does not span multiple lines.  Fix spelling mistake on "unknown".

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: parse the device configuration from an OF node
Martin Blumenstingl [Sun, 16 Oct 2016 20:59:07 +0000 (22:59 +0200)]
ath9k: parse the device configuration from an OF node

This allows setting the MAC address and specifying that the firmware
will be requested from userspace (because there might not be a hardware
EEPROM connected to the chip) for ath9k based PCI devices using
the device tree.

There is some out-of-tree code to "convert devicetree to
ath9k_platform_data" (for example in OpenWrt and LEDE) which becomes
obsolete with this patch.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: add a helper to get the string representation of ath_bus_type
Martin Blumenstingl [Sun, 16 Oct 2016 20:59:06 +0000 (22:59 +0200)]
ath9k: add a helper to get the string representation of ath_bus_type

This can be used when the ath_bus_type has to be presented in a log
message or firmware filename.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoDocumentation: dt: net: add ath9k wireless device binding
Martin Blumenstingl [Sun, 16 Oct 2016 20:59:05 +0000 (22:59 +0200)]
Documentation: dt: net: add ath9k wireless device binding

Add documentation how devicetree can be used to configure ath9k based
devices.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards.
Vittorio Gambaletta (VittGam) [Wed, 9 Nov 2016 01:40:56 +0000 (03:40 +0200)]
ath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards.

The active_high LED of my Wistron DNMA-92 is still being recognized as
active_low on 4.7.6 mainline. When I was preparing my former commit
0f9edcdd88a9 ("ath9k: Fix LED polarity for some Mini PCI AR9220 MB92
cards.") to fix that I must have somehow messed up with testing, because
I tested the final version of that patch before sending it, and it was
apparently working; but now it is not working on 4.7.6 mainline.

I initially added the PCI_DEVICE_SUB section for 0x0029/0x2096 above the
PCI_VDEVICE section for 0x0029; but then I moved the former below the
latter after seeing how 0x002A sections were sorted in the file.

This turned out to be wrong: if a generic PCI_VDEVICE entry (that has
both subvendor and subdevice IDs set to PCI_ANY_ID) is put before a more
specific one (PCI_DEVICE_SUB), then the generic PCI_VDEVICE entry will
match first and will be used.

With this patch, 0x0029/0x2096 has finally got active_high LED on 4.7.6.

While I'm at it, let's fix 0x002A too by also moving its generic definition
below its specific ones.

Fixes: 0f9edcdd88a9 ("ath9k: Fix LED polarity for some Mini PCI AR9220 MB92 cards.")
Cc: <stable@vger.kernel.org> #4.7+
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
[kvalo@qca.qualcomm.com: improve the commit log based on email discussions]
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agocw1200: Don't leak memory if krealloc failes
Johannes Thumshirn [Fri, 30 Sep 2016 12:39:17 +0000 (14:39 +0200)]
cw1200: Don't leak memory if krealloc failes

The call to krealloc() in wsm_buf_reserve() directly assigns the newly
returned memory to buf->begin. This is all fine except when krealloc()
failes we loose the ability to free the old memory pointed to by
buf->begin. If we just create a temporary variable to assign memory to
and assign the memory to it we can mitigate the memory leak.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix missing destroy_workqueue() on error in mwifiex_add_virtual_intf()
Wei Yongjun [Thu, 29 Sep 2016 14:57:56 +0000 (14:57 +0000)]
mwifiex: fix missing destroy_workqueue() on error in mwifiex_add_virtual_intf()

Add the missing destroy_workqueue() before return from
mwifiex_add_virtual_intf() in the error handling case.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix p2p device doesn't find in scan problem
Karthik D A [Wed, 28 Sep 2016 12:48:28 +0000 (18:18 +0530)]
mwifiex: fix p2p device doesn't find in scan problem

Marvell p2p device disappears from the list of p2p peers on the other
p2p device after disconnection.

It happens due to a bug in driver. When interface is changed from p2p
to station, certain variables(bss_type, bss_role etc.) aren't correctly
updated. This patch corrects them to fix the issue.

Signed-off-by: Karthik D A <karthida@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix command timeout problem seen in stress tests
Xinming Hu [Wed, 28 Sep 2016 12:48:27 +0000 (18:18 +0530)]
mwifiex: fix command timeout problem seen in stress tests

It is observed that if single tid 6 packet comes among with massive tid 0
packets, tid 6 packet may stay in it's queue and will never be
transmited. This is because wmm.highest_queued_prio will be set to 2
during transmission of tid 0 packets As a result, main work thread
keeps on looping without serving that packet. In this case, if command
has downloaded to firmware, driver doesn't process it's response causing
command timeout.

This patch will reset highest_queued_prio if packets exist in data
queue, and try to find a ra_list for current private.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: update tx_pkts_queued for requeued packets
Xinming Hu [Wed, 28 Sep 2016 12:48:26 +0000 (18:18 +0530)]
mwifiex: update tx_pkts_queued for requeued packets

wmm.tx_pkts_queued and ralist's total_pkt_count should be updated in
synchronization. They were not correctly updated in
mwifiex_send_processed_packet().

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: add memrw command information in README
Amitkumar Karwar [Wed, 28 Sep 2016 12:48:25 +0000 (18:18 +0530)]
mwifiex: add memrw command information in README

Support for this debugfs command is available in driver. This patch
adds usage information in README file.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: vendor_ie length check for parse WMM IEs
Karthik D A [Wed, 28 Sep 2016 12:48:24 +0000 (18:18 +0530)]
mwifiex: vendor_ie length check for parse WMM IEs

While copying the vendor_ie obtained from the cfg80211_find_vendor_ie()
to the struct mwifiex_types_wmm_info, length/size was inappropriate.
This patch corrects the required length needed to the
mwifiex_types_wmm_info

Signed-off-by: Karthik D A <karthida@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Fix NULL pointer dereference in skb_dequeue()
Amitkumar Karwar [Wed, 28 Sep 2016 12:48:23 +0000 (18:18 +0530)]
mwifiex: Fix NULL pointer dereference in skb_dequeue()

At couple of places in cleanup path, we are just going through the
skb queue and freeing them without unlinking. This leads to a crash
when other thread tries to do skb_dequeue() and use already freed node.

The problem is freed by unlinking skb before freeing it.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: report error to PCIe for suspend failure
Amitkumar Karwar [Wed, 28 Sep 2016 12:48:22 +0000 (18:18 +0530)]
mwifiex: report error to PCIe for suspend failure

When host_sleep_config command fails, we should return an error to
PCIe, instead of continuing (and possibly panicking, when we try to keep
processing a timed-out ioctl after we return "successfully" from
suspend).

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: prevent register accesses after host is sleeping
Amitkumar Karwar [Wed, 28 Sep 2016 12:48:21 +0000 (18:18 +0530)]
mwifiex: prevent register accesses after host is sleeping

Following is mwifiex driver-firmware host sleep handshake.
It involves three threads. suspend handler, interrupt handler, interrupt
processing in main work queue.

1) Enter suspend handler
2) Download HS_CFG command
3) Response from firmware for HS_CFG
4) Suspend thread waits until handshake completes(i.e hs_activate becomes
   true)
5) SLEEP from firmware
6) SLEEP confirm downloaded to firmware.
7) SLEEP confirm response from firmware
8) Driver processes SLEEP confirm response and set hs_activate to wake up
suspend thread
9) Exit suspend handler
10) Read sleep cookie in loop and wait until it indicates firmware is
sleep.
11) After processing SLEEP confirm response, we are at the end of interrupt
processing routine. Recheck if there are interrupts received while we were
processing them.

During suspend-resume stress test, it's been observed that we may end up
acessing PCIe hardware(in 10 and 11) when PCIe bus is closed which leads
to a kernel crash.

This patch solves the problem with below changes.
a) action 10 above can be done before 8
b) Skip 11 if hs_activated is true. SLEEP confirm response
is the last interrupt from firmware. No need to recheck for
pending interrupts.
c) Add flush_workqueue() in suspend handler.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: proto: add callback for queuing TX data
Rafał Miłecki [Mon, 26 Sep 2016 21:51:44 +0000 (23:51 +0200)]
brcmfmac: proto: add callback for queuing TX data

So far our core code was calling brcmf_fws_process_skb which wasn't
a proper thing to do. If case of devices using msgbuf protocol fwsignal
shouldn't be used. It was an unnecessary extra layer simply calling
a protocol specifix txdata function.

Please note we already have txdata callback, but it's used for calls
between bcdc and fwsignal so it couldn't be simply used there.

This makes core code more generic (instead of bcdc/fwsignal specific).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: add support for mac addr from device tree
Mathias Kresin [Fri, 26 Aug 2016 07:16:53 +0000 (09:16 +0200)]
rt2x00: add support for mac addr from device tree

On some devices the EEPROMs of Ralink Wi-Fi chips have a default Ralink
MAC address set (RT3062F: 00:0C:43:30:62:00, RT3060F:
00:0C:43:30:60:00). Using multiple of these devices in the same network
can cause nasty issues.

Allow to override the MAC in the EEPROM with (a known good) one set in
the device tree to bypass the issue.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 9 Nov 2016 00:15:17 +0000 (02:15 +0200)]
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for 4.10. Major changes:

ath10k

* allow setting coverage class for first generation cards
* read regulatory domain from ACPI

ath9k

* disable RNG by default

7 years agoMerge tag 'iwlwifi-next-for-kalle-2016-10-25-2' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Thu, 27 Oct 2016 15:29:18 +0000 (18:29 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2016-10-25-2' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

* Finalize and enable dynamic queue allocation;
* Use dev_coredumpmsg() to prevent locking the driver;
* Small fix to pass the AID to the FW;
* Use FW PS decisions with multi-queue;

7 years agodevlink: Prevent port_type_set() callback when it's not needed
Elad Raz [Sun, 23 Oct 2016 15:43:05 +0000 (17:43 +0200)]
devlink: Prevent port_type_set() callback when it's not needed

When a port_type_set() is been called and the new port type set is the same
as the old one, just return success.

Signed-off-by: Elad Raz <eladr@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agofirewire: net: set initial MTU = 1500 unconditionally, fix IPv6 on some CardBus cards
Stefan Richter [Sun, 23 Oct 2016 14:30:56 +0000 (16:30 +0200)]
firewire: net: set initial MTU = 1500 unconditionally, fix IPv6 on some CardBus cards

firewire-net, like the older eth1394 driver, reduced the initial MTU to
less than 1500 octets if the local link layer controller's asynchronous
packet reception limit was lower.

This is bogus, since this reception limit does not have anything to do
with the transmission limit.  Neither did this reduction affect the TX
path positively, nor could it prevent link fragmentation at the RX path.

Many FireWire CardBus cards have a max_rec of 9, causing an initial MTU
of 1024 - 16 = 1008.  RFC 2734 and RFC 3146 allow a minimum max_rec = 8,
which would result in an initial MTU of 512 - 16 = 496.  On such cards,
IPv6 could only be employed if the MTU was manually increased to 1280 or
more, i.e. IPv6 would not work without intervention from userland.

We now always initialize the MTU to 1500, which is the default according
to RFC 2734 and RFC 3146.

On a VIA VT6316 based CardBus card which was affected by this, changing
the MTU from 1008 to 1500 also increases TX bandwidth by 6 %.
RX remains unaffected.

CC: netdev@vger.kernel.org
CC: linux1394-devel@lists.sourceforge.net
CC: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agofirewire: net: fix maximum possible MTU
Stefan Richter [Sun, 23 Oct 2016 14:29:03 +0000 (16:29 +0200)]
firewire: net: fix maximum possible MTU

Commit b3e3893e1253 ("net: use core MTU range checking in misc drivers")
mistakenly introduced an upper limit for firewire-net's MTU based on the
local link layer controller's reception capability.  Revert this.  Neither
RFC 2734 nor our implementation impose any particular upper limit.

Actually, to be on the safe side and to make the code explicit, set
ETH_MAX_MTU = 65535 as upper limit now.

(I replaced sizeof(struct rfc2734_header) by the equivalent
RFC2374_FRAG_HDR_SIZE in order to avoid distracting long/int conversions.)

Fixes: b3e3893e1253('net: use core MTU range checking in misc drivers')
CC: netdev@vger.kernel.org
CC: linux1394-devel@lists.sourceforge.net
CC: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: netcp: add missing of_node_put() in netcp_probe()
Wei Yongjun [Sat, 22 Oct 2016 14:40:17 +0000 (14:40 +0000)]
net: netcp: add missing of_node_put() in netcp_probe()

This node pointer is returned by of_get_child_by_name() with refcount
incremented in this function. of_node_put() on it before exitting this
function.

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ena: use setup_timer() and mod_timer()
Wei Yongjun [Sat, 22 Oct 2016 14:36:36 +0000 (14:36 +0000)]
net: ena: use setup_timer() and mod_timer()

Use setup_timer() instead of init_timer(), being the preferred/standard
way to set a timer up.

Also, quoting the mod_timer() function comment:
-> mod_timer() is a more efficient way to update the expire field of an
   active timer (if the timer is inactive it will be activated).

Use setup_timer and mod_timer to setup and arm a timer, to make the code
cleaner and easier to read.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoamd-xgbe: Fix error return code in xgbe_probe()
Wei Yongjun [Sat, 22 Oct 2016 14:35:30 +0000 (14:35 +0000)]
amd-xgbe: Fix error return code in xgbe_probe()

Fix to return error code -ENODEV from the DMA is not supported error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ns83820: use dev_kfree_skb_irq instead of kfree_skb
Wei Yongjun [Sat, 22 Oct 2016 14:34:55 +0000 (14:34 +0000)]
net: ns83820: use dev_kfree_skb_irq instead of kfree_skb

It is not allowed to call kfree_skb() from hardware interrupt
context or with interrupts being disabled, spin_lock_irqsave()
make sure always in irq disable context. So the kfree_skb()
should be replaced with dev_kfree_skb_irq().

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: eth: altera: Fix error return code in altera_tse_probe()
Wei Yongjun [Sat, 22 Oct 2016 14:28:38 +0000 (14:28 +0000)]
net: eth: altera: Fix error return code in altera_tse_probe()

Fix to return error code -EINVAL from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: dsa: mv88e6xxx: use setup_timer to simplify the code
Wei Yongjun [Sat, 22 Oct 2016 14:28:00 +0000 (14:28 +0000)]
net: dsa: mv88e6xxx: use setup_timer to simplify the code

Use setup_timer function instead of initializing timer with the function
and data fields.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: netcp: drop kfree for memory allocated with devm_kzalloc
Wei Yongjun [Sat, 22 Oct 2016 12:32:04 +0000 (12:32 +0000)]
net: netcp: drop kfree for memory allocated with devm_kzalloc

It's not necessary to free memory allocated with devm_kzalloc in the
remove path and using kfree leads to a double free.

Fixes: 84640e27f230 ("net: netcp: Add Keystone NetCP core ethernet
driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobatman-adv: Revert "use core MTU range checking in misc drivers"
Sven Eckelmann [Sat, 22 Oct 2016 07:46:24 +0000 (09:46 +0200)]
batman-adv: Revert "use core MTU range checking in misc drivers"

The maximum MTU is defined via the slave devices of an batman-adv
interface. Thus it is not possible to calculate the max_mtu during the
creation of the batman-adv device when no slave devices are attached. Doing
so would for example break non-fragmentation setups which then
(incorrectly) allow an MTU of 1500 even when underlying device cannot
transport 1500 bytes + batman-adv headers.

Checking the dynamically calculated max_mtu via the minimum of the slave
devices MTU during .ndo_change_mtu is also used by the bridge interface.

Cc: Jarod Wilson <jarod@redhat.com>
Fixes: b3e3893e1253 ("net: use core MTU range checking in misc drivers")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'BCM54612E'
David S. Miller [Wed, 26 Oct 2016 21:15:27 +0000 (17:15 -0400)]
Merge branch 'BCM54612E'

Xo Wang says:

====================
Broadcom BCM54612E support

This series is based on tip of torvalds/master.

The first patch adds register definitions from Broadcom docs.

The second patch adds the BCM54612E PHY ID, flags, and device-specific
RGMII internal delay initialization.

I tested on a custom board with an Aspeed AST2500 SOC with its second
MAC connected to this PHY.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: phy: broadcom: Add support for BCM54612E
Xo Wang [Fri, 21 Oct 2016 17:20:13 +0000 (10:20 -0700)]
net: phy: broadcom: Add support for BCM54612E

This PHY has internal delays enabled after reset. This clears the
internal delay enables unless the interface specifically requests them.

Signed-off-by: Xo Wang <xow@google.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: phy: broadcom: Update Auxiliary Control Register macros
Xo Wang [Fri, 21 Oct 2016 17:20:12 +0000 (10:20 -0700)]
net: phy: broadcom: Update Auxiliary Control Register macros

Add the RXD-to-RXC skew (delay) time bit in the Miscellaneous Control
shadow register and a mask for the shadow selector field.

Remove a re-definition of MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL.

Signed-off-by: Xo Wang <xow@google.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agosch_htb: do not report fake rate estimators
Eric Dumazet [Fri, 21 Oct 2016 16:02:43 +0000 (09:02 -0700)]
sch_htb: do not report fake rate estimators

When I prepared commit d250a5f90e53 ("pkt_sched: gen_estimator: Dont
report fake rate estimators"), htb still had an implicit rate estimator
for all its classes.

Then later, I made this rate estimator optional in commit 64153ce0a7b6
("net_sched: htb: do not setup default rate estimators"), but I forgot
to update htb use of gnet_stats_copy_rate_est()

After this patch, "tc -s qdisc ..." no longer report fake rate
estimators for HTB classes.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoiwlwifi: mvm: use dev_coredumpsg()
Aviya Erenfeld [Tue, 20 Sep 2016 15:07:44 +0000 (18:07 +0300)]
iwlwifi: mvm: use dev_coredumpsg()

iwlmvm currently uses dev_coredumpm() to collect multiple
buffers, but this has the downside of pinning the module
until the coredump expires, if the data isn't read by any
userspace.

Avoid this by using the new dev_coredumpsg() method. We
still copy the data from the old way of generating it, but
neither hold on to vmalloc'ed data for a long time, nor do
we pin the module now.

Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com>
[rewrite commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: enable dynamic queue allocation mode
Liad Kaufman [Thu, 22 Sep 2016 11:41:28 +0000 (14:41 +0300)]
iwlwifi: mvm: enable dynamic queue allocation mode

New firmwares support dynamic queue allocation (DQA), which enables
on-demand allocation of queues per RA/TID, instead of allocating them
statically per vif.  This allows an AP to send, for instance, BE
traffic to STA2 even if it also needs to send traffic to a sleeping
STA1, without being blocked by the sleeping station.

The implementation in the driver is now ready, so we can enable this
feature by default when running firmwares that support it.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
[reworded the commit message]
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agonet: ip, diag -- Add diag interface for raw sockets
Cyrill Gorcunov [Fri, 21 Oct 2016 10:03:44 +0000 (13:03 +0300)]
net: ip, diag -- Add diag interface for raw sockets

In criu we are actively using diag interface to collect sockets
present in the system when dumping applications. And while for
unix, tcp, udp[lite], packet, netlink it works as expected,
the raw sockets do not have. Thus add it.

v2:
 - add missing sock_put calls in raw_diag_dump_one (by eric.dumazet@)
 - implement @destroy for diag requests (by dsa@)

v3:
 - add export of raw_abort for IPv6 (by dsa@)
 - pass net-admin flag into inet_sk_diag_fill due to
   changes in net-next branch (by dsa@)

v4:
 - use @pad in struct inet_diag_req_v2 for raw socket
   protocol specification: raw module carries sockets
   which may have custom protocol passed from socket()
   syscall and sole @sdiag_protocol is not enough to
   match underlied ones
 - start reporting protocol specifed in socket() call
   when sockets are raw ones for the same reason: user
   space tools like ss may parse this attribute and use
   it for socket matching

v5 (by eric.dumazet@):
 - use sock_hold in raw_sock_get instead of atomic_inc,
   we're holding (raw_v4_hashinfo|raw_v6_hashinfo)->lock
   when looking up so counter won't be zero here.

v6:
 - use sdiag_raw_protocol() helper which will access @pad
   structure used for raw sockets protocol specification:
   we can't simply rename this member without breaking uapi

v7:
 - sine sdiag_raw_protocol() helper is not suitable for
   uapi lets rather make an alias structure with proper
   names. __check_inet_diag_req_raw helper will catch
   if any of structure unintentionally changed.

CC: David S. Miller <davem@davemloft.net>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: David Ahern <dsa@cumulusnetworks.com>
CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
CC: James Morris <jmorris@namei.org>
CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
CC: Patrick McHardy <kaber@trash.net>
CC: Andrey Vagin <avagin@openvz.org>
CC: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agolwt: Remove unused len field
Thomas Graf [Fri, 21 Oct 2016 14:10:22 +0000 (16:10 +0200)]
lwt: Remove unused len field

The field is initialized by ILA and MPLS but never used. Remove it.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>