cascardo/linux.git
8 years agowcn36xx: split DMA mask register writing.
Fengwei Yin [Sun, 20 Dec 2015 13:20:41 +0000 (21:20 +0800)]
wcn36xx: split DMA mask register writing.

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

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

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

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

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

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

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

There is a type bug so it always returns success.

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

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

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

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

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

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

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

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

Proper solution is to drop packets pending in reorder buffer.

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

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

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

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

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: fix a warning message condition
Dan Carpenter [Wed, 16 Dec 2015 11:10:00 +0000 (14:10 +0300)]
wil6210: fix a warning message condition

"iter" is -1 at the end of the loop and not zero.  It means we don't
print a warning message.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k_htc: fix handling return value of ath9k_hw_calibrate
Andrzej Hajda [Mon, 14 Dec 2015 10:06:01 +0000 (11:06 +0100)]
ath9k_htc: fix handling return value of ath9k_hw_calibrate

The function can return negative values in case of error.
Its result should be then tested for such case.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: reduce indentation by moving powersave check within function
Rajkumar Manoharan [Wed, 16 Dec 2015 14:52:19 +0000 (16:52 +0200)]
ath10k: reduce indentation by moving powersave check within function

For devices that does not support PCI power save, force wake up
API is used. So move powersave check inside force wakeup to reduce
one level indentation.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: wake up device before accessing registers
Rajkumar Manoharan [Wed, 16 Dec 2015 14:52:19 +0000 (16:52 +0200)]
ath10k: wake up device before accessing registers

commit 1aaf8efba0ae ("ath10k: disable PCI PS for QCA988X
and QCA99X0") partially reverts pci soc powersave support added by
commit 77258d409ce4 ("ath10k: enable pci soc powersaving"). While
reverting the change, pci wake up function is called after accessing
pci registers instead of prior to access. The assumption is that chip
is woken up before accessing its registers.Though this change does not
fix any known issues, this might help to avoid unknown or low power
platform specific issues.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agossb: pick SoC invariants code from MIPS BCM47xx arch
Rafał Miłecki [Wed, 9 Dec 2015 22:36:51 +0000 (23:36 +0100)]
ssb: pick SoC invariants code from MIPS BCM47xx arch

There is code in ssb fetching "invariants" that is basically a set of
board specific data. Every host requires its own implementation of
reading function. In ssb we have support for PCI, PCMCIA & SDIO.
For some (historical?) reason code reading "invariants" for SoC was
placed in arch code and provided by a callback. This is not needed
nowadays, so lets move that into ssb. This way we keep all "invariants"
functions in a single module making code cleaner.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge ath-next from ath.git
Kalle Valo [Wed, 16 Dec 2015 14:28:20 +0000 (16:28 +0200)]
Merge ath-next from ath.git

Major changes:

ath9k

* add random number generator support (CONFIG_ATH9K_HWRNG)

8 years agoath10k: allow Mesh Point to install peer security key
Peter Oh [Thu, 3 Dec 2015 17:50:55 +0000 (09:50 -0800)]
ath10k: allow Mesh Point to install peer security key

Mesh Point requires peer security key install when running
in secured mode since it's a type of peer links, otherwise peer
link will be removed due to key install failure.

MFP feature set is required to run Mesh in secured mode and
QCA988X firmware, 10.2.4.70.14-2 and above, is the only one
supporting secured Mesh at this moment.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: fix inconsistent indenting on return statement
Colin Ian King [Tue, 8 Dec 2015 23:49:31 +0000 (23:49 +0000)]
ath9k: fix inconsistent indenting on return statement

minor change, indenting is one tab out.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: feeding entropy in kernel from ADC capture
Miaoqing Pan [Fri, 9 Oct 2015 09:06:45 +0000 (17:06 +0800)]
ath9k: feeding entropy in kernel from ADC capture

This patch is derived from
commit 6301566e0b2d ("ath9k: export HW random number generator"),

We evaluated the entropy of the ADC data on QCA9531, QCA9561, QCA955x,
and AR9340, and it has sufficient quality random data (at least 10 bits
and up to 22 bits of min-entropy for a 32-bit value). We conservatively
assume the min-entropy is 10 bits out of 32 bits. Thus, ATH9K_RNG_BUF_SIZE
is set to 320 (u32) i.e., 1.25 kilobytes of data is inserted to fill up
the pool as soon as the entropy counter becomes 896/4096 (set by random.c).
Since ADC was not designed to be a dedicated HW RNG, we do not want to bind
it to /dev/hwrng framework directly. This patch feeds the entropy directly
from the WiFi driver to the input pool. The ADC register output is only
used as a seed for the Linux entropy pool. No conditioning is needed,
since all the conditioning is performed by the pool itself.

Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: fix AR_RX_FILTER for ar9462/ar9565 when rx stopped
Miaoqing Pan [Thu, 20 Aug 2015 01:21:38 +0000 (09:21 +0800)]
ath9k: fix AR_RX_FILTER for ar9462/ar9565 when rx stopped

When rx stopped, AR_RX_FILTER should be cleared, but in
ath9k_hw_setrxfilter(), ATH9K_RX_FILTER_CONTROL_WRAPPER will always
be set for ar9462/ar9565.

Fix this by moving the code in ath9k_hw_setrxfilter() to
ath_calcrxfilter().

Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: add log messages for firmware failure cases.
Ben Greear [Mon, 30 Nov 2015 23:01:48 +0000 (15:01 -0800)]
ath6kl: add log messages for firmware failure cases.

This gives a user a chance to know why a firmware load
is failing.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: fix tx/rx antenna reporting for 2x2 devices
Ben Greear [Mon, 30 Nov 2015 23:01:47 +0000 (15:01 -0800)]
ath6kl: fix tx/rx antenna reporting for 2x2 devices

My previous patch incorrectly reported the antenna
for 2x2 devices. It should be a mask instead of
a numeric count. This patch fixes that.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowlcore/wl12xx: spi: fix oops on firmware load
Uri Mashiach [Thu, 10 Dec 2015 13:12:56 +0000 (15:12 +0200)]
wlcore/wl12xx: spi: fix oops on firmware load

The maximum chunks used by the function is
(SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE + 1).
The original commands array had space for
(SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) commands.
When the last chunk is used (len > 4 * WSPI_MAX_CHUNK_SIZE), the last
command is stored outside the bounds of the commands array.

Oops 5 (page fault) is generated during current wl1271 firmware load
attempt:

root@debian-armhf:~# ifconfig wlan0 up
[  294.312399] Unable to handle kernel paging request at virtual address
00203fc4
[  294.320173] pgd = de528000
[  294.323028] [00203fc4] *pgd=00000000
[  294.326916] Internal error: Oops: 5 [#1] SMP ARM
[  294.331789] Modules linked in: bnep rfcomm bluetooth ipv6 arc4 wl12xx
wlcore mac80211 musb_dsps cfg80211 musb_hdrc usbcore usb_common
wlcore_spi omap_rng rng_core musb_am335x omap_wdt cpufreq_dt thermal_sys
hwmon
[  294.351838] CPU: 0 PID: 1827 Comm: ifconfig Not tainted
4.2.0-00002-g3e9ad27-dirty #78
[  294.360154] Hardware name: Generic AM33XX (Flattened Device Tree)
[  294.366557] task: dc9d6d40 ti: de550000 task.ti: de550000
[  294.372236] PC is at __spi_validate+0xa8/0x2ac
[  294.376902] LR is at __spi_sync+0x78/0x210
[  294.381200] pc : [<c049c760>]    lr : [<c049ebe0>]    psr: 60000013
[  294.381200] sp : de551998  ip : de5519d8  fp : 00200000
[  294.393242] r10: de551c8c  r9 : de5519d8  r8 : de3a9000
[  294.398730] r7 : de3a9258  r6 : de3a9400  r5 : de551a48  r4 :
00203fbc
[  294.405577] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 :
de3a9000
[  294.412420] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment user
[  294.419918] Control: 10c5387d  Table: 9e528019  DAC: 00000015
[  294.425954] Process ifconfig (pid: 1827, stack limit = 0xde550218)
[  294.432437] Stack: (0xde551998 to 0xde552000)

...

[  294.883613] [<c049c760>] (__spi_validate) from [<c049ebe0>]
(__spi_sync+0x78/0x210)
[  294.891670] [<c049ebe0>] (__spi_sync) from [<bf036598>]
(wl12xx_spi_raw_write+0xfc/0x148 [wlcore_spi])
[  294.901661] [<bf036598>] (wl12xx_spi_raw_write [wlcore_spi]) from
[<bf21c694>] (wlcore_boot_upload_firmware+0x1ec/0x458 [wlcore])
[  294.914038] [<bf21c694>] (wlcore_boot_upload_firmware [wlcore]) from
[<bf24532c>] (wl12xx_boot+0xc10/0xfac [wl12xx])
[  294.925161] [<bf24532c>] (wl12xx_boot [wl12xx]) from [<bf20d5cc>]
(wl1271_op_add_interface+0x5b0/0x910 [wlcore])
[  294.936364] [<bf20d5cc>] (wl1271_op_add_interface [wlcore]) from
[<bf15c4ac>] (ieee80211_do_open+0x44c/0xf7c [mac80211])
[  294.947963] [<bf15c4ac>] (ieee80211_do_open [mac80211]) from
[<c0537978>] (__dev_open+0xa8/0x110)
[  294.957307] [<c0537978>] (__dev_open) from [<c0537bf8>]
(__dev_change_flags+0x88/0x148)
[  294.965713] [<c0537bf8>] (__dev_change_flags) from [<c0537cd0>]
(dev_change_flags+0x18/0x48)
[  294.974576] [<c0537cd0>] (dev_change_flags) from [<c05a55a0>]
(devinet_ioctl+0x6b4/0x7d0)
[  294.983191] [<c05a55a0>] (devinet_ioctl) from [<c0517040>]
(sock_ioctl+0x1e4/0x2bc)
[  294.991244] [<c0517040>] (sock_ioctl) from [<c017d378>]
(do_vfs_ioctl+0x420/0x6b0)
[  294.999208] [<c017d378>] (do_vfs_ioctl) from [<c017d674>]
(SyS_ioctl+0x6c/0x7c)
[  295.006880] [<c017d674>] (SyS_ioctl) from [<c000f4c0>]
(ret_fast_syscall+0x0/0x54)
[  295.014835] Code: e1550004 e2444034 0a00007d e5953018 (e5942008)
[  295.021544] ---[ end trace 66ed188198f4e24e ]---

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: stable@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Move scheduled scan related interface layer structs
Hante Meuleman [Thu, 10 Dec 2015 12:43:11 +0000 (13:43 +0100)]
brcmfmac: Move scheduled scan related interface layer structs

All interface layer related to scheduled scan are moved in
fwil_types.h

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Change error print in debug print
Hante Meuleman [Thu, 10 Dec 2015 12:43:10 +0000 (13:43 +0100)]
brcmfmac: Change error print in debug print

The pcie suspend and resume routines contain some error prints,
which should have been debug prints.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: add 43242 device id for LG dongle
Arend van Spriel [Thu, 10 Dec 2015 12:43:09 +0000 (13:43 +0100)]
brcmfmac: add 43242 device id for LG dongle

Got a hint on IRC that a 43242 dongle for LG smart TV's works with
brcmfmac:

> Hello - I recently got a LG AN-WF500 wireless dongle for LG's SmartTVs.
> From the information I gathered it uses a Broadcom chipset BCM43242.
> The device should have been supported by brcmfmac kernel driver if it used
> USB IDs 0a5c:bd1f.
> My device however identifies itself as "ID 043e:3101 LG Electronics USA, Inc.".
> I then tried adding the USB ID to the driver with
> "echo "043e 3101" > /sys/bus/usb/drivers/brcmfmac/new_id" and it just works.
> The kernel provides the following information.
> [15958.851291] usb 3-1.1.3: new high-speed USB device number 53 using ehci-pci
> [15958.946723] usb 3-1.1.3: New USB device found, idVendor=043e, idProduct=3101
> [15958.946728] usb 3-1.1.3: New USB device strings: Mfr=1, Product=4, SerialNumber=3
> [15958.946731] usb 3-1.1.3: Product: Composite Wireless Adapter
> [15958.946733] usb 3-1.1.3: Manufacturer: Broadcom
> [15958.946735] usb 3-1.1.3: SerialNumber: 28458

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: fix waitqueue_active without memory barrier in brcmfmac driver
Kosuke Tatsukawa [Thu, 10 Dec 2015 12:43:08 +0000 (13:43 +0100)]
brcmfmac: fix waitqueue_active without memory barrier in brcmfmac driver

brcmf_msgbuf_ioctl_resp_wake() seems to be missing a memory barrier
which might cause the waker to not notice the waiter and miss sending a
wake_up as in the following figure.

  brcmf_msgbuf_ioctl_resp_wake     brcmf_msgbuf_ioctl_resp_wait
------------------------------------------------------------------------
if (waitqueue_active(&msgbuf->ioctl_resp_wait))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
                       /* wait_event_timeout */
        /* __wait_event_timeout */
 /* ___wait_event */
 prepare_to_wait_event(&wq, &__wait,
   state);
 if (msgbuf->ctl_completed)
 ...
msgbuf->ctl_completed = true;
 schedule_timeout(__ret))
------------------------------------------------------------------------

There are three other place in drivers/net/wireless/brcm80211/brcmfmac/
which have similar code.  The attached patch removes the call to
waitqueue_active() leaving just wake_up() behind.  This fixes the
problem because the call to spin_lock_irqsave() in wake_up() will be an
ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Fix IBSS setup
Hante Meuleman [Thu, 10 Dec 2015 12:43:07 +0000 (13:43 +0100)]
brcmfmac: Fix IBSS setup

IBSS got broken over time. Disconnect events should not be given
for IBSS mode and connect events for IBSS need to have channel
information.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: no interface combination check for single interface
Arend van Spriel [Thu, 10 Dec 2015 12:43:06 +0000 (13:43 +0100)]
brcmfmac: no interface combination check for single interface

The interface combinations are intended for use-case in which the driver
handles multiple interface concurrently. This means that the combinations
do not need to be checked when there is only a single interface active.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Add support for PCIE 4350 revision 5 device
Hante Meuleman [Thu, 10 Dec 2015 12:43:05 +0000 (13:43 +0100)]
brcmfmac: Add support for PCIE 4350 revision 5 device

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Make TDLS a detectable feature
Hante Meuleman [Thu, 10 Dec 2015 12:43:04 +0000 (13:43 +0100)]
brcmfmac: Make TDLS a detectable feature

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Cleanup pmksa cache handling code
Hante Meuleman [Thu, 10 Dec 2015 12:43:03 +0000 (13:43 +0100)]
brcmfmac: Cleanup pmksa cache handling code

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Remove some redundant cfg80211 data
Hante Meuleman [Thu, 10 Dec 2015 12:43:02 +0000 (13:43 +0100)]
brcmfmac: Remove some redundant cfg80211 data

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Use local storage for ssid iovar
Hante Meuleman [Thu, 10 Dec 2015 12:43:01 +0000 (13:43 +0100)]
brcmfmac: Use local storage for ssid iovar

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Simplify scan timing configuration
Hante Meuleman [Thu, 10 Dec 2015 12:43:00 +0000 (13:43 +0100)]
brcmfmac: Simplify scan timing configuration

No need to pass timing configuration in local functions as they are
static anyway.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoiwlegacy: mark il_adjust_beacon_interval as noinline
Arnd Bergmann [Wed, 9 Dec 2015 16:42:41 +0000 (17:42 +0100)]
iwlegacy: mark il_adjust_beacon_interval as noinline

With the new optimized do_div() code, some versions of gcc
produce obviously incorrect code that leads to a link error
in iwlegacy/common.o:

drivers/built-in.o: In function `il_send_rxon_timing':
:(.text+0xa6b4d4): undefined reference to `____ilog2_NaN'
:(.text+0xa6b4f0): undefined reference to `__aeabi_uldivmod'

In a few thousand randconfig builds, I have seen this problem
a couple of times in this file, but never anywhere else in the
kernel, so we can try to work around this in the only file
that shows the behavior, by marking the il_adjust_beacon_interval
function as noinline, which convinces gcc to use the unoptimized
do_div() all the time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: fix memory leak for USB device
Peter Wu [Mon, 7 Dec 2015 00:07:31 +0000 (01:07 +0100)]
rtlwifi: fix memory leak for USB device

Free skb for received frames with a wrong checksum. This can happen
pretty rapidly, exhausting all memory.

This fixes a memleak (detected with kmemleak). Originally found while
using monitor mode, but it also appears during managed mode (once the
link is up).

Cc: stable@vger.kernel.org
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoprism54: fix compare_const_fl.cocci warnings
Julia Lawall [Mon, 7 Dec 2015 09:55:33 +0000 (10:55 +0100)]
prism54: fix compare_const_fl.cocci warnings

Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix semicolon.cocci warnings
Julia Lawall [Sun, 6 Dec 2015 21:56:21 +0000 (22:56 +0100)]
mwifiex: fix semicolon.cocci warnings

Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcm80211: fix compare_const_fl.cocci warnings
Julia Lawall [Sun, 6 Dec 2015 06:03:26 +0000 (07:03 +0100)]
brcm80211: fix compare_const_fl.cocci warnings

Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: correction in region code to country mapping
Amitkumar Karwar [Fri, 4 Dec 2015 14:13:07 +0000 (06:13 -0800)]
mwifiex: correction in region code to country mapping

EU is not a valid country in db.txt file. Hence regulatory_hint
returns failure if EEPROM provides region code as 0x30. Let's
use FR for 0x30.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: don't follow AP if country code received from EEPROM
Amitkumar Karwar [Fri, 4 Dec 2015 14:13:05 +0000 (06:13 -0800)]
mwifiex: don't follow AP if country code received from EEPROM

If device has already received country information from
EEPROM, we won't parse AP's country IE and download it to
firmware. We will also set regulatory flags to disable beacon
hints and ignore country IE.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: set regulatory info from EEPROM
Amitkumar Karwar [Fri, 4 Dec 2015 14:13:04 +0000 (06:13 -0800)]
mwifiex: set regulatory info from EEPROM

Driver gets country information from EEPROM during
initialization. We will call regulatory_hint to update
current regulatory domain.
As by default world regulatory domain is selected by
cfg80211, country '00' from EEPROM is ignored.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: handle start AP error paths correctly
Amitkumar Karwar [Fri, 4 Dec 2015 14:13:03 +0000 (06:13 -0800)]
mwifiex: handle start AP error paths correctly

It's been observed that even if firmware returns an error
for a configuration command, we go ahead and start AP.

This patch changes the command type from async to sync
so that threads waits for command response and return
failure start AP.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: parse adhoc start/join result
Amitkumar Karwar [Fri, 4 Dec 2015 14:13:02 +0000 (06:13 -0800)]
mwifiex: parse adhoc start/join result

Even if ADHOC start or join attempt is failed, these commands
are returned with success status by firmware. Actual connection
result is provided inside command response.

This patch parses the adhoc connection result and resets
connection state variables if connection is not successful.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoprism54: off by one BUG_ON() test
Dan Carpenter [Fri, 4 Dec 2015 13:19:49 +0000 (16:19 +0300)]
prism54: off by one BUG_ON() test

This code was supposed to trigger a BUG() if we truncate the output but
it's off by one so it allows one character to be truncated.  Really
drivers shouldn't call BUG_ON() and especially for something minor like
this so I've changed it to a WARN_ON().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agohostap: fix an error code in prism2_config()
Dan Carpenter [Fri, 4 Dec 2015 13:17:46 +0000 (16:17 +0300)]
hostap: fix an error code in prism2_config()

The current code returns success if prism2_init_local_data() fails, but
we want to return an error code.  Also we can remove the bogus
ret initializer because it is wrong and never used.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: remove an unneeded condition
Dan Carpenter [Fri, 4 Dec 2015 13:17:15 +0000 (16:17 +0300)]
mwifiex: remove an unneeded condition

We already know that "wep_key->key_length" is set so there is no need to
check again.  Also the last curly brace was indented too far.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoiwlegacy: cleanup end of il_send_add_sta()
Dan Carpenter [Fri, 4 Dec 2015 13:16:45 +0000 (16:16 +0300)]
iwlegacy: cleanup end of il_send_add_sta()

This code causes a static checker warning because we check for
"if (ret == 0)" but we have already had verified that was true.  Clean
it up a little.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agocw1200: remove some dead code
Dan Carpenter [Fri, 4 Dec 2015 13:15:23 +0000 (16:15 +0300)]
cw1200: remove some dead code

If the mode is NL80211_IFTYPE_UNSPECIFIED then we return success at the
start of the function so this condition is never true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: only lock and unlock fws if fws is not null
Colin Ian King [Wed, 2 Dec 2015 11:45:10 +0000 (11:45 +0000)]
brcmfmac: only lock and unlock fws if fws is not null

There is a null ptr check for fws to set bcmc_credit_check, however,
there a lock and unlock on fws should only performed if fwts is
also not null to also avoid a potential null pointer deference.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: split wl12xx/wl18xx sg parameters
Guy Mishol [Wed, 2 Dec 2015 08:28:22 +0000 (10:28 +0200)]
wlcore: split wl12xx/wl18xx sg parameters

Align to new wl18xx sg parameters.
This requires to split both wl12xx/wl18xx enumerators.

Signed-off-by: Guy Mishol <guym@ti.com>
Acked-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agochelsio: constify cmac_ops structures
Julia Lawall [Tue, 8 Dec 2015 20:42:09 +0000 (21:42 +0100)]
chelsio: constify cmac_ops structures

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

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobnx2x: remove rx_pkt/rx_calls
Eric Dumazet [Tue, 8 Dec 2015 18:28:30 +0000 (10:28 -0800)]
bnx2x: remove rx_pkt/rx_calls

These fields are updated but never read.
Remove the overhead.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobnx2x: avoid soft lockup in bnx2x_poll()
Eric Dumazet [Tue, 8 Dec 2015 13:54:40 +0000 (05:54 -0800)]
bnx2x: avoid soft lockup in bnx2x_poll()

Under heavy TX load, bnx2x_poll() can loop forever and trigger
soft lockup bugs.

A napi poll handler must yield after one TX completion round,
risk of livelock is too high otherwise.

Bug is very easy to trigger using a debug build, and udp flood, because
of added cpu cycles in TX completion, and we do not receive enough
packets to break the loop.

Reported-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ariel Elior <ariel.elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agorhashtable: Remove unnecessary wmb for future_tbl
Herbert Xu [Tue, 8 Dec 2015 09:09:04 +0000 (17:09 +0800)]
rhashtable: Remove unnecessary wmb for future_tbl

The patch 9497df88ab5567daa001829051c5f87161a81ff0 ("rhashtable:
Fix reader/rehash race") added a pair of barriers.  In fact the
wmb is superfluous because every subsequent write to the old or
new hash table uses rcu_assign_pointer, which itself carriers a
full barrier prior to the assignment.

Therefore we may remove the explicit wmb.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'cxgb4-update-kconfig-and-fixes'
David S. Miller [Wed, 9 Dec 2015 03:43:15 +0000 (22:43 -0500)]
Merge branch 'cxgb4-update-kconfig-and-fixes'

Hariprasad Shenai says:

====================
Update Kconfig and some fixes for cxgb4

This series update Kconfig to add description for Chelsio's next
generation T6 family of adapters, also fixes ethtool stats alignment
and prevents simultaneous execution of service_ofldq thread, deals with
queue wrap around and adds some fl counters for debugging purpose and
device ID for new T5 adapters.

This patch series has been created against net-next tree and includes
patches on cxgb4 driver.

We have included all the maintainers of respective drivers. Kindly review
the change and let us know in case of any review comments.

Thanks

V2: Declare 'service_ofldq_running' as bool in Patch 4/7 ("cxgb4: prevent
    simultaneous execution of service_ofldq()") based on review comment
    by David Miller
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Adds PCI device id for new T5 adapters
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:17 +0000 (10:09 +0530)]
cxgb4: Adds PCI device id for new T5 adapters

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Add FL DMA mapping error and low counter
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:16 +0000 (10:09 +0530)]
cxgb4: Add FL DMA mapping error and low counter

Add Free List DMA Mapping Errors to SGE Queue info for
Free Lists. Add Free List "Low" counter to count the number of times we
see the number of pointers that we _think_ the hardware sees in the
Free List below the Egress Threshold.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Deal with wrap-around of queue for Work request
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:15 +0000 (10:09 +0530)]
cxgb4: Deal with wrap-around of queue for Work request

The WR headers  may not fit within one descriptor.
So we need to deal with wrap-around here.

Based on original patch by Pranjal Joshi <pjoshi@chelsio.com>

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: prevent simultaneous execution of service_ofldq()
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:14 +0000 (10:09 +0530)]
cxgb4: prevent simultaneous execution of service_ofldq()

Change mutual exclusion mechanism to prevent multiple threads of
execution from running in service_ofldq() at the same time.  The old
mechanism used an implicit guard on the down-call path and none on the
restart path and wasn't working. This checking makes the mechanism
explicit and is much easier to understand as a result.

Based on original work by Casey Leedom <leedom@chelsio.com>

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Use ACCES_ONCE macro to read queue's consumer index
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:13 +0000 (10:09 +0530)]
cxgb4: Use ACCES_ONCE macro to read queue's consumer index

Use helper macro ACCESS_ONCE() to load from the SGE status page
to prevent the compiler loading multiple times.

Based on original work by Mike Werner <werner@chelsio.com>

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4/cxgb4vf: update Kconfig file to include T6 adapter
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:12 +0000 (10:09 +0530)]
cxgb4/cxgb4vf: update Kconfig file to include T6 adapter

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agocxgb4: Align rest of the ethtool get stats
Hariprasad Shenai [Tue, 8 Dec 2015 04:39:11 +0000 (10:09 +0530)]
cxgb4: Align rest of the ethtool get stats

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: hns: optimize XGE capability by reducing cpu usage
yankejian [Tue, 8 Dec 2015 03:02:31 +0000 (11:02 +0800)]
net: hns: optimize XGE capability by reducing cpu usage

here is the patch raising the performance of XGE by:
1)changes the way page management method for enet momery, and
2)reduces the count of rmb, and
3)adds Memory prefetching

Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosock, cgroup: add sock->sk_cgroup
Tejun Heo [Mon, 7 Dec 2015 22:38:53 +0000 (17:38 -0500)]
sock, cgroup: add sock->sk_cgroup

In cgroup v1, dealing with cgroup membership was difficult because the
number of membership associations was unbound.  As a result, cgroup v1
grew several controllers whose primary purpose is either tagging
membership or pull in configuration knobs from other subsystems so
that cgroup membership test can be avoided.

net_cls and net_prio controllers are examples of the latter.  They
allow configuring network-specific attributes from cgroup side so that
network subsystem can avoid testing cgroup membership; unfortunately,
these are not only cumbersome but also problematic.

Both net_cls and net_prio aren't properly hierarchical.  Both inherit
configuration from the parent on creation but there's no interaction
afterwards.  An ancestor doesn't restrict the behavior in its subtree
in anyway and configuration changes aren't propagated downwards.
Especially when combined with cgroup delegation, this is problematic
because delegatees can mess up whatever network configuration
implemented at the system level.  net_prio would allow the delegatees
to set whatever priority value regardless of CAP_NET_ADMIN and net_cls
the same for classid.

While it is possible to solve these issues from controller side by
implementing hierarchical allowable ranges in both controllers, it
would involve quite a bit of complexity in the controllers and further
obfuscate network configuration as it becomes even more difficult to
tell what's actually being configured looking from the network side.
While not much can be done for v1 at this point, as membership
handling is sane on cgroup v2, it'd be better to make cgroup matching
behave like other network matches and classifiers than introducing
further complications.

In preparation, this patch updates sock->sk_cgrp_data handling so that
it points to the v2 cgroup that sock was created in until either
net_prio or net_cls is used.  Once either of the two is used,
sock->sk_cgrp_data reverts to its previous role of carrying prioidx
and classid.  This is to avoid adding yet another cgroup related field
to struct sock.

As the mode switching can happen at most once per boot, the switching
mechanism is aimed at lowering hot path overhead.  It may leak a
finite, likely small, number of cgroup refs and report spurious
prioidx or classid on switching; however, dynamic updates of prioidx
and classid have always been racy and lossy - socks between creation
and fd installation are never updated, config changes don't update
existing sockets at all, and prioidx may index with dead and recycled
cgroup IDs.  Non-critical inaccuracies from small race windows won't
make any noticeable difference.

This patch doesn't make use of the pointer yet.  The following patch
will implement netfilter match for cgroup2 membership.

v2: Use sock_cgroup_data to avoid inflating struct sock w/ another
    cgroup specific field.

v3: Add comments explaining why sock_data_prioidx() and
    sock_data_classid() use different fallback values.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Daniel Wagner <daniel.wagner@bmw-carit.de>
CC: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: wrap sock->sk_cgrp_prioidx and ->sk_classid inside a struct
Tejun Heo [Mon, 7 Dec 2015 22:38:52 +0000 (17:38 -0500)]
net: wrap sock->sk_cgrp_prioidx and ->sk_classid inside a struct

Introduce sock->sk_cgrp_data which is a struct sock_cgroup_data.
->sk_cgroup_prioidx and ->sk_classid are moved into it.  The struct
and its accessors are defined in cgroup-defs.h.  This is to prepare
for overloading the fields with a cgroup pointer.

This patch mostly performs equivalent conversions but the followings
are noteworthy.

* Equality test before updating classid is removed from
  sock_update_classid().  This shouldn't make any noticeable
  difference and a similar test will be implemented on the helper side
  later.

* sock_update_netprioidx() now takes struct sock_cgroup_data and can
  be moved to netprio_cgroup.h without causing include dependency
  loop.  Moved.

* The dummy version of sock_update_netprioidx() converted to a static
  inline function while at it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonetprio_cgroup: limit the maximum css->id to USHRT_MAX
Tejun Heo [Mon, 7 Dec 2015 22:38:51 +0000 (17:38 -0500)]
netprio_cgroup: limit the maximum css->id to USHRT_MAX

netprio builds per-netdev contiguous priomap array which is indexed by
css->id.  The array is allocated using kzalloc() effectively limiting
the maximum ID supported to some thousand range.  This patch caps the
maximum supported css->id to USHRT_MAX which should be way above what
is actually useable.

This allows reducing sock->sk_cgrp_prioidx to u16 from u32.  The freed
up part will be used to overload the cgroup related fields.
sock->sk_cgrp_prioidx's position is swapped with sk_mark so that the
two cgroup related fields are adjacent.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Daniel Borkmann <daniel@iogearbox.net>
CC: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'for-4.5-ancestor-test' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Wed, 9 Dec 2015 03:01:38 +0000 (22:01 -0500)]
Merge branch 'for-4.5-ancestor-test' of git://git./linux/kernel/git/tj/cgroup

Preparatory changes for some new socket cgroup infrastructure
and netfilter targets.

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoRevert "Merge branch 'vsock-virtio'"
Stefan Hajnoczi [Wed, 9 Dec 2015 02:51:12 +0000 (10:51 +0800)]
Revert "Merge branch 'vsock-virtio'"

This reverts commit 0d76d6e8b2507983a2cae4c09880798079007421 and merge
commit c402293bd76fbc93e52ef8c0947ab81eea3ae019, reversing changes made
to c89359a42e2a49656451569c382eed63e781153c.

The virtio-vsock device specification is not finalized yet.  Michael
Tsirkin voiced concerned about merging this code when the hardware
interface (and possibly the userspace interface) could still change.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'sh_eth-optimize-mdio'
David S. Miller [Wed, 9 Dec 2015 02:55:06 +0000 (21:55 -0500)]
Merge branch 'sh_eth-optimize-mdio'

Sergei Shtylyov says:

====================
sh_eth: optimize MDIO code

Here's a set of 3 patches against DaveM's 'net-next.git' repo which
gets rid of ~35 LoCs in the MDIO bitbang methods.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosh_eth: get rid of bb_{set|clr|read}()
Sergei Shtylyov [Mon, 7 Dec 2015 21:41:43 +0000 (00:41 +0300)]
sh_eth: get rid of bb_{set|clr|read}()

After the MDIO bitbang code consolidation, there's no need anymore for
bb_{set|clr}() as well as bb_read() -- just expand them inline, thus
saving more LoCs...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosh_eth: factor out common code from MDIO bitbang methods
Sergei Shtylyov [Mon, 7 Dec 2015 21:40:57 +0000 (00:40 +0300)]
sh_eth: factor out common code from MDIO bitbang methods

sh_mm[cd]_ctrl()  and sh_set_mdio() all look mostly the same -- factor out
their common code and put it into sh_mdio_ctrl().

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agosh_eth: remove mask fields from 'struct bb_info'
Sergei Shtylyov [Mon, 7 Dec 2015 21:40:19 +0000 (00:40 +0300)]
sh_eth: remove mask fields from 'struct bb_info'

The MDIO control bits are always mapped to the same bits of the same register
(PIR), so there's no need to store their masks in the 'struct bb_info'...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agodrivers: net: xgene: constify xgene_mac_ops and xgene_port_ops structures
Julia Lawall [Tue, 8 Dec 2015 20:18:25 +0000 (21:18 +0100)]
drivers: net: xgene: constify xgene_mac_ops and xgene_port_ops structures

The xgene_mac_ops and xgene_port_ops structures are never modified, so
declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge tag 'wireless-drivers-next-for-davem-2015-12-07' of git://git.kernel.org/pub...
David S. Miller [Tue, 8 Dec 2015 17:39:15 +0000 (12:39 -0500)]
Merge tag 'wireless-drivers-next-for-davem-2015-12-07' of git://git./linux/kernel/git/kvalo/wireless-drivers-next

Kalle Vallo says:

====================
brcfmac

* support bcm4359 which can operate in two bands concurrently
* disable runtime pm for USB avoiding issues
* use generic pm callback in PCIe driver
* support wowlan wake indication reporting
* add beamforming support
* unified handling of firmware files

ath10k

* support Manegement Frame Protection (MFP)
* add thermal throttling support for 10.4 firmware
* add support for pktlog in QCA99X0
* add debugfs file to enable Bluetooth coexistence feature
* use firmware's native mesh interface type instead of raw mode

iwlwifi

* BT coex improvements
* D3 operation bugfixes
* rate control improvements
* firmware debugging infra improvements
* ground work for multi Rx
* various security fixes
====================

Conflicts:
drivers/net/wireless/ath/ath10k/pci.c

The conflict resolution at:

http://article.gmane.org/gmane.linux.kernel.next/37391

by Stephen Rothwell was used.

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: Fix inverted test in __skb_recv_datagram
Rainer Weikusat [Tue, 8 Dec 2015 14:47:56 +0000 (14:47 +0000)]
net: Fix inverted test in __skb_recv_datagram

As the kernel generally uses negated error numbers, *err needs to be
compared with -EAGAIN (d'oh).

Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Fixes: ea3793ee29d3 ("core: enable more fine-grained datagram reception control")
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoath9k: remove ath9k_mod_tsf64_tu
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:18 +0000 (09:37 +0100)]
ath9k: remove ath9k_mod_tsf64_tu

Remove ath9k_mod_tsf64_tu() function while we could
use div_u64_rem() function.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: MCC, print time elapsed between events
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:17 +0000 (09:37 +0100)]
ath9k: MCC, print time elapsed between events

This is useful for MCC debugging and bug fixing.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: MCC, add NOA also in case of an AP
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:15 +0000 (09:37 +0100)]
ath9k: MCC, add NOA also in case of an AP

In case of MCC and AP interface, add also NOA attr
that will inform stations about absence of an AP.
There is a chance that some stations will handle
this NOA attr correctly and will know exactly when
AP is present/absent.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: P2P_CLIENT, get/set NOA correctly
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:13 +0000 (09:37 +0100)]
ath9k: P2P_CLIENT, get/set NOA correctly

In case we get BSS_CHANGED_P2P_PS early, from
mac80211, we didn't set NOA timer correctly,
while p2p_ps_vif was NULL.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: MCC enable Opportunistic Power Save
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:12 +0000 (09:37 +0100)]
ath9k: MCC enable Opportunistic Power Save

When adding NOA attr enable Opportunistic Power Save.
Before we calculate ctwindow but didn't enable oppps.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: setup correct skb priority for nullfunc
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:11 +0000 (09:37 +0100)]
ath9k: setup correct skb priority for nullfunc

After queue nullfunc for MCC case, we hit WARN_ON
in xmit.c:2398 while skb priority wasn't set.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: use u32 when calculate tsf
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:10 +0000 (09:37 +0100)]
ath9k: use u32 when calculate tsf

Use u32 while ath9k_hw_gettsf32() and
ath9k_hw_gen_timer_start() require u32.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:09 +0000 (09:37 +0100)]
ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear

AP/GO will aprear after NOA, wait 1ms to be sure AP
could receive/answer this frames.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: queue null frames in case of MCC
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:08 +0000 (09:37 +0100)]
ath9k: queue null frames in case of MCC

While mac80211 using null frames when connection polling,
we should queue this frames while NOA could be there, and
AP, P2P_GO could be not present.

Without this patch, with no traffic we often saw disconnections
while we try to send nullfunc when AP/GO wasn't present.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: print real timer value
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:07 +0000 (09:37 +0100)]
ath9k: print real timer value

In case of low HZ before this patch we saw wrong
values in debug message. Print real timeout value.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: add debug messages to aggr/chanctx funcs
Janusz Dziedzic [Fri, 27 Nov 2015 08:37:06 +0000 (09:37 +0100)]
ath9k: add debug messages to aggr/chanctx funcs

Add/extend debug messages when chanctx used.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agowil6210: prevent external wmi commands during suspend flow
Maya Erez [Tue, 24 Nov 2015 07:30:15 +0000 (09:30 +0200)]
wil6210: prevent external wmi commands during suspend flow

In __wmi_send we check if fw is ready at the beginning of the function.
While we wait for the completion of the previous command, system suspend
can be invoked and reset the HW, causing __wmi_send to read from HW
registers while it is not ready.
Taking the wmi_mutex in the reset flow when setting the FW ready bit
to zero will prevent the above race condition.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath5k: fix RTS/CTS by using proper rate flags
Bob Copeland [Thu, 19 Nov 2015 15:04:48 +0000 (10:04 -0500)]
ath5k: fix RTS/CTS by using proper rate flags

The rates in the tx control rateset do not have the protection
flags applied, so RTS/CTS would never get enabled if requested.

Fix by using the rate flags in the rates returned by
ieee80211_get_tx_rates().

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath6kl: Don't print error message when recv is canceled
Steve deRosier [Wed, 18 Nov 2015 22:51:28 +0000 (14:51 -0800)]
ath6kl: Don't print error message when recv is canceled

An error message ath6kl_htc_rxmsg_pending_handler isn't appropate for when
the error is ECANCELED. This could be the result of a perfectly appropriate
RX cancel due to shutdown or suspend. This allows the right cleanup to
continue, but without an alarming error message in this particular case.

Signed-off-by: Steve deRosier <steve.derosier@lairdtech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath9k: Simplify and fix eeprom endianness swapping
Martin Blumenstingl [Sat, 31 Oct 2015 12:57:32 +0000 (13:57 +0100)]
ath9k: Simplify and fix eeprom endianness swapping

The three eeprom implementations had quite some duplicate code when it
came to endianness swapping.
Additionally there was a bug in eeprom_4k and eeprom_9287 which
prevented the endianness swapping from working correctly, because the
swapping code was guarded within an "if (!ath9k_hw_use_flash(ah))". In
eeprom_def this check did not exist, so it seems that eeprom_def was the
only implementation where endianness swapping worked.

This patch takes the duplicate code and moves it from eeprom_* to
eeprom.c. The new code is derived from eeprom_def, while taking into
account the specifics from the other implementations.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: do not use coherent memory for allocated device memory chunks
Felix Fietkau [Mon, 30 Nov 2015 18:32:01 +0000 (19:32 +0100)]
ath10k: do not use coherent memory for allocated device memory chunks

Coherent memory is more expensive to allocate (and constrained on some
architectures where it has to be pre-allocated). It is also completely
unnecessary, since the host has no reason to even access these allocated
memory spaces

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agoath10k: remove unnecessary amsdu/ampdu assignment in debugfs
Mohammed Shafi Shajakhan [Mon, 30 Nov 2015 16:59:39 +0000 (22:29 +0530)]
ath10k: remove unnecessary amsdu/ampdu assignment in debugfs

The default values of max_num_amsdu / max_num_amdpu is assigned a
default value as part of 'ath10k_core_init_firmware_features'

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
8 years agocxgb3: Convert simple_strtoul to kstrtox
LABBE Corentin [Mon, 7 Dec 2015 13:11:33 +0000 (14:11 +0100)]
cxgb3: Convert simple_strtoul to kstrtox

the simple_strtoul function is obsolete. This patch replace it by
kstrtox.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'more-dsa-unbinding-fixes'
David S. Miller [Mon, 7 Dec 2015 21:35:51 +0000 (16:35 -0500)]
Merge branch 'more-dsa-unbinding-fixes'

Neil Armstrong says:

====================
Further fix for dsa unbinding

This series fixes further issues for DSA dynamic unbinding.
The first patch completely removes the PHY link state polling.
The two following cleans up the dsa state upon removal.
The last patch moves slave destroy code as slave function and
adds missing netdev and phy cleanup calls.

v1: http://lkml.kernel.org/r/562F8ECB.6050709@baylibre.com
v2: http://lkml.kernel.org/r/56321D9A.8010109@baylibre.com
remove phy fix and add missing calls in dsa_switch_destroy
then add dedicated dsa_slave_destroy

v3: remove polling instead of fixing it, make single patch for
dsa slave destroy
====================

Acked-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: move dsa slave destroy code to slave.c
Neil Armstrong [Mon, 7 Dec 2015 12:57:35 +0000 (13:57 +0100)]
net: dsa: move dsa slave destroy code to slave.c

Move dsa slave dedicated code from dsa_switch_destroy to a new
dsa_slave_destroy function in slave.c.
Add the netif_carrier_off and phy_disconnect calls in order to
correctly cleanup the netdev state and PHY state machine.

Signed-off-by: Frode Isaksen <fisaksen@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: Add missing master netdev dev_put() calls
Neil Armstrong [Mon, 7 Dec 2015 12:57:34 +0000 (13:57 +0100)]
net: dsa: Add missing master netdev dev_put() calls

Upon probe failure or unbinding, add missing dev_put() calls.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: cleanup resources upon module removal
Neil Armstrong [Mon, 7 Dec 2015 12:57:33 +0000 (13:57 +0100)]
net: dsa: cleanup resources upon module removal

Make sure that we unassign the master_netdev dsa_ptr to make the packet
processing go through the regular Ethernet receive path.

Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: dsa: remove DSA link polling
Neil Armstrong [Mon, 7 Dec 2015 12:57:32 +0000 (13:57 +0100)]
net: dsa: remove DSA link polling

Since no more DSA driver uses the polling callback, and since
the phylib handles the link detection, remove the link polling
work and timer code.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge tag 'mac80211-next-for-davem-2015-12-07' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Mon, 7 Dec 2015 19:10:10 +0000 (14:10 -0500)]
Merge tag 'mac80211-next-for-davem-2015-12-07' of git://git./linux/kernel/git/jberg/mac80211-next

Johannes Berg says:

====================
This pull request got a bit bigger than I wanted, due to
needing to reshuffle and fix some bugs. I merged mac80211
to get the right base for some of these changes.

 * new mac80211 API for upcoming driver changes: EOSP handling,
   key iteration
 * scan abort changes allowing to cancel an ongoing scan
 * VHT IBSS 80+80 MHz support
 * re-enable full AP client state tracking after fixes
 * various small fixes (that weren't relevant for mac80211)
 * various cleanups
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoMerge branch 'thunderx-cleanups'
David S. Miller [Mon, 7 Dec 2015 18:40:01 +0000 (13:40 -0500)]
Merge branch 'thunderx-cleanups'

Sunil Goutham says:

====================
net: thunderx: Miscellaneous cleanups

This patch series contains contains couple of cleanup patches.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet, thunderx: Remove unnecessary rcv buffer start address management
Sunil Goutham [Mon, 7 Dec 2015 05:00:33 +0000 (10:30 +0530)]
net, thunderx: Remove unnecessary rcv buffer start address management

Since we have moved on to using allocated pages to carve receive
buffers instead of netdev_alloc_skb() there is no need to store
any pointers for later retrieval. Earlier we had to store
skb and skb->data pointers which later are used to handover
received packet to network stack.

This will avoid an unnecessary cache miss as well.

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>