3233 Commits

Author SHA1 Message Date
Ping-Ke Shih
f506e3ee54 wifi: rtw89: correct aSIFSTime for 6GHz band
aSIFSTime is 10us for 2GHz band and 16us for 5GHz and 6GHz bands.
Originally, it doesn't consider 6GHz band and use wrong value, so correct
it accordingly.

Cc: stable@vger.kernel.org
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240430020515.8399-1-pkshih@realtek.com
2024-05-04 08:14:49 +08:00
Chin-Yen Lee
58ed86e166 wifi: rtw89: wow: add ARP offload feature
Add H2C command and offload template packet to allow firmware send ARP
response in WoWLAN mode. Then, firmware in WoWLAN mode can interactive
with peer that issue ARP request to query MAC address.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-13-pkshih@realtek.com
2024-05-04 08:05:43 +08:00
Chih-Kang Chang
e765370fdc wifi: rtw89: wow: support WEP cipher on WoWLAN
When using the WEP cipher, we need to add the address cam type as all
unicast mode to let firmware to work. Although WEP only set GTK in
mac80211, but we need to set both PTK and GTK information to firmware.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-12-pkshih@realtek.com
2024-05-04 08:05:34 +08:00
Chih-Kang Chang
940cd99625 wifi: rtw89: wow: support 802.11w PMF IGTK rekey
Once we connect to AP with 802.11w enabled, IGTK rekey happen during GTK
happen. We get IGTK IPN from mac80211 and set to firmware, and get latest
IGTK IPN from AOAC report then update to mac80211 after resume. When rekey
happen, also update new IGTK key info to mac80211. Furthermore, We
construct SA query reply packet to firmware. If firmware received SA query
request from AP can transmit reply back when suspend.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-11-pkshih@realtek.com
2024-05-04 08:05:15 +08:00
Chih-Kang Chang
ff53fce5c7 wifi: rtw89: wow: update latest PTK GTK info to mac80211 after resume
When resume we parse AOAC report from firmware using H2C and C2H
registers before enable interrupt, then update PTK RX PN and GTK RX PN.
After enable interrupt, we parse AOAC report using H2C and C2H commands,
then update PTK TX PN and update new GTK key info if GTK rekey during
suspend. Furthermore, We update pattern match index if wakeup by pattern.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-10-pkshih@realtek.com
2024-05-04 08:04:03 +08:00
Chih-Kang Chang
0291633afe wifi: rtw89: wow: add GTK rekey feature related H2C commands
Add PTK TRX IV, GTK RX IV, key encryption algorithm to H2C command to
enable GTK rekey feature.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-9-pkshih@realtek.com
2024-05-04 08:03:50 +08:00
Chih-Kang Chang
ed9a3c0d4d wifi: rtw89: wow: construct EAPoL packet for GTK rekey offload
We construct EAPoL packet with various encryption method, and download
to firmware. Also we add Key Encryption Key (KEK) and Key Confirmation Key
(KCK) to H2C command. Once firmware received EAPoL group rekey packet(1/2)
can TX EAPoL group rekey packet(2/2) when suspend.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-8-pkshih@realtek.com
2024-05-04 08:02:34 +08:00
Chih-Kang Chang
786737b6b7 wifi: rtw89: use struct to fill H2C of WoWLAN global configuration
This H2C command is used to set WoWLAN global config, and we correct
the H2C format by enlarging the H2C size to fill GTK and PTK info.
This fix is compatible with old firmware.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-7-pkshih@realtek.com
2024-05-04 08:01:55 +08:00
Chih-Kang Chang
9076bf365e wifi: rtw89: use struct to access firmware command h2c_dctl_sec_cam_v1
This H2C command set key information into security CAM including key
index, entry index and valid map. No logic is changed.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-6-pkshih@realtek.com
2024-05-04 08:01:13 +08:00
Chih-Kang Chang
803a96f477 wifi: rtw89: wow: prepare PTK GTK info from mac80211
Get the PTK and PTK TRX PN value and transfer to IV value, these
values will used by firmware to generate packets with correct IV value.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-5-pkshih@realtek.com
2024-05-04 07:59:55 +08:00
Chih-Kang Chang
92790c4e50 wifi: rtw89: wow: parsing Auth Key Management from associate request
Need Auth Key Management(AKM) to let firmware to generate appropriate
EAPoL packet for GTK rekey. The AKM is present in the association request
RSN IE to indicate which cipher that station selected.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-4-pkshih@realtek.com
2024-05-04 07:58:28 +08:00
Chih-Kang Chang
baaf806e46 wifi: rtw89: wow: refine WoWLAN flows of HCI interrupts and low power mode
After enabling packet offload, the TX will be stuck after resume from
WoWLAN mode. And the 8852c gets error messages like

rtw89_8852ce 0000:04:00.0: No busy txwd pages available
rtw89_8852ce 0000:04:00.0: queue 0 txwd 100 is not idle
rtw89_8852ce 0000:04:00.0: queue 0 txwd 101 is not idle
rtw89_8852ce 0000:04:00.0: queue 0 txwd 102 is not idle
rtw89_8852ce 0000:04:00.0: queue 0 txwd 103 is not idle

If suspend/resume many times that firmware will download failed and
disconnection.

To fix these issues, We removed the rtw89_hci_disable_intr() and
rtw89_hci_enable_intr() during rtw89_wow_swap_fw() to prevent add packet
offload can't receive c2h back due to interrupt disable. Only 8852C and
8922A needs to disable interrupt before downloading fw.

Furthermore, we avoid using low power HCI mode on WoWLAN mode, to prevent
interrupt enabled, then get interrupt and calculate RXBD mismatched due to
software RXBD index already reset but hardware RXBD index not yet.

Fixes: 5c12bb66b79d ("wifi: rtw89: refine packet offload flow")
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-3-pkshih@realtek.com
2024-05-04 07:58:18 +08:00
Chin-Yen Lee
a79264e8c7 wifi: rtw89: wow: send RFK pre-nofity H2C command in WoWLAN mode
802.11be WiFi chips need a RFK (RF calibration) notify H2C command after
downloading WoWLAN firmware to make sure RF TX/RX work fine when leaving
power save mode, so add it to correct RF TX/RX in WoWLAN mode.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240502022505.28966-2-pkshih@realtek.com
2024-05-04 07:54:19 +08:00
Ping-Ke Shih
949f6f3aeb wifi: rtl8xxxu: cleanup includes
Remove unnecessary includes from driver. The first step is to add
necessary includes to driver's header files to make them can be included
individually. Then, driver's C files include driver's header files first,
and check if still missed header files of kernel.

The results show that most C files only include driver's header files.
Only core.c needs to include additional linux/firmware.h.

Also sort includes in alphabetic order.

Compile tested only.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240429024711.30992-1-pkshih@realtek.com
2024-05-02 11:08:33 +08:00
Kalle Valo
028fa28171 wifi: rtl8xxxu: remove rtl8xxxu_ prefix from filenames
The driver is already in a directory named rtl8xxxu, there's no need to
duplicate that in the filename as well. Now file listing looks a lot more
reasonable:

8188e.c  8192c.c  8192f.c  8723a.c  core.c   Makefile  rtl8xxxu.h
8188f.c  8192e.c  8710b.c  8723b.c  Kconfig  regs.h

No functional changes, compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240426141939.3881678-2-kvalo@kernel.org
2024-05-02 11:05:43 +08:00
Kalle Valo
a890495b29 wifi: rtl8xxxu: remove some unused includes
I noticed by random that rtl8xxxu includes linux/wireless.h even though it
doesn't need it. While investigating a bit more I found even more unused
include files:

#include <linux/init.h>
#include <linux/sched.h>
#include <linux/ethtool.h>

It looks like that the includes are just copied to every file without checking
if the file really needs the include. So more includes could be removed but
that would need more careful analysis per each file.

No functional changes, compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240426141939.3881678-1-kvalo@kernel.org
2024-05-02 11:05:13 +08:00
Chia-Yuan Li
4e5957101d wifi: rtw89: 8852c: refine power sequence to imporve power consumption
Power sequence is a flow to enable/disable WiFi card with hardware
parameters. Adjust power and clock parameters according to results
of internal simulation and verification, so apply them to have better
power consumption.

Signed-off-by: Chia-Yuan Li <leo.li@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240426061200.44262-2-pkshih@realtek.com
2024-05-02 10:58:04 +08:00
Chin-Yen Lee
535c045da6 wifi: rtw89: reset AFEDIG register in power off sequence
Some Wi-Fi chips meet card lost issue due to unstable hardware signal of
GPIO pins during power off. Reset AFEDIG register before BB reset in
power off sequence could avoid unstable signal and fix the issue.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240426061200.44262-1-pkshih@realtek.com
2024-05-02 10:57:51 +08:00
Bitterblue Smith
014bba73b5 wifi: rtlwifi: Adjust rtl8192d-common for USB
A few of the shared functions need small changes for the USB driver:
 - firmware loading
 - efuse reading
 - rate mask updating
 - rf register reading
 - initial gain for scanning

Also, add a few macros to wifi.h and initialise rtlhal.interfaceindex
for USB devices.

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://msgid.link/28100330-f421-4b85-b41b-f1045380cef2@gmail.com
2024-05-02 10:46:12 +08:00
Bitterblue Smith
d75589a013 wifi: rtlwifi: Clean up rtl8192d-common a bit
Improve readability:
 * add empty lines
 * use abs_diff in rtl92d_dm_txpower_tracking_callback_thermalmeter
 * roll up repeated statements into a for loop in
   rtl92d_dm_txpower_tracking_callback_thermalmeter
 * shorten lines by replacing many instances of "rtlpriv->dm" with "dm"
   pointer in rtl92d_dm_txpower_tracking_callback_thermalmeter
 * sort some declarations by length
 * refactor _rtl92d_get_txpower_writeval_by_regulatory a little
 * refactor _rtl92de_readpowervalue_fromprom a little

Delete unused structs tag_dynamic_init_gain_operation_type_definition
and swat.

Simplify rtl92d_fill_h2c_cmd a little and delete a pointless wrapper
function.

Tested with a single MAC single PHY USB dongle from Aliexpress labelled
"CC&C WL-6210-V3".

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://msgid.link/f6acfa78-2f4e-47f1-95d4-65aa77510113@gmail.com
2024-05-02 10:44:27 +08:00
Bitterblue Smith
db5ae2e182 wifi: rtlwifi: Move code from rtl8192de to rtl8192d-common
Create the new module rtl8192d-common and move some code into it from
rtl8192de. Now the rtl8192de driver (PCI) and the new rtl8192du driver
(USB) can share some of the code.

This is mostly the code that required little effort to make it
shareable. There are a few more functions which they could share, with
more changes.

Add phy_iq_calibrate member to struct rtl_hal_ops to allow moving the
TX power tracking code from dm.c.

The other changes in this patch are adjusting whitespace, renaming some
functions, making some arrays const, and making checkpatch.pl less
unhappy.

rtl8192de is compile-tested only. rtl8192d-common is tested with the
new rtl8192du driver.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/69c4358a-6fbf-4433-92a6-341c83e9dd48@gmail.com
2024-05-02 10:39:07 +08:00
Bitterblue Smith
2f228d364d wifi: rtlwifi: rtl8192de: Fix endianness issue in RX path
Structs rx_desc_92d and rx_fwinfo_92d will not work for big endian
systems.

Delete rx_desc_92d because it's big and barely used, and instead use
the get_rx_desc_rxmcs and get_rx_desc_rxht functions, which work on big
endian systems too.

Fix rx_fwinfo_92d by duplicating four of its members in the correct
order.

Tested only with RTL8192DU, which will use the same code.
Tested only on a little endian system.

Cc: stable@vger.kernel.org
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/698463da-5ef1-40c7-b744-fa51ad847caf@gmail.com
2024-05-02 10:38:59 +08:00
Bitterblue Smith
a7c0f48410 wifi: rtlwifi: rtl8192de: Fix low speed with WPA3-SAE
Some (all?) management frames are incorrectly reported to mac80211 as
decrypted when actually the hardware did not decrypt them. This results
in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100
Mbps.

Fix this by checking the encryption type field of the RX descriptor.
rtw88 does the same thing.

This fix was tested only with rtl8192du, which will use the same code.

Cc: stable@vger.kernel.org
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/4d600435-f0ea-46b0-bdb4-e60f173da8dd@gmail.com
2024-05-02 10:38:51 +08:00
Bitterblue Smith
de4d4be4fa wifi: rtlwifi: rtl8192de: Fix 5 GHz TX power
Different channels have different TX power settings. rtl8192de is using
the TX power setting from the wrong channel in the 5 GHz band because
_rtl92c_phy_get_rightchnlplace expects an array which includes all the
channel numbers, but it's using an array which includes only the 5 GHz
channel numbers.

Use the array channel_all (defined in rtl8192de/phy.c) instead of
the incorrect channel5g (defined in core.c).

Tested only with rtl8192du, which will use the same TX power code.

Cc: stable@vger.kernel.org
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/c7653517-cf88-4f57-b79a-8edb0a8b32f0@gmail.com
2024-05-02 10:36:13 +08:00
Colin Ian King
ed403e86c8 wifi: rtlwifi: rtl8723be: Make read-only arrays static const
Don't populate the read-only arrays cck_rates, ofdm_rates, ht_rates_1t and
channel_all on the stack at run time, instead make them static const and
clean up the formatting.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240425155733.114423-1-colin.i.king@gmail.com
2024-04-29 09:48:36 +08:00
Jiapeng Chong
5eb027019f wifi: rtw89: Remove the redundant else branch in the function rtw89_phy_get_kpath
The assignment of the else and if branches is the same in the "case:
MLO_2_PLUS_0_1RF" branch of the function rtw89_phy_get_kpath, so we
remove it and add comments here to make the code easier to understand.

./drivers/net/wireless/realtek/rtw89/phy.c:6406:2-4: WARNING: possible condition with no effect (if == else).

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8812
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240422072922.50940-1-jiapeng.chong@linux.alibaba.com
2024-04-29 09:38:22 +08:00
Ching-Te Ku
416a445ec3 wifi: rtw89: coex: Check and enable reports after run coex
If there is any changes with Wi-Fi/Bluetooth, the mechanism will
trigger run_coex to update information and coexistence mechanism.
Enable/Disable reports here can make sure the action take effect
in time.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-9-pkshih@realtek.com
2024-04-29 08:54:25 +08:00
Ching-Te Ku
11173c7062 wifi: rtw89: coex: Add Wi-Fi role v8 condition when set BTG control
BTG(A hardware block, which Wi-Fi 2.4Ghz & Bluetooth shared a part
of hardware). Because some information are saved in role info. So the
logic also need to get value from the version 8 role info.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-8-pkshih@realtek.com
2024-04-29 08:54:13 +08:00
Ching-Te Ku
efb85ded5c wifi: rtw89: coex: Add Wi-Fi role v8 condition when set Bluetooth channel
This function is to let Bluetooth know Wi-Fi is using which channel,
and ask Bluetooth do not hop into the nearby channel. Wi-Fi channel
is saved at role info, this patch make the logic also get the channel
value from version 8 role info.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-7-pkshih@realtek.com
2024-04-29 08:54:02 +08:00
Ching-Te Ku
947cbc6ead wifi: rtw89: coex: Fix unexpected value in version 7 slot parameter
It will assign wrong value to version 7 slot parameter setting, because
the structure member order has changed. Add a for-loop to assign variables
manually.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-6-pkshih@realtek.com
2024-04-29 08:53:51 +08:00
Ching-Te Ku
1a5565d812 wifi: rtw89: coex: Add Bluetooth version report version 7
The report is reported from Bluetooth, it shows the current Bluetooth
driver & firmware version code. Wi-Fi & Bluetooth need to use compatible
version. The version 7 report adjust the structure variables order.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-5-pkshih@realtek.com
2024-04-29 08:52:43 +08:00
Ching-Te Ku
b60b468633 wifi: rtw89: coex: Add Bluetooth frequency hopping map version 7
The report is reported from Bluetooth, it described the usable
Bluetooth channel map. Bluetooth should not hopped into Wi-Fi
using channel. Version 8 report adjust the structure variables
order.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-4-pkshih@realtek.com
2024-04-29 08:51:34 +08:00
Ching-Te Ku
e5d0305a2b wifi: rtw89: coex: Add Bluetooth scan parameter report version 7
This report is reported from Bluetooth, it described Bluetooth scan
parameters. Version 7 adjust the structure variables order.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-3-pkshih@realtek.com
2024-04-29 08:50:27 +08:00
Ching-Te Ku
430d80e794 wifi: rtw89: coex: Add Wi-Fi null data status version 7
The mechanism will use Wi-Fi null packet to stop the packets from
access point to avoid the interference to Bluetooth when switch
to Bluetooth slot. The report can check whether the null packet is
working as expected or not.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423130502.32682-2-pkshih@realtek.com
2024-04-29 08:49:20 +08:00
Ping-Ke Shih
3ef60f4483 wifi: rtw89: 8852b: update hardware parameters for RFE type 5
RFE type 5 of 8852B is a type of hardware module, which can use different
external components, so update register settings accordingly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423121247.24714-2-pkshih@realtek.com
2024-04-29 08:40:39 +08:00
Kuan-Chung Chen
7be73dc106 wifi: rtw89: fix CTS transmission issue with center frequency deviation
The CTS cannot be received by the peer due to center frequency
deviation. This issue can be solved by correct settings to
transmit proper CTS.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240423121247.24714-1-pkshih@realtek.com
2024-04-29 08:40:18 +08:00
Damien Le Moal
c3d26b9b26 wifi: rtw88: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY
Use the macro PCI_IRQ_INTX instead of the deprecated PCI_IRQ_LEGACY macro.

Link: https://lore.kernel.org/r/20240325070944.3600338-21-dlemoal@kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
[bhelgaas: split to separate patch]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2024-04-25 12:53:32 -05:00
Ching-Te Ku
4ea11e4db3 wifi: rtw89: coex: Re-order the index for the report from firmware
The report index has changed, correct the index for the corresponding
firmware version.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-10-pkshih@realtek.com
2024-04-23 19:52:51 +08:00
Ching-Te Ku
45deb9e6a6 wifi: rtw89: coex: Add coexistence firmware control report version 8
This report summary monitor the firmware related counters, firmware
version. It will help to analysis the communication between driver and
firmware.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-9-pkshih@realtek.com
2024-04-23 19:51:41 +08:00
Ching-Te Ku
de656c77c7 wifi: rtw89: coex: Add GPIO signal control version 7
The feature can help to know how the firmware mechanism working.
There are several trigger point set in firmware. If driver send
the H2C command to firmware to enable the trigger, firmware will
toggle GPIO to perform the firmware mechanism.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-8-pkshih@realtek.com
2024-04-23 19:50:34 +08:00
Ching-Te Ku
b952cb0a6e wifi: rtw89: coex: Add register monitor report v7 format
To avoid driver I/O, firmware will periodic monitor the register
settings and update to driver. The v7 report adjust the structure
variables order, so driver does changes accordingly.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-7-pkshih@realtek.com
2024-04-23 19:49:20 +08:00
Ching-Te Ku
c95d34c7d6 wifi: rtw89: coex: Update Bluetooth polluted Wi-Fi TX logic
When the PTA breaks Wi-Fi traffic request caused Bluetooth traffic,
it means Bluetooth polluted the Wi-Fi traffic. When Wi-Fi is TX, the
mechanism can ignore the polluted Wi-Fi packet retry counter, it is
help to the stability of Wi-Fi TX rate. The chip RTL8922A has not only
one MAC, so need to include the all MAC as reference.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-6-pkshih@realtek.com
2024-04-23 19:48:11 +08:00
Ching-Te Ku
89d0632536 wifi: rtw89: coex: Add PTA path control condition for chip RTL8922A
PTA(packet traffic arbitration) is a coexistence hardware feature.
Wi-Fi & Bluetooth owns their PTA, the function is to show whose PTA
control the traffic now. RTL8922A PTA control is controlled by hardware
logic, there is no register to monitor the setting.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-5-pkshih@realtek.com
2024-04-23 19:48:00 +08:00
Ching-Te Ku
ac83ba93b2 wifi: rtw89: coex: Add version 3 report map of H2C command
The map is the H2C index for driver forward the driver status to firmware.
The status is for firmware to make mechanism decision, if driver provided
the wrong index to firmware, it will make parse the status incorrectly.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-4-pkshih@realtek.com
2024-04-23 19:47:47 +08:00
Ching-Te Ku
b5d8d19de2 wifi: rtw89: coex: Add v7 firmware cycle status report
To support v7 version firmware cycle report, which adjusts the structure
variables order, apply the related structure and functions. The cycle
report can show how the firmware mechanism runs.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-3-pkshih@realtek.com
2024-04-23 19:46:35 +08:00
Ching-Te Ku
a4f19fd7dc wifi: rtw89: coex: Allow Bluetooth doing traffic during Wi-Fi scan
The Wi-Fi/Bluetooth slot are toggled by firmware timer when Wi-Fi doing
firmware scan, and Wi-Fi slot don't allow Bluetooth do traffic when
Wi-Fi slot. It will trigger Bluetooth audio lag in a random rate, because
Bluetooth can not have enough time slot to keep enough data to play audio.
This patch make Bluetooth can do traffic during Wi-Fi slot, this can help
Bluetooth to collect audio data in time.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418021207.32173-2-pkshih@realtek.com
2024-04-23 19:45:28 +08:00
Bitterblue Smith
feaedb05fc wifi: rtl8xxxu: Add LED control code for RTL8723BU
Software control (on/off) and hardware control (automatic blinking)
tested with EDUP EP-N8568.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/7df66d1f-87a1-4f44-9aac-ce75438abde3@gmail.com
2024-04-23 19:41:43 +08:00
Bitterblue Smith
fbeddb4a76 wifi: rtl8xxxu: Add LED control code for RTL8192CU family
Also, don't set bit 7 of LEDCFG2 for RTL8192CU. If bit 7 is set the LED
never turns on. In this family only RTL8188CUS needs bit 7 of LEDCFG2
set.

Software control (on/off) and hardware control (automatic blinking)
tested with Netcore NW362 (RTL8192CU).

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/4b5970cf-d28b-415a-b911-82cdb5e9ce99@gmail.com
2024-04-23 18:52:30 +08:00
Bitterblue Smith
110951b8fa wifi: rtl8xxxu: Add separate MAC init table for RTL8192CU
Until now RTL8192CU family was using the MAC init table from RTL8723AU,
but these tables are not identical in the two vendor drivers. Import
the correct table for RTL8192CU.

Also move the existing MAC init table to rtl8xxxu_8723a.c, which is
the only remaining user.

Tested with the Netcore NW362 (RTL8192CU).

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/a53ed8b9-27fc-4871-a20a-ad42c6d210d3@gmail.com
2024-04-23 18:50:04 +08:00
Martin Kaistra
cbfbb4ddbc wifi: rtl8xxxu: enable MFP support with security flag of RX descriptor
In order to connect to networks which require 802.11w, add the
MFP_CAPABLE flag and let mac80211 do the actual crypto in software.

When a robust management frame is received, rx_dec->swdec is not set,
even though the HW did not decrypt it. Extend the check and don't set
RX_FLAG_DECRYPTED for these frames in order to use SW decryption.

Use the security flag in the RX descriptor for this purpose, like it is
done in the rtw88 driver.

Cc: stable@vger.kernel.org
Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240418071813.1883174-3-martin.kaistra@linutronix.de
2024-04-22 09:53:10 +08:00