Kalle Valo [Thu, 3 Aug 2023 18:16:27 +0000 (21:16 +0300)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git
ath.git patches for v6.6. Major changes:
ath12k
* Extremely High Throughput (EHT) PHY support for Wi-Fi 7
Ping-Ke Shih [Tue, 1 Aug 2023 02:11:27 +0000 (10:11 +0800)]
wifi: rtw89: return failure if needed firmware elements are not recognized
WiFi 7 chips doesn't have static const tables defined in driver. If tables
aren't loaded properly from firmware file, driver can get NULL pointer
access exception. One way is to add the checking statements when trying to
access these tables, but I choose to check them right after loading
firmware elements from firmware file, so I don't need to add error handlers
everywhere.
Currently, the needed firmware elements of WiFi 6 chips are all zero, and
coming WiFi 7 chip will need at least BB MCU, parameters of BB and RF.
We will add them after 8922AE is verified.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-9-pkshih@realtek.com
Ping-Ke Shih [Tue, 1 Aug 2023 02:11:26 +0000 (10:11 +0800)]
wifi: rtw89: add to parse firmware elements of BB and RF tables
The tables of BB and RF parameters are pairs of {addr, value}. Load them
and convert from little-endian to CPU order, and show the version to clear
which version we are using.
rtw89_8922ae 0000:03:00.0: Firmware element BB version: 00 04 00 00
rtw89_8922ae 0000:03:00.0: Firmware element radio A version: 00 13 00 00
rtw89_8922ae 0000:03:00.0: Firmware element NCTL version: 00 05 00 00
We use tables defined in firmware elements with higher priority than
original static const tables defined in driver, because WiFi 7 chips will
not define the tables in driver, and existing chips can possibly migrate to
the new design one by one.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-8-pkshih@realtek.com
Ping-Ke Shih [Tue, 1 Aug 2023 02:11:25 +0000 (10:11 +0800)]
wifi: rtw89: introduce infrastructure of firmware elements
In order to pack more data into firmware file, we introduce firmware
elements and append BB_MCU firmware first. The first part of new firmware
file is still unchanged firmware of WiFi CPU, so the new firmware format
can be backward compatible to old format. The new elements part consists
of ID and size basically, which can append more elements simply. To avoid
unaligned access in certain platform and be easy to read, headers of all
elements start at 16-byte aligned address.
+===========================================+
| original firmware |
| +-------------+
| | padding |
+===========================================+
| elm ID 1 | elm size | other header data |
+----------+----------+ |
| |
+-------------------------------------------+
| content (variable length) |
| +-------------+
| | padding |
+===========================================+
| elm ID 2 | elm size | other header data |
+----------+----------+ |
| |
+-------------------------------------------+
| content (variable length) |
| +-----------------------+
| | (no padding for the last one)
+===================+
More detail of element header is shown below. The additional fields
'version' and 'element_priv[]' are meta data of elements, so that we can
know element version easily, and element_priv[] provide specific fields
for certain element, such as RF path index for RF parameter tables.
+===========================================+
| elm ID | elm size | version | rsvd0 |
+----------+----------+----------+----------+
| rsvd1/2 | element_priv[] |
+-------------------------------------------+
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-7-pkshih@realtek.com
Ping-Ke Shih [Tue, 1 Aug 2023 02:11:24 +0000 (10:11 +0800)]
wifi: rtw89: add firmware suit for BB MCU 0/1
For existing chips, firmware is only for WiFi CPU, but WiFi 7 chips add
new hardware component BB MCU that needs firmware as well. The firmwares of
BB MCU 0/1 are also downloaded via the same path like WiFi CPU firmware,
and use the same firmware header format, so add firmware suits to access
them commonly.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-6-pkshih@realtek.com
Ping-Ke Shih [Tue, 1 Aug 2023 02:11:23 +0000 (10:11 +0800)]
wifi: rtw89: add firmware parser for v1 format
A firmware with v1 format contains many sections to download. Add parser to
read section type, target address, length, checksum and so on, and then
download the section to WiFi CPU with proper location.
The additional dynamic header length named dynamic_hdr_len is used to
skip content of dynamic header containing compiler flags of firmware, which
can help to determine variant firmware build, but currently rtw89 only
use single one variant. So, just skip the content.
The layout of a WiFi CPU firmware with v1 format looks like:
+---------------------------------------+
| Header (12 words) |
+---------------------------------------+
| Section header 1 (4 words) |
| Section header 2 (4 words) |
| Section header 3 (4 words) |
| ... |
+---------------------------------------+
| Dynamic header (variable length) |
+---------------------------------------+
| Data used & pointed by section |
| ... |
+---------------------------------------+
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-5-pkshih@realtek.com
Ping-Ke Shih [Tue, 1 Aug 2023 02:11:22 +0000 (10:11 +0800)]
wifi: rtw89: introduce v1 format of firmware header
New firmware header is used by upcoming WiFi 7 chips to have more
information, so use common field w3[31:24] to determine header version,
and then use corresponding function to read firmware version and commit ID:
rtw89_8852be 0000:03:00.0: Firmware version 0.29.29.1 (
799134c3), cmd version 1, type 5
rtw89_8852be 0000:03:00.0: Firmware version 0.29.29.1 (
799134c3), cmd version 1, type 3
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-4-pkshih@realtek.com
Chin-Yen Lee [Tue, 1 Aug 2023 02:11:21 +0000 (10:11 +0800)]
wifi: rtw89: support firmware log with formatted text
Original firmware log which is sent via C2H message bloats
code size of firmware and is also length-limited. So we put
some common log into format file, and firmware could use a
log ID and some variables in C2H message to map a formatted
text via pre-designed rule.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-3-pkshih@realtek.com
Chin-Yen Lee [Tue, 1 Aug 2023 02:11:20 +0000 (10:11 +0800)]
wifi: rtw89: recognize log format from firmware file
Firmware log format is an element of multi-firmware file
and used for firmware to provide log with formatted text.
Driver needs to recognize it in advance if it exists.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-2-pkshih@realtek.com
Wen Gong [Tue, 18 Jul 2023 02:47:24 +0000 (22:47 -0400)]
wifi: ath12k: avoid deadlock by change ieee80211_queue_work for regd_update_work
Deadlock is easily happened while shutdown wlan interface such as run
"ifconfig wlan0 down".
The reason is because when ar->regd_update_work is ran, it will
call wiphy_lock(ar->hw->wiphy) in function ath12k_regd_update() which
is running in workqueue of ieee80211_local queued by ieee80211_queue_work().
Another thread from "ifconfig wlan0 down" will also accuqire the lock
by wiphy_lock(sdata->local->hw.wiphy) in function ieee80211_stop(), and
then it call ieee80211_stop_device() to flush_workqueue(local->workqueue),
this will wait the workqueue of ieee80211_local finished. Then deadlock
will happen easily if the two thread run meanwhile.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230718024724.29120-1-quic_wgong@quicinc.com
Wen Gong [Mon, 17 Jul 2023 03:44:57 +0000 (23:44 -0400)]
wifi: ath12k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED
When wlan interface is up, and 11d scan is sent to the firmware, then
firmware needs to spend couple of seconds to complete the 11d scan. If
normal scan from user space arrives to ath12k at this moment, then the
normal scan request is also sent to the firmware, but the scan started
event will be reported to ath12k until the 11d scan complete. When timed
out for the scan started in ath12k, ath12k stops the normal scan and the
firmware reports WMI_SCAN_EVENT_DEQUEUED to ath12k for the normal scan.
ath12k has no handler for the event and then timed out for the scan
completed in ath12k_scan_stop(), and ath12k prints the following error
message.
[ 1491.604750] ath12k_pci 0000:02:00.0: failed to receive scan abort comple: timed out
[ 1491.604756] ath12k_pci 0000:02:00.0: failed to stop scan: -110
[ 1491.604758] ath12k_pci 0000:02:00.0: failed to start hw scan: -110
Add a handler for WMI_SCAN_EVENT_DEQUEUED and then complete the scan to
get rid of the above error message.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230717034457.22162-1-quic_wgong@quicinc.com
Dmitry Antipov [Wed, 2 Aug 2023 17:04:09 +0000 (20:04 +0300)]
wifi: ath12k: relax list iteration in ath12k_mac_vif_unref()
In ath12k_mac_vif_unref() dp->tx_desc_used_list[i]
is not altered so list_for_each_entry() should be safe.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230704173718.73462-1-dmantipov@yandex.ru
Aloka Dixit [Wed, 2 Aug 2023 17:04:07 +0000 (20:04 +0300)]
wifi: ath12k: configure puncturing bitmap
Enable the feature flag to indicate the driver support for
preamble puncturing. Firmware will support this feature
by default from IEEE 802.11be onwards.
Configure the bitmap as part of VDEV start/restart and
peer association commands.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-12-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:06 +0000 (20:04 +0300)]
wifi: ath12k: parse WMI service ready ext2 event
Parse WMI service ready ext2 event.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-11-quic_alokad@quicinc.com
Pradeep Kumar Chitrapu [Wed, 2 Aug 2023 17:04:06 +0000 (20:04 +0300)]
wifi: ath12k: add MLO header in peer association
Add tags with length 0 for MLO header and partner links which
are required by the firmware for a successful association.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-10-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:05 +0000 (20:04 +0300)]
wifi: ath12k: peer assoc for 320 MHz
Add required peer association definitions and processing if the
bandwidth is 320 MHz.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu<quic_pradeepc@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-9-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:04 +0000 (20:04 +0300)]
wifi: ath12k: add WMI support for EHT peer
Add new WMI tag and pass the EHT parameters for peer association
to firmware.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-8-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:04 +0000 (20:04 +0300)]
wifi: ath12k: prepare EHT peer assoc parameters
Add new parameters and prepare the association data for an EHT peer.
MCS data uses the format described in IEEE P802.11be/D2.0, May 2022,
9.4.2.313.4, convert it into the format expected by the firmware.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-7-quic_alokad@quicinc.com
Muna Sinada [Wed, 2 Aug 2023 17:04:03 +0000 (20:04 +0300)]
wifi: ath12k: add EHT PHY modes
Add support to retrieve and configure the phy modes supported
by the hardware.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-6-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:02 +0000 (20:04 +0300)]
wifi: ath12k: propagate EHT capabilities to userspace
Propagate EHT capabilities to the userspace using a new member
'eht_cap' in structure ieee80211_sband_iftype_data.
MCS-NSS capabilities are copied depending on the supported bandwidths
for the given band.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu<quic_pradeepc@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-5-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:02 +0000 (20:04 +0300)]
wifi: ath12k: WMI support to process EHT capabilities
Add WMI support to process the EHT capabilities passed by
the firmware. Add required EHT specific definitions in
structures ath12k_band_cap and ath12k_wmi_svc_rdy_ext_parse.
For single_pdev chip such as WCN7850, only one pdev is created
and only one hardware is registered to mac80211. This one pdev
manages both 2.4 GHz radio and 5 GHz/6 GHz radio.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Co-developed-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Co-developed-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-4-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:01 +0000 (20:04 +0300)]
wifi: ath12k: move HE capabilities processing to a new function
The function ath12k_mac_copy_sband_iftype_data() is currently
used HE capabilities propagation but it can be extended to
include EHT data. Move the HE specific functionality from to
ath12k_mac_copy_he_cap() to make EHT additions easier.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-3-quic_alokad@quicinc.com
Aloka Dixit [Wed, 2 Aug 2023 17:04:00 +0000 (20:04 +0300)]
wifi: ath12k: rename HE capabilities setup/copy functions
Functions ath12k_mac_setup_he_cap() and ath12k_mac_copy_he_cap()
propagate HE and 6GHz capabilities to the userspace using an instance
of struct ieee80211_sband_iftype_data. This structure now has a new
member 'eht_cap' to include EHT capabilities as well.
Rename the above mentioned functions to indicate that their use is not
limited to HE.
Also, replace the local variable 'band' with 'sband' and reuse
'band' for the type enum nl80211_band.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230725224034.14045-2-quic_alokad@quicinc.com
Wen Gong [Mon, 17 Jul 2023 03:34:31 +0000 (23:34 -0400)]
wifi: ath12k: change to use dynamic memory for channel list of scan
Currently there are about 60 channels for 6 GHz, then the size of
chan_list in struct scan_req_params which is 40 is not enough to
fill all the channel list of 6 GHz.
Use dynamic memory to save the channel list of scan.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230717033431.21983-1-quic_wgong@quicinc.com
Wen Gong [Fri, 14 Jul 2023 09:25:55 +0000 (05:25 -0400)]
wifi: ath12k: trigger station disconnect on hardware restart
Currently after the hardware restart triggered from the driver, the
station interface connection remains intact, since a disconnect
trigger is not sent to userspace. This can lead to a problem in
targets where the wifi mac sequence is added by the firmware.
After the target restart, its wifi mac sequence number gets reset to
zero. Hence AP to which our device is connected will receive frames
with a wifi mac sequence number jump to the past, thereby resulting
in the AP dropping all these frames, until the frame arrives with a
wifi mac sequence number which AP was expecting.
To avoid such frame drops, its better to trigger a station disconnect
upon target hardware restart which can be done with API
ieee80211_reconfig_disconnect exposed to mac80211.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230714092555.2018-1-quic_wgong@quicinc.com
Baochen Qiang [Fri, 14 Jul 2023 08:06:58 +0000 (16:06 +0800)]
wifi: ath12k: Use pdev_id rather than mac_id to get pdev
We are seeing kernel crash in below test scenario:
1. make DUT connect to an WPA3 encrypted 11ax AP in Ch44 HE80
2. use "wpa_cli -i <inf> disconnect" to disconnect
3. wait for DUT to automatically reconnect
Kernel crashes while waiting, below shows the crash stack:
[ 755.120868] BUG: kernel NULL pointer dereference, address:
0000000000000000
[ 755.120871] #PF: supervisor read access in kernel mode
[ 755.120872] #PF: error_code(0x0000) - not-present page
[ 755.120873] PGD 0 P4D 0
[ 755.120875] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ 755.120876] CPU: 7 PID: 0 Comm: swapper/7 Kdump: loaded Not tainted 5.19.0-rc1+ #3
[ 755.120878] Hardware name: Intel(R) Client Systems NUC11PHi7/NUC11PHBi7, BIOS PHTGL579.0063.2021.0707.1057 07/07/2021
[ 755.120879] RIP: 0010:ath12k_dp_process_rx_err+0x2b6/0x14a0 [ath12k]
[ 755.120890] Code: 01 c0 48 c1 e0 05 48 8b 9c 07 b8 b2 00 00 48 c7 c0 61 ff 0e c1 48 85 db 53 48 0f 44 c6 48 c7 c6 80 9d 0f c1 50 e8 1a 25 00 00 <4c> 8b 3b 4d 8b 76 14 41 59 41 5a 41 8b 87 78 43 01 00 4d 85 f6 89
[ 755.120891] RSP: 0018:
ffff9a93402c8d10 EFLAGS:
00010282
[ 755.120892] RAX:
0000000000000000 RBX:
0000000000000000 RCX:
0000000000000303
[ 755.120893] RDX:
0000000000000000 RSI:
ffffffff93b7cbe9 RDI:
00000000ffffffff
[ 755.120894] RBP:
ffff9a93402c8e50 R08:
ffffffff93e65360 R09:
ffffffff942e044d
[ 755.120894] R10:
0000000000000000 R11:
0000000000000063 R12:
ffff8dbec5420000
[ 755.120895] R13:
ffff8dbec5420000 R14:
ffff8dbdefe9a0a0 R15:
ffff8dbec5420000
[ 755.120896] FS:
0000000000000000(0000) GS:
ffff8dc2705c0000(0000) knlGS:
0000000000000000
[ 755.120897] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 755.120898] CR2:
0000000000000000 CR3:
0000000107be4005 CR4:
0000000000770ee0
[ 755.120898] PKRU:
55555554
[ 755.120899] Call Trace:
[ 755.120900] <IRQ>
[ 755.120903] ? ath12k_pci_write32+0x2e/0x80 [ath12k]
[ 755.120910] ath12k_dp_service_srng+0x214/0x2e0 [ath12k]
[ 755.120917] ath12k_pci_ext_grp_napi_poll+0x26/0x80 [ath12k]
[ 755.120923] __napi_poll+0x2b/0x1c0
[ 755.120925] net_rx_action+0x2a1/0x2f0
[ 755.120927] __do_softirq+0xfa/0x2e9
[ 755.120929] irq_exit_rcu+0xb9/0xd0
[ 755.120932] common_interrupt+0xc1/0xe0
[ 755.120934] </IRQ>
[ 755.120934] <TASK>
[ 755.120935] asm_common_interrupt+0x2c/0x40
[ 755.120936] RIP: 0010:cpuidle_enter_state+0xdd/0x3a0
[ 755.120938] Code: 00 31 ff e8 45 e2 74 ff 80 7d d7 00 74 16 9c 58 0f 1f 40 00 f6 c4 02 0f 85 a0 02 00 00 31 ff e8 69 79 7b ff fb 0f 1f 44 00 00 <45> 85 ff 0f 88 6d 01 00 00 49 63 d7 4c 2b 6d c8 48 8d 04 52 48 8d
[ 755.120939] RSP: 0018:
ffff9a934018be50 EFLAGS:
00000246
[ 755.120940] RAX:
ffff8dc2705c0000 RBX:
0000000000000002 RCX:
000000000000001f
[ 755.120941] RDX:
000000afd0b532d3 RSI:
ffffffff93b7cbe9 RDI:
ffffffff93b8b66e
[ 755.120942] RBP:
ffff9a934018be88 R08:
0000000000000002 R09:
0000000000030500
[ 755.120942] R10:
ffff9a934018be18 R11:
0000000000000741 R12:
ffffba933fdc0600
[ 755.120943] R13:
000000afd0b532d3 R14:
ffffffff93fcbc60 R15:
0000000000000002
[ 755.120945] cpuidle_enter+0x2e/0x40
[ 755.120946] call_cpuidle+0x23/0x40
[ 755.120948] do_idle+0x1ff/0x260
[ 755.120950] cpu_startup_entry+0x1d/0x20
[ 755.120951] start_secondary+0x10d/0x130
[ 755.120953] secondary_startup_64_no_verify+0xd3/0xdb
[ 755.120956] </TASK>
[ 755.120956] Modules linked in: michael_mic rfcomm cmac algif_hash algif_skcipher af_alg bnep qrtr_mhi intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio kvm_intel qrtr snd_hda_codec_hdmi kvm irqbypass ath12k snd_hda_intel snd_seq_midi crct10dif_pclmul mhi ghash_clmulni_intel snd_intel_dspcfg snd_seq_midi_event aesni_intel qmi_helpers i915 snd_rawmidi crypto_simd snd_hda_codec cryptd cec intel_cstate snd_hda_core mac80211 rc_core nouveau snd_seq snd_hwdep btusb drm_buddy drm_ttm_helper nls_iso8859_1 snd_pcm ttm btrtl snd_seq_device wmi_bmof mxm_wmi input_leds cfg80211 joydev btbcm drm_display_helper snd_timer btintel mei_me libarc4 drm_kms_helper bluetooth i2c_algo_bit snd fb_sys_fops syscopyarea mei sysfillrect ecdh_generic soundcore sysimgblt ecc acpi_pad mac_hid sch_fq_codel ipmi_devintf ipmi_msghandler msr parport_pc ppdev lp ramoops parport reed_solomon drm efi_pstore ip_tables x_tables autofs4
[ 755.120992] hid_generic usbhid hid ax88179_178a usbnet mii nvme nvme_core rtsx_pci_sdmmc crc32_pclmul i2c_i801 intel_lpss_pci i2c_smbus intel_lpss rtsx_pci idma64 virt_dma vmd wmi video
[ 755.121002] CR2:
0000000000000000
The crash is because, for WCN7850, only ab->pdev[0] is initialized, while mac_id here is
misused to retrieve pdev and it is not zero, leading to a NULL pointer access.
Fix this issue by getting pdev_id first and then use it to retrieve pdev.
Also fix some other code snippets which have the same issue.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230714080658.3140-1-quic_bqiang@quicinc.com
Wen Gong [Fri, 14 Jul 2023 07:24:05 +0000 (03:24 -0400)]
wifi: ath12k: avoid array overflow of hw mode for preferred_hw_mode
Currently ath12k define WMI_HOST_HW_MODE_DBS_OR_SBS=5 as max hw mode
for enum wmi_host_hw_mode_config_type, it is also same for the array
ath12k_hw_mode_pri_map.
When tested with new version firmware/board data which support new
hw mode eMLSR mode with hw mode value 8, it leads overflow usage for
array ath12k_hw_mode_pri_map in function ath12k_wmi_hw_mode_caps(),
and then lead preferred_hw_mode changed to 8, and finally function
ath12k_pull_mac_phy_cap_svc_ready_ext() select the capability of hw
mode 8, but the capability of eMLSR mode report from firmware does
not support 2.4 GHz band for WCN7850, so finally 2.4 GHz band is
disabled.
Skip the hw mode which exceeds WMI_HOST_HW_MODE_MAX in function
ath12k_wmi_hw_mode_caps() helps to avoid array overflow, then the 2.4
GHz band will not be disabled.
This is to keep compatibility with newer version firmware/board data
files, this change is still needed after ath12k add eMLSR hw mode 8 in
array ath12k_hw_mode_pri_map and enum wmi_host_hw_mode_config_type,
because more hw mode maybe added in next firmware/board data version
e.g hw mode 9, then it will also lead new array overflow without this
change.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230714072405.28705-1-quic_wgong@quicinc.com
Arnd Bergmann [Mon, 3 Jul 2023 12:37:29 +0000 (14:37 +0200)]
wifi: ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he()
Two memory copies in this function copy from a short array into a longer one,
using the wrong size, which leads to an out-of-bounds access:
include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
__read_overflow2_field(q_size_field, size);
^
include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
2 errors generated.
Fixes: d889913205cf7 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230703123737.3420464-1-arnd@kernel.org
Wen Gong [Wed, 26 Jul 2023 09:38:57 +0000 (05:38 -0400)]
wifi: ath12k: correct the data_type from QMI_OPT_FLAG to QMI_UNSIGNED_1_BYTE for mlo_capable
Currently, the encoding rule for field mlo_capable in struct
qmi_wlanfw_host_cap_req_msg_v01 defined in array
qmi_wlanfw_host_cap_req_msg_v01_ei uses type QMI_OPT_FLAG.
Unfortunately, all ath12k firmware actually expects this field to be of
type NON QMI_OPT_FLAG such as QMI_UNSIGNED_1_BYTE/QMI_UNSIGNED_8_BYTE...
And as a result, firmware is unable to correctly decode the mlo_capable
field.
Change the ath12k definition as QMI_UNSIGNED_1_BYTE to match the firmware
definition so that firmware can correctly parse the mlo_capable info from
message QMI_WLANFW_HOST_CAP_REQ_V01 at wlan load time.
This is just an accidental typo and that both WCN7850 and QCN9274 firmwares
use QMI_UNSIGNED_1_BYTE.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726093857.3610-1-quic_wgong@quicinc.com
Wen Gong [Wed, 26 Jul 2023 09:26:25 +0000 (05:26 -0400)]
wifi: ath12k: Fix a NULL pointer dereference in ath12k_mac_op_hw_scan()
In ath12k_mac_op_hw_scan(), the return value of kzalloc() is directly
used in memcpy(), which may lead to a NULL pointer dereference on
failure of kzalloc().
Fix this bug by adding a check of arg.extraie.ptr.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726092625.3350-1-quic_wgong@quicinc.com
Seevalamuthu Mariappan [Wed, 26 Jul 2023 14:10:32 +0000 (19:40 +0530)]
wifi: ath11k: Remove cal_done check during probe
In some race conditions, calibration done QMI message is received even
before host wait starts for calibration to be done.
Due to this, resetting firmware was not performed after calibration.
Hence, remove cal_done check in ath11k_qmi_fwreset_from_cold_boot()
as this is called only from probe.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Signed-off-by: Seevalamuthu Mariappan <quic_seevalam@quicinc.com>
Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726141032.3061-4-quic_rajkbhag@quicinc.com
Anilkumar Kolli [Wed, 26 Jul 2023 14:10:31 +0000 (19:40 +0530)]
wifi: ath11k: Add coldboot calibration support for QCN9074
QCN9074 supports 6 GHz, which has increased number of channels
compared to 5 GHz/2 GHz. So, to support coldboot calibration in
QCN9074 ATH11K_COLD_BOOT_FW_RESET_DELAY extended to 60 seconds. To
avoid code redundancy, fwreset_from_cold_boot moved to QMI and made
common for both ahb and pci. Coldboot calibration is enabled only in
FTM mode for QCN9074. QCN9074 requires firmware restart after coldboot,
hence enable cbcal_restart_fw in hw_params.
This support can be enabled/disabled using hw params for different
hardware. Currently it is not enabled for QCA6390.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Signed-off-by: Anilkumar Kolli <quic_akolli@quicinc.com>
Signed-off-by: Seevalamuthu Mariappan <quic_seevalam@quicinc.com>
Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726141032.3061-3-quic_rajkbhag@quicinc.com
Seevalamuthu Mariappan [Wed, 26 Jul 2023 14:10:30 +0000 (19:40 +0530)]
wifi: ath11k: Split coldboot calibration hw_param
QCN9074 enables coldboot calibration only in Factory Test Mode (FTM).
Hence, split cold_boot_calib to two hw_params for mission and FTM
mode.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
Signed-off-by: Seevalamuthu Mariappan <quic_seevalam@quicinc.com>
Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726141032.3061-2-quic_rajkbhag@quicinc.com
Dmitry Antipov [Wed, 26 Jul 2023 09:21:02 +0000 (12:21 +0300)]
wifi: ath11k: simplify ath11k_mac_validate_vht_he_fixed_rate_settings()
In ath11k_mac_validate_vht_he_fixed_rate_settings() ar->ab->peers
list is not altered so list_for_each_entry() should be safe.
Compile tested only.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726092113.78794-1-dmantipov@yandex.ru
Aditya Kumar Singh [Wed, 26 Jul 2023 04:46:24 +0000 (10:16 +0530)]
wifi: ath11k: fix band selection for ppdu received in channel 177 of 5 GHz
5 GHz band channel 177 support was added with the commit
e5e94d10c856 ("wifi:
ath11k: add channel 177 into 5 GHz channel list"). However, during processing
for the received ppdu in ath11k_dp_rx_h_ppdu(), channel number is checked only
till 173. This leads to driver code checking for channel and then fetching the
band from it which is extra effort since firmware has already given the channel
number in the metadata.
Fix this issue by checking the channel number till 177 since we support
it now.
Found via code review. Compile tested only.
Fixes: e5e94d10c856 ("wifi: ath11k: add channel 177 into 5 GHz channel list")
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230726044624.20507-1-quic_adisi@quicinc.com
Dmitry Antipov [Mon, 31 Jul 2023 07:43:07 +0000 (10:43 +0300)]
wifi: mwifiex: fix error recovery in PCIE buffer descriptor management
Add missing 'kfree_skb()' in 'mwifiex_init_rxq_ring()' and never do
'kfree(card->rxbd_ring_vbase)' because this area is DMAed and should
be released with 'dma_free_coherent()'. The latter is performed in
'mwifiex_pcie_delete_rxbd_ring()', which is now called to recover
from possible errors in 'mwifiex_pcie_create_rxbd_ring()'. Likewise
for 'mwifiex_pcie_init_evt_ring()', 'kfree(card->evtbd_ring_vbase)'
'mwifiex_pcie_delete_evtbd_ring()' and 'mwifiex_pcie_create_rxbd_ring()'.
Fixes: d930faee141b ("mwifiex: add support for Marvell pcie8766 chipset")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230731074334.56463-1-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 16:23:46 +0000 (19:23 +0300)]
wifi: brcmsmac: cleanup SCB-related data types
Drop unused and set-but-unused fields of 'struct scb_ampdu_tid_ini',
'struct scb_ampdu' and 'struct scb', as well as now unused argument
of 'brcms_c_ampdu_tx_operational()', adjust related code.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725162400.192357-2-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 16:23:45 +0000 (19:23 +0300)]
wifi: brcmsmac: remove more unused data types
Remove unused 'struct brcmu_iovar' and 'struct tx_inst_power'. This
follows commit
b2090d93d4b6 ("wifi: brcmsmac: remove unused data type").
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725162400.192357-1-dmantipov@yandex.ru
Azeem Shaikh [Mon, 3 Jul 2023 18:12:56 +0000 (18:12 +0000)]
wifi: mt76: Replace strlcpy() with strscpy()
strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().
Direct replacement is safe here since DEV_ASSIGN is only used by
TRACE macros and the return values are ignored.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89
Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230703181256.3712079-1-azeemshaikh38@gmail.com
Kalle Valo [Wed, 2 Aug 2023 09:36:37 +0000 (12:36 +0300)]
Merge tag 'mt76-for-kvalo-2023-07-31' of https://github.com/nbd168/wireless
mt76 patches for 6.6
* fixes
* preparation for mt7925 support
* mt7981 support
Dmitry Antipov [Tue, 25 Jul 2023 06:04:48 +0000 (09:04 +0300)]
wifi: libertas: prefer kstrtoX() for simple integer conversions
Prefer 'kstrtoX()' family of functions over 'sscanf()' to convert
strings to integers and always check results of the conversions.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725060531.72968-6-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 06:04:47 +0000 (09:04 +0300)]
wifi: libertas: handle possible spu_write_u16() errors
Check and handle (well, report at least, as it's done through the rest
of the module) possible 'spu_write_u16()' errors in 'if_spi_e2h()'.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725060531.72968-5-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 06:04:46 +0000 (09:04 +0300)]
wifi: libertas: cleanup SDIO reset
Embed SDIO reset worker in 'struct if_sdio_card' and so
drop 'reset_host' and 'card_reset_work' static variables,
adjust related code. Not sure whether it's possible to do
something useful on 'mmc_add_host()' error, so just add
'dev_err()' to emit an error message.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725060531.72968-4-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 06:04:45 +0000 (09:04 +0300)]
wifi: libertas: simplify list operations in free_if_spi_card()
Use 'list_for_each_entry_safe()' to simplify
list operations in 'free_if_spi_card()'.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725060531.72968-3-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 06:04:44 +0000 (09:04 +0300)]
wifi: libertas: use convenient lists to manage SDIO packets
Use convenient lists to manage SDIO packets, adjust
'struct if_sdio_packet', 'struct if_sdio_card' and
related code accordingly.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725060531.72968-2-dmantipov@yandex.ru
Dmitry Antipov [Tue, 25 Jul 2023 06:04:43 +0000 (09:04 +0300)]
wifi: libertas: add missing calls to cancel_work_sync()
Add missing 'cancel_work_sync()' in 'if_sdio_remove()'
and on error handling path in 'if_sdio_probe()'.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Tested-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230725060531.72968-1-dmantipov@yandex.ru
Rob Herring [Mon, 24 Jul 2023 21:19:13 +0000 (15:19 -0600)]
wifi: drivers: Explicitly include correct DT includes
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230724211914.805876-1-robh@kernel.org
Amisha Patel [Mon, 24 Jul 2023 16:40:00 +0000 (16:40 +0000)]
wifi: wilc1000: add SPI commands retry mechanism
In some situations like, chip wake-up with powersave enabled, SPI
commands are failing temporarily. Reissuing commands after reset helps
to overcome the failure. So, add the retry limit and reset command
sequence API for read/write SPI commands.
Signed-off-by: Amisha Patel <amisha.patel@microchip.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230724163955.4583-1-amisha.patel@microchip.com
Polaris Pi [Sun, 23 Jul 2023 07:07:41 +0000 (07:07 +0000)]
wifi: mwifiex: Fix OOB and integer underflow when rx packets
Make sure mwifiex_process_mgmt_packet,
mwifiex_process_sta_rx_packet and mwifiex_process_uap_rx_packet,
mwifiex_uap_queue_bridged_pkt and mwifiex_process_rx_packet
not out-of-bounds access the skb->data buffer.
Fixes: 2dbaf751b1de ("mwifiex: report received management frames to cfg80211")
Signed-off-by: Polaris Pi <pinkperfect2021@gmail.com>
Reviewed-by: Matthew Wang <matthewmwang@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230723070741.1544662-1-pinkperfect2021@gmail.com
Prasurjya Rohan Saikia [Mon, 10 Jul 2023 09:44:03 +0000 (09:44 +0000)]
wifi: wilc1000: remove use of has_thrpt_enh3 flag
The 'enhance throughput flow' algorithm is used by default. So older
sections of the code are removed so as to always use this new algorithm.
Signed-off-by: Prasurjya Rohan Saikia <prasurjya.rohansaikia@microchip.com>
Acked-by: Ajay Kathat <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230710094401.235222-1-prasurjya.rohansaikia@microchip.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:52 +0000 (15:02 +0800)]
wifi: rtw89: get data rate mode/NSS/MCS v1 from RX descriptor
The data rate from RX descriptor also uses hardware rate v1 for WiFi 7
chips. The rate code contains three parts -- mode, NSS and MCS. For
CCK/OFDM/HT rates, NSS/MCS parts are the same as before. VHT/HE/EHT rates
are changed and listed as below:
mode NSS MCS
V0 [8:7] [6:4] [3:0]
V1 [10:8] [7:5] [4:0]
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-11-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:51 +0000 (15:02 +0800)]
wifi: rtw89: add to display hardware rates v1 histogram in debugfs
The upcoming WiFi 7 chips support EHT rates, and hardware rate codes are
changed too, so modify to adapt the changes. (EHT counters are still zeros
in below example)
RX count:
Legacy: [0, 0, 0, 0]
OFDM: [0, 0, 0, 0, 0, 0, 0, 0]
HT 0: [0, 0, 0, 0, 0, 0, 0, 0]
HT 1: [0, 0, 0, 0, 0, 0, 0, 0]
VHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
VHT 2SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
HE 1SS: [0, 0, 42, 0, 43, 90, 75, 0, 26, 20, 260, 7]
HE 2SS: [0, 96, 232, 84, 125, 184, 52, 0, 0, 0, 0, 0]
EHT 1SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0][0, 0]
EHT 2SS: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-10-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:50 +0000 (15:02 +0800)]
wifi: rtw89: add C2H RA event V1 to support WiFi 7 chips
WiFi 7 chips have more rate mode (EHT), higher MCS and more bandwidth, so
define and use reserved bits to carry these information in C2H events.
Also, the SS/MCS encoded bits of VHT and HE are changed, so define V1 masks
for them.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-9-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:49 +0000 (15:02 +0800)]
wifi: rtw89: use struct to access RA report
RA (rate adaptive), a mechanism to select proper rate, is implemented in
firmware, and this report is used to tell driver TX rate it is currently
using. Use struct to access this report, and doesn't change logic at all.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-8-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:48 +0000 (15:02 +0800)]
wifi: rtw89: use struct to access firmware C2H event header
Firmware C2H events contain two-word header which can indicate category,
class, function and length of received events. Use struct to access them,
and doesn't change logic at all.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-7-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:47 +0000 (15:02 +0800)]
wifi: rtw89: add H2C RA command V1 to support WiFi 7 chips
H2C RA V1 command adds two words to support WiFi 7 chips, which can
possibly support up to 4SS rates. Because current chips have only 2SS
rates, leave the fields blank for now. The main changes are to set
extended bits of EHT mode and bandwidth -- add a bit for EHT mode; add a
bit to enumerate 320MHz channel bandwidth.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-6-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:46 +0000 (15:02 +0800)]
wifi: rtw89: use struct to set RA H2C command
RA (rate adaptive) H2C command is used to tell firmware which rates can
be used for specified MAC ID. Basically, this commit doesn't change result.
Only change to set two 32-bit instead of continual 8-byte rate masks one
by one. Originally, we only set 5-byte masks, because existing WiFi 6
2SS chips only need 5-byte masks. Setting two 32-bit masks will be more
efficient and also can support coming WiFi 7 2SS chips containing more
rates.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-5-pkshih@realtek.com
Zong-Zhe Yang [Fri, 28 Jul 2023 07:02:45 +0000 (15:02 +0800)]
wifi: rtw89: phy: rate pattern handles HW rate by chip gen
Rate pattern is controlled by 'iw bitrates' to fix rate as desired, and
we extend to support v1 rate.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-4-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:44 +0000 (15:02 +0800)]
wifi: rtw89: define hardware rate v1 for WiFi 7 chips
To support EHT rate, hardware rate v1 is introduced. The CCK and OFDM rates
are persistent. HT/VHT/HE rates use different rate code from original, and
add new code for EHT rates.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-3-pkshih@realtek.com
Ping-Ke Shih [Fri, 28 Jul 2023 07:02:43 +0000 (15:02 +0800)]
wifi: rtw89: add chip_info::chip_gen to determine chip generation
The coming WiFi 7 chip is 8922AE which uses different hardware rate and
register naming rule. Adding a chip_info::chip_gen field can help to
do things by generations accordingly.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230728070252.66525-2-pkshih@realtek.com
Larry Finger [Mon, 24 Jul 2023 18:39:27 +0000 (13:39 -0500)]
wifi: rtw89: Fix loading of compressed firmware
When using compressed firmware, the early firmware load feature will fail.
In most cases, the only downside is that if a device has more than one
firmware version available, only the last one listed will be loaded.
In at least two cases, there is no firmware loaded, and the device fails
initialization. See https://github.com/lwfinger/rtw89/issues/259 and
https://bugzilla.opensuse.org/show_bug.cgi?id=
1212808 for examples of
the failure.
When firmware_class.dyndbg=+p" added to the kernel boot parameters, the
following is found:
finger@localhost:~/rtw89>sudo dmesg -t | grep rtw89
firmware_class: __allocate_fw_priv: fw-rtw89/rtw8852b_fw-1.bin fw_priv=
00000000638862fb
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/5.14.21-150500.53-default/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/5.14.21-150500.53-default/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: Direct firmware load for rtw89/rtw8852b_fw-1.bin failed with error -2
firmware_class: __free_fw_priv: fw-rtw89/rtw8852b_fw-1.bin fw_priv=
00000000638862fb data=
00000000307c30c7 size=0
firmware_class: __allocate_fw_priv: fw-rtw89/rtw8852b_fw.bin fw_priv=
00000000638862fb
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/5.14.21-150500.53-default/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/5.14.21-150500.53-default/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: Direct firmware load for rtw89/rtw8852b_fw.bin failed with error -2
firmware_class: __free_fw_priv: fw-rtw89/rtw8852b_fw.bin fw_priv=
00000000638862fb data=
00000000307c30c7 size=0
rtw89_8852be 0000:02:00.0: failed to early request firmware: -2
firmware_class: __allocate_fw_priv: fw-rtw89/rtw8852b_fw.bin fw_priv=
00000000638862fb
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/5.14.21-150500.53-default/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/5.14.21-150500.53-default/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/rtw89/rtw8852b_fw.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/5.14.21-150500.53-default/rtw89/rtw8852b_fw.bin.xz failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw.bin.xz failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/5.14.21-150500.53-default/rtw89/rtw8852b_fw.bin.xz failed for no such file or directory.
rtw89_8852be 0000:02:00.0: Loading firmware from /lib/firmware/rtw89/rtw8852b_fw.bin.xz
rtw89_8852be 0000:02:00.0: f/w decompressing rtw89/rtw8852b_fw.bin
firmware_class: fw_set_page_data: fw-rtw89/rtw8852b_fw.bin fw_priv=
00000000638862fb data=
000000004ed6c2f7 size=
1035232
rtw89_8852be 0000:02:00.0: Firmware version 0.27.32.1, cmd version 0, type 1
rtw89_8852be 0000:02:00.0: Firmware version 0.27.32.1, cmd version 0, type 3
The key is that firmware version 0.27.32.1 is loaded.
With this patch, the following is obtained:
firmware_class: __free_fw_priv: fw-rtw89/rtw8852b_fw.bin fw_priv=
000000000849addc data=
00000000fd3cabe2 size=
1035232
firmware_class: fw_name_devm_release: fw_name-rtw89/rtw8852b_fw.bin devm-
000000002d8c3343 released
firmware_class: __allocate_fw_priv: fw-rtw89/rtw8852b_fw-1.bin fw_priv=
000000009e1a6364
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/6.4.3-1-default/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/6.4.3-1-default/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/rtw89/rtw8852b_fw-1.bin failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/6.4.3-1-default/rtw89/rtw8852b_fw-1.bin.zst failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw-1.bin.zst failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/6.4.3-1-default/rtw89/rtw8852b_fw-1.bin.zst failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/rtw89/rtw8852b_fw-1.bin.zst failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/6.4.3-1-default/rtw89/rtw8852b_fw-1.bin.xz failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/updates/rtw89/rtw8852b_fw-1.bin.xz failed for no such file or directory.
rtw89_8852be 0000:02:00.0: loading /lib/firmware/6.4.3-1-default/rtw89/rtw8852b_fw-1.bin.xz failed for no such file or directory.
rtw89_8852be 0000:02:00.0: Loading firmware from /lib/firmware/rtw89/rtw8852b_fw-1.bin.xz
rtw89_8852be 0000:02:00.0: f/w decompressing rtw89/rtw8852b_fw-1.bin
firmware_class: fw_set_page_data: fw-rtw89/rtw8852b_fw-1.bin fw_priv=
000000009e1a6364 data=
00000000fd3cabe2 size=
1184992
rtw89_8852be 0000:02:00.0: Loaded FW: rtw89/rtw8852b_fw-1.bin, sha256:
8539efc75f513f4585cf0cd6e79e6507da47fce87225f2d0de391a03aefe9ac8
rtw89_8852be 0000:02:00.0: loaded firmware rtw89/rtw8852b_fw-1.bin
rtw89_8852be 0000:02:00.0: Firmware version 0.29.29.1, cmd version 0, type 5
rtw89_8852be 0000:02:00.0: Firmware version 0.29.29.1, cmd version 0, type 3
Now, version 0.29.29.1 is loaded.
Fixes: ffde7f3476a6 ("wifi: rtw89: add firmware format version to backward compatible with older drivers")
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230724183927.28553-1-Larry.Finger@lwfinger.net
Ryder Lee [Wed, 26 Jul 2023 18:35:06 +0000 (02:35 +0800)]
wifi: mt76: mt7915: fix power-limits while chan_switch
If user changes the channel without completely disabling the interface the
txpower_sku values reported track the old channel the device was operating on.
If user bounces the interface the correct power tables are applied.
mt7915_sku_group_len array gets updated before the channel switch happens so it
uses data from the old channel.
Fixes: ecb187a74e18 ("mt76: mt7915: rework the flow of txpower setting")
Fixes: f1d962369d56 ("mt76: mt7915: implement HE per-rate tx power support")
Reported-By: Chad Monroe <chad.monroe@smartrg.com>
Tested-by: Chad Monroe <chad.monroe@smartrg.com>
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Ryder Lee [Wed, 26 Jul 2023 18:35:05 +0000 (02:35 +0800)]
wifi: mt76: mt7915: fix tlv length of mt7915_mcu_get_chan_mib_info
Correct per-device TLV lengths to avoid invalid operation in firmware.
( 64.040375:28:STATS-E)statsGetSingleHWCounter: MIB counter index = 65472 not supported.
This happens on mt7916/mt7986.
Fixes: b0bfa00595be ("wifi: mt76: mt7915: improve accuracy of time_busy calculation")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Yuanjun Gong [Mon, 17 Jul 2023 14:50:08 +0000 (22:50 +0800)]
wifi: mt76: mt76x02: fix return value check in mt76x02_mac_process_rx
in mt76x02_mac_process_rx(), return an error code if an
unexpected result is returned by pskb_trim.
Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Dmitry Antipov [Wed, 21 Jun 2023 09:36:55 +0000 (12:36 +0300)]
wifi: wil6210: fix fortify warnings
When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y,
I've noticed the following:
In function ‘fortify_memcpy_chk’,
inlined from ‘wil_rx_crypto_check_edma’ at drivers/net/wireless/ath/wil6210/txrx_edma.c:566:2:
./include/linux/fortify-string.h:529:25: warning: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
529 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
where the compiler complains on:
const u8 *pn;
...
pn = (u8 *)&st->ext.pn_15_0;
...
memcpy(cc->pn, pn, IEEE80211_GCMP_PN_LEN);
and:
In function ‘fortify_memcpy_chk’,
inlined from ‘wil_rx_crypto_check’ at drivers/net/wireless/ath/wil6210/txrx.c:684:2:
./include/linux/fortify-string.h:529:25: warning: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
529 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
where the compiler complains on:
const u8 *pn = (u8 *)&d->mac.pn_15_0;
...
memcpy(cc->pn, pn, IEEE80211_GCMP_PN_LEN);
In both cases, the fortification logic interprets 'memcpy()' as 6-byte
overread of 2-byte field 'pn_15_0' of 'struct wil_rx_status_extension'
and 'pn_15_0' of 'struct vring_rx_mac', respectively. To silence
these warnings, last two fields of the aforementioned structures
are grouped using 'struct_group_attr(pn, __packed' quirk.
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230621093711.80118-1-dmantipov@yandex.ru
Lin Ma [Sun, 23 Jul 2023 08:03:50 +0000 (16:03 +0800)]
wifi: mt76: testmode: add nla_policy for MT76_TM_ATTR_TX_LENGTH
It seems that the nla_policy in mt76_tm_policy is missed for attribute
MT76_TM_ATTR_TX_LENGTH. This patch adds the correct description to make
sure the
u32 val = nla_get_u32(tb[MT76_TM_ATTR_TX_LENGTH]);
in function mt76_testmode_cmd() is safe and will not result in
out-of-attribute read.
Fixes: f0efa8621550 ("mt76: add API for testmode support")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:24 +0000 (15:07 +0800)]
wifi: mt76: mt7921: move mt7921u_disconnect mt792x-lib
mt7921u_disconnect routine is shared between mt7921 and mt7925 so move
it in mt792x-usb module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:23 +0000 (15:07 +0800)]
wifi: mt76: mt7921: move mt7921_dma_init in pci.c
Move mt7921_dma_init routine in pci.c and make it static since it is run
just in mt7921_pci_probe(). Get rid of dma.c.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:22 +0000 (15:07 +0800)]
wifi: mt76: mt792x: move MT7921_PM_TIMEOUT and MT7921_HW_SCAN_TIMEOUT in common code
MT7921_PM_TIMEOUT is shared between mt7925 and mt7921 so move it in
mt792x module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:21 +0000 (15:07 +0800)]
wifi: mt76: mt76_connac3: move lmac queue enumeration in mt76_connac3_mac.h
This is a preliminary patch to introduce mt7925 chip support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:20 +0000 (15:07 +0800)]
wifi: mt76: mt792x: move mt7921_load_firmware in mt792x-lib module
mt7921_load_firmware routine is shared between mt7921 and mt7925 chipset
so move it in mt792x-lib module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:19 +0000 (15:07 +0800)]
wifi: mt76: mt792x: introduce mt792x-usb module
Add usb shared code between mt7921 and mt7925 chipset to mt792x-usb module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:18 +0000 (15:07 +0800)]
wifi: mt76: mt7921: move acpi_sar code in mt792x-lib module
Move acpi_sar code in mt792x-lib module since it is shared between
mt7921 and mt7925 driver.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:17 +0000 (15:07 +0800)]
wifi: mt76: mt7921: move runtime-pm pci code in mt792x-lib
Move the following runtime-pm pci routines in mt792x-lib since they are
shared between mt7921 and mt7925 chipsets:
- __mt7921e_mcu_drv_pmctrl
- mt7921e_mcu_drv_pmctrl
- mt7921e_mcu_fw_pmctrl
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:16 +0000 (15:07 +0800)]
wifi: mt76: mt7921: move shared runtime-pm code on mt792x-lib
Moving hif_ops marcos in mt792x.h, we can move shared runtime-pm code
between mt7925 and mt7921 in mt792x-lib module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:15 +0000 (15:07 +0800)]
wifi: mt76: mt7921: move hif_ops macro in mt792x.h
Move the following hif_ops macro in mt792x.h:
- mt7925_init_reset
- mt7925_dev_reset
- mt7925_mcu_init
- __mt7925_mcu_drv_pmctrl
- __mt7925_mcu_fw_pmctrl
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:07:14 +0000 (15:07 +0800)]
wifi: mt76: mt792x: move more dma shared code in mt792x_dma
Rely on irq_map support, move more dma shared code between mt7921 and
mt7925 in mt792x_dma.c
Move the following dma code in mt792x-lib
- mt792x_dma_enable
- mt792x_dma_reset
- mt792x_wpdma_reset
- mt792x_wpdma_reinit_cond
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:06:02 +0000 (15:06 +0800)]
wifi: mt76: mt792x: introduce mt792x_irq_map
mt792x_irq_map will be use to share the irq code shared between mt7921
and mt7925
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:06:01 +0000 (15:06 +0800)]
wifi: mt76: mt7921: move init shared code in mt792x-lib module
Reduce duplicated code moving init shared code in mt792x-lib module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:06:00 +0000 (15:06 +0800)]
wifi: mt76: mt7921: move debugfs shared code in mt792x-lib module
Reduce duplicated code moving debugfs shared code in mt792x-lib module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:59 +0000 (15:05 +0800)]
wifi: mt76: mt7921: move dma shared code in mt792x-lib module
Reduce duplicated code moving dma shared code in mt792x-lib module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:58 +0000 (15:05 +0800)]
wifi: mt76: mt7921: move mac shared code in mt792x-lib module
Reduce duplicated code moving mac shared code in mt792x-lib module.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:57 +0000 (15:05 +0800)]
wifi: mt76: mt792x: introduce mt792x-lib module
mt792x-lib module will contain the shared code between mt7921 and new
MT79 WiFi7 chipset
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:56 +0000 (15:05 +0800)]
wifi: mt76: mt7921: move mt792x_hw_dev in mt792x.h
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:55 +0000 (15:05 +0800)]
wifi: mt76: mt7921: move mt792x_mutex_{acquire/release} in mt792x.h
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:54 +0000 (15:05 +0800)]
wifi: mt76: mt792x: move shared structure definition in mt792x.h
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:53 +0000 (15:05 +0800)]
wifi: mt76: mt7921: rename mt7921_hif_ops in mt792x_hif_ops
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:52 +0000 (15:05 +0800)]
wifi: mt76: mt7921: rename mt7921_dev in mt792x_dev
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:51 +0000 (15:05 +0800)]
wifi: mt76: mt7921: rename mt7921_phy in mt792x_phy
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:50 +0000 (15:05 +0800)]
wifi: mt76: mt7921: rename mt7921_sta in mt792x_sta
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:49 +0000 (15:05 +0800)]
wifi: mt76: mt7921: rename mt7921_vif in mt792x_vif
This is a preliminary patch to introduce WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:48 +0000 (15:05 +0800)]
wifi: mt76: mt7921: convert acpisar and clc pointers to void
Convert acpisar and clc pointers in mt7921_dev structure to void.
This is a preliminary patch to add WiFi7 chipset support
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 28 Jun 2023 07:05:47 +0000 (15:05 +0800)]
wifi: mt76: mt7921: move common register definition in mt792x_regs.h
This is a preliminary patch in order to support new WiFi7 chips.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Tue, 25 Jul 2023 19:06:03 +0000 (21:06 +0200)]
wifi: mt76: mt7603: fix tx filter/flush function
Setting MT_TX_ABORT does not abort any transmission for a wtbl index on its
own. Instead, it modifies the behavior of a queue flush to make it selectively
flush packets for a particular wtbl index.
Adjust powersave filtering to make use of this in order to avoid running into
unnecessary timeouts while flushing
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Tue, 25 Jul 2023 10:37:59 +0000 (12:37 +0200)]
wifi: mt76: mt7603: fix beacon interval after disabling a single vif
When disabling beacons on a vif, intval is 0. Ensure that dev->mt76.beacon_int
is not overwritten in this case, so that beacons continue to work for other
interfaces.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Fri, 14 Jul 2023 08:57:15 +0000 (10:57 +0200)]
wifi: mt76: mt7915: remove VHT160 capability on MT7915
The IEEE80211_VHT_CAP_EXT_NSS_BW value already indicates support for half-NSS
160 MHz support, so it is wrong to also advertise full 160 MHz support.
Fixes: c2f73eacee3b ("wifi: mt76: mt7915: add back 160MHz channel width support for MT7915")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Rafał Miłecki [Mon, 8 May 2023 15:58:20 +0000 (17:58 +0200)]
dt-bindings: mt76: support pointing to EEPROM using NVMEM cell
All kind of calibration data should be described as NVMEM cells of NVMEM
devices. That is more generic solution than "mediatek,mtd-eeprom" which
is MTD specific.
Add support for EEPROM NVMEM cells and deprecate existing MTD-based
property.
Cc: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Christian Marangi [Sat, 8 Jul 2023 18:29:36 +0000 (20:29 +0200)]
wifi: mt76: add support for providing eeprom in nvmem cells
Add support for providing eeprom in nvmem cells by adding nvmem cell as
an alternative source for mt76_get_of_eeprom().
Nvmem cells will follow standard nvmem cell definition and needs to be
called 'eeprom' to be correctly identified.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Christian Marangi [Sat, 8 Jul 2023 18:29:35 +0000 (20:29 +0200)]
wifi: mt76: split get_of_eeprom in subfunction
In preparation for NVMEM support, split get_of_eeprom() in subfunction
to tidy the code and facilitate the addition of alternative method to
get eeprom data. No behaviour change intended.
While at it also drop OF ifdef checks as OF have stubs and calling
of_get_property would result in the same error returned.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Thu, 29 Jun 2023 20:39:30 +0000 (22:39 +0200)]
wifi: mt76: mt7915: fix capabilities in non-AP mode
Capabilities in vif->bss_conf are only initialized in AP mode.
For other modes, they should be enabled by default, in order to avoid a
mismatch.
Fixes: 885f7af7e544 ("wifi: mt76: mt7915: remove mt7915_mcu_beacon_check_caps()")
Signed-off-by: Felix Fietkau <nbd@nbd.name>