platform/kernel/linux-rpi.git
7 years agobrcmfmac: restore bus state when enter_D3 fails
Arend Van Spriel [Tue, 28 Mar 2017 10:43:27 +0000 (11:43 +0100)]
brcmfmac: restore bus state when enter_D3 fails

In brcmf_pcie_suspend() we inform the firmware on the device that
it will enter in D3 state. Before this is done we already bring down
the bus state. However, When entering D3 fails we abort the suspend
and the bus state need to be restored.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: add support to move wiphy instance into network namespace
Arend Van Spriel [Tue, 28 Mar 2017 10:43:26 +0000 (11:43 +0100)]
brcmfmac: add support to move wiphy instance into network namespace

To support network namespace the driver must assure all created
network interfaces are in the same namespace as the wiphy instance
and flag the support using WIPHY_FLAG_NETNS_OK.

Verified using two terminals:

 Terminal 1 Terminal 2
 -------------------------- ---------------------------------
 # ip netns add brcm-wifi # iw dev
phy#0
Interface wlan3
ifindex 11
wdev 0x1
 # ip netns exec brcm-wifi bash
 # iw dev
 # echo $$
 20337 # iw phy0 set netns 20337
 # iw dev
 phy#0
Interface wlan3
ifindex 11
wdev 0x2
 # iw phy0 interface add wl3.ap type __ap
 # iw dev
 phy#0
Interface wl3.ap
ifindex 2
wdev 0x3
Interface wlan3
ifindex 11
wdev 0x2
# iw dev
 # iw phy0 set netns 1
 # iw dev
# iw dev
phy#0
Interface wl3.ap
ifindex 2
wdev 0x5
Interface wlan3
ifindex 11
wdev 0x4

Note:
increasing wdev identifier above indicates issue in
cfg80211 which is addressed separately.

Tested-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: move brcmf_fws_deinit to bcdc layer
Franky Lin [Tue, 28 Mar 2017 10:43:25 +0000 (11:43 +0100)]
brcmfmac: move brcmf_fws_deinit to bcdc layer

Move brcmf_fws_deinit into brcmf_proto_bcdc_detach since it is a bcdc
exclusive feature.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_init into bcdc layer
Franky Lin [Tue, 28 Mar 2017 10:43:24 +0000 (11:43 +0100)]
brcmfmac: wrap brcmf_fws_init into bcdc layer

Create a new protocol layer interface brcmf_proto_init_cb for protocol
layer to finish initialzation after core module components(fweh and
etc.) are initialized.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: enable auto deep sleep mode for USB chipsets
Amitkumar Karwar [Mon, 27 Mar 2017 13:06:51 +0000 (18:36 +0530)]
mwifiex: enable auto deep sleep mode for USB chipsets

Chip goes into low power state when this feature is enabled.
This was already enabled for SDIO and PCIe interface based
chipsets.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Support USB interrupt endpoint for command response/event
Ganapathi Bhat [Mon, 27 Mar 2017 12:57:44 +0000 (18:27 +0530)]
mwifiex: Support USB interrupt endpoint for command response/event

USB firmware added support for sending command response/event through
interrupt endpoint, to enhance RX throughput. Added corresponding changes
required to support this feature. This change takes care of backward
compatibility with older firmware.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: update BRCMFMAC symbol description
Rafał Miłecki [Thu, 23 Mar 2017 10:29:28 +0000 (11:29 +0100)]
brcmfmac: update BRCMFMAC symbol description

For quite some time now brcmfmac supports 802.11ac chipsets and it's
not limited to embedded devices only. There are even standalone PCIe
cards based on BCM43602 or BCM4366.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.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, 5 Apr 2017 07:14:09 +0000 (10:14 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for 4.12. Major changes:

ath10k

* improve firmware download time for QCA6174 and QCA9377, especially
  helps resume time

ath9k_htc

* add support AirTies 1eda:2315 AR9271 device

7 years agort2x00: add support for MT7620
Roman Yeryomin [Mon, 20 Mar 2017 23:43:00 +0000 (00:43 +0100)]
rt2x00: add support for MT7620

Basic support for MT7620 built-in wireless radio was added to
OpenWrt in r41441. It has seen some heavy cleaning and refactoring
since in order to match the Kernel's code quality standards.

Signed-off-by: Roman Yeryomin <roman@advem.lv>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agozd1211rw: fix NULL-deref at probe
Johan Hovold [Mon, 13 Mar 2017 12:44:21 +0000 (13:44 +0100)]
zd1211rw: fix NULL-deref at probe

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory beyond the endpoint array should a
malicious device lack the expected endpoints.

Fixes: a1030e92c150 ("[PATCH] zd1211rw: Convert installer CDROM device into WLAN device")
Cc: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: fix TX_PWR_CFG_4 register definition
Daniel Golle [Wed, 8 Mar 2017 23:54:22 +0000 (00:54 +0100)]
rt2x00: fix TX_PWR_CFG_4 register definition

Some of the macros used to describe the TX_PWR_CFG_4 register accidentally
refer to TX_PWR_CFG_3, probably a copy&paste error. Fix that.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoipw2200: remove redundant check of rc < 0
Colin Ian King [Mon, 27 Feb 2017 23:40:19 +0000 (23:40 +0000)]
ipw2200: remove redundant check of rc < 0

The check for rc < 0 is always false so the check is redundant
and can be removed.

Detected with CoverityScan, CID#101143 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_reset_interface into bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:06 +0000 (21:17 +0000)]
brcmfmac: wrap brcmf_fws_reset_interface into bcdc layer

Create a new protocol interface function brcmf_proto_reset_if for core
module to notify protocol layer when interface role changes.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_del_interface into bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:05 +0000 (21:17 +0000)]
brcmfmac: wrap brcmf_fws_del_interface into bcdc layer

Create a new protocol interface function brcmf_proto_del_if for core
module to notify protocol layer upon interface deletion.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: wrap brcmf_fws_add_interface into bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:04 +0000 (21:17 +0000)]
brcmfmac: wrap brcmf_fws_add_interface into bcdc layer

fwsignal is only used by bcdc. Create a new protocol interface function
brcmf_proto_add_if for core module to notify protocol layer upon a new
interface is created.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: move brcmf_txcomplete to bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:03 +0000 (21:17 +0000)]
brcmfmac: move brcmf_txcomplete to bcdc layer

brcmf_txcomplete is invoked by sdio and usb bus module which are using
bcdc protocol. So move it from core module into bcdc layer.

Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: move brcmf_txflowblock to bcdc layer
Franky Lin [Fri, 10 Mar 2017 21:17:02 +0000 (21:17 +0000)]
brcmfmac: move brcmf_txflowblock to bcdc layer

brcmf_txflowblock is invoked by sdio and usb bus module which are using
bcdc protocol. This patch makes it a bcdc API instead of a core module
function.

Reviewed-by: Arend Van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: Handle status == BRCMF_E_STATUS_ABORT in cfg80211_escan_handler
Hans de Goede [Wed, 8 Mar 2017 13:50:17 +0000 (14:50 +0100)]
brcmfmac: Handle status == BRCMF_E_STATUS_ABORT in cfg80211_escan_handler

If a scan gets aborted BRCMF_SCAN_STATUS_BUSY gets cleared in
cfg->scan_status and when we receive an abort event from the firmware
the BRCMF_SCAN_STATUS_BUSY check in the cfg80211_escan_handler will
trigger resulting in multiple errors getting logged.

Check for a status of BRCMF_E_STATUS_ABORT and in this case simply
cleanly exit the cfg80211_escan_handler. This also avoids a
BRCMF_E_STATUS_ABORT event arriving after a new scan has been started
causing the new scan to complete prematurely without any data.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: Do not complain about country code "00"
Hans de Goede [Wed, 8 Mar 2017 13:50:16 +0000 (14:50 +0100)]
brcmfmac: Do not complain about country code "00"

The country code gets set to "00" by default at boot, ignore this
rather then logging an error about it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: Do not print the firmware version as an error
Hans de Goede [Wed, 8 Mar 2017 13:50:15 +0000 (14:50 +0100)]
brcmfmac: Do not print the firmware version as an error

Using pr_err for things which are not errors is a bad idea. E.g. it
will cause the plymouth bootsplash screen to drop back to the text
console so that the user can see the error, which is not what we
normally want to happen.

Instead add a new brcmf_info macro and use that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobrcmfmac: always print error when PSM's watchdog fires
Rafał Miłecki [Fri, 24 Feb 2017 16:32:46 +0000 (17:32 +0100)]
brcmfmac: always print error when PSM's watchdog fires

So far we were attaching BRCMF_E_PSM_WATCHDOG event listener in
brcmf_debug_attach which gets compiled only with CONFIG_BRCMDBG. This
event means something went wrong and firmware / hardware usually can't
be expected to work (reliably).

Such a problem is significant for user experience so I believe we should
print an error unconditionally (even with debugging disabled). What can
be indeed optional is dumping bus memory as this is clearly part of
debugging process.

In the future we may also try to extend this listener by trying to
recover from the error or at least signal it to the cfg80211.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: fill core OF info independently of bus type
Rafał Miłecki [Fri, 3 Mar 2017 10:34:15 +0000 (11:34 +0100)]
bcma: fill core OF info independently of bus type

PCI devices can be described in DT as well so we should always execute
relevant code. This will make bcma e.g. set of_node for cores described
in DT.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: use helper function to set core dev's parent
Rafał Miłecki [Fri, 3 Mar 2017 10:34:14 +0000 (11:34 +0100)]
bcma: use helper function to set core dev's parent

A tiny code deduplication thanks to the bcma_bus_get_host_dev.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: drop unneeded check for CONFIG_OF_IRQ
Rafał Miłecki [Fri, 3 Mar 2017 10:33:30 +0000 (11:33 +0100)]
bcma: drop unneeded check for CONFIG_OF_IRQ

We already have the same check in bcma_of_get_irq which really calls
symbols available with CONFIG_OF_IRQ only. It appears this duplicated
check was accidentally added in commit c58d900cc96a ("bcma: fix building
without OF_IRQ"). The rest of code in bcma_of_fill_device should work
fine without CONFIG_OF_IRQ.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortlwifi: Add QoS-NULL and BT-QoS-NULL to reserved page.
Ping-Ke Shih [Thu, 23 Feb 2017 17:19:57 +0000 (11:19 -0600)]
rtlwifi: Add QoS-NULL and BT-QoS-NULL to reserved page.

Two additional preset responses are added to the reserved page on the
wifi device.

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 code to read new versions of firmware
Larry Finger [Thu, 23 Feb 2017 17:19:56 +0000 (11:19 -0600)]
rtlwifi: Add code to read new versions of firmware

Changes in the drivers for RTL8723BE and RTL8821AE require corresponding
changes in the firmware. This new firmware has been accepted into the
Linux firmware repo. To handle the case where the kernel has been
updated before the firmware, the new versions have been given new names.
The code will attempt to read the new name, and fall back to the old one
if the new one is not available.

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: Update 8812ae new phy parameters and its parser.
Ping-Ke Shih [Thu, 23 Feb 2017 17:19:55 +0000 (11:19 -0600)]
rtlwifi: Update 8812ae new phy parameters and its parser.

Update PHY tables for the RTL8812AE. A new parser is also needed.

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: Update 8821ae new phy parameters and its parser.
Ping-Ke Shih [Thu, 23 Feb 2017 17:19:54 +0000 (11:19 -0600)]
rtlwifi: Update 8821ae new phy parameters and its parser.

There are new PHY table values for the RTL8821AE. The changes require
new parsing code.

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 agomwifiex: fix kernel crash after shutdown command timeout
Brian Norris [Thu, 16 Mar 2017 21:36:07 +0000 (14:36 -0700)]
mwifiex: fix kernel crash after shutdown command timeout

We observed a SHUTDOWN command timeout during reboot stress test due to
a corner case firmware bug. It can lead to either a use-after-free +
OOPS (on either the adapter structure, or the 'card' structure) or an
abort (where, e.g., the PCI device is "disabled" before we're done
dumping the FW).

We can avoid this by canceling/flushing the FW dump work:

(a) after we've terminated all other work queues (e.g., for processing
    commands which could time out)
(b) after we've disabled all interrupts (which could also queue more
    work for us)
(c) after we've unregistered the netdev and wiphy structures (and
    implicitly, and debugfs entries which could manually trigger FW dumps)
(d) before we've actually disabled the device (e.g.,
    pci_device_disable())

Altogether, this means no card->work will be scheduled if we sync at
a point that satisfies the above. This can be done at the beginning of
the .cleanup_if() callback.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: send fewer channels to scan while connected
Amitkumar Karwar [Thu, 16 Mar 2017 10:46:11 +0000 (16:16 +0530)]
mwifiex: send fewer channels to scan while connected

Application triggers periodic background scans when device is connected.
We will scan less number of channels per scan command so that data
traffic won't get affected.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: fix for unaligned reads
Devidas Puranik [Thu, 9 Mar 2017 08:36:17 +0000 (14:06 +0530)]
mwifiex: fix for unaligned reads

Using the accessor function e.g. get_unaligned_le32 instead of
le32_to_cpu to avoid the unaligned access. This is for the
architectures that don't handle the unaligned memory access

Signed-off-by: Devidas Puranik <devidas@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: Use accessors routines for unaligned values
Daniel Mentz [Thu, 9 Mar 2017 08:36:16 +0000 (14:06 +0530)]
mwifiex: Use accessors routines for unaligned values

Synopsys' ARCompact architecture does not support loading from or
storing values to unaligned memory locations. We saw a series of
misaligned access exceptions on ARC. To work around this issue, we bulk
replaced le16_to_cpu and le32_to_cpu with get_unaligned_le16 and
get_unaligned_le32, respectively. We also added le16_unaligned_add_cpu
which is similar to le16_add_cpu but works with unaligned values.

Signed-off-by: Daniel Mentz <danielmentz@google.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: add qualifier to firmware structures
Karthik Ananthapadmanabha [Thu, 9 Mar 2017 08:36:15 +0000 (14:06 +0530)]
mwifiex: add qualifier to firmware structures

Adding qualifier "__packed" indicates that no padding should be
performed on the qualified object for alignment.
This patch adds qualifier __packed to the required firmware
structures in mwifiex driver.

Signed-off-by: Karthik Ananthapadmanabha <karthida@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: pcie: clean up error prints in mwifiex_pcie_reset_notify()
Brian Norris [Tue, 7 Mar 2017 20:47:46 +0000 (12:47 -0800)]
mwifiex: pcie: clean up error prints in mwifiex_pcie_reset_notify()

We shouldn't be printing a kernel pointer as a decimal integer. But we
really shouldn't be printing this case at all; we should never get here
with NULL drvdata. We've eliminated this unnecessary conditional in
several other places, so kill it here too.

Similarly, there's no need to check for '!pdev'; we are guaranteed to
have a real device here.

And finally, use dev_err() instead of pr_err().

This yields (for failed PCIe resets):

[   68.286586] mwifiex_pcie 0000:01:00.0: mwifiex_pcie_reset_notify: adapter structure is not valid

instead of:

[   82.932658] mwifiex_pcie: mwifiex_pcie_reset_notify: Card or adapter structure is not valid (-270880688088)

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agomwifiex: wake system up when receives a wake irq
Jeffy Chen [Fri, 24 Feb 2017 06:24:31 +0000 (14:24 +0800)]
mwifiex: wake system up when receives a wake irq

Currrently we are disabling this wake irq after receiving it. If this
happens before we finish suspend and the pm event check is disabled,
the system will continue suspending, and this irq would not work again.

We may need to abort system suspend to avoid that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoatmel: remove time_t usage
Alexandre Belloni [Thu, 23 Feb 2017 16:14:45 +0000 (17:14 +0100)]
atmel: remove time_t usage

last_qual never really holds a time. It only holds jiffies. Make it the
same type as jiffies.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agoath6kl: Remove old 802.11a-only channels
Rostyslav Khudolii [Thu, 16 Mar 2017 09:22:17 +0000 (11:22 +0200)]
ath6kl: Remove old 802.11a-only channels

Channels 34/38/42/46 can only be used for compatibility with old devices sold
in Japan. Modern products, such as AR6003/AR6004 don't support these channels.
Keeping them in the upstream is error prone and requires full network stack
support. A custom patch should be used in case such compatibility is required.

Without this one, a user is able to start an AP using wpa_supplicant,
for example, on one of these channels (34/38/42/46), without getting
any warning/error from the cfg80211 or ath6kl - which is correct
(since these channels match regdom rules). However, the AR6003 and its
firmware (we're using v3.4.0.225) will fail and return
"WMI_CMDERROR_EVENTID" with "INVALID_PARAM" error code.

Signed-off-by: Rostyslav Khudolii <rkhudolii@airtame.com>
Cc: Attila Sukosd <attila@airtame.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: remove redundant check of len with buf_len
Colin Ian King [Wed, 15 Mar 2017 16:36:41 +0000 (16:36 +0000)]
ath10k: remove redundant check of len with buf_len

The check of len > buf_len is redundant as len is initialized
to 0 and buf_len to 4096, so this comparison is always false.
Remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix typo in wmi header file
Mohammed Shafi Shajakhan [Tue, 14 Mar 2017 11:33:24 +0000 (17:03 +0530)]
ath10k: fix typo in wmi header file

Fix typo (spelling mistake) in wmi.h

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix warnings from an earlier commit
Kalle Valo [Thu, 16 Mar 2017 09:11:02 +0000 (11:11 +0200)]
ath10k: fix warnings from an earlier commit

I failed to notice that commit 523f6701dbab ("ath10k: update available channel
list for 5G radio") added two new warnings:

drivers/net/wireless/ath/ath10k/mac.c:3129:6: warning: symbol 'ath10k_mac_update_channel_list' was not declared. Should it be static?
drivers/net/wireless/ath/ath10k/mac.c:3170: Alignment should match open parenthesis

Fix those.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix fetching channel during potential radar detection
Mohammed Shafi Shajakhan [Wed, 8 Mar 2017 12:33:32 +0000 (18:03 +0530)]
ath10k: fix fetching channel during potential radar detection

Fetch target operating channel during potential radar detection when
the interface is just brought up, but no channel is assigned from
userspace. In this scenario rx_channel may not be having a valid pointer
hence fetch the target operating channel to avoid warnings as below
which can be triggered by the commands with DFS testing over longer run

comamnds:
iw wlan1 set type mesh
ifconfig wlan1 up (valid tgt_oper_chan only)
iw wlan1 cac trigger freq 5260 HT20 (valid rx_channel, tgt_oper_chan)
iw wlan1 cac trigger freq 5280 HT20
iw wlan1 cac trigger freq 5300 HT20

Once the CAC expires, current channel context will be removed and
we are only left with the fallback option of using 'target operating
channel'

Firmware and driver log:
ath: phy1: DFS: radar found on freq=5300: id=1, pri=1125, count=5,
count_false=4
ath: phy1: DFS: radar found on freq=5260: id=5, pri=3151, count=6,
count_false=11
ath: phy1: DFS: radar found on freq=5280: id=1, pri=1351, count=6,
count_false=4
ath: phy1: DFS: radar found on freq=5300: id=1, pri=1125, count=5,
count_false=4
ath10k_pci 0001:01:00.0: failed to derive channel for radar pulse,
treating as radar
ath10k_pci 0001:01:00.0: failed to derive channel for radar pulse,
treating as radar

Call trace:

WARNING: CPU: 1 PID: 2145 at
backports-20161201-3.14.77-9ab3068/net/wireless/chan.c:265
cfg80211_set_dfs_state+0x3c/0x88 [cfg80211]()

 Workqueue: phy1 ieee80211_dfs_radar_detected_work
[mac80211]
[<c0320770>] (warn_slowpath_null) from [<bf79b90c>]
(cfg80211_set_dfs_state+0x3c/0x88 [cfg80211])
[<bf79b90c>] (cfg80211_set_dfs_state [cfg80211]) from
[<bf79697c>] (cfg80211_radar_event+0xc4/0x140 [cfg80211])
[<bf79697c>] (cfg80211_radar_event [cfg80211]) from
[<bf83c058>] (ieee80211_dfs_radar_detected_work+0xa8/0xb4 [mac80211])
[<bf83c058>] (ieee80211_dfs_radar_detected_work
[mac80211]) from [<c0339518>] (process_one_work+0x298/0x4a4)

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: remove redundant error check
Colin Ian King [Tue, 28 Feb 2017 11:14:39 +0000 (11:14 +0000)]
ath10k: remove redundant error check

The check on ret for an error is redundant because it is already been
checked for non-zero earlier on and ret is never non-zero at this point.
Fix this by removing the redundant check and error message.

Detected by CoverityScan, CID#1357170 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k: don't trigger spectral scan when not enabled
Zefir Kurtisi [Mon, 27 Feb 2017 14:49:36 +0000 (15:49 +0100)]
ath9k: don't trigger spectral scan when not enabled

Doing so enables the FFT generation without prior
configuration, leading to an IRQ storm caused by
invalid (or at least unwanted) PHY errors.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: update available channel list for 5G radio
Tamizh chelvam [Thu, 23 Feb 2017 13:18:22 +0000 (18:48 +0530)]
ath10k: update available channel list for 5G radio

If a 5 GHz radio is calibrated for operation in both
the low band (channels 36 to 64) and high band(channels 100 to 169),
hardware allows operations in all the listed channels. However,
if the chip has been calibrated only for the low/high band and
a high/low band channel is configured, due to lack of calibration
there will be potentially invalid signal on those non calibrated channels.
To avoid this problem this patch sets IEEE80211_CHAN_DISABLED flag for
those non calibrated channels by using low_5ghz_chan and high_5ghz_chan
values which we get from target through wmi service ready event.

Driver initialized flags are getting re initialized in handle_channel
in cfg80211. So calling the function to disable the non supported channel
from reg_notifier().

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: disallow DFS simulation if DFS channel is not enabled
Mohammed Shafi Shajakhan [Wed, 22 Feb 2017 15:33:11 +0000 (21:03 +0530)]
ath10k: disallow DFS simulation if DFS channel is not enabled

If DFS is not enabled in hostapd (ieee80211h=0) DFS channels shall
not be available for use even though the hardware may have the capability
to support DFS. With this configuration (DFS disabled in hostapd) trying to
bring up ath10k device in DFS channel for AP mode fails and trying to
simulate DFS in ath10k debugfs results in a warning in cfg80211 complaining
invalid channel and this should be avoided in the driver itself rather than
false propogating RADAR detection to mac80211/cfg80211. Fix this by
checking for the first vif 'is_started' state(should work for client mode
as well) as all the vifs shall be configured for the same channel

sys/kernel/debug/ieee80211/phy1/ath10k# echo 1 > dfs_simulate_radar

WARNING: at net/wireless/chan.c:265 cfg80211_radar_event+0x24/0x60
Workqueue: phy0 ieee80211_dfs_radar_detected_work [mac80211]
[<c022f2d4>] (warn_slowpath_null) from
[<bf72dab8>] (cfg80211_radar_event+0x24/0x60 [cfg80211])
[<bf72dab8>] (cfg80211_radar_event [cfg80211]) from
[<bf7813e0>] (ieee80211_dfs_radar_detected_work+0x94/0xa0 [mac80211])
[<bf7813e0>] (ieee80211_dfs_radar_detected_work [mac80211]) from
[<c0242320>] (process_one_work+0x20c/0x32c)

WARNING: at net/wireless/nl80211.c:2488 nl80211_get_mpath+0x13c/0x4cc
 Workqueue: phy0 ieee80211_dfs_radar_detected_work [mac80211]
[<c022f2d4>] (warn_slowpath_null) from
[<bf72dab8>] (cfg80211_radar_event+0x24/0x60 [cfg80211])
[<bf72dab8>] (cfg80211_radar_event [cfg80211]) from
[<bf7813e0>] (ieee80211_dfs_radar_detected_work+0x94/0xa0 [mac80211])
[<bf7813e0>] (ieee80211_dfs_radar_detected_work [mac80211]) from
[<c0242320>] (process_one_work+0x20c/0x32c)

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: add oob_mode for AP certification
Lior David [Wed, 8 Mar 2017 11:52:19 +0000 (13:52 +0200)]
wil6210: add oob_mode for AP certification

Add a new value to the oob_mode module parameter for
supporting AP certification.
All enabled values of oob_mode (>0) are intended only
for debugging and diagnostics.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: correctly report locally generated disconnect in STA mode
Dedy Lansky [Wed, 8 Mar 2017 11:52:18 +0000 (13:52 +0200)]
wil6210: correctly report locally generated disconnect in STA mode

Driver always invoke cfg80211_disconnected() with locally_generated as
false.
Fix this by reporting true whenever the disconnect is triggered from
upper layers (cfg80211) or from within the driver itself (reset,
deinit).

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: use WMI_DISCONNECT_CMDID upon connect timeout
Dedy Lansky [Wed, 8 Mar 2017 11:52:17 +0000 (13:52 +0200)]
wil6210: use WMI_DISCONNECT_CMDID upon connect timeout

Upon connect timeout driver invokes _wil6210_disconnect() which iterates
over sta array and disconnects each connected sta. In practice, because
the connection is still ongoing and because cid is not yet allocated,
disconnect is not actually happening. This leaves FW in connecting
state while driver is in disconnected state.
To fix this, upon connect timeout, explicitly send WMI_DISCONNECT_CMDID
to FW to make sure it gets disconnected.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: protect list of pending wmi events during flush
Hamad Kadmany [Wed, 8 Mar 2017 11:52:16 +0000 (13:52 +0200)]
wil6210: protect list of pending wmi events during flush

When flush is done, pending events list is manipulated
without taking the proper spinlock, which could lead to
memory corruption if list is manipulated by wmi worker
or by interrupt routine.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: store bss object and use cfg80211_connect_bss()
Dedy Lansky [Wed, 8 Mar 2017 11:52:15 +0000 (13:52 +0200)]
wil6210: store bss object and use cfg80211_connect_bss()

In a fast disconnect/connect sequence, cfg80211_connect_result() can
fail to find the bss object which the driver is connecting to. Detailed
sequence of events:
* Driver is connected in STA mode
* Disconnect request arrives from user space. Driver disconnects and
  calls cfg80211_disconnected() which adds new event to the
  cfg80211_wq worker thread
* Connect request arrives from user space. cfg80211_connect() stores
  ssid/ssid_len and calls rdev_connect()
* __cfg80211_disconnected() runs in worker thread and zero
  wdev->ssid_len
* Connect succeeds. Driver calls cfg80211_connect_result() which fails
  to find the bss because wdev->ssid_len is zero

To overcome this, upon connect request, store the bss object in the
driver and upon connect completion pass it to kernel using
cfg80211_connect_bss().

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: missing reinit_completion in HALP voting
Maya Erez [Wed, 8 Mar 2017 11:52:14 +0000 (13:52 +0200)]
wil6210: missing reinit_completion in HALP voting

After setting HALP ICR bit, we keep it set until HALP unvote.
Masking HALP ICR should protect the driver from hitting the HALP ICR
over and over again. However, in case there is another MISC ICR
we will read the HALP ICR and issue a completion. This can lead to
a case where HALP voting is completed immediately, as the completion
is already set.
Reinit the HALP completion before the actual vote will clear previous
completions and protect from such cases.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: use print_hex_dump_debug instead of print_hex_dump_bytes
Dedy Lansky [Wed, 8 Mar 2017 11:52:13 +0000 (13:52 +0200)]
wil6210: use print_hex_dump_debug instead of print_hex_dump_bytes

Some dynamic debug printouts in driver are using print_hex_dump_bytes.
However, with dynamic debug disabled, print_hex_dump_bytes outputs to
log unconditionally.
Use print_hex_dump_debug instead to prevent log pollution when dynamic
debug disabled.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: bus_request platform operation refinement
Lior David [Wed, 8 Mar 2017 11:52:12 +0000 (13:52 +0200)]
wil6210: bus_request platform operation refinement

The driver uses the bus_request platform operation to
request resources from the platform for a specific bandwidth.
Currently the driver requests resources for the maximum
theoretical bandwidth, when interface is brought up.
Refine this process a bit: now the driver will request a
small amount of resources when interface is up, and will only
issue the maximum request when connected.
This mechanism will be improved further in the future to make
more refined requests based on actual bandwidth.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: do not start regular scan on stopped p2p device
Lior David [Wed, 8 Mar 2017 11:52:11 +0000 (13:52 +0200)]
wil6210: do not start regular scan on stopped p2p device

The driver should not allow starting any type of scan on a stopped
P2P device. Current implementation only checked social scan.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowil6210: set dma mask to reflect device capability
Hamad Kadmany [Wed, 8 Mar 2017 11:52:10 +0000 (13:52 +0200)]
wil6210: set dma mask to reflect device capability

device supports 48bit addresses, reflect that by
setting the dma mask accordingly.

Signed-off-by: Hamad Kadmany <qca_hkadmany@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agowcn36xx: Fix error handling
Christophe Jaillet [Wed, 8 Mar 2017 11:52:09 +0000 (13:52 +0200)]
wcn36xx: Fix error handling

Reorder 'out_free_dxe_pool' and 'out_free_dxe_ctl' error handling labels
in order to match the way resources have been allocated.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: fix a warning during channel switch with multiple vaps
Mohammed Shafi Shajakhan [Wed, 8 Mar 2017 11:52:06 +0000 (13:52 +0200)]
ath10k: fix a warning during channel switch with multiple vaps

Doing a channel switch via hostapd_cli seems to update
the new channel context for each VAP's appropriately as below
in 'ath10k_mac_update_vif_chan', hence we can safely suppress the
warning that shows up during this operation and dump the warning only
if no vaps are available for channel switch

hostapd_cli -i wlan0 chan_switch 5 5200
OK

ath10k_pci : mac chanctx switch n_vifs 3 mode 1
ath10k_pci : mac chanctx switch vdev_id 2 freq 5180->5200 width 0->0
ath10k_pci : mac chanctx switch vdev_id 1 freq 5180->5200 width 0->0
ath10k_pci : mac chanctx switch vdev_id 0 freq 5180->5200 width 0->0

Call Trace:

WARNING: backports-20161201-3.14.77-9ab3068/drivers/net/wireless/ath/ath10k/mac.c:7126
[<c022f2d4>] (warn_slowpath_null) from [<bf7f150c>]
(ath10k_reconfig_complete+0xe4/0x25c [ath10k_core])
[<bf7f150c>] (ath10k_reconfig_complete [ath10k_core])
[<bf7f35f0>] (ath10k_mac_vif_ap_csa_work+0x214/0x370 [ath10k_core])
[<bf7f38b8>] (ath10k_mac_op_change_chanctx+0x108/0x128 [ath10k_core])
[<bf782ac0>] (ieee80211_recalc_chanctx_min_def+0x30c/0x430 [mac80211])
[<bf7830a4>] (ieee80211_recalc_smps_chanctx+0x2ec/0x840 [mac80211])
[<bf7843e8>] (ieee80211_vif_use_reserved_context+0x7c/0xf8 [mac80211])
[<bf7843e8>] (ieee80211_vif_use_reserved_context [mac80211])
[<bf76e5d4>] (ieee80211_csa_finalize_work+0x5c/0x88 [mac80211])

Fixes: d7bf4b4aba05 ("ath10k: fix ar->rx_channel updating logic")
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath9k_htc: Add support of AirTies 1eda:2315 AR9271 device
Dmitry Tunin [Wed, 8 Mar 2017 11:52:07 +0000 (13:52 +0200)]
ath9k_htc: Add support of AirTies 1eda:2315 AR9271 device

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#=  7 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs=  1
P:  Vendor=1eda ProdID=2315 Rev=01.08
S:  Manufacturer=ATHEROS
S:  Product=USB2.0 WLAN
S:  SerialNumber=12345
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 6 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: improve the firmware download time for QCA9377
Ryan Hsu [Wed, 8 Mar 2017 11:52:05 +0000 (13:52 +0200)]
ath10k: improve the firmware download time for QCA9377

QCA9377 is the family of QCA61x4 which shared the same procedure
to enable the hardware clock that could improve the firmware download time.

Signed-off-by: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agoath10k: improve the firmware download time for QCA6174
Ryan Hsu [Wed, 8 Mar 2017 11:52:04 +0000 (13:52 +0200)]
ath10k: improve the firmware download time for QCA6174

Len Brown reported the system resume time is taking more than 2 seconds in
bug - https://bugzilla.kernel.org/show_bug.cgi?id=185621.

The reason of the 2 seconds is due to the firmware download time.

The chip is booted up in the default reference clock speed to handle the
firmware download to chip memory and advanced to the support higher speed
clock to run the firmware after all. The default reference clock in the
hardware is slow so that the firmware download time is taking up to 2
seconds for a 600KB firmware file.

[76796.349701] ath10k_pci : boot uploading firmware image len 688691
[76798.334612] ath10k_pci : htt tx max num pending tx 1056

The resolution here is to enable the higher speed clock if the hardware
supported before the firmware download at BMI stage, so that the hardware
can handle the firmare download in a more efficient way. This can help to
improve the firmware download time from 2 seconds to around 500ms for the
same 600KB firmware file.

[322858.577919] ath10k_pci boot uploading firmware image len 688691
[322859.093094] ath10k_pci htt tx max num pending tx 1056

The steps to advance to the higher speed clock is very hardware specific,
so adding the hardware ops for the hardware that can support this.

Reported-by: Len Brown <lenb@kernel.org>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
7 years agortlwifi: fix spelling mistake: "conuntry" -> "country"
Colin Ian King [Wed, 22 Feb 2017 23:35:52 +0000 (23:35 +0000)]
rtlwifi: fix spelling mistake: "conuntry" -> "country"

trivial fix to spelling mistake in RT_TRACE message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agortl8187: Enable monitor mode to fix multicast reception
Nils Holland [Sun, 19 Feb 2017 23:59:28 +0000 (00:59 +0100)]
rtl8187: Enable monitor mode to fix multicast reception

The rtl8187 cards don't seem to receive multicast frames, which,
among other things, makes them fail to receive RAs in IPv6 networks.
The cause seems to be that the RTL818X_RX_CONF_MULTICAST flag doesn't
have the desired effect.

Fix the issue by setting RTL818X_RX_CONF_MONITOR instead, which puts the
card into monitor mode and resolves the problem so that multicast frames
are sucessfully passed to the kernel.

The existence of the problem and the effectiveness of the solution has
originally been confirmed on an 8187B based card with the USB id of
0bda:8197. Subsequent testing by Larry Finger on an 8187L based card,
which follows the second (8187, i.e. "non-b") code path in the driver,
has confirmed that the fix does not cause any noticeable regresssions
there either.

Signed-off-by: Nils Holland <nholland@tisys.org>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: fix rt2x00debug_dump_frame comment
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:13 +0000 (10:25 +0100)]
rt2x00: fix rt2x00debug_dump_frame comment

Reported-by: Jeroen Roovers <jer@airfi.aero>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: use TXOP_BACKOFF for probe frames
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:12 +0000 (10:25 +0100)]
rt2800: use TXOP_BACKOFF for probe frames

Even if we do not set AMPDU bit in TXWI, device still can aggregate
frame and send it with rate not corresponding to requested. That mean
we can do not sent probe frames with requested rate. To prevent that
use TXOP_BACKOFF for probe frames.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: status based rate flags for nomatch case
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:11 +0000 (10:25 +0100)]
rt2800: status based rate flags for nomatch case

We use skb_desc->tx_rate_flags from entry as rate[].flags even if
skb does not match status. Patch corrects flags and also fixes
mcs for legacy rates.

rt2800_rate_from_status() is based on Felix's mt76
mt76x2_mac_process_tx_rate() function.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: use txdone_nomatch on rt2800usb
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:10 +0000 (10:25 +0100)]
rt2x00: use txdone_nomatch on rt2800usb

If we do not match skb entry, provide tx status via nomatch procedure.

Currently in that case we do rt2x00lib_txdone_noinfo(TXDONE_NOINFO),
which actually assume that entry->skb was posted without retries and
provide rate saved in skb desc as successful. Patch changed that to
rate read from TX_STAT_FIFO, however still do not provide correct
number of retries.

On SoC/PCI devices we keep providing status via standard txdone
procedure, no change in those devices, though we should thing about it.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: fixup fill_tx_status for nomatch case
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:09 +0000 (10:25 +0100)]
rt2x00: fixup fill_tx_status for nomatch case

Add bits rt2x00lib_fill_tx_status() when filling status in nomatch
case and hopefully do not break the function for existing cases.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: add txdone nomatch function
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:08 +0000 (10:25 +0100)]
rt2x00: add txdone nomatch function

This txdone nomatch function will be used when we get status from the HW,
but we could not match it with any sent skb.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: separte clearing entry from rt2x00lib_txdone
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:07 +0000 (10:25 +0100)]
rt2x00: separte clearing entry from rt2x00lib_txdone

This makes rt2x00lib_txdone a bit simpler and will allow to reuse
code in different variant of txdone which I'm preparing.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: separte filling tx status from rt2x00lib_txdone
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:06 +0000 (10:25 +0100)]
rt2x00: separte filling tx status from rt2x00lib_txdone

This makes rt2x00lib_txdone a bit simpler and will allow to reuse code
in different variant of txdone which I'm preparing.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2800: identify station based on status WCID
Stanislaw Gruszka [Wed, 15 Feb 2017 09:25:05 +0000 (10:25 +0100)]
rt2800: identify station based on status WCID

Add framework to identify sta based on tx status WCID. This is currently
not used, will start be utilized in the future patch.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agort2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h
Gabor Juhos [Wed, 15 Feb 2017 09:25:04 +0000 (10:25 +0100)]
rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h

The rt2800_drv_data structure contains driver specific
information. Move the declaration into the rt2800lib.h
header which is a more logical place for it. Also fix
the comment style to avoid checkpatch warning.

The patch contains no functional changes, it is in
preparation for the next patch.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agobcma: gpio: set of_node regardless of the host type
Rafał Miłecki [Tue, 14 Feb 2017 22:03:46 +0000 (23:03 +0100)]
bcma: gpio: set of_node regardless of the host type

DT allows describing many device types, not only platform ones. If e.g.
bcma is hosted on PCI(e) and it has its of_node, let's pass it to the
GPIO subsystem. This allows GPIO code to handle more hardware details
not only for bcma on a SoC.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
7 years agodecnet: Use TCP nagle macro instead of literal number in decnet
Gao Feng [Sat, 4 Mar 2017 14:10:28 +0000 (22:10 +0800)]
decnet: Use TCP nagle macro instead of literal number in decnet

Use existing TCP nagle macro TCP_NAGLE_OFF and TCP_NAGLE_CORK instead
of the literal number 1 and 2 in the current decnet codes.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: qcom/emac: optimize QDF2400 SGMII RX/TX impedence values
Timur Tabi [Tue, 28 Feb 2017 23:16:02 +0000 (17:16 -0600)]
net: qcom/emac: optimize QDF2400 SGMII RX/TX impedence values

Adjust the impedance values of the RX and TX lanes in the SGMII block
so that they are closer to optimal values.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'bgmac-cleanups-PM-support'
David S. Miller [Tue, 7 Mar 2017 01:17:48 +0000 (17:17 -0800)]
Merge branch 'bgmac-cleanups-PM-support'

Jon Mason says:

====================
net: ethernet: bgmac: PM support and clean-ups

Changes in v3:
* Corrected a bug Florian found and added his Reviewed-by

Changes in v2:
* Reworked the PM patch with Florian's suggestions

Add code to support Power Management (only tested on NS2), and add some
code clean-ups
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: bgmac: driver power manangement
Joey Zhong [Tue, 28 Feb 2017 18:51:01 +0000 (13:51 -0500)]
net: ethernet: bgmac: driver power manangement

Implement suspend/resume callbacks in the bgmac driver. This makes sure
that we de-initialize and re-initialize the hardware correctly before
entering suspend and when resuming.

Signed-off-by: Joey Zhong <zhongx@broadcom.com>
Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: bgmac: unify code of the same family
Jon Mason [Tue, 28 Feb 2017 18:51:00 +0000 (13:51 -0500)]
net: ethernet: bgmac: unify code of the same family

BCM471X and BCM535X are of the same family (from what I can derive from
internal documents).  Group them into the case statement together, which
results in more code reuse.

Also, use existing helper variables to make the code a little more
readable too.

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: ethernet: bgmac: use #defines for MAX size
Jon Mason [Tue, 28 Feb 2017 18:50:59 +0000 (13:50 -0500)]
net: ethernet: bgmac: use #defines for MAX size

The maximum frame size is really just the standard ethernet frame size
and FCS.  So use those existing defines to make the code a little more
beautiful.

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: axienet: use eth_hw_addr_random()
Tobias Klauser [Tue, 28 Feb 2017 11:21:12 +0000 (12:21 +0100)]
net: axienet: use eth_hw_addr_random()

Use eth_hw_addr_random() to set a random MAC address in order to make
sure ndev->addr_assign_type will be properly set to NET_ADDR_RANDOM.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoMerge branch 'netvsc-NAPI'
David S. Miller [Tue, 7 Mar 2017 01:13:14 +0000 (17:13 -0800)]
Merge branch 'netvsc-NAPI'

Stephen Hemminger says:

====================
NAPI support for Hyper-V

These patches enable NAPI, GRO and napi_alloc_skb for Hyper-V netvsc
driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: replace netdev_alloc_skb_ip_align with napi_alloc_skb
stephen hemminger [Mon, 27 Feb 2017 18:26:51 +0000 (10:26 -0800)]
netvsc: replace netdev_alloc_skb_ip_align with napi_alloc_skb

Gives potential performance gain.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: enable GRO
stephen hemminger [Mon, 27 Feb 2017 18:26:50 +0000 (10:26 -0800)]
netvsc: enable GRO

Use GRO when receiving packets.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: implement NAPI
stephen hemminger [Mon, 27 Feb 2017 18:26:49 +0000 (10:26 -0800)]
netvsc: implement NAPI

Use NAPI (softirq), to handle receive packets and send completions.
Previously this was handled by tasklet.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agovmbus: introduce in-place packet iterator
stephen hemminger [Mon, 27 Feb 2017 18:26:48 +0000 (10:26 -0800)]
vmbus: introduce in-place packet iterator

This is mostly just a refactoring of previous functions
(get_pkt_next_raw, put_pkt_raw and commit_rd_index) to make it easier
to use for other drivers and NAPI.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonetvsc: don't overload variable in same function
stephen hemminger [Mon, 27 Feb 2017 18:26:47 +0000 (10:26 -0800)]
netvsc: don't overload variable in same function

There are two variables named packet in the same function. One is the
metadata descriptor from host (vmpacket_descriptor) and the other is
the control block in the skb used to hold metadata from send.
Change name to avoid possible confusion and bugs.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agotools: hv: Add clean up function for Ubuntu config
Haiyang Zhang [Fri, 24 Feb 2017 17:30:32 +0000 (17:30 +0000)]
tools: hv: Add clean up function for Ubuntu config

This patch adds a function to clean up duplicate config info
on Ubuntu.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agoipv6: Provide ipv6 version of "disable_policy" sysctl
David Forster [Thu, 23 Feb 2017 16:27:18 +0000 (16:27 +0000)]
ipv6: Provide ipv6 version of "disable_policy" sysctl

This provides equivalent functionality to the existing ipv4
"disable_policy" systcl. ie. Allows IPsec processing to be skipped
on terminating packets on a per-interface basis.

Signed-off-by: David Forster <dforster@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: smsc: smc91c92_cs: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Fri, 3 Mar 2017 22:39:35 +0000 (23:39 +0100)]
net: smsc: smc91c92_cs: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: smsc: epic100: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Mon, 27 Feb 2017 22:43:14 +0000 (23:43 +0100)]
net: smsc: epic100: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: sis: sis900: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Mon, 27 Feb 2017 22:17:37 +0000 (23:17 +0100)]
net: sis: sis900: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: sis: sis190: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Mon, 27 Feb 2017 22:06:41 +0000 (23:06 +0100)]
net: sis: sis190: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: silan: sc92031: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Mon, 27 Feb 2017 21:50:25 +0000 (22:50 +0100)]
net: silan: sc92031: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: sgi: ioc3-eth: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Sun, 26 Feb 2017 21:48:59 +0000 (22:48 +0100)]
net: sgi: ioc3-eth: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: rocker: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Sun, 26 Feb 2017 18:00:29 +0000 (19:00 +0100)]
net: rocker: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: realtek: r8169: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Thu, 23 Feb 2017 21:34:43 +0000 (22:34 +0100)]
net: realtek: r8169: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: realtek: 8139too: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Wed, 22 Feb 2017 23:14:08 +0000 (00:14 +0100)]
net: realtek: 8139too: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: realtek: 8139cp: use new api ethtool_{get|set}_link_ksettings
Philippe Reynes [Wed, 22 Feb 2017 07:50:27 +0000 (08:50 +0100)]
net: realtek: 8139cp: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agonet: phy: Do not perform software reset for Generic PHY
Florian Fainelli [Sun, 5 Mar 2017 20:34:49 +0000 (12:34 -0800)]
net: phy: Do not perform software reset for Generic PHY

The Generic PHY driver is a catch-all PHY driver and it should preserve
whatever prior initialization has been done by boot loader or firmware
agents. For specific PHY device configuration it is expected that a
specialized PHY driver would take over that role.

Resetting the generic PHY was a bad idea that has lead to several
complaints and downstream workarounds e.g: in OpenWrt/LEDE so restore
the behavior prior to 87aa9f9c61ad ("net: phy: consolidate PHY
reset in phy_init_hw()").

Reported-by: Felix Fietkau <nbd@nbd.name>
Fixes: 87aa9f9c61ad ("net: phy: consolidate PHY reset in phy_init_hw()")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7 years agobpf: add get_next_key callback to LPM map
Alexei Starovoitov [Sun, 5 Mar 2017 17:41:08 +0000 (09:41 -0800)]
bpf: add get_next_key callback to LPM map

map_get_next_key callback is mandatory. Supply dummy handler.

Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>