linux-block.git
3 months agowifi: rtw88: sdio: map mgmt frames to queue TX_DESC_QSEL_MGMT
Zhen XIN [Thu, 10 Apr 2025 15:42:17 +0000 (15:42 +0000)]
wifi: rtw88: sdio: map mgmt frames to queue TX_DESC_QSEL_MGMT

The rtw88-sdio do not work in AP mode due to the lack of TX status report
for management frames.

Map the management frames to queue TX_DESC_QSEL_MGMT, which enables the
chip to generate TX reports for these frames

Tested-on: rtl8723ds

Fixes: 65371a3f14e7 ("wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets")
Signed-off-by: Zhen XIN <zhen.xin@nokia-sbell.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250410154217.1849977-3-zhen.xin@nokia-sbell.com
3 months agowifi: rtw88: Fix the module names printed in dmesg
Bitterblue Smith [Wed, 2 Apr 2025 17:54:30 +0000 (20:54 +0300)]
wifi: rtw88: Fix the module names printed in dmesg

The rtw88 module names all start with the "rtw88_" prefix, but the
messages in dmesg mostly use the "rtw_" prefix. The messages from
rtw88_8723cs don't even have the underscore.

Use the KBUILD_MODNAME macro in every driver. This ensures that the
messages in dmesg will always use the module name.

Before:

Mar 17 15:54:19 ideapad2 kernel: rtw_8814au 2-4:1.0: Firmware version 33.6.0, H2C version 6

After:

Mar 17 16:33:35 ideapad2 kernel: rtw88_8814au 2-4:1.0: Firmware version 33.6.0, H2C version 6

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/29cd29ba-bc51-4d5b-ad48-a43c6ce72d56@gmail.com
3 months agowifi: rtw88: Don't set SUPPORTS_AMSDU_IN_AMPDU for RTL8814AU
Bitterblue Smith [Wed, 2 Apr 2025 15:31:36 +0000 (18:31 +0300)]
wifi: rtw88: Don't set SUPPORTS_AMSDU_IN_AMPDU for RTL8814AU

RTL8814AU doesn't work well with SUPPORTS_AMSDU_IN_AMPDU. The RX speed
is noticeably lower and the VHT RX statistics are strange. Typical
values with SUPPORTS_AMSDU_IN_AMPDU:

Reverse mode, remote host 192.168.0.1 is sending
[  5] local 192.168.0.50 port 60710 connected to 192.168.0.1 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  74.6 MBytes   626 Mbits/sec
[  5]   1.00-2.00   sec  79.2 MBytes   665 Mbits/sec
[  5]   2.00-3.00   sec  84.9 MBytes   712 Mbits/sec
[  5]   3.00-4.00   sec  83.8 MBytes   703 Mbits/sec
[  5]   4.00-5.00   sec  85.9 MBytes   720 Mbits/sec
[  5]   5.00-6.00   sec  78.9 MBytes   662 Mbits/sec
[  5]   6.00-7.00   sec  81.2 MBytes   682 Mbits/sec
[  5]   7.00-8.00   sec  80.5 MBytes   675 Mbits/sec
[  5]   8.00-9.00   sec  79.4 MBytes   666 Mbits/sec
[  5]   9.00-10.00  sec  82.2 MBytes   689 Mbits/sec
[  5]  10.00-11.00  sec  82.0 MBytes   688 Mbits/sec
[  5]  11.00-12.00  sec  84.2 MBytes   707 Mbits/sec
[  5]  12.00-13.00  sec  71.0 MBytes   596 Mbits/sec
[  5]  13.00-14.00  sec  69.4 MBytes   582 Mbits/sec
[  5]  14.00-15.00  sec  80.2 MBytes   673 Mbits/sec
[  5]  15.00-16.00  sec  74.5 MBytes   625 Mbits/sec

[Rx Counter]:
 * CCA (CCK, OFDM, Total) = (0, 2455, 2455)
 * False Alarm (CCK, OFDM, Total) = (0, 69, 69)
 * CCK cnt (ok, err) = (0, 0)
 * OFDM cnt (ok, err) = (1239, 2)
 * HT cnt (ok, err) = (0, 0)
 * VHT cnt (ok, err) = (21, 12109)

The "VHT ok" number is not believable.

And without SUPPORTS_AMSDU_IN_AMPDU:

Reverse mode, remote host 192.168.0.1 is sending
[  5] local 192.168.0.50 port 50030 connected to 192.168.0.1 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  70.5 MBytes   591 Mbits/sec
[  5]   1.00-2.00   sec  86.9 MBytes   729 Mbits/sec
[  5]   2.00-3.00   sec  98.6 MBytes   827 Mbits/sec
[  5]   3.00-4.00   sec  97.4 MBytes   817 Mbits/sec
[  5]   4.00-5.00   sec  98.6 MBytes   827 Mbits/sec
[  5]   5.00-6.00   sec  96.9 MBytes   813 Mbits/sec
[  5]   6.00-7.00   sec  98.2 MBytes   824 Mbits/sec
[  5]   7.00-8.00   sec  98.0 MBytes   822 Mbits/sec
[  5]   8.00-9.00   sec  99.9 MBytes   838 Mbits/sec
[  5]   9.00-10.00  sec  99.2 MBytes   833 Mbits/sec
[  5]  10.00-11.00  sec  98.0 MBytes   822 Mbits/sec
[  5]  11.00-12.00  sec  98.1 MBytes   823 Mbits/sec
[  5]  12.00-13.00  sec  97.0 MBytes   814 Mbits/sec
[  5]  13.00-14.00  sec  98.2 MBytes   824 Mbits/sec
[  5]  14.00-15.00  sec  98.5 MBytes   826 Mbits/sec
[  5]  15.00-16.00  sec  97.4 MBytes   817 Mbits/sec

[Rx Counter]:
 * CCA (CCK, OFDM, Total) = (0, 3860, 3860)
 * False Alarm (CCK, OFDM, Total) = (0, 2, 2)
 * CCK cnt (ok, err) = (0, 0)
 * OFDM cnt (ok, err) = (1486, 0)
 * HT cnt (ok, err) = (0, 0)
 * VHT cnt (ok, err) = (7399, 9118)

Add a new member "amsdu_in_ampdu" in struct rtw_chip_info and use it
to set SUPPORTS_AMSDU_IN_AMPDU only for the other chips.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/6202ccfb-feb0-4107-a08d-db2699e179f0@gmail.com
3 months agowifi: rtw88: Set AMPDU factor to hardware for RTL8814A
Bitterblue Smith [Wed, 2 Apr 2025 15:31:12 +0000 (18:31 +0300)]
wifi: rtw88: Set AMPDU factor to hardware for RTL8814A

Tell the chip the maximum AMPDU size supported by the AP. This greatly
improves the TX speed of RTL8814AU in the 2.4 GHz band. Before: ~90
Mbps. After: ~300 Mbps.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/4edc2a63-81b3-431c-9a37-5a7d899a6cc2@gmail.com
3 months agowifi: rtw88: usb: Enable RX aggregation for RTL8814AU
Bitterblue Smith [Wed, 2 Apr 2025 15:30:28 +0000 (18:30 +0300)]
wifi: rtw88: usb: Enable RX aggregation for RTL8814AU

Let the chip transfer several frames in a single USB Request Block.
This is supposed to improve the RX speed.

It can use the same code used for RTL8822CU, RTL8822BU, and RTL8821CU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/672397ac-dd4d-4420-8b3e-7011578e2243@gmail.com
3 months agowifi: rtw88: usb: Enable switching the RTL8814AU to USB 3
Bitterblue Smith [Wed, 2 Apr 2025 15:30:02 +0000 (18:30 +0300)]
wifi: rtw88: usb: Enable switching the RTL8814AU to USB 3

The Realtek wifi 5 devices which support USB 3 are weird: when first
plugged in, they pretend to be USB 2. The driver needs to send some
commands to the device, which make it disappear and come back as a
USB 3 device.

The method used to switch the RTL8812AU also works for the RTL8814AU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/d3608f70-e04f-4f6b-987a-022c8e317165@gmail.com
3 months agowifi: rtw88: usb: Remove redundant 'flush_workqueue()' calls
Chen Ni [Mon, 24 Mar 2025 08:03:03 +0000 (16:03 +0800)]
wifi: rtw88: usb: Remove redundant 'flush_workqueue()' calls

'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

This was generated with coccinelle:

@@
expression E;
@@

- flush_workqueue(E);
  destroy_workqueue(E);

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250324080303.408084-1-nichen@iscas.ac.cn
3 months agowifi: rtw88: sdio: Remove redundant 'flush_workqueue()' calls
Chen Ni [Mon, 24 Mar 2025 07:59:10 +0000 (15:59 +0800)]
wifi: rtw88: sdio: Remove redundant 'flush_workqueue()' calls

'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

This was generated with coccinelle:

@@
expression E;
@@

- flush_workqueue(E);
  destroy_workqueue(E);

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250324075910.407999-1-nichen@iscas.ac.cn
3 months agowifi: rtw89: 8852bx: support different SAR configs by antenna
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:43 +0000 (10:06 +0800)]
wifi: rtw89: 8852bx: support different SAR configs by antenna

Calculate difference of SAR configs between RF path A and RF path B.
And then, based on the calculated result, set the TX power reference
CR (control register). Finally, declare to support SAR by antenna in
8852b/8852bt chip info.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-13-pkshih@realtek.com
3 months agowifi: rtw89: 8852c: support different SAR configs by antenna
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:42 +0000 (10:06 +0800)]
wifi: rtw89: 8852c: support different SAR configs by antenna

Set SAR configs to the corresponding CRs (control registers) according to
RF path. Then, declare to support SAR by antenna in chip info.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-12-pkshih@realtek.com
3 months agowifi: rtw89: 8922a: support different SAR configs by antenna
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:41 +0000 (10:06 +0800)]
wifi: rtw89: 8922a: support different SAR configs by antenna

Set SAR configs to the corresponding CRs (control registers) according to
RF path. Then, declare to support SAR by antenna in chip info.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-11-pkshih@realtek.com
3 months agowifi: rtw89: sar: add skeleton for different configs by antenna
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:40 +0000 (10:06 +0800)]
wifi: rtw89: sar: add skeleton for different configs by antenna

Some SAR sources, e.g. ACPI, may allow different SAR configs by antenna.
Previously, the minimum config between antennas was taken. Because there
are differences between HW design, different chips might have different
solutions to achieve this. So, it cannot be done through a single common
handling. Now, add the relevant skeleton for this purpose ahead.

First, add a flag into chip info to describe whether it has implemented
this function or not. Second, support to query SAR config for a given RF
path. With it, each chip can implement its own handling. Then, if a chip
declares to support this function, when it queries SAR config without a
given RF path, it gets a maximum config between antennas.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-10-pkshih@realtek.com
3 months agowifi: rtw89: acpi: support loading GEO SAR tables
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:39 +0000 (10:06 +0800)]
wifi: rtw89: acpi: support loading GEO SAR tables

Support to load GEO (geography) SAR tables with ACPI RWGS method. When
SAR values could be different by regulatory, GEO SAR can be used. The
format of GEO SAR is like the following, where regulatory number, band
number, and delta number are determined by header of either static SAR
or dynamic SAR. (It also means that no GEO SAR will be considered when
neither static SAR nor dynamic SAR is configured.)

                               delta number
                             /               \
                    + +-----+-----------------+
                  / | | max | delta...        | \
                 /  | +-----+-----------------+  band
                /   | | max | delta...        |  number
               /    | +-----+-----------------+
              /     | |...                    | /
                    + +-----+-----------------+
                    | | max | delta...        | \
       regulatory   | +-----+-----------------+  band
       number       | | max | delta...        |  number
                    | +-----+-----------------+
                    | |...                    | /
                    + +-----+-----------------+
              \     | |...                    |
               \    | |...                    |
                \   | |...                    |
                 \  | |                       |
                  \ | |                       |
                    + +-----+-----------------+

Each entry of GEO SAR contains delta field(s), which are offset(s) used
to tweak the loaded static/dynamic SAR table(s) by antenna, and one max
field, which describes the maximum of the final SAR values after tweaked.
Different entries should be configured based on both regulatory and band.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-9-pkshih@realtek.com
3 months agowifi: rtw89: acpi: support loading dynamic SAR tables and indicator
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:38 +0000 (10:06 +0800)]
wifi: rtw89: acpi: support loading dynamic SAR tables and indicator

Support to load dynamic SAR tables with ACPI RWRD method. The content
format of a single dynamic SAR table is basically the same as static
SAR table. However, it's able to carry multiple dynamic SAR tables at
one time. And, its header contains one more field to describe how many
dynamic SAR tables are filled in the content. Either static SAR table
or dynamic SAR tables can be supported, but not both simultaneously.

Besides, also support to load indicator of dynamic SAR with ACPI RWSI
method. The indicator will describe a target dynamic SAR table, which
should be followed currently, by antenna. It can be changed at runtime
according to platform mode. For example, tablet mode can use different
SAR from normal mode. So, track indicator configuration if dynamic SAR
is configured.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-8-pkshih@realtek.com
3 months agowifi: rtw89: acpi: support loading static SAR table
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:37 +0000 (10:06 +0800)]
wifi: rtw89: acpi: support loading static SAR table

Support to load static SAR table with ACPI WRDS method. The format of
a static SAR table is like the following, where according to header,
antenna number could be either 2 or 4 and subband number could either
contain 6 GHz or not. And then, an entry of it describes a TX power
limitation with a given unit, which is also based on header, for the
antenna under the subband. Though things can be determined by header,
still not all combinations are allowed in content. For the recognizing
flow, there is a list of allowed combinations.

               +--------------------------------+
               |             header             |
               +--------------------------------+
               +---+---+---+---+---+------------+ +
             / |   |   |   |   |   | ...        | | \
               +---+---+---+---+---+------------+ |
      antenna  |   |   |   |   |   | ...        | |
      number   +---+---+---+---+---+------------+ |   content
               |...|   |   |   |   | ...        | |
               +---+---+---+---+---+------------+ |
             \ |...|   |   |   |   | ...        | | /
               +---+---+---+---+---+------------+ +
                \                              /
                          subband number

Following the format above, try to load a static SAR table and normalize
its content into SW structure. If any recognized is loaded, SW SAR flow
is then set up with source from ACPI.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-7-pkshih@realtek.com
3 months agowifi: rtw89: acpi: introduce method evaluation function for reuse
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:36 +0000 (10:06 +0800)]
wifi: rtw89: acpi: introduce method evaluation function for reuse

The following implementations will evaluate different ACPI methods, but
the pre-process flow of them are the same. So, introduce a function for
these pre-process things. Besides, also change ACPI RTAG method to call
this function.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-6-pkshih@realtek.com
3 months agowifi: rtw89: sar: add skeleton for SAR configuration via ACPI
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:35 +0000 (10:06 +0800)]
wifi: rtw89: sar: add skeleton for SAR configuration via ACPI

To support SAR configuration in BIOS via ACPI, add related subbnad/band
converting/handling function and define SW format to store result after
parsing. Then, register a new SAR source, i.e. ACPI, into SAR flow and
implement its query function.

Besides, tweak priority of common SAR to be the highest. And, ACPI SAR
can just be configured once when no other sources is already working.
For now, evaluating SAR via ACPI returns -ENOENT, i.e. ACPI SAR doesn't
really work yet. The evaluating flow will be implemented in the following.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-5-pkshih@realtek.com
3 months agowifi: rtw89: sar: introduce structure to wrap query parameters
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:34 +0000 (10:06 +0800)]
wifi: rtw89: sar: introduce structure to wrap query parameters

The following implementations will support SAR source from ACPI/BIOS.
And when querying, it needs to take more parameters into account. To
avoid changing function prototype of querying SAR everytime when new
SAR source is introduced, wrap query parameters into a structure first.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-4-pkshih@realtek.com
3 months agowifi: rtw89: regd: introduce string getter for reuse
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:33 +0000 (10:06 +0800)]
wifi: rtw89: regd: introduce string getter for reuse

Introduce a function to get the string for a given regulatory. It will be
used in the following. Besides, drop similar things in debug code and use
this too.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-3-pkshih@realtek.com
3 months agowifi: rtw89: fix typo of "access" in rtw89_sar_info description
Zong-Zhe Yang [Wed, 26 Mar 2025 02:06:32 +0000 (10:06 +0800)]
wifi: rtw89: fix typo of "access" in rtw89_sar_info description

The "acces" should be "access".
So, fix it.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250326020643.14487-2-pkshih@realtek.com
3 months agowifi: rtw89: phy: reset value of force TX power for MAC ID
Ping-Ke Shih [Tue, 25 Mar 2025 03:10:21 +0000 (11:10 +0800)]
wifi: rtw89: phy: reset value of force TX power for MAC ID

The force TX power function is disabled, but the force TX power value is
preserved, causing misunderstand the behavior in debug. Clear all values.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250325031021.15619-1-pkshih@realtek.com
3 months agowifi: rtw89: fw: cast mfw_hdr pointer from address of zeroth byte of firmware->data
Ping-Ke Shih [Tue, 25 Mar 2025 02:54:24 +0000 (10:54 +0800)]
wifi: rtw89: fw: cast mfw_hdr pointer from address of zeroth byte of firmware->data

The firmware->size is validated before using firmware->data, but Coverity
still reports:
  Downcasting "firmware->data" from "u8 const *" to "struct rtw89_mfw_hdr"
  implies that the data that this pointer points to is tainted."

Using &firmware->data[0] to avoid the warning. No change logic at all.

Addresses-Coverity-ID: 1494046 ("Untrusted loop bound")
Addresses-Coverity-ID: 1544385 ("Untrusted array index read")

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250325025424.14079-1-pkshih@realtek.com
3 months agowifi: rtw89: set 2TX for 1SS rate by default
Ping-Ke Shih [Fri, 21 Mar 2025 03:47:36 +0000 (11:47 +0800)]
wifi: rtw89: set 2TX for 1SS rate by default

To improve performance in range, for 1SS rate, transmit the same signal
on 2 antenna, which is called 2TX.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250321034736.6269-1-pkshih@realtek.com
4 months agowifi: mt76: mt7996: fix locking in mt7996_mac_sta_rc_work()
Johannes Berg [Wed, 19 Mar 2025 18:44:25 +0000 (19:44 +0100)]
wifi: mt76: mt7996: fix locking in mt7996_mac_sta_rc_work()

The 'continue' statements need to be under spinlock, since
the spinlock needs to be held as a loop invariant.

Fixes: 0762bdd30279 ("wifi: mt76: mt7996: rework mt7996_mac_sta_rc_work to support MLO")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agoMerge tag 'mt76-next-2025-03-19' of https://github.com/nbd168/wireless
Johannes Berg [Wed, 19 Mar 2025 18:37:46 +0000 (19:37 +0100)]
Merge tag 'mt76-next-2025-03-19' of https://github.com/nbd168/wireless

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

- preparation for mt7996 mlo support
- fixes
====================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table
Icenowy Zheng [Mon, 17 Mar 2025 10:22:35 +0000 (18:22 +0800)]
wifi: mt76: mt76x2u: add TP-Link TL-WDN6200 ID to device table

The TP-Link TL-WDN6200 "Driverless" version cards use a MT7612U chipset.

Add the USB ID to mt76x2u driver.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Link: https://patch.msgid.link/20250317102235.1421726-1-uwu@icenowy.me
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt792x: re-register CHANCTX_STA_CSA only for the mt7921 series
Ming Yen Hsieh [Thu, 13 Mar 2025 05:40:44 +0000 (13:40 +0800)]
wifi: mt76: mt792x: re-register CHANCTX_STA_CSA only for the mt7921 series

CSA is currently not supported on mt7925, so CSA is only registered for
the mt7921 series

Cc: stable@vger.kernel.org
Fixes: 8aa2f59260eb ("wifi: mt76: mt7921: introduce CSA support")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250313054044.2638837-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Update mt7996_tx to MLO support
Lorenzo Bianconi [Wed, 12 Mar 2025 11:14:05 +0000 (12:14 +0100)]
wifi: mt76: mt7996: Update mt7996_tx to MLO support

Rework mt7996_tx routine in order to support multi-link
setup.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-21-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_ampdu_action to support MLO
Lorenzo Bianconi [Wed, 12 Mar 2025 11:14:04 +0000 (12:14 +0100)]
wifi: mt76: mt7996: rework mt7996_ampdu_action to support MLO

Active/de-active TX/RX BA sessssion for each active links running
mt7996_ampdu_action routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-20-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework set/get_tsf callabcks to support MLO
Shayne Chen [Wed, 12 Mar 2025 11:14:03 +0000 (12:14 +0100)]
wifi: mt76: mt7996: rework set/get_tsf callabcks to support MLO

This is a preliminary patch in order to enable MLO for MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-19-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: set vif default link_id adding/removing vif links
Lorenzo Bianconi [Wed, 12 Mar 2025 11:14:02 +0000 (12:14 +0100)]
wifi: mt76: mt7996: set vif default link_id adding/removing vif links

This info will be consumed by subsequent patches (e.g. in set/get tsf
routines).

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-18-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_mcu_beacon_inband_discov to support MLO
Shayne Chen [Wed, 12 Mar 2025 11:14:01 +0000 (12:14 +0100)]
wifi: mt76: mt7996: rework mt7996_mcu_beacon_inband_discov to support MLO

Rework mt7996_mcu_beacon_inband_discov routine in order to support
multi-link setup.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-17-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_mcu_add_obss_spr to support MLO
Shayne Chen [Wed, 12 Mar 2025 11:14:00 +0000 (12:14 +0100)]
wifi: mt76: mt7996: rework mt7996_mcu_add_obss_spr to support MLO

Rework mt7996_mcu_add_obss_spr routine in order to support multi-link
setup.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-16-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_net_fill_forward_path to support MLO
Lorenzo Bianconi [Wed, 12 Mar 2025 11:13:59 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_net_fill_forward_path to support MLO

Rework mt7996_net_fill_forward_path routine in order to support multi-link
setup.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-15-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_update_mu_group to support MLO
Lorenzo Bianconi [Wed, 12 Mar 2025 11:13:58 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_update_mu_group to support MLO

Rework mt7996_update_mu_group routine in order to support multi-link
setup.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-14-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_mac_sta_poll to support MLO
Lorenzo Bianconi [Wed, 12 Mar 2025 11:13:57 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_mac_sta_poll to support MLO

Rework mt7996_mac_sta_poll routine in order to support multi-link
setup.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-13-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_mac_sta_rc_work to support MLO
Lorenzo Bianconi [Wed, 12 Mar 2025 11:13:56 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_mac_sta_rc_work to support MLO

Rework mt7996_mac_sta_rc_work routine in order to support multi-link
setup.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-12-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: remove mt7996_mac_enable_rtscts()
Shayne Chen [Wed, 12 Mar 2025 11:13:55 +0000 (12:13 +0100)]
wifi: mt76: mt7996: remove mt7996_mac_enable_rtscts()

It is controlled by FW, also, driver should not directly write WTBL to
prevent WTBL overwritten issues.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-11-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_sta_hw_queue_read to support MLO
Lorenzo Bianconi [Wed, 12 Mar 2025 11:13:54 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_sta_hw_queue_read to support MLO

Extend mt7996_sta_hw_queue_read to support multi-link setup.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-10-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_set_hw_key to support MLO
Shayne Chen [Wed, 12 Mar 2025 11:13:53 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_set_hw_key to support MLO

Modify mt7996_set_hw_key routine to work in a multi-link setup.
This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-9-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add mt7996_sta_link to mt7996_mcu_add_bss_info signature
Lorenzo Bianconi [Wed, 12 Mar 2025 11:13:52 +0000 (12:13 +0100)]
wifi: mt76: mt7996: Add mt7996_sta_link to mt7996_mcu_add_bss_info signature

This is a preliminary patch to introduce MLO support for MT996 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250312-b4-mt7996-mlo-p2-v1-8-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_sta_set_4addr and mt7996_sta_set_decap_offload...
Shayne Chen [Wed, 12 Mar 2025 11:13:51 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_sta_set_4addr and mt7996_sta_set_decap_offload to support MLO

Rework mt7996_sta_set_4addr and mt7996_sta_set_decap_offload routines in
order to properly support multi-link. This is a preliminary patch to enable
MLO for MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-7-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_rx_get_wcid to support MLO
Shayne Chen [Wed, 12 Mar 2025 11:13:50 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_rx_get_wcid to support MLO

The wcid idx and band idx in the TXS are sometimes mismatched since the
FW will select a transmission link according to a private algorithm.
That is, the wcid idx in the TXS would be the one registered by the
driver rather than the actual wcid idx used during transmission.
However, the band idx in the TXS is the band select for transmission.
Therefore, we should get the driver-registered wcid in order
to notify the driver the packet has been acked; otherwise,
the driver will be unable to match the transmitted packet and its TXS.
This is a preliminary patch to enable MLO for MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-6-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Rely on wcid_to_sta in mt7996_mac_add_txs_skb()
Shayne Chen [Wed, 12 Mar 2025 11:13:49 +0000 (12:13 +0100)]
wifi: mt76: mt7996: Rely on wcid_to_sta in mt7996_mac_add_txs_skb()

This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-5-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: rework mt7996_mac_write_txwi() for MLO support
Shayne Chen [Wed, 12 Mar 2025 11:13:48 +0000 (12:13 +0100)]
wifi: mt76: mt7996: rework mt7996_mac_write_txwi() for MLO support

Update mt7996_mac_write_txwi routine and all the called subroutines to
support MLO.
This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-4-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add mt7996_mcu_teardown_mld_sta rouine
Shayne Chen [Wed, 12 Mar 2025 11:13:47 +0000 (12:13 +0100)]
wifi: mt76: mt7996: Add mt7996_mcu_teardown_mld_sta rouine

mt7996_mcu_teardown_mld_sta is used to remove MLO configuration from the
MCU. This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-3-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add mt7996_mcu_sta_mld_setup_tlv() and mt7996_mcu_sta_eht_mld_tlv()
Shayne Chen [Wed, 12 Mar 2025 11:13:46 +0000 (12:13 +0100)]
wifi: mt76: mt7996: Add mt7996_mcu_sta_mld_setup_tlv() and mt7996_mcu_sta_eht_mld_tlv()

mt7996_mcu_sta_mld_setup_tlv is needed to push MLO configuration to the
MCU. This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-2-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Update mt7996_mcu_add_rate_ctrl to MLO
Shayne Chen [Wed, 12 Mar 2025 11:13:45 +0000 (12:13 +0100)]
wifi: mt76: mt7996: Update mt7996_mcu_add_rate_ctrl to MLO

Update mt7996_mcu_add_rate_ctrl routine and all the called subroutines
to support MLO.
This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250312-b4-mt7996-mlo-p2-v1-1-015b3d6fd928@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Rely on mt7996_vif/sta_link in twt teardown
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:12 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Rely on mt7996_vif/sta_link in twt teardown

This is a preliminary patch to enable MLO for MT7996 driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-13-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Rely on mt7996_vif_link in mt7996_mcu_twt_agrt_update signature
Shayne Chen [Tue, 11 Mar 2025 17:45:11 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Rely on mt7996_vif_link in mt7996_mcu_twt_agrt_update signature

This is a preliminary patch to enable MLO for MT7996 driver

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250311-mt7996-mlo-v2-12-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Update mt7996_mcu_add_sta to MLO support
Shayne Chen [Tue, 11 Mar 2025 17:45:10 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Update mt7996_mcu_add_sta to MLO support

Update mt7996_mcu_add_sta routine and all the called subroutines to
support MLO. This is a preliminary patch to enable MLO for MT7996
driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250311-mt7996-mlo-v2-11-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: Check link_conf pointer in mt76_connac_mcu_sta_basic_tlv()
Shayne Chen [Tue, 11 Mar 2025 17:45:09 +0000 (18:45 +0100)]
wifi: mt76: Check link_conf pointer in mt76_connac_mcu_sta_basic_tlv()

This is a preliminary patch to introduce MLO support for MT7996 driver.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-10-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Support MLO in mt7996_mac_sta_event()
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:08 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Support MLO in mt7996_mac_sta_event()

Similar to mt7996_mac_sta_add() adn mt7996_mac_sta_remove(), update
mt7996_mac_sta_event routine to take into account MLO support.
Please note mcu routines does not support MLO yet.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-9-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add mt7996_mac_sta_change_links callback
Shayne Chen [Tue, 11 Mar 2025 17:45:07 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Add mt7996_mac_sta_change_links callback

Intrdouce mt7996_mac_sta_change_links routine to set change_sta_links
required by mac80211. This is a preliminary patch to introduce MLO
support for MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
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/20250311-mt7996-mlo-v2-8-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:06 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks

Generalize mt7996_mac_sta_add() and mt7996_mac_sta_remove() routines to
deal with mt7996_sta_link structure.
This is a preliminary patch to introduce MLO support for MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-7-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add mt7996_sta_state routine
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:05 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Add mt7996_sta_state routine

Introduce mt7996_sta_state routine in order to initialize wcid structure
in mt7996 codebase. This is a preliminary patch to enable MLO support in
MT7996 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-6-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add link_info_changed callback
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:04 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Add link_info_changed callback

Convert bss_info_changed mac80211 callback in link_info_changed one.
This is a preliminary patch to enable MLO support in MT7996 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-5-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add vif_cfg_changed callback
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:03 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Add vif_cfg_changed callback

Introduce vif_cfg_changed mac80211 callback as preliminary patch to
enable MLO support in MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-4-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add mt7996_sta_link struct in mt7996_vif_link
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:02 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Add mt7996_sta_link struct in mt7996_vif_link

Introduce mt7996_sta_link field in mt7996_vif_link structure instead of
mt7996_sta. This is a preliminary patch to support MLO in MT7996 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-3-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Introduce mt7996_sta_link container
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:01 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Introduce mt7996_sta_link container

Similar to mt7996_vif_link, add mt7996_sta_link structure as driver
representation for sta links. This is a preliminary patch to introduce
MLO support for MT7996 driver.

Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-2-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: Add change_vif_links stub
Lorenzo Bianconi [Tue, 11 Mar 2025 17:45:00 +0000 (18:45 +0100)]
wifi: mt76: mt7996: Add change_vif_links stub

change_vif_links callback is required by mac80211.
This is a preliminary patch to introduce MLO support for MT7996 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250311-mt7996-mlo-v2-1-31df6972519b@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: scan: fix setting tx_info fields
Felix Fietkau [Tue, 11 Mar 2025 10:36:45 +0000 (11:36 +0100)]
wifi: mt76: scan: fix setting tx_info fields

ieee80211_tx_prepare_skb initializes the skb cb, so fields need to be set
afterwards.

Link: https://patch.msgid.link/20250311103646.43346-8-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: implement driver specific get_txpower function
Felix Fietkau [Tue, 11 Mar 2025 10:36:44 +0000 (11:36 +0100)]
wifi: mt76: mt7996: implement driver specific get_txpower function

Fixes reporting tx power for vifs that don't have a channel context
assigned. Report the tx power of a phy that is covered by the vif's
radio mask.

Link: https://patch.msgid.link/20250311103646.43346-7-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: only mark tx-status-failed frames as ACKed on mt76x0/2
Felix Fietkau [Tue, 11 Mar 2025 10:36:43 +0000 (11:36 +0100)]
wifi: mt76: only mark tx-status-failed frames as ACKed on mt76x0/2

The interrupt status polling is unreliable, which can cause status events
to get lost. On all newer chips, txs-timeout is an indication that the
packet was either never sent, or never acked.
Fixes issues with inactivity polling.

Link: https://patch.msgid.link/20250311103646.43346-6-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: use the correct vif link for scanning/roc
Felix Fietkau [Tue, 11 Mar 2025 10:36:42 +0000 (11:36 +0100)]
wifi: mt76: mt7996: use the correct vif link for scanning/roc

Use the newly added offchannel_link pointer in vif data

Link: https://patch.msgid.link/20250311103646.43346-5-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: scan: set vif offchannel link for scanning/roc
Felix Fietkau [Tue, 11 Mar 2025 10:36:41 +0000 (11:36 +0100)]
wifi: mt76: scan: set vif offchannel link for scanning/roc

The driver needs to know what vif link to use

Link: https://patch.msgid.link/20250311103646.43346-4-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: remove unnecessary key->cipher check for BIP frames
Michael-CY Lee [Tue, 11 Mar 2025 10:36:40 +0000 (11:36 +0100)]
wifi: mt76: mt7996: remove unnecessary key->cipher check for BIP frames

The cipher type check is redundant, and there is no need to dereference the
key struct here.

Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
Link: https://patch.msgid.link/20250311103646.43346-3-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: fix SER reset trigger on WED reset
Rex Lu [Tue, 11 Mar 2025 10:36:39 +0000 (11:36 +0100)]
wifi: mt76: mt7996: fix SER reset trigger on WED reset

The firmware needs a specific trigger when WED is being reset due to an
ethernet reset condition. This helps prevent further L1 SER failure.

Signed-off-by: Rex Lu <rex.lu@mediatek.com>
Link: https://patch.msgid.link/20250311103646.43346-2-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: revise TXS size
Benjamin Lin [Tue, 11 Mar 2025 10:36:38 +0000 (11:36 +0100)]
wifi: mt76: mt7996: revise TXS size

Size of MPDU/PPDU TXS is 12 DWs.
In mt7996/mt7992, last 4 DWs are reserved, so TXS size was mistakenly
considered to be 8 DWs. However, in mt7990, 9th DW of TXS starts to be used.

Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Link: https://patch.msgid.link/20250311103646.43346-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7996: cleanup mt7996_get_power_bound
Razvan Grigore [Tue, 11 Feb 2025 08:12:47 +0000 (08:12 +0000)]
wifi: mt76: mt7996: cleanup mt7996_get_power_bound

Refactor for making use of mt76_get_power_bound instead of the specific
mt7996_get_power_bound, since we need this for other chipsets as well
when calculating txpower

Signed-off-by: Razvan Grigore <razvan.grigore@vampirebyte.ro>
Link: https://patch.msgid.link/20250211081247.5892-6-razvan.grigore@vampirebyte.ro
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7915: cleanup mt7915_get_power_bound
Razvan Grigore [Tue, 11 Feb 2025 08:12:46 +0000 (08:12 +0000)]
wifi: mt76: mt7915: cleanup mt7915_get_power_bound

Refactor for making use of mt76_get_power_bound instead of the specific
mt7915_get_power_bound, since we need this for other chipsets as well
when calculating txpower

Signed-off-by: Razvan Grigore <razvan.grigore@vampirebyte.ro>
Link: https://patch.msgid.link/20250211081247.5892-5-razvan.grigore@vampirebyte.ro
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: add mt76_get_power_bound helper function
Razvan Grigore [Tue, 11 Feb 2025 08:12:43 +0000 (08:12 +0000)]
wifi: mt76: add mt76_get_power_bound helper function

This will replace mt7915_get_power_bound function from b/mt7915/mcu.h,
since we will need it also for mt7921 and mt7925

Signed-off-by: Razvan Grigore <razvan.grigore@vampirebyte.ro>
Link: https://patch.msgid.link/20250211081247.5892-2-razvan.grigore@vampirebyte.ro
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: add MTCL support to enhance the regulatory compliance
Ming Yen Hsieh [Tue, 4 Mar 2025 11:36:49 +0000 (19:36 +0800)]
wifi: mt76: mt7925: add MTCL support to enhance the regulatory compliance

Apply the MTCL configuration to improving channel availability and
regulatory compliance if MTCL table is supported.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-6-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt792x: extend MTCL of APCI to version3 for EHT control
Ming Yen Hsieh [Tue, 4 Mar 2025 11:36:48 +0000 (19:36 +0800)]
wifi: mt76: mt792x: extend MTCL of APCI to version3 for EHT control

This patch introduces version 3 of the MTCL table, which provides
regulatory information for WiFi 7. It also configured by the platform
vender like the version 1 and 2.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-5-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: remove unused acpi function for clc
Ming Yen Hsieh [Tue, 4 Mar 2025 11:36:47 +0000 (19:36 +0800)]
wifi: mt76: mt7925: remove unused acpi function for clc

The code for handling ACPI configuration in CLC was copied from the mt7921
driver but is not utilized in the mt7925 implementation. So removes the
unused functionality to clean up the codebase.

Cc: stable@vger.kernel.org
Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-4-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: update the channel usage when the regd domain changed
Ming Yen Hsieh [Tue, 4 Mar 2025 11:36:46 +0000 (19:36 +0800)]
wifi: mt76: mt7925: update the channel usage when the regd domain changed

The 5.9/6GHz channel license of a certain platform device has been
regulated in various countries. That may be difference with standard Liunx
regulatory domain settings. In this case, when .reg_notifier() called for
regulatory change, mt7925 chipset should update the channel usage based on
CLC data.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-3-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: add EHT control support based on the CLC data
Ming Yen Hsieh [Tue, 4 Mar 2025 11:36:45 +0000 (19:36 +0800)]
wifi: mt76: mt7925: add EHT control support based on the CLC data

Some countries do not support EHT modulation for now. To prevent violating
regulations, the MT7925 chipset should control the EHT capabilities.
Therefore, when a regulatory domain change is detected during scanning,
the `mt7925_regd_be_ctrl` will process the CLC data to update the EHT
capabilities.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-2-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: load the appropriate CLC data based on hardware type
Ming Yen Hsieh [Tue, 4 Mar 2025 11:36:44 +0000 (19:36 +0800)]
wifi: mt76: mt7925: load the appropriate CLC data based on hardware type

Read the EEPROM to determine the hardware type and uses this to load the
correct CLC data.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250304113649.867387-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: update the power-saving flow
Ming Yen Hsieh [Wed, 5 Mar 2025 00:08:51 +0000 (16:08 -0800)]
wifi: mt76: mt7925: update the power-saving flow

After joining MLO, ensure that all links are setup before
enabling power-saving.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Cc: stable@vger.kernel.org
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-6-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmd
Ming Yen Hsieh [Wed, 5 Mar 2025 00:08:50 +0000 (16:08 -0800)]
wifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmd

Integrate *mlo_sta_cmd and *sta_cmd for the MLO firmware.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Cc: stable@vger.kernel.org
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-5-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure
Ming Yen Hsieh [Wed, 5 Mar 2025 00:08:49 +0000 (16:08 -0800)]
wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure

Removing BSS without removing STAREC first will cause firmware
abnormal and next connection fail.

Fixes: 816161051a03 ("wifi: mt76: mt7925: Cleanup MLO settings post-disconnection")
Cc: stable@vger.kernel.org
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-4-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: fix the wrong simultaneous cap for MLO
Ming Yen Hsieh [Wed, 5 Mar 2025 00:08:48 +0000 (16:08 -0800)]
wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO

The mt7925 chip is only support a single radio, so the maximum
number of simultaneous should be 0.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Cc: stable@vger.kernel.org
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-3-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is present
Ming Yen Hsieh [Wed, 5 Mar 2025 00:08:47 +0000 (16:08 -0800)]
wifi: mt76: mt7925: fix the wrong link_idx when a p2p_device is present

When the p2p device and MLO station are running concurrently, the p2p device
will occupy the wrong link_idx when the MLO secondary link is added.

Fixes: 9e4c3a007f01 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO")
Cc: stable@vger.kernel.org
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-2-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agoRevert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO"
Sean Wang [Wed, 5 Mar 2025 00:08:46 +0000 (16:08 -0800)]
Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO"

For MLO, mac80211 will send the BA action for each link to
the driver, so the driver does not need to handle it itself.
Therefore, revert this patch.

Fixes: eb2a9a12c609 ("wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO")
Cc: stable@vger.kernel.org
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20250305000851.493671-1-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7921: fix kernel panic due to null pointer dereference
Ming Yen Hsieh [Tue, 18 Feb 2025 03:33:42 +0000 (11:33 +0800)]
wifi: mt76: mt7921: fix kernel panic due to null pointer dereference

Address a kernel panic caused by a null pointer dereference in the
`mt792x_rx_get_wcid` function. The issue arises because the `deflink` structure
is not properly initialized with the `sta` context. This patch ensures that the
`deflink` structure is correctly linked to the `sta` context, preventing the
null pointer dereference.

 BUG: kernel NULL pointer dereference, address: 0000000000000400
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI
 CPU: 0 UID: 0 PID: 470 Comm: mt76-usb-rx phy Not tainted 6.12.13-gentoo-dist #1
 Hardware name:  /AMD HUDSON-M1, BIOS 4.6.4 11/15/2011
 RIP: 0010:mt792x_rx_get_wcid+0x48/0x140 [mt792x_lib]
 RSP: 0018:ffffa147c055fd98 EFLAGS: 00010202
 RAX: 0000000000000000 RBX: ffff8e9ecb652000 RCX: 0000000000000000
 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8e9ecb652000
 RBP: 0000000000000685 R08: ffff8e9ec6570000 R09: 0000000000000000
 R10: ffff8e9ecd2ca000 R11: ffff8e9f22a217c0 R12: 0000000038010119
 R13: 0000000080843801 R14: ffff8e9ec6570000 R15: ffff8e9ecb652000
 FS:  0000000000000000(0000) GS:ffff8e9f22a00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000400 CR3: 000000000d2ea000 CR4: 00000000000006f0
 Call Trace:
  <TASK>
  ? __die_body.cold+0x19/0x27
  ? page_fault_oops+0x15a/0x2f0
  ? search_module_extables+0x19/0x60
  ? search_bpf_extables+0x5f/0x80
  ? exc_page_fault+0x7e/0x180
  ? asm_exc_page_fault+0x26/0x30
  ? mt792x_rx_get_wcid+0x48/0x140 [mt792x_lib]
  mt7921_queue_rx_skb+0x1c6/0xaa0 [mt7921_common]
  mt76u_alloc_queues+0x784/0x810 [mt76_usb]
  ? __pfx___mt76_worker_fn+0x10/0x10 [mt76]
  __mt76_worker_fn+0x4f/0x80 [mt76]
  kthread+0xd2/0x100
  ? __pfx_kthread+0x10/0x10
  ret_from_fork+0x34/0x50
  ? __pfx_kthread+0x10/0x10
  ret_from_fork_asm+0x1a/0x30
  </TASK>
 ---[ end trace 0000000000000000 ]---

Reported-by: Nick Morrow <usbwifi2024@gmail.com>
Closes: https://github.com/morrownr/USB-WiFi/issues/577
Cc: stable@vger.kernel.org
Fixes: 90c10286b176 ("wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Tested-by: Salah Coronya <salah.coronya@gmail.com>
Link: https://patch.msgid.link/20250218033343.1999648-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: Simplify HIF suspend handling to avoid suspend fail
Quan Zhou [Mon, 24 Feb 2025 13:05:14 +0000 (21:05 +0800)]
wifi: mt76: mt7925: Simplify HIF suspend handling to avoid suspend fail

System suspend failures may occur due to inappropriate
handling of traffic not idle event by the WiFi driver.
The WiFi firmware's traffic not idle indication does
not need to be tied to suspend. Fix the flow to ensuring
the system can suspend properly.

Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/34208c7280325f57a651363d339399eb1744d3b7.1740400998.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: Remove unnecessary if-check
Thorsten Blum [Sun, 23 Feb 2025 23:21:24 +0000 (00:21 +0100)]
wifi: mt76: mt7925: Remove unnecessary if-check

The if and else branches implement the same logic. Remove the
unnecessary if-check and simplify the code.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20250223232127.99357-2-thorsten.blum@linux.dev
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: Add check for devm_kstrdup()
Haoxiang Li [Wed, 19 Feb 2025 03:36:45 +0000 (11:36 +0800)]
wifi: mt76: Add check for devm_kstrdup()

Add check for the return value of devm_kstrdup() in
mt76_get_of_data_from_mtd() to catch potential exception.

Fixes: e7a6a044f9b9 ("mt76: testmode: move mtd part to mt76_dev")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Link: https://patch.msgid.link/20250219033645.2594753-1-haoxiang_li2024@163.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: fix country count limitation for CLC
Ming Yen Hsieh [Thu, 16 Jan 2025 06:21:31 +0000 (14:21 +0800)]
wifi: mt76: mt7925: fix country count limitation for CLC

Due to the increase in the number of power tables for 6Ghz on CLC,
the variable nr_country is no longer sufficient to represent the
total quantity. Therefore, we have switched to calculating the
length of clc buf to obtain the correct power table.

Cc: stable@vger.kernel.org
Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250116062131.3860198-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: ensure wow pattern command align fw format
Ming Yen Hsieh [Thu, 16 Jan 2025 05:59:25 +0000 (13:59 +0800)]
wifi: mt76: mt7925: ensure wow pattern command align fw format

Align the format of "struct mt7925_wow_pattern_tlv" with
firmware to ensure proper functionality.

Cc: stable@vger.kernel.org
Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Link: https://patch.msgid.link/20250116055925.3856856-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7915: fix possible integer overflows in mt7915_muru_stats_show()
Nikita Zhandarovich [Tue, 14 Jan 2025 15:44:41 +0000 (07:44 -0800)]
wifi: mt76: mt7915: fix possible integer overflows in mt7915_muru_stats_show()

Assuming sums of values stored in variables such as sub_total_cnt
and total_ppdu_cnt are big enough to warrant their u64 type, it
makes sense to ensure that their calculation takes into account
possible integer overflow issues.

Play it safe and fix the problem by casting right hand expressions
to u64 as well. Also, slightly adjust tabulation.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: 1966a5078f2d ("mt76: mt7915: add mu-mimo and ofdma debugfs knobs")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://patch.msgid.link/20250114154441.16920-1-n.zhandarovich@fintech.ru
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: fix fails to enter low power mode in suspend state
Quan Zhou [Tue, 14 Jan 2025 05:06:22 +0000 (13:06 +0800)]
wifi: mt76: mt7925: fix fails to enter low power mode in suspend state

The mt7925 sometimes fails to enter low power mode during suspend.
This is caused by the chip firmware sending an additional ACK event
to the host after processing the suspend command. Due to timing issues,
this event may not reach the host, causing the chip to get stuck.
To resolve this, the ACK flag in the suspend command is removed,
as it is not needed in the MT7925 architecture. This prevents the
firmware from sending the additional ACK event, ensuring the device
can reliably enter low power mode during suspend.

Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Link: https://patch.msgid.link/d056938144a3a0336c3a4e3cec6f271899f32bf7.1736775666.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agowifi: mt76: mt7925: introduce MLO capability control
Ming Yen Hsieh [Mon, 17 Feb 2025 08:17:29 +0000 (16:17 +0800)]
wifi: mt76: mt7925: introduce MLO capability control

This patch introduces MLO capability control for the MT792x Wi-Fi driver.
It removes the unused `MT792x_CHIP_CAP_MLO_EVT_EN` flag and introduces new
capability flags `MT792x_CHIP_CAP_MLO_EN` and `MT792x_CHIP_CAP_MLO_EML_EN`
to enable MLO and EML features based on firmware capabilities.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Reviewed-by: Sabeeh Khan <sabeeh-khan@ti.com>
Link: https://patch.msgid.link/20250217081729.1840930-1-mingyen.hsieh@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 months agoMerge tag 'rtw-next-2025-03-13' of https://github.com/pkshih/rtw
Johannes Berg [Wed, 19 Mar 2025 08:34:40 +0000 (09:34 +0100)]
Merge tag 'rtw-next-2025-03-13' of https://github.com/pkshih/rtw

Ping-Ke Shih says:
====================
rtw-next patches for v6.15

Some minor fixes and refinements of rtw89.

The only major change is rtw88:

 * support RTL8814AE/RTL8814AU
====================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: nl80211: re-enable multi-link reconfiguration
Johannes Berg [Tue, 18 Mar 2025 12:50:08 +0000 (13:50 +0100)]
wifi: nl80211: re-enable multi-link reconfiguration

With the recent fixes, we can re-enable multi-link
reconfiguration. Also add a CMD() entry to allow
userspace discovery for it.

Link: https://patch.msgid.link/20250318135009.a95c43837a0f.Ic6ed3d184e5be8ba47c6affa7271daaf824fd823@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: dvm: Avoid -Wflex-array-member-not-at-end warnings
Gustavo A. R. Silva [Thu, 15 Aug 2024 19:00:23 +0000 (13:00 -0600)]
wifi: iwlwifi: dvm: Avoid -Wflex-array-member-not-at-end warnings

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

So, in order to avoid ending up with a flexible-array member in the
middle of multiple other structs, we use the `__struct_group()`
helper to create a new tagged `struct iwl_tx_cmd_hdr`. This structure
groups together all the members of the flexible `struct iwl_tx_cmd`
except the flexible array.

As a result, the array is effectively separated from the rest of the
members without modifying the memory layout of the flexible structure.
We then change the type of the middle struct members currently causing
trouble from `struct iwl_tx_cmd` to `struct iwl_tx_cmd_hdr`.

We also want to ensure that when new members need to be added to the
flexible structure, they are always included within the newly created
tagged struct. For this, we use `static_assert()`. This ensures that the
memory layout for both the flexible structure and the new tagged struct
is the same after any changes.

This approach avoids having to implement `struct iwl_tx_cmd_hdr`
as a completely separate structure, thus preventing having to maintain
two independent but basically identical structures, closing the door
to potential bugs in the future.

So, with these changes, fix the following warnings:

drivers/net/wireless/intel/iwlwifi/dvm/commands.h:2315:27: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/intel/iwlwifi/dvm/commands.h:2426:27: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/Zr5QR03+wyw571zd@elsanto
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: do not use iwlmld for non-wifi7 devices
Emmanuel Grumbach [Tue, 18 Mar 2025 09:29:44 +0000 (10:29 +0100)]
wifi: iwlwifi: do not use iwlmld for non-wifi7 devices

Roll-back to use iwlmvm for those devices. iwlmld will support wifi7
capable devices only. The firmware for the non-wifi7 capable will soon
be frozen and we don't want iwlmld to have to support devices that will
require the old APIs.

Fixes: d1e879ec600f9 ("wifi: iwlwifi: add iwlmld sub-driver")
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20250318103019.df6df96df826.I0020ca9f6c6c928caa78721666df131a692c6186@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remove a buggy else statement in op_mode selection
Emmanuel Grumbach [Tue, 18 Mar 2025 09:29:43 +0000 (10:29 +0100)]
wifi: iwlwifi: remove a buggy else statement in op_mode selection

This led to weird behavior. The next debug print was not printed.

Fixes: d1e879ec600f9 ("wifi: iwlwifi: add iwlmld sub-driver")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20250318103019.bf54d0474909.Icfb129d4cf13b42b13e2ac4aa1bd171ef46bf561@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mwifiex: Fix RF calibration data download from file
Jeff Chen [Tue, 18 Mar 2025 05:07:39 +0000 (13:07 +0800)]
wifi: mwifiex: Fix RF calibration data download from file

This patch resolves an issue where RF calibration data from a
file could not be downloaded to the firmware. The feature to
download calibration data from a file was broken by the commit:
d39fbc88956e.

The issue arose because the function `mwifiex_cmd_cfg_data()`
was modified in a way that prevented proper handling of
file-based calibration data. While this patch restores the ability
to download RF calibration data from a file, it may inadvertently
break the feature to download calibration data from the device
tree. This is because the function `mwifiex_dnld_dt_cfgdata()`,
which also relies on `mwifiex_cmd_cfg_data()`, is still used for
device tree-based calibration data downloads.

Fixes: d39fbc88956e ("mwifiex: remove cfg_data construction")
Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
Link: https://patch.msgid.link/20250318050739.2239376-3-jeff.chen_1@nxp.com
[add newline for shorter lines]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mwifiex: Fix premature release of RF calibration data.
Jeff Chen [Tue, 18 Mar 2025 05:07:38 +0000 (13:07 +0800)]
wifi: mwifiex: Fix premature release of RF calibration data.

This patch resolves an issue where RF calibration data was being
released before the download process. Without this fix, the
external calibration data file would not be downloaded
at all.

Fixes: d39fbc88956e ("mwifiex: remove cfg_data construction")
Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
Link: https://patch.msgid.link/20250318050739.2239376-2-jeff.chen_1@nxp.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>