platform/kernel/linux-rpi.git
3 years agomt76: mt7921: introduce regdomain notifier support
Lorenzo Bianconi [Wed, 27 Jan 2021 19:33:54 +0000 (03:33 +0800)]
mt76: mt7921: introduce regdomain notifier support

Register regdomain notifier to determine the channel domain the hw scan
should rely on.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce Runtime PM support
Sean Wang [Wed, 27 Jan 2021 19:33:53 +0000 (03:33 +0800)]
mt76: mt7921: introduce Runtime PM support

Introduce runtime PM to mt7921 driver

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: rely on mt76_connac_mcu module for suspend and WoW support
Lorenzo Bianconi [Wed, 27 Jan 2021 19:33:52 +0000 (03:33 +0800)]
mt76: mt7921: rely on mt76_connac_mcu module for suspend and WoW support

Rely on mt76_connac_mcu module for suspend and WoW support and remove
duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: rely on mt76_connac_mcu module for sched_scan and hw_scan
Lorenzo Bianconi [Wed, 27 Jan 2021 19:33:51 +0000 (03:33 +0800)]
mt76: mt7921: rely on mt76_connac_mcu module for sched_scan and hw_scan

Rely on mt76_connac_mcu module for sched_scan and hw_scan and remove
duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: rely on mt76_connac_mcu common library
Lorenzo Bianconi [Wed, 27 Jan 2021 19:33:50 +0000 (03:33 +0800)]
mt76: mt7921: rely on mt76_connac_mcu common library

Rely on mt76_connac_mcu common library and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce PM support
Sean Wang [Wed, 27 Jan 2021 19:33:49 +0000 (03:33 +0800)]
mt76: mt7921: introduce PM support

Introduce suspend/resume and WoW (Wake-on-WoWLAN) support to mt7921
driver to allow remote wakeu-up from the suspend state.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce beacon_loss mcu event
Sean Wang [Wed, 27 Jan 2021 19:33:48 +0000 (03:33 +0800)]
mt76: mt7921: introduce beacon_loss mcu event

If device has enabled beacon hw filter rx beacons are not reported to
the host. Introduce beacon_loss mcu event to trigger mac80211 mlme
connection state machine in this configuration.
IEEE80211_VIF_BEACON_FILTER has not set in vif flags since hw beacon
filter is not enabled yet

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce support for hardware beacon filter
Sean Wang [Wed, 27 Jan 2021 19:33:47 +0000 (03:33 +0800)]
mt76: mt7921: introduce support for hardware beacon filter

Introduce support for hw beacon filter available in the mt7921 firmware.

According to mt7921e firmware, enabling hardware filter would rely on
mt7921_mcu_uni_bss_bcnft and disabling hardware filter still rely on legacy
mt7921_mcu_set_bss_pm.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce 802.11 PS support in sta mode
Sean Wang [Wed, 27 Jan 2021 19:33:46 +0000 (03:33 +0800)]
mt76: mt7921: introduce 802.11 PS support in sta mode

Enable 802.11 power-save support available in mt7921 firmware

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce schedule scan support
Sean Wang [Wed, 27 Jan 2021 19:33:45 +0000 (03:33 +0800)]
mt76: mt7921: introduce schedule scan support

introduce schedule scan to control mt7921 firmware to do background scan in
defined plan to see if the matched SSID is available.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: add debugfs support
Sean Wang [Wed, 27 Jan 2021 19:33:44 +0000 (03:33 +0800)]
mt76: mt7921: add debugfs support

Add debugfs support to dump driver statistics and hardware details.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: introduce mt7921e support
Sean Wang [Wed, 27 Jan 2021 19:33:43 +0000 (03:33 +0800)]
mt76: mt7921: introduce mt7921e support

Introduce support for mt7921e 802.11ax (Wi-Fi 6) 2x2:2SS chipset.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: add ieee80211_ops
Sean Wang [Wed, 27 Jan 2021 19:33:42 +0000 (03:33 +0800)]
mt76: mt7921: add ieee80211_ops

Filling ieee80211_ops with the mt7921 operations.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: add EEPROM support
Sean Wang [Wed, 27 Jan 2021 19:33:41 +0000 (03:33 +0800)]
mt76: mt7921: add EEPROM support

Add EEPROM support to MT7921 to determine the capability the card has
such as indentificaiton, MAC address, the band and antenna number the
card able to support.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: add DMA support
Sean Wang [Wed, 27 Jan 2021 19:33:40 +0000 (03:33 +0800)]
mt76: mt7921: add DMA support

Add DMA and register access support to MT7921e driver to set up the link
for the data movement between the host and MT7921 MAC, or the host and
MT7921 MCU.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: add MCU support
Sean Wang [Wed, 27 Jan 2021 19:33:39 +0000 (03:33 +0800)]
mt76: mt7921: add MCU support

MT7921 contains a microprocessor with which the host can use command/event
to communicate to implement offload features such as establish connection,
hardware scan and so on. The host has to download the ROM patch, RAM
firmware and finally activate the MCU to complete the MT7921
initialization.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7921: add MAC support
Sean Wang [Wed, 27 Jan 2021 19:33:38 +0000 (03:33 +0800)]
mt76: mt7921: add MAC support

Add Rx packet description parsing, Tx packet description compositon, handle
packet recycling and provide MAC information mt76 core needs to support
mac80211.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76_connac: move pm utility routines in mt76_connac_lib module
Lorenzo Bianconi [Tue, 26 Jan 2021 11:13:56 +0000 (12:13 +0100)]
mt76: mt76_connac: move pm utility routines in mt76_connac_lib module

Move power_save common code shared between mt7663 and mt7921 in
mt76_connac module

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76_connac: move pm data struct in mt76_connac.h
Lorenzo Bianconi [Tue, 26 Jan 2021 11:13:55 +0000 (12:13 +0100)]
mt76: mt76_connac: move pm data struct in mt76_connac.h

Move pm mt7663 data structure in mt76_connac.h introducing
mt76_connac_pm data struct. This is a preliminary patch to share pm code
between mt7663 and mt7921

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76_connac: move WoW and suspend code in mt76_connac_mcu module
Lorenzo Bianconi [Tue, 26 Jan 2021 11:13:54 +0000 (12:13 +0100)]
mt76: mt76_connac: move WoW and suspend code in mt76_connac_mcu module

Move WoW and suspend code in mt76_connac_mcu module in order to be reused in
mt7615 and mt7921 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76_connac: move hw_scan and sched_scan routine in mt76_connac_mcu module
Lorenzo Bianconi [Tue, 26 Jan 2021 11:13:53 +0000 (12:13 +0100)]
mt76: mt76_connac: move hw_scan and sched_scan routine in mt76_connac_mcu module

Move hw_scan/sched_scan in mt76_connac_mcu module in order to be reused in
mt7615 and mt7921 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76_connac: create mcu library
Lorenzo Bianconi [Tue, 26 Jan 2021 11:13:52 +0000 (12:13 +0100)]
mt76: mt76_connac: create mcu library

Introduce mt76_connac common mcu library for code sharing between mt7615 and
mt7921 devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: introduce mt76_vif data structure
Lorenzo Bianconi [Tue, 26 Jan 2021 11:13:51 +0000 (12:13 +0100)]
mt76: introduce mt76_vif data structure

Introduce mt76_vif data structure to share common fields between
mt7615_vif and mt7921_vif and create a mcu common library

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: reduce VHT maximum MPDU length
Felix Fietkau [Mon, 25 Jan 2021 21:24:31 +0000 (22:24 +0100)]
mt76: mt7615: reduce VHT maximum MPDU length

With a maximum length of 7991, the radio sometimes locks up under load when
transmitting A-MSDU frames to lots of stations. Using the lower limit makes
it work reliably again

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: reduce q->lock hold time
Felix Fietkau [Sun, 24 Jan 2021 11:25:13 +0000 (12:25 +0100)]
mt76: reduce q->lock hold time

Instead of holding it for the duration of an entire station schedule run,
which can block out competing tasks for a significant amount of time,
only hold it for scheduling one batch of packets for one station.
Improves responsiveness under load

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: usb: process URBs with status EPROTO properly
Lorenzo Bianconi [Fri, 15 Jan 2021 14:18:02 +0000 (15:18 +0100)]
mt76: usb: process URBs with status EPROTO properly

Similar to commit '0e40dbd56d67 ("mt7601u: process URBs in status EPROTO
properly")', do no schedule rx_worker for urb marked with status set
-EPROTO

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move vif_mask back from mt76_phy to mt76_dev
Felix Fietkau [Wed, 20 Jan 2021 12:10:21 +0000 (13:10 +0100)]
mt76: move vif_mask back from mt76_phy to mt76_dev

Since it is global for all drivers, it belongs to the main device

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: make vif index per adapter instead of per band
Felix Fietkau [Wed, 20 Jan 2021 11:36:12 +0000 (12:36 +0100)]
mt76: mt7915: make vif index per adapter instead of per band

The firmware treats it as global, so we need to avoid collisions here

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add support for using a secondary PCIe link for gen1
Felix Fietkau [Tue, 19 Jan 2021 16:41:04 +0000 (17:41 +0100)]
mt76: mt7915: add support for using a secondary PCIe link for gen1

For performance reasons, mt7915 supports using 2 PCIE gen1 links on
platforms that don't support gen2.
Add support for using this to move traffic for a second DBDC band onto
a dedicated link

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: fix crash on tearing down ext phy
Felix Fietkau [Tue, 19 Jan 2021 12:19:53 +0000 (13:19 +0100)]
mt76: fix crash on tearing down ext phy

Only clear dev->phy2 after the phy is gone, the driver may still need to access
it until shutdown is complete

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: bring up the WA event rx queue for band1
Felix Fietkau [Tue, 19 Jan 2021 09:34:31 +0000 (10:34 +0100)]
mt76: mt7915: bring up the WA event rx queue for band1

This is needed for DBDC cards to work correctly on both bands simultaneously

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: unify init work
Felix Fietkau [Mon, 18 Jan 2021 20:07:48 +0000 (21:07 +0100)]
mt76: mt7615: unify init work

Reduce code duplication and remove unnecessary exports

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: support TxBF for DBDC
Ryder Lee [Tue, 19 Jan 2021 03:01:25 +0000 (11:01 +0800)]
mt76: mt7915: support TxBF for DBDC

With this patch, TxBF can be run on both bands simultaneously.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: Remove unneeded semicolon
Xu Wang [Tue, 19 Jan 2021 08:08:05 +0000 (08:08 +0000)]
mt76: mt7915: Remove unneeded semicolon

fix semicolon.cocci warnings:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1694:2-3: Unneeded semicolon

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: set mcu country code in mt7615_mcu_set_channel_domain()
Lorenzo Bianconi [Thu, 14 Jan 2021 15:38:55 +0000 (16:38 +0100)]
mt76: mt7615: set mcu country code in mt7615_mcu_set_channel_domain()

Update mcu country code running mt7615_mcu_set_channel_domain routine in
mt7615_regd_notifier().
Filter out disabled channels in mt7615_mcu_set_channel_domain().

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix eeprom DBDC band selection
Felix Fietkau [Wed, 13 Jan 2021 18:35:59 +0000 (19:35 +0100)]
mt76: mt7915: fix eeprom DBDC band selection

When the EEPROM band fields contain default values, assign 2.4 GHz to the
first band and 5 GHz to the second.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix eeprom parsing for DBDC
Felix Fietkau [Tue, 12 Jan 2021 18:57:43 +0000 (19:57 +0100)]
mt76: mt7915: fix eeprom parsing for DBDC

Annotate WIFI_CONF eeprom mask values with the byte number
Fix parsing per-band number of chains

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: disable RED support in the WA firmware
Felix Fietkau [Wed, 6 Jan 2021 09:43:03 +0000 (10:43 +0100)]
mt76: mt7915: disable RED support in the WA firmware

It causes high CPU load on the WA core, which can lead to extra latency when
using many stations. Dropping packets for long queues is managed by mac80211
fq_codel instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: rework mcu API
Felix Fietkau [Wed, 6 Jan 2021 09:16:27 +0000 (10:16 +0100)]
mt76: mt7915: rework mcu API

Add support for passing flags for selecting the MCU target and query type
instead of trying to detect it based on the command id

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: do not set DRR group for stations
Felix Fietkau [Wed, 16 Dec 2020 15:07:07 +0000 (16:07 +0100)]
mt76: mt7915: do not set DRR group for stations

This is causing some extreme latency spikes when sending traffic to
multiple stations at the same time. Disable this until the firmware issue
is sorted out

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: ensure that init work completes before starting the device
Felix Fietkau [Mon, 23 Nov 2020 12:32:26 +0000 (13:32 +0100)]
mt76: mt7915: ensure that init work completes before starting the device

Without this change, the start operation could potentially race against eeprom
or txbf init

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7603: fix ED/CCA monitoring with single-stream devices
Felix Fietkau [Wed, 14 Oct 2020 14:49:36 +0000 (16:49 +0200)]
mt76: mt7603: fix ED/CCA monitoring with single-stream devices

Do not use the RSSI values of the unavailable chain

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add implicit Tx beamforming support
Ryder Lee [Thu, 14 Jan 2021 05:15:31 +0000 (13:15 +0800)]
mt76: mt7915: add implicit Tx beamforming support

Add ht/vht implicit Tx beamforming support and enable it via debugfs.

Tested-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: simplify peer's TxBF capability check
Ryder Lee [Thu, 14 Jan 2021 05:15:30 +0000 (13:15 +0800)]
mt76: mt7915: simplify peer's TxBF capability check

This is a preliminary patch for implicit beamforming support.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: mt7915: disable txpower sku when testmode enabled
Shayne Chen [Tue, 5 Jan 2021 11:30:45 +0000 (19:30 +0800)]
mt76: mt7615: mt7915: disable txpower sku when testmode enabled

When testmode can be enabled, the start() callback would already be
called, causing that txpower sku feature isn't really disabled after
testmode is enabled. This patch fix the issue.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add support for continuous tx in testmode
Shayne Chen [Tue, 5 Jan 2021 11:30:44 +0000 (19:30 +0800)]
mt76: mt7915: add support for continuous tx in testmode

Implement continuous tx state for MT7915 NIC testmode.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: rework set state part in testmode
Shayne Chen [Tue, 5 Jan 2021 11:30:43 +0000 (19:30 +0800)]
mt76: mt7915: rework set state part in testmode

This is a preliminary patch to simplify setting state in mt7915
testmode, for adding the new continuous tx state.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add a new state for continuous tx
Shayne Chen [Tue, 5 Jan 2021 11:30:42 +0000 (19:30 +0800)]
mt76: testmode: add a new state for continuous tx

Support to set a special tx state in testmode: continuous tx,
which is used for sending tx without time gap.
Note that continuous tx mode doesn't send real packets, instead, it's
pure phy signal, and the waveform can be observed by instrument.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: clean hw queue before starting new testmode tx
Shayne Chen [Tue, 5 Jan 2021 08:55:29 +0000 (16:55 +0800)]
mt76: mt7915: clean hw queue before starting new testmode tx

Add a testmode mcu command to clean up hw tx queue before a new
testmode tx starts.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: calculate new packet length when tx_time is set in testmode
Shayne Chen [Tue, 5 Jan 2021 08:55:28 +0000 (16:55 +0800)]
mt76: mt7915: calculate new packet length when tx_time is set in testmode

If tx_time is set, calculate a new packet length based on tx time and
tx rate.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add support for ipg in testmode
Shayne Chen [Tue, 5 Jan 2021 08:55:27 +0000 (16:55 +0800)]
mt76: mt7915: add support for ipg in testmode

Add support to calculate and apply ipg parameters in testmode
for MT7915 NIC.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: split edca update function
Shayne Chen [Tue, 5 Jan 2021 08:55:26 +0000 (16:55 +0800)]
mt76: mt7915: split edca update function

Split parameter settings and mcu command update in mt7915_mcu_set_tx().
This is for reusing edca update function in testmode ipg setting.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: make tx queued limit adjustable
Shayne Chen [Tue, 5 Jan 2021 08:55:25 +0000 (16:55 +0800)]
mt76: testmode: make tx queued limit adjustable

Originally, tx queued limit is set to 1000 to prevent from running out
of tx token. If a new testmode tx is triggered while the previous one
hasn't finished yet, we'll wait a period of time until tx_done equals to
tx_queued. Normally, current queued limit can finish in 10 seconds.

However, if ipg is configured to a larger value, less than 1000 packets
can be done in the default timeout period, which may lead to a crash
when a new testmode tx triggered.

To deal with this, make tx queued limit dynamically adjusted according
to ipg value.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add attributes for ipg related parameters
Shayne Chen [Tue, 5 Jan 2021 08:55:24 +0000 (16:55 +0800)]
mt76: testmode: add attributes for ipg related parameters

Add attributes for setting tx inter-packet gap (ipg), duty cycle, and
transmission time in testmode.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add support to set user-defined spe index
Shayne Chen [Tue, 5 Jan 2021 05:41:24 +0000 (13:41 +0800)]
mt76: testmode: add support to set user-defined spe index

Add spatial extension (spe) index as a configurable parameter in testmode.
This is used for specifically configuring TX path, such as different
WF TX priority, number of antennas and spatial streams.

If spe_idx is not set, TX path depends on tx_antenna_mask; otherwise,
both spe_idx and tx_antenna_mask are referenced to decide TX path.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: force ldpc for bw larger than 20MHz in testmode
Shayne Chen [Tue, 5 Jan 2021 05:41:00 +0000 (13:41 +0800)]
mt76: mt7915: force ldpc for bw larger than 20MHz in testmode

LDPC should be set when bw is larger than 20MHz to make
testmode tx work normally.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move chainmask in mt76_phy
Lorenzo Bianconi [Mon, 4 Jan 2021 18:00:06 +0000 (02:00 +0800)]
mt76: move chainmask in mt76_phy

Move chainmask from driver phy to mt76_phy since it is used by all
drivers. This is a preliminary patch to create a common mcu library used
by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move mac_work in mt76_core module
Lorenzo Bianconi [Mon, 4 Jan 2021 18:00:05 +0000 (02:00 +0800)]
mt76: move mac_work in mt76_core module

Move mac_work delayed_work and mac_work_count in mt76_phy since it is
used by all drivers. This is a preliminary patch to create a common mcu
library used by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: move testmode data from dev to phy
Shayne Chen [Fri, 4 Dec 2020 09:36:59 +0000 (17:36 +0800)]
mt76: mt7615: move testmode data from dev to phy

Move per-chip testmode data to mt7615_phy, to properly support
reg_backup and rx status of each band in testmode.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: move testmode data from dev to phy
Shayne Chen [Fri, 4 Dec 2020 09:36:58 +0000 (17:36 +0800)]
mt76: mt7915: move testmode data from dev to phy

Move per-chip testmode data to mt7915_phy, to properly support
reg_backup and rx status of each band in testmode.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: move mtd part to mt76_dev
Shayne Chen [Fri, 4 Dec 2020 09:36:57 +0000 (17:36 +0800)]
mt76: testmode: move mtd part to mt76_dev

Move testmode mtd variables to mt76_dev, since they are the same on
each phy.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: introduce dbdc support
Shayne Chen [Fri, 4 Dec 2020 09:36:56 +0000 (17:36 +0800)]
mt76: testmode: introduce dbdc support

Add testmode support for DBDC NICs (both MT7615D and MT7915D work).
Testmode data and parameters are moved from per-dev to per-phy
for maintaining the value of each band.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add partial add_bss_info command on testmode init
Shayne Chen [Fri, 4 Dec 2020 09:36:55 +0000 (17:36 +0800)]
mt76: mt7915: add partial add_bss_info command on testmode init

This is a preliminary patch for DBDC and ipg config support
in testmode.

The wmm_idx of band1 should be configured by this command to
make band1 Tx work normally. Also, for setting ipg, FW needs a
non-empty bss_info structure to do edca parameters update.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: drop zero-length packet to avoid Tx hang
Ryder Lee [Tue, 29 Dec 2020 04:15:30 +0000 (12:15 +0800)]
mt76: mt7915: drop zero-length packet to avoid Tx hang

Hardware wouldn't add LLC-SNAP when skb->data_len is 0, which causes
Tx hang, so add a check to drop this kind of packet.

Tested-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: simplify mt7915_mcu_send_message routine
Lorenzo Bianconi [Sat, 26 Dec 2020 17:09:04 +0000 (18:09 +0100)]
mt76: mt7915: simplify mt7915_mcu_send_message routine

Simplify mt7915_mcu_send_message routine removing unused code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix endianness warning in mt7915_mcu_set_radar_th
Lorenzo Bianconi [Tue, 22 Dec 2020 21:52:36 +0000 (22:52 +0100)]
mt76: mt7915: fix endianness warning in mt7915_mcu_set_radar_th

Fix the following sparse warning in mt7915_mcu_set_radar_th routine:

drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3154:17: warning: incorrect type in initializer (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3154:17:    expected unsigned int [usertype] min_pri
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3154:17:    got restricted __le32 [usertype]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3155:17: warning: incorrect type in initializer (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3155:17:    expected unsigned int [usertype] max_pri
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3155:17:    got restricted __le32 [usertype]
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3162:17: warning: incorrect type in initializer (different base types)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3162:17:    expected unsigned int [usertype] min_stgpr_diff
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:3162:17:    got restricted __le32 [usertype]

Fixes: cee236e1489ec ("mt76: mt7915: fix endian issues")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add support for flash mode
Shayne Chen [Mon, 14 Dec 2020 02:38:55 +0000 (10:38 +0800)]
mt76: mt7915: add support for flash mode

Add support for getting rf values from flash.
This is used for some test purposes and products.
If the mtd partition is configured in dts, driver will read from flash
to init eeprom command; if not, still init it with efuse's values.

An example:
&slot0 {
mt7915@0,0 {
reg = <0x0000 0 0 0 0>;
device_type = "pci";
mediatek,mtd-eeprom = <&factory 0x0000>;
};
};

Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: run mt7915_configure_filter holding mt76 mutex
Lorenzo Bianconi [Sat, 12 Dec 2020 17:24:31 +0000 (18:24 +0100)]
mt76: mt7915: run mt7915_configure_filter holding mt76 mutex

In order to avoid races, run mt7915_configure_filter routine holding
mt76 mutex

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: convert comma to semicolon
Zheng Yongjun [Wed, 9 Dec 2020 13:57:17 +0000 (21:57 +0800)]
mt76: mt7915: convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: convert comma to semicolon
Zheng Yongjun [Wed, 9 Dec 2020 13:57:02 +0000 (21:57 +0800)]
mt76: mt7615: convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: reset token when mac_reset happens
Ryder Lee [Thu, 10 Dec 2020 18:51:38 +0000 (02:51 +0800)]
mt76: mt7615: reset token when mac_reset happens

Reset token in mt7615_mac_reset_work() to avoid possible leakege.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: reset token when mac_reset happens
Ryder Lee [Thu, 10 Dec 2020 18:51:37 +0000 (02:51 +0800)]
mt76: mt7915: reset token when mac_reset happens

Reset buffering token in mt7915_mac_reset_work() to avoid possible leakege,
which leads to Tx stop after mac reset.

Tested-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix MT_CIPHER_BIP_CMAC_128 setkey
Ryder Lee [Tue, 8 Dec 2020 16:39:04 +0000 (00:39 +0800)]
mt76: mt7915: fix MT_CIPHER_BIP_CMAC_128 setkey

MCU expects to set WLAN_CIPHER_SUITE_CCMP and WLAN_CIPHER_SUITE_AES_CMAC
at the same time, so adding an intermediate buffer for batch update.

Tested-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: add vif check in mt7615_update_vif_beacon()
Ryder Lee [Fri, 4 Dec 2020 23:37:15 +0000 (07:37 +0800)]
mt76: mt7615: add vif check in mt7615_update_vif_beacon()

This avoids the WARN_ON(1) calltrace in station mode.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add vif check in mt7915_update_vif_beacon()
Ryder Lee [Fri, 4 Dec 2020 23:37:14 +0000 (07:37 +0800)]
mt76: mt7915: add vif check in mt7915_update_vif_beacon()

To avoid the warn_on() calltrace in station mode.

[ 4522.024382]  ieee80211_tx_dequeue+0x1258/0x1298 [mac80211]
[ 4522.029868]  ieee80211_beacon_get_template+0x10/0x18 [mac80211]
[ 4522.035780]  mt7915_mcu_add_beacon+0x2c/0x208 [mt7915e]
[ 4522.040997]  mt7915_mcu_get_rx_rate+0x304/0x878 [mt7915e]
[ 4522.046394]  ieee80211_delayed_tailroom_dec+0x158/0x180 [mac80211]
[ 4522.052573]  ieee80211_iterate_interfaces+0x48/0x68 [mac80211]
[ 4522.058398]  mt7915_mac_reset_work+0x3b4/0x630 [mt7915e]
[ 4522.063704]  process_one_work+0x1fc/0x390
[ 4522.067703]  worker_thread+0x48/0x4d0
[ 4522.071356]  kthread+0x120/0x128

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agoiwl4965: do not process non-QOS frames on txq->sched_retry path
Stanislaw Gruszka [Tue, 19 Jan 2021 10:06:21 +0000 (11:06 +0100)]
iwl4965: do not process non-QOS frames on txq->sched_retry path

We have already WARN_ON(!qc) for non-QOS frame on txq->sched_retry path,
but we continue to process, what makes no sense since tid is not
initialized. Non QOS frame should never happen when aggregation
is enabled on queue, so do not process that.

Patch should fix smatch warning:
drivers/net/wireless/intel/iwlegacy/4965-mac.c:2822 il4965_hdl_tx() error: uninitialized symbol 'tid'.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210119100621.439134-1-stf_xl@wp.pl
3 years agomt7601u: process tx URBs with status EPROTO properly
Lorenzo Bianconi [Sun, 17 Jan 2021 21:46:56 +0000 (22:46 +0100)]
mt7601u: process tx URBs with status EPROTO properly

Similar to commit 0e40dbd56d67 ("mt7601u: process URBs in status EPROTO
properly"), do not process tx URBs if marked with status set to EPROTO.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/72392e8341aa8591c0b9962661a6ca26b1198f32.1610919534.git.lorenzo@kernel.org
3 years agowlcore: Fix command execute failure 19 for wl12xx
Tony Lindgren [Fri, 15 Jan 2021 06:56:13 +0000 (08:56 +0200)]
wlcore: Fix command execute failure 19 for wl12xx

We can currently get a "command execute failure 19" error on beacon loss
if the signal is weak:

wlcore: Beacon loss detected. roles:0xff
wlcore: Connection loss work (role_id: 0).
...
wlcore: ERROR command execute failure 19
...
WARNING: CPU: 0 PID: 1552 at drivers/net/wireless/ti/wlcore/main.c:803
...
(wl12xx_queue_recovery_work.part.0 [wlcore])
(wl12xx_cmd_role_start_sta [wlcore])
(wl1271_op_bss_info_changed [wlcore])
(ieee80211_prep_connection [mac80211])

Error 19 is defined as CMD_STATUS_WRONG_NESTING from the wlcore firmware,
and seems to mean that the firmware no longer wants to see the quirk
handling for WLCORE_QUIRK_START_STA_FAILS done.

This quirk got added with commit 18eab430700d ("wlcore: workaround
start_sta problem in wl12xx fw"), and it seems that this already got fixed
in the firmware long time ago back in 2012 as wl18xx never had this quirk
in place to start with.

As we no longer even support firmware that early, to me it seems that it's
safe to just drop WLCORE_QUIRK_START_STA_FAILS to fix the error. Looks
like earlier firmware got disabled back in 2013 with commit 0e284c074ef9
("wl12xx: increase minimum singlerole firmware version required").

If it turns out we still need WLCORE_QUIRK_START_STA_FAILS with any
firmware that the driver works with, we can simply revert this patch and
add extra checks for firmware version used.

With this fix wlcore reconnects properly after a beacon loss.

Cc: Raz Bouganim <r-bouganim@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210115065613.7731-1-tony@atomide.com
3 years agomt7601u: use ieee80211_rx_list to pass frames to the network stack as a batch
Lorenzo Bianconi [Wed, 13 Jan 2021 23:26:26 +0000 (00:26 +0100)]
mt7601u: use ieee80211_rx_list to pass frames to the network stack as a batch

Similar to mt76 driver, rely on ieee80211_rx_list in order to
improve icache footprint

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/5c72fa2dda45c1ae3f285af80c02f3db23341d85.1610580222.git.lorenzo@kernel.org
3 years agortw88: 8723de: adjust the LTR setting
Chin-Yen Lee [Wed, 13 Jan 2021 01:43:42 +0000 (09:43 +0800)]
rtw88: 8723de: adjust the LTR setting

The LTR mechanism enables PCIE Endpoints to report the service latency
requirements and CPU will enter appropriate sleep state to save power
based on the LTR value.

8723de provides two registers to config the LTR, and the original setting
is too short for CPU to ente sleep state. The patch adjust the LTR setting.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210113014342.3615-1-pkshih@realtek.com
3 years agortlwifi: rtl8821ae: fix bool comparison in expressions
Aditya Srivastava [Sun, 10 Jan 2021 12:15:25 +0000 (17:45 +0530)]
rtlwifi: rtl8821ae: fix bool comparison in expressions

There are certain conditional expressions in rtl8821ae, where a boolean
variable is compared with true/false, in forms such as (foo == true) or
(false != bar), which does not comply with checkpatch.pl (CHECK:
BOOL_COMPARISON), according to which boolean variables should be
themselves used in the condition, rather than comparing with true/false

E.g., in drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c,
"if (rtlefuse->autoload_failflag == false)" can be replaced with
"if (!rtlefuse->autoload_failflag)"

Replace all such expressions with the bool variables appropriately

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210110121525.2407-6-yashsri421@gmail.com
3 years agortlwifi: rtl8192se: fix bool comparison in expressions
Aditya Srivastava [Sun, 10 Jan 2021 12:15:24 +0000 (17:45 +0530)]
rtlwifi: rtl8192se: fix bool comparison in expressions

There are certain conditional expressions in rtl8192se, where a boolean
variable is compared with true/false, in forms such as (foo == true) or
(false != bar), which does not comply with checkpatch.pl (CHECK:
BOOL_COMPARISON), according to which boolean variables should be
themselves used in the condition, rather than comparing with true/false

Replace all such expressions with the bool variables appropriately

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210110121525.2407-5-yashsri421@gmail.com
3 years agortlwifi: rtl8188ee: fix bool comparison in expressions
Aditya Srivastava [Sun, 10 Jan 2021 12:15:23 +0000 (17:45 +0530)]
rtlwifi: rtl8188ee: fix bool comparison in expressions

There are certain conditional expressions in rtl8188ee, where a boolean
variable is compared with true/false, in forms such as (foo == true) or
(false != bar), which does not comply with checkpatch.pl (CHECK:
BOOL_COMPARISON), according to which boolean variables should be
themselves used in the condition, rather than comparing with true/false

E.g., in drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c,
"if (mac->act_scanning == true)" can be replaced with
"if (mac->act_scanning)"

Replace all such expressions with the bool variables appropriately

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210110121525.2407-4-yashsri421@gmail.com
3 years agortlwifi: rtl8192c-common: fix bool comparison in expressions
Aditya Srivastava [Sun, 10 Jan 2021 12:15:22 +0000 (17:45 +0530)]
rtlwifi: rtl8192c-common: fix bool comparison in expressions

There are certain conditional expressions in rtl8192c-common, where a
boolean variable is compared with true/false, in forms such as
(foo == true) or (false != bar), which does not comply with checkpatch.pl
(CHECK: BOOL_COMPARISON), according to which boolean variables should be
themselves used in the condition, rather than comparing with true/false

E.g., in drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c,
"else if (initialized == false) {" can be replaced with
"else if (!initialized) {"

Replace all such expressions with the bool variables appropriately

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210110121525.2407-3-yashsri421@gmail.com
3 years agortlwifi: rtl_pci: fix bool comparison in expressions
Aditya Srivastava [Sun, 10 Jan 2021 12:15:21 +0000 (17:45 +0530)]
rtlwifi: rtl_pci: fix bool comparison in expressions

There are certain conditional expressions in rtl_pci, where a boolean
variable is compared with true/false, in forms such as (foo == true) or
(false != bar), which does not comply with checkpatch.pl (CHECK:
BOOL_COMPARISON), according to which boolean variables should be
themselves used in the condition, rather than comparing with true/false

E.g., in drivers/net/wireless/realtek/rtlwifi/ps.c,
"if (find_p2p_ie == true)" can be replaced with "if (find_p2p_ie)"

Replace all such expressions with the bool variables appropriately

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210110121525.2407-2-yashsri421@gmail.com
3 years agowlcore: Downgrade exceeded max RX BA sessions to debug
Tony Lindgren [Fri, 1 Jan 2021 06:59:55 +0000 (08:59 +0200)]
wlcore: Downgrade exceeded max RX BA sessions to debug

We can get the following in the logs every few minutes or so:

wlcore: ERROR exceeded max RX BA sessions

Let's downgrade the message to a debug message as suggested by the TI
support folks at:

https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/p/352435/1244754

"The WL127x firmware supports max of 3 BA sessions. It cannot be increased.
 I think the problem here is the peer trying to initiate a 4th BA session
 (ADDBA request)."

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210101065955.63386-1-tony@atomide.com
3 years agowilc1000: use flexible-array member instead of zero-length array
Tian Tao [Fri, 25 Dec 2020 07:35:03 +0000 (15:35 +0800)]
wilc1000: use flexible-array member instead of zero-length array

Use flexible-array member introduced in C99 instead of zero-length
array. Most of zero-length array was already taken care in previous
patch [1].

[1]. https://patchwork.kernel.org/patch/11394197/

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1608881703-37060-1-git-send-email-tiantao6@hisilicon.com
3 years agobrcmfmac: clear EAP/association status bits on linkdown events
Luca Pesce [Thu, 24 Dec 2020 10:51:59 +0000 (11:51 +0100)]
brcmfmac: clear EAP/association status bits on linkdown events

This ensure that previous association attempts do not leave stale statuses
on subsequent attempts.

This fixes the WARN_ON(!cr->bss)) from __cfg80211_connect_result() when
connecting to an AP after a previous connection failure (e.g. where EAP fails
due to incorrect psk but association succeeded). In some scenarios, indeed,
brcmf_is_linkup() was reporting a link up event too early due to stale
BRCMF_VIF_STATUS_ASSOC_SUCCESS bit, thus reporting to cfg80211 a connection
result with a zeroed bssid (vif->profile.bssid is still empty), causing the
WARN_ON due to the call to cfg80211_get_bss() with the empty bssid.

Signed-off-by: Luca Pesce <luca.pesce@vimar.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1608807119-21785-1-git-send-email-luca.pesce@vimar.com
3 years agobrcmfmac: Delete useless kfree code
Zheng Yongjun [Tue, 22 Dec 2020 13:51:13 +0000 (21:51 +0800)]
brcmfmac: Delete useless kfree code

A null pointer will be passed to a kfree() call after a kzalloc() call failed.
This code is useless. Thus delete the extra function call.

A goto statement is also no longer needed. Thus adjust an if branch.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201222135113.20680-1-zhengyongjun3@huawei.com
3 years agoqtnfmac_pcie: Use module_pci_driver
Amey Narkhede [Mon, 21 Dec 2020 07:57:35 +0000 (13:27 +0530)]
qtnfmac_pcie: Use module_pci_driver

Use module_pci_driver for drivers whose init and exit functions
only register and unregister, respectively.

Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201221075735.197255-1-ameynarkhede03@gmail.com
3 years agomt7601u: check the status of device in calibration
Zhi Han [Thu, 17 Dec 2020 16:16:57 +0000 (17:16 +0100)]
mt7601u: check the status of device in calibration

When the usb device being plugged out, before ieee80211 gets to know the
hw being removed, it gets to know that the association status changed,
and thus ask for the device to do the calibration. This causes error as
the hw is absent.

This can be avoid by checking the status of the device before sending
the calibration request to the device.

Signed-off-by: Zhi Han <z.han@gmx.net>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201217161657.GB12562@E480
3 years agomt7601u: process URBs in status EPROTO properly
Zhi Han [Thu, 17 Dec 2020 16:13:02 +0000 (17:13 +0100)]
mt7601u: process URBs in status EPROTO properly

When the usb device being plugged out, before the usb_driver:disconnect
called by e.g workqueue, it is possible that some URBs are still in
processing, and being marked as EPROTO in host controller.

Those URBs should not be scheduled in complete_rx callback function to
get further processing.

Signed-off-by: Zhi Han <z.han@gmx.net>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201217161302.GA12562@E480
3 years agobrcmfmac: support BCM4365E with 43666 ChipCommon chip ID
Rafał Miłecki [Mon, 14 Dec 2020 10:15:53 +0000 (11:15 +0100)]
brcmfmac: support BCM4365E with 43666 ChipCommon chip ID

This adds support for the BCM43666/4 which seems to be using the same
firmware as BCM4366 (4366c0). I found it in the Netgear R8000P router.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201214101553.32097-1-zajec5@gmail.com
3 years agowilc1000: fix spelling mistake in Kconfig "devision" -> "division"
Colin Ian King [Wed, 16 Dec 2020 11:58:08 +0000 (11:58 +0000)]
wilc1000: fix spelling mistake in Kconfig "devision" -> "division"

There is a spelling mistake in the Kconfig help text. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201216115808.12987-1-colin.king@canonical.com
3 years agomwifiex: pcie: Drop bogus __refdata annotation
Geert Uytterhoeven [Fri, 11 Dec 2020 13:38:35 +0000 (14:38 +0100)]
mwifiex: pcie: Drop bogus __refdata annotation

As the Marvell PCIE WiFi-Ex driver does not have any code or data
located in initmem, there is no need to annotate the mwifiex_pcie
structure with __refdata.  Drop the annotation, to avoid suppressing
future section warnings.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201211133835.2970384-1-geert+renesas@glider.be
3 years agortw88: Simplify bool comparison
YANG LI [Tue, 12 Jan 2021 09:50:40 +0000 (17:50 +0800)]
rtw88: Simplify bool comparison

Fix the following coccicheck warning:
 ./drivers/net/wireless/realtek/rtw88/debug.c:800:17-23: WARNING:
Comparison of 0/1 to bool variable

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1610445040-23599-1-git-send-email-abaci-bugfix@linux.alibaba.com
3 years agortw88: coex: set 4 slot TDMA for BT link and WL busy
Ching-Te Ku [Tue, 12 Jan 2021 02:11:35 +0000 (10:11 +0800)]
rtw88: coex: set 4 slot TDMA for BT link and WL busy

To protect both of WL/BT performance while BT is under re-link state.
4-slot mode TDMA can make the re-link more sensitive and mitigate the WL
throughput drop.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210112021135.3823-1-pkshih@realtek.com
3 years agortw88: 8821c: apply CCK PD level which calculates from dynamic mechanism
Vincent Fann [Mon, 28 Dec 2020 08:25:16 +0000 (16:25 +0800)]
rtw88: 8821c: apply CCK PD level which calculates from dynamic mechanism

Hal function must follow the value that calculates from dynamic mechanism.
Force to set new_lvl to 4 damages receiving ability. System will not able
to reconnect to the AP if wifi unexpected disconnecting at this moment.

Signed-off-by: Vincent Fann <vincent_fann@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201228082516.16488-1-pkshih@realtek.com
3 years agortw88: reduce the log level for failure of tx report
Chin-Yen Lee [Mon, 28 Dec 2020 08:24:33 +0000 (16:24 +0800)]
rtw88: reduce the log level for failure of tx report

Sometimes driver does not get tx report from firmware because wifi
environment is too noisy to get ack from AP about a TX frame,
or firmware is too busy to report driver in a estimated time.
But the condition will not affect wifi function or throughput.
So we reduce the log level to rtw_debug instead of scary backtrace.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201228082433.16431-1-pkshih@realtek.com
3 years agortw88: Delete useless kfree code
Zheng Yongjun [Wed, 16 Dec 2020 13:04:42 +0000 (21:04 +0800)]
rtw88: Delete useless kfree code

The parameter of kfree function is NULL, so kfree code is useless, delete it.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201216130442.13869-1-zhengyongjun3@huawei.com