platform/kernel/linux-starfive.git
2 years agomt76: move mt76_connac2_mcu_fill_message in mt76_connac module
Lorenzo Bianconi [Mon, 20 Jun 2022 12:59:18 +0000 (14:59 +0200)]
mt76: move mt76_connac2_mcu_fill_message in mt76_connac module

Move mt76_connac2_mcu_fill_message routine in shared module in order to
reuse it for mt7921 and mt7915e drivers. This is a preliminary patch to
add mt7990 driver support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: move mcu_txd/mcu_rxd structures in shared code
Lorenzo Bianconi [Mon, 20 Jun 2022 12:59:17 +0000 (14:59 +0200)]
mt76: move mcu_txd/mcu_rxd structures in shared code

This is a preliminary patch to add mt7990 chipset support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: rely on mt76_connac_tx_free
Lorenzo Bianconi [Mon, 20 Jun 2022 12:37:34 +0000 (14:37 +0200)]
mt76: mt7915: rely on mt76_connac_tx_free

As for mt7921 and mt7615 drivers, rely on mt76_connac_tx_free data
structure in mt7915e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt7615_txp_skb_unmap in common code
Lorenzo Bianconi [Sun, 19 Jun 2022 20:42:41 +0000 (22:42 +0200)]
mt76: connac: move mt7615_txp_skb_unmap in common code

Move mt7615_txp_skb_unmap in shared code and reuse it in mt7915e and
mt7921e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac_write_hw_txp in shared code
Lorenzo Bianconi [Sun, 19 Jun 2022 20:42:40 +0000 (22:42 +0200)]
mt76: connac: move mt76_connac_write_hw_txp in shared code

Now we can move mt76_connac_write_hw_txp routine in mt76-connac module
and reuse it in mt7921e and mt7615e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac_tx_complete_skb in shared code
Lorenzo Bianconi [Sun, 19 Jun 2022 20:42:39 +0000 (22:42 +0200)]
mt76: connac: move mt76_connac_tx_complete_skb in shared code

Since now txp structures are in common code we can reuse
mt76_connac_tx_complete_skb routine in mt7921e, mt7915e and mt7615e
drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac_tx_free in shared code
Lorenzo Bianconi [Sun, 19 Jun 2022 20:42:38 +0000 (22:42 +0200)]
mt76: connac: move mt76_connac_tx_free in shared code

Move mt76_connac_tx_free structure in mt76_connac module since it is
shared by mt7615 and mt7921 drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: move mt7615_txp_ptr in mt76_connac module
Lorenzo Bianconi [Sun, 19 Jun 2022 20:42:37 +0000 (22:42 +0200)]
mt76: move mt7615_txp_ptr in mt76_connac module

Since mt7615_txp_ptr is shared between mt7615 and mt7921 move it in
mt76_connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac_fw_txp in common module
Lorenzo Bianconi [Sun, 19 Jun 2022 20:42:36 +0000 (22:42 +0200)]
mt76: connac: move mt76_connac_fw_txp in common module

Since mt76_connac_fw_txp struct is shared between mt7615e, mt7915e and
mt7921e, move it in mt76_connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: get rid of unnecessary new line in mt7915_mac_write_txwi
Lorenzo Bianconi [Sun, 19 Jun 2022 13:05:51 +0000 (15:05 +0200)]
mt76: mt7915: get rid of unnecessary new line in mt7915_mac_write_txwi

Remove unnecessary new line in mt7915_mac_write_txwi routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: enlarge maximum VHT MPDU length to 11454
Deren Wu [Sat, 18 Jun 2022 10:56:44 +0000 (18:56 +0800)]
mt76: mt7921: enlarge maximum VHT MPDU length to 11454

Enlarge maximum MPDU length to 11454 that both mt7921/mt7922 can support.
After this fixing, we can get better performance.

Fixes: 5c14a5f944b9 ("mt76: mt7921: introduce mt7921e support")
Tested-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: fix aggregation subframes setting to HE max
Deren Wu [Thu, 16 Jun 2022 15:57:43 +0000 (23:57 +0800)]
mt76: mt7921: fix aggregation subframes setting to HE max

mt7921/mt7922 support HE max aggregation subframes 256 for both tx/rx.
Get better throughput then before.

Fixes: 94bb18b03d43 ("mt76: mt7921: fix max aggregation subframes setting")
Tested-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921s: fix possible sdio deadlock in command fail
Deren Wu [Tue, 14 Jun 2022 07:50:24 +0000 (15:50 +0800)]
mt76: mt7921s: fix possible sdio deadlock in command fail

Move sdio_release_host() to final resource handing

Fixes: b12deb5e86fa ("mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl")
Reported-by: YN Chen <YN.Chen@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: do not update pm states in case of error
Lorenzo Bianconi [Mon, 13 Jun 2022 12:07:08 +0000 (14:07 +0200)]
mt76: mt7921: do not update pm states in case of error

Do not update pm stats if mt7921e_mcu_fw_pmctrl routine returns an
error.

Fixes: 36873246f78a2 ("mt76: mt7921: add awake and doze time accounting")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7615: do not update pm stats in case of error
Lorenzo Bianconi [Mon, 13 Jun 2022 12:03:28 +0000 (14:03 +0200)]
mt76: mt7615: do not update pm stats in case of error

Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error.

Fixes: abe912ae3cd42 ("mt76: mt7663: add awake and doze time accounting")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921s: remove unnecessary goto in mt7921s_mcu_drv_pmctrl
Lorenzo Bianconi [Mon, 13 Jun 2022 12:00:44 +0000 (14:00 +0200)]
mt76: mt7921s: remove unnecessary goto in mt7921s_mcu_drv_pmctrl

Get rid of unnecessary goto in mt7921s_mcu_drv_pmctrl routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac2_mac_fill_rx_rate in connac module
Lorenzo Bianconi [Wed, 8 Jun 2022 17:30:31 +0000 (19:30 +0200)]
mt76: connac: move mt76_connac2_mac_fill_rx_rate in connac module

Rely on mt76_connac2_mac_fill_rx_rate routine in mt7921 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module
Lorenzo Bianconi [Wed, 8 Jun 2022 17:30:30 +0000 (19:30 +0200)]
mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module

mt76_connac2_reverse_frag0_hdr_trans routine is shared between mt7921
and mt7915e drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move HE radiotap parsing in connac module
Lorenzo Bianconi [Wed, 8 Jun 2022 17:30:29 +0000 (19:30 +0200)]
mt76: connac: move HE radiotap parsing in connac module

HE radiotap parsing code is shared between connac2 devices.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: fix command timeout in AP stop period
Deren Wu [Wed, 8 Jun 2022 12:53:26 +0000 (20:53 +0800)]
mt76: mt7921: fix command timeout in AP stop period

Due to AP stop improperly, mt7921 driver would face random command timeout
by chip fw problem. Migrate AP start/stop process to .start_ap/.stop_ap and
congiure BSS network settings in both hooks.

The new flow is shown below.
* AP start
    .start_ap()
      configure BSS network resource
      set BSS to connected state
    .bss_info_changed()
      enable fw beacon offload

* AP stop
    .bss_info_changed()
      disable fw beacon offload (skip this command)
    .stop_ap()
      set BSS to disconnected state (beacon offload disabled automatically)
      destroy BSS network resource

Fixes: 116c69603b01 ("mt76: mt7921: Add AP mode support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: not support beacon offload disable command
Deren Wu [Wed, 8 Jun 2022 12:53:25 +0000 (20:53 +0800)]
mt76: mt7921: not support beacon offload disable command

Beacon disable flow would be handled in bss stop handler automatically.
Force return -EOPNOTSUPP in disable case.

Fixes: 116c69603b01 ("mt76: mt7921: Add AP mode support")
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac2_mac_add_txs_skb in connac module
Lorenzo Bianconi [Tue, 7 Jun 2022 09:28:41 +0000 (11:28 +0200)]
mt76: connac: move mt76_connac2_mac_add_txs_skb in connac module

Move mt76_connac2_mac_add_txs_skb in mt76-connac module since it is
shared between connac2 devices (mt7921 and mt7915)

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move connac2_mac_write_txwi in mt76_connac module
Lorenzo Bianconi [Tue, 7 Jun 2022 09:28:40 +0000 (11:28 +0200)]
mt76: connac: move connac2_mac_write_txwi in mt76_connac module

mac_write_txwi code is shared between connac2 devices (mt7915 and
mt7921). Move it in connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mac connac2 defs in mt76_connac2_mac.h
Lorenzo Bianconi [Tue, 7 Jun 2022 09:28:39 +0000 (11:28 +0200)]
mt76: connac: move mac connac2 defs in mt76_connac2_mac.h

This is a preliminary patch to share connac2 mac txwi code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: rely on mt76_dev in mt7915_mac_write_txwi signature
Lorenzo Bianconi [Tue, 7 Jun 2022 09:28:38 +0000 (11:28 +0200)]
mt76: mt7915: rely on mt76_dev in mt7915_mac_write_txwi signature

This is a preliminary patch to share txwi configuration code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: rely on mt76_dev in mt7921_mac_write_txwi signature
Lorenzo Bianconi [Tue, 7 Jun 2022 09:28:37 +0000 (11:28 +0200)]
mt76: mt7921: rely on mt76_dev in mt7921_mac_write_txwi signature

This is a preliminary patch to share txwi configuration code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: enable the VHT extended NSS BW feature
Deren Wu [Tue, 7 Jun 2022 05:00:46 +0000 (13:00 +0800)]
mt76: enable the VHT extended NSS BW feature

According IEEE Std 802.11-2020, its definition is:
Indicates whether the STA is capable of interpreting the Extended NSS BW
Support subfield of the VHT Capabilities Information field.

Some APs, such as Xiaomi AX6000, would check this one for BW settings.
mt76 driver can get max BW capability only if the this field is confgured
properly.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7663: rely on mt76_connac2_fw_trailer
Lorenzo Bianconi [Fri, 3 Jun 2022 09:36:46 +0000 (11:36 +0200)]
mt76: mt7663: rely on mt76_connac2_fw_trailer

Remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac2_load_patch in connac module
Lorenzo Bianconi [Fri, 3 Jun 2022 09:36:45 +0000 (11:36 +0200)]
mt76: connac: move mt76_connac2_load_patch in connac module

Move mt76_connac2_load_patch utility routine in mt76_connac module since
it is shared between mt7921 and mt7915. This is a preliminary patch to
support mt7902e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move mt76_connac2_load_ram in connac module
Lorenzo Bianconi [Fri, 3 Jun 2022 09:36:44 +0000 (11:36 +0200)]
mt76: connac: move mt76_connac2_load_ram in connac module

Move mt76_connac2_load_ram utility routine in mt76_connac module since
it is shared between mt7921 and mt7915. This is a preliminary patch to
support mt7902e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: move fw toggle in mt7921_load_firmware
Lorenzo Bianconi [Fri, 3 Jun 2022 09:36:43 +0000 (11:36 +0200)]
mt76: mt7921: move fw toggle in mt7921_load_firmware

Move drv_own/fw_own toggle in mt7921_load_firmware. This change allow to
reuse connac code to load patch for mt7921 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: connac: move shared fw structures in connac module
Lorenzo Bianconi [Fri, 3 Jun 2022 09:36:42 +0000 (11:36 +0200)]
mt76: connac: move shared fw structures in connac module

Move mt76_connac2 fw structures in connac module since they are shared
between mt7921 and mt7915 drivers. This is a preliminary patch to add
mt7902e support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: get rid of mt7921_mcu_exit
Lorenzo Bianconi [Fri, 3 Jun 2022 08:21:37 +0000 (10:21 +0200)]
mt76: mt7921: get rid of mt7921_mcu_exit

Run skb_queue_purge when needed.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: add missing bh-disable around rx napi schedule
Lorenzo Bianconi [Fri, 3 Jun 2022 07:35:00 +0000 (09:35 +0200)]
mt76: mt7921: add missing bh-disable around rx napi schedule

napi_schedule() can call __raise_softirq_irqoff(), which can perform
softirq handling, so it must not be called in a pure process context
with BH enabled.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7615: add missing bh-disable around rx napi schedule
Felix Fietkau [Thu, 2 Jun 2022 19:44:21 +0000 (21:44 +0200)]
mt76: mt7615: add missing bh-disable around rx napi schedule

napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: add missing bh-disable around tx napi enable/schedule
Felix Fietkau [Thu, 2 Jun 2022 19:43:04 +0000 (21:43 +0200)]
mt76: mt7915: add missing bh-disable around tx napi enable/schedule

napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agodt-bindings: net: wireless: mt76: add clock description for MT7986.
Peter Chiu [Thu, 12 May 2022 04:38:59 +0000 (12:38 +0800)]
dt-bindings: net: wireless: mt76: add clock description for MT7986.

Add clocks and clock-names for MT7986.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921s: fix firmware download random fail
YN Chen [Sat, 28 May 2022 01:28:54 +0000 (09:28 +0800)]
mt76: mt7921s: fix firmware download random fail

To avoid racing problems in chip, mt7921s should reacquire drv-own after
firmware semaphore is released.

Fixes: 78b217580c509 ("mt76: mt7921s: fix bus hang with wrong privilege")
Signed-off-by: YN Chen <yn.chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: add PATCH_FINISH_REQ cmd response handling
YN Chen [Sat, 28 May 2022 01:28:53 +0000 (09:28 +0800)]
mt76: mt7921: add PATCH_FINISH_REQ cmd response handling

add new case to fetch the return value of PATCH_FINISH_REQ

Signed-off-by: YN Chen <yn.chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: add DBDC rxq handlings into mac_reset_work
Ryder Lee [Thu, 26 May 2022 09:08:55 +0000 (17:08 +0800)]
mt76: add DBDC rxq handlings into mac_reset_work

Enable/disable rx napi for DBDC.

Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: add more ethtool stats
Ryder Lee [Thu, 26 May 2022 09:08:54 +0000 (17:08 +0800)]
mt76: mt7915: add more ethtool stats

Add channel time and MAC ready stats.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: introduce ACPI SAR config in tx power
Deren Wu [Fri, 20 May 2022 09:03:39 +0000 (17:03 +0800)]
mt76: mt7921: introduce ACPI SAR config in tx power

Add new function mt7921_set_tx_sar_pwr() to update SAR power from
.set_sar_specs and ACPI setting. Both settings would be merged into
mt76_freq_range_power for final tx power value.

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: introduce ACPI SAR support
Deren Wu [Fri, 20 May 2022 09:03:38 +0000 (17:03 +0800)]
mt76: mt7921: introduce ACPI SAR support

In ACPI SAR enabled device, mt7921 should read power limit in ACPI config.
The limit value would be applied to regular tx power settings in mt76.

Two major functionalities added:
1. Get SAR power table through ACPI.
2. Read power in Dynamic/Geo SAR table for tx power limit.

Table note
MTDS: Dynamic SAR table
MTGS: Geo SAR table
MTCL: Country List table (for 6GHz support)

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: add 6 GHz band support in mt76_sar_freq_ranges
Deren Wu [Fri, 20 May 2022 09:03:37 +0000 (17:03 +0800)]
mt76: add 6 GHz band support in mt76_sar_freq_ranges

Add new frequencies support in mt76_sar_freq_ranges[]
* 5945 - 6165
* 6165 - 6405
* 6405 - 6525
* 6525 - 6705
* 6705 - 6865
* 6865 - 7125

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: fix endian bug in mt7915_rf_regval_set()
Dan Carpenter [Thu, 19 May 2022 13:57:22 +0000 (16:57 +0300)]
mt76: mt7915: fix endian bug in mt7915_rf_regval_set()

This code is supposed to set a u32 value, but casting will not work on
big endian systems.

Fixes: 0a17329ae9c1 ("mt76: mt7915: add debugfs knob for RF registers read/write")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt76x02u: fix possible memory leak in __mt76x02u_mcu_send_msg
Lorenzo Bianconi [Tue, 17 May 2022 16:37:07 +0000 (18:37 +0200)]
mt76: mt76x02u: fix possible memory leak in __mt76x02u_mcu_send_msg

Free the skb if mt76u_bulk_msg fails in __mt76x02u_mcu_send_msg routine.

Fixes: 4c89ff2c74e39 ("mt76: split __mt76u_mcu_send_msg and mt76u_mcu_send_msg routines")
Co-developed-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: fix endianness in mt7915_rf_regval_get
Lorenzo Bianconi [Tue, 17 May 2022 16:05:59 +0000 (18:05 +0200)]
mt76: mt7915: fix endianness in mt7915_rf_regval_get

Fix the following sparse warning in mt7915_rf_regval_get routine:
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:979:16: warning: cast to restricted __le32

Fixes: 0a17329ae9c1f ("mt76: mt7915: add debugfs knob for RF registers read/write")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agowifi: mac80211_hwsim: add back erroneously removed cast
Johannes Berg [Mon, 11 Jul 2022 11:14:24 +0000 (13:14 +0200)]
wifi: mac80211_hwsim: add back erroneously removed cast

The robots report that we're now casting to a differently
sized integer, which is correct, and the previous patch
had erroneously removed it.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 4ee186fa7e40 ("wifi: mac80211_hwsim: fix race condition in pending packet")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211_hwsim: fix race condition in pending packet
Jeongik Cha [Mon, 4 Jul 2022 08:43:54 +0000 (17:43 +0900)]
wifi: mac80211_hwsim: fix race condition in pending packet

A pending packet uses a cookie as an unique key, but it can be duplicated
because it didn't use atomic operators.

And also, a pending packet can be null in hwsim_tx_info_frame_received_nl
due to race condition with mac80211_hwsim_stop.

For this,
 * Use an atomic type and operator for a cookie
 * Add a lock around the loop for pending packets

Signed-off-by: Jeongik Cha <jeongik@google.com>
Link: https://lore.kernel.org/r/20220704084354.3556326-1-jeongik@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: Use the bitmap API to allocate bitmaps
Christophe JAILLET [Mon, 4 Jul 2022 19:16:09 +0000 (21:16 +0200)]
wifi: mac80211: Use the bitmap API to allocate bitmaps

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/dfb438a6a199ee4c95081fa01bd758fd30e50931.1656962156.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: fix center freq calculation in ieee80211_chandef_downgrade
MeiChia Chiu [Fri, 8 Jul 2022 09:58:23 +0000 (17:58 +0800)]
wifi: mac80211: fix center freq calculation in ieee80211_chandef_downgrade

When mac80211 downgrades working bandwidth, the
center_freq and center_freq1 need to be recalculated.
There is a typo in the case of downgrading bandwidth from
320MHz to 160MHz which would cause a wrong frequency value.

Reviewed-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Link: https://lore.kernel.org/r/20220708095823.12959-1-MeiChia.Chiu@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: fix sending link ID info of associated BSS
Veerendranath Jakkam [Fri, 8 Jul 2022 12:26:07 +0000 (17:56 +0530)]
wifi: nl80211: fix sending link ID info of associated BSS

commit dd374f84baec ("wifi: nl80211: expose link ID for associated
BSSes") used a top-level attribute to send link ID of the associated
BSS in the nested attribute NL80211_ATTR_BSS. But since NL80211_ATTR_BSS
is a nested attribute of the attributes defined in enum nl80211_bss,
define a new attribute in enum nl80211_bss and use it for sending the
link ID of the BSS.

Fixes: dd374f84baec ("wifi: nl80211: expose link ID for associated BSSes")
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20220708122607.1836958-1-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: cfg80211: fix a comment in cfg80211_mlme_mgmt_tx()
Veerendranath Jakkam [Fri, 8 Jul 2022 16:55:44 +0000 (22:25 +0530)]
wifi: cfg80211: fix a comment in cfg80211_mlme_mgmt_tx()

A comment in cfg80211_mlme_mgmt_tx() is describing this API used only
for transmitting action frames. Fix the comment since
cfg80211_mlme_mgmt_tx() can be used to transmit any management frame.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220708165545.2072999-1-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doit
Veerendranath Jakkam [Mon, 11 Jul 2022 05:34:43 +0000 (11:04 +0530)]
wifi: nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doit

nl80211_pre_doit() using nla_get_u16() to read u8 attribute
NL80211_ATTR_MLO_LINK_ID. Fix this by using nla_get_u8() to
read NL80211_ATTR_MLO_LINK_ID attribute.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/1657517683-5724-1-git-send-email-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Fri, 8 Jul 2022 14:03:42 +0000 (17:03 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

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

ath9k

* fix use-after-free in ath9k_hif_usb_rx_cb()

2 years agoath9k: remove unexpected words "the" in comments
Jiang Jian [Tue, 21 Jun 2022 08:02:40 +0000 (16:02 +0800)]
ath9k: remove unexpected words "the" in comments

there is unexpected word "the" in comments need to remove

Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220621080240.42198-1-jiangjian@cdjrlc.com
2 years agoath11k: Fix typo in comments
Zhang Jiaming [Mon, 4 Jul 2022 03:00:04 +0000 (11:00 +0800)]
ath11k: Fix typo in comments

There is a typo(isn't') in comments.
It maybe 'isn't' instead of 'isn't''.

Signed-off-by: Zhang Jiaming <jiaming@nfschina.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220704030004.16484-1-jiaming@nfschina.com
2 years agowifi: nl80211: retrieve EHT related elements in AP mode
Aloka Dixit [Mon, 23 May 2022 06:49:04 +0000 (23:49 -0700)]
wifi: nl80211: retrieve EHT related elements in AP mode

Add support to retrieve EHT capabilities and EHT operation elements
passed by the userspace in the beacon template and store the pointers
in struct cfg80211_ap_settings to be used by the drivers.

Co-developed-by: Vikram Kandukuri <quic_vikram@quicinc.com>
Signed-off-by: Vikram Kandukuri <quic_vikram@quicinc.com>
Co-developed-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20220523064904.28523-1-quic_alokad@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings
Veerendranath Jakkam [Mon, 23 May 2022 13:25:58 +0000 (18:55 +0530)]
wifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings

Increase akm_suites array size in struct cfg80211_crypto_settings to 10
and advertise the capability to userspace. This allows userspace to send
more than two AKMs to driver in netlink commands such as
NL80211_CMD_CONNECT.

This capability is needed for implementing WPA3-Personal transition mode
correctly with any driver that handles roaming internally. Currently,
the possible AKMs for multi-AKM connect can include PSK, PSK-SHA-256,
SAE, FT-PSK and FT-SAE. Since the count is already 5, increasing
the akm_suites array size to 10 should be reasonable for future
usecases.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/1653312358-12321-1-git-send-email-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: cfg80211: remove chandef check in cfg80211_cac_event()
Johannes Berg [Mon, 27 Jun 2022 10:49:03 +0000 (12:49 +0200)]
wifi: cfg80211: remove chandef check in cfg80211_cac_event()

The current check only worked for AP mode, but we can do
radar detection in mesh as well (for example). We could
try to check this using wdev_chandef(), but we also don't
really care since the chandef is passed in and we have no
need to use it anymore (since we added the argument in
commit d2859df5e7f0 ("cfg80211/mac80211: DFS setup chandef
for cac event")).

Change-Id: I856e4344d5e64ff4d2eead0b4c53b11f264be9b8
Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: relax wdev mutex check in wdev_chandef()
Johannes Berg [Mon, 27 Jun 2022 10:49:03 +0000 (12:49 +0200)]
wifi: nl80211: relax wdev mutex check in wdev_chandef()

In many cases we might get here from driver code that's
not really set up to care about the locking, and for the
non-MLO cases we really don't care so much about it. So
relax the checking here for now, perhaps we should even
remove it completely since we might not really care if
we point to an invalid link's chandef and can require
the caller to check the link validity first.

Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: acquire wdev mutex earlier in start_ap
Johannes Berg [Mon, 27 Jun 2022 10:49:03 +0000 (12:49 +0200)]
wifi: nl80211: acquire wdev mutex earlier in start_ap

We need to hold the wdev mutex already in order to call
nl80211_parse_tx_bitrate_mask(), so acquire it earlier.

Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: hold wdev mutex for tid config
Johannes Berg [Mon, 27 Jun 2022 10:43:37 +0000 (12:43 +0200)]
wifi: nl80211: hold wdev mutex for tid config

We need wdev_chandef() in this code, which now requires
the wdev mutex due to the per-link nature. Hold it here
to make sure we can access the link.

Reported-by: syzbot+b4e9aa0f32ffd9902442@syzkaller.appspotmail.com
Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: cfg80211: handle IBSS in channel switch
Johannes Berg [Mon, 27 Jun 2022 10:36:03 +0000 (12:36 +0200)]
wifi: cfg80211: handle IBSS in channel switch

Prior to commit 7b0a0e3c3a88 ("wifi: cfg80211: do some
rework towards MLO link APIs") the interface type didn't
really matter here, but now we need to handle all of the
possible cases. Add IBSS ("ADHOC") and handle it.

Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")
Reported-by: syzbot+90d912872157e63589e4@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: properly skip link info driver update
Johannes Berg [Mon, 27 Jun 2022 10:28:31 +0000 (12:28 +0200)]
wifi: mac80211: properly skip link info driver update

If the interface isn't (yet) added to the driver, skip the
link info update. This was previously done for the BSS info
changes, but I forgot to copy the same check here.

Fixes: 7b7090b4c6a9 ("wifi: mac80211: split bss_info_changed method")
Reported-by: syzbot+bce2ca140cc00578ed07@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: only accumulate airtime deficit for active clients
Felix Fietkau [Sat, 25 Jun 2022 21:24:11 +0000 (23:24 +0200)]
wifi: mac80211: only accumulate airtime deficit for active clients

When a client does not generate any local tx activity, accumulating airtime
deficit for the round-robin scheduler can be harmful. If this goes on for too
long, the deficit could grow quite large, which might cause unreasonable
initial latency once the client becomes active

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-7-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: add debugfs file to display per-phy AQL pending airtime
Felix Fietkau [Sat, 25 Jun 2022 21:24:10 +0000 (23:24 +0200)]
wifi: mac80211: add debugfs file to display per-phy AQL pending airtime

Now that the global pending airtime is more relevant for airtime fairness,
it makes sense to make it accessible via debugfs for debugging

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-6-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: add a per-PHY AQL limit to improve fairness
Felix Fietkau [Sat, 25 Jun 2022 21:24:09 +0000 (23:24 +0200)]
wifi: mac80211: add a per-PHY AQL limit to improve fairness

In order to maintain fairness, the amount of queueing needs to be limited
beyond the simple per-station AQL budget, otherwise the driver can simply
repeatedly do scheduling rounds until all queues that have not used their
AQL budget become eligble.

To be conservative, use the high AQL limit for the first txq and add half
of the low AQL for each subsequent queue.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-5-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: keep recently active tx queues in scheduling list
Felix Fietkau [Sat, 25 Jun 2022 21:24:08 +0000 (23:24 +0200)]
wifi: mac80211: keep recently active tx queues in scheduling list

This allows proper deficit accounting to ensure that they don't carry their
deficit until the next time they become active

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-4-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: consider aql_tx_pending when checking airtime deficit
Felix Fietkau [Sat, 25 Jun 2022 21:24:07 +0000 (23:24 +0200)]
wifi: mac80211: consider aql_tx_pending when checking airtime deficit

When queueing packets for a station, deficit only gets added once the packets
have been transmitted, which could be much later. During that time, a lot of
temporary unfairness could happen, which could lead to bursty behavior.
Fix this by subtracting the aql_tx_pending when checking the deficit in tx
scheduling.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-3-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: make sta airtime deficit field s32 instead of s64
Felix Fietkau [Sat, 25 Jun 2022 21:24:06 +0000 (23:24 +0200)]
wifi: mac80211: make sta airtime deficit field s32 instead of s64

32 bit is more than enough range for the airtime deficit

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-2-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: switch airtime fairness back to deficit round-robin scheduling
Felix Fietkau [Sat, 25 Jun 2022 21:24:05 +0000 (23:24 +0200)]
wifi: mac80211: switch airtime fairness back to deficit round-robin scheduling

This reverts commits 6a789ba679d652587532cec2a0e0274fda172f3b and
2433647bc8d983a543e7d31b41ca2de1c7e2c198.

The virtual time scheduler code has a number of issues:
- queues slowed down by hardware/firmware powersave handling were not properly
  handled.
- on ath10k in push-pull mode, tx queues that the driver tries to pull from
  were starved, causing excessive latency
- delay between tx enqueue and reported airtime use were causing excessively
  bursty tx behavior

The bursty behavior may also be present on the round-robin scheduler, but there
it is much easier to fix without introducing additional regressions

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://lore.kernel.org/r/20220625212411.36675-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: fix a kernel-doc complaint
Johannes Berg [Fri, 1 Jul 2022 08:42:40 +0000 (10:42 +0200)]
wifi: mac80211: fix a kernel-doc complaint

Somehow kernel-doc complains here about strong markup, but
we really don't need the [] so just remove that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: cfg80211: remove redundant documentation
Johannes Berg [Fri, 1 Jul 2022 08:36:36 +0000 (10:36 +0200)]
wifi: cfg80211: remove redundant documentation

These struct members no longer exist, remove them
from documentation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: sta_info: fix a missing kernel-doc struct element
Mauro Carvalho Chehab [Tue, 28 Jun 2022 09:46:07 +0000 (10:46 +0100)]
wifi: mac80211: sta_info: fix a missing kernel-doc struct element

struct link_sta_info has now a cur_max_bandwidth data:

net/mac80211/sta_info.h:569: warning: Function parameter or member 'cur_max_bandwidth' not described in 'link_sta_info'

Copy the meaning from struct sta_info, documenting it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/37d898634bb30776442a33833c48cbb21c90ecc6.1656409369.git.mchehab@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: add a missing comma at kernel-doc markup
Mauro Carvalho Chehab [Tue, 28 Jun 2022 09:46:06 +0000 (10:46 +0100)]
wifi: mac80211: add a missing comma at kernel-doc markup

The lack of the colon makes it not parse the function parameter:
include/net/mac80211.h:6250: warning: Function parameter or member 'vif' not described in 'ieee80211_channel_switch_disconnect'

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/11c1bdb861d89c93058fcfe312749b482851cbdb.1656409369.git.mchehab@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: cfg80211: fix kernel-doc warnings all over the file
Mauro Carvalho Chehab [Tue, 28 Jun 2022 09:46:05 +0000 (10:46 +0100)]
wifi: cfg80211: fix kernel-doc warnings all over the file

There are currently 17 kernel-doc warnings on this file:
include/net/cfg80211.h:391: warning: Function parameter or member 'bw' not described in 'ieee80211_eht_mcs_nss_supp'
include/net/cfg80211.h:437: warning: Function parameter or member 'eht_cap' not described in 'ieee80211_sband_iftype_data'
include/net/cfg80211.h:507: warning: Function parameter or member 's1g' not described in 'ieee80211_sta_s1g_cap'
include/net/cfg80211.h:1390: warning: Function parameter or member 'counter_offset_beacon' not described in 'cfg80211_color_change_settings'
include/net/cfg80211.h:1390: warning: Function parameter or member 'counter_offset_presp' not described in 'cfg80211_color_change_settings'
include/net/cfg80211.h:1430: warning: Enum value 'STATION_PARAM_APPLY_STA_TXPOWER' not described in enum 'station_parameters_apply_mask'
include/net/cfg80211.h:2195: warning: Function parameter or member 'dot11MeshConnectedToAuthServer' not described in 'mesh_config'
include/net/cfg80211.h:2341: warning: Function parameter or member 'short_ssid' not described in 'cfg80211_scan_6ghz_params'
include/net/cfg80211.h:3328: warning: Function parameter or member 'kck_len' not described in 'cfg80211_gtk_rekey_data'
include/net/cfg80211.h:3698: warning: Function parameter or member 'ftm' not described in 'cfg80211_pmsr_result'
include/net/cfg80211.h:3828: warning: Function parameter or member 'global_mcast_stypes' not described in 'mgmt_frame_regs'
include/net/cfg80211.h:4977: warning: Function parameter or member 'ftm' not described in 'cfg80211_pmsr_capabilities'
include/net/cfg80211.h:5742: warning: Function parameter or member 'u' not described in 'wireless_dev'
include/net/cfg80211.h:5742: warning: Function parameter or member 'links' not described in 'wireless_dev'
include/net/cfg80211.h:5742: warning: Function parameter or member 'valid_links' not described in 'wireless_dev'
include/net/cfg80211.h:6076: warning: Function parameter or member 'is_amsdu' not described in 'ieee80211_data_to_8023_exthdr'
include/net/cfg80211.h:6949: warning: Function parameter or member 'sig_dbm' not described in 'cfg80211_notify_new_peer_candidate'

Address them, in order to build a better documentation from this
header.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/f6f522cdc716a01744bb0eae2186f4592976222b.1656409369.git.mchehab@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: ieee80211: s1g action frames are not robust
Peter Chiu [Wed, 22 Jun 2022 01:08:20 +0000 (09:08 +0800)]
wifi: ieee80211: s1g action frames are not robust

S1g action frame with code 22 is not protected so update the robust
action frame list.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Link: https://lore.kernel.org/r/20220622010820.17522-1-chui-hao.chiu@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: rtw89: 8852a: rfk: fix div 0 exception
Ping-Ke Shih [Mon, 13 Jun 2022 06:51:44 +0000 (14:51 +0800)]
wifi: rtw89: 8852a: rfk: fix div 0 exception

The DPK is a kind of RF calibration whose algorithm is to fine tune
parameters and calibrate, and check the result. If the result isn't good
enough, it could adjust parameters and try again.

This issue is to read and show the result, but it could be a negative
calibration result that causes divisor 0 and core dump. So, fix it by
phy_div() that does division only if divisor isn't zero; otherwise,
zero is adopted.

  divide error: 0000 [#1] PREEMPT SMP NOPTI
  CPU: 1 PID: 728 Comm: wpa_supplicant Not tainted 5.10.114-16019-g462a1661811a #1 <HASH:d024 28>
  RIP: 0010:rtw8852a_dpk+0x14ae/0x288f [rtw89_core]
  RSP: 0018:ffffa9bb412a7520 EFLAGS: 00010246
  RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: 00000000000180fc RDI: ffffa141d01023c0
  RBP: ffffa9bb412a76a0 R08: 0000000000001319 R09: 00000000ffffff92
  R10: ffffffffc0292de3 R11: ffffffffc00d2f51 R12: 0000000000000000
  R13: ffffa141d01023c0 R14: ffffffffc0290250 R15: ffffa141d0102638
  FS:  00007fa99f5c2740(0000) GS:ffffa142e5e80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000013e8e010 CR3: 0000000110d2c000 CR4: 0000000000750ee0
  PKRU: 55555554
  Call Trace:
   rtw89_core_sta_add+0x95/0x9c [rtw89_core <HASH:d239 29>]
   rtw89_ops_sta_state+0x5d/0x108 [rtw89_core <HASH:d239 29>]
   drv_sta_state+0x115/0x66f [mac80211 <HASH:81fe 30>]
   sta_info_insert_rcu+0x45c/0x713 [mac80211 <HASH:81fe 30>]
   sta_info_insert+0xf/0x1b [mac80211 <HASH:81fe 30>]
   ieee80211_prep_connection+0x9d6/0xb0c [mac80211 <HASH:81fe 30>]
   ieee80211_mgd_auth+0x2aa/0x352 [mac80211 <HASH:81fe 30>]
   cfg80211_mlme_auth+0x160/0x1f6 [cfg80211 <HASH:00cd 31>]
   nl80211_authenticate+0x2e5/0x306 [cfg80211 <HASH:00cd 31>]
   genl_rcv_msg+0x371/0x3a1
   ? nl80211_stop_sched_scan+0xe5/0xe5 [cfg80211 <HASH:00cd 31>]
   ? genl_rcv+0x36/0x36
   netlink_rcv_skb+0x8a/0xf9
   genl_rcv+0x28/0x36
   netlink_unicast+0x27b/0x3a0
   netlink_sendmsg+0x2aa/0x469
   sock_sendmsg_nosec+0x49/0x4d
   ____sys_sendmsg+0xe5/0x213
   __sys_sendmsg+0xec/0x157
   ? syscall_enter_from_user_mode+0xd7/0x116
   do_syscall_64+0x43/0x55
   entry_SYSCALL_64_after_hwframe+0x44/0xa9
  RIP: 0033:0x7fa99f6e689b

Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220613065144.15647-1-pkshih@realtek.com
2 years agowifi: rtw89: disable invalid phy reports for all ICs
Po-Hao Huang [Fri, 10 Jun 2022 07:26:10 +0000 (15:26 +0800)]
wifi: rtw89: disable invalid phy reports for all ICs

Previously we only disable invalid reports for 52A, since we plan to
support more ICs in the future, enable settings for those as well.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-12-pkshih@realtek.com
2 years agowifi: rtw89: pci: fix PCI doesn't reclaim TX BD properly
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:09 +0000 (15:26 +0800)]
wifi: rtw89: pci: fix PCI doesn't reclaim TX BD properly

TX BD (TX ring index) and TX WD (WiFi descriptor buffer) are freed
asynchronously. With burst packets, we free TX WD, but the corresponding
TX BD couldn't be freed yet. Then, TX can possibly get stuck due to no
more TX BD.

To avoid this, ignore reclaiming TX BD only if TX WD is no free space,
because at this moment TX BD must have some spaces. Otherwise, we reclaim
TX BD to resolve TX stuck issue.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-11-pkshih@realtek.com
2 years agowifi: rtw89: fix long RX latency in low power mode
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:08 +0000 (15:26 +0800)]
wifi: rtw89: fix long RX latency in low power mode

In low power mode, regular IO is power off, so we don't schedule napi to
poll RX and TX completion. Therefore, calling ieee80211_rx_napi() with
napi instance causes long RX latency. To fix this, use NULL as argument,
and then it can use netif_receive_skb_list() to receive.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-10-pkshih@realtek.com
2 years agowifi: rtw89: drop invalid TX rate report of legacy rate
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:07 +0000 (15:26 +0800)]
wifi: rtw89: drop invalid TX rate report of legacy rate

Somehow, firmware could report invalid TX rate, and we consider the
invalid rate as 0 that will make a wrong decision. So, drop invalid
reports, and also suppress the warning message.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-9-pkshih@realtek.com
2 years agowifi: rtw89: add UNEXP debug mask to keep monitor messages unexpected to happen frequ...
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:06 +0000 (15:26 +0800)]
wifi: rtw89: add UNEXP debug mask to keep monitor messages unexpected to happen frequently

Some warning messages could bother users. With proper handling, these
situations don't really affect usage, but we still need to keep monitor
these messages. If they happen frequently, we must review driver or
hardware design to clarify.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-8-pkshih@realtek.com
2 years agowifi: rtw89: enable VO TX AMPDU
Kuan-Chung Chen [Fri, 10 Jun 2022 07:26:05 +0000 (15:26 +0800)]
wifi: rtw89: enable VO TX AMPDU

To improve VO throughput, we enable VO TX AMPDU.

We measure the latency of enable or disable VO TX AMPDU. The experimental
results show that the difference between the two is insignificant only
300µs, so the little impact can be ignored for user experience.

Moreover, we found some APs will have a group key handshake timeout issue
when the EAPOL's TID is already setup BA session. Therefore, when
transmitting EAPOL, if EAPOL's TID BA session is already setup, we need
to delete it.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-7-pkshih@realtek.com
2 years agowifi: rtw89: fix potential TX stuck
Kuan-Chung Chen [Fri, 10 Jun 2022 07:26:04 +0000 (15:26 +0800)]
wifi: rtw89: fix potential TX stuck

The potential TX stuck occurs when there are lots of packets to be
transmitted and the boundary of the tx_resource is hit. Add this
patch to avoid the TX stuck when burst traffic.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-6-pkshih@realtek.com
2 years agowifi: rtw89: support TDLS
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:03 +0000 (15:26 +0800)]
wifi: rtw89: support TDLS

Since we can allocate MAC ID, BSSID and address CAM to TDLS peer, declare
we can support TDLS now.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-5-pkshih@realtek.com
2 years agowifi: rtw89: allocate BSSID CAM per TDLS peer
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:02 +0000 (15:26 +0800)]
wifi: rtw89: allocate BSSID CAM per TDLS peer

In STA mode, if peer is TDLS. Allocate a BSSID CAM entry with peer's
address to match address properly, and then hardware can ACK peer's
packets and receive packets to driver.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-4-pkshih@realtek.com
2 years agowifi: rtw89: separate BSSID CAM operations
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:01 +0000 (15:26 +0800)]
wifi: rtw89: separate BSSID CAM operations

Normally, we allocate a BSSID CAM to a vif. By hardware design, we must
allocate a BSSID CAM to each TDLS peer, so separate BSSID CAM operations
that will be used by later patches.

This patch doesn't change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-3-pkshih@realtek.com
2 years agowifi: rtw89: allocate address CAM and MAC ID to TDLS peer
Ping-Ke Shih [Fri, 10 Jun 2022 07:26:00 +0000 (15:26 +0800)]
wifi: rtw89: allocate address CAM and MAC ID to TDLS peer

Normally, we only allocate an address CAM and single one MAC ID to AP in
STA mode. To support TDLS, we handle TDLS peers like AP handles stations.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220610072610.27095-2-pkshih@realtek.com
2 years agowifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()
Alexey Kodanev [Wed, 8 Jun 2022 17:16:14 +0000 (20:16 +0300)]
wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd()

As a result of the execution of the inner while loop, the value
of 'idx' can be equal to LINK_QUAL_MAX_RETRY_NUM. However, this
is not checked after the loop and 'idx' is used to write the
LINK_QUAL_MAX_RETRY_NUM size array 'lq_cmd->rs_table[idx]' below
in the outer loop.

The fix is to check the new value of 'idx' inside the nested loop,
and break both loops if index equals the size. Checking it at the
start is now pointless, so let's remove it.

Detected using the static analysis tool - Svace.

Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965")
Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220608171614.28891-1-aleksei.kodanev@bell-sw.com
2 years agocfg80211: Indicate MLO connection info in connect and roam callbacks
Veerendranath Jakkam [Wed, 8 Jun 2022 09:16:37 +0000 (14:46 +0530)]
cfg80211: Indicate MLO connection info in connect and roam callbacks

The MLO links used for connection with an MLD AP are decided by the
driver in case of SME offloaded to driver.

Add support for the drivers to indicate the information of links used
for MLO connection in connect and roam callbacks, update the connected
links information in wdev from connect/roam result sent by driver.
Also, send the connected links information to userspace.

Add a netlink flag attribute to indicate that userspace supports
handling of MLO connection. Drivers must not do MLO connection when this
flag is not set. This is to maintain backwards compatibility with older
supplicant versions which doesn't have support for MLO connection.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211_hwsim: print the link id
Shaul Triebitz [Tue, 14 Jun 2022 09:26:39 +0000 (12:26 +0300)]
wifi: mac80211_hwsim: print the link id

Print the link ID in link_info_changed function.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211_hwsim: support creating MLO-capable radios
Johannes Berg [Wed, 8 Jun 2022 12:23:39 +0000 (14:23 +0200)]
wifi: mac80211_hwsim: support creating MLO-capable radios

Add initial support to hwsim for creating MLO-capable
radios dynamically (and statically via module parameter,
but that's not really recommended.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: expose link ID for associated BSSes
Johannes Berg [Mon, 13 Jun 2022 14:52:02 +0000 (16:52 +0200)]
wifi: nl80211: expose link ID for associated BSSes

When retrieving scan data, expose not just whether or not the
interface (possibly an MLD) is associated to the BSS or not,
but also on which link ID if it is an MLD.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: nl80211: expose link information for interfaces
Johannes Berg [Mon, 13 Jun 2022 14:51:27 +0000 (16:51 +0200)]
wifi: nl80211: expose link information for interfaces

When getting/dumping an interface, expose information about
valid links.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211_hwsim: send a beacon per link
Shaul Triebitz [Mon, 6 Jun 2022 17:03:17 +0000 (20:03 +0300)]
wifi: mac80211_hwsim: send a beacon per link

Add to hwsim a link_data structure.
For now, move the beacon interval and beacon timer to
the link_data structure (making them per link).
Set a beacon timer for each link and transmit a per
link beacon (pass the link_id to ieee80211_beacon_get).

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: set STA deflink addresses
Johannes Berg [Wed, 15 Jun 2022 09:50:00 +0000 (11:50 +0200)]
wifi: mac80211: set STA deflink addresses

We should set the STA deflink addresses in case no
link is really added.

Fixes: 046d2e7c50e3 ("mac80211: prepare sta handling for MLO support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: maintain link-sta hash table
Johannes Berg [Tue, 14 Jun 2022 11:07:42 +0000 (13:07 +0200)]
wifi: mac80211: maintain link-sta hash table

Maintain a hash table of link-sta addresses so we can find
them for management frames etc. where addresses haven't
been replaced by the drivers to the MLD address yet.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agowifi: mac80211: RCU-ify link STA pointers
Johannes Berg [Wed, 15 Jun 2022 07:20:45 +0000 (09:20 +0200)]
wifi: mac80211: RCU-ify link STA pointers

We need to be able to access these in a race-free way under
traffic while adding/removing them, so RCU-ify the pointers.
This requires passing a link_sta to a lot of functions so
we don't have to do the RCU handling everywhere.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>