Commit Graph
100 Commits
Author SHA1 Message Date
Felix Fietkau a34adb961b wifi: mt76: mt7996: add missing max_remain_on_channel_duration
Having this unset breaks remain-on-channel and mgmt TX.
Move setting it to mt76 core to keep it in one place.

Fixes: 69d54ce7491d0 ("wifi: mt76: mt7996: switch to single multi-radio wiphy")
Signed-off-by: Felix Fietkau <[email protected]>
2026-02-04 14:10:50 +00:00
Felix Fietkau a47ad19275 wifi: mt76: mt7996: fix out-of-bounds array access during hardware restart
During hardware restart, link_id can be IEEE80211_LINK_UNSPECIFIED,
causing an out-of-bounds array access on msta->link[].

Add mt7996_sta_link() and mt7996_sta_link_protected() helper functions
for accessing sta links with proper RCU handling and bounds checking.
Use them for any sta link RCU access.

Reported-by: Chad Monroe <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2026-01-28 12:38:03 +00:00
Felix Fietkau f473d66ab5 wifi: mt76: mt7996: fix crash in mt7996_tx_prepare_skb
Add missing NULL pointer check. In mesh mode, sta can be NULL even for
qosdata frames.

Signed-off-by: Felix Fietkau <[email protected]>
2025-11-12 16:32:50 +00:00
Felix Fietkau c63db0fcad wifi: mt76: mt7915: add WDS support when WED is enabled
The current WED only supports 256 wcid, whereas mt7986 can support up to
512 entries, so firmware provides a rule to get sta_info by DA when wcid
is set to 0x3ff by txd. Also, WED provides a register to overwrite txd
wcid, that is, wcid[9:8] can be overwritten by 0x3 and wcid[7:0] is set
to 0xff by host driver.

However, firmware is unable to get sta_info from DA as DA != RA for
4addr cases, so firmware and wifi host driver both use wcid (256 - 271)
and (768 ~ 783) for sync up to get correct sta_info.

Currently WDS+WED config is completely broken on MT7986/7981 devices if
without this patch.

Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Shengyu Qu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2025-10-20 16:09:22 +02:00
Felix Fietkau fc25ba8219 add LICENSE file
Signed-off-by: Felix Fietkau <[email protected]>
2025-10-13 11:11:19 +02:00
Felix Fietkau 33f29d2345 wifi: mt76: relicense to BSD-3-Clause-Clear
MediaTek has asked to switch from the ISC license to BSD-3-Clause-Clear,
in order to improve clarity and the legal integrity of the code.

The BSD-3-Clause license includes the "no endorsement" clause, which is
important for protecting the reputation of the original authors and
contributors by preventing unauthorized use of their names for endorsement
purposes.

This clause is absent in the BSD-2-Clause license, which is more permissive
but lacks this specific protection.

This change also cleans up the license of some Kconfig/Makefile files,
which were accidentally marked as GPL.

The GPL 2.0 remains in use on mt76x0, as well as two source files in mt7615
for which the license situation still needs to be clarified.

Signed-off-by: Felix Fietkau <[email protected]>
2025-10-13 11:11:19 +02:00
Felix Fietkau 9050597c4c wifi: mt76: fix license/copyright of util.h
The extra copyright line for Ivo van Doorn and GPL license was only there
because of code that I had already removed before the initial upstream
submission of mt76.
Remove it and make this header file use ISC license like the rest of the
source files.

Signed-off-by: Felix Fietkau <[email protected]>
2025-10-13 11:11:19 +02:00
Felix Fietkau 9ee788a382 wifi: mt76: mt7996: fix null pointer deref in mt7996_conf_tx()
If a link does not have an assigned channel yet, mt7996_vif_link returns
NULL. We still need to store the updated queue settings in that case, and
apply them later.
Move the location of the queue params to within struct mt7996_vif_link.

Fixes: c0df2f0caa8d ("wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support")
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-29 13:16:01 +02:00
Felix Fietkau d4a79d50ff wifi: mt76: mt7996: reset interface links on hardware restart
Free allocated memory

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-12 13:51:36 +02:00
Felix Fietkau 6745cece7a wifi: mt76: mt7996: reset station links on hardware restart
Ensure that all allocated memory is freed properly

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-12 13:51:36 +02:00
Felix Fietkau ddbe1f6eb2 wifi: mt76: abort scan/roc on hw restart
Avoid spurious channel changes and clean up allocated links

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-12 13:51:36 +02:00
Felix Fietkau d17519baab wifi: mt76: improve phy reset on hw restart
- fix number of station accounting for scanning code.
- reset channel context

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-12 13:51:36 +02:00
Felix Fietkau 1383b5548f wifi: mt76: use altx queue for offchannel tx on connac+
This ensures that packets are sent out immediately and are not held by
firmware internal buffering.

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-12 11:56:26 +02:00
Felix Fietkau bba7ae0b1a wifi: mt76: mt7996: drop connac mcu wtbl clear
The firmware does not support the command

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-11 10:28:24 +02:00
Felix Fietkau 5b0cbb0580 wifi: mt76: mt7996: fix updating beacon protection with beacons enabled
Disable and re-enable beacon after beacon protection key change, in order
to fully apply the changes.

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-10 17:59:04 +02:00
Felix Fietkau e995f6198d wifi: mt76: mt7996: fix key add/remove imbalance
Ensure that a key for a link is only added and removed once.
When bringing up a link, only upload keys for that particular link, instead
of iterating over all of them.

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-10 17:59:04 +02:00
Felix Fietkau 587012a433 wifi: mt76: mt7996: delete vif keys when requested
While deleting sta keys can be omitted in order to fix race conditions,
vif keys must be deleted before being replaced in order to prevent
accidental reuse in firmware.

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-10 17:59:04 +02:00
Felix Fietkau 75cd7c365b wifi: mt76: mt7996: fix memory leak on mt7996_mcu_sta_key_tlv error
Free the allocated skb on error

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-10 17:59:04 +02:00
Felix Fietkau 904abc93b7 wifi: mt76: mt7996: fix setting beacon protection keys
Include beacon key information in the STA_REC_UPDATE call.
Remove mt7996_mcu_get_pn - when installing a new key, we should
not reuse any existing PN value.

Signed-off-by: Allen Ye <[email protected]>
Signed-off-by: Michael-CY Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-10 17:58:46 +02:00
Felix Fietkau a6559a003d wifi: mt76: mt7996: decrease timeout for commonly issued MCU commands
This allows faster recovery from firmware issues.
Based on patch by Chad Monroe and ported from mt7915.

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 18:09:51 +02:00
Felix Fietkau ffda443265 wifi: mt76: mt7996: improve hardware restart reliability
Port latest version of similar changes from mt7915:
- use reconfig_complete to restart mac_work / queues
- reset full wtbl after firmware init
- clear wcid and vif mask to avoid leak
- fix sta poll list corruption
- clear rro list

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 18:09:50 +02:00
Felix Fietkau a4d6f193be wifi: mt76: mt7996: remove redundant per-phy mac80211 calls during restart
There is only one wiphy, so extra calls must be removed.
For calls that need to remain per-wiphy, use mt7996_for_each_phy

Fixes: 69d54ce7491d ("wifi: mt76: mt7996: switch to single multi-radio wiphy")
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 18:09:50 +02:00
Felix Fietkau 76401f5e2e mt76: update RRO patches to the latest version
Fix endian issues

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 15:06:06 +02:00
Felix Fietkau 91dcccebfe firmware: update mt7996/mt7992 firmware to 20250905
Upstream description:
"Update FW to 20250905 to fix MLO T.P issue scan or channel switch."

Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 10:40:24 +02:00
Felix Fietkau 03b0c87163 wifi: mt76: mt7996: add missing NULL pointer check
Fixes: d1a2900a39 ("wifi: mt76: mt7996: Set proper link destination address in mt7996_tx()")
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 09:56:12 +02:00
Felix Fietkau f271ce48d7 mt76: mt7996: fix unsigned comparison
Fixes detecing error condition from get_own_mld_idx

Fixes: 110ecc3311 ("wifi: mt76: mt7996: Fix mt7996_mcu_bss_mld_tlv routine")
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-09 06:36:19 +02:00
Felix Fietkau d30faac3b6 firmware: update mt7996 and mt7992 firmware to 20250606
Signed-off-by: Felix Fietkau <[email protected]>
2025-09-02 20:09:02 +02:00
Felix Fietkau 415b5a6887 wifi: mt76: fix list corruption
Never leave scheduled wcid entries on the temporary on-stack list

Fixes: 0b3be9d1d34e ("wifi: mt76: add separate tx scheduling queue for off-channel tx")
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-27 11:12:50 +02:00
Felix Fietkau ee538efba5 wifi: mt76: free pending offchannel tx frames on wcid cleanup
Avoid leaking them or keeping the wcid on the tx list

Fixes: 0b3be9d1d34e ("wifi: mt76: add separate tx scheduling queue for off-channel tx")
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-27 10:47:58 +02:00
Felix Fietkau 4cd64ad128 wifi: mt76: mt7915: fix list corruption after hardware restart
Since stations are recreated from scratch, all lists that wcids are added
to must be cleared before calling ieee80211_restart_hw.
Set wcid->sta = 0 for each wcid entry in order to ensure that they are
not added again before they are ready.

Signed-off-by: Felix Fietkau <[email protected]>
2025-08-25 16:14:39 +02:00
Felix Fietkau fb7e0501b8 wifi: mt76: mt7996: add missing check for rx wcid entries
Non-station wcid entries must not be passed to the rx functions.
In case of the global wcid entry, it could even lead to corruption in the wcid
array due to pointer being casted to struct mt7996_sta_link using container_of.

Fixes: 7464b12b7d92 ("wifi: mt76: mt7996: rework mt7996_rx_get_wcid to support MLO")
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-25 16:14:39 +02:00
Felix Fietkau fb22489fd7 wifi: mt76: do not add non-sta wcid entries to the poll list
Polling and airtime reporting is valid for station entries only

Signed-off-by: Felix Fietkau <[email protected]>
2025-08-25 16:14:30 +02:00
Felix Fietkau d729307b5e mt76: mt7996: add missing null pointer check
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-15 11:10:53 +02:00
Felix Fietkau 5f61f34087 wifi: mt76: mt7996: fix crash on some tx status reports
When a wcid can't be found, link_sta can be stale from a previous batch.
The code currently assumes that if link_sta is set, wcid is also non-zero.
Fix wcid NULL pointer dereference by resetting link_sta when a wcid entry
can't be found.

Fixes: 62da647a2b20 ("wifi: mt76: mt7996: Add MLO support to mt7996_tx_check_aggr()")
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-14 18:41:00 +02:00
Felix Fietkau 630e166c95 wifi: mt76: prevent non-offchannel mgmt tx during scan/roc
Only put probe request packets in the offchannel queue if
IEEE80211_TX_CTRL_DONT_USE_RATE_MASK is set and IEEE80211_TX_CTL_TX_OFFCHAN
is unset.

Fixes: 0b3be9d1d34e ("wifi: mt76: add separate tx scheduling queue for off-channel tx")
Reported-by: Chad Monroe <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-09 09:47:19 +02:00
Felix Fietkau aa2f13c3be wifi: mt76: mt7996: disable beacons when going offchannel
Avoid leaking beacons on unrelated channels during scanning/roc

Fixes: c56d6edebc1f ("wifi: mt76: mt7996: use emulated hardware scan support")
Reported-by: Chad Monroe <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2025-08-09 09:46:44 +02:00
Felix Fietkau 32ca2b6db3 firmware: update mt7996 firmware to 20250328
Signed-off-by: Felix Fietkau <[email protected]>
2025-07-07 19:36:38 +02:00
Felix Fietkau 05eaa56bc7 firmware: update mt7992 firmware to 20250328
Signed-off-by: Felix Fietkau <[email protected]>
2025-07-07 19:36:14 +02:00
Felix Fietkau dd2d862251 firmware: add missing mt7990 eeprom files
Signed-off-by: Felix Fietkau <[email protected]>
2025-07-07 19:33:02 +02:00
Felix Fietkau d70f62b8f1 wifi: mt76: fix vif link allocation
Reuse the vif deflink for link_id = 0 in order to avoid confusion with
vif->bss_conf, which also gets a link id of 0.

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2025-07-07 18:03:48 +02:00
Felix Fietkau 243e572d89 wifi: mt76: add a wrapper for wcid access with validation
Several places use rcu_dereference to get a wcid entry without validating
if the index exceeds the array boundary. Fix this by using a helper function,
which handles validation.

Signed-off-by: Felix Fietkau <[email protected]>
2025-07-04 20:46:06 +02:00
Felix Fietkau c4a114e2b8 wifi: mt76: fix queue assignment for deauth packets
When running in AP mode and deauthenticating a client that's in powersave
mode, the disassoc/deauth packet can get stuck in a tx queue along with
other buffered frames. This can fill up hardware queues with frames
that are only released after the WTBL slot is reused for another client.

Fix this by moving deauth packets to the ALTX queue.

Signed-off-by: Felix Fietkau <[email protected]>
2025-07-04 20:43:51 +02:00
Felix Fietkau 6df761e0e6 mt76: fix signature of platform_driver remove funtions for newer kernels
Signed-off-by: Felix Fietkau <[email protected]>
2025-06-25 14:33:41 +02:00
Felix Fietkau 46f3a10a9f mt76: mt7925: sync with upstream cleanups
Signed-off-by: Felix Fietkau <[email protected]>
2025-03-19 14:21:34 +01:00
Felix Fietkau 67c724cc60 Revert "wifi: mt76: mt7921: fix returned txpower"
This reverts commit ffd1cbfc48.
2025-03-12 10:34:21 +01:00
Felix Fietkau 539e7e711a Revert "wifi: mt76: mt7925: fix returned txpower"
This reverts commit 687e2fdfbf.
2025-03-12 10:34:17 +01:00
Felix Fietkau e931cecc45 mt76: mt792x: fix unused variable warning
Signed-off-by: Felix Fietkau <[email protected]>
2025-03-11 14:34:37 +01:00
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 2c068c9638 wifi: mt76: fix crash in mt76_switch_vif_chanctx
If the mode is CHANCTX_SWMODE_SWAP_CONTEXTS, the new chanctx is not
initialized yet.

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-14 13:31:15 +01:00
Felix Fietkau 49c0bd66da wifi: mt76: mt7996: fix unused-but-set variable
Signed-off-by: Felix Fietkau <[email protected]>
2025-01-13 19:22:02 +01:00
Felix Fietkau 7279e3f3c3 wifi: mt76: mt7925: fix unused-but-set warning
Signed-off-by: Felix Fietkau <[email protected]>
2025-01-13 19:22:02 +01:00
Felix Fietkau 02f453d8df wifi: mt76: fix survey regression
Signed-off-by: Felix Fietkau <[email protected]>
2025-01-13 19:22:02 +01:00
Felix Fietkau e43df6bf48 wifi: mt76: mt7996: fix thermal sparse warning
Signed-off-by: Felix Fietkau <[email protected]>
2025-01-13 19:05:54 +01:00
Felix Fietkau cf4e709e49 wifi: mt76: mt7996: fix crash in mt7996_set_radar_background
When disabling background radar detection, chandef is NULL

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-09 14:21:21 +01:00
Felix Fietkau e354436db4 wifi: mt76: mt7996: use the correct vif link for scanning/roc
Use the newly added offchannel_link pointer in vif data

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-04 08:12:09 +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 35bcf68a62 wifi: mt76: scan: fix setting tx_info fields
ieee80211_tx_prepare_skb initializes the skb cb, so fields need to be set
afterwards.

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-04 07:46:21 +01:00
Felix Fietkau 959a2d4000 wifi: mt76: mt7996: initialize phy txpower
Fixes phy tx power during scan/offchannel if no chanctx was assigned yet.

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-03 11:00:16 +01:00
Felix Fietkau 46715044ec wifi: mt76: mt7996: implement driver specific get_txpower function
Fixes reporting tx power for vifs that don't have a channel context
assigned. Report the tx power of a phy that is covered by the vif's
radio mask.

Signed-off-by: Felix Fietkau <[email protected]>
2025-01-03 10:35:08 +01:00
Felix Fietkau eb85bb3fd5 wifi: mt76: mt7915: fix eifs value on older chipsets
Use the default firmware values

Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:19:53 +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 5fe42ec88f mt76: mt7915: ensure that only one sta entry is active per mac address
When a client is roaming to a different AP interface, a duplicate wtbl entry
can be created. This can lead to lost packets or aggregation issues until
the old entry expires.
In order to fix this issue, delete any conflicting entries from WTBL
whenever a station is authorized.

Signed-off-by: Felix Fietkau <[email protected]>
2024-12-05 20:33:55 +01:00
Felix Fietkau 109114146f mt76: only enable tx worker after setting the channel
Avoids sending packets too early

Fixes: 0b3be9d1d34e ("wifi: mt76: add separate tx scheduling queue for off-channel tx")
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-05 13:06:27 +01:00
Felix Fietkau c246fa5451 wifi: mt76: mt7996: fix monitor mode
Enable sniffer mode via MCU command in order to properly enable promiscuous
mode on the device.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:07:24 +01:00
Felix Fietkau d258f4e3e1 wifi: mt76: mt7996: switch to single multi-radio wiphy
Use generic mt76 chanctx functions and look up phy from vif link.
The driver now uses only a single phy to handle multiple interfaces on
different channels. This is preparation for full MLO support.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:07:23 +01:00
Felix Fietkau 484e3f289a wifi: mt76: mt7996: move all debugfs files to the primary phy
Preparation for single-wiphy support

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:04:14 +01:00
Felix Fietkau 1289737e12 wifi: mt76: mt7996: prepare mt7996_mcu_update_bss_color for MLO support
Pass in struct mt76_vif_link in order to update the correct link.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:04:13 +01:00
Felix Fietkau 60bf2bef95 wifi: mt76: connac: prepare mt76_connac_mcu_sta_basic_tlv for MLO support
Pass in struct ieee80211_bss_conf in order to use link specific data.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:04:13 +01:00
Felix Fietkau bf12cc4043 wifi: mt76: mt7996: prepare mt7996_mcu_set_timing for MLO support
Pass in struct ieee80211_bss_conf in order to use link specific data.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:04:13 +01:00
Felix Fietkau 9ee9900503 wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support
Pass in struct ieee80211_bss_conf in order to use link specific data.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:04:13 +01:00
Felix Fietkau 252baa7bf4 wifi: mt76: mt7996: prepare mt7996_mcu_add_beacon for MLO support
Pass in struct ieee80211_bss_conf.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:04:13 +01:00
Felix Fietkau 807090b286 wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support
Add extra arguments for struct ieee80211_bss_conf and mt76_vif_link.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-28 10:03:59 +01:00
Felix Fietkau f9d593d4a6 wifi: mt76: mt7996: pass wcid to mt7996_mcu_sta_hdr_trans_tlv
Preparation for MLO support.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-27 08:52:59 +01:00
Felix Fietkau 42429ae0ea wifi: mt76: mt7996: use emulated hardware scan support
Preparation for supporting multiple radios on a single wiphy

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-27 08:52:59 +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 aeedee5c0a wifi: mt76: add multi-radio support to tx scheduling
Look up the phy for each scheduled txq. Only run one scheduling loop per hw.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02:00
Felix Fietkau 0b526090de wifi: mt76: add multi-radio support to a few core hw ops
Iterate over all phys if multi-radio is supported by the driver

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-22 10:18:59 +02: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 dcc6f158d7 wifi: mt76: mt7996: split link specific data from struct mt7996_vif
Preparation for MLO support.

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
Felix Fietkau d508a6eb93 wifi: mt76: mt7996: 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-10-22 10:18:59 +02:00
Felix Fietkau 8dfead68c2 wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state
Avoid issuing MCU calls during a hardware restart

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-14 19:11:12 +02:00
Felix Fietkau ecca0e77b4 wifi: mt76: mt7915: fix omac index assignment after hardware reset
Reset per-phy mac address slot mask in order to avoid leaking entries.

Fixes: 8a55712d124f ("wifi: mt76: mt7915: enable full system reset support")
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-11 20:01:19 +02:00
Felix Fietkau 703c6b78c1 wifi: mt76: mt7915: firmware restart on devices with a second pcie link
It seems that the firmware checks the register used for detecting matching
PCIe links in order to figure out if a secondary PCIe link is enabled.
Write the register again just before starting the firmware on hw reset,
in order to fix an issue that left the second band unusable after restart.

Fixes: 9093cfff72e3 ("mt76: mt7915: add support for using a secondary PCIe link for gen1")
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-11 18:49:00 +02:00
Felix Fietkau 513bd76837 Revert "wifi: mt76: mt7915: disable the second PCIe link for MT7915"
This reverts commit a902bfa6db.
Will be replaced with a proper fix

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-11 18:46:01 +02:00
Felix Fietkau 0d8474602a wifi: mt76: mt7915: decrease timeout for commonly issued MCU commands
This allows faster recovery from firmware issues

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-08 21:55:01 +02:00
Felix Fietkau a7d48cd3ed wifi: mt76: mt7915: reduce the number of command retries
The need to retry a command is really uncommon. Reduce the retries to 1 to
speed up recovery from firmware issues.

Signed-off-by: Felix Fietkau <[email protected]>
2024-10-08 21:55:01 +02:00
Felix Fietkau a902bfa6db wifi: mt76: mt7915: disable the second PCIe link for MT7915
The second PCIe link is only used to improve performance on older generation
PCIe devices (e.g. MT7621) where the bus speed of one link is not enough to
saturate both wifi bands under really good conditions.
Unfortunately it seems that resetting the hardware after a firmware error
causes the second band to stop working if the second link is in use.
Disable the link until the issue is properly fixed.

For testing, the link can still be enabled via module parameter.

Fixes: 9093cfff72e3 ("mt76: mt7915: add support for using a secondary PCIe link for gen1")
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-08 21:15:32 +02:00
Felix Fietkau 02c07fe539 wifi: mt76: mt7996: fix rx filter setting for bfee functionality
Fix rx filter setting to prevent dropping NDPA frames. Without this
change, bfee functionality may behave abnormally.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-07 17:37:02 +02:00
Felix Fietkau ee693260c5 firmware: move mt7996 firmware to the right place
It was accidentally placed in the source code folder

Signed-off-by: Felix Fietkau <[email protected]>
2024-09-29 17:49:27 +02:00
Felix Fietkau 7aca94abac wifi: mt76: mt7915: fix slot time for 5/6GHz
It should only be set to 20 for long slot time on 2.4 GHz

Signed-off-by: Felix Fietkau <[email protected]>
2024-09-27 19:31:09 +02:00
Felix Fietkau addfbd1418 firmware: add latest mt7996 + mt7992 firmware
Signed-off-by: Felix Fietkau <[email protected]>
2024-09-27 07:49:18 +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 a2a9d98262 wifi: mt76: do not increase mcu skb refcount if retry is not supported
If mcu_skb_prepare_msg is not implemented, incrementing skb refcount does not
work for mcu message retry. In some cases (e.g. on SDIO), shared skbs can trigger
a BUG_ON, crashing the system.
Fix this by only incrementing refcount if retry is actually supported.

Fixes: 3688c18b65ae ("wifi: mt76: mt7915: retry mcu messages")
Reported-by: Nícolas F. R. A. Prado <[email protected]> #KernelCI
Tested-by: Alper Nebi Yasak <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2024-09-17 12:58:21 +02:00