Commit Graph
523 Commits
Author SHA1 Message Date
Leon YenandFelix Fietkau dc32780c7f wifi: mt76: mt7921s: fix a potential firmware freeze during startup
The maximum command quota of the firmware may be exceeded because the
command to retrieve the quota setting has not been taken into account.

This patch considers not only the quota usage of the command retrieving
quota settings but also limits the total quota usage.

Signed-off-by: Leon Yen <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-09-27 08:11:07 +02:00
Felix Fietkau 059342ca6a wifi: mt76: move mt76_tm_policy to from testmode.h to mt76.h
This fixes using testmode.h from user space code

Signed-off-by: Felix Fietkau <[email protected]>
2024-09-24 12:34:25 +02:00
Felix Fietkau d10ce9d65d wifi: mt76: remove mt76_calculate_default_rate()
It is only used in mt76_connac2_mac_tx_rate_val, inline it there.

Signed-off-by: Felix Fietkau <[email protected]>
2024-09-13 14:16:30 +02:00
Felix Fietkau a5e630ef45 wifi: mt76: mt7916: fix regression in .sta_state migration
- initialize and use per-sta wcid entry instead of vif wcid
- set wcid flags for 4addr/offload
- fix 'newly' argument for vif sta entry update

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-21 16:51:03 +02:00
Felix Fietkau caed4843c5 wifi: mt76: fix station muar index
Signed-off-by: Felix Fietkau <[email protected]>
2024-08-19 20:05:30 +02:00
Felix Fietkau a1a65d8608 wifi: mt76: mt7915: retry mcu messages
In some cases MCU messages can get lost. Instead of failing completely,
attempt to recover by re-sending them.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-13 20:22:43 +02:00
Felix Fietkau 5af2f7c8e8 wifi: mt76: mt7915: use mac80211 .sta_state op
Allows adding stations before assoc, though they are not passed to the
firmware yet at that point.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 21:09:09 +02:00
Felix Fietkau ea8c3eac12 wifi: mt76: change .sta_assoc callback to .sta_event
Also report auth/disassoc events, in order to give the driver more control over
handling the station state.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 21:09:03 +02:00
Felix Fietkau 891031ee05 wifi: mt76: add separate tx scheduling queue for off-channel tx
Ensure that packets are not sent out to the wrong channel

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 21:08:34 +02:00
Felix Fietkau b80c997b3f wifi: mt76: partially move channel change code to core
This allows the core code to change the channel. Code deduplication and
preparation for adding scanning code to the core.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 21:08:33 +02:00
Michael LoandFelix Fietkau 3a367258d9 wifi: mt76: mt792x: fix scheduler interference in drv own process
Add some time to wait for LP engine to complete its operation
before polling pmctrl register.

Signed-off-by: Michael Lo <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Tested-by: David Ruth <[email protected]>
Acked-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-16 14:30:13 +02:00
Sean WangandFelix Fietkau 2304e6146c wifi: mt76: add def_wcid to struct mt76_wcid
add def_wcid to struct mt76_wcid to allow per-link wcid to retrieve the
struct ieee80211_sta structure.

Co-developed-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/d5188ca633666eaad7e90a8061d1a0585487e128.1720248331.git.sean.wang@kernel.org
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-16 14:30:13 +02:00
Sean WangandFelix Fietkau ebd522981b wifi: mt76: mt7925: report link information in rx status
report link information in rx status

Co-developed-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/c7cdc17d94375a76802a5c4a825ea3e51cdb53af.1720248331.git.sean.wang@kernel.org
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-16 14:30:13 +02:00
Sean WangandFelix Fietkau 94e751a0f5 wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv according to link id
configure mt7925_mcu_sta_key_tlv according to link id

We created a link id field in the common structure mt76_wcid so that
mt7925_mcu_sta_key_tlv can access per-link STA/BSS. Additionally,
.link_id will be required when reporting the link information of Rx status
to mac80211. We will submit the changes for reporting the Rx status in
a separate patch.

Co-developed-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Ming Yen Hsieh <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/16d65aae010113f9be3c4e6e759b4226d396a1be.1720248331.git.sean.wang@kernel.org
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-13 15:39:30 +02:00
Felix Fietkau 564cd93961 mt76: sync with upstream changes
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-12 17:15:04 +02:00
Felix Fietkau 14d5ee9f33 mt76: shrink mt76_queue_buf
Reuse one bit from the length field for skip_unmap

Signed-off-by: Felix Fietkau <[email protected]>
2024-05-03 22:42:40 +02:00
Felix Fietkau 605624a4e1 mt76: fix path to page_pool helper include
Signed-off-by: Felix Fietkau <[email protected]>
2024-03-24 15:51:52 +01:00
Felix Fietkau b5640b3153 wifi: mt76: fix tx packet loss when scanning on DBDC
When queueing packets, only the MT76_RESET flag of the primary PHY
is checked. If the primary PHY is scanning or changing channels, this can
lead to packet loss for tx on the second PHY.
Fix this by passing the phy to the .tx_queue_skb op and using it to check
the correct flag.

Signed-off-by: Felix Fietkau <[email protected]>
2024-03-15 17:07:47 +01:00
Lorenzo BianconiandFelix Fietkau 9827df56b2 wifi: mt76: move wed common utilities in wed.c
Introduce wed.c in order to collect mt76 wed common codebase used by
mt7915 and mt7996 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2024-02-03 15:04:42 +01:00
Lorenzo BianconiandFelix Fietkau e8909c610c wifi: mt76: usb: store usb endpoint in mt76_queue
Store usb endpoint in mt76_queue structure and rework q2ep routine.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2024-02-03 15:04:42 +01:00
Sujuan ChenandFelix Fietkau 95c14207d2 wifi: mt76: mt7996: set DMA mask to 36 bits for boards with more than 4GB of RAM
Introduce the capability to run mt7996 driver on boards with more than
4GB of memory.

Co-developed-by: Rex Lu <[email protected]>
Signed-off-by: Rex Lu <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-12-06 12:21:19 +01:00
Wang ZhaoandFelix Fietkau 9ef06028d4 wifi: mt76: mt7921s: fix workqueue problem causes STA association fail
The ieee80211_queue_work function queues work into the mac80211
local->workqueue, which is widely used for mac80211 internal
work processes. In the mt76 driver, both the mt76-sido-status and
mt76-sdio-net threads enqueue workers to the workqueue with this
function. However, in some cases, when two workers are enqueued
to the workqueue almost simultaneously, the second worker may not
be scheduled immediately and may get stuck for a while.
This can cause timing issues. To avoid these timing
conflicts caused by worker scheduling, replace the worker
with an independent thread.

Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support")
Signed-off-by: Wang Zhao <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-12-06 12:16:45 +01:00
Lorenzo BianconiandFelix Fietkau 0f89bf58ef wifi: mt76: mt7996: add wed rro delete session garbage collector
Introduce the capability to clear WED rro session configured in the hw
according to the event reported by the MCU firmware

Co-developed-by: Sujuan Chen <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau be2e74c0c4 wifi: mt76: move wed reset common code in mt76 module
Move WED reset code shared between mt7915 and mt7996 in common module.
This is a preliminary patch to introduce WED reset support for mt7996.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Bo JiaoandFelix Fietkau abca260a15 wifi: mt76: mt7996: add wed rx support
Similar to MT7915, enable Wireless Ethernet Ditpatcher for MT7996
to offload traffic received from the WLAN nic and transmitted on the
LAN one

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Co-developed-by: Sujuan Chen <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Sujuan ChenandFelix Fietkau 2e7f30f22c wifi: mt76: mt7996: add wed tx support
Similar to MT7915, enable Wireless Ethernet Ditpatcher for MT7996
to offload traffic received from the LAN nic and transmitted on the
WLAN one

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau c550204e34 wifi: mt76: increase MT_QFLAG_WED_TYPE size
This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau 48b0cedbf8 wifi: mt76: introduce wed pointer in mt76_queue
Introduce mtk_wed_device pointer in mt76_queue structure in order to
configure WED chip.
Get rid of dev parameter in Q_READ and Q_WRITE macros.
Introduce wed parameter to the following routine signatures:
- mt76_init_queue
- mt76_init_tx_queue

This is a preliminary patch to introduce WED support for mt7996 since
mt7996 runs two separate WED chips.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau d798d5d6f7 wifi: mt76: introduce mt76_queue_is_wed_tx_free utility routine
This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau 4b47145ecf wifi: mt76: move mt76_net_setup_tc in common code
This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau 9fb0277d7e wifi: mt76: move mt76_mmio_wed_offload_{enable,disable} in common code
mt76_mmio_wed_offload_enable and mt76_mmio_wed_offload_disable routines
will be reused by mt7996 driver for wed support.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Lorenzo BianconiandFelix Fietkau ea28142891 wifi: mt76: mmio: move mt76_mmio_wed_{init,release}_rx_buf in common code
Move mt76_mmio_wed_init_rx_buf and mt76_mmio_wed_release_rx_buf routines
in common code.
This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:12:32 +01:00
Christian MarangiandFelix Fietkau d1c671a90e wifi: mt76: permit to use alternative cell name to eeprom NVMEM load
Generilize mt76_get_of_eeprom_from_nvmem to use alternative cell name by
passing the cell name as an arg and expose it.

Rename it to mt76_get_of_data_from_nvmem to better reflect the now more
generic usage.

This is to permit driver to load additional cell, like precal cell.

Tested-by: Shiji Yang <[email protected]>
Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:11:35 +01:00
Christian MarangiandFelix Fietkau d6e8aa634a wifi: mt76: make mt76_get_of_eeprom static again
Since mt76_get_of_eeprom is not used by mt7915 anymore, unexport it and
make it static again.

Also drop offset arg as it's only supported for MTD and was always set
to 0, hardcode the MTD functio instead.

Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:11:35 +01:00
Christian MarangiandFelix Fietkau c37738fc90 wifi: mt76: limit support of precal loading for mt7915 to MTD only
Limit support for precal loading for mt7915 only to MTD. Passing data
from DT doesn't support offset and NVMEM require a different cell name
and doesn't support offset hence only MTD way is actually supported.

Rename mt76_get_of_eeprom_from_mtd to mt76_get_of_data_from_mtd as it is
now used for a more generic purpose and export it.

Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-11-17 14:11:35 +01:00
Ming Yen HsiehandFelix Fietkau 4a0f839da0 wifi: mt76: mt7921: update the channel usage when the regd domain changed
The 5.9/6GHz channel license of a certain platform device has been
regulated in various countries. That may be difference with standard
Liunx regulatory domain settings. In this case, when .reg_notifier()
called for regulatory change, mt792x chipset should update the channel
usage based on clc or dts configurations.

Channel would be disabled by following cases.
* clc report the particular UNII-x is disabled.
* dts enabled and the channel is not configured.

Signed-off-by: Ming Yen Hsieh <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-30 20:17:46 +02:00
Sean WangandFelix Fietkau 66d5694e18 wifi: mt76: mt7921: fix the wrong rate pickup for the chanctx driver
The variable band should be determined by the ieee80211_chanctx_conf when
the driver is a kind of chanctx one e.g mt7921 and mt7922 driver so we
added the extension to mt76_connac2_mac_tx_rate_val by distinguishing if
it can support chanctx to fix the incorrect rate pickup.

Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Signed-off-by: Sean Wang <[email protected]>
Reviewed-by: David Ruth <[email protected]>
Tested-by: David Ruth <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-18 12:15:31 +02:00
Sean WangandFelix Fietkau d1881b1b2b wifi: mt76: move struct ieee80211_chanctx_conf up to struct mt76_vif
Move struct ieee80211_chanctx_conf up to struct mt76_vif to allow the
connac2 library can access the struct ieee80211_chanctx_conf * member in
struct mt76_vif.

Signed-off-by: Sean Wang <[email protected]>
Reviewed-by: David Ruth <[email protected]>
Tested-by: David Ruth <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-18 12:15:31 +02:00
Deren WuandFelix Fietkau 5df6b26a9f wifi: mt76: connac: add eht support for tx power
Add eht field in struct mt76_power_limits for 802.11be power config.
The function stack size would be too big by eht adding in structure,
we also refactor mt76_connac_mcu_rate_txpower_band() to take dynamic
allocated memory instead.

This is a preliminary patch to support mt7925 driver.

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]>
2023-09-16 14:12:29 +02:00
Shayne ChenandFelix Fietkau b3f739a64e wifi: mt76: mt7996: add eht rx rate support
Add support to report eht rx rate.
Note that extended fields for eht in mt76_rx_status will make the struct
size exceed the cb size, so make nss and band share the same u8.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Felix Fietkau f1e1e67d97 wifi: mt76: fix race condition related to checking tx queue fill status
When drv_tx calls race against local tx scheduling, the queue fill status checks
can potentially race, leading to dma queue entries being overwritten.
Fix this by deferring packets from drv_tx calls to the tx worker, in order to
ensure that all regular queue tx comes from the same context.

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau bbbac7deee wifi: mt76: rename mt76_packet_id_init/flush to mt76_wcid_init/cleanup
Also un-inline the functions. Will be used for further wcid init/cleanup

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Lorenzo BianconiandFelix Fietkau 39a70710dd wifi: mt76: move rate info in mt76_vif
This is a preliminary patch to introduce mt76_connac3 mac library used
by WiFi7 chipsets (e.g. mt7996).

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 19:24:40 +02:00
Lorenzo BianconiandFelix Fietkau f5c5eece50 wifi: mt76: move ampdu_state in mt76_wcid
ampdu_state field is used by most of the drivers, so move it in
mt76_wcid structure.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 19:24:03 +02:00
Lorenzo BianconiandFelix Fietkau 595b033275 wifi: mt76: mt7915: move poll_list in mt76_wcid
poll_list field is used by most of the drivers, so move it in mt76_wcid
structure.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 19:24:03 +02:00
Lorenzo BianconiandFelix Fietkau 30706095c5 wifi: mt76: mt7915: move sta_poll_list and sta_poll_lock in mt76_dev
sta_poll_list and sta_poll_lock are used by most of the drivers, so move
them in mt76_dev structure.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 19:24:03 +02:00
Ryder LeeandFelix Fietkau e48235308b wifi: mt76: mt7915: accumulate mu-mimo ofdma muru stats
The stats are clear-on-read, which makes it very difficult for tools
to adequately deal with wrapped stats and with keeping good totals.

So, accumulate these values when they are read from the firmware/radio
and present totals to user-space.

Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:52:14 +02:00
Lorenzo BianconiandFelix Fietkau 18b1027e5b wifi: mt76: mt7915: move mib_stats structure in mt76.h
mib_stats structure is shared by mostly all chipsets. Move it to shared
code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Peter ChiuandFelix Fietkau f76b102b09 wifi: mt76: mt7915: rework tx packets counting when WED is active
PPDU TxS can only report MPDU count whereas mac80211 requires MSDU scale
(NL80211_STA_INFO_TX_PACKETS), so switch to get MSDU counts from WA
statistic.

Note that mt7915 WA firmware only counts tx_packet for WED path, so driver
needs to take care of host path additionally.

Fixes: 43eaa3689507 ("wifi: mt76: add PPDU based TxS support for WED device")
Co-developed-by: Ryder Lee <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-22 17:50:24 +02:00
Lorenzo BianconiandFelix Fietkau 482d2a765b wifi: mt76: move irq_tasklet in mt76_dev struct
irq_tasklet struct is used by most of the drivers (e.g. mt7915, mt7921,
mt7615, mt7663 and mt7996) so move it in common code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-18 11:37:59 +02:00