585 Commits
Author SHA1 Message Date
Felix Fietkau e5fef13852 mt76: only mark tx-status-failed frames as ACKed on mt76x0/2
The interrupt status polling is unreliable, which can cause status events
to get lost. On all newer chips, txs-timeout is an indication that the
packet was either never sent, or never acked.
Fixes issues with inactivity polling.

Signed-off-by: Felix Fietkau <[email protected]>
2025-02-14 11:13:33 +01:00
Felix Fietkau 4d8d6e2e77 wifi: mt76: scan: set vif offchannel link for scanning/roc
The driver needs to know what vif link to use

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-04 08:11:30 +01:00
Felix Fietkau 1884f568ba wifi: mt76: do not add wcid entries to sta poll list during MCU reset
Fixes linked list management issues during restart, where sta entries
can be recreated and reinitialized while still in the poll list, triggering
kernel warnings.

Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 18:40:23 +01:00
Felix Fietkau f19cbcf834 wifi: mt76: add multi-radio remain_on_channel functions
This allows a driver using the generic channel context functions to
temporarily switch to another channel for off-channel rx/tx.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-27 08:52:59 +01:00
Felix Fietkau fc0ff17b53 wifi: mt76: add multi-radio support to scanning code
When scanning on a phy/vif combination that does not have an active link,
create a temporary link in order to ensure that we have a valid wcid.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-27 08:52:59 +01:00
Felix Fietkau 0b05795ca8 wifi: mt76: remove dev->wcid_phy_mask
Explicitly check wcid->phy_idx instead. Reduces allocated data size.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau d026be405c wifi: mt76: add chanctx functions for multi-channel phy support
This adds an implementation for the chanctx functions, which can be used
by multi-channel capable drivers. Preparation for adding MLO support.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau d388deab9e wifi: mt76: initialize more wcid fields mt76_wcid_init
Reduces code duplication and ensures that the phy index is always set.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau 99df84d628 wifi: mt76: add vif link specific data structure
Preparation for splitting link data from vif data for MLO support.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau 8cd0263f92 wifi: mt76: rename struct mt76_vif to mt76_vif_link
Preparation to use it for private bss link data instead of the full vif
on MLO capable devices.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau dc4c2bdf7c wifi: mt76: add support for allocating a phy without hw
Preparation for supporting a single hw with multiple radios

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau 57019e663f wifi: mt76: add code for emulating hardware scanning
Preparation for supporting multiple radios on a single wiphy on devices
where firmware does not support actual hardware scanning.
This is also a prerequisite for full MLO support

Co-developed-by: Peter Chiu <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Co-developed-by: Michael-CY Lee <[email protected]>
Signed-off-by: Michael-CY Lee <[email protected]>
Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
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