Commit Graph
3330 Commits
Author SHA1 Message Date
Shayne ChenandFelix Fietkau b0114a0abb wifi: mt76: mt7915: rework testmode tx antenna setting
Let the configuration of testmode antenna mask on both band0 and band1
become antenna_mask rather than chainmask. This could simplify the
settings for user and get rid of the conversion when sending fw command.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Peter ChiuandFelix Fietkau 6606507317 wifi: mt76: mt7915: deal with special variant of mt7916
A variant of mt7916 supports up to 3 tx/rx paths but with only
2 spatial streams. An example usage of the 3rd path is to server as
an auxiliary for beamforming.
In order to deal with this case, this patch reworks some parts to
correctly use paths or streams.

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Shayne ChenandFelix Fietkau ad3d0f8db0 wifi: mt76: mt7915: rework eeprom tx paths and streams init
Rework tx paths and streams init part to improve readability, and make
sure that the available tx streams should be smaller than or equal to
the available tx paths.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Evelyn TsaiandFelix Fietkau 06df7e6892 wifi: mt76: mt7915: reserve 8 bits for the index of rf registers
The value of regidx of rf registers is combined with WF selection and
offset. Extend the WF selection field from 4 to 8 bits since the
adie index should also be specified.

Signed-off-by: Evelyn Tsai <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Ben GreearandFelix Fietkau d75f15ddeb wifi: mt76: mt7915: fix bounds checking for tx-free-done command
According to the tx-free-done documentation, the DW4 can be repeated,
so have to be more careful about how we test for walking off the
end of the array.

Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Gaosheng CuiandFelix Fietkau 9059a5de3b wifi: mt76: Remove unused inline function mt76_wcid_mask_test()
All uses of mt76_wcid_mask_test() have
been removed since commit 8950a62f19c9 ("mt76: get rid of
mt76_wcid_hw routine"), so remove it.

Signed-off-by: Gaosheng Cui <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Sean WangandFelix Fietkau c07f3d2d5e wifi: mt76: mt7921: fix antenna signal are way off in monitor mode
Group 3 in RxD is disabled in monitor mode. We should use the group 5 in
RxD instead to fix antenna signal way off issue, e.g we would see the
incorrect antenna signal value in wireshark. On the other hand, Group 5
wouldn't be used in STA or AP mode, so the patch shouldn't cause any
harm to those modes.

Fixes: cbaa0a404f8d ("mt76: mt7921: fix up the monitor mode")
Reported-by: Adrian Granados <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 14:38:05 +02:00
Felix Fietkau 3f27f6adb1 wifi: mt76: mt76x02: simplify struct mt76x02_rate_power
- remove stbc, because mt76x0 doesn't support it and mt76x2 uses the same
  values as HT/VHT
- reduce vht array to 2 elements, because VHT MCS0-7 are the same as HT

Signed-off-by: Felix Fietkau <[email protected]>
2022-09-28 11:29:46 +02:00
Felix Fietkau e49b6063fb wifi: mt76: move mt76_rate_power from core to mt76x02 driver code
Its layout and code is mt76x02 specific

Signed-off-by: Felix Fietkau <[email protected]>
2022-09-28 11:29:15 +02:00
Deren WuandFelix Fietkau 9d601f4eee linux-firmware: update firmware for MT7922 WiFi device
Update binary firmware for MT7922 WiFi devices

File: firmware/WIFI_MT7922_patch_mcu_1_1_hdr.bin
Version: 20220908203203a
File: firmware/WIFI_RAM_CODE_MT7922_1.bin
Version: 20220908203253

Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Josh Boyer <[email protected]>
2022-09-23 14:50:37 +02:00
Deren WuandFelix Fietkau 60fcf08fe6 linux-firmware: update firmware for MT7921 WiFi device
Update binary firmware for MT7921 WiFi devices

File: firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin
Version: 20220908210919a
File: firmware/WIFI_RAM_CODE_MT7961_1.bin
Version: 20220908211021

Signed-off-by: Deren Wu <[email protected]>
2022-09-23 14:46:01 +02:00
Deren WuandFelix Fietkau e4fa68a9b3 linux-firmware: update firmware for MT7921 WiFi device
Update binary firmware for MT7921 WiFi devices

File: firmware/WIFI_MT7961_patch_mcu_1_2_hdr.bin
Version: 20220608210839a
File: firmware/WIFI_RAM_CODE_MT7961_1.bin
Version: 20220608210922

Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Josh Boyer <[email protected]>
2022-09-23 14:45:58 +02:00
Deren WuandFelix Fietkau 763a1d9013 wifi: mt76: mt7921e: fix random fw download fail
In case of PCIe interoperability problem shows up, the firmware
payload may be corrupted in download stage. Turn off L0s to keep
fw download process accurately.

[ 1093.528363] mt7921e 0000:3b:00.0: Message 00000007 (seq 7) timeout
[ 1093.528414] mt7921e 0000:3b:00.0: Failed to start patch
[ 1096.600156] mt7921e 0000:3b:00.0: Message 00000010 (seq 8) timeout
[ 1096.600207] mt7921e 0000:3b:00.0: Failed to release patch semaphore
[ 1097.699031] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1098.758427] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1099.834408] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1100.915264] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1101.990625] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1103.077587] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1104.173258] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1105.248466] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1106.336969] mt7921e 0000:3b:00.0: Timeout for driver own
[ 1106.397542] mt7921e 0000:3b:00.0: hardware init failed

Cc: [email protected]
Fixes: bf3747ae2e25 ("mt76: mt7921: enable aspm by default")
Signed-off-by: Deren Wu <[email protected]>
Tested-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:15:49 +02:00
Ming Yen HsiehandFelix Fietkau ebbd68842e wifi: mt76: mt7921: introduce Country Location Control support
Country Location Control (CLC) is an additional control for country rules
in firmware. We introduce this new feature to make sure mt7921 series
working properly in all region.

The addtional policies would be put into firmware based on differnt
regions. mt76 driver should be in charge of submitting per region policy.

Reviewed-by: Sean Wang <[email protected]>
Tested-by: YN Chen <[email protected]>
Co-developed-by: Deren Wu <[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-09-15 13:15:49 +02:00
Deren WuandFelix Fietkau cddc4b43ea wifi: mt76: mt7921e: fix rmmod crash in driver reload test
In insmod/rmmod stress test, the following crash dump shows up immediately.
The problem is caused by missing mt76_dev in mt7921_pci_remove(). We
should make sure the drvdata is ready before probe() finished.

[168.862789] ==================================================================
[168.862797] BUG: KASAN: user-memory-access in try_to_grab_pending+0x59/0x480
[168.862805] Write of size 8 at addr 0000000000006df0 by task rmmod/5361
[168.862812] CPU: 7 PID: 5361 Comm: rmmod Tainted: G           OE     5.19.0-rc6 #1
[168.862816] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, 05/04/2020
[168.862820] Call Trace:
[168.862822]  <TASK>
[168.862825]  dump_stack_lvl+0x49/0x63
[168.862832]  print_report.cold+0x493/0x6b7
[168.862845]  kasan_report+0xa7/0x120
[168.862857]  kasan_check_range+0x163/0x200
[168.862861]  __kasan_check_write+0x14/0x20
[168.862866]  try_to_grab_pending+0x59/0x480
[168.862870]  __cancel_work_timer+0xbb/0x340
[168.862898]  cancel_work_sync+0x10/0x20
[168.862902]  mt7921_pci_remove+0x61/0x1c0 [mt7921e]
[168.862909]  pci_device_remove+0xa3/0x1d0
[168.862914]  device_remove+0xc4/0x170
[168.862920]  device_release_driver_internal+0x163/0x300
[168.862925]  driver_detach+0xc7/0x1a0
[168.862930]  bus_remove_driver+0xeb/0x2d0
[168.862935]  driver_unregister+0x71/0xb0
[168.862939]  pci_unregister_driver+0x30/0x230
[168.862944]  mt7921_pci_driver_exit+0x10/0x1b [mt7921e]
[168.862949]  __x64_sys_delete_module+0x2f9/0x4b0
[168.862968]  do_syscall_64+0x38/0x90
[168.862973]  entry_SYSCALL_64_after_hwframe+0x63/0xcd

Test steps:
1. insmode
2. do not ifup
3. rmmod quickly (within 1 second)

Fixes: 1c71e03afe4b ("mt76: mt7921: move mt7921_init_hw in a dedicated work")
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:15:49 +02:00
Sean WangandFelix Fietkau 0c0bda4aea wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value
We should reset mstat->airtime_ac along with clear up the entries in the
hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the
value msta->airtime_ac - [tx, rx]_last may be a negative and that is not
the actual airtime the device took in the last run.

Reported-by: YN Chen <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:15:49 +02:00
Howard HsuandFelix Fietkau e06376af21 wifi: mt76: mt7915: do not check state before configuring implicit beamform
Do not need to check running state before configuring implicit Tx
beamform. It is okay to configure implicit Tx beamform in run time.
Noted that the existing connected stations will be applied for new
configuration only if they reconnected to the interface.

Fixes: 6377b7f330 ("mt76: mt7915: add implicit Tx beamforming support")

Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:15:49 +02:00
Lorenzo BianconiandFelix Fietkau 5e45533e4b wifi: mt76: fix uninitialized pointer in mt7921_mac_fill_rx
Initialize msta pointer to NULL in mt7921_mac_fill_rx() in order to not
dereference a uninitialized pointer.

Fixes: 0880d40871d1d ("mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:15:49 +02:00
Howard HsuandFelix Fietkau 2ac22300c7 wifi: mt76: mt7915: fix mcs value in ht mode
Fix the error that mcs will be reduced to a range of 0 to 7 in ht mode.

Fixes: 70fd1333cd32 ("mt76: mt7915: rework .set_bitrate_mask() to support more options")

Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:15:49 +02:00
Sean WangandFelix Fietkau d11f971a45 wifi: mt76: mt7921: get rid of the false positive reset
False positive reset would be possibly triggered by those commands we
applied in suspend with HZ MCU timeout, especially it happened when we
enabled kernel log in pm core to diagnose how much time we spend in each
driver during suspend procedure. So we enlarge the value and align the MCU
timeout as other commands we did to reduce the false positive reset.

Signed-off-by: Sean Wang <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Ruffalo LavoisierandFelix Fietkau 0c64a80a61 wifi: mt76: connac: fix in comment
Correct spelling on 'transmitted' in comment

Signed-off-by: Ruffalo Lavoisier <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Ryder LeeandFelix Fietkau 873365b06c wifi: mt76: add PPDU based TxS support for WED device
Given that there's no data coming from network stack for binding flows,
hence driver counts and reports station's statistics directly through
NL80211_STA_INFO_* based on active PPDU based TxS for offloading data.

Apart from that, WA firmware and its offloading engine (SDO) have hardcoded
"2" as PID, so we introduce MT_PACKET_ID_WED to differentiate WED reporting.

Note that PPDU format TxS is mutually exclusive with MT_TXD5_TX_STATUS_HOST.

Co-developed-by: Yi-Chia Hsieh <[email protected]>
Signed-off-by: Yi-Chia Hsieh <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Ryder LeeandFelix Fietkau 2d72c9a740 wifi: mt76: move move mt76_sta_stats to mt76_wcid
This is a preliminary patch for WED's TxS support.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Sean WangandFelix Fietkau b55a4eb2ee wifi: mt76: mt7921: fix the firmware version report
Fix the regression of the firmware version report since
'b9ec27102ac0 ('mt76: connac: move mt76_connac2_load_ram in connac
module')'.

Fixes: b9ec27102ac0 ("mt76: connac: move mt76_connac2_load_ram in connac module")
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Sean WangandFelix Fietkau fbb3554b62 wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload
Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race
with the context holding dev->muxtex and the driver might access the
device in low power state.

Fixes: 24299fc869f7 ("mt76: mt7921: enable rx header traslation offload")
Tested-by: AngeloGioacchino Del Regno <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Sean WangandFelix Fietkau 0a392ca03d wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap
Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race
with the context holding dev->muxtex and the driver might access the
device in low power state.

Fixes: 9d958b60ebc2 ("mt76: mt7921: fix command timeout in AP stop period")
Tested-by: AngeloGioacchino Del Regno <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Gergo KotelesandFelix Fietkau 019ef069e7 wifi: mt76: mt76_usb.mt76u_mcu.burst is always false remove related code
Simplify mt76x02u_multiple_mcu_reads routine since burst is always
false.

Signed-off-by: Gergo Koteles <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Lorenzo BianconiandFelix Fietkau 52eec74986 wifi: mt76: mt7663s: add rx_check callback
Introduce rx_check callback support for mt7663s driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Lorenzo BianconiandFelix Fietkau c4132ab0be wifi: mt76: connac: fix possible unaligned access in mt76_connac_mcu_add_nested_tlv
Fix possible unaligned pointer in mt76_connac_mcu_add_nested_tlv
routine.

Reported-by: kernel test robot <[email protected]>
Fixes: 25702d9c55dc5 ("mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Lorenzo BianconiandFelix Fietkau bf79f5d73e wifi: mt76: mt7915: fix possible unaligned access in mt7915_mac_add_twt_setup
Fix possible unaligned pointer in mt7915_mac_add_twt_setup routine.

Reported-by: kernel test robot <[email protected]>
Fixes: 3782b69d03e71 ("mt76: mt7915: introduce mt7915_mac_add_twt_setup routine")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Lorenzo BianconiandFelix Fietkau 206c7ebd74 wifi: mt76: mt7615: add mt7615_mutex_acquire/release in mt7615_sta_set_decap_offload
Similar to mt7921 driver, introduce mt7615_mutex_acquire/release in
mt7615_sta_set_decap_offload in order to avoid sending mcu commands
while the device is in low-power state.

Fixes: d4b98c63d7a77 ("mt76: mt7615: add support for rx decapsulation offload")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
YN ChenandFelix Fietkau fe85e5ccba wifi: mt76: sdio: fix transmitting packet hangs
Fix transmitting packets hangs with continuing to pull the pending packet
from mac80211 queues when receiving Tx status notification from the device.

Fixes: aac5104bf631 ("mt76: sdio: do not run mt76_txq_schedule directly")
Acked-by: Sean Wang <[email protected]>
Signed-off-by: YN Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Lorenzo BianconiandFelix Fietkau 0ad02c9a45 wifi: mt76: sdio: add rx_check callback for sdio devices
Introduce rx_check callback support for mt7921s driver.

Tested-by: Sean Wang <[email protected]>
Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:14:11 +02:00
Dan CarpenterandFelix Fietkau 9dd7be2c51 wifi: mt76: mt7921: fix use after free in mt7921_acpi_read()
Don't dereference "sar_root" after it has been freed.

Fixes: f965333e491e ("mt76: mt7921: introduce ACPI SAR support")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Dan CarpenterandFelix Fietkau dee0a3cbfb wifi: mt76: mt7915: fix an uninitialized variable bug
Smatch complains that:

    drivers/net/wireless/mediatek/mt76/mt7915/mac.c:428 mt7915_mac_fill_rx()
    error: uninitialized symbol 'msta'.

It looks like this was supposed to be initialized to NULL.

Fixes: 0880d40871d1 ("mt76: connac: move mt76_connac2_reverse_frag0_hdr_trans in mt76-connac module")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Sean WangandFelix Fietkau 322656141f wifi: mt76: sdio: poll sta stat when device transmits data
It is not meaningful to poll sta stat when there is no data traffic.
So polling sta stat when the device has transmitted data instead to save
CPU power.

That implies that it is unallowed the stat_work to work while MCU is being
initialized in the really early stage to fix the possible time to time MCU
initialization failure.

Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module")
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Sean WangandFelix Fietkau f49e06c4cf wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work
Because wake_work and sdio->stat_work share the same workqueue mt76->wq,
if sdio->stat_work cannot acquire the mutex lock such as that was possibly
held up by [mt7615, mt7921]_mutex_acquire. Additionally, if
[mt7615, mt7921]_mutex_acquire was called by sdio->stat_work self, the wake
would be blocked by itself. Thus, we move the stat_work into
ieee80211_workqueue instead to break the deadlock.

Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module")
Co-developed-by: YN Chen <[email protected]>
Signed-off-by: YN Chen <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Lorenzo BianconiandFelix Fietkau 74a29eb4f7 wifi: mt76: mt7921: move mt7921_rx_check and mt7921_queue_rx_skb in mac.c
Since both mt7921_rx_check and mt7921_queue_rx_skb routines are used by
all chipsets (mmio, usb and sdio), move them in mac.c and remove
duplicated code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Sean WangandFelix Fietkau 9706ccef54 wifi: mt76: mt7921u: remove unnecessary MT76_STATE_SUSPEND
remove unnecessary MT76_STATE_SUSPEND manipulation to be consistent
with the mt7921[e, s] driver.

Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Sean WangandFelix Fietkau ee3eb0d6d5 wifi: mt76: mt7921u: fix race issue between reset and suspend/resume
It is unexpected that the reset work is running simultaneously with
the suspend or resume context and it is possible that reset work is still
running even after mt7921 is suspended if we don't fix the race issue.

Thus, the suspend procedure should be waiting until the reset is completed
at the beginning and ignore the subsequent the reset requests.

In case there is an error that happens during either suspend or resume
handler, we will schedule a reset task to recover the error before
returning the error code to ensure we can immediately fix the error there.

Fixes: df3e4143ba8a ("mt76: mt7921u: add suspend/resume support")
Co-developed-by: YN Chen <[email protected]>
Signed-off-by: YN Chen <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Sean WangandFelix Fietkau a9b09dd271 wifi: mt76: mt7921s: fix race issue between reset and suspend/resume
It is unexpected that the reset work is running simultaneously with
the suspend or resume context and it is possible that reset work is still
running even after mt7921 is suspended if we don't fix the race issue.

Thus, the suspend procedure should be waiting until the reset is completed
at the beginning and ignore the subsequent the reset requests.

In case there is an error that happens during either suspend or resume
handler, we will schedule a reset task to recover the error before
returning the error code to ensure we can immediately fix the error there.

Fixes: ca74b9b907f9 ("mt76: mt7921s: add reset support")
Co-developed-by: YN Chen <[email protected]>
Signed-off-by: YN Chen <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Sean WangandFelix Fietkau 67fbdb7bed wifi: mt76: mt7921e: fix race issue between reset and suspend/resume
It is unexpected that the reset work is running simultaneously with
the suspend or resume context and it is possible that reset work is still
running even after mt7921 is suspended if we don't fix the race issue.

Thus, the suspend procedure should be waiting until the reset is completed
at the beginning and ignore the subsequent the reset requests.

In case there is an error that happens during either suspend or resume
handler, we will schedule a reset task to recover the error before
returning the error code to ensure we can immediately fix the error there.

Fixes: 0c1ce9884607 ("mt76: mt7921: add wifi reset support")
Co-developed-by: YN Chen <[email protected]>
Signed-off-by: YN Chen <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:37 +02:00
Lorenzo BianconiandFelix Fietkau f8ece81000 wifi: mt76: add rx_check callback for usb devices
Introduce rx_check callback support for mt7663u and mt7921u drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:23 +02:00
Shayne ChenandFelix Fietkau 94eb0bc137 wifi: mt76: testmode: use random payload for tx packets
Compared to fixed payload packets, random payload packets have better
measured EVM under the same txpower. Our tests show EVM becomes at least
2-3 dB better in test cases with high rate and long tx length, which also
aligns the testing results to proprietary driver.

Suggested-by: Jm Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-15 13:12:23 +02:00
Felix Fietkau d70546462b mt76: fix 5 GHz connection regression on mt76x0/mt76x2
Some users have reported being unable to connect to MT76x0 APs running mt76
after a commit enabling the VHT extneded NSS BW feature.
Fix this regression by ensuring that this feature only gets enabled on drivers
that support it

Fixes: d9fcfc1424aa ("mt76: enable the VHT extended NSS BW feature")
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-06 22:39:56 +02:00
Felix Fietkau 5ec78e1ec4 wifi: mt76: fix reading current per-tid starting sequence number for aggregation
The code was accidentally shifting register values down by tid % 32 instead of
(tid * field_size) % 32.

Signed-off-by: Felix Fietkau <[email protected]>
2022-08-26 19:46:09 +02:00
Lorenzo BianconiandFelix Fietkau 13bedd62ff mt76: connac: introduce mt76_connac_reg_map structure
Introduce mt76_connac_reg_map structure in mt76-connac module since it
is used by all connac2 chipset. Align structure definitions.
This is a preliminary patch to add mt7990 chipset support.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 14:07:40 +02:00
Liang HeandFelix Fietkau 111e92cf8c mediatek: mt76: eeprom: fix missing of_node_put() in mt76_find_power_limits_node()
We should use of_node_put() for the reference 'np' returned by
of_get_child_by_name() which will increase the refcount.

Fixes: 22b980badc0f ("mt76: add functions for parsing rate power limits from DT")
Signed-off-by: Liang He <[email protected]>
2022-07-11 13:38:17 +02:00
Liang HeandFelix Fietkau 120f73ad99 mediatek: mt76: mac80211: Fix missing of_node_put() in mt76_led_init()
We should use of_node_put() for the reference 'np' returned by
of_get_child_by_name() which will increase the refcount.

Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
Signed-off-by: Liang He <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau e6c6bf8cee mt76: get rid of mt76_wcid_hw routine
mt76_wcid_hw() is no longer used.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00