platform/kernel/linux-rpi.git
6 years agortlwifi: rtl_pci: 8822BE puts broadcast and multicast packet to HIQ
Ping-Ke Shih [Sat, 9 Dec 2017 17:37:08 +0000 (11:37 -0600)]
rtlwifi: rtl_pci: 8822BE puts broadcast and multicast packet to HIQ

Making this change to HIQ, which has high priority, improves the response
time for transmission after TBTT or beacon.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: enlarge buffer size of caps to 512 bytes
Wright Feng [Mon, 11 Dec 2017 07:38:21 +0000 (15:38 +0800)]
brcmfmac: enlarge buffer size of caps to 512 bytes

The buffer size of return of cap iovar is greater than 256 bytes in some
firmwares. For instance, the return size of cap iovar is 271 bytes in 4373
13.10.246.79 firmare. It makes feature capability parsing failed because
caps buffer is default value.
So we enlarge caps buffer size to 512 bytes and add the error print for
cap iovar error.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Remove repeated calls to brcmf_chip_get_core()
Ian Molton [Fri, 8 Dec 2017 12:10:35 +0000 (13:10 +0100)]
brcmfmac: Remove repeated calls to brcmf_chip_get_core()

There is no need to repeatdly call brcmf_chip_get_core(), which
traverses a list of cores every time its called (including during
register access code!).

Call it once, and store a pointer to the core structure. The existing
code does nto keep track of users of the cores anyway, and even so, this
will allow for easier refcounting in future.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
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>
6 years agobrcmfmac: Remove unused macro.
Ian Molton [Fri, 8 Dec 2017 12:10:34 +0000 (13:10 +0100)]
brcmfmac: Remove unused macro.

This macro is used exactly nowhere in the code. Delete it.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
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>
6 years agobrcmfmac: Cleanup offsetof()
Ian Molton [Fri, 8 Dec 2017 12:10:33 +0000 (13:10 +0100)]
brcmfmac: Cleanup offsetof()

Create a macro to make the code a bit more readable, whilst we're stuck
with using struct element offsets as register offsets.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
[arend: rename macro to SD_REG]
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: remove unnecessary call to brcmf_sdiod_set_backplane_window()
Ian Molton [Fri, 8 Dec 2017 12:10:32 +0000 (13:10 +0100)]
brcmfmac: remove unnecessary call to brcmf_sdiod_set_backplane_window()

All functions that might require the window address changing call
brcmf_sdiod_set_backplane_window() prior to access. Thus resetting
the window is not required.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
[arend: corrected the driver prefix in the subject]
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Remove brcmf_sdiod_addrprep()
Ian Molton [Fri, 8 Dec 2017 12:10:31 +0000 (13:10 +0100)]
brcmfmac: Remove brcmf_sdiod_addrprep()

This function has become trivial enough that it may as well be pushed into
its callers, which has the side-benefit of clarifying what's going on.

Remove it, and rename brcmf_sdiod_set_sbaddr_window() to
brcmf_sdiod_set_backplane_window() as it's easier to understand.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
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>
6 years agobrcmfmac: Tidy register definitions a little
Ian Molton [Fri, 8 Dec 2017 12:10:30 +0000 (13:10 +0100)]
brcmfmac: Tidy register definitions a little

Trivial tidy of register definitions.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Acked-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>
6 years agobrcmfmac: Rename / replace old IO functions with simpler ones.
Ian Molton [Fri, 8 Dec 2017 12:10:29 +0000 (13:10 +0100)]
brcmfmac: Rename / replace old IO functions with simpler ones.

Primarily this patch removes:

brcmf_sdiod_f0_writeb()
brcmf_sdiod_reg_write()
brcmf_sdiod_reg_read()

Since we no longer use the quirky method of deciding which function to
address via the address being accessed, take the opportunity to rename
some IO functions more in line with common kernel code. We also convert
those that map directly to sdio_{read,write}*() to macros.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
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>
6 years agobrcmfmac: Clarify if using braces.
Ian Molton [Fri, 8 Dec 2017 12:10:28 +0000 (13:10 +0100)]
brcmfmac: Clarify if using braces.

Whilst this if () statement is technically correct, it lacks clarity.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: whitespace fixes in brcmf_sdiod_send_buf()
Ian Molton [Fri, 8 Dec 2017 12:10:27 +0000 (13:10 +0100)]
brcmfmac: whitespace fixes in brcmf_sdiod_send_buf()

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
[arend: mention function in patch subject]
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Split brcmf_sdiod_buffrw function up.
Ian Molton [Fri, 8 Dec 2017 12:10:26 +0000 (13:10 +0100)]
brcmfmac: Split brcmf_sdiod_buffrw function up.

This function needs to be split up into separate read / write variants
for clarity.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
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>
6 years agobrcmsmac: use ARRAY_SIZE on rfseq_updategainu_events
Colin Ian King [Thu, 7 Dec 2017 10:20:47 +0000 (10:20 +0000)]
brcmsmac: use ARRAY_SIZE on rfseq_updategainu_events

Use the ARRAY_SIZE macro on rfseq_updategainu_events to determine
size of the array. Improvement suggested by coccinelle.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowireless: use ARRAY_SIZE
Jérémy Lefaure [Tue, 14 Nov 2017 03:19:41 +0000 (22:19 -0500)]
wireless: use ARRAY_SIZE

Using the ARRAY_SIZE macro improves the readability of the code. Also,
it is not always useful to use a variable to store this constant
calculated at compile time.

Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
 (sizeof(E)@p /sizeof(*E))
|
 (sizeof(E)@p /sizeof(E[...]))
|
 (sizeof(E)@p /sizeof(T))
)

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoiwlwifi: mvm: fix wrong #ifdef that uses a macro from backports
Luca Coelho [Fri, 8 Dec 2017 12:52:59 +0000 (14:52 +0200)]
iwlwifi: mvm: fix wrong #ifdef that uses a macro from backports

I accidentally pushed a patch with CPTCFG (which is used in the
backports project) to the rs-fw.c file.  Fix that to use CONFIG
instead.

Fixes: 9f66a397c877 ("iwlwifi: mvm: rs: add ops for the new rate scaling in the FW")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2017-12-05' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Fri, 8 Dec 2017 12:58:20 +0000 (14:58 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2017-12-05' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Second batch of iwlwifi updates for v4.16

* Initial work for rate-scaling offload;
* Support for new FW API version;
* Some fixes here and there;

6 years agossb: make SSB a menuconfig to ease disabling it all
Vincent Legoll [Mon, 4 Dec 2017 22:27:44 +0000 (23:27 +0100)]
ssb: make SSB a menuconfig to ease disabling it all

No need to get into the submenu to disable all SSB-related
config entries.

This makes it easier to disable all SSB config options
without entering the submenu. It will also enable one
to see that en/dis-abled state from the outside menu.

This is only intended to change menuconfig UI, not change
the config dependencies.

Signed-off-by: Vincent Legoll <vincent.legoll@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: add driver code for MT76x2e
Felix Fietkau [Tue, 21 Nov 2017 09:50:53 +0000 (10:50 +0100)]
mt76: add driver code for MT76x2e

MT76x2e is a 2x2 PCIe 802.11ac chipset by MediaTek. This driver has full
support for AP, station, ad-hoc, mesh and monitor mode.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomt76: add common code shared between multiple chipsets
Felix Fietkau [Tue, 21 Nov 2017 09:50:52 +0000 (10:50 +0100)]
mt76: add common code shared between multiple chipsets

This will be used by drivers for MT76x2e, MT7603e and MT7628

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agodt-bindings: net: add mt76 wireless device binding
Felix Fietkau [Tue, 21 Nov 2017 09:50:51 +0000 (10:50 +0100)]
dt-bindings: net: add mt76 wireless device binding

Add documentation describing how device tree can be used to configure
wireless chips supported by the mt76 driver.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobcma: Adjust block comment
Ashish Kalra [Tue, 28 Nov 2017 15:54:58 +0000 (21:24 +0530)]
bcma: Adjust block comment

use * for block comments in multiple lines according to kernel coding
style

Reported by: checkpatch.pl

Signed-off-by: Ashish Kalra <eashishkalra@gmail.com>
Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: cfg80211: do not change virtual interface during scan processing
Limin Zhu [Thu, 30 Nov 2017 06:22:34 +0000 (14:22 +0800)]
mwifiex: cfg80211: do not change virtual interface during scan processing

(1) Change virtual interface operation in cfg80211 process reset and
reinitilize private data structure.
(2) Scan result event processed in main process will dereference private
data structure concurrently, ocassionly crash the kernel.

The cornel case could be trigger by below steps:
(1) wpa_cli mlan0 scan
(2) ./hostapd mlan0.conf

Cfg80211 asynchronous scan procedure is not all the time operated
under rtnl lock, here we add the protect to serialize the cfg80211
scan and change_virtual interface operation.

Signed-off-by: Limin Zhu <liminzhu@marvell.com>
Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwifiex: do not support change AP interface to station mode
Xinming Hu [Wed, 22 Nov 2017 06:55:31 +0000 (14:55 +0800)]
mwifiex: do not support change AP interface to station mode

Firmware do not support change interface from micro-ap mode
to station mode, forbid this operation

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowlcore, wl1251: fix spelling: "Couldnt" -> "Couldn't" and remove error on -ENOMEM
Colin Ian King [Fri, 1 Dec 2017 10:02:58 +0000 (10:02 +0000)]
wlcore, wl1251: fix spelling: "Couldnt" -> "Couldn't" and remove error on -ENOMEM

Trivial fix to spelling mistake in error message text.  Also remove the
error message on an kzalloc failure as this is redundant.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowlcore: allow elp during wowlan suspend
Reizer, Eyal [Tue, 28 Nov 2017 08:02:07 +0000 (08:02 +0000)]
wlcore: allow elp during wowlan suspend

when enabling wowlan and entering suspend the last write to the firmware
allowing it to go into elp mode was not completing before suspend, leaving
the firmware running in full active mode consuming high power.
Use an immediate call instead of a work queue for this last access
allowing the firmware to go into power save during wowlan uspend.

Signed-off-by: Eyal Reizer <eyalr@ti.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agowlcore: use boottime for fw time sync
Arnd Bergmann [Mon, 27 Nov 2017 11:48:19 +0000 (12:48 +0100)]
wlcore: use boottime for fw time sync

Using getnstimeofday()/timespec_to_ns() causes an overflow on 32-bit
architectures in 2038, and may suffer from time jumps due to
settimeofday() or leap seconds.

I don't see a reason why this needs to be UTC, so either monotonic
or boot time would be better here. Assuming that the fw time keeps
running during suspend, boottime is better than monotonic, and
ktime_get_boot_ns() will also save the additional conversion to
nanoseconds.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agomwl8k: Expand non-DFS 5G channels
Weixiao Zhang [Thu, 16 Nov 2017 07:59:55 +0000 (01:59 -0600)]
mwl8k: Expand non-DFS 5G channels

Add non-DFS 5G upper channels (149-165) besides existed 4 lower channels
(36, 40, 44, 48).

Signed-off-by: Weixiao Zhang <waveletboy@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: rtl818x: remove redundant check for cck_power > 15
Colin Ian King [Tue, 14 Nov 2017 17:01:45 +0000 (17:01 +0000)]
rtlwifi: rtl818x: remove redundant check for cck_power > 15

cck_poweri cannot be greated than 15 as is derived from the bottom 4 bits
from riv->channels[channel - 1].hw_value & 0xf.  Hence the check for it
being greater than 15 is redundant and can be removed.

Detected by CoverityScan, CID#744303 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: cleanup the code that check whether TX ring is available
Ping-Ke Shih [Mon, 13 Nov 2017 09:39:35 +0000 (17:39 +0800)]
rtlwifi: cleanup the code that check whether TX ring is available

Remove the duplicate checking of TX ring's available number, and remove
the variable to store available number that can be calculated by
read/write pointers.

Signed-off-by: Steven Ting <steventing@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: fix the wrong size to calculate fifo space
Ping-Ke Shih [Mon, 13 Nov 2017 09:39:34 +0000 (17:39 +0800)]
rtlwifi: fix the wrong size to calculate fifo space

Give correct fifo size to calculate fifo space. Fortunately, the values of
RTL_PCI_MAX_RX_COUNT and TX_DESC_NUM_92E are the same in old code, so it
still works.

Signed-off-by: Steven Ting <steventing@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Reduce IO in RX interrupt to boost throughput
Ping-Ke Shih [Mon, 13 Nov 2017 09:39:33 +0000 (17:39 +0800)]
rtlwifi: Reduce IO in RX interrupt to boost throughput

Check remaining count of RX packets cost a lot of CPU time, so only update
when the counter decreases to zero. In old flow, the counter was updated
once a RX packet is received.

Signed-off-by: Steven Ting <steventing@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agortlwifi: Convert individual interrupt results to struct
Larry Finger [Sun, 12 Nov 2017 20:06:45 +0000 (14:06 -0600)]
rtlwifi: Convert individual interrupt results to struct

With the RTL8822BE and later devices, the number of interrupt vectors
has grown from 2 to 4. At this point, saving and passing those vectors
in a struct makes more sense than using individual scaler variables.

In two of the drivers, code to process the second of the interrupt
registers was included, but commented out. This patch removes those
useless sections.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Rename bcmerror to err
Ian Molton [Mon, 13 Nov 2017 20:35:47 +0000 (21:35 +0100)]
brcmfmac: Rename bcmerror to err

Trivial cleanup of nasty variable name

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Remove noisy debugging.
Ian Molton [Mon, 13 Nov 2017 20:35:46 +0000 (21:35 +0100)]
brcmfmac: Remove noisy debugging.

If you need debugging this low level, you're doing something wrong.
Remove these noisy debug statements so the code is more readable.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Fix asymmetric IO functions.
Ian Molton [Mon, 13 Nov 2017 20:35:45 +0000 (21:35 +0100)]
brcmfmac: Fix asymmetric IO functions.

Unlikely to be a problem, but brcmf_sdiod_regrl() is
not symmetric with brcmf_sdiod_regrb() in initializing
the data value on stack. Fix that.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
[arend: reword the commit message a bit]
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Remove brcmf_sdiod_request_data()
Ian Molton [Mon, 13 Nov 2017 20:35:44 +0000 (21:35 +0100)]
brcmfmac: Remove brcmf_sdiod_request_data()

This function is obfuscating how IO works on this chip. Remove it
and push its logic into brcmf_sdiod_reg_{read,write}().

Handling of -ENOMEDIUM is altered, but as that's pretty much broken anyway
we can ignore that.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Remove bandaid for SleepCSR
Ian Molton [Mon, 13 Nov 2017 20:35:43 +0000 (21:35 +0100)]
brcmfmac: Remove bandaid for SleepCSR

Register access code is not the place for band-aid fixes like this.
If this is a genuine problem, it should be fixed further up in the driver
stack.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Remove dead IO code
Ian Molton [Mon, 13 Nov 2017 20:35:42 +0000 (21:35 +0100)]
brcmfmac: Remove dead IO code

The value passed to brcmf_sdiod_addrprep() is *always* 4
remove this parameter and the unused code to handle it.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Clean up brcmf_sdiod_set_sbaddr_window()
Ian Molton [Mon, 13 Nov 2017 20:35:41 +0000 (21:35 +0100)]
brcmfmac: Clean up brcmf_sdiod_set_sbaddr_window()

This function sets the address of the IO window used for
SDIO accesses onto the backplane of the chip.

It currently uses 3 separate masks despite the full mask being
defined in the code already. Remove the separate masks and clean up.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Split brcmf_sdiod_regrw_helper() up.
Ian Molton [Mon, 13 Nov 2017 20:35:40 +0000 (21:35 +0100)]
brcmfmac: Split brcmf_sdiod_regrw_helper() up.

This large function is concealing a LOT of obscure logic about
how the hardware functions. Time to split it up.

This first patch splits the function into two pieces - read and write,
doing away with the rw flag in the process.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Register sizes on hardware are not dependent on compiler types
Ian Molton [Mon, 13 Nov 2017 20:35:39 +0000 (21:35 +0100)]
brcmfmac: Register sizes on hardware are not dependent on compiler types

The 4 IO functions in this patch are incorrect as they use compiler types
to determine how many bytes to send to the hardware.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agobrcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb()
Ian Molton [Mon, 13 Nov 2017 20:35:38 +0000 (21:35 +0100)]
brcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb()

All the other IO functions are the other way round in this
driver. Make this one match.

Signed-off-by: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
6 years agoiwlwifi: mvm: request statistics when reading debugfs
Johannes Berg [Wed, 22 Nov 2017 08:02:42 +0000 (09:02 +0100)]
iwlwifi: mvm: request statistics when reading debugfs

When statistics are read from debugfs, make sure that they
are actually updated from the firmware.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: make init_dbg effective only on failure
Liad Kaufman [Thu, 23 Nov 2017 08:29:04 +0000 (10:29 +0200)]
iwlwifi: mvm: make init_dbg effective only on failure

If FW loads without a problem, leaving init_dbg on can
cause a confusion, since the user won't necessarily
remember it is still turned on, and there are flows in
which everything continues as usual, only without
stopping the device after INIT, even if there is no FW
assert. On 22000 HW, for instance, this causes a
warning, since the paging is getting initialized twice.

Solve the issue by making this module param effective
only if the FW indeed asserts during INIT.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: add sanity check when sending LQ command
Gregory Greenman [Thu, 30 Nov 2017 03:16:16 +0000 (05:16 +0200)]
iwlwifi: mvm: rs: add sanity check when sending LQ command

When sending LQ command, verify the rate scaling is not in firmware.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: add size checks when printing to a buffer
Gregory Greenman [Sun, 26 Nov 2017 13:51:31 +0000 (15:51 +0200)]
iwlwifi: mvm: rs: add size checks when printing to a buffer

Replace sprintf by scnprintf throughout rs code.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: new rate scale API - add debugfs hooks
Gregory Greenman [Wed, 1 Nov 2017 07:38:59 +0000 (09:38 +0200)]
iwlwifi: mvm: rs: new rate scale API - add debugfs hooks

This patch adds basic debugfs hooks for rate scaling.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: new rate scale API - add FW notifications
Gregory Greenman [Wed, 1 Nov 2017 07:21:24 +0000 (09:21 +0200)]
iwlwifi: mvm: rs: new rate scale API - add FW notifications

This patch sends to the FW notification configuration command and
handles the update responses.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: add basic implementation of the new RS API handlers
Gregory Greenman [Wed, 1 Nov 2017 07:04:38 +0000 (09:04 +0200)]
iwlwifi: mvm: rs: add basic implementation of the new RS API handlers

This patch adds rate scaling configuration command and
implements a few other handlers.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: add ops for the new rate scaling in the FW
Gregory Greenman [Sun, 5 Nov 2017 16:49:48 +0000 (18:49 +0200)]
iwlwifi: mvm: rs: add ops for the new rate scaling in the FW

This patch introduces a new instance of rate_control_ops for
the new API (adding only empty stubs here and the subsequent
patches in the series will fill in the implementation).
The decision which API to use is done during the register
step according to FW TLV.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: rs: introduce new API for rate scaling
Gregory Greenman [Wed, 1 Nov 2017 05:16:29 +0000 (07:16 +0200)]
iwlwifi: mvm: rs: introduce new API for rate scaling

New devices will have rate scaling algorithm running in the firmware.
With this feature, the driver's responsiblity is to provide an initial
configuration and to handle notifications regarding recent rates and
some other parameters. Debugfs hooks will be still available for
reading the current rate/statistics and setting a fixed rate.
The old API is supported so far, though both APIs cannot be used
simultaneously.

This is the first patch in the series. It adds a new TLV specifying
FW support for the new API and updates lq_sta to support two types
of rate scaling.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: avoid dumping assert log when device is stopped
Sara Sharon [Mon, 20 Nov 2017 16:02:05 +0000 (18:02 +0200)]
iwlwifi: mvm: avoid dumping assert log when device is stopped

We might erroneously get to error dumping code when the
device is already stopped.

In that case the driver will detect a defective value and will try to
reset the HW, assuming it is only a bus issue.  The driver than
proceeds with the dumping.

The result has two side effects:

1. The device won't be stopped again, since the transport status is
already stopped, so the device remains powered on while it actually
should be stopped.

2. The dump in that case is completely garbaged and useless.

Detect and avoid this.  It will also make debugging such issues
easier.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: remove set but unused variable in iwl_mvm_roc_done_wk
Emmanuel Grumbach [Wed, 15 Nov 2017 19:12:41 +0000 (21:12 +0200)]
iwlwifi: mvm: remove set but unused variable in iwl_mvm_roc_done_wk

Since the removal of non-DQA code, we don't need the queues
variable any more. Remove it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: bump FW API to 36 for 8000 and up
Luca Coelho [Tue, 29 Aug 2017 07:39:27 +0000 (10:39 +0300)]
iwlwifi: bump FW API to 36 for 8000 and up

Load version 36 of the API for these devices, if available.  We
skipped version 35.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoiwlwifi: mvm: add WFA vendor specific TPC report IE to probe request
Avraham Stern [Tue, 4 Jul 2017 07:05:15 +0000 (10:05 +0300)]
iwlwifi: mvm: add WFA vendor specific TPC report IE to probe request

Add the WFA vendor specific TPC report IE to probe requests
when it is not added by the FW. The FW will still need to set
the tx power field.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
6 years agoMerge tag 'iwlwifi-next-for-kalle-2017-11-29' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Sat, 2 Dec 2017 13:20:21 +0000 (15:20 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2017-11-29' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

First batch of iwlwifi updates for v4.16

* Rename the temporary name A000 to 22000;
* Change in the way we print the firmware version;
* Remove some unused code;
* Other small improvements;

kvalo:

There were conflicts, I fixed them with taking into account commit c2c48ddfc8b0
("iwlwifi: fix firmware names for 9000 and A000 series hw"):

CONFLICT (content): Merge conflict in drivers/net/wireless/intel/iwlwifi/iwl-config.h
CONFLICT (modify/delete): drivers/net/wireless/intel/iwlwifi/cfg/a000.c deleted in ca495785063c428641cc6df8888afd2587ca6677 and modified in HEAD. Version HEAD of drivers/net/wireless/intel/iwlwifi/cfg/a000.c left in tree.

6 years agoDocumentation: net: dsa: Cut set_addr() documentation
Linus Walleij [Wed, 29 Nov 2017 15:34:38 +0000 (16:34 +0100)]
Documentation: net: dsa: Cut set_addr() documentation

This is not supported anymore, devices needing a MAC address
just assign one at random, it's just a driver pecularity.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge branch 'net-dst_entry-shrink'
David S. Miller [Thu, 30 Nov 2017 14:54:28 +0000 (09:54 -0500)]
Merge branch 'net-dst_entry-shrink'

David Miller says:

====================
net: Significantly shrink the size of routes.

Through a combination of several things, our route structures are
larger than they need to be.

Mostly this stems from having members in dst_entry which are only used
by one class of routes.  So the majority of the work in this series is
about "un-commoning" these members and pushing them into the type
specific structures.

Unfortunately, IPSEC needed the most surgery.  The majority of the
changes here had to do with bundle creation and management.

The other issue is the refcount alignment in dst_entry.  Once we get
rid of the not-so-common members, it really opens the door to removing
that alignment entirely.

I think the new layout looks really nice, so I'll reproduce it here:

struct net_device       *dev;
struct  dst_ops         *ops;
unsigned long _metrics;
unsigned long           expires;
struct xfrm_state *xfrm;
int (*input)(struct sk_buff *);
int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
unsigned short flags;
short obsolete;
unsigned short header_len;
unsigned short trailer_len;
atomic_t __refcnt;
int __use;
unsigned long lastuse;
struct lwtunnel_state   *lwtstate;
struct rcu_head rcu_head;
short error;
short __pad;
__u32 tclassid;

(This is for 64-bit, on 32-bit the __refcnt comes at the very end)

So, the good news:

1) struct dst_entry shrinks from 160 to 112 bytes.

2) struct rtable shrinks from 216 to 168 bytes.

3) struct rt6_info shrinks from 384 to 320 bytes.

Enjoy.

v2:
Collapse some patches logically based upon feedback.
Fix the strange patch #7.

v3: xfrm_dst_path() needs inline keyword
Properly align __refcnt on 32-bit.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: Remove dst->next
David Miller [Tue, 28 Nov 2017 20:41:07 +0000 (15:41 -0500)]
net: Remove dst->next

There are no more users.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agoxfrm: Stop using dst->next in bundle construction.
David Miller [Tue, 28 Nov 2017 20:41:01 +0000 (15:41 -0500)]
xfrm: Stop using dst->next in bundle construction.

While building ipsec bundles, blocks of xfrm dsts are linked together
using dst->next from bottom to the top.

The only thing this is used for is initializing the pmtu values of the
xfrm stack, and for updating the mtu values at xfrm_bundle_ok() time.

The bundle pmtu entries must be processed in this order so that pmtu
values lower in the stack of routes can propagate up to the higher
ones.

Avoid using dst->next by simply maintaining an array of dst pointers
as we already do for the xfrm_state objects when building the bundle.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agonet: Rearrange dst_entry layout to avoid useless padding.
David Miller [Tue, 28 Nov 2017 20:40:53 +0000 (15:40 -0500)]
net: Rearrange dst_entry layout to avoid useless padding.

We have padding to try and align the refcount on a separate cache
line.  But after several simplifications the padding has increased
substantially.

So now it's easy to change the layout to get rid of the padding
entirely.

We group the write-heavy __refcnt and __use with less often used
items such as the rcu_head and the error code.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agoxfrm: Move dst->path into struct xfrm_dst
David Miller [Tue, 28 Nov 2017 20:40:46 +0000 (15:40 -0500)]
xfrm: Move dst->path into struct xfrm_dst

The first member of an IPSEC route bundle chain sets it's dst->path to
the underlying ipv4/ipv6 route that carries the bundle.

Stated another way, if one were to follow the xfrm_dst->child chain of
the bundle, the final non-NULL pointer would be the path and point to
either an ipv4 or an ipv6 route.

This is largely used to make sure that PMTU events propagate down to
the correct ipv4 or ipv6 route.

When we don't have the top of an IPSEC bundle 'dst->path == dst'.

Move it down into xfrm_dst and key off of dst->xfrm.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agoipv6: Move dst->from into struct rt6_info.
David Miller [Tue, 28 Nov 2017 20:40:40 +0000 (15:40 -0500)]
ipv6: Move dst->from into struct rt6_info.

The dst->from value is only used by ipv6 routes to track where
a route "came from".

Any time we clone or copy a core ipv6 route in the ipv6 routing
tables, we have the copy/clone's ->from point to the base route.

This is used to handle route expiration properly.

Only ipv6 uses this mechanism, and only ipv6 code references
it.  So it is safe to move it into rt6_info.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agoxfrm: Move child route linkage into xfrm_dst.
David Miller [Tue, 28 Nov 2017 20:45:44 +0000 (15:45 -0500)]
xfrm: Move child route linkage into xfrm_dst.

XFRM bundle child chains look like this:

xdst1 --> xdst2 --> xdst3 --> path_dst

All of xdstN are xfrm_dst objects and xdst->u.dst.xfrm is non-NULL.
The final child pointer in the chain, here called 'path_dst', is some
other kind of route such as an ipv4 or ipv6 one.

The xfrm output path pops routes, one at a time, via the child
pointer, until we hit one which has a dst->xfrm pointer which
is NULL.

We can easily preserve the above mechanisms with child sitting
only in the xfrm_dst structure.  All children in the chain
before we break out of the xfrm_output() loop have dst->xfrm
non-NULL and are therefore xfrm_dst objects.

Since we break out of the loop when we find dst->xfrm NULL, we
will not try to dereference 'dst' as if it were an xfrm_dst.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipsec: Create and use new helpers for dst child access.
David Miller [Tue, 28 Nov 2017 20:40:28 +0000 (15:40 -0500)]
ipsec: Create and use new helpers for dst child access.

This will make a future change moving the dst->child pointer less
invasive.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agonet: Create and use new helper xfrm_dst_child().
David Miller [Tue, 28 Nov 2017 20:40:22 +0000 (15:40 -0500)]
net: Create and use new helper xfrm_dst_child().

Only IPSEC routes have a non-NULL dst->child pointer.  And IPSEC
routes are identified by a non-NULL dst->xfrm pointer.

Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoipv6: Move rt6_next from dst_entry into ipv6 route structure.
David Miller [Tue, 28 Nov 2017 20:40:15 +0000 (15:40 -0500)]
ipv6: Move rt6_next from dst_entry into ipv6 route structure.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agodecnet: Move dn_next into decnet route structure.
David Miller [Tue, 28 Nov 2017 20:40:08 +0000 (15:40 -0500)]
decnet: Move dn_next into decnet route structure.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agonet: dst->rt_next is unused.
David Miller [Tue, 28 Nov 2017 20:39:59 +0000 (15:39 -0500)]
net: dst->rt_next is unused.

Delete it.

Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
6 years agoforcedeth: optimize the xmit with unlikely
Zhu Yanjun [Tue, 28 Nov 2017 06:42:22 +0000 (01:42 -0500)]
forcedeth: optimize the xmit with unlikely

In xmit, it is very impossible that TX_ERROR occurs. So using
unlikely optimizes the xmit process.

CC: Srinivas Eeda <srinivas.eeda@oracle.com>
CC: Joe Jin <joe.jin@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoatm: mpoa: remove 32-bit timekeeping
Tina Ruchandani [Mon, 27 Nov 2017 14:02:17 +0000 (15:02 +0100)]
atm: mpoa: remove 32-bit timekeeping

net/atm/mpoa_* files use 'struct timeval' to store event
timestamps. struct timeval uses a 32-bit seconds field which will
overflow in the year 2038 and beyond. Morever, the timestamps are being
compared only to get seconds elapsed, so struct timeval which stores
a seconds and microseconds field is an overkill. This patch replaces
the use of struct timeval with time64_t to store a 64-bit seconds field.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoatm: eni: fix several indentation issues
Colin Ian King [Mon, 27 Nov 2017 13:15:10 +0000 (13:15 +0000)]
atm: eni: fix several indentation issues

There are several statements that have incorrect indentation. Fix
these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoopenvswitch: use ktime_get_ts64() instead of ktime_get_ts()
Arnd Bergmann [Mon, 27 Nov 2017 11:41:38 +0000 (12:41 +0100)]
openvswitch: use ktime_get_ts64() instead of ktime_get_ts()

timespec is deprecated because of the y2038 overflow, so let's convert
this one to ktime_get_ts64(). The code is already safe even on 32-bit
architectures, since it uses monotonic times. On 64-bit architectures,
nothing changes, while on 32-bit architectures this avoids one
type conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonetxen: remove timespec usage
Arnd Bergmann [Mon, 27 Nov 2017 11:39:57 +0000 (12:39 +0100)]
netxen: remove timespec usage

netxen_collect_minidump() evidently just wants to get a monotonic
timestamp. Using jiffies_to_timespec(jiffies, &ts) is not
appropriate here, since it will overflow after 2^32 jiffies,
which may be as short as 49 days of uptime.

ktime_get_seconds() is the correct interface here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: phy: harmonize phy_id{,_mask} data type
Richard Leitner [Mon, 27 Nov 2017 07:16:45 +0000 (08:16 +0100)]
net: phy: harmonize phy_id{,_mask} data type

Previously phy_id was u32 and phy_id_mask was unsigned int. As the
phy_id_mask defines the important bits of the phy_id (and is therefore
the same size) these two variables should be the same data type.

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: ethernet: davinci_emac: Deduplicate bus_find_device() by name matching
Lukas Wunner [Sat, 25 Nov 2017 11:18:19 +0000 (12:18 +0100)]
net: ethernet: davinci_emac: Deduplicate bus_find_device() by name matching

No need to reinvent the wheel, we have bus_find_device_by_name().

Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: thunderx: Set max queue count taking XDP_TX into account
Sunil Goutham [Fri, 24 Nov 2017 12:04:03 +0000 (15:04 +0300)]
net: thunderx: Set max queue count taking XDP_TX into account

on T81 there are only 4 cores, hence setting max queue count to 4
would leave nothing for XDP_TX. This patch fixes this by doubling
max queue count in above scenarios.

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: cjacob <cjacob@caviumnetworks.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: thunderx: Add support for xdp redirect
Sunil Goutham [Fri, 24 Nov 2017 12:03:26 +0000 (15:03 +0300)]
net: thunderx: Add support for xdp redirect

This patch adds support for XDP_REDIRECT. Flush is not
yet supported.

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: cjacob <cjacob@caviumnetworks.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoMerge tag 'nfsd-4.15-1' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Wed, 29 Nov 2017 22:49:26 +0000 (14:49 -0800)]
Merge tag 'nfsd-4.15-1' of git://linux-nfs.org/~bfields/linux

Pull nfsd fixes from Bruce Fields:
 "I screwed up my merge window pull request; I only sent half of what I
  meant to.

  There were no new features, just bugfixes of various importance and
  some very minor cleanup, so I think it's all still appropriate for
  -rc2.

  Highlights:

   - Fixes from Trond for some races in the NFSv4 state code.

   - Fix from Naofumi Honda for a typo in the blocked lock notificiation
     code

   - Fixes from Vasily Averin for some problems starting and stopping
     lockd especially in network namespaces"

* tag 'nfsd-4.15-1' of git://linux-nfs.org/~bfields/linux: (23 commits)
  lockd: fix "list_add double add" caused by legacy signal interface
  nlm_shutdown_hosts_net() cleanup
  race of nfsd inetaddr notifiers vs nn->nfsd_serv change
  race of lockd inetaddr notifiers vs nlmsvc_rqst change
  SUNRPC: make cache_detail structures const
  NFSD: make cache_detail structures const
  sunrpc: make the function arg as const
  nfsd: check for use of the closed special stateid
  nfsd: fix panic in posix_unblock_lock called from nfs4_laundromat
  lockd: lost rollback of set_grace_period() in lockd_down_net()
  lockd: added cleanup checks in exit_net hook
  grace: replace BUG_ON by WARN_ONCE in exit_net hook
  nfsd: fix locking validator warning on nfs4_ol_stateid->st_mutex class
  lockd: remove net pointer from messages
  nfsd: remove net pointer from debug messages
  nfsd: Fix races with check_stateid_generation()
  nfsd: Ensure we check stateid validity in the seqid operation checks
  nfsd: Fix race in lock stateid creation
  nfsd4: move find_lock_stateid
  nfsd: Ensure we don't recognise lock stateids after freeing them
  ...

6 years agoMerge tag 'for-4.15-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
Linus Torvalds [Wed, 29 Nov 2017 22:26:50 +0000 (14:26 -0800)]
Merge tag 'for-4.15-rc2-tag' of git://git./linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
 "We've collected some fixes in since the pre-merge window freeze.

  There's technically only one regression fix for 4.15, but the rest
  seems important and candidates for stable.

   - fix missing flush bio puts in error cases (is serious, but rarely
     happens)

   - fix reporting stat::st_blocks for buffered append writes

   - fix space cache invalidation

   - fix out of bound memory access when setting zlib level

   - fix potential memory corruption when fsync fails in the middle

   - fix crash in integrity checker

   - incremetnal send fix, path mixup for certain unlink/rename
     combination

   - pass flags to writeback so compressed writes can be throttled
     properly

   - error handling fixes"

* tag 'for-4.15-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  Btrfs: incremental send, fix wrong unlink path after renaming file
  btrfs: tree-checker: Fix false panic for sanity test
  Btrfs: fix list_add corruption and soft lockups in fsync
  btrfs: Fix wild memory access in compression level parser
  btrfs: fix deadlock when writing out space cache
  btrfs: clear space cache inode generation always
  Btrfs: fix reported number of inode blocks after buffered append writes
  Btrfs: move definition of the function btrfs_find_new_delalloc_bytes
  Btrfs: bail out gracefully rather than BUG_ON
  btrfs: dev_alloc_list is not protected by RCU, use normal list_del
  btrfs: add missing device::flush_bio puts
  btrfs: Fix transaction abort during failure in btrfs_rm_dev_item
  Btrfs: add write_flags for compression bio

6 years agoMerge tag 'microblaze-4.15-rc2' of git://git.monstr.eu/linux-2.6-microblaze
Linus Torvalds [Wed, 29 Nov 2017 22:19:22 +0000 (14:19 -0800)]
Merge tag 'microblaze-4.15-rc2' of git://git.monstr.eu/linux-2.6-microblaze

Pull Microblaze fix from Michal Simek:
 "Add missing header to mmu_context_mm.h"

* tag 'microblaze-4.15-rc2' of git://git.monstr.eu/linux-2.6-microblaze:
  microblaze: add missing include to mmu_context_mm.h

6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Linus Torvalds [Wed, 29 Nov 2017 22:17:30 +0000 (14:17 -0800)]
Merge git://git./linux/kernel/git/davem/sparc

Pull sparc fix from David Miller:
 "Sparc T4 and later cpu bootup regression fix"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
  sparc64: Fix boot on T4 and later.

6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Wed, 29 Nov 2017 21:10:25 +0000 (13:10 -0800)]
Merge git://git./linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) The forcedeth conversion from pci_*() DMA interfaces to dma_*() ones
    missed one spot. From Zhu Yanjun.

 2) Missing CRYPTO_SHA256 Kconfig dep in cfg80211, from Johannes Berg.

 3) Fix checksum offloading in thunderx driver, from Sunil Goutham.

 4) Add SPDX to vm_sockets_diag.h, from Stephen Hemminger.

 5) Fix use after free of packet headers in TIPC, from Jon Maloy.

 6) "sizeof(ptr)" vs "sizeof(*ptr)" bug in i40e, from Gustavo A R Silva.

 7) Tunneling fixes in mlxsw driver, from Petr Machata.

 8) Fix crash in fanout_demux_rollover() of AF_PACKET, from Mike
    Maloney.

 9) Fix race in AF_PACKET bind() vs. NETDEV_UP notifier, from Eric
    Dumazet.

10) Fix regression in sch_sfq.c due to one of the timer_setup()
    conversions. From Paolo Abeni.

11) SCTP does list_for_each_entry() using wrong struct member, fix from
    Xin Long.

12) Don't use big endian netlink attribute read for
    IFLA_BOND_AD_ACTOR_SYSTEM, it is in cpu endianness. Also from Xin
    Long.

13) Fix mis-initialization of q->link.clock in CBQ scheduler, preventing
    adding filters there. From Jiri Pirko.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (67 commits)
  ethernet: dwmac-stm32: Fix copyright
  net: via: via-rhine: use %p to format void * address instead of %x
  net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit
  myri10ge: Update MAINTAINERS
  net: sched: cbq: create block for q->link.block
  atm: suni: remove extraneous space to fix indentation
  atm: lanai: use %p to format kernel addresses instead of %x
  VSOCK: Don't set sk_state to TCP_CLOSE before testing it
  atm: fore200e: use %pK to format kernel addresses instead of %x
  ambassador: fix incorrect indentation of assignment statement
  vxlan: use __be32 type for the param vni in __vxlan_fdb_delete
  bonding: use nla_get_u64 to extract the value for IFLA_BOND_AD_ACTOR_SYSTEM
  sctp: use right member as the param of list_for_each_entry
  sch_sfq: fix null pointer dereference at timer expiration
  cls_bpf: don't decrement net's refcount when offload fails
  net/packet: fix a race in packet_bind() and packet_notifier()
  packet: fix crash in fanout_demux_rollover()
  sctp: remove extern from stream sched
  sctp: force the params with right types for sctp csum apis
  sctp: force SCTP_ERROR_INV_STRM with __u32 when calling sctp_chunk_fail
  ...

6 years agosparc64: Fix boot on T4 and later.
David S. Miller [Wed, 29 Nov 2017 20:09:29 +0000 (15:09 -0500)]
sparc64: Fix boot on T4 and later.

If we don't put the NG4fls.o object into the same part of
the link as the generic sparc64 objects for fls() and __fls()
then the relocation in the branch we use for patching will
not fit.

Move NG4fls.o into lib-y to fix this problem.

Fixes: 46ad8d2d22c1 ("sparc64: Use sparc optimized fls and __fls for T4 and above")
Signed-off-by: David S. Miller <davem@davemloft.net>
Reported-by: Anatoly Pugachev <matorola@gmail.com>
Tested-by: Anatoly Pugachev <matorola@gmail.com>
6 years agovsprintf: don't use 'restricted_pointer()' when not restricting
Linus Torvalds [Wed, 29 Nov 2017 19:28:09 +0000 (11:28 -0800)]
vsprintf: don't use 'restricted_pointer()' when not restricting

Instead, just fall back on the new '%p' behavior which hashes the
pointer.

Otherwise, '%pK' - that was intended to mark a pointer as restricted -
just ends up leaking pointers that a normal '%p' wouldn't leak.  Which
just make the whole thing pointless.

I suspect we should actually get rid of '%pK' entirely, and make it just
work as '%p' regardless, but this is the minimal obvious fix.  People
who actually use 'kptr_restrict' should weigh in on which behavior they
want.

Cc: Tobin Harding <me@tobin.cc>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agokallsyms: take advantage of the new '%px' format
Linus Torvalds [Wed, 29 Nov 2017 18:30:13 +0000 (10:30 -0800)]
kallsyms: take advantage of the new '%px' format

The conditional kallsym hex printing used a special fixed-width '%lx'
output (KALLSYM_FMT) in preparation for the hashing of %p, but that
series ended up adding a %px specifier to help with the conversions.

Use it, and avoid the "print pointer as an unsigned long" code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agoMerge tag 'printk-hash-pointer-4.15-rc2' of git://github.com/tcharding/linux
Linus Torvalds [Wed, 29 Nov 2017 18:19:29 +0000 (10:19 -0800)]
Merge tag 'printk-hash-pointer-4.15-rc2' of git://github.com/tcharding/linux

Pull printk pointer hashing update from Tobin Harding:
 "Here is the patch set that implements hashing of printk specifier %p.

  First we have two clean up patches then we do the hashing. Hashing is
  done via the SipHash algorithm. The next patch adds printk specifier
  %px for printing pointers when we _really_ want to see the address i.e
  %px is functionally equivalent to %lx. Final patch in the set fixes
  KASAN since we break it by hashing %p.

  For the record here is the justification for the series:

    Currently there exist approximately 14 000 places in the Kernel
    where addresses are being printed using an unadorned %p. This
    potentially leaks sensitive information about the Kernel layout in
    memory. Many of these calls are stale, instead of fixing every call
    we hash the address by default before printing. We then add %px to
    provide a way to print the actual address. Although this is
    achievable using %lx, using %px will assist us if we ever want to
    change pointer printing behaviour. %px is more uniquely grep'able
    (there are already >50 000 uses of %lx).

    The added advantage of hashing %p is that security is now opt-out,
    if you _really_ want the address you have to work a little harder
    and use %px.

  This will of course break some users, forcing code printing needed
  addresses to be updated"

[ I do expect this to be an annoyance, and a number of %px users to be
  added for debuggability. But nobody is willing to audit existing %p
  users for information leaks, and a number of places really only use
  the pointer as an object identifier rather than really 'I need the
  address'.

  IOW - sorry for the inconvenience, but it's the least inconvenient of
  the options.    - Linus ]

* tag 'printk-hash-pointer-4.15-rc2' of git://github.com/tcharding/linux:
  kasan: use %px to print addresses instead of %p
  vsprintf: add printk specifier %px
  printk: hash addresses printed with %p
  vsprintf: refactor %pK code out of pointer()
  docs: correct documentation for %pK

6 years agoRevert "mm, thp: Do not make pmd/pud dirty without a reason"
Linus Torvalds [Wed, 29 Nov 2017 17:01:01 +0000 (09:01 -0800)]
Revert "mm, thp: Do not make pmd/pud dirty without a reason"

This reverts commit 152e93af3cfe2d29d8136cc0a02a8612507136ee.

It was a nice cleanup in theory, but as Nicolai Stange points out, we do
need to make the page dirty for the copy-on-write case even when we
didn't end up making it writable, since the dirty bit is what we use to
check that we've gone through a COW cycle.

Reported-by: Michal Hocko <mhocko@kernel.org>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6 years agoethernet: dwmac-stm32: Fix copyright
Benjamin Gaignard [Wed, 29 Nov 2017 14:20:00 +0000 (15:20 +0100)]
ethernet: dwmac-stm32: Fix copyright

Uniformize STMicroelectronics copyrights header

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
CC: Alexandre Torgue <alexandre.torgue@st.com>
Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: via: via-rhine: use %p to format void * address instead of %x
Colin Ian King [Wed, 29 Nov 2017 14:11:49 +0000 (14:11 +0000)]
net: via: via-rhine: use %p to format void * address instead of %x

Don't use %x and casting to print out an address, instead use %p
and remove the casting.  Cleans up smatch warnings:

drivers/net/ethernet/via/via-rhine.c:998 rhine_init_one_common()
warn: argument 4 to %lx specifier is cast from pointer

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agonet: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit
Geert Uytterhoeven [Wed, 29 Nov 2017 10:01:09 +0000 (11:01 +0100)]
net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit

On 64-bit (e.g. powerpc64/allmodconfig):

    drivers/net/ethernet/xilinx/ll_temac_main.c: In function 'temac_start_xmit_done':
    drivers/net/ethernet/xilinx/ll_temac_main.c:633:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
dev_kfree_skb_irq((struct sk_buff *)cur_p->app4);
  ^

cdmac_bd.app4 is u32, so it is too small to hold a kernel pointer.

Note that several other fields in struct cdmac_bd are also too small to
hold physical addresses on 64-bit platforms.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agomyri10ge: Update MAINTAINERS
Hyong-Youb Kim [Wed, 29 Nov 2017 05:03:50 +0000 (00:03 -0500)]
myri10ge: Update MAINTAINERS

Change the maintainer to Chris Lee who has access to Myricom hardware
and can test/review. Update the website URL.

Signed-off-by: Hyong-Youb Kim <hykim@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agokasan: use %px to print addresses instead of %p
Tobin C. Harding [Wed, 1 Nov 2017 04:32:22 +0000 (15:32 +1100)]
kasan: use %px to print addresses instead of %p

Pointers printed with %p are now hashed by default. Kasan needs the
actual address. We can use the new printk specifier %px for this
purpose.

Use %px instead of %p to print addresses.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agovsprintf: add printk specifier %px
Tobin C. Harding [Wed, 22 Nov 2017 23:59:45 +0000 (10:59 +1100)]
vsprintf: add printk specifier %px

printk specifier %p now hashes all addresses before printing. Sometimes
we need to see the actual unmodified address. This can be achieved using
%lx but then we face the risk that if in future we want to change the
way the Kernel handles printing of pointers we will have to grep through
the already existent 50 000 %lx call sites. Let's add specifier %px as a
clear, opt-in, way to print a pointer and maintain some level of
isolation from all the other hex integer output within the Kernel.

Add printk specifier %px to print the actual unmodified address.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoprintk: hash addresses printed with %p
Tobin C. Harding [Wed, 1 Nov 2017 04:32:23 +0000 (15:32 +1100)]
printk: hash addresses printed with %p

Currently there exist approximately 14 000 places in the kernel where
addresses are being printed using an unadorned %p. This potentially
leaks sensitive information regarding the Kernel layout in memory. Many
of these calls are stale, instead of fixing every call lets hash the
address by default before printing. This will of course break some
users, forcing code printing needed addresses to be updated.

Code that _really_ needs the address will soon be able to use the new
printk specifier %px to print the address.

For what it's worth, usage of unadorned %p can be broken down as
follows (thanks to Joe Perches).

$ git grep -E '%p[^A-Za-z0-9]' | cut -f1 -d"/" | sort | uniq -c
   1084 arch
     20 block
     10 crypto
     32 Documentation
   8121 drivers
   1221 fs
    143 include
    101 kernel
     69 lib
    100 mm
   1510 net
     40 samples
      7 scripts
     11 security
    166 sound
    152 tools
      2 virt

Add function ptr_to_id() to map an address to a 32 bit unique
identifier. Hash any unadorned usage of specifier %p and any malformed
specifiers.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agovsprintf: refactor %pK code out of pointer()
Tobin C. Harding [Wed, 22 Nov 2017 23:56:39 +0000 (10:56 +1100)]
vsprintf: refactor %pK code out of pointer()

Currently code to handle %pK is all within the switch statement in
pointer(). This is the wrong level of abstraction. Each of the other switch
clauses call a helper function, pK should do the same.

Refactor code out of pointer() to new function restricted_pointer().

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agodocs: correct documentation for %pK
Tobin C. Harding [Wed, 22 Nov 2017 23:55:24 +0000 (10:55 +1100)]
docs: correct documentation for %pK

Current documentation indicates that %pK prints a leading '0x'. This is
not the case.

Correct documentation for printk specifier %pK.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
6 years agoMerge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Linus Torvalds [Wed, 29 Nov 2017 00:22:10 +0000 (16:22 -0800)]
Merge branch 'linus' of git://git./linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:

 - avoid potential bogus alignment for some AEAD operations

 - fix crash in algif_aead

 - avoid sleeping in softirq context with async af_alg

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: skcipher - Fix skcipher_walk_aead_common
  crypto: af_alg - remove locking in async callback
  crypto: algif_aead - skip SGL entries with NULL page

6 years agonet: sched: cbq: create block for q->link.block
Jiri Pirko [Mon, 27 Nov 2017 17:37:21 +0000 (18:37 +0100)]
net: sched: cbq: create block for q->link.block

q->link.block is not initialized, that leads to EINVAL when one tries to
add filter there. So initialize it properly.

This can be reproduced by:
$ tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 rate 1000Mbit bandwidth 1000Mbit
$ tc filter add dev eth0 parent 1: protocol ip prio 100 u32 match ip protocol 0 0x00 flowid 1:1

Reported-by: Jaroslav Aster <jaster@redhat.com>
Reported-by: Ivan Vecera <ivecera@redhat.com>
Fixes: 6529eaba33f0 ("net: sched: introduce tcf block infractructure")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6 years agoatm: suni: remove extraneous space to fix indentation
Colin Ian King [Mon, 27 Nov 2017 13:47:22 +0000 (13:47 +0000)]
atm: suni: remove extraneous space to fix indentation

Remove a leading space, fixes indentation

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>