Commit Graph
3245 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau 899d192e8a 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-21 20:47:36 +02:00
Lorenzo BianconiandFelix Fietkau 149e95f5d7 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-21 20:47:36 +02:00
Lorenzo BianconiandFelix Fietkau 18df38fe77 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-21 20:47:36 +02:00
Deren WuandFelix Fietkau fd3958970e 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 <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-21 20:47:36 +02:00
Felix Fietkau e522834390 mt76: mt7915: disable UL MU-MIMO for mt7915
After initially establishing a connection, it can produce multi-second latency
spikes and tx hangs when pushing traffic.
It should work better for MT7916 and MT7986, so leave it enabled there

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-21 20:35:36 +02:00
Deren WuandFelix Fietkau 8a04f1b046 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 <[email protected]>
Reviewed-by: Sean Wang <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:16:03 +02:00
Deren WuandFelix Fietkau 6329a83490 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 <[email protected]>
Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau f8d125b4ea 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau e0eaf66eae 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau cb75aaa392 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 649bdc4983 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 4876740626 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau cae61112ef mt76: connac: move HE radiotap parsing in connac module
HE radiotap parsing code is shared between connac2 devices.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Deren WuandFelix Fietkau f1f46d3b4b 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 <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Deren WuandFelix Fietkau 1b492be795 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 <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 012e619a07 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau b5eecc841d 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau ecefae4c7d 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 934029bb93 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 488a5ccc97 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Deren WuandFelix Fietkau d6ae3505ac 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 <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 051c68d182 mt76: mt7663: rely on mt76_connac2_fw_trailer
Remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 29fd748801 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 16ab6bf495 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau db4d784ae7 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 <[email protected]>
Tested-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau fee8a5911c 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau 9aeca2a5ce mt76: mt7921: get rid of mt7921_mcu_exit
Run skb_queue_purge when needed.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Lorenzo BianconiandFelix Fietkau a3f1d6ccf3 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-17 12:14:22 +02:00
Deren WuandFelix Fietkau 4554ee652c mt76: mt7921: fix warning Using plain integer as NULL pointer
Changed "0 to NULL" to avoid below sparse warnings
.../mt76/mt7921/acpi_sar.c:64:68: sparse: Using plain integer as NULL pointer

Fixes: ab79a7d7a96f ("mt76: mt7921: introduce ACPI SAR support")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
2022-06-17 11:57:33 +02:00
Felix Fietkau 1d8af168e8 mt76: mt7615: add missing bh-disable around rx 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 <[email protected]>
2022-06-02 21:45:37 +02:00
Felix Fietkau 28b19d2cc5 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 <[email protected]>
2022-06-02 21:45:33 +02:00
YN ChenandFelix Fietkau f8b9be4287 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 <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:31 +02:00
YN ChenandFelix Fietkau b284684f5c 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 <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:31 +02:00
Ryder LeeandFelix Fietkau cdd66d6429 mt76: add DBDC rxq handlings into mac_reset_work
Enable/disable rx napi for DBDC.

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Ryder LeeandFelix Fietkau 54b6504a3e mt76: mt7915: add more ethtool stats
Add channel time and MAC ready stats.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Deren WuandFelix Fietkau 8c27300b42 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 <[email protected]>
Co-developed-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Deren WuandFelix Fietkau 268ce38e9e 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 <[email protected]>
Co-developed-by: Quan Zhou <[email protected]>
Signed-off-by: Quan Zhou <[email protected]>
Co-developed-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Deren WuandFelix Fietkau 380eac6f31 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 <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Dan CarpenterandFelix Fietkau d299ad96d8 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Lorenzo BianconiandFelix Fietkau 0742eaeafe 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 <[email protected]>
Signed-off-by: Gergo Koteles <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Lorenzo BianconiandFelix Fietkau e1b2c18eee 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:39:30 +02:00
Deren WuandFelix Fietkau 8e87669eef mt76: mt7921: add ipv6 NS offload support
Add ipv6 NS offload for WoWLAN state.

Tested in this way:
1. Put device-A into WoW state.
2. ping6 from device-B to device-A.
3. In sniffer, see Neighbour advertisement from device-A.

Reviewed-by: Sean Wang <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:33:17 +02:00
Lorenzo BianconiandFelix Fietkau 3a65deb937 mt76: add gfp to mt76_mcu_msg_alloc signature
Introduce __mt76_mcu_msg_alloc utility routine in order to specify gfp
flags for mcu message allocation.

Acked-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:33:17 +02:00
Ryder LeeandFelix Fietkau 838529da64 mt76: mt7915: add more statistics from fw_util debugfs knobs
Print out exception state and program counters of WA/WM MCUs.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:33:17 +02:00
Ryder LeeandFelix Fietkau bb54f5e1c1 mt76: mt7915: improve error handling for fw_debug knobs
In case fw.debug_wm/wa might be unavailable.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:31:01 +02:00
Bo JiaoandFelix Fietkau 31273183ea mt76: mt7615/mt7915: do reset_work with mt76's work queue
reset_work may be blocked when mcu message timeout occurs

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:31:01 +02:00
MeiChia ChiuandFelix Fietkau 2b7f5e8529 mt76: mt7915: add support for 6G in-band discovery
Add offloading FILS discovery and unsolicited broadcast probe response support.

Reviewed-by: Ryder Lee <[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-12 11:30:45 +02:00
Ryder LeeandFelix Fietkau 8152406768 mt76: mt7915: move MT_INT_MASK_CSR to init.c
To avoid redundant MT_INT_MASK_CSR settings.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-05 14:27:56 +02:00
Ryder LeeandFelix Fietkau bac5f22365 mt76: mt7915: introduce mt7915_mac_severe_check()
In rare cases, TRB pointers might be out of sync leads to RMAC stopping
Rx that requires minimal recovery, so add this helper to periodically
check TRB status.

Tested-by: Chad Monroe <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-05 14:27:56 +02:00
Ryder LeeandFelix Fietkau 84319691b7 mt76: mt7915: reowrk SER debugfs knob
1. get status of system recovery from firmware.
2. add more recovery points.
3. make knob per phy.

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-05-05 14:27:56 +02:00