Commit Graph
4145 Commits
Author SHA1 Message Date
Ming Yen HsiehandFelix Fietkau 1b5e6abc2e wifi: mt76: mt7925: Fix incorrect MLD address in bss_mld_tlv for MLO support
For this TLV, the address should be set to the MLD address rather than
the link address.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:41:28 +01:00
Sean WangandFelix Fietkau 7f65b1b28b wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO
This commit extends the `mt76_connac_mcu_uni_add_dev` function to include
support for Multi-Link Operation (MLO). Additionally, backward
compatibility for MT7921 is preserved, enabling seamless integration with
existing setups.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Sean Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:41:28 +01:00
Chad MonroeandFelix Fietkau 6f6a1f7cb3 wifi: mt76: mt7996: exclude tx backoff time from airtime
This helps to make STA airtime counters more accurate.

Signed-off-by: Chad Monroe <[email protected]>
Suggested-by: Ryder Lee <[email protected]>
Link: https://patch.msgid.link/88821d8f08e2715927939b35e630a06171962636.1732653612.git.chad@monroe.io
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
Chad MonroeandFelix Fietkau af494e2dcc wifi: mt76: mt7915: exclude tx backoff time from airtime
This helps to make STA airtime counters more accurate.

Signed-off-by: Chad Monroe <[email protected]>
Suggested-by: Ryder Lee <[email protected]>
Link: https://patch.msgid.link/026380cec180261956b983cbdb009605867bcd8d.1732596478.git.chad@monroe.io
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
xueqin LuoandFelix Fietkau af983b2543 wifi: mt76: mt7915: fix overflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large
number such as 18446744073709551615 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.
This commit was inspired by commit: 57ee12b6c514.

Fixes: 02ee68b95d81 ("mt76: mt7915: add control knobs for thermal throttling")
Signed-off-by: xueqin Luo <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
xueqin LuoandFelix Fietkau c99e4d51b3 wifi: mt76: mt7996: fix overflows seen when writing limit attributes
DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large
number such as 18446744073709551615 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.
This commit was inspired by commit: 57ee12b6c514.

Fixes: 6879b2e94172 ("wifi: mt76: mt7996: add thermal sensor device support")
Signed-off-by: xueqin Luo <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
Ming Yen HsiehandFelix Fietkau eede99f524 wifi: mt76: mt7925: fix the invalid ip address for arp offload
The wrong ieee80211_vif will lead to get invalid ip address and
the correct ieee80211_vif can be obtained from ieee80211_bss_conf.

Fixes: 147324292979 ("wifi: mt76: mt7925: add link handling in the BSS_CHANGED_ARP_FILTER handler")
Signed-off-by: Ming Yen Hsieh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
Ming Yen HsiehandFelix Fietkau 3f1401a0f0 wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer
Use tlv instead of skb, because using skb will get valid data
with wrong offset.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
Eric-SY ChangandFelix Fietkau 3e3c484726 wifi: mt76: mt7925: fix wrong band_idx setting when enable sniffer mode
Currently, sniffer mode does not support band auto,
so set band_idx to the default 0.

Fixes: 0cb349d742d1 ("wifi: mt76: mt7925: update mt7925_mac_link_bss_add for MLO")
Signed-off-by: Eric-SY Chang <[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-12-30 19:36:08 +01:00
Charles HanandFelix Fietkau b47e20b440 wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links
In mt7925_change_vif_links() devm_kzalloc() may return NULL but this
returned value is not checked.

Fixes: 69acd6d910b0 ("wifi: mt76: mt7925: add mt7925_change_vif_links")
Signed-off-by: Charles Han <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36:08 +01:00
Allan WangandFelix Fietkau 83e4d4a82e wifi: mt76: introduce mt792x_config_mac_addr_list routine
Add mt792x_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt792x driver

Signed-off-by: Hao Zhang <[email protected]>
Signed-off-by: Leon Yen <[email protected]>
Signed-off-by: Allan Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:36: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
Ma KeandFelix Fietkau 71fa9124d1 wifi: mt76: mt7996: fix NULL pointer dereference in mt7996_mcu_sta_bfer_he
Fix the NULL pointer dereference in mt7996_mcu_sta_bfer_he
routine adding an sta interface to the mt7996 driver.

Found by code review.

Cc: [email protected]
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Ma Ke <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2024-12-30 19:16:14 +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
Shayne ChenandFelix Fietkau 7c00df0e7e wifi: mt76: connac: rework connac helpers
Rework connac helpers related to rate and phymode.
This is a preliminary patch to add MLO support for mt7996 chipsets.

Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
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
Christophe JAILLETandFelix Fietkau 6a1199463f wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface()
If mt76_wcid_alloc() fails, the "mt76.mutex" mutex needs to be released as
done in the other error handling paths of mt7915_add_interface().

Fixes: f3049b88b2b3 ("wifi: mt76: mt7915: allocate vif wcid in the same range as stations")
Signed-off-by: Christophe JAILLET <[email protected]>
Link: https://patch.msgid.link/b9d8fbfc19360bfe60b9cea1cb0f735ab3b4bc26.1727639596.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-10 10:47:23 +02:00
Shayne ChenandFelix Fietkau f5bccb1223 wifi: mt76: mt7996: fix invalid interface combinations
Setting beacon_int_min_gcd and NL80211_IFTYPE_ADHOC in the same interface
combination is invalid, which will trigger the following warning trace
and get error returned from wiphy_register().

[   10.080325] Call trace:
[   10.082761]  wiphy_register+0xc4/0x76c [cfg80211]
[   10.087465]  ieee80211_register_hw+0x800/0xac4 [mac80211]
[   10.092868]  mt76_register_device+0x16c/0x2c0 [mt76]
[   10.097829]  mt7996_register_device+0x740/0x844 [mt7996e]

Fix this by removing unused adhoc iftype.

Fixes: 948f65249868 ("wifi: mt76: mt7996: advertize beacon_int_min_gcd")
Reported-by: Frank Wunderlich <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
2024-10-10 10:39:58 +02:00
Shayne ChenandFelix Fietkau 5f60515696 wifi: mt76: mt7915: add module param to select 5 GHz or 6 GHz on MT7916
Due to a limitation in available memory, the MT7916 firmware can only
handle either 5 GHz or 6 GHz at a time. It does not support runtime
switching without a full restart.

On older firmware, this accidentally worked to some degree due to missing
checks, but couldn't be supported properly, because it left the 6 GHz
channels uncalibrated.
Newer firmware refuses to start on either band if the passed EEPROM
data indicates support for both.

Deal with this limitation by using a module parameter to specify the
preferred band in case both are supported.

Fixes: b4d093e321bd ("mt76: mt7915: add 6 GHz support")
Cc: [email protected]
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2024-10-10 10:33:23 +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