From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH rtw-next v1 05/13] wifi: rtw89: Add hfc_param_ini_usb
Date: Sat, 31 May 2025 23:57:09 +0300 [thread overview]
Message-ID: <a30a4c25-6821-474b-8e67-0f627ff2be88@gmail.com> (raw)
In-Reply-To: <14ed20822a1e4890a30965123825cb5f@realtek.com>
On 26/05/2025 09:29, Ping-Ke Shih wrote:
> Ping-Ke Shih <pkshih@realtek.com> wrote:
>> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>>> On 13/05/2025 06:12, Ping-Ke Shih wrote:
>>>> Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
>>>>> Add hfc_param_ini_usb to struct rtw89_chip_info. For now initialise it
>>>>> only for RTL8851B.
>>>>>
>>>>> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>>>>> ---
>>>>
>>>> [...]
>>>>
>>>>
>>>>> +
>>>>> +static const struct rtw89_hfc_param_ini rtw8851b_hfc_param_ini_usb[] = {
>>>>> + [RTW89_QTA_SCC] = {rtw8851b_hfc_chcfg_usb, &rtw8851b_hfc_pubcfg_usb,
>>>>> + &rtw8851b_hfc_preccfg_usb, RTW89_HCIFC_STF},
>>>>
>>>> [RTW89_QTA_WOW] is missing. I'm not sure if current can handle this correctly.
>>>> Could you try to do WoWLAN with USB? At least, it shouldn't crash.
>>>>
>>>
>>> RTW89_QTA_WOW is missing because I didn't find an equivalent in
>>> enum mac_ax_qta_mode in the vendor driver.
>>
>> Yes, vendor driver doesn't have that. As I know, it does some modifications
>> from original normal operation quota, such as RTW89_QTA_SCC, because we want
>> constant definition in upstream driver. I will check internally and get back
>> to you how it should be for USB devices.
>
> The main function to get QTA_WOW is redu_wowlan_rx_qta().
>
> Take RTL8851BE as an example,
>
> Based on RTW89_QTA_SCC:
> cfg->ple_size->pge_size =>rtw89_mac_size.ple_size6
> =>.ple_size6 = {RTW89_PLE_PG_128, 496, 16,},
> rdu_pg_num = PLE_QTA_PG128B_12KB = 96
>
> QTA6:
> .ple_qt18 = {147, 0, 16, 20, 17, 13, 89, 0, 32, 14, 8, 0,}, //min
> .ple_qt58 = {147, 0, 16, 20, 157, 13, 229, 0, 172, 14, 24, 0,}, //max
> ^^^^
> qta_min = 89
> qta_max = 229
>
> new_qta = (qta_max - qta_min) < rdu_pg_num ?
> qta_min : (qta_max - rdu_pg_num);
> = 229 - 96 = 133
>
> QTA7:
>
> .ple_qt18 = {147, 0, 16, 20, 17, 13, 89, 0, 32, 14, 8, 0,}, //min
> .ple_qt58 = {147, 0, 16, 20, 157, 13, 229, 0, 172, 14, 24, 0,}, //max
> ^^^^
>
> qta_min = 0
> qta_max = 0
>
> new_qta = (qta_max - qta_min) < rdu_pg_num ?
> qta_min : (qta_max - rdu_pg_num);
> = 0
>
> Finally:
>
> .ple_qt_51b_wow = {147, 0, 16, 20, 157, 13, 133, 0, 172, 14, 24, 0,},
> ^^^^^^
>
> A way is to induce the quota by eyes. Another way is to add debug message
> in vendor driver to show these quota -- this would be much simpler.
>
>
Thank you for the explanation. I calculated the quotas like you showed
above and got WOWLAN to work with RTL8851BU. Well, it goes to sleep
and I can wake it up with a Magic Packet, but there are still problems:
1) "c2h reg timeout" error from rtw89_wow_suspend() ->
rtw89_wow_enable() -> rtw89_wow_enable_trx_post() ->
rtw89_wow_config_mac() -> rtw89_wow_config_mac_ax() ->
rtw89_mac_cpu_io_rx() -> rtw89_fw_msg_reg().
The vendor driver doesn't have this problem.
2) It takes ~250 seconds for the above "c2h reg timeout" error to appear
because rtw89_fw_read_c2h_reg() doesn't take into account that it takes
~250 µs to send a USB control message. It uses read_poll_timeout_atomic()
with a timeout of 1000000 µs and a delay of 1 µs. Changing the delay to
250 µs makes read_poll_timeout_atomic() finish after just 2 seconds.
3) There is a warning when the computer wakes up:
May 28 23:14:59 ideapad2 kernel: ------------[ cut here ]------------
May 28 23:14:59 ideapad2 kernel: WARNING: CPU: 2 PID: 3124 at net/mac80211/iface.c:680 ieee80211_do_stop+0x936/0x950 [mac80211]
May 28 23:14:59 ideapad2 kernel: Modules linked in: ccm rtw89_8852bu(OE) rtw89_8851bu(OE) rtw89_8852b(OE) rtw89_8851b(OE) rtw89_8852b_common(OE) rtw89_usb(OE) rtw89_core(>
May 28 23:14:59 ideapad2 kernel: snd_hda_codec mousedev sha512_ssse3 snd_rpl_pci_acp6x snd_acp_pci sha256_ssse3 sha1_ssse3 ee1004 snd_hda_core snd_acp_legacy_common snd_>
May 28 23:14:59 ideapad2 kernel: Unloaded tainted modules: 8851bu(OE):1 [last unloaded: 8851bu(OE)]
May 28 23:14:59 ideapad2 kernel: CPU: 2 UID: 0 PID: 3124 Comm: kworker/u16:31 Tainted: G OE 6.14.2-arch1-1 #1 51440b8a0cc8bb91764dac94f6c2b53455e5a907
May 28 23:14:59 ideapad2 kernel: Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
May 28 23:14:59 ideapad2 kernel: Hardware name: LENOVO 82KR/LNVNB161216, BIOS HBCN18WW 08/27/2021
May 28 23:14:59 ideapad2 kernel: Workqueue: async async_run_entry_fn
May 28 23:14:59 ideapad2 kernel: RIP: 0010:ieee80211_do_stop+0x936/0x950 [mac80211]
May 28 23:14:59 ideapad2 kernel: Code: 34 ea e9 92 f9 ff ff 0f b7 f0 48 c7 c7 60 d0 28 c2 e8 9e 1b 3e e9 0f 0b e9 89 f8 ff ff 4c 89 e7 e8 7f f3 ff ff e9 03 fd ff ff <0f> >
May 28 23:14:59 ideapad2 kernel: RSP: 0018:ffff97e05b28ba80 EFLAGS: 00010202
May 28 23:14:59 ideapad2 kernel: RAX: 0000000000000004 RBX: ffff8cc46a388a80 RCX: 0000000000000000
May 28 23:14:59 ideapad2 kernel: RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8cc51c4810ec
May 28 23:14:59 ideapad2 kernel: RBP: ffff97e05b28bb20 R08: ffff8cc5783ad200 R09: 000000008010000d
May 28 23:14:59 ideapad2 kernel: R10: 000000008010000d R11: 0000000000000246 R12: ffff8cc51c480900
May 28 23:14:59 ideapad2 kernel: R13: ffff97e05b28bab0 R14: ffff97e05b28bab0 R15: 0000000000000000
May 28 23:14:59 ideapad2 kernel: FS: 0000000000000000(0000) GS:ffff8cc653500000(0000) knlGS:0000000000000000
May 28 23:14:59 ideapad2 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
May 28 23:14:59 ideapad2 kernel: CR2: 0000000000000000 CR3: 0000000140822000 CR4: 00000000003506f0
May 28 23:14:59 ideapad2 kernel: Call Trace:
May 28 23:14:59 ideapad2 kernel: <TASK>
May 28 23:14:59 ideapad2 kernel: ? psi_group_change+0x13b/0x310
May 28 23:14:59 ideapad2 kernel: ieee80211_stop+0x5b/0x1a0 [mac80211 682e229732a6bfe53cb0bbcde81ec2801d27c374]
May 28 23:14:59 ideapad2 kernel: __dev_close_many+0xaa/0x150
May 28 23:14:59 ideapad2 kernel: dev_close_many+0xbe/0x1a0
May 28 23:14:59 ideapad2 kernel: dev_close+0x6f/0xa0
May 28 23:14:59 ideapad2 kernel: cfg80211_shutdown_all_interfaces+0x4d/0xf0 [cfg80211 fca8a1144424bca742e19d88b98aa1afb064fec0]
May 28 23:14:59 ideapad2 kernel: ieee80211_remove_interfaces+0x4d/0x230 [mac80211 682e229732a6bfe53cb0bbcde81ec2801d27c374]
May 28 23:14:59 ideapad2 kernel: ? __pfx_wait_rcu_exp_gp+0x10/0x10
May 28 23:14:59 ideapad2 kernel: ieee80211_unregister_hw+0x4a/0x130 [mac80211 682e229732a6bfe53cb0bbcde81ec2801d27c374]
May 28 23:14:59 ideapad2 kernel: rtw89_core_unregister+0x3a/0x50 [rtw89_core 6d9cf325b1126b69ab43ddd6b0b9a561d4ea24f8]
May 28 23:14:59 ideapad2 kernel: rtw89_usb_disconnect+0x53/0xe0 [rtw89_usb 2cf966e0c4b7fe950d436a899adc081e9902c1d8]
May 28 23:14:59 ideapad2 kernel: usb_unbind_interface+0x90/0x290
May 28 23:14:59 ideapad2 kernel: device_release_driver_internal+0x19c/0x200
May 28 23:14:59 ideapad2 kernel: ? __pfx_usb_dev_resume+0x10/0x10
May 28 23:14:59 ideapad2 kernel: usb_forced_unbind_intf+0x75/0xb0
May 28 23:14:59 ideapad2 kernel: ? __pfx_usb_dev_resume+0x10/0x10
May 28 23:14:59 ideapad2 kernel: unbind_marked_interfaces.isra.0+0x59/0x80
May 28 23:14:59 ideapad2 kernel: usb_resume+0x5a/0x60
May 28 23:14:59 ideapad2 kernel: dpm_run_callback+0x48/0x150
May 28 23:14:59 ideapad2 kernel: device_resume+0x140/0x240
May 28 23:14:59 ideapad2 kernel: async_resume+0x1d/0x30
May 28 23:14:59 ideapad2 kernel: async_run_entry_fn+0x31/0x140
May 28 23:14:59 ideapad2 kernel: process_one_work+0x17b/0x330
May 28 23:14:59 ideapad2 kernel: worker_thread+0x2ce/0x3f0
May 28 23:14:59 ideapad2 kernel: ? __pfx_worker_thread+0x10/0x10
May 28 23:14:59 ideapad2 kernel: kthread+0xec/0x230
May 28 23:14:59 ideapad2 kernel: ? __pfx_kthread+0x10/0x10
May 28 23:14:59 ideapad2 kernel: ret_from_fork+0x31/0x50
May 28 23:14:59 ideapad2 kernel: ? __pfx_kthread+0x10/0x10
May 28 23:14:59 ideapad2 kernel: ret_from_fork_asm+0x1a/0x30
May 28 23:14:59 ideapad2 kernel: </TASK>
May 28 23:14:59 ideapad2 kernel: ---[ end trace 0000000000000000 ]---
It's this one in ieee80211_do_stop():
/*
* If the interface goes down while suspended, presumably because
* the device was unplugged and that happens before our resume,
* then the driver is already unconfigured and the remainder of
* this function isn't needed.
* XXX: what about WoWLAN? If the device has software state, e.g.
* memory allocated, it might expect teardown commands from
* mac80211 here?
*/
if (local->suspended) {
WARN_ON(local->wowlan);
I would like to leave the WOWLAN fixes for later, to keep this set of
patches small.
next prev parent reply other threads:[~2025-05-31 20:57 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-04 20:47 [PATCH rtw-next v1 00/13] wifi: rtw89: Add support for USB devices Bitterblue Smith
2025-05-04 20:49 ` [PATCH rtw-next v1 01/13] wifi: rtw89: 8851b: Accept USB devices and load their MAC address Bitterblue Smith
2025-05-13 2:46 ` Ping-Ke Shih
2025-05-04 20:49 ` [PATCH rtw-next v1 02/13] wifi: rtw89: Get dle_mem via rtw89_hci_dle_mem() Bitterblue Smith
2025-05-13 2:51 ` Ping-Ke Shih
2025-05-14 0:56 ` Ping-Ke Shih
2025-05-25 22:04 ` Bitterblue Smith
2025-05-26 2:52 ` Ping-Ke Shih
2025-05-04 20:49 ` [PATCH rtw-next v1 03/13] wifi: rtw89: Rename hfc_param_ini to hfc_param_ini_pcie Bitterblue Smith
2025-05-13 3:04 ` Ping-Ke Shih
2025-05-04 20:50 ` [PATCH rtw-next v1 04/13] wifi: rtw89: Add dle_mem_usb2 and dle_mem_usb3 Bitterblue Smith
2025-05-13 3:06 ` Ping-Ke Shih
2025-05-04 20:51 ` [PATCH rtw-next v1 05/13] wifi: rtw89: Add hfc_param_ini_usb Bitterblue Smith
2025-05-13 3:12 ` Ping-Ke Shih
2025-05-25 21:55 ` Bitterblue Smith
2025-05-26 1:51 ` Ping-Ke Shih
2025-05-26 6:29 ` Ping-Ke Shih
2025-05-31 20:57 ` Bitterblue Smith [this message]
2025-05-31 20:54 ` Bitterblue Smith
2025-05-04 20:51 ` [PATCH rtw-next v1 06/13] wifi: rtw89: Disable some power saving for USB Bitterblue Smith
2025-05-13 3:27 ` Ping-Ke Shih
2025-05-25 21:57 ` Bitterblue Smith
2025-05-26 2:36 ` Ping-Ke Shih
2025-05-04 20:51 ` [PATCH rtw-next v1 07/13] wifi: rtw89: Add extra TX headroom " Bitterblue Smith
2025-05-13 3:28 ` Ping-Ke Shih
2025-05-04 20:52 ` [PATCH rtw-next v1 08/13] wifi: rtw89: Hide some errors when the device is unplugged Bitterblue Smith
2025-05-13 3:43 ` Ping-Ke Shih
2025-05-25 21:58 ` Bitterblue Smith
2025-05-04 20:52 ` [PATCH rtw-next v1 09/13] wifi: rtw89: Fix rtw89_mac_power_switch() for USB Bitterblue Smith
2025-05-13 3:50 ` Ping-Ke Shih
2025-05-25 21:58 ` Bitterblue Smith
2025-05-26 2:45 ` Ping-Ke Shih
2025-05-04 20:53 ` [PATCH rtw-next v1 10/13] wifi: rtw89: Add some definitions " Bitterblue Smith
2025-05-13 3:52 ` Ping-Ke Shih
2025-05-04 20:54 ` [PATCH rtw-next v1 11/13] wifi: rtw89: Add usb.{c,h} Bitterblue Smith
2025-05-13 6:12 ` Ping-Ke Shih
2025-05-25 22:03 ` Bitterblue Smith
2025-05-26 3:18 ` Ping-Ke Shih
2025-05-31 21:03 ` Bitterblue Smith
2025-05-04 20:54 ` [PATCH rtw-next v1 12/13] wifi: rtw89: Add rtw8851bu.c Bitterblue Smith
2025-05-13 6:14 ` Ping-Ke Shih
2025-05-04 20:55 ` [PATCH rtw-next v1 13/13] wifi: rtw89: Enable the new USB modules Bitterblue Smith
2025-05-13 6:14 ` Ping-Ke Shih
2025-05-13 6:22 ` [PATCH rtw-next v1 00/13] wifi: rtw89: Add support for USB devices Ping-Ke Shih
2025-05-13 7:07 ` Ping-Ke Shih
2025-05-25 22:03 ` Bitterblue Smith
2025-05-26 1:35 ` Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a30a4c25-6821-474b-8e67-0f627ff2be88@gmail.com \
--to=rtl8821cerfe2@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.