summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76
AgeCommit message (Collapse)Author
2025-03-19wifi: mt76: mt7996: Add link_info_changed callbackLorenzo Bianconi
Convert bss_info_changed mac80211 callback in link_info_changed one. This is a preliminary patch to enable MLO support in MT7996 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-5-31df6972519b@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: Add vif_cfg_changed callbackLorenzo Bianconi
Introduce vif_cfg_changed mac80211 callback as preliminary patch to enable MLO support in MT7996 driver. Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com> Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-4-31df6972519b@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: Add mt7996_sta_link struct in mt7996_vif_linkLorenzo Bianconi
Introduce mt7996_sta_link field in mt7996_vif_link structure instead of mt7996_sta. This is a preliminary patch to support MLO in MT7996 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-3-31df6972519b@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: Introduce mt7996_sta_link containerLorenzo Bianconi
Similar to mt7996_vif_link, add mt7996_sta_link structure as driver representation for sta links. This is a preliminary patch to introduce MLO support for MT7996 driver. Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com> Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-2-31df6972519b@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: Add change_vif_links stubLorenzo Bianconi
change_vif_links callback is required by mac80211. This is a preliminary patch to introduce MLO support for MT7996 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-1-31df6972519b@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: scan: fix setting tx_info fieldsFelix Fietkau
ieee80211_tx_prepare_skb initializes the skb cb, so fields need to be set afterwards. Link: https://patch.msgid.link/20250311103646.43346-8-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: implement driver specific get_txpower functionFelix Fietkau
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. Link: https://patch.msgid.link/20250311103646.43346-7-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: only mark tx-status-failed frames as ACKed on mt76x0/2Felix Fietkau
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. Link: https://patch.msgid.link/20250311103646.43346-6-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: use the correct vif link for scanning/rocFelix Fietkau
Use the newly added offchannel_link pointer in vif data Link: https://patch.msgid.link/20250311103646.43346-5-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: scan: set vif offchannel link for scanning/rocFelix Fietkau
The driver needs to know what vif link to use Link: https://patch.msgid.link/20250311103646.43346-4-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: remove unnecessary key->cipher check for BIP framesMichael-CY Lee
The cipher type check is redundant, and there is no need to dereference the key struct here. Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> Link: https://patch.msgid.link/20250311103646.43346-3-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: fix SER reset trigger on WED resetRex Lu
The firmware needs a specific trigger when WED is being reset due to an ethernet reset condition. This helps prevent further L1 SER failure. Signed-off-by: Rex Lu <rex.lu@mediatek.com> Link: https://patch.msgid.link/20250311103646.43346-2-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: revise TXS sizeBenjamin Lin
Size of MPDU/PPDU TXS is 12 DWs. In mt7996/mt7992, last 4 DWs are reserved, so TXS size was mistakenly considered to be 8 DWs. However, in mt7990, 9th DW of TXS starts to be used. Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com> Link: https://patch.msgid.link/20250311103646.43346-1-nbd@nbd.name Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7996: cleanup mt7996_get_power_boundRazvan Grigore
Refactor for making use of mt76_get_power_bound instead of the specific mt7996_get_power_bound, since we need this for other chipsets as well when calculating txpower Signed-off-by: Razvan Grigore <razvan.grigore@vampirebyte.ro> Link: https://patch.msgid.link/20250211081247.5892-6-razvan.grigore@vampirebyte.ro Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7915: cleanup mt7915_get_power_boundRazvan Grigore
Refactor for making use of mt76_get_power_bound instead of the specific mt7915_get_power_bound, since we need this for other chipsets as well when calculating txpower Signed-off-by: Razvan Grigore <razvan.grigore@vampirebyte.ro> Link: https://patch.msgid.link/20250211081247.5892-5-razvan.grigore@vampirebyte.ro Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: add mt76_get_power_bound helper functionRazvan Grigore
This will replace mt7915_get_power_bound function from b/mt7915/mcu.h, since we will need it also for mt7921 and mt7925 Signed-off-by: Razvan Grigore <razvan.grigore@vampirebyte.ro> Link: https://patch.msgid.link/20250211081247.5892-2-razvan.grigore@vampirebyte.ro Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: add MTCL support to enhance the regulatory complianceMing Yen Hsieh
Apply the MTCL configuration to improving channel availability and regulatory compliance if MTCL table is supported. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250304113649.867387-6-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt792x: extend MTCL of APCI to version3 for EHT controlMing Yen Hsieh
This patch introduces version 3 of the MTCL table, which provides regulatory information for WiFi 7. It also configured by the platform vender like the version 1 and 2. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250304113649.867387-5-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: remove unused acpi function for clcMing Yen Hsieh
The code for handling ACPI configuration in CLC was copied from the mt7921 driver but is not utilized in the mt7925 implementation. So removes the unused functionality to clean up the codebase. Cc: stable@vger.kernel.org Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250304113649.867387-4-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: update the channel usage when the regd domain changedMing Yen Hsieh
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, mt7925 chipset should update the channel usage based on CLC data. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250304113649.867387-3-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: add EHT control support based on the CLC dataMing Yen Hsieh
Some countries do not support EHT modulation for now. To prevent violating regulations, the MT7925 chipset should control the EHT capabilities. Therefore, when a regulatory domain change is detected during scanning, the `mt7925_regd_be_ctrl` will process the CLC data to update the EHT capabilities. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250304113649.867387-2-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: load the appropriate CLC data based on hardware typeMing Yen Hsieh
Read the EEPROM to determine the hardware type and uses this to load the correct CLC data. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250304113649.867387-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: update the power-saving flowMing Yen Hsieh
After joining MLO, ensure that all links are setup before enabling power-saving. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Cc: stable@vger.kernel.org Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-6-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmdMing Yen Hsieh
Integrate *mlo_sta_cmd and *sta_cmd for the MLO firmware. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Cc: stable@vger.kernel.org Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-5-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failureMing Yen Hsieh
Removing BSS without removing STAREC first will cause firmware abnormal and next connection fail. Fixes: 816161051a03 ("wifi: mt76: mt7925: Cleanup MLO settings post-disconnection") Cc: stable@vger.kernel.org Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-4-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: fix the wrong simultaneous cap for MLOMing Yen Hsieh
The mt7925 chip is only support a single radio, so the maximum number of simultaneous should be 0. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Cc: stable@vger.kernel.org Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-3-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is presentMing Yen Hsieh
When the p2p device and MLO station are running concurrently, the p2p device will occupy the wrong link_idx when the MLO secondary link is added. Fixes: 9e4c3a007f01 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO") Cc: stable@vger.kernel.org Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-2-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO"Sean Wang
For MLO, mac80211 will send the BA action for each link to the driver, so the driver does not need to handle it itself. Therefore, revert this patch. Fixes: eb2a9a12c609 ("wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO") Cc: stable@vger.kernel.org Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Tested-by: Caleb Jorden <cjorden@gmail.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Link: https://patch.msgid.link/20250305000851.493671-1-sean.wang@kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7921: fix kernel panic due to null pointer dereferenceMing Yen Hsieh
Address a kernel panic caused by a null pointer dereference in the `mt792x_rx_get_wcid` function. The issue arises because the `deflink` structure is not properly initialized with the `sta` context. This patch ensures that the `deflink` structure is correctly linked to the `sta` context, preventing the null pointer dereference. BUG: kernel NULL pointer dereference, address: 0000000000000400 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 0 UID: 0 PID: 470 Comm: mt76-usb-rx phy Not tainted 6.12.13-gentoo-dist #1 Hardware name: /AMD HUDSON-M1, BIOS 4.6.4 11/15/2011 RIP: 0010:mt792x_rx_get_wcid+0x48/0x140 [mt792x_lib] RSP: 0018:ffffa147c055fd98 EFLAGS: 00010202 RAX: 0000000000000000 RBX: ffff8e9ecb652000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8e9ecb652000 RBP: 0000000000000685 R08: ffff8e9ec6570000 R09: 0000000000000000 R10: ffff8e9ecd2ca000 R11: ffff8e9f22a217c0 R12: 0000000038010119 R13: 0000000080843801 R14: ffff8e9ec6570000 R15: ffff8e9ecb652000 FS: 0000000000000000(0000) GS:ffff8e9f22a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000400 CR3: 000000000d2ea000 CR4: 00000000000006f0 Call Trace: <TASK> ? __die_body.cold+0x19/0x27 ? page_fault_oops+0x15a/0x2f0 ? search_module_extables+0x19/0x60 ? search_bpf_extables+0x5f/0x80 ? exc_page_fault+0x7e/0x180 ? asm_exc_page_fault+0x26/0x30 ? mt792x_rx_get_wcid+0x48/0x140 [mt792x_lib] mt7921_queue_rx_skb+0x1c6/0xaa0 [mt7921_common] mt76u_alloc_queues+0x784/0x810 [mt76_usb] ? __pfx___mt76_worker_fn+0x10/0x10 [mt76] __mt76_worker_fn+0x4f/0x80 [mt76] kthread+0xd2/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 </TASK> ---[ end trace 0000000000000000 ]--- Reported-by: Nick Morrow <usbwifi2024@gmail.com> Closes: https://github.com/morrownr/USB-WiFi/issues/577 Cc: stable@vger.kernel.org Fixes: 90c10286b176 ("wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA") Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Tested-by: Salah Coronya <salah.coronya@gmail.com> Link: https://patch.msgid.link/20250218033343.1999648-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: Simplify HIF suspend handling to avoid suspend failQuan Zhou
System suspend failures may occur due to inappropriate handling of traffic not idle event by the WiFi driver. The WiFi firmware's traffic not idle indication does not need to be tied to suspend. Fix the flow to ensuring the system can suspend properly. Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Link: https://patch.msgid.link/34208c7280325f57a651363d339399eb1744d3b7.1740400998.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: Remove unnecessary if-checkThorsten Blum
The if and else branches implement the same logic. Remove the unnecessary if-check and simplify the code. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://patch.msgid.link/20250223232127.99357-2-thorsten.blum@linux.dev Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: Add check for devm_kstrdup()Haoxiang Li
Add check for the return value of devm_kstrdup() in mt76_get_of_data_from_mtd() to catch potential exception. Fixes: e7a6a044f9b9 ("mt76: testmode: move mtd part to mt76_dev") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> Link: https://patch.msgid.link/20250219033645.2594753-1-haoxiang_li2024@163.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: fix country count limitation for CLCMing Yen Hsieh
Due to the increase in the number of power tables for 6Ghz on CLC, the variable nr_country is no longer sufficient to represent the total quantity. Therefore, we have switched to calculating the length of clc buf to obtain the correct power table. Cc: stable@vger.kernel.org Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250116062131.3860198-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: ensure wow pattern command align fw formatMing Yen Hsieh
Align the format of "struct mt7925_wow_pattern_tlv" with firmware to ensure proper functionality. Cc: stable@vger.kernel.org Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Link: https://patch.msgid.link/20250116055925.3856856-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7915: fix possible integer overflows in mt7915_muru_stats_show()Nikita Zhandarovich
Assuming sums of values stored in variables such as sub_total_cnt and total_ppdu_cnt are big enough to warrant their u64 type, it makes sense to ensure that their calculation takes into account possible integer overflow issues. Play it safe and fix the problem by casting right hand expressions to u64 as well. Also, slightly adjust tabulation. Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Fixes: 1966a5078f2d ("mt76: mt7915: add mu-mimo and ofdma debugfs knobs") Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru> Link: https://patch.msgid.link/20250114154441.16920-1-n.zhandarovich@fintech.ru Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: fix fails to enter low power mode in suspend stateQuan Zhou
The mt7925 sometimes fails to enter low power mode during suspend. This is caused by the chip firmware sending an additional ACK event to the host after processing the suspend command. Due to timing issues, this event may not reach the host, causing the chip to get stuck. To resolve this, the ACK flag in the suspend command is removed, as it is not needed in the MT7925 architecture. This prevents the firmware from sending the additional ACK event, ensuring the device can reliably enter low power mode during suspend. Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Link: https://patch.msgid.link/d056938144a3a0336c3a4e3cec6f271899f32bf7.1736775666.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-19wifi: mt76: mt7925: introduce MLO capability controlMing Yen Hsieh
This patch introduces MLO capability control for the MT792x Wi-Fi driver. It removes the unused `MT792x_CHIP_CAP_MLO_EVT_EN` flag and introduces new capability flags `MT792x_CHIP_CAP_MLO_EN` and `MT792x_CHIP_CAP_MLO_EML_EN` to enable MLO and EML features based on firmware capabilities. Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Reviewed-by: Sabeeh Khan <sabeeh-khan@ti.com> Link: https://patch.msgid.link/20250217081729.1840930-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-02-18wifi: Switch to use hrtimer_setup()Nam Cao
hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism. Patch was created by using Coccinelle. Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/71fbc442aee9a9e892e475f3bbf8f368c6692a55.1738746872.git.namcao@linutronix.de
2025-01-27wifi: mt76: move napi_enable() from under BHJakub Kicinski
mt76 does a lot of: local_bh_disable(); napi_enable(...napi); napi_schedule(...napi); local_bh_enable(); local_bh_disable() is not a real lock, its most likely taken because napi_schedule() requires that we invoke softirqs at some point. napi_enable() needs to take a mutex, so move it from under the BH protection. Fixes: 413f0271f396 ("net: protect NAPI enablement with netdev_lock()") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/dcfd56bc-de32-4b11-9e19-d8bd1543745d@stanley.mountain Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250124031841.1179756-8-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-01-14wifi: mt76: mt7996: add implicit beamforming support for mt7992Howard Hsu
The configuration of mt7992 iBF has some differences to mt7996, rework related code to make it work. Also, most of our chipsets support iBF only on HT and VHT mode, except mt7992 variant that has 5T on 5GHz band also supports iBF on HE and EHT mode. Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-9-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: fix beacon command during disablingMichael-CY Lee
When stopping AP, mac80211 frees beacon template before it calls driver's stop_ap operation. In other words, on the path of stopping AP, ieee80211_beacon_get_template() must returns NULL in mt7996_mcu_add_beacon(). In such case mt7996 immediately returns -EINVAL without telling FW to disable the beacon. This commit refactors mt7996_mcu_add_beacon() so that FW can be correctly informed when disabling AP interface. Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-8-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: fix ldpc settingPeter Chiu
The non-AP interfaces would not use conf->vht_ldpc so they never set STA_CAP_VHT_LDPC even if peer-station support LDPC. Check conf->vht_ldpc only for AP interface. Without this patch, station only uses BCC to transmit packet in VHT mode. Fixes: dda423dd65c3 ("wifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()") Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-7-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: fix definition of tx descriptorBenjamin Lin
For mt7992 chipsets, the definition of TXD.DW6.BIT10~15 has different interpretations on different frame types. Driver only needs to fill MSDU_CNT for non-management frames. Fixes: 408566db8cad ("wifi: mt76: connac: add new definition of tx descriptor") Co-developed-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-6-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: connac: adjust phy capabilities based on band constraintsHoward Hsu
Adjust HE and EHT phy capabilities based on the band constraints. For 2g band, we shall not enable the capabilities above 40MHz. Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-5-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: fix incorrect indexing of MIB FW eventBenjamin Lin
Fix wrong calculation of the channel times due to incorrect interpretation from the FW event. Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-4-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: fix HE Phy capabilityHoward Hsu
Set HE SU PPDU And HE MU PPDU With 4x HE-LTF And 0.8 us GI within HE PHY Capabilities element as 1 since hardware can support. Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-3-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: fix the capability of reception of EHT MU PPDUHoward Hsu
This commit includes two changes. First, enable "EHT MU PPDU With 4x EHT-LTF And 0.8us GI" in EHT Phy capabilities element since hardware can support. Second, fix the value of "Maximum number of supported EHT LTFs" in the same element, where the previous setting of 3 in Bit 3-4 was incorrect. Fixes: 348533eb968d ("wifi: mt76: mt7996: add EHT capability init") Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-2-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7996: add max mpdu len capabilityPeter Chiu
Set max mpdu len to 11454 according to hardware capability. Without this patch, the max ampdu length would be 3895 and count not get expected performance. Fixes: 348533eb968d ("wifi: mt76: mt7996: add EHT capability init") Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250114101026.3587702-1-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domainLeon Yen
Some countries have strict RF restrictions where changing the regulatory domain dynamically based on the connected AP is not acceptable. This patch disables Beacon country IE hinting when a valid country code is set from usersland (e.g., by system using iw or CRDA). Signed-off-by: Leon Yen <leon.yen@mediatek.com> Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com> Tested-by: David Ruth <druth@chromium.org> Link: https://patch.msgid.link/20240412085357.13756-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-01-14wifi: mt76: mt7925e: fix too long of wifi resume timeQuan Zhou
The mt7925e takes a long time to resume in platform resume scenarios. This is due to the mt7925 reconfiguring the tx power for each wifi channel during resume. By streamlining the process and removing redundant power configurations, the resume time for the mt7925 can be shortened. Signed-off-by: Quan Zhou <quan.zhou@mediatek.com> Link: https://patch.msgid.link/f075d43d87a5eefa5869baf755e9986edf735860.1735910836.git.quan.zhou@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>