]> git.ipfire.org Git - thirdparty/linux.git/log
thirdparty/linux.git
3 weeks agowifi: iwlwifi: mld: block EMLSR during TDLS connections
Avinash Bhatt [Sat, 21 Mar 2026 17:29:18 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: block EMLSR during TDLS connections

TDLS (Tunneled Direct Link Setup) requires single-link operation
for direct peer-to-peer communication, which is incompatible with
EMLSR (Enhanced Multi-Link Single Radio) mode where the radio
switches between multiple links.

Block EMLSR when the first TDLS peer is added and unblock when
the last TDLS peer is removed. The block/unblock APIs handle
exiting EMLSR and triggering link selection automatically.

Signed-off-by: Avinash Bhatt <avinash.bhatt@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/20260321192637.c1376b0259dd.I016587eb1570f7a7a64c0c95e0636e955a640350@changeid
3 weeks agowifi: iwlwifi: TLC_MNG_CONFIG_CMD can use several structures
Emmanuel Grumbach [Sat, 21 Mar 2026 17:29:17 +0000 (19:29 +0200)] 
wifi: iwlwifi: TLC_MNG_CONFIG_CMD can use several structures

Depending on the firmware API version, we can use different version of
the command. Mention them all in the description.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.2c0b1adb8655.Id0cc6cb6996df53a224d29fa541d19b9ee2aa479@changeid
3 weeks agowifi: iwlwifi: mld: update the TLC when we deactivate a link
Emmanuel Grumbach [Sat, 21 Mar 2026 17:29:16 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: update the TLC when we deactivate a link

We hit a problem in the channel switch flow.
We had link 0 using PHY 0, so the TLC object in the firmware is using
PHY 0.
Then we switched channel, so mac80211 / iwlmld:
* deactivated link 0
* removed PHY 0
* added PHY 1
* modified link 0 to use PHY 1
* activated link 0.

The TLC object was not updated and the firmware was unhappy that the TLC
was still trying to use PHY 0.

Fix that by letting the TLC know about the PHY context before the link
activation.
When we are de-activating a link, let the TLC know so that it'll send a
TLC configuration command with an invalid PHY context to remove the
relationship between the TLC object and the PHY that is going to be
removed.

That last part is not implemented yet in the firmware, so leave this as
a TODO for now.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.317c66b11a31.I591118fa376ed967c0d1a47058c13834bc94605e@changeid
3 weeks agowifi: iwlwifi: add a macro for max FW links
Miri Korenblit [Sat, 21 Mar 2026 17:29:15 +0000 (19:29 +0200)] 
wifi: iwlwifi: add a macro for max FW links

Currently we use IWL_FW_MAX_LINK_ID + 1 to indicate the maximum number
of link that the fw supports. This is a bit confusing.
Add a macro that indicates the number if maximum links that the FW
supports and use it instead.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.8da9f991526f.I72709f1db90036265c98c5d45682bcf5f36be7ba@changeid
3 weeks agowifi: iwlwifi: mld: always assign a fw id to a vif
Miri Korenblit [Sat, 21 Mar 2026 17:29:14 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: always assign a fw id to a vif

We used to have a fw id assignment in iwl_mld_init_vif since all interface
types that were added to the driver was immediately added to the FW as
well.
Since NAN was introduced, this is no longer the case - the NAN interface
is not added to the fw until a local schedule is configured.

For this vif we don't assign a fw id so it is 0 by default.
But later, when the vif is removed from the driver, we think that it has
a valid fw id (0) and we point fw_id_to_vif[0] to NULL.
fw_id_to_vif[0] might actually point to another vif with a valid fw id
0. In this case, we end up messing fw_id_to_vif.

Fix this by initializing a vif with a special invalid fw id, and by
exiting iwl_mld_rm_vif early for NAN interfaces.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.f3b5cc59098f.I3d1dbe66bd224cbb786c2b0ab3d1c9f7ec9003e4@changeid
3 weeks agowifi: iwlwifi: mld: use the dedicated helper to extract a link
Miri Korenblit [Sat, 21 Mar 2026 17:29:13 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: use the dedicated helper to extract a link

There is a helper, iwl_mld_fw_id_to_link_conf, that converts a fw link
id into the bss_conf structure. Use it in two more places instead of
retrieving the bss_conf directly from the fw-id-to-bss_conf mapping array.

This required changing the loop bound in iwl_mld_process_per_link_stats()
to ucode_capa.num_links, to avoid hitting a IWL_FW_CHECK for link ids
> ucode_capa.num_links and < ARRAY_SIZE(fw_id_to_bss_conf), but this
change makes sense anyway (there is no reason to iterate links that
cannot be valid).

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.f8da2cd2a873.I7fbd3b4a86a5695206bb5083fdac49de9acc9dca@changeid
3 weeks agowifi: iwlwifi: add MAC context command version 4
Johannes Berg [Sat, 21 Mar 2026 17:29:12 +0000 (19:29 +0200)] 
wifi: iwlwifi: add MAC context command version 4

Due to NAN additions, this command needs to grow. In iwlmvm
we just need to use the old _v3 (or v2) version, but iwlmld
needs to handle the difference and send both.  Do that as a
first step towards adding NAN support.

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/20260321192637.5ab609ca1966.I860737f952865bd0b997f1c190c3891864c7c6ba@changeid
3 weeks agowifi: iwlwifi: handle NULL/ERR returns from ptp_clock_register()
Avinash Bhatt [Sat, 21 Mar 2026 17:29:11 +0000 (19:29 +0200)] 
wifi: iwlwifi: handle NULL/ERR returns from ptp_clock_register()

ptp_clock_register() returns NULL when PTP support is disabled and may
return an ERR_PTR() on other failures. Reduce Log severity for NULL
return cases to avoid misleading errors when PTP is unavailable.

Signed-off-by: Avinash Bhatt <avinash.bhatt@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/20260321192637.adea594600e8.I0e3d3f7ce897c54fff8ace6dd0faf55b4f39832b@changeid
3 weeks agowifi: iwlwifi: mld: add double-include guards to nan.h
Johannes Berg [Sat, 21 Mar 2026 17:29:10 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: add double-include guards to nan.h

This is missing, but needed when we want to add data structures
to this file.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.4e09d461db6a.If5c14c495b14a20ce7abadc72be57a40d3462bfb@changeid
3 weeks agowifi: iwlwifi: mld: make alloc functions not forced static
Johannes Berg [Sat, 21 Mar 2026 17:29:09 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: make alloc functions not forced static

In preparation for NAN needing the link ID allocation, have
the macro not automatically make the ID allocation functions
static so we can remove that later from the link allocation
function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.cbfd202c255f.I4dd4d4416d30bed35bc7b7caa3de50071906830a@changeid
3 weeks agowifi: iwlwifi: mld: rename iwl_mld_phy_from_mac80211() argument
Johannes Berg [Sat, 21 Mar 2026 17:29:08 +0000 (19:29 +0200)] 
wifi: iwlwifi: mld: rename iwl_mld_phy_from_mac80211() argument

Calling the channel context just "channel" is confusing since it's
a different struct, rename it to the more appropriate "chanctx".

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.b2cf8cfd5902.I9e0006481454445058b96ec3e7ae338e917e2c50@changeid
3 weeks agowifi: iwlwifi: mld: remove type argument from iwl_mld_add_sta()
Johannes Berg [Fri, 20 Mar 2026 08:09:18 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: remove type argument from iwl_mld_add_sta()

This is used only in a single place, and the caller always sets
the type to STATION_TYPE_PEER right now. We need to change some
of this for NAN in the future, removing the type argument will
simplify that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.71841a054f16.I1851148e582eb710261740459a46d22720788926@changeid
3 weeks agowifi: iwlwifi: mld: make iwl_mld_mac80211_iftype_to_fw() static
Johannes Berg [Fri, 20 Mar 2026 08:09:17 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: make iwl_mld_mac80211_iftype_to_fw() static

This function is only used within the file, so make it static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.45867b060b3d.Iee64056fab7881ea5146433bacef8c2e936c45b1@changeid
3 weeks agowifi: iwlwifi: pcie: don't dump on reset handshake in dump
Johannes Berg [Fri, 20 Mar 2026 08:09:16 +0000 (10:09 +0200)] 
wifi: iwlwifi: pcie: don't dump on reset handshake in dump

When a FW dump happens, possibly even because of a reset handshake
timeout, there's no point in attempting to dump again. Since all the
callers of the function outside the transport itself are from the FW
dump infrastructure, just split the internal function and make the
external one not dump on timeout.

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/20260320100746.f36ba3893899.I063ccc3a037ae6dabcde61941acb162c4b33f127@changeid
3 weeks agowifi: iwlwifi: use IWL_FW_CHECK for sync timeout
Johannes Berg [Fri, 20 Mar 2026 08:09:15 +0000 (10:09 +0200)] 
wifi: iwlwifi: use IWL_FW_CHECK for sync timeout

This could be a firmware issue, it didn't send all the responses
quickly enough. There are other potential issues (interrupts not
being delivered, etc.) but the FW debug data will at least give
some better information, and it's not a WARN condition anyway.

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/20260320100746.2188e2efbead.I7dc5bd6f581a31ac51d8a854f3b3af4cb980223a@changeid
3 weeks agowifi: iwlwifi: mld: add BIOS revision compatibility check for PPAG command
Pagadala Yesu Anjaneyulu [Fri, 20 Mar 2026 08:09:14 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: add BIOS revision compatibility check for PPAG command

Prevent potential issues when newer BIOS revisions
are used with firmware that doesn't support them for
PER_PLATFORM_ANT_GAIN_CMD.

Without this check, the driver may attempt to use
BIOS configurations that are incompatible with the
current firmware version, leading to dropping of
command in firmware without any failure notification
to driver.

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-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/20260320100746.79bf2bf398d0.I8161dbe1a04af3738e00ab0fc13fe3dbfa9094ec@changeid
3 weeks agowifi: iwlwifi: validate the channels received in iwl_mcc_update_resp_v*
Miri Korenblit [Fri, 20 Mar 2026 08:09:13 +0000 (10:09 +0200)] 
wifi: iwlwifi: validate the channels received in iwl_mcc_update_resp_v*

Check with IWL_FW_CHECK that the FW doesn't send a channel that we don't
support. Otherwise, the center frequency will be 0, leading to a
warning since is_valid_reg_rule will return false, of course.
Although the warning is verbose enough, the IWL_FW_CHECK will spare some
of the debug.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.0e83cdd88cea.Ic86852e622ed3ec06110f9e6525f72679236cf1e@changeid
3 weeks agowifi: iwlwifi: add CQM event support for per-link RSSI changes
Avinash Bhatt [Fri, 20 Mar 2026 08:09:12 +0000 (10:09 +0200)] 
wifi: iwlwifi: add CQM event support for per-link RSSI changes

Implement CQM RSSI threshold handling by tracking the last reported RSSI
and issuing CQM low/high events when the RSSI crosses the configured
threshold with the required hysteresis. This provides proper CQM support
and enables userspace to receive per-link RSSI notifications.

Signed-off-by: Avinash Bhatt <avinash.bhatt@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@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/20260320100746.08697e34bf66.Ic1a68537ef0d37be62c73c138efe9c5cf09bd24c@changeid
3 weeks agowifi: iwlwifi: mld: eliminate duplicate WIDE_ID in PPAG command handling
Pagadala Yesu Anjaneyulu [Fri, 20 Mar 2026 08:09:11 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: eliminate duplicate WIDE_ID in PPAG command handling

Extract the PER_PLATFORM_ANT_GAIN_CMD command ID into a local variable
to avoid duplicating WIDE_ID(PHY_OPS_GROUP, PER_PLATFORM_ANT_GAIN_CMD).

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-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/20260320100746.7b7e6315e2cc.Icffcc47ac1e876708b6219a89fd546a018797d44@changeid
3 weeks agowifi: iwlwifi: fw: Add TLV support for BIOS revision of command
Pagadala Yesu Anjaneyulu [Fri, 20 Mar 2026 08:09:10 +0000 (10:09 +0200)] 
wifi: iwlwifi: fw: Add TLV support for BIOS revision of command

Add support for newer firmware API versions that support
multiple BIOS revisions. Use the new TLV provided by
firmware to determine which BIOS revision it supports.

Future patches will use this information to either
drop commands when the BIOS revision is higher than
supported or convert commands based on the command
specific implementation.

Since we are including now nvm-reg.h in img.h, this causes a
re-definition error of IWL_NUM_CHANNELS which is also defined in
eeprom.c, so rename IWL_NUM_CHANNELS to IWL_NUM_CHANNELS_V2

Signed-off-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@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/20260320100746.76c8a9589ea0.I7f9157115de702e07511f2c3ed5fcb9ae4c667aa@changeid
3 weeks agowifi: iwlwifi: bump core version for BZ/SC/DR
Miri Korenblit [Fri, 20 Mar 2026 08:09:09 +0000 (10:09 +0200)] 
wifi: iwlwifi: bump core version for BZ/SC/DR

Start supporting Core 102 FW on these devices.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.3b6540a99c1c.Ie2d3bdb3dc1865ad7c865cdcbeefa41d21ea4482@changeid
3 weeks agowifi: iwlwifi: mld: support changing iftype at runtime
Johannes Berg [Fri, 20 Mar 2026 08:09:07 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: support changing iftype at runtime

While the interface isn't really operating, which is already
required by mac80211, we can simply remove the MAC and add
it again to change the type. Implement this simple handling.

We could almost consider moving this to mac80211 itself, as
this kind of flow should be supportable by any device, but
for now keep it here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.2fb530f9d825.I7cc68fa36e40c9f3bef3be9c2982061cb9ea2300@changeid
3 weeks agowifi: iwlwifi: mld: set UHR MCS in RX status
Johannes Berg [Fri, 20 Mar 2026 08:09:05 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: set UHR MCS in RX status

Handle UHR MCSes in the RX status when receiving UHR frames.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.7d235ea6a4f2.Ibc8c7e1af45cae2756e4ddcdf6dc5424b3992f7b@changeid
3 weeks agowifi: iwlwifi: mld: enable UHR in TLC
Johannes Berg [Fri, 20 Mar 2026 08:09:04 +0000 (10:09 +0200)] 
wifi: iwlwifi: mld: enable UHR in TLC

Tell the firmware if UHR is supported, including ELR (enhanced
long range) MCS support.

Note that the spec currently doesn't differentiate between 1.5
and 3 Mbps ELR MCSes, unlike the firmware.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.7117009d7c39.If4e8cdc63fdf4c5f14d923a5c59fb7b43df72a67@changeid
3 weeks agowifi: iwlwifi: mld: remove SCAN_TIMEOUT_MSEC
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:55 +0000 (20:48 +0200)] 
wifi: iwlwifi: mld: remove SCAN_TIMEOUT_MSEC

It has no users

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/20260319204647.ea8d4a381474.I82c1d17faa6de6f16f08573ebb180de8db837bee@changeid
3 weeks agowifi: iwlwifi: remove IWL_MAX_WD_TIMEOUT
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:54 +0000 (20:48 +0200)] 
wifi: iwlwifi: remove IWL_MAX_WD_TIMEOUT

This define is not used, remove it.

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/20260319204647.15341c4081ed.I639a1d65799ce5502e5c83e8889bcc5eda5ec4dc@changeid
3 weeks agowifi: iwlwifi: uefi: mode the comments valid kerneldoc comments
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:53 +0000 (20:48 +0200)] 
wifi: iwlwifi: uefi: mode the comments valid kerneldoc comments

This will allow to get warnings if we make mistakes while documenting
the uefi structures

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/20260319204647.e9ad48c2cf4a.I867e3eb9581ac2a87772fd2534502c008543bafb@changeid
3 weeks agowifi: iwlwifi: support PER_CHAIN_LIMIT_OFFSET_CMD v6
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:52 +0000 (20:48 +0200)] 
wifi: iwlwifi: support PER_CHAIN_LIMIT_OFFSET_CMD v6

This includes support for UNII-9.
Store the source of the WGDS table in the firmware runtime object to be
able to pass the information to the firmware.

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/20260319204647.eaff31760dd7.Ic7f56fbbe310833723094f965e7ba3f8624d0ef9@changeid
3 weeks agowifi: iwlwifi: acpi: add support for WGDS revision 4
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:51 +0000 (20:48 +0200)] 
wifi: iwlwifi: acpi: add support for WGDS revision 4

This adds support for UNII-9.
WGDS tables will now have 4 subbands.

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/20260319204647.721e9fbabfc9.Ie8bd641cf84aa659d93893438c172c172b67214b@changeid
3 weeks agowifi: iwlwifi: acpi: validate the WGDS table
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:50 +0000 (20:48 +0200)] 
wifi: iwlwifi: acpi: validate the WGDS table

Prefer to use ARRAY_SIZE when we check array-length.
Make sure num_profile isn't bigger than the number of profiles we can
actually store in the firmware runtime object.
Same of the number of bands.

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/20260319204647.a398511514ed.Ie4e62e2008f7e117ae7e305967ffadf1a30fc2b1@changeid
3 weeks agowifi: iwlwifi: uefi: add support for WGDS rev4
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:49 +0000 (20:48 +0200)] 
wifi: iwlwifi: uefi: add support for WGDS rev4

This new revision includes support for UNII-9. It adds a subband.

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/20260319204647.ad8e49c3a9e1.I51170ba78a706f976e93918d6473185d41e4306d@changeid
3 weeks agowifi: iwlwifi: uefi: open code the parsing of the WGDS table
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:48 +0000 (20:48 +0200)] 
wifi: iwlwifi: uefi: open code the parsing of the WGDS table

We will soon add support for UNII-9 band in the WGDS table. We need to
decouple the UEFI code from the firmware runtime code.
The firmware runtime is just a software object which will need to grow
and UEFI objects need a new revision to grow. Existing systems will keep
the same UEFI objects.

Just like PPAG and SAR, stop using structures to parse the UEFI tables
since the layout depends on the revision.
The support for the new revision will be added in the next patch, for
now, just do the ground work.

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/20260319204647.140706e6e91f.I83ca04932bc21aa358119890001e876ced1e1bda@changeid
3 weeks agowifi: iwlwifi: mld: support version 11 of REDUCE_TX_POWER_CMD
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:47 +0000 (20:48 +0200)] 
wifi: iwlwifi: mld: support version 11 of REDUCE_TX_POWER_CMD

This introduces support for UNII-9.
After we increased the size of the arrays of the subbands in SAR
structure, we now support the new firmware command.

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/20260319204647.9cea60b78a1b.Ia91c59829af0dc4d6c351c5b09ce33800c1f9e44@changeid
3 weeks agowifi: iwlwifi: acpi: add support for EWRD rev 3 table
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:46 +0000 (20:48 +0200)] 
wifi: iwlwifi: acpi: add support for EWRD rev 3 table

This table includes another sub-band for UNII-9.

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/20260319204647.9182284f007e.Ibbe7c1f8442933d29695b9bf56b8e775394c71f8@changeid
3 weeks agowifi: iwlwifi: acpi: add support for WRDS rev 3 table
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:45 +0000 (20:48 +0200)] 
wifi: iwlwifi: acpi: add support for WRDS rev 3 table

This table includes another sub-band for UNII-9.

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/20260319204647.06543ec65e00.I73135c7d61bff9b46ad9862d93f4faf923983fd4@changeid
3 weeks agowifi: iwlwifi: uefi: support the new WRDS and EWRD tables
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:44 +0000 (20:48 +0200)] 
wifi: iwlwifi: uefi: support the new WRDS and EWRD tables

Those tables now have support for UNII-9 subband.
Refactor iwl_uefi_set_sar_profile to get an array of values that makes
it easier to use when the number of subbands can vary.
Revamp a bit the code that fetches the tables to ask for the smaller
table, then we can check the size of the object that we got and compare
to the expected sizes to determine what revision to expect.

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/20260319204647.6948f69e6ae4.Icf990e13de6905c35a8de69f1445f8eb4aa43ee4@changeid
3 weeks agowifi: iwlwifi: mvm: zero iwl_geo_tx_power_profiles_cmd before sending
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:43 +0000 (20:48 +0200)] 
wifi: iwlwifi: mvm: zero iwl_geo_tx_power_profiles_cmd before sending

Otherwise we may send garbage.

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/20260319204647.2d494b0f4692.I9afd0fa6b2ea5a27118144ac4e3bbbedc2089c10@changeid
3 weeks agowifi: iwlwifi: restrict TOP reset to some devices
Johannes Berg [Thu, 19 Mar 2026 18:48:42 +0000 (20:48 +0200)] 
wifi: iwlwifi: restrict TOP reset to some devices

Due to the Bluetooth implementation needing to match, not all
devices can actually do TOP reset. Restrict it to Sc2/Sc2f or
later, with Wh RF or later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319204647.6c4479f4e49d.I5023d70cb33f1e18f7cb15981fc3acfbb00862b7@changeid
3 weeks agowifi: iwlwifi: uefi: add support for PPAG table rev5
Emmanuel Grumbach [Thu, 19 Mar 2026 18:48:41 +0000 (20:48 +0200)] 
wifi: iwlwifi: uefi: add support for PPAG table rev5

This table has another subband for UNII-9.
Add defines for the sizes of rev4 and rev5 to easily know how much data
to ask from iwl_uefi_get_verified_variable.
In case rev5 doesn't exist, fallback to rev4.
Check that the revision advertised by the fetched table matches the size
that we got.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319204647.b9ebcff37599.I1e8bb9cee5a028ed416b6094c0fdbf9f859c6dd8@changeid
3 weeks agowifi: iwlwifi: acpi: add support for PPAG rev5
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:27 +0000 (11:09 +0200)] 
wifi: iwlwifi: acpi: add support for PPAG rev5

This adds support for UNII9 which requires to add a subband.
Just increase the number of subbands that we need to read.

Replace the usage of the IWL_NUM_SUB_BANDS_VX macros in acpi.h since
those macros are defined in the firmware API and ACPI declarations have
nothing to do the firmware API.

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.a5e7f805d0f2.I0e3ee3258b77b339234692ceccf0d25d1e6dd67e@changeid
3 weeks agowifi: iwlwifi: acpi: check the size of the ACPI PPAG tables
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:26 +0000 (11:09 +0200)] 
wifi: iwlwifi: acpi: check the size of the ACPI PPAG tables

We need to make sure we don't have a buffer overflow while reading the
PPAG tables from ACPI into the firmware runtime object.
Add an ACPI specific define for the number of chains in order to
decouple the ACPI layout from the other objects.

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.451808698662.I91234c8a662608674679ce490b51be792332cd43@changeid
3 weeks agowifi: iwlwifi: regulatory: support a new command for PPAG
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:25 +0000 (11:09 +0200)] 
wifi: iwlwifi: regulatory: support a new command for PPAG

Per Platform Antenna Gain is getting support for UNII-9.
Add a new version of PER_PLATFORM_ANT_GAIN_CMD.
This requires to increase the number of subbands in the firmware runtime
object.
Pass the number of subbands to iwl_bios_print_ppag to avoid printing
invalid values.

Introduce BIOS_PPAG_MAX_SUB_BANDS_NUM to avoid impacting
BIOS_SAR_MAX_SUB_BANDS_NUM which was used until now for PPAG as well.
SAR will get support for the new subband in future patches.

While at it, print the PPAG table as it was read from BIOS.

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.2e577236d3c9.I042697a73893d79ef761796354b5d1dd8522f734@changeid
3 weeks agowifi: iwlwifi: mld: add support for sta command version 3
Miri Korenblit [Thu, 19 Mar 2026 09:09:23 +0000 (11:09 +0200)] 
wifi: iwlwifi: mld: add support for sta command version 3

In this version, the link_id becomes a link_mask to support multiple
links that are used to communicate with the station in question.
This is needed for NAN, in which we can communicate on multiple channels
with the same station.
Also add a new STA type - NAN peer.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319110722.382a30bd1b70.Id6271e7eba233a11dc214ed2e07c2b186b167c66@changeid
3 weeks agowifi: iwlwifi: bring iwl_fill_ppag_table to the iwlmvm
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:22 +0000 (11:09 +0200)] 
wifi: iwlwifi: bring iwl_fill_ppag_table to the iwlmvm

iwl_fill_ppag_table fills a command that is sent to the firmware. This
command has several versions and handling those different versions is
the responsibility of the op_mode.

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.1f9b38ff7d22.I5c7482c074d63cd18533ac83289cc0b26c1be3d2@changeid
3 weeks agowifi: iwlwifi: uefi: open code the PPAG table store operation
Emmanuel Grumbach [Thu, 19 Mar 2026 09:09:21 +0000 (11:09 +0200)] 
wifi: iwlwifi: uefi: open code the PPAG table store operation

The structure in firmware runtime will need to grow because we're adding
a subband for UNII-9.
This means that we will soon no longer be able to just memcpy the data
from the UEFI table. The layout of the array will change.
Tediously copy the data byte-byte to make sure things get to the right
place even when we'll increase the number of subbands.
Make it easier for the uefi_cnv_var_ppag structure to grow by
simpiflying the layout it becomes an array of s8.
The layout of the structure becomes less obvious from the structure's
declaration, but then the code is more flexible.

Don't use UEFI_SAR_MAX_SUB_BANDS_NUM for the number of bands for PPAG.
Of course, SAR related structures will grow in future patches, but
decouple SAR and PPAG to make the work easier.

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.61e729ea2bde.I9d9cda29f576290bf966f780bf7ad5af34970e6f@changeid
3 weeks agowifi: iwlwifi: mld: Introduce scan command version 18
Ilan Peer [Thu, 19 Mar 2026 09:09:20 +0000 (11:09 +0200)] 
wifi: iwlwifi: mld: Introduce scan command version 18

The FW scan logic was extended to support new channels in the
7 GHz band, as such, the scan command was modified to support
scanning more PSC channels.

Introduce scan command version 18 handling, which is different
from scan command version 17 only in the number of supported
channel configurations.

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.c995b4e8bbc5.Ie401d9cf02daaa5e6adf2b3c309643589e3ead71@changeid
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>