platform/kernel/linux-starfive.git
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
3 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Mon, 11 Jan 2021 17:42:29 +0000 (19:42 +0200)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for v5.12. Major changes:

ath9k

* more robust encryption key cache management

3 years agonet: dsa: bcm_sf2: support BCM4908's integrated switch
Rafał Miłecki [Wed, 6 Jan 2021 21:32:02 +0000 (22:32 +0100)]
net: dsa: bcm_sf2: support BCM4908's integrated switch

BCM4908 family SoCs come with integrated Starfighter 2 switch. Its
registers layout it a mix of BCM7278 and BCM7445. It has 5 integrated
PHYs and 8 ports. It also supports RGMII and SerDes.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210106213202.17459-3-zajec5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agodt-bindings: net: dsa: sf2: add BCM4908 switch binding
Rafał Miłecki [Wed, 6 Jan 2021 21:32:01 +0000 (22:32 +0100)]
dt-bindings: net: dsa: sf2: add BCM4908 switch binding

BCM4908 family SoCs have integrated Starfighter 2 switch.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210106213202.17459-2-zajec5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agodt-bindings: net: convert Broadcom Starfighter 2 binding to the json-schema
Rafał Miłecki [Wed, 6 Jan 2021 21:32:00 +0000 (22:32 +0100)]
dt-bindings: net: convert Broadcom Starfighter 2 binding to the json-schema

This helps validating DTS files. Only the current (not deprecated one)
binding was converted.

Minor changes:
1. Dropped dsa/dsa.txt references
2. Updated node name to match dsa.yaml requirement
3. Fixed 2 typos in examples

The new binding was validated using the dt_binding_check.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Link: https://lore.kernel.org/r/20210106213202.17459-1-zajec5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agoMerge branch 'mptcp-add-mp_prio-support-and-rework-local-address-ids'
Jakub Kicinski [Sun, 10 Jan 2021 02:18:47 +0000 (18:18 -0800)]
Merge branch 'mptcp-add-mp_prio-support-and-rework-local-address-ids'

Mat Martineau says:

====================
MPTCP: Add MP_PRIO support and rework local address IDs

Patches 1 and 2 rework the assignment of local address IDs to allow them
to be assigned by a userspace path manager, and add corresponding self
tests.

Patches 2-8 add the ability to change subflow priority after a subflow
has been established. Each subflow in a MPTCP connection has a priority
level: "regular" or "backup". Data should only be sent on backup
subflows if no regular subflows are available. The priority level can be
set when the subflow connection is established (as was already
implemented), or during the life of the connection by sending MP_PRIO in
the TCP options (as added here). Self tests are included.
====================

Link: https://lore.kernel.org/r/20210109004802.341602-1-mathew.j.martineau@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agoselftests: mptcp: add the MP_PRIO testcases
Geliang Tang [Sat, 9 Jan 2021 00:48:02 +0000 (16:48 -0800)]
selftests: mptcp: add the MP_PRIO testcases

This patch added the MP_PRIO testcases:

Add a new argument bkup for run_tests and do_transfer, it can be set as
"backup" or "nobackup", the default value is "".

Add a new function chk_prio_nr to check the MP_PRIO related MIB counters.

The output looks like this:

29 single subflow, backup      syn[ ok ] - synack[ ok ] - ack[ ok ]
                               ptx[ ok ] - prx   [ ok ]
30 single address, backup      syn[ ok ] - synack[ ok ] - ack[ ok ]
                               add[ ok ] - echo  [ ok ]
                               ptx[ ok ] - prx   [ ok ]

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agomptcp: add the mibs for MP_PRIO
Geliang Tang [Sat, 9 Jan 2021 00:48:01 +0000 (16:48 -0800)]
mptcp: add the mibs for MP_PRIO

This patch added the mibs for MP_PRIO, MPTCP_MIB_MPPRIOTX for transmitting
of the MP_PRIO suboption, and MPTCP_MIB_MPPRIORX for receiving of it.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agoselftests: mptcp: add set_flags command in pm_nl_ctl
Geliang Tang [Sat, 9 Jan 2021 00:48:00 +0000 (16:48 -0800)]
selftests: mptcp: add set_flags command in pm_nl_ctl

This patch added the set_flags command in pm_nl_ctl, currently we can only
set two flags: backup and nobackup. The set_flags command can be used like
this:

 # pm_nl_ctl set 10.0.0.1 flags backup
 # pm_nl_ctl set 10.0.0.1 flags nobackup

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agomptcp: add set_flags command in PM netlink
Geliang Tang [Sat, 9 Jan 2021 00:47:59 +0000 (16:47 -0800)]
mptcp: add set_flags command in PM netlink

This patch added a new command MPTCP_PM_CMD_SET_FLAGS in PM netlink:

In mptcp_nl_cmd_set_flags, parse the input address, get the backup value
according to whether the address's FLAG_BACKUP flag is set from the
user-space. Then check whether this address had been added in the local
address list. If it had been, then call mptcp_nl_addr_backup to deal with
this address.

In mptcp_nl_addr_backup, traverse all the existing msk sockets to find
the relevant sockets, and call mptcp_pm_nl_mp_prio_send_ack to send out
a MP_PRIO ACK packet.

Finally in mptcp_nl_cmd_set_flags, set or clear the address's FLAG_BACKUP
flag.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agomptcp: add the incoming MP_PRIO support
Geliang Tang [Sat, 9 Jan 2021 00:47:58 +0000 (16:47 -0800)]
mptcp: add the incoming MP_PRIO support

This patch added the incoming MP_PRIO logic:

Added a flag named mp_prio in struct mptcp_options_received, to mark the
MP_PRIO is received, and save the priority value to struct
mptcp_options_received's backup member. Then invoke
mptcp_pm_mp_prio_received with the receiving subsocket and the backup
value.

In mptcp_pm_mp_prio_received, get the subflow context according the input
subsocket, and change the subflow's backup as the incoming priority value.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agomptcp: add the outgoing MP_PRIO support
Geliang Tang [Sat, 9 Jan 2021 00:47:57 +0000 (16:47 -0800)]
mptcp: add the outgoing MP_PRIO support

This patch added the outgoing MP_PRIO logic:

In mptcp_pm_nl_mp_prio_send_ack, find the related subflow and subsocket
according to the input parameter addr. Save the input priority value to
suflow's backup, then set subflow's send_mp_prio flag to true, and save
the input priority value to suflow's request_bkup. Finally, send out a
pure ACK on the related subsocket.

In mptcp_established_options_mp_prio, check whether the subflow's
send_mp_prio is set. If it is, this is the packet for sending MP_PRIO.
So save subflow->request_bkup value to mptcp_out_options's backup, and
change the option type to OPTION_MPTCP_PRIO.

In mptcp_write_options, clear the send_mp_prio flag and send out the
MP_PRIO suboption with mptcp_out_options's backup value.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agoselftests: mptcp: add testcases for setting the address ID
Geliang Tang [Sat, 9 Jan 2021 00:47:56 +0000 (16:47 -0800)]
selftests: mptcp: add testcases for setting the address ID

Since the address ID can be set from user-space, some of the tests in
pm_netlink.sh will fail. This patch fixed the failures, and add the
testcases for setting the address ID.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agomptcp: add the address ID assignment bitmap
Geliang Tang [Sat, 9 Jan 2021 00:47:55 +0000 (16:47 -0800)]
mptcp: add the address ID assignment bitmap

Currently the address ID set by the netlink PM from user-space is
overridden by the kernel. This patch added the address ID assignment
bitmap to allow user-space to set the address ID.

Use a per netns bitmask id_bitmap (256 bits) to keep track of in-use IDs.
And use next_id to keep track of the highest ID currently in use. If the
user-space provides an ID at endpoint creation time, try to use it. If
already in use, endpoint creation fails. Otherwise pick the first ID
available after the highest currently in use, with wrap-around.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agoMerge branch 'r8169-small-improvements'
Jakub Kicinski [Sun, 10 Jan 2021 02:07:54 +0000 (18:07 -0800)]
Merge branch 'r8169-small-improvements'

Heiner Kallweit says:

====================
r8169: small improvements

This series includes a number of smaller improvements.

v2:
- return on WARN in patch 1
====================

Link: https://lore.kernel.org/r/938caef4-8a0b-bbbd-66aa-76f758ff877a@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agor8169: don't wakeup-enable device on shutdown if WOL is disabled
Heiner Kallweit [Fri, 8 Jan 2021 12:00:13 +0000 (13:00 +0100)]
r8169: don't wakeup-enable device on shutdown if WOL is disabled

If WOL isn't enabled, then there's no need to enable wakeup from D3
on system shutdown.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agor8169: improve rtl_ocp_reg_failure
Heiner Kallweit [Fri, 8 Jan 2021 11:58:54 +0000 (12:58 +0100)]
r8169: improve rtl_ocp_reg_failure

Use WARN_ONCE here to get a call trace in case of a problem.
This facilitates finding the offending code part.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agor8169: replace BUG_ON with WARN in _rtl_eri_write
Heiner Kallweit [Fri, 8 Jan 2021 11:57:57 +0000 (12:57 +0100)]
r8169: replace BUG_ON with WARN in _rtl_eri_write

Use WARN here to avoid stopping the system. In addition print the addr
and mask values that triggered the warning.

v2:
- return on WARN to avoid an invalid register write

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agonet: dsa: dsa_legacy_fdb_{add,del} can be static
Vladimir Oltean [Fri, 8 Jan 2021 23:30:54 +0000 (01:30 +0200)]
net: dsa: dsa_legacy_fdb_{add,del} can be static

Introduced in commit 37b8da1a3c68 ("net: dsa: Move FDB add/del
implementation inside DSA") in net/dsa/legacy.c, these functions were
moved again to slave.c as part of commit 2a93c1a3651f ("net: dsa: Allow
compiling out legacy support"), before actually deleting net/dsa/slave.c
in 93e86b3bc842 ("net: dsa: Remove legacy probing support"). Along with
that movement there should have been a deletion of the prototypes from
dsa_priv.h, they are not useful.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20210108233054.1222278-1-olteanv@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agoMerge branch 'dpaa2-mac-various-updates'
Jakub Kicinski [Sun, 10 Jan 2021 00:21:33 +0000 (16:21 -0800)]
Merge branch 'dpaa2-mac-various-updates'

Ioana Ciornei says:

====================
dpaa2-mac: various updates

The first two patches of this series extends the MAC statistics support
to also work for network interfaces which have their link status handled
by firmware (TYPE_FIXED).

The next two patches are fixing a sporadic problem which happens when
the connected DPMAC object is not yet discovered by the fsl-mc bus, thus
the dpaa2-eth is not able to get a reference to it. A referred probe
will be requested in this case.

Finally, the last two patches make some cosmetic changes, mostly
removing comments and unnecessary checks.

Changes in v2:
 - replaced IS_ERR_OR_NULL() by IS_ERR() in patch 4/6
 - reworded the commit message of patch 6/6
====================

Link: https://lore.kernel.org/r/20210108090727.866283-1-ciorneiioana@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agodpaa2-mac: remove a comment regarding pause settings
Ioana Ciornei [Fri, 8 Jan 2021 09:07:27 +0000 (11:07 +0200)]
dpaa2-mac: remove a comment regarding pause settings

The MC firmware takes these PAUSE/ASYM_PAUSE flags provided by the
driver, transforms them back into rx/tx pause enablement status and
applies them to hardware. We are not losing information by this
transformation, thus remove the comment.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agodpaa2-mac: remove an unnecessary check
Ioana Ciornei [Fri, 8 Jan 2021 09:07:26 +0000 (11:07 +0200)]
dpaa2-mac: remove an unnecessary check

The dpaa2-eth driver has phylink integration only if the connected dpmac
object is in TYPE_PHY (aka the PCS/PHY etc link status is managed by
Linux instead of the firmware). The check is thus unnecessary because
the code path that reaches the .mac_link_up() callback is only with
TYPE_PHY dpmac objects.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agodpaa2-eth: retry the probe when the MAC is not yet discovered on the bus
Ioana Ciornei [Fri, 8 Jan 2021 09:07:25 +0000 (11:07 +0200)]
dpaa2-eth: retry the probe when the MAC is not yet discovered on the bus

The fsl_mc_get_endpoint() function now returns -EPROBE_DEFER when the
dpmac device was not yet discovered by the fsl-mc bus. When this
happens, pass the error code up so that we can retry the probe at a
later time.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agobus: fsl-mc: return -EPROBE_DEFER when a device is not yet discovered
Ioana Ciornei [Fri, 8 Jan 2021 09:07:24 +0000 (11:07 +0200)]
bus: fsl-mc: return -EPROBE_DEFER when a device is not yet discovered

The fsl_mc_get_endpoint() should return a pointer to the connected
fsl_mc device, if there is one. By interrogating the MC firmware, we
know if there is an endpoint or not so when the endpoint device is
actually searched on the fsl-mc bus and not found we are hitting the
case in which the device has not been yet discovered by the bus.

Return -EPROBE_DEFER so that callers can differentiate this case.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 years agodpaa2-mac: export MAC counters even when in TYPE_FIXED
Ioana Ciornei [Fri, 8 Jan 2021 09:07:23 +0000 (11:07 +0200)]
dpaa2-mac: export MAC counters even when in TYPE_FIXED

If the network interface object is connected to a MAC of TYPE_FIXED, the
link status management is handled exclusively by the firmware. This does
not mean that the driver cannot access the MAC counters and export them
in ethtool.

For this to happen, we open the attached dpmac device and keep a pointer
to it in priv->mac. Because of this, all the checks in the driver of the
following form 'if (priv->mac)' have to be updated to actually check
the dpmac attribute and not rely on the presence of a non-NULL value.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>