platform/kernel/linux-starfive.git
4 years agomt76: fix compilation warning in mt76_eeprom_override()
Lorenzo Bianconi [Mon, 16 Dec 2019 18:32:10 +0000 (19:32 +0100)]
mt76: fix compilation warning in mt76_eeprom_override()

Fix the following compilation warning in mt76_eeprom_override routine
when CONFIG_OF is not set and label 'out' is not actually used

drivers/net/wireless/mediatek/mt76/eeprom.c: In function ‘mt76_eeprom_override’:
drivers/net/wireless/mediatek/mt76/eeprom.c:100:1: warning: label ‘out’ defined but not used [-Wunused-label]

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: simplify led reg definitions
Lorenzo Bianconi [Mon, 16 Dec 2019 13:19:59 +0000 (14:19 +0100)]
mt76: mt7603: simplify led reg definitions

Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: simplify led reg definitions
Lorenzo Bianconi [Mon, 16 Dec 2019 13:19:58 +0000 (14:19 +0100)]
mt76: mt76x02: simplify led reg definitions

Rely on FIELD_PREP macro for led register definitions and
remove open coding

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: introduce LED support
Lorenzo Bianconi [Mon, 16 Dec 2019 13:05:05 +0000 (14:05 +0100)]
mt76: mt7615: introduce LED support

Initialize brightness_set and blink_set callbacks to
mt7615_led_set_brightness and mt7615_led_set_blink in order to enable
LED support in mt7615 driver

Tested-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: clear skb pointers from rx aggregation reorder buffer during cleanup
Felix Fietkau [Fri, 13 Dec 2019 23:15:26 +0000 (00:15 +0100)]
mt76: clear skb pointers from rx aggregation reorder buffer during cleanup

During the cleanup of the aggregation session, a rx handler (or release timer)
on another CPU might still hold a pointer to the reorder buffer and could
attempt to release some packets.
Clearing pointers during cleanup avoids a theoretical use-after-free bug here.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: fix input validation issues for powersave-filtered frames
Felix Fietkau [Sat, 21 Dec 2019 15:46:53 +0000 (16:46 +0100)]
mt76: mt7603: fix input validation issues for powersave-filtered frames

Before extracting the tid out of the packet, check if it was qos-data.
Only accept tid values 0-7
Also, avoid accepting the hardware queue as skb queue mapping, it could
lead to an overrun. Instead, derive the hardware queue from the tid number,
in order to avoid issues with packets being filtered multiple times.
This also fixes a mismatch between hardware and software queue indexes.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: increase MCU command timeout
Felix Fietkau [Thu, 19 Dec 2019 12:41:24 +0000 (13:41 +0100)]
mt76: mt7615: increase MCU command timeout

MCU_EXT_CMD_EFUSE_BUFFER_MODE needs more time on initialization, and
with only 10 seconds it sometimes runs into timeouts.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: measure channel noise and report it via survey
Felix Fietkau [Sat, 14 Dec 2019 19:08:59 +0000 (20:08 +0100)]
mt76: mt7615: measure channel noise and report it via survey

Read measurements every 100 ms and build a simple moving average

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix MT7615_CFEND_RATE_DEFAULT value
Ryder Lee [Sat, 21 Dec 2019 07:17:00 +0000 (15:17 +0800)]
mt76: mt7615: fix MT7615_CFEND_RATE_DEFAULT value

Fix default CFEND_RATE and replace hardcode values.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: minor mt76x02_mac_set_beacon optimization
Stanislaw Gruszka [Fri, 29 Nov 2019 12:32:28 +0000 (13:32 +0100)]
mt76: mt76x02: minor mt76x02_mac_set_beacon optimization

We do not call mt76x02_mac_set_beacon() with NULL skb any longer and
we do not need to return error value.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02u: do not set NULL beacons
Stanislaw Gruszka [Fri, 29 Nov 2019 12:32:27 +0000 (13:32 +0100)]
mt76: mt76x02u: do not set NULL beacons

With current implementation we do not cleanup beacon memory, so is not
needed to call mt76x02_mac_set_beacon() with NULL skb.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: usb: use max packet length for m76u_copy
Stanislaw Gruszka [Fri, 29 Nov 2019 12:32:26 +0000 (13:32 +0100)]
mt76: usb: use max packet length for m76u_copy

For transferring data over USB the optimal size is endpoint maxpacket.
For my hardware maxpaket for control endpoint is 64 bytes and changing
to this value from 128 bytes further shorten TBTT work time from
3ms to 1ms.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: add channel switch support for usb interfaces
Markus Theil [Wed, 18 Dec 2019 16:07:54 +0000 (17:07 +0100)]
mt76: mt76x02: add channel switch support for usb interfaces

This patch enables channel switch support on mt76 usb interfaces.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: speed up usb bulk copy
Markus Theil [Wed, 18 Dec 2019 16:07:53 +0000 (17:07 +0100)]
mt76: speed up usb bulk copy

Use larger batches for usb copy to speed this operation up. Otherwise it
would be too slow for copying new beacons or broadcast frames over usb.
Assure, that always a multiple of 4 Bytes is copied, as outlined in
850e8f6fbd "mt76: round up length on mt76_wr_copy" from Felix Fietkau.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: remove a copy call for usb speedup
Markus Theil [Wed, 18 Dec 2019 16:07:52 +0000 (17:07 +0100)]
mt76: mt76x02: remove a copy call for usb speedup

This patch removes a mt76_wr_copy call from the beacon path to hw.
The skb which is used in this place gets therefore build with txwi
inside its data. For mt76 usb drivers, this saves one synchronuous
copy call over usb, which lets the beacon work complete faster.

In mmio case, there is not enough headroom to put the txwi into the
skb, it is therefore using an additional mt76_wr_copy, which is fast
over mmio. Thanks Stanislaw for pointing this out.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: add check for invalid vif idx
Markus Theil [Wed, 18 Dec 2019 16:07:51 +0000 (17:07 +0100)]
mt76: mt76x02: add check for invalid vif idx

On adding vifs the idx can become 1 + (7 & 7) = 8 for APs.
Check against that, as only AP vif idx 0-7 is possible.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: split beaconing
Markus Theil [Wed, 18 Dec 2019 16:07:50 +0000 (17:07 +0100)]
mt76: mt76x02: split beaconing

Sending beacons to the hardware always happens in batches. In order to
speed up beacon processing on usb devices, this patch splits out common
code an calls it only once.

Beacons are sequentially written into the beacon memory area, by
tracking its usage with the dev->beacon_data_count. For MBSS support
and buffered traffic dev->beacon_data_count is used to create the bypass
mask.

The code is also adapted for the mmio part of the driver, but should not
have any performance implication there.

MBSS tests were performed with AVM AC860 USB NIC with temporary support
for 5 BSS'. Different combinations of active vifs were created and
brought up. Afterwards connection and data transfer was tested for the
announced BSS'.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: omit beacon slot clearing
Markus Theil [Wed, 18 Dec 2019 16:07:49 +0000 (17:07 +0100)]
mt76: mt76x02: omit beacon slot clearing

mt76 hw does not send beacons from beacon slots, if the corresponding
bitmask is set accordingly. Therefore we can omit clearing the beacon
memory. Clearing uses many usb calls, if usb drivers are used. These
calls unnecessarily slow down the beacon tasklet. Thanks to Stanislaw
Gruzska for pointing this out.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: use AC specific reorder timeout
Markus Theil [Sat, 14 Dec 2019 09:58:59 +0000 (10:58 +0100)]
mt76: use AC specific reorder timeout

Before this patch, mt76 handled rx traffic for all TIDs equally,
when released from reorder buffer early. This patch uses an AC specific
reorder timeout, in order to release partial aggregated frames for video
ACs earlier. Voice ACs are currently not aggregated (thanks to Felix for
this hint). For example, ath10k also uses AC specific reorder timeouts
(reported by firmware in that case).

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add set_coverage class support
Lorenzo Bianconi [Sun, 8 Dec 2019 07:25:40 +0000 (08:25 +0100)]
mt76: mt7615: add set_coverage class support

Add the capability to configure acktimeout for mt7615 driver. Moreover
configure slottime according to the value provided by mac80211

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: set 0 as min coverage_class value
Lorenzo Bianconi [Sun, 8 Dec 2019 07:25:39 +0000 (08:25 +0100)]
mt76: mt7603: set 0 as min coverage_class value

Set 0 as minimum configurable value for coverage_class since mt76 does
not support dynack

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x02: fix coverage_class type
Lorenzo Bianconi [Sun, 8 Dec 2019 07:25:38 +0000 (08:25 +0100)]
mt76: mt76x02: fix coverage_class type

Fix coverage_class type in mt76x02_dev data structure since
coverage_class can be negative to enable dynack (just supported by
ath9k). Set 0 as minimum value for coverage_class

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: report firmware version using ethtool
Lorenzo Bianconi [Mon, 9 Dec 2019 19:58:59 +0000 (20:58 +0100)]
mt76: mt7615: report firmware version using ethtool

Print fw_ver and build_date members of struct mt7615_fw_trailer
similarly to what appears in the output of 'dmesg' when the MCU firmware
is loaded.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: Fix build with older compilers
Pablo Greco [Sun, 1 Dec 2019 18:17:10 +0000 (15:17 -0300)]
mt76: mt7615: Fix build with older compilers

Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
FIELD_GET inside an inline function, which ends up in a BUILD_BUG_ON.
Convert inline function to a macro.

Fixes commit bf92e7685100 ("mt76: mt7615: add support for per-chain
signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Pablo Greco <pgreco@centosproject.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agodt-bindings: net: wireless: mt76: introduce big-endian property
Lorenzo Bianconi [Wed, 27 Nov 2019 14:46:34 +0000 (16:46 +0200)]
dt-bindings: net: wireless: mt76: introduce big-endian property

Introduce big-endian property to specify mtd radio partition endianness

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: eeprom: add support for big endian eeprom partition
Lorenzo Bianconi [Wed, 27 Nov 2019 14:46:33 +0000 (16:46 +0200)]
mt76: eeprom: add support for big endian eeprom partition

mt76x0e users reported some devices (e.g TP-Link Archer VR200v) have
been flashed with big endian radio partition. Add the possibility to
specify eeprom endianness using big-endian dts property and in case
covert eeprom data in little endian

Tested-by: Kevin Schmidt <kevin.patrick.schmidt@googlemail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: reset STA_CCA counter setting the channel
Lorenzo Bianconi [Thu, 21 Nov 2019 08:42:13 +0000 (10:42 +0200)]
mt76: mt7603: reset STA_CCA counter setting the channel

Reset MT_MIB_STAT_CCA after channel switch since it is used to track busy
time starting from 'commit dcff8d4dc301 ("mt76: mt7603: switch to a
different counter for survey busy time")'

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: fix possible undetected invalid MAC address
Shayne Chen [Tue, 26 Nov 2019 13:15:54 +0000 (21:15 +0800)]
mt76: fix possible undetected invalid MAC address

Make sure the MAC address is checked before function returns.

If CONFIG_OF is set and the device node is null, the function will
return directly, and an invalid MAC address will not be checked.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: disable bh in mt76_dma_rx_poll
Felix Fietkau [Thu, 5 Dec 2019 16:46:42 +0000 (17:46 +0100)]
mt76: disable bh in mt76_dma_rx_poll

Fixes potential RCU issues and avoids calling ieee80211_rx_napi with softirq
enabled.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: fix rx dma ring descriptor state on reset
Felix Fietkau [Thu, 5 Dec 2019 16:32:41 +0000 (17:32 +0100)]
mt76: fix rx dma ring descriptor state on reset

To avoid having the hardware potentially write to memory behind stale
descriptors, set the dma-done flag on all of them before cleaning up
allocated rx buffers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt7615: replace sta_state callback with sta_add/sta_remove
Felix Fietkau [Thu, 5 Dec 2019 13:26:13 +0000 (14:26 +0100)]
mt7615: replace sta_state callback with sta_add/sta_remove

The MT7615 firmware needs to know the association id at creation time,
which is unavailable during the transition from notexist to none in
.sta_state.
This can cause a number of issues, probably also breaking powersave
support.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: defer mcu initialization via workqueue
Felix Fietkau [Thu, 5 Dec 2019 10:36:51 +0000 (11:36 +0100)]
mt76: mt7615: defer mcu initialization via workqueue

Loading the mcu firmware and waiting for it to boot takes a long time,
which adds a significant amount to the system boot time.
Fix this by running the mcu init from a workqueue and waiting for it to
complete before starting the phy or issuing mcu commands via debugfs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: update beacon contents on BSS_CHANGED_BEACON
Felix Fietkau [Wed, 6 Nov 2019 19:18:28 +0000 (20:18 +0100)]
mt76: mt7615: update beacon contents on BSS_CHANGED_BEACON

Beacon changes need to be sent to the firmware, otherwise it will
keep sending stale data

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add support for registering a second wiphy via debugfs
Felix Fietkau [Wed, 30 Oct 2019 22:27:48 +0000 (23:27 +0100)]
mt76: mt7615: add support for registering a second wiphy via debugfs

This is only used for testing for now. In the future it will be possible to
enable the second PHY through an proper API via device tree

Running:
 echo 1 > /sys/kernel/debug/ieee80211/phyX/mt76/dbdc

will register a second wiphy (and limit the primary one to 2 spatial streams).
The second wiphy will only be able to run on 5 GHz, while the primary one can
operate in both bands (if supported by the device).

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: select the correct tx queue for frames sent to the second phy
Felix Fietkau [Tue, 5 Nov 2019 11:55:18 +0000 (12:55 +0100)]
mt76: mt7615: select the correct tx queue for frames sent to the second phy

Beacons and management frames need to explicitly select the alternate tx
queues in order to be sent out on the right phy

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: move radio/mac initialization to .start/stop callbacks
Felix Fietkau [Thu, 31 Oct 2019 13:53:03 +0000 (14:53 +0100)]
mt76: mt7615: move radio/mac initialization to .start/stop callbacks

Run initialization per phy

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: initialize dbdc settings on interface add
Felix Fietkau [Wed, 30 Oct 2019 18:06:19 +0000 (19:06 +0100)]
mt76: mt7615: initialize dbdc settings on interface add

Use the first two WMM slots for the primary phy and the second two for the
secondary phy.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add multiple wiphy support to the rx path
Felix Fietkau [Wed, 30 Oct 2019 16:50:57 +0000 (17:50 +0100)]
mt76: mt7615: add multiple wiphy support to the rx path

Program the RMAC CHFREQ registers to properly indicate the band that the
frames are received on.
Add some sanity checks to the programmed values, because the firmware
programs these registers differently

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: rework chainmask handling
Felix Fietkau [Wed, 30 Oct 2019 13:16:28 +0000 (14:16 +0100)]
mt76: mt7615: rework chainmask handling

Move chainmask to struct mt7615_phy and instead of needlessly making the
format similar to values for older chips, make it refer to the actual chain
bits used for the rx/tx path.
This is important for multiple wiphy support, where for a secondary phy,
antenna_mask will start at 0, and chainmask will start at the chain offset
(bit 2)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add multiple wiphy support to the dfs support code
Felix Fietkau [Wed, 30 Oct 2019 12:11:27 +0000 (13:11 +0100)]
mt76: mt7615: add multiple wiphy support to the dfs support code

There are two DFS detectors on the chip. When using 160 MHz channel bandwidth
(not supported in dual-wiphy mode), both are used. Otherwise, one detector is
used per wiphy.
Rework the code to start/stop them separately per phy and to indicate the
radar event on the right phy based on the detector index

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: remove useless MT_HW_RDD0/1 enum
Felix Fietkau [Wed, 30 Oct 2019 10:19:10 +0000 (11:19 +0100)]
mt76: mt7615: remove useless MT_HW_RDD0/1 enum

Writing 0/1 is shorter and just as clear

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add missing register init for dual-wiphy support
Felix Fietkau [Wed, 30 Oct 2019 10:02:38 +0000 (11:02 +0100)]
mt76: mt7615: add missing register init for dual-wiphy support

Initialize low-power beacon mode setting

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add multiple wiphy support for smart carrier sense
Felix Fietkau [Sat, 26 Oct 2019 07:30:42 +0000 (09:30 +0200)]
mt76: mt7615: add multiple wiphy support for smart carrier sense

Use per-phy radio stats and tuning registers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add dual-phy support for mac80211 ops
Felix Fietkau [Tue, 15 Oct 2019 19:08:49 +0000 (21:08 +0200)]
mt76: mt7615: add dual-phy support for mac80211 ops

Allows them to be used by a separately registered wiphy later

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: do not overwrite max_tx_fragments if it has been set
Shayne Chen [Sat, 14 Dec 2019 11:22:04 +0000 (19:22 +0800)]
mt76: do not overwrite max_tx_fragments if it has been set

Prevent the overwriting of max_tx_fragments if it has already been set
in chip-specific init routine.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move ampdu_ref from mt76_dev to driver struct
Felix Fietkau [Wed, 6 Nov 2019 19:04:56 +0000 (20:04 +0100)]
mt76: move ampdu_ref from mt76_dev to driver struct

It is only used by the driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add ext_phy field to struct mt76_wcid
Felix Fietkau [Mon, 4 Nov 2019 14:16:59 +0000 (15:16 +0100)]
mt76: add ext_phy field to struct mt76_wcid

Will be used to determine the phy from within the driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add function for allocating an extra wiphy
Felix Fietkau [Wed, 30 Oct 2019 20:54:41 +0000 (21:54 +0100)]
mt76: add function for allocating an extra wiphy

Unlike the core phy, this will have extra allocated memory for a driver
private struct.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add priv pointer to struct mt76_phy
Felix Fietkau [Wed, 30 Oct 2019 19:33:05 +0000 (20:33 +0100)]
mt76: add priv pointer to struct mt76_phy

Will be used for per-phy driver private data

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add multiple wiphy support to mt76_get_min_avg_rssi
Felix Fietkau [Wed, 16 Oct 2019 14:14:12 +0000 (16:14 +0200)]
mt76: add multiple wiphy support to mt76_get_min_avg_rssi

Allow tracking clients of both wiphys separately

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move txpower and antenna mask to struct mt76_phy
Felix Fietkau [Wed, 16 Oct 2019 10:41:48 +0000 (12:41 +0200)]
mt76: move txpower and antenna mask to struct mt76_phy

Adds multiple wiphy support to mt76_get_txpower

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move txpower_conf back to driver specific structs
Felix Fietkau [Wed, 16 Oct 2019 10:36:16 +0000 (12:36 +0200)]
mt76: move txpower_conf back to driver specific structs

Nothing in the core uses it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move chainmask back to driver specific structs
Felix Fietkau [Wed, 16 Oct 2019 10:31:46 +0000 (12:31 +0200)]
mt76: move chainmask back to driver specific structs

Nothing in the core uses it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move state from struct mt76_dev to mt76_phy
Felix Fietkau [Wed, 16 Oct 2019 10:09:22 +0000 (12:09 +0200)]
mt76: move state from struct mt76_dev to mt76_phy

Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: keep a set of software tx queues per phy
Felix Fietkau [Mon, 14 Oct 2019 08:57:03 +0000 (10:57 +0200)]
mt76: keep a set of software tx queues per phy

Allows tracking tx scheduling separately per phy

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move channel state to struct mt76_phy
Felix Fietkau [Sat, 12 Oct 2019 17:46:40 +0000 (19:46 +0200)]
mt76: move channel state to struct mt76_phy

Add support for an extra wiphy in mt76_set_channel and mt76_get_survey
This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add support for an extra wiphy in mt76_sta_state()
Felix Fietkau [Sat, 12 Oct 2019 15:42:00 +0000 (17:42 +0200)]
mt76: add support for an extra wiphy in mt76_sta_state()

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add support for an extra wiphy in the tx status path
Felix Fietkau [Fri, 11 Oct 2019 20:57:08 +0000 (22:57 +0200)]
mt76: add support for an extra wiphy in the tx status path

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add support for an extra wiphy in the main tx path
Felix Fietkau [Fri, 11 Oct 2019 21:27:20 +0000 (23:27 +0200)]
mt76: add support for an extra wiphy in the main tx path

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add support for an extra wiphy in the rx path
Felix Fietkau [Fri, 11 Oct 2019 20:30:47 +0000 (22:30 +0200)]
mt76: add support for an extra wiphy in the rx path

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: introduce struct mt76_phy
Felix Fietkau [Mon, 30 Sep 2019 20:09:06 +0000 (22:09 +0200)]
mt76: introduce struct mt76_phy

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

On the first wiphy, hw->priv will point to struct mt76_dev, which contains a
struct mt76_phy at the start. For the secondary wiphy, hw->priv will point
to a mt76_phy encapsulated in a driver specific struct

To simplify access to struct mt76_phy members from drivers, the driver specific
device struct is changed to add a union of struct mt76_dev and struct mt76_phy
as the first element

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: move initialization of some struct members to mt76_alloc_device
Felix Fietkau [Mon, 30 Sep 2019 19:23:03 +0000 (21:23 +0200)]
mt76: move initialization of some struct members to mt76_alloc_device

Reduces duplication and prepares for further rework

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agortw88: Fix incorrect beamformee role setting
Tzu-En Huang [Fri, 7 Feb 2020 08:47:29 +0000 (16:47 +0800)]
rtw88: Fix incorrect beamformee role setting

In associating and configuring beamformee, bfee->role is not
correctly set before rtw_chip_ops::config_bfee().
Fix it by setting it correctly.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: 8822[bc]: Make tables const, reduce data object size
Joe Perches [Thu, 6 Feb 2020 10:54:38 +0000 (02:54 -0800)]
rtw88: 8822[bc]: Make tables const, reduce data object size

Reduce the data size 2kb or 3kb by making tables const.
Add const to pointer declarations to make compilation work too.

(x86-64 defconfig)
$ size drivers/net/wireless/realtek/rtw88/rtw8822?.o*
   text    data     bss     dec     hex filename
  25054     672       8   25734    6486 drivers/net/wireless/realtek/rtw88/rtw8822b.o.new
  23870    1872       8   25750    6496 drivers/net/wireless/realtek/rtw88/rtw8822b.o.old
  53646     828       0   54474    d4ca drivers/net/wireless/realtek/rtw88/rtw8822c.o.new
  52846    1652       0   54498    d4e2 drivers/net/wireless/realtek/rtw88/rtw8822c.o.old

(x86-64 allyesconfig)
$ size drivers/net/wireless/realtek/rtw88/rtw8822?.o*
   text    data     bss     dec     hex filename
  45811    6280     128   52219    cbfb drivers/net/wireless/realtek/rtw88/rtw8822b.o.new
  44211    7880     128   52219    cbfb drivers/net/wireless/realtek/rtw88/rtw8822b.o.old
 100195    8128       0  108323   1a723 drivers/net/wireless/realtek/rtw88/rtw8822c.o.new
  98947    9376       0  108323   1a723 drivers/net/wireless/realtek/rtw88/rtw8822c.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: disable TX-AMSDU on 2.4G band
Yan-Hsuan Chuang [Tue, 4 Feb 2020 12:06:14 +0000 (20:06 +0800)]
rtw88: disable TX-AMSDU on 2.4G band

Some tests shows that using AMSDU to aggregate TCP ACKs to specific
APs will degrade the throughput on 2.4G band in 20MHz bandwidth
(< 10 Mbps, should be ~100 Mbps for 2x2). Also found that there's
barely no negative impact if we disable TX AMSDU on 2.4G to connect
to other APs. So it seems like we can just tell mac80211 to not to
aggregate MSDUs when transmitting on 2.4G band.

Note that we still can TX AMSDU on 5G band and benefit from it by
having 50 ~ 70 Mbps throughput improvement.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: 8822c: modify rf protection setting
Chien-Hsun Liao [Thu, 30 Jan 2020 05:31:12 +0000 (13:31 +0800)]
rtw88: 8822c: modify rf protection setting

According to some experiments, the original RF register protection
setting of 8822c cannot perfectly make sure that there is no hardware
PI write (direct) during direct write. Modify the setting so that the
hardware block of PI would be turned off via rtw8822c_rstb_3wire()
during the direct write, to avoid RF register racing.

Note that 8822b uses SIPI write (indirect), so 8822b does not
have such problem.

Signed-off-by: Chien-Hsun Liao <ben.liao@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Use secondary channel offset enumeration
Ping-Ke Shih [Thu, 30 Jan 2020 05:31:11 +0000 (13:31 +0800)]
rtw88: Use secondary channel offset enumeration

The hardware value of secondary channel offset isn't very intuitive. This
commit adds enumeration, so we can easier to check the logic with the
suffix of enumeration name, likes _UPPER or _LOWER.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: Use kfree_skb() instead of kfree()
Dan Carpenter [Wed, 29 Jan 2020 17:39:24 +0000 (20:39 +0300)]
rtw88: Use kfree_skb() instead of kfree()

sk_buff structs need to be freed with kfree_skb(), not kfree().

Fixes: b6c12908a33e ("rtw88: Add wowlan net-detect support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agorsi: fix null pointer dereference during rsi_shutdown()
Martin Kepplinger [Wed, 29 Jan 2020 13:02:59 +0000 (14:02 +0100)]
rsi: fix null pointer dereference during rsi_shutdown()

Appearently the hw pointer can be NULL while the module is loaded and
in that case rsi_shutdown() crashes due to the unconditional dereference.

Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: 8822c: update power sequence to v16
Tzu-En Huang [Wed, 5 Feb 2020 07:08:58 +0000 (15:08 +0800)]
rtw88: 8822c: update power sequence to v16

Fix switching xtal mode leads to BT USB error issue.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add ciphers to suppress error message
Ping-Ke Shih [Wed, 5 Feb 2020 07:08:57 +0000 (15:08 +0800)]
rtw88: add ciphers to suppress error message

Though hardware isn't implement CCMP-256, GCMP and GCMP-256, it's possible
to fallback to use software de-/en-cryption implemented by mac80211.

Without adding these chipers, kernel log will show something if we connect
to a WPA3 enterprise AP, likes
  wlan0: failed to set key (1, ff:ff:ff:ff:ff:ff) to hardware (-524)

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: avoid holding mutex for cancel_delayed_work_sync()
Yan-Hsuan Chuang [Wed, 5 Feb 2020 07:08:56 +0000 (15:08 +0800)]
rtw88: avoid holding mutex for cancel_delayed_work_sync()

Driver could possibly be dead-locked while canceling works with
*_sync() with mutex lock held. Those cancel_delayed_work_sync()
functions will wait until the work is done, but if we hold the
lock, they will never acquire the lock.

To prevent this, simply release the lock and acquire again after
the works have been canceled. And to avoid the works being queued
again, check if the device is at RTW_FLAG_RUNNING state, otherwise
just return and do nothing.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: move rtw_enter_ips() to the last when config
Ping-Ke Shih [Wed, 5 Feb 2020 07:08:55 +0000 (15:08 +0800)]
rtw88: move rtw_enter_ips() to the last when config

When driver is coming up, mac80211 will set changed as ~0 (0xffffffff),
and driver could enter IDLE state (power off) before switching channel or
other config event. So move rtw_enter_ips() to the last, to make sure the
driver completed the config events before going to IDLE state.

So, moves leave/enter IPS config to be first/last one according to flag
IEEE80211_CONF_IDLE. If there're more configureations we want to add in
the future, they must locate between leave/enter IPS.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: pci: 8822c should set clock delay to zero
Yan-Hsuan Chuang [Wed, 5 Feb 2020 07:08:54 +0000 (15:08 +0800)]
rtw88: pci: 8822c should set clock delay to zero

Since RTL8822CE has enabled reference clock auto calibration,
there is no need to add any clock delay for covering the timing
gap of the reference clock.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: add rtw_read8_mask and rtw_read16_mask
Yan-Hsuan Chuang [Wed, 5 Feb 2020 07:08:53 +0000 (15:08 +0800)]
rtw88: add rtw_read8_mask and rtw_read16_mask

Both are missing but could be used sometimes.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agortw88: remove unused parameter vif in rtw_lps_pg_info_get()
Yan-Hsuan Chuang [Wed, 5 Feb 2020 07:08:52 +0000 (15:08 +0800)]
rtw88: remove unused parameter vif in rtw_lps_pg_info_get()

vif is not used, remove it

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: abort and release host after error
Guenter Roeck [Tue, 28 Jan 2020 22:14:57 +0000 (14:14 -0800)]
brcmfmac: abort and release host after error

With commit 216b44000ada ("brcmfmac: Fix use after free in
brcmf_sdio_readframes()") applied, we see locking timeouts in
brcmf_sdio_watchdog_thread().

brcmfmac: brcmf_escan_timeout: timer expired
INFO: task brcmf_wdog/mmc1:621 blocked for more than 120 seconds.
Not tainted 4.19.94-07984-g24ff99a0f713 #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
brcmf_wdog/mmc1 D    0   621      2 0x00000000 last_sleep: 2440793077.  last_runnable: 2440766827
[<c0aa1e60>] (__schedule) from [<c0aa2100>] (schedule+0x98/0xc4)
[<c0aa2100>] (schedule) from [<c0853830>] (__mmc_claim_host+0x154/0x274)
[<c0853830>] (__mmc_claim_host) from [<bf10c5b8>] (brcmf_sdio_watchdog_thread+0x1b0/0x1f8 [brcmfmac])
[<bf10c5b8>] (brcmf_sdio_watchdog_thread [brcmfmac]) from [<c02570b8>] (kthread+0x178/0x180)

In addition to restarting or exiting the loop, it is also necessary to
abort the command and to release the host.

Fixes: 216b44000ada ("brcmfmac: Fix use after free in brcmf_sdio_readframes()")
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Matthias Kaehlcke <mka@chromium.org>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: franky.lin@broadcom.com
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: fix potential Spectre vulnerabilities
Sergey Matyukevich [Mon, 27 Jan 2020 10:46:58 +0000 (10:46 +0000)]
qtnfmac: fix potential Spectre vulnerabilities

Fix potential Spectre vulnerabilities and other warnings
reported by smatch:

drivers/net/wireless/quantenna/qtnfmac/core.c:49 qtnf_core_get_mac() warn: potential spectre issue 'bus->mac' [r] (local cap)
drivers/net/wireless/quantenna/qtnfmac/core.c:51 qtnf_core_get_mac() warn: possible spectre second half.  'mac'
drivers/net/wireless/quantenna/qtnfmac/event.c:671 qtnf_event_parse() warn: potential spectre issue 'mac->iflist' [r] (local cap)
drivers/net/wireless/quantenna/qtnfmac/pcie/pearl_pcie.c:912 qtnf_pcie_skb_send() warn: variable dereferenced before check 'skb' (see line 881)

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: drop unnecessary TLVs from scan command
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:56 +0000 (10:46 +0000)]
qtnfmac: drop unnecessary TLVs from scan command

Most part of scan command data is always present, so no need
to keep it in TLV. Simplify scan command processing moving
most part of its parameters into a fixed part of
qlink_cmd_scan message.

Use fixed dwell time values for normal scan when device is not
connected, and allow wireless card decide on dwell times by
itself if it's operating as a STA and is connected. When
connected, card can select dwell times dynamically based on
traffic conditions to get best results.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: update channel switch command to support 6GHz band
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:55 +0000 (10:46 +0000)]
qtnfmac: update channel switch command to support 6GHz band

With an addition of 6GHz band support, channel number can no longer be
used to uniquely identify a specific channel. Modify channel switch
command to use chandef data.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: cleanup alignment in firmware communication protocol
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:53 +0000 (10:46 +0000)]
qtnfmac: cleanup alignment in firmware communication protocol

Make sure that all elements in QLINK protocol message are aligned to
4 bytes. For this purpose add necessary amount of padding bytes to
each message. Besides, add padding for non-aligned variable length
fields, e.g. SSID, so that the first byte of the next variable length
element is aligned. to 4 bytes. Finally, introduce TLV parsing helpers
to reduce boilerplate TLV parsing code.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: pass max scan SSIDs limit on per-radio basis
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:52 +0000 (10:46 +0000)]
qtnfmac: pass max scan SSIDs limit on per-radio basis

Each radio on a given wifi device may have different max scan SSIDs
limitation, so take this information from a per-radio info structure.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: implement extendable channel survey dump
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:50 +0000 (10:46 +0000)]
qtnfmac: implement extendable channel survey dump

Switch to extendable implementation of channel survey dump to make sure
that any new channel statistics can be added in the future without any
backwards compatibility issues. For this purpose use a separate variable
length bitmap to pass the list of valid statistics in firmware response.
Besides, switch to using channel frequency instead of IEEE channel
number to prepare for adding support of 6GHz band.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: drop QTN_TLV_ID_NUM_IFACE_COMB TLV type
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:49 +0000 (10:46 +0000)]
qtnfmac: drop QTN_TLV_ID_NUM_IFACE_COMB TLV type

Information about interface combinations is now available in a fixed
portion of struct qlink_resp_get_mac_info. Use that information to
get interface combinations. TLV type QTN_TLV_ID_NUM_IFACE_COMB is
not needed anymore and can be dropped.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: merge PHY_PARAMS_GET into MAC_INFO
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:47 +0000 (10:46 +0000)]
qtnfmac: merge PHY_PARAMS_GET into MAC_INFO

QLINK_CMD_PHY_PARAMS_GET command does not need to be separate,
it can be included into GET_MAC_INFO command. Merge these two
commands adding all the missing wiphy data.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: pass hardware capabilities in TLV element
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:46 +0000 (10:46 +0000)]
qtnfmac: pass hardware capabilities in TLV element

To support any number of capabilities bits in the future,
replace u32 capabilities bitmask by array. Pass
capabilities from firmware using TLV element.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoqtnfmac: use MAJOR.MINOR format for firmware protocol
Igor Mitsyanko [Mon, 27 Jan 2020 10:46:44 +0000 (10:46 +0000)]
qtnfmac: use MAJOR.MINOR format for firmware protocol

Use MAJOR.MINOR format for QLink firmware protocol. MAJOR part is
incremented when backward compatibility is broken. Normally this
part should not be incremented unless there is a good reason for
that. MINOR part is incremented each time when new features are
added to qlink.h, e.g. new TLVs, events, commands. These changes
should not break backward compatibility. For instance, older
firmware versions may not be able to parse new flags or send new
types of events, but this does not impact normal system operations.

As part of initialization sequence, driver requests protocol version
from firmware and refuses to start in case there is a mismatch in MAJOR
part of the version.

Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agowl1251: remove ti,power-gpio for SDIO mode
H. Nikolaus Schaller [Sun, 26 Jan 2020 20:00:14 +0000 (21:00 +0100)]
wl1251: remove ti,power-gpio for SDIO mode

Remove handling of this property from code.

Note that wl->power_gpio is still needed in
the header file for SPI mode (N900).

Suggested by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoDTS: bindings: wl1251: mark ti,power-gpio as optional
H. Nikolaus Schaller [Sun, 26 Jan 2020 20:00:13 +0000 (21:00 +0100)]
DTS: bindings: wl1251: mark ti,power-gpio as optional

It is now only useful for SPI interface.
Power control of SDIO mode is done through mmc core.

Suggested by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agobrcmfmac: add the BRCM 4364 found in MacBook Pro 15,2
brian m. carlson [Sun, 26 Jan 2020 19:33:39 +0000 (19:33 +0000)]
brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2

The 2018 13" MacBook Pro (MacBookPro15,2) has a Broadcom chip, the 4364.
This chip appears to be specific to Apple and is not found in other
hardware.

Add this chip to the brcmfmac driver so that it can be recognized
automatically.  Note that the PCI device id is 4464 even though the chip
is referred to as the 4364.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 years agoLinux 5.6-rc1
Linus Torvalds [Mon, 10 Feb 2020 00:08:48 +0000 (16:08 -0800)]
Linux 5.6-rc1

4 years agoMerge tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
Linus Torvalds [Mon, 10 Feb 2020 00:05:50 +0000 (16:05 -0800)]
Merge tag 'kbuild-v5.6-2' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada:

 - fix randconfig to generate a sane .config

 - rename hostprogs-y / always to hostprogs / always-y, which are more
   natual syntax.

 - optimize scripts/kallsyms

 - fix yes2modconfig and mod2yesconfig

 - make multiple directory targets ('make foo/ bar/') work

* tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: make multiple directory targets work
  kconfig: Invalidate all symbols after changing to y or m.
  kallsyms: fix type of kallsyms_token_table[]
  scripts/kallsyms: change table to store (strcut sym_entry *)
  scripts/kallsyms: rename local variables in read_symbol()
  kbuild: rename hostprogs-y/always to hostprogs/always-y
  kbuild: fix the document to use extra-y for vmlinux.lds
  kconfig: fix broken dependency in randconfig-generated .config

4 years agoMerge tag 'zonefs-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal...
Linus Torvalds [Sun, 9 Feb 2020 23:51:46 +0000 (15:51 -0800)]
Merge tag 'zonefs-5.6-rc1' of git://git./linux/kernel/git/dlemoal/zonefs

Pull new zonefs file system from Damien Le Moal:
 "Zonefs is a very simple file system exposing each zone of a zoned
  block device as a file.

  Unlike a regular file system with native zoned block device support
  (e.g. f2fs or the on-going btrfs effort), zonefs does not hide the
  sequential write constraint of zoned block devices to the user. As a
  result, zonefs is not a POSIX compliant file system. Its goal is to
  simplify the implementation of zoned block devices support in
  applications by replacing raw block device file accesses with a richer
  file based API, avoiding relying on direct block device file ioctls
  which may be more obscure to developers.

  One example of this approach is the implementation of LSM
  (log-structured merge) tree structures (such as used in RocksDB and
  LevelDB) on zoned block devices by allowing SSTables to be stored in a
  zone file similarly to a regular file system rather than as a range of
  sectors of a zoned device. The introduction of the higher level
  construct "one file is one zone" can help reducing the amount of
  changes needed in the application while at the same time allowing the
  use of zoned block devices with various programming languages other
  than C.

  Zonefs IO management implementation uses the new iomap generic code.
  Zonefs has been successfully tested using a functional test suite
  (available with zonefs userland format tool on github) and a prototype
  implementation of LevelDB on top of zonefs"

* tag 'zonefs-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
  zonefs: Add documentation
  fs: New zonefs file system

4 years agoirqchip/gic-v4.1: Avoid 64bit division for the sake of 32bit ARM
Marc Zyngier [Sun, 9 Feb 2020 22:48:50 +0000 (22:48 +0000)]
irqchip/gic-v4.1: Avoid 64bit division for the sake of 32bit ARM

In order to allow the GICv4 code to link properly on 32bit ARM,
make sure we don't use 64bit divisions when it isn't strictly
necessary.

Fixes: 4e6437f12d6e ("irqchip/gic-v4.1: Ensure L2 vPE table is allocated at RD level")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4 years agoMerge tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sun, 9 Feb 2020 21:27:17 +0000 (13:27 -0800)]
Merge tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "13 cifs/smb3 patches, most from testing at the SMB3 plugfest this week:

   - Important fix for multichannel and for modefromsid mounts.

   - Two reconnect fixes

   - Addition of SMB3 change notify support

   - Backup tools fix

   - A few additional minor debug improvements (tracepoints and
     additional logging found useful during testing this week)"

* tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6:
  smb3: Add defines for new information level, FileIdInformation
  smb3: print warning once if posix context returned on open
  smb3: add one more dynamic tracepoint missing from strict fsync path
  cifs: fix mode bits from dir listing when mounted with modefromsid
  cifs: fix channel signing
  cifs: add SMB3 change notification support
  cifs: make multichannel warning more visible
  cifs: fix soft mounts hanging in the reconnect code
  cifs: Add tracepoints for errors on flush or fsync
  cifs: log warning message (once) if out of disk space
  cifs: fail i/o on soft mounts if sessionsetup errors out
  smb3: fix problem with null cifs super block with previous patch
  SMB3: Backup intent flag missing from some more ops

4 years agoMerge branch 'work.vboxsf' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sun, 9 Feb 2020 20:41:00 +0000 (12:41 -0800)]
Merge branch 'work.vboxsf' of git://git./linux/kernel/git/viro/vfs

Pull vboxfs from Al Viro:
 "This is the VirtualBox guest shared folder support by Hans de Goede,
  with fixups for fs_parse folded in to avoid bisection hazards from
  those API changes..."

* 'work.vboxsf' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: Add VirtualBox guest shared folder (vboxsf) support

4 years agoMerge tag 'x86-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 9 Feb 2020 20:11:12 +0000 (12:11 -0800)]
Merge tag 'x86-urgent-2020-02-09' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "A set of fixes for X86:

   - Ensure that the PIT is set up when the local APIC is disable or
     configured in legacy mode. This is caused by an ordering issue
     introduced in the recent changes which skip PIT initialization when
     the TSC and APIC frequencies are already known.

   - Handle malformed SRAT tables during early ACPI parsing which caused
     an infinite loop anda boot hang.

   - Fix a long standing race in the affinity setting code which affects
     PCI devices with non-maskable MSI interrupts. The problem is caused
     by the non-atomic writes of the MSI address (destination APIC id)
     and data (vector) fields which the device uses to construct the MSI
     message. The non-atomic writes are mandated by PCI.

     If both fields change and the device raises an interrupt after
     writing address and before writing data, then the MSI block
     constructs a inconsistent message which causes interrupts to be
     lost and subsequent malfunction of the device.

     The fix is to redirect the interrupt to the new vector on the
     current CPU first and then switch it over to the new target CPU.
     This allows to observe an eventually raised interrupt in the
     transitional stage (old CPU, new vector) to be observed in the APIC
     IRR and retriggered on the new target CPU and the new vector.

     The potential spurious interrupts caused by this are harmless and
     can in the worst case expose a buggy driver (all handlers have to
     be able to deal with spurious interrupts as they can and do happen
     for various reasons).

   - Add the missing suspend/resume mechanism for the HYPERV hypercall
     page which prevents resume hibernation on HYPERV guests. This
     change got lost before the merge window.

   - Mask the IOAPIC before disabling the local APIC to prevent
     potentially stale IOAPIC remote IRR bits which cause stale
     interrupt lines after resume"

* tag 'x86-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apic: Mask IOAPIC entries when disabling the local APIC
  x86/hyperv: Suspend/resume the hypercall page for hibernation
  x86/apic/msi: Plug non-maskable MSI affinity race
  x86/boot: Handle malformed SRAT tables during early ACPI parsing
  x86/timer: Don't skip PIT setup when APIC is disabled or in legacy mode

4 years agoMerge tag 'smp-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 9 Feb 2020 20:09:43 +0000 (12:09 -0800)]
Merge tag 'smp-urgent-2020-02-09' of git://git./linux/kernel/git/tip/tip

Pull SMP fixes from Thomas Gleixner:
 "Two fixes for the SMP related functionality:

   - Make the UP version of smp_call_function_single() match SMP
     semantics when called for a not available CPU. Instead of emitting
     a warning and assuming that the function call target is CPU0,
     return a proper error code like the SMP version does.

   - Remove a superfluous check in smp_call_function_many_cond()"

* tag 'smp-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  smp/up: Make smp_call_function_single() match SMP semantics
  smp: Remove superfluous cond_func check in smp_call_function_many_cond()

4 years agoMerge tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 9 Feb 2020 20:04:09 +0000 (12:04 -0800)]
Merge tag 'perf-urgent-2020-02-09' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Thomas Gleixner:
 "A set of fixes and improvements for the perf subsystem:

  Kernel fixes:

   - Install cgroup events to the correct CPU context to prevent a
     potential list double add

   - Prevent an integer underflow in the perf mlock accounting

   - Add a missing prototype for arch_perf_update_userpage()

  Tooling:

   - Add a missing unlock in the error path of maps__insert() in perf
     maps.

   - Fix the build with the latest libbfd

   - Fix the perf parser so it does not delete parse event terms, which
     caused a regression for using perf with the ARM CoreSight as the
     sink configuration was missing due to the deletion.

   - Fix the double free in the perf CPU map merging test case

   - Add the missing ustring support for the perf probe command"

* tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf maps: Add missing unlock to maps__insert() error case
  perf probe: Add ustring support for perf probe command
  perf: Make perf able to build with latest libbfd
  perf test: Fix test case Merge cpu map
  perf parse: Copy string to perf_evsel_config_term
  perf parse: Refactor 'struct perf_evsel_config_term'
  kernel/events: Add a missing prototype for arch_perf_update_userpage()
  perf/cgroups: Install cgroup events to correct cpuctx
  perf/core: Fix mlock accounting in perf_mmap()

4 years agoMerge tag 'timers-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 9 Feb 2020 20:00:12 +0000 (12:00 -0800)]
Merge tag 'timers-urgent-2020-02-09' of git://git./linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
 "Two small fixes for the time(r) subsystem:

   - Handle a subtle race between the clocksource watchdog and a
     concurrent clocksource watchdog stop/start sequence correctly to
     prevent a timer double add bug.

   - Fix the file path for the core time namespace file"

* tag 'timers-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource: Prevent double add_timer_on() for watchdog_timer
  MAINTAINERS: Correct path to time namespace source file