]> git.ipfire.org Git - thirdparty/linux.git/log
thirdparty/linux.git
3 weeks agowifi: iwlwifi: mld: Refactor scan command handling
Ilan Peer [Thu, 19 Mar 2026 09:09:19 +0000 (11:09 +0200)] 
wifi: iwlwifi: mld: Refactor scan command handling

As a preparation for a new scan command version, refactor
the scan command building such that it would allow introducing
new scan command structures in a simpler way.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.a3e9589769f0.If458023e234ed79db7474107d98f0b6e28e565e5@changeid
3 weeks agowifi: iwlwifi: mld: remove unused scan expire time constants
Pagadala Yesu Anjaneyulu [Thu, 19 Mar 2026 09:09:18 +0000 (11:09 +0200)] 
wifi: iwlwifi: mld: remove unused scan expire time constants

Remove the unused IWL_MLD_SCAN_EXPIRE_TIME_SEC constant from
constants.h and its corresponding IWL_MLD_SCAN_EXPIRE_TIME
macro definition from mlo.c. These definitions are no longer
referenced.

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.4be7221113cf.I13e32d575bb854709af374519332b998bc1fed4a@changeid
3 weeks agowifi: iwlwifi: mvm: cleanup some more MLO code
Nidhish A N [Thu, 19 Mar 2026 09:09:17 +0000 (11:09 +0200)] 
wifi: iwlwifi: mvm: cleanup some more MLO code

iwlmld is now the op mode that is used  for EHT devices,
so iwlmvm code can never run in MLO.
Clean up some more MLO code.

Signed-off-by: Nidhish A N <nidhish.a.n@intel.com>
Reviewed-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.8efcec472e91.Icaf4f4d6b9008e12310f408cfef7f35643f27ca5@changeid
3 weeks agowifi: iwlwifi: acpi: better use ARRAY_SIZE than a define
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:16 +0000 (11:09 +0200)] 
wifi: iwlwifi: acpi: better use ARRAY_SIZE than a define

Since we'll have to change things in this area, use the safer option to
define the size of an array.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.1acfc3b6f2b8.I2185e7850146e15628f8ec2c579d93f536c83d83@changeid
3 weeks agowifi: iwlwifi: uefi: decouple UEFI and firmware APIs
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:15 +0000 (11:09 +0200)] 
wifi: iwlwifi: uefi: decouple UEFI and firmware APIs

The APIs in uefi.h are not firmware API files nor are they pure software
objects. They really reflect a specific layout we expect to see in the
UEFI tables.
Since the UEFI objects are encoded into the BIOS, we can't use the same
values for the declaration of the UEFI objects and for the pure software
object like iwl_sar_profile in the firmware runtime object.

Decouple the two types.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.db39a64073db.I21486dedb7357570151437cb0211b697e0efb61d@changeid
3 weeks agowifi: iwlwifi: ensure we don't read SAR values past the limit
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:14 +0000 (11:09 +0200)] 
wifi: iwlwifi: ensure we don't read SAR values past the limit

When we fill the SAR values, we read values from the BIOS store in the
firmware runtime object and write them into the command that we send to
the firmware.
We assumed that the size of the firmware command is not longer than the
BIOS tables. This has been true until now, but this is not really safe.
We will soon have an firmware API change that will increase the size of
the table in the command and we want to make sure that we don't have a
buffer overrun when we read the firmware runtime object.
Add this safety measure.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.99aaf2df072a.I5942590b81324b17e2a369f0c354cafee0f70ef5@changeid
3 weeks agowifi: iwlwifi: mld: add support for iwl_mcc_allowed_ap_type_cmd v2
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:13 +0000 (11:09 +0200)] 
wifi: iwlwifi: mld: add support for iwl_mcc_allowed_ap_type_cmd v2

There is a new version of this command to indicate which AP type in
UNII-9 is supported per country.

This adds support for a new UEFI table that will include that data to be
filled in the new AP type table.
Rename the uats_table field in firmware_runtime structure since it
includes now the UATS and the new UNEB table coming from UEFI.
For the same reason, rename iwl_mld_init_uats.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.b839655712c5.I3dfca54bd19d6bd5f7ca385ea63be086ece9c1d0@changeid
3 weeks agowifi: iwlwifi: mvm: replace use of system_wq with system_percpu_wq
Marco Crivellari [Tue, 10 Feb 2026 14:33:32 +0000 (15:33 +0100)] 
wifi: iwlwifi: mvm: replace use of system_wq with system_percpu_wq

This patch continues the effort to refactor workqueue APIs, which has begun
with the changes introducing new workqueues and a new alloc_workqueue flag:

   commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
   commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")

The point of the refactoring is to eventually alter the default behavior of
workqueues to become unbound by default so that their workload placement is
optimized by the scheduler.

Before that to happen after a careful review and conversion of each individual
case, workqueue users must be converted to the better named new workqueues with
no intended behaviour changes:

   system_wq -> system_percpu_wq
   system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be
removed in the future.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://patch.msgid.link/20260210143332.206146-4-marco.crivellari@suse.com
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
3 weeks agowifi: iwlwifi: fw: replace use of system_unbound_wq with system_dfl_wq
Marco Crivellari [Thu, 20 Nov 2025 10:08:49 +0000 (11:08 +0100)] 
wifi: iwlwifi: fw: replace use of system_unbound_wq with system_dfl_wq

This patch continues the effort to refactor workqueue APIs, which has begun
with the changes introducing new workqueues and a new alloc_workqueue flag:

   commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
   commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")

The point of the refactoring is to eventually alter the default behavior of
workqueues to become unbound by default so that their workload placement is
optimized by the scheduler.

Before that to happen after a careful review and conversion of each individual
case, workqueue users must be converted to the better named new workqueues with
no intended behaviour changes:

   system_wq -> system_percpu_wq
   system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be
removed in the future.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://patch.msgid.link/20251120100850.66192-3-marco.crivellari@suse.com
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
3 weeks agowifi: iwlwifi: replace use of system_unbound_wq with system_dfl_wq
Marco Crivellari [Thu, 20 Nov 2025 10:08:48 +0000 (11:08 +0100)] 
wifi: iwlwifi: replace use of system_unbound_wq with system_dfl_wq

This patch continues the effort to refactor workqueue APIs, which has begun
with the changes introducing new workqueues and a new alloc_workqueue flag:

   commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq")
   commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")

The point of the refactoring is to eventually alter the default behavior of
workqueues to become unbound by default so that their workload placement is
optimized by the scheduler.

Before that to happen after a careful review and conversion of each individual
case, workqueue users must be converted to the better named new workqueues with
no intended behaviour changes:

   system_wq -> system_percpu_wq
   system_unbound_wq -> system_dfl_wq

This way the old obsolete workqueues (system_wq, system_unbound_wq) can be
removed in the future.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Link: https://patch.msgid.link/20251120100850.66192-2-marco.crivellari@suse.com
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
3 weeks agoMerge tag 'mt76-next-2026-03-23' of https://github.com/nbd168/wireless
Johannes Berg [Tue, 24 Mar 2026 16:12:38 +0000 (17:12 +0100)] 
Merge tag 'mt76-next-2026-03-23' of https://github.com/nbd168/wireless

Felix Fietkau says:
===================
mt76 patches for 7.1

- fixes
- mt7996/mt7925 MLO fixes/improvements
- mt7996 NPU support
- mt7996 external EEPROM support
===================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mt76: mt7996: Destroy active sta links in mt7996_mac_sta_remove()
Lorenzo Bianconi [Sun, 15 Mar 2026 10:26:29 +0000 (11:26 +0100)] 
wifi: mt76: mt7996: Destroy active sta links in mt7996_mac_sta_remove()

Similar to vif link management, postpone sta link destuction in
mt7996_mac_sta_remove() introducing mt7996_mac_sta_remove_link utility
routine and just disable sta link running mt7996_mac_sta_remove_links
routine.
This is a preliminary patch in order to support MLO link reconfiguration
in MT7996 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260315-mt7996-mlo-link-reconf-v1-6-a8a634fbc927@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Add mcu APIs to enable/disable vif links.
Shayne Chen [Sun, 15 Mar 2026 10:26:28 +0000 (11:26 +0100)] 
wifi: mt76: mt7996: Add mcu APIs to enable/disable vif links.

Introduce mt7996_mcu_mld_reconf_stop_link and mt7996_mcu_mld_link_oper
utility routines in order to communicate to the mcu fw to disable/enable
a specific vif link. Please note these APIs are currently supported by
the MT7996 firmware only in AP mode.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260315-mt7996-mlo-link-reconf-v1-5-a8a634fbc927@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Destroy vif active links in mt7996_remove_interface()
Lorenzo Bianconi [Sun, 15 Mar 2026 10:26:27 +0000 (11:26 +0100)] 
wifi: mt76: mt7996: Destroy vif active links in mt7996_remove_interface()

MT7996 hw requires to remove active links from the mcu BSSINFO table
destroying the interface. For this reason introduce mt7996_vif_link_destroy
routine and remove active (non-offchannel) vif links running
mt7996_remove_interface routine.
This is a preliminary patch in order to support MLO link reconfiguration
in MT7996 driver.

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/20260315-mt7996-mlo-link-reconf-v1-4-a8a634fbc927@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Move mlink deallocation in mt7996_vif_link_remove()
Shayne Chen [Sun, 15 Mar 2026 10:26:26 +0000 (11:26 +0100)] 
wifi: mt76: mt7996: Move mlink deallocation in mt7996_vif_link_remove()

Destroy mt76_vif_link struct in mt7996_vif_link_remove routine and not
in mt76_unassign_vif_chanctx(). This is necessary since, in order to
properly support MLO link reconfiguration, we will destroy mt76_vif_link
struct during AP tear-down process and not running unassign_vif_chanctx
mac80211 callback.
This patch does not introduce any regression since
mt76_assign_vif_chanctx/mt76_unassign_vif_chanctx APIs are currently
used just by MT7996 driver.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260315-mt7996-mlo-link-reconf-v1-3-a8a634fbc927@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Account active links in valid_links fields
Shayne Chen [Sun, 15 Mar 2026 10:26:25 +0000 (11:26 +0100)] 
wifi: mt76: mt7996: Account active links in valid_links fields

Track active vif links in mt7996_vif_link_add and mt7996_vif_link_remove
routines.
This is a preliminary patch in order to remove AP MLD links from MCU
configuration during AP tear-down process and to support MLO link
reconfiguration in MT7996 driver.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260315-mt7996-mlo-link-reconf-v1-2-a8a634fbc927@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Rely on msta_link link_id in mt7996_vif_link_remove()
Lorenzo Bianconi [Sun, 15 Mar 2026 10:26:24 +0000 (11:26 +0100)] 
wifi: mt76: mt7996: Rely on msta_link link_id in mt7996_vif_link_remove()

Rely on msta_link link_id value in mt7996_vif_link_remove routine
instead of using link_conf pointer. This assumption is correct since
msta_link link_id is set to link_conf link_id value in mt7996_vif_link_add
routine.
Moreover, fallback to default ieee80211_bss_conf struct if the link_conf
pointer in mt7996_vif_link_remove() is NULL.
MT7996 hw requires to remove AP MLD links from MCU configuration during
AP tear-down process (e.g. running mt7996_remove_interface()). Doing so,
we can't assume link_conf pointer is always non-NULL running
mt7996_vif_link_remove routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260315-mt7996-mlo-link-reconf-v1-1-a8a634fbc927@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix frequency separation for station STR mode
Peter Chiu [Mon, 16 Mar 2026 11:44:27 +0000 (12:44 +0100)] 
wifi: mt76: mt7996: fix frequency separation for station STR mode

Fix frequency separation field for STR in MLD capabilities to get the
correct chip capability.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260316-mt7996-sta-str-v1-1-666814e6ab2d@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: host-only unwind published links on add failure
Sean Wang [Fri, 6 Mar 2026 23:22:38 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: host-only unwind published links on add failure

Release host link resources when mt7925_mac_sta_add_links() fails after
partial success.

msta->link[] and dev->mt76.wcid[] may already be published, so unwind
the host state to avoid leaving stale links behind.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-20-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: publish msta->link after successful link add
Sean Wang [Fri, 6 Mar 2026 23:22:37 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: publish msta->link after successful link add

Move the msta->link[link_id] publication until after
mt7925_mac_link_sta_add() succeeds.

msta->link[] is RCU-visible, so publishing it before setup completes can
expose a link whose add path later fails. Publish it only after success
to avoid partially initialized link state becoming visible.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-19-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: switch link STA allocation to RCU lifetime
Sean Wang [Fri, 6 Mar 2026 23:22:36 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: switch link STA allocation to RCU lifetime

Allocate mt792x_link_sta with kzalloc() and free it with kfree_rcu()
instead of devm-managed memory.

msta->link[] is published via RCU, so the link STA must remain valid
until readers have quiesced after teardown. Manage the object lifetime
with kfree_rcu() to match its RCU-visible publication.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-18-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: move WCID teardown into link_sta_remove()
Sean Wang [Fri, 6 Mar 2026 23:22:35 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: move WCID teardown into link_sta_remove()

Move WCID teardown into mt7925_mac_link_sta_remove() to mirror the
dev->mt76.wcid[] publish done during link add.

This clears the published WCID before the rest of teardown, so WCID
lookups no longer expose a link that is being removed.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-17-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: drop WCID reinit after publish
Sean Wang [Fri, 6 Mar 2026 23:22:34 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: drop WCID reinit after publish

Remove the redundant mt76_wcid_init() call after publishing the WCID in
mt7925_mac_link_sta_add().

WCID is already initialized before publication, so reinitializing it
afterward is unnecessary and makes the setup ordering less clear.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-16-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: unwind WCID setup on link STA add failure
Sean Wang [Fri, 6 Mar 2026 23:22:33 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: unwind WCID setup on link STA add failure

Undo the published WCID state when mt7925_mac_link_sta_add() fails after
WCID setup.

The add path can fail after dev->mt76.wcid[] is published, so the error
path must clear the partial host-side WCID state to avoid leaving stale
entries behind.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-15-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: make WCID cleanup unconditional in sta_remove_links()
Sean Wang [Fri, 6 Mar 2026 23:22:32 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: make WCID cleanup unconditional in sta_remove_links()

Drop the dead pri_link check in mt7925_mac_sta_remove_links() and
perform WCID cleanup unconditionally.

mlink->pri_link is already cleared before the test, making the branch
ineffective. This matches the actual teardown behaviour and simplifies
the remove path.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-14-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mconf and mlink to wtbl_update_hdr_trans()
Sean Wang [Fri, 6 Mar 2026 23:22:31 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mconf and mlink to wtbl_update_hdr_trans()

Drop the mt792x_vif_to_link() lookup in mt7925_mcu_wtbl_update_hdr_trans()
and pass the resolved mconf and mlink from the caller instead. The link
context is already known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes link ownership explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-13-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: resolve link after acquiring mt76 mutex
Sean Wang [Fri, 6 Mar 2026 23:22:30 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: resolve link after acquiring mt76 mutex

mt792x_sta_to_link() uses rcu_dereference_protected() and therefore
expects mt76.mutex to be held. Move the lookup after
mt792x_mutex_acquire() to make the locking explicit and correct.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-12-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink to set_link_key()
Sean Wang [Fri, 6 Mar 2026 23:22:29 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink to set_link_key()

Drop the mt792x_sta_to_link() lookup in mt7925_set_link_key() and pass
the resolved mlink from the caller instead. The link context is already
known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes link ownership explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-11-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink to wtbl_update_hdr_trans()
Sean Wang [Fri, 6 Mar 2026 23:22:28 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink to wtbl_update_hdr_trans()

Drop the mt792x_sta_to_link() lookup in mt7925_mcu_wtbl_update_hdr_trans()
and pass the resolved mlink from the caller instead. The link context is
already known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes link ownership explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-10-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: validate mlink in sta_hdr_trans_tlv()
Sean Wang [Fri, 6 Mar 2026 23:22:27 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: validate mlink in sta_hdr_trans_tlv()

Replace the dead wcid NULL check in mt7925_mcu_sta_hdr_trans_tlv() with
a WARN_ON_ONCE() guard on mlink before dereferencing mlink->wcid.

wcid is always derived from mlink, so mlink is the only meaningful
object to validate here.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-9-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink to sta_hdr_trans_tlv()
Sean Wang [Fri, 6 Mar 2026 23:22:26 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink to sta_hdr_trans_tlv()

Drop the mt792x_sta_to_link() lookup in mt7925_mcu_sta_hdr_trans_tlv()
and pass the resolved mlink from the caller instead. The link is
already known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes WCID selection explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-8-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink to mac_link_sta_remove()
Sean Wang [Fri, 6 Mar 2026 23:22:25 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink to mac_link_sta_remove()

Drop the mt792x_sta_to_link() lookup in mt7925_mac_link_sta_remove()
and pass mlink from mt7925_mac_sta_remove_links() instead. The link is
already resolved there, making the extra lookup redundant.

This keeps the remove helper lookup-free and avoids hidden dependence on
msta->link[link_id] during teardown.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-7-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: resolve primary mlink via def_wcid
Sean Wang [Fri, 6 Mar 2026 23:22:24 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: resolve primary mlink via def_wcid

Use mlink->wcid.def_wcid to obtain the primary mlink in
mt7925_mac_link_sta_add() instead of calling mt792x_sta_to_link().

The primary link context is already carried by the WCID, so the extra
lookup is redundant. This makes the add path follow the existing WCID
association directly.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-6-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink to mcu_sta_update()
Sean Wang [Fri, 6 Mar 2026 23:22:23 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink to mcu_sta_update()

Drop the mt792x_sta_to_link() lookup in mt7925_mcu_sta_update() and
pass the resolved mlink from the caller instead. The link context is
already known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes WCID selection explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-5-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink and mconf to sta_mld_tlv()
Sean Wang [Fri, 6 Mar 2026 23:22:22 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink and mconf to sta_mld_tlv()

Drop the mt792x_sta_to_link() lookup in mt7925_mcu_sta_mld_tlv() and
pass mlink and mconf from the caller instead. The link context is
already known at the call site, making the lookup redundant.

This keeps the helper lookup-free and makes MLD link selection
explicit.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-4-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass WCID indices to bss_basic_tlv()
Sean Wang [Fri, 6 Mar 2026 23:22:21 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass WCID indices to bss_basic_tlv()

Drop the mt792x_sta_to_link() lookup in mt7925_mcu_bss_basic_tlv() and
pass the resolved WCID indices from the caller instead. The link
context is already known, so the lookup is redundant.

This makes link ownership explicit and keeps the helper lookup-free.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-3-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: pass mlink to sta_amsdu_tlv()
Sean Wang [Fri, 6 Mar 2026 23:22:20 +0000 (17:22 -0600)] 
wifi: mt76: mt7925: pass mlink to sta_amsdu_tlv()

Drop the mt792x_sta_to_link() lookup in mt7925_mcu_sta_amsdu_tlv() and
pass mlink from the caller instead. The link context is already known
so the lookup is redundant.

This makes link ownership explicit and keeps the helper lookup-free.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-2-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix issues with manually triggered radar detection
StanleyYP Wang [Thu, 12 Mar 2026 09:57:24 +0000 (17:57 +0800)] 
wifi: mt76: mt7996: fix issues with manually triggered radar detection

Disallow triggering radar detection on non-DFS channels to prevent paused
TX queues from failing to resume, as a channel switch is not performed in
this case.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260312095724.2117448-6-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: adjust timeout value for boot-up calibration commands
Rex Lu [Thu, 12 Mar 2026 09:57:22 +0000 (17:57 +0800)] 
wifi: mt76: mt7996: adjust timeout value for boot-up calibration commands

Align the vendor driver by adjusting the timeout values for the
MCU_UNI_CMD_EFUSE_CTRL and MCU_UNI_CMD_EXT_EEPROM_CTRL commands.
Without this adjustment, false positive command timeout errors may occur,
especially on some iPA variants.

Signed-off-by: Rex Lu <rex.lu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260312095724.2117448-4-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: update WFSYS reset flow for MT7990 chipsets
Peter Chiu [Thu, 12 Mar 2026 09:57:21 +0000 (17:57 +0800)] 
wifi: mt76: mt7996: update WFSYS reset flow for MT7990 chipsets

Skip WFSYS reset during bootup for MT7990 chipsets; only reset if L0.5
recovery is triggered.
Without this fix, the following kernel error may occur:
Internal error: synchronous external abort.

Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260312095724.2117448-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: support critical packet mode for MT7990 chipsets
Howard Hsu [Thu, 12 Mar 2026 09:57:20 +0000 (17:57 +0800)] 
wifi: mt76: mt7996: support critical packet mode for MT7990 chipsets

For MT7990 chipsets, critical packet mode must be enabled. Without this,
some higher priority packets may be placed in the wrong AC queue.

Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260312095724.2117448-2-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix RRO EMU configuration
Peter Chiu [Thu, 12 Mar 2026 09:57:19 +0000 (17:57 +0800)] 
wifi: mt76: mt7996: fix RRO EMU configuration

Use the correct helper to update specific bitfields instead of
overwriting the entire register.

Fixes: eedb427eb260 ("wifi: mt76: mt7996: Enable HW RRO for MT7992 chipset")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260312095724.2117448-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt792x: fix mt7925u USB WFSYS reset handling
Sean Wang [Wed, 11 Mar 2026 00:28:25 +0000 (19:28 -0500)] 
wifi: mt76: mt792x: fix mt7925u USB WFSYS reset handling

mt7925u uses different reset/status registers from mt7921u. Reusing the
mt7921u register set causes the WFSYS reset to fail.

Add a chip-specific descriptor in mt792xu_wfsys_reset() to select the
correct registers and fix mt7925u failing to initialize after a warm
reboot.

Fixes: d28e1a48952e ("wifi: mt76: mt792x: introduce mt792x-usb module")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260311002825.15502-2-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt792x: describe USB WFSYS reset with a descriptor
Sean Wang [Wed, 11 Mar 2026 00:28:24 +0000 (19:28 -0500)] 
wifi: mt76: mt792x: describe USB WFSYS reset with a descriptor

Prepare mt792xu_wfsys_reset() for chips that share the same USB WFSYS
reset flow but use different register definitions.

This is a pure refactor of the current mt7921u path and keeps the reset
sequence unchanged.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260311002825.15502-1-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: add per-link beacon monitoring for MLO
Felix Fietkau [Mon, 9 Mar 2026 06:07:30 +0000 (06:07 +0000)] 
wifi: mt76: add per-link beacon monitoring for MLO

With chanctx drivers using hardware scan or remain-on-channel,
mac80211 does not know when the radio goes off-channel, which breaks
its software beacon loss detection.

Implement per-link beacon monitoring in the driver. Track the last
beacon timestamp per link and check for beacon loss periodically from
the mac_work handler.

Beacon monitoring is initialized on association and on late link
activation, and cleared on disassociation. The beacon_mon_last
timestamp is reset when returning from offchannel and after channel
switches to prevent false beacon loss detection.

Link: https://patch.msgid.link/20260309060730.87840-11-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: wait for firmware TX completion of mgmt frames before channel switch
Felix Fietkau [Mon, 9 Mar 2026 06:07:29 +0000 (06:07 +0000)] 
wifi: mt76: wait for firmware TX completion of mgmt frames before channel switch

After flushing software-pending frames to DMA, mt76_has_tx_pending()
only checks DMA ring q->queued. For token-based drivers, q->queued is
decremented at DMA consumption, but firmware may not have transmitted
the frame yet. Waiting for all tokens is not feasible because data
frames may be stuck in firmware powersave/aggregation queues.

Track PSD queue tokens (firmware ALTX) per phy using an atomic counter.
These frames are sent by firmware immediately without PS buffering, so
the counter reliably reaches zero after transmission.

Increment the counter in mt76_token_consume() and decrement it in
mt76_token_release(), only for PSD queue tokens. Include the counter
in mt76_has_tx_pending() so channel switch waits for firmware TX
completion of management and nullfunc frames.

mt7615 (uses mt76_token_get/put) and non-token drivers are unaffected
as they never call mt76_token_consume/release.

Link: https://patch.msgid.link/20260309060730.87840-10-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: route nullfunc frames to PSD/ALTX queue
Felix Fietkau [Mon, 9 Mar 2026 06:07:28 +0000 (06:07 +0000)] 
wifi: mt76: route nullfunc frames to PSD/ALTX queue

ieee80211_is_data() returns true for nullfunc/QoS-nullfunc frames, so
they bypass the PSD queue routing and go through the regular VO data
queue. This means firmware processes them through the normal TID queue
instead of the ALTX queue, which doesn't guarantee immediate
transmission.

Use ieee80211_is_data_present() instead, which returns false for both
management frames and nullfunc/QoS-nullfunc (no payload), routing them
to MT_TXQ_PSD. Firmware maps PSD to the ALTX queue, which transmits
immediately without PS buffering.

This only affects frames from the mt76_tx() pending path. Regular
mac80211 TXQ scheduling is unchanged.

Link: https://patch.msgid.link/20260309060730.87840-9-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: flush pending TX before channel switch
Felix Fietkau [Mon, 9 Mar 2026 06:07:27 +0000 (06:07 +0000)] 
wifi: mt76: flush pending TX before channel switch

mt76_tx() queues frames on wcid->tx_pending for async processing by
tx_worker. In __mt76_set_channel(), the worker gets disabled before it
may have run, and the subsequent wait only checks DMA ring queues, not
the software pending list. This means frames like nullfunc PS frames
from mt76_offchannel_notify() may never be transmitted on the correct
channel.

Fix this by running mt76_txq_schedule_pending() synchronously after
disabling the tx_worker but before setting MT76_RESET, which would
otherwise cause mt76_txq_schedule_pending_wcid() to bail out.

Link: https://patch.msgid.link/20260309060730.87840-8-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: send nullfunc PS frames on offchannel transitions
Felix Fietkau [Mon, 9 Mar 2026 06:07:26 +0000 (06:07 +0000)] 
wifi: mt76: send nullfunc PS frames on offchannel transitions

Since mt76 uses chanctx, mac80211 does not send nullfunc power save
notifications when the driver goes offchannel for scan or ROC.
Add mt76_offchannel_notify() to send nullfunc PM=1 before going
offchannel and PM=0 after returning, so that the AP can buffer
frames during the absence.

For MLO, iterate all vif links on the phy and set
IEEE80211_TX_CTRL_MLO_LINK so that the driver's tx_prepare_skb
resolves the correct per-link wcid.

Link: https://patch.msgid.link/20260309060730.87840-7-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: optimize ROC for same-channel case
Felix Fietkau [Mon, 9 Mar 2026 06:07:25 +0000 (06:07 +0000)] 
wifi: mt76: optimize ROC for same-channel case

mt76_remain_on_channel() always creates an HT20 chandef and goes
offchannel, even when the ROC channel matches the operating channel.
This unnecessarily narrows bandwidth and triggers beacon stop/restart.

When the ROC channel matches the current operating channel, preserve
the full chandef and skip the offchannel transition, matching the
optimization already present in the scan code.

Extract the shared same-channel detection into mt76_offchannel_chandef()
and use it in both ROC and scan paths.

Link: https://patch.msgid.link/20260309060730.87840-6-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: abort ROC on chanctx changes
Felix Fietkau [Mon, 9 Mar 2026 06:07:24 +0000 (06:07 +0000)] 
wifi: mt76: abort ROC on chanctx changes

mt76_change_chanctx() calls mt76_phy_update_channel() which switches
the hardware channel. If ROC is active on the same phy, this switches
away from the ROC channel and clears offchannel, but leaves ROC state
intact. Mac80211 still thinks the phy is on the ROC channel.

Abort any active ROC before proceeding, matching the pattern already
used in add, remove, assign, unassign, and switch chanctx functions.

Link: https://patch.msgid.link/20260309060730.87840-5-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: check chanctx before restoring channel after ROC
Felix Fietkau [Mon, 9 Mar 2026 06:07:23 +0000 (06:07 +0000)] 
wifi: mt76: check chanctx before restoring channel after ROC

mt76_remove_chanctx() sets phy->chanctx to NULL but does not clear
phy->main_chandef. If ROC is later performed on that phy, completion
tries to restore the stale main_chandef channel, programming the
hardware to sit on a channel with no active context.

Add a chanctx check to avoid restoring a channel when no context is
active.

Link: https://patch.msgid.link/20260309060730.87840-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: add offchannel check to mt76_roc_complete
Felix Fietkau [Mon, 9 Mar 2026 06:07:22 +0000 (06:07 +0000)] 
wifi: mt76: add offchannel check to mt76_roc_complete

mt76_roc_complete() unconditionally calls __mt76_set_channel() to
restore the operating channel. The scan equivalent mt76_scan_complete()
checks phy->offchannel first, skipping the restore if the phy is
already back on-channel.

Without this check, ROC completion performs a redundant full hardware
channel switch when something has already moved the phy back.

Link: https://patch.msgid.link/20260309060730.87840-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: support upgrading passive scans to active
Chad Monroe [Mon, 9 Mar 2026 06:07:21 +0000 (06:07 +0000)] 
wifi: mt76: support upgrading passive scans to active

On channels with NO_IR or RADAR flags, wait for beacon before sending
probe requests. Allows active scanning and WPS on restricted channels
if another AP is already present.

Fixes: c56d6edebc1f ("wifi: mt76: mt7996: use emulated hardware scan support")
Tested-by: Piotr Kubik <piotr.kubik@adtran.com>
Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://patch.msgid.link/20251118102723.47997-2-nbd@nbd.name
Link: https://patch.msgid.link/20260309060730.87840-2-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: fix multi-radio on-channel scanning
Chad Monroe [Mon, 9 Mar 2026 06:07:20 +0000 (06:07 +0000)] 
wifi: mt76: fix multi-radio on-channel scanning

avoid unnecessary channel switch when performing an on-channel scan
using a multi-radio device.

Fixes: c56d6edebc1f ("wifi: mt76: mt7996: use emulated hardware scan support")
Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://patch.msgid.link/20251118102723.47997-1-nbd@nbd.name
Link: https://patch.msgid.link/20260309060730.87840-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Decrement sta counter removing the link in mt7996_mac_reset_sta_i...
Lorenzo Bianconi [Sun, 8 Mar 2026 13:25:20 +0000 (14:25 +0100)] 
wifi: mt76: mt7996: Decrement sta counter removing the link in mt7996_mac_reset_sta_iter()

Fixes tracking per-phy stations for offchannel switching.

Fixes: ace5d3b6b49e8 ("wifi: mt76: mt7996: improve hardware restart reliability")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260308-mt7996_mac_reset_vif_iter-fix-v1-1-57f640aa2dcf@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Remove unnecessary phy filed in mt7996_vif_link struct
Lorenzo Bianconi [Fri, 6 Mar 2026 10:27:55 +0000 (11:27 +0100)] 
wifi: mt76: mt7996: Remove unnecessary phy filed in mt7996_vif_link struct

Remove unnecessary phy pointer in mt7996_vif_link struct and rely on
mt7996_vif_link_phy() utility routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260306-mt7996-deflink-lookup-link-remove-v1-4-7162b332873c@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Remove link pointer dependency in mt7996_mac_sta_remove_links()
Lorenzo Bianconi [Fri, 6 Mar 2026 10:27:52 +0000 (11:27 +0100)] 
wifi: mt76: mt7996: Remove link pointer dependency in mt7996_mac_sta_remove_links()

Remove link pointer dependency in mt7996_mac_sta_remove_links routine to
get the mt7996_phy pointer since the link can be already offchannel
running mt7996_mac_sta_remove_links(). Rely on __mt7996_phy routine
instead.

Fixes: 344dd6a4c919 ("wifi: mt76: mt7996: Move num_sta accounting in mt7996_mac_sta_{add,remove}_links")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260306-mt7996-deflink-lookup-link-remove-v1-1-7162b332873c@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Add missing CHANCTX_STA_CSA property
Lorenzo Bianconi [Sun, 28 Sep 2025 16:27:01 +0000 (18:27 +0200)] 
wifi: mt76: mt7996: Add missing CHANCTX_STA_CSA property

Enable missing CHANCTX_STA_CSA property required for MLO.

Fixes: f5160304d57c ("wifi: mt76: mt7996: Enable MLO support for client interfaces")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20250928-mt7996_chanctx_sta_csa-v1-1-82e455185990@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7925: fix incorrect TLV length in CLC command
Quan Zhou [Wed, 25 Feb 2026 09:47:22 +0000 (17:47 +0800)] 
wifi: mt76: mt7925: fix incorrect TLV length in CLC command

The previous implementation of __mt7925_mcu_set_clc() set the TLV length
field (.len) incorrectly during CLC command construction. The length was
initialized as sizeof(req) - 4, regardless of the actual segment length.
This could cause the WiFi firmware to misinterpret the command payload,
resulting in command execution errors.

This patch moves the TLV length assignment to after the segment is
selected, and sets .len to sizeof(req) + seg->len - 4, matching the
actual command content. This ensures the firmware receives the
correct TLV length and parses the command properly.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Cc: stable@vger.kernel.org
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/f56ae0e705774dfa8aab3b99e5bbdc92cd93523e.1772011204.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: add missing lock protection in mt76_sta_state for sta_event callback
Ziyi Guo [Sat, 31 Jan 2026 03:52:10 +0000 (03:52 +0000)] 
wifi: mt76: add missing lock protection in mt76_sta_state for sta_event callback

mt76_sta_state() calls the sta_event callback without holding dev->mutex.
However, mt7915_mac_sta_event() (MT7915 implementation of this callback)
calls mt7915_mac_twt_teardown_flow() which has
lockdep_assert_held(&dev->mt76.mutex) indicating that callers must
hold this lock.

The locking pattern in mt76_sta_state() is inconsistent:
- mt76_sta_add() acquires dev->mutex before calling dev->drv->sta_add
- mt76_sta_remove() acquires dev->mutex before calling __mt76_sta_remove
- But sta_event callback is called without acquiring the lock

Add mutex_lock()/mutex_unlock() around the mt7915_mac_twt_teardown_flow
invocation to fix the missing lock protection and maintain consistency
with the existing locking pattern.

Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
Link: https://patch.msgid.link/20260131035210.2198259-1-n7l8m4@u.northwestern.edu
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: fix 6GHz regulatory update on connection
Michael Lo [Wed, 11 Feb 2026 09:50:25 +0000 (17:50 +0800)] 
wifi: mt76: mt7921: fix 6GHz regulatory update on connection

Call mt7921_regd_update() instead of mt7921_mcu_set_clc() when setting
the 6GHz power type after connection, so that regulatory limits and SAR
power are also applied.

Fixes: 51ba0e3a15eb ("wifi: mt76: mt7921: add 6GHz power type support for clc")
Signed-off-by: Michael Lo <michael.lo@mediatek.com>
Link: https://patch.msgid.link/20260211095025.2415624-1-leon.yen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Disable Rx hdr_trans in monitor mode
Ryder Lee [Fri, 13 Feb 2026 08:00:29 +0000 (00:00 -0800)] 
wifi: mt76: mt7996: Disable Rx hdr_trans in monitor mode

Ensure raw frames are captured without header modification.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://patch.msgid.link/04008426d6cd5de3995beefb98f9d13f35526c25.1770969275.git.ryder.lee@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: Add eMLSR support
MeiChia Chiu [Tue, 3 Feb 2026 08:32:02 +0000 (09:32 +0100)] 
wifi: mt76: mt7996: Add eMLSR support

Implement set_eml_op_mode mac80211 callback in order to introduce eMLSR
support.

Tested-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260203-mt7996-emlsr-v1-1-38ffb3d5110c@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix use-after-free bugs in mt7996_mac_dump_work()
Duoming Zhou [Sat, 31 Jan 2026 02:47:31 +0000 (10:47 +0800)] 
wifi: mt76: mt7996: fix use-after-free bugs in mt7996_mac_dump_work()

When the mt7996 pci chip is detaching, the mt7996_crash_data is
released in mt7996_coredump_unregister(). However, the work item
dump_work may still be running or pending, leading to UAF bugs
when the already freed crash_data is dereferenced again in
mt7996_mac_dump_work().

The race condition can occur as follows:

CPU 0 (removal path)               | CPU 1 (workqueue)
mt7996_pci_remove()                | mt7996_sys_recovery_set()
 mt7996_unregister_device()        |  mt7996_reset()
  mt7996_coredump_unregister()     |   queue_work()
   vfree(dev->coredump.crash_data) | mt7996_mac_dump_work()
                                   |  crash_data-> // UAF

Fix this by ensuring dump_work is properly canceled before
the crash_data is deallocated. Add cancel_work_sync() in
mt7996_unregister_device() to synchronize with any pending
or executing dump work.

Fixes: 878161d5d4a4 ("wifi: mt76: mt7996: enable coredump support")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://patch.msgid.link/20260131024731.18741-1-duoming@zju.edu.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7915: fix use-after-free bugs in mt7915_mac_dump_work()
Duoming Zhou [Fri, 30 Jan 2026 14:57:59 +0000 (22:57 +0800)] 
wifi: mt76: mt7915: fix use-after-free bugs in mt7915_mac_dump_work()

When the mt7915 pci chip is detaching, the mt7915_crash_data is
released in mt7915_coredump_unregister(). However, the work item
dump_work may still be running or pending, leading to UAF bugs
when the already freed crash_data is dereferenced again in
mt7915_mac_dump_work().

The race condition can occur as follows:

CPU 0 (removal path)               | CPU 1 (workqueue)
mt7915_pci_remove()                | mt7915_sys_recovery_set()
 mt7915_unregister_device()        |  mt7915_reset()
  mt7915_coredump_unregister()     |   queue_work()
   vfree(dev->coredump.crash_data) | mt7915_mac_dump_work()
                                   |  crash_data-> // UAF

Fix this by ensuring dump_work is properly canceled before
the crash_data is deallocated. Add cancel_work_sync() in
mt7915_unregister_device() to synchronize with any pending
or executing dump work.

Fixes: 4dbcb9125cc3 ("wifi: mt76: mt7915: enable coredump support")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://patch.msgid.link/20260130145759.84272-1-duoming@zju.edu.cn
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: don't return TXQ when exceeding max non-AQL packets
David Bauer [Thu, 29 Jan 2026 23:23:20 +0000 (00:23 +0100)] 
wifi: mt76: don't return TXQ when exceeding max non-AQL packets

mt76_txq_send_burst does check if the number of non-AQL frames exceeds
the maximum. In this case the queue is returned to ieee80211_return_txq
when iterating over the scheduled TXQs in mt76_txq_schedule_list.

This has the effect of inserting said TXQ at the head of the list. This
means the loop will get the same TXQ again, which will terminate the
scheduling round. TXQs following in the list thus never get scheduled
for transmission.

This can manifest in high latency low throughput or broken connections
for said STAs.

Check if the non-AQL packet count exceeds the limit and not return the
TXQ in this case.
Schedule all TXQs for the STA in case the non-AQL limit can be satisfied
again.

Signed-off-by: David Bauer <mail@david-bauer.net>
Link: https://patch.msgid.link/20260129232321.276575-1-mail@david-bauer.net
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix queue pause after scan due to wrong channel switch reason
StanleyYP Wang [Tue, 3 Feb 2026 15:55:32 +0000 (23:55 +0800)] 
wifi: mt76: mt7996: fix queue pause after scan due to wrong channel switch reason

Previously, we used the IEEE80211_CONF_IDLE flag to avoid setting the
parking channel with the CH_SWITCH_NORMAL reason, which could trigger TX
emission before bootup CAC.

However, we found that this flag can be set after triggering scanning on a
connected station interface, and the reason CH_SWITCH_SCAN_BYPASS_DPD will
be used when switching back to the operating channel, which makes the
firmware failed to resume paused AC queues.

Seems that we should avoid relying on this flag after switching to single
multi-radio architecture. Instead, use the existence of chanctx as the
condition.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260203155532.1098290-4-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: avoid to set ACK for MCU command if wait_resp is not set
StanleyYP Wang [Tue, 3 Feb 2026 15:55:31 +0000 (23:55 +0800)] 
wifi: mt76: avoid to set ACK for MCU command if wait_resp is not set

When wait_resp is not set but the ACK option is enabled in the MCU TXD,
the ACK event is enqueued to the MCU event queue without being dequeued
by the original MCU command request.

Any orphaned ACK events will only be removed from the queue when another
MCU command requests a response. Due to sequence index mismatches, these
events are discarded one by one until a matching sequence index is found.

However, if several MCU commands that do not require a response continue
to fill up the event queue, there is a risk that when an MCU command with
wait_resp enabled is issued, it may dequeue the wrong event skb,
especially if the queue contains events with all possible sequence
indices.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260203155532.1098290-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix struct mt7996_mcu_uni_event
StanleyYP Wang [Tue, 3 Feb 2026 15:55:30 +0000 (23:55 +0800)] 
wifi: mt76: mt7996: fix struct mt7996_mcu_uni_event

The cid field is defined as a two-byte value in the firmware.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260203155532.1098290-2-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: fix wrong DMAD length when using MAC TXP
Shayne Chen [Tue, 3 Feb 2026 15:55:29 +0000 (23:55 +0800)] 
wifi: mt76: mt7996: fix wrong DMAD length when using MAC TXP

The struct mt76_connac_fw_txp is used for HIF TXP. Change to use the
struct mt76_connac_hw_txp to fix the wrong DMAD length for MAC TXP.

Fixes: cb6ebbdffef2 ("wifi: mt76: mt7996: support writing MAC TXD for AddBA Request")
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260203155532.1098290-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: add MT7902 SDIO device support
Sean Wang [Thu, 19 Feb 2026 00:40:07 +0000 (18:40 -0600)] 
wifi: mt76: mt7921: add MT7902 SDIO device support

Register the MT7902 SDIO device ID in the mt7921 driver and add its
corresponding firmware and ROM patch names.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-11-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: add MT7902 PCIe device support
Sean Wang [Thu, 19 Feb 2026 00:40:06 +0000 (18:40 -0600)] 
wifi: mt76: mt7921: add MT7902 PCIe device support

Register the MT7902 PCI device ID in the mt7921 driver and add its
corresponding firmware and ROM patch names.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-10-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt792x: add MT7902 WFDMA prefetch configuration
Sean Wang [Thu, 19 Feb 2026 00:40:05 +0000 (18:40 -0600)] 
wifi: mt76: mt792x: add MT7902 WFDMA prefetch configuration

Configure the RX/TX ring prefetch setting for MT7902 PCIe device.

This is a prerequisite patch before enabling MT7902 PCIe support.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-9-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: add MT7902 MCU support
Sean Wang [Thu, 19 Feb 2026 00:40:04 +0000 (18:40 -0600)] 
wifi: mt76: mt7921: add MT7902 MCU support

Add MCU support for the MT7902 chipset.

runtime pm is not yet supported by the driver, but normal mac80211
operation is unaffected.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-8-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt792x: ensure MCU ready before ROM patch download
Sean Wang [Thu, 19 Feb 2026 00:40:03 +0000 (18:40 -0600)] 
wifi: mt76: mt792x: ensure MCU ready before ROM patch download

Restart the MCU and poll FW state to ensure correct MCU status
before downloading the ROM patch.

This is a prerequisite for enabling MT7902 PCIe and has been
validated on MT7921 and MT7925 since they share the common code path.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-7-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt792x: add PSE handling barrier for the large MCU cmd
Sean Wang [Thu, 19 Feb 2026 00:40:02 +0000 (18:40 -0600)] 
wifi: mt76: mt792x: add PSE handling barrier for the large MCU cmd

Add a dummy register read in mt76_connac_mcu_rate_txpower_band() to act as
a PSE barrier. This would release PSE pages and prevents buffer underflow
issues when handling MCU commands with larger payloads without the response
in mt76_connac_mcu_set_rate_txpower().

This is a prerequisite patch before enabling MT7902 PCIe and SDIO support.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-6-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: connac: mark MT7902 as hw txp devices
Sean Wang [Thu, 19 Feb 2026 00:40:01 +0000 (18:40 -0600)] 
wifi: mt76: connac: mark MT7902 as hw txp devices

Add MT7902 to is_mt76_fw_txp() so it follows the legacy TX descriptor
path like the other connac2 chips that return false.

This is a prerequisite patch before enabling MT7902 pcie support.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-5-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: add MT7902e DMA layout support
Sean Wang [Thu, 19 Feb 2026 00:40:00 +0000 (18:40 -0600)] 
wifi: mt76: mt7921: add MT7902e DMA layout support

Add MT7902 PCIe specific DMA layout overrides for MCU TXQ index, RX ring
size, and MCU_WA usage. Common layout remains the default for other chips.

This is a prerequisite patch before enabling MT7902 PCIe support.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-4-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: handle MT7902 irq_map quirk with mutable copy
Sean Wang [Thu, 19 Feb 2026 00:39:59 +0000 (18:39 -0600)] 
wifi: mt76: mt7921: handle MT7902 irq_map quirk with mutable copy

MT7902 PCIe requires a different wm2_complete_mask value, so introduce a
mutable per-device copy of the default irq_map and override the field
only for this chip. Other devices continue using the shared const
template.

This is a prerequisite patch before enabling MT7902 PCIe support.

Co-developed-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Xiong Huang <xiong.huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-3-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: use mt76_for_each_q_rx() in reset path
Sean Wang [Thu, 19 Feb 2026 00:39:58 +0000 (18:39 -0600)] 
wifi: mt76: mt7921: use mt76_for_each_q_rx() in reset path

Replace explicit napi_disable() calls for RX queues with
mt76_for_each_q_rx() in mt7921e_mac_reset().

This removes hardcoded queue indices and disables all configured
RX queues during reset.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-2-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: connac: use is_connac2() to replace is_mt7921() checks
Sean Wang [Thu, 19 Feb 2026 00:39:57 +0000 (18:39 -0600)] 
wifi: mt76: connac: use is_connac2() to replace is_mt7921() checks

Unify all per-chip conditionals under the new is_connac2() helper. This
avoids confusion caused by the previous is_mt7921() check, which
implicitly covered multiple connac2 chipsets and no longer reflected its
actual scope. This is a clean-up only change with no functional impact.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260219004007.19733-1-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: apply calibration-free data from OTP
StanleyYP Wang [Thu, 12 Feb 2026 09:03:10 +0000 (17:03 +0800)] 
wifi: mt76: mt7996: apply calibration-free data from OTP

Before sending the current EEPROM data to the firmware, read the
calibration-free data (FT data) from the efuse and merge it with
the existing EEPROM data.

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Link: https://patch.msgid.link/20260212090310.3335392-3-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: add variant for MT7992 chipsets
Shayne Chen [Thu, 12 Feb 2026 09:03:09 +0000 (17:03 +0800)] 
wifi: mt76: mt7996: add variant for MT7992 chipsets

Introduce VAR_TYPE_24 for the MT7992 chipsets, a dual-band variant
supporting 3T3R/2SS on the 2 GHz band and 5T5R/4SS on the 5GHz band.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20260212090310.3335392-2-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: add external EEPROM support for mt799x chipsets
StanleyYP Wang [Thu, 12 Feb 2026 09:03:08 +0000 (17:03 +0800)] 
wifi: mt76: add external EEPROM support for mt799x chipsets

For the MT7992 and MT7990 chipsets, efuse mode is not supported because
there is insufficient space in the efuse to store the calibration data.
Therefore, an additional on-chip EEPROM is added to address this
limitation.

Co-developed-by: Elwin Huang <s09289728096@gmail.com>
Signed-off-by: Elwin Huang <s09289728096@gmail.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Link: https://patch.msgid.link/20260212090310.3335392-1-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: b43: kzalloc + kcalloc to kzalloc_flex
Rosen Penev [Wed, 11 Mar 2026 00:47:36 +0000 (17:47 -0700)] 
wifi: b43: kzalloc + kcalloc to kzalloc_flex

Simplifies allocation and allows using __counted_by for extra runtime
analysis.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260311004736.32730-1-rosenp@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mac80211: don't consider the sband when processing capabilities
Miri Korenblit [Fri, 20 Mar 2026 12:15:32 +0000 (14:15 +0200)] 
wifi: mac80211: don't consider the sband when processing capabilities

In NAN, we have one set of (HT, VHT, HE) capabilities for all bands,
which means that we will need to process those capabilities without a
given sband.

To prepare for that, remove the sband argument from
ieee80211_ht_cap_ie_to_sta_ht_cap and ieee80211_he_cap_ie_to_sta_he_cap
and pass our own capabilities instead.

For ieee80211_vht_cap_ie_to_sta_vht_cap, make the sband argument
optional, since it is also used to check if there is at least one channel
that supports 80 MHz.
(Note that this check doesn't make much sense, but this can be handled in
 a different patch.)

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320141504.e42ef1f0eabb.If994d6346f00219437e22043e7bf2395b827b34a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mac80211: properly handle error in ieee80211_add_virtual_monitor
Miri Korenblit [Fri, 20 Mar 2026 12:13:46 +0000 (14:13 +0200)] 
wifi: mac80211: properly handle error in ieee80211_add_virtual_monitor

In case of an error in ieee80211_add_virtual_monitor,
SDATA_STATE_RUNNING should be cleared as it was set in this function.
Do it there instead of in the error path of ieee80211_do_open.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320141312.5546126313b1.I689dba2f54069b259702e8d246cedf79a73b82c6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: cfg80211: support UNII-9 channels in ieee80211_channel_to_freq_khz
Emmanuel Grumbach [Fri, 20 Mar 2026 08:20:40 +0000 (10:20 +0200)] 
wifi: cfg80211: support UNII-9 channels in ieee80211_channel_to_freq_khz

Devices that support UNII-9 will call ieee80211_channel_to_freq_khz
with a channel number that can go up to 253.
Allow the new channel numbers in ieee80211_channel_to_freq_khz.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320102034.efcb7ea1de3c.Ifa4b75a24466de2a1d5707181c9c487618236e4b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mac80211: make ieee80211_find_chanctx link-unaware
Miri Korenblit [Fri, 20 Mar 2026 08:19:59 +0000 (10:19 +0200)] 
wifi: mac80211: make ieee80211_find_chanctx link-unaware

Currently we have only one user for a channel context: the link.
With NAN, a new type of the channel context user will be added - the NAN
channel.
To prepare for this, we need to separate the channel context code from
the link code.

Removes the link argument from ieee80211_find_chanctx. Since the issue that led
to commit 5e0c422d12b5 ("wifi: mac80211: reserve chanctx during find") - that
added the link argument - is relevant for any user of the channel context, add
a boolean to the chanctx itself, indicating that the chanctx is in the process
of getting used.

When this indication is set, the reference count of the channel context
will be incremented by one, so even if it is getting released from a link
(or another user) it won't be freed.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320101954.232499e2a41f.I0b735a607e1ec7aa5749ab01c794ef99dbe82b7f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mac80211_hwsim: advertise basic UHR support
Johannes Berg [Fri, 20 Mar 2026 08:16:28 +0000 (10:16 +0200)] 
wifi: mac80211_hwsim: advertise basic UHR support

Just add support for ELR, and nothing else since the spec
isn't really all that well-specified yet.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320101624.77af6463920e.I257e525a461c350bed87cfaefc52de25e37afcfb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mac80211: use for_each_chanctx_user_* in one more place
Miri Korenblit [Fri, 20 Mar 2026 08:16:01 +0000 (10:16 +0200)] 
wifi: mac80211: use for_each_chanctx_user_* in one more place

for_each_chanctx_user_* is an iterator that visits all types of chanctx
users, including the (to be added) NAN channels, and not only the link.

ieee80211_get_chanctx_max_required_bw wasn't changed to use this new
iterator, do it now.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320101556.4691916c7877.I9660f3945f4dccdb6d41a06ec4e74161e5ac65a4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: cfg80211: Add support for additional 7 GHz channels
Ilan Peer [Mon, 23 Mar 2026 21:02:50 +0000 (23:02 +0200)] 
wifi: cfg80211: Add support for additional 7 GHz channels

Add support for channels 237, 241, 245, 249, 253 and support
for additional 320 MHz segment.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260323230242.072942e8e55a.I20eba7b534c6402d5e55f862865ff1e6fef64d83@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mac80211: Replace strncpy() with strscpy_pad() in drv_switch_vif_chanctx tracepoint
Kees Cook [Mon, 23 Mar 2026 17:20:16 +0000 (10:20 -0700)] 
wifi: mac80211: Replace strncpy() with strscpy_pad() in drv_switch_vif_chanctx tracepoint

Replace the deprecated[1] strncpy() with strscpy_pad() for copying the
interface name into a tracepoint entry.

The source "sdata->name" is a NUL-terminated char[IFNAMSIZ] buffer
populated via NUL-guaranteeing paths: strscpy() in ieee80211_if_add(),
snprintf() in ieee80211_add_virtual_monitor(), or memcpy() from
ndev->name in ieee80211_if_add() and netdev_notify()
(net/mac80211/iface.c). In the memcpy() cases, the source ndev->name
is itself always NUL-terminated (populated via snprintf() or strscpy()
in __dev_alloc_name() and dev_prep_valid_name() in net/core/dev.c).

The destination "local_vifs[i].vif.vif_name" is a char[IFNAMSIZ] field
in struct trace_vif_entry, stored in a __dynamic_array within the trace
ring buffer. Since ring buffer entries are not zeroed on allocation,
strscpy_pad() is used to zero-fill trailing bytes and prevent exposing
stale ring buffer contents to userspace readers of tracefs.

No behavioral change: since interface names are always at most 15
characters plus a NUL terminator, strscpy_pad() with size IFNAMSIZ (16)
produces identical output to the original strncpy().

Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20260323172015.work.146-kees@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agoMerge tag 'ath-next-20260324' of git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath
Johannes Berg [Tue, 24 Mar 2026 15:28:09 +0000 (16:28 +0100)] 
Merge tag 'ath-next-20260324' of git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath

Jeff Johnson says:
==================
ath.git patches for v7.1 (PR #2)

A few small cleanups and bug fixes across ath drivers.
==================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 weeks agowifi: mt76: fix backoff fields and max_power calculation
Allen Ye [Thu, 19 Feb 2026 00:30:27 +0000 (16:30 -0800)] 
wifi: mt76: fix backoff fields and max_power calculation

The maximum power value may exist in either the data or backoff field.
Previously, backoff power limits were not considered in txpower reporting.
This patch ensures mt76 also considers backoff values in the SKU table.

Also, each RU entry (RU26, RU52, RU106, BW20, ...) in the DTS corresponds
to 10 stream combinations (1T1ss, 2T1ss, 3T1ss, 4T1ss, 2T2ss, 3T2ss,
4T2ss, 3T3ss, 4T3ss, 4T4ss).

For beamforming tables:
- In connac2, beamforming entries for BW20~BW160, and OFDM do not include
  1T1ss.
- In connac3, beamforming entries for BW20~BW160, and RU include 1T1ss,
  but OFDM beamforming does not include 1T1ss.

Non-beamforming and RU entries for both connac2 and connac3 include 1T1ss.

Fixes: b05ab4be9fd7 ("wifi: mt76: mt7915: add bf backoff limit table support")
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://patch.msgid.link/8fa8ec500b3d4de7b1966c6887f1dfbe5c46a54c.1771205424.git.ryder.lee@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7921: Replace deprecated PCI function
Madhur Kumar [Mon, 8 Dec 2025 17:23:31 +0000 (22:53 +0530)] 
wifi: mt76: mt7921: Replace deprecated PCI function

pcim_iomap_table() and pcim_iomap_regions() have been
deprecated.
Replace them with pcim_iomap_region().

Signed-off-by: Madhur Kumar <madhurkumar004@gmail.com>
Link: https://patch.msgid.link/20251208172331.89705-1-madhurkumar004@gmail.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: increase txq memory limit to 32 MiB
Chad Monroe [Mon, 8 Dec 2025 14:14:50 +0000 (14:14 +0000)] 
wifi: mt76: mt7996: increase txq memory limit to 32 MiB

Prior to this change, both 2G and 6G radios would fall back to the
mac80211 default of 4MB which is not enough for high data rates.

Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://patch.msgid.link/acfe2e25768b414518be2db22b1d3ba6f5db6fa1.1765203249.git.chad@monroe.io
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: mt7996: reset device after MCU message timeout
Chad Monroe [Mon, 8 Dec 2025 14:24:00 +0000 (14:24 +0000)] 
wifi: mt76: mt7996: reset device after MCU message timeout

Trigger a full reset after MCU message timeout.

Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://patch.msgid.link/6e05ed063f3763ad3457633c56b60a728a49a6f0.1765203753.git.chad@monroe.io
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 weeks agowifi: mt76: fix deadlock in remain-on-channel
Chad Monroe [Mon, 8 Dec 2025 14:31:32 +0000 (14:31 +0000)] 
wifi: mt76: fix deadlock in remain-on-channel

mt76_remain_on_channel() and mt76_roc_complete() call mt76_set_channel()
while already holding dev->mutex. Since mt76_set_channel() also acquires
dev->mutex, this results in a deadlock.

Use __mt76_set_channel() instead of mt76_set_channel().
Add cancel_delayed_work_sync() for mac_work before acquiring the mutex
in mt76_remain_on_channel() to prevent a secondary deadlock with the
mac_work workqueue.

Fixes: a8f424c1287c ("wifi: mt76: add multi-radio remain_on_channel functions")
Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://patch.msgid.link/ace737e7b621af7c2adb33b0188011a5c1de2166.1765204256.git.chad@monroe.io
Signed-off-by: Felix Fietkau <nbd@nbd.name>