Commit Graph
3306 Commits
Author SHA1 Message Date
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
Lorenzo BianconiandFelix Fietkau 4bf8c20a95 mt76: convert MT_TX_HW_QUEUE_EXT_PHY to MT_TX_HW_QUEUE_PHY
Report phy_indx in tx_info->hw_queue. This is a preliminary patch to add
newer chipset support

Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau 30887591e3 mt76: add phy_idx to mt76_wcid
Introduce phy_idx to mt76_wcid structure instead of ext_phy.
This is a preliminary patch to add newer chipset support.

Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau eb19ac83c0 mt76: introduce phys array in mt76_dev structure
Introduce phys array in mt76_dev structure to reference mt76_phy
supported by the chipset. This is a preliminary patch to introduce
newer chipset support.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau 8ccbb38ca6 mt76: add phy_idx in mt76_rx_status
Introduce phy_idx mt76_rx_status instead of ext_idx. This is a
preliminary patch to add newer chipset support

Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau 60ef85fa35 mt76: introduce MT_RXQ_BAND2 and MT_RXQ_BAND2_WA in mt76_rxq_id
Rename MT_RXQ_EXT in MT_RXQ_BAND1.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau 08ea730c11 mt76: add len parameter to __mt76_mcu_msg_alloc signature
Introduce len to __mt76_mcu_msg_alloc signature in order to add the
capability to specify two different value for allocation and copy length.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2022-07-11 13:38:17 +02:00
MeiChia ChiuandFelix Fietkau a2d61f4f40 mt76: mt7915 add ht mpdu density
set ht mpdu density to 4 usec.

Reviewed-by: Ryder Lee <[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 13:38:17 +02:00
Sean WangandFelix Fietkau cb80da974f mt76: mt7921: reduce the mutex lock scope during reset
Reduce the mutex lock scope for reset to get rid of possible task hung
e.g wpa_supplicant and to allow the user-space process to keep running
during we need more retries to complete the reset.

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Suggested-by: YN Chen <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 13:38:17 +02:00
Sean WangandFelix Fietkau 6e0d707748 mt76: mt7921: reduce log severity levels for informative messages
Use dev_dbg instead for the diagnostic messages.

Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau b8304b456e mt76: connac: move tx initialization/cleanup in mt76_connac module
Move mt76_connac_init_tx_queues and mt76_connac_tx_cleanup routines
in mt76_connac module. 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 13:38:17 +02:00
Lorenzo BianconiandFelix Fietkau d5459efaaf mt76: mt7921: make mt7921_pci_driver static
mt7921_pci_driver struct is only referenced in mt7921/pci.c so make it
static.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 13:38:17 +02:00
Sean WangandFelix Fietkau 7fd299e3c9 mt76: mt7921: enable HW beacon filter in the initialization stage
The current driver has worked with HW beacon filter and connection
monitor all the way, here we move the enablement into the initialization
stage like other HW features being done to get rid of others are
confused why these configurations would be changed at runtime.

We still leave a way to turn off these offload features in debugfs knobs
but that is just for debugging purposes.

Tested-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 13:38:17 +02:00
Sean WangandFelix Fietkau e5674c4aa4 mt76: mt7921: enable HW beacon filter not depending on PM flag
The hardware beacon filter works whether or not the PM flag is set, so we
drop redundant dependency checks on PM flags.

Additionally, the patch implicitly allow the MT7921[E, S, U] to have a
consistent configuration of the hardware beacon filter.

Tested-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-11 13:38:17 +02:00
Felix Fietkau 9485e3b470 mt76: remove q->qid
It is no longer used

Signed-off-by: Felix Fietkau <[email protected]>
2022-07-03 20:59:06 +02:00
Felix Fietkau 93e3fce916 mt76: pass original queue id from __mt76_tx_queue_skb to the driver
MT7615 and newer map multiple software tx queues to the hardware id

Signed-off-by: Felix Fietkau <[email protected]>
2022-07-03 17:52:25 +02:00
Felix Fietkau af406a2d1c mt76: do not use skb_set_queue_mapping for internal purposes
Previously the code used skb_set_queue_mapping for management or non-bufferable
powersave frames that need to be sent to a different hardware queue.
This can confuse AQL, which expects the value to remain the same until the tx
status report.
The only place that currently uses the altered skb queue mapping is the txwi
write function. Change the code to pass the hardware queue id as a function
parameter instead.

Signed-off-by: Felix Fietkau <[email protected]>
2022-07-02 15:57:02 +02:00
Felix Fietkau c07f459278 firmware: update mt7622 firmware to version 20220630
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-01 18:42:47 +02:00
Felix Fietkau b6e865e2cc mt76: mt7615: fix throughput regression on DFS channels
For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar
detector without also switching the channel.
This results in very bad throughput on DFS channels, because
hw->conf.radar_enabled can get toggled a few times after CAC ends.
Fix this by always leaving the DFS detector enabled on DFS channels and instead
suppress unwanted detection events.

Fixes: 2c86f6752046 ("mt76: mt7615: fix/rewrite the dfs state handling logic")
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-24 21:08:25 +02:00
Felix Fietkau f2edd340dd mt76: allow receiving frames with invalid CCMP PN via monitor interfaces
This can be useful for debugging

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-23 14:21:20 +02:00
Felix Fietkau fd8211cf7c mt76: mt7921: sync with updated patch
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-23 14:14:52 +02:00
Felix Fietkau ba39ed3b44 mt76: mt76x02: improve reliability of the beacon hang check
Increment the counter only when writing beacons to the hardware in order
to avoid triggering restarts if beacons are disabled.
Additionally, avoid resetting the MAC if stopping it failed

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-23 14:10:22 +02:00
Felix Fietkau 4fb991f2c9 mt76: mt7615: add sta_rec with EXTRA_INFO_NEW for the first time only
Set EXTRA_INFO_NEW for the first time only to prevent adding the same
starec entry, otherwise the entry might be removed in fw.

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-22 14:11:23 +02:00
MeiChia ChiuandFelix Fietkau dd682eead0 mt76: mt7915: update the maximum size of beacon offload
Since an in-band discovery frame is offloaded by MCU,
here we enlarge the command size to accommodate the additional content.

Reviewed-by: Ryder Lee <[email protected]>
Signed-off-by: Money Wang <[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-22 13:19:55 +02:00
MeiChia ChiuandFelix Fietkau 3ef66fc7c7 mt76: do not check the ccmp pn for ONLY_MONITOR frame
if the received frame enables RX_FLAG_ONLY_MONITOR,
driver doesn't need to check the ccmp pn of this frame.

Reviewed-by: Ryder Lee <[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-22 13:19:55 +02:00