Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH rtw-next v2 1/2] wifi: rtw89: Lower the timeout in rtw89_fw_read_c2h_reg() for USB
Date: Thu, 17 Jul 2025 00:20:31 +0000	[thread overview]
Message-ID: <03c5ab84de5e459b87c9c529818ec4e2@realtek.com> (raw)
In-Reply-To: <0dab5755-4801-46c4-b78d-d8d3f0cf042b@gmail.com>

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> On 16/07/2025 03:17, Ping-Ke Shih wrote:
> > Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> >> This read_poll_timeout_atomic() with a delay of 1 µs and a timeout of
> >> 1000000 µs can take ~250 seconds in the worst case because sending a
> >> USB control message takes ~250 µs.
> >>
> >> Lower the timeout to 4000 for USB in order to reduce the maximum polling
> >> time to ~1 second.
> >>
> >> This problem was observed with RTL8851BU while suspending to RAM with
> >> WOWLAN enabled. The computer sat for 4 minutes with a black screen
> >> before suspending.
> >>
> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> >> ---
> >> v2:
> >>  - Lower the timeout for USB instead of increasing the delay.
> >> ---
> >>  drivers/net/wireless/realtek/rtw89/fw.c | 9 +++++++--
> >>  drivers/net/wireless/realtek/rtw89/fw.h | 2 ++
> >>  2 files changed, 9 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
> >> index 73a4ec988d16..b774a329e7c7 100644
> >> --- a/drivers/net/wireless/realtek/rtw89/fw.c
> >> +++ b/drivers/net/wireless/realtek/rtw89/fw.c
> >> @@ -6755,13 +6755,18 @@ static int rtw89_fw_read_c2h_reg(struct rtw89_dev *rtwdev,
> >>         const struct rtw89_chip_info *chip = rtwdev->chip;
> >>         struct rtw89_fw_info *fw_info = &rtwdev->fw;
> >>         const u32 *c2h_reg = chip->c2h_regs;
> >> -       u32 ret;
> >> +       u32 ret, timeout;
> >>         u8 i, val;
> >>
> >>         info->id = RTW89_FWCMD_C2HREG_FUNC_NULL;
> >>
> >> +       if (rtwdev->hci.type == RTW89_HCI_TYPE_USB)
> >> +               timeout = RTW89_C2H_TIMEOUT_USB;
> >
> > Should we have different timeout times for USB2 and USB3?
> > The same question for patch 2/2.
> >
> 
> I measured the time it takes to read R_AX_WCPU_FW_CTRL (patch 2/2):
> 
>                 USB 2           USB 3
> RTL8851BU       125 µs          not supported
> RTL8852BU       250 µs          40 µs
> RTL8852CU       375 µs          40 µs
> 
> In my setup the same timeout works for both. Even with the faster reads
> it still waits long enough.

Thanks for the info. 



  reply	other threads:[~2025-07-17  0:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 19:44 [PATCH rtw-next v2 1/2] wifi: rtw89: Lower the timeout in rtw89_fw_read_c2h_reg() for USB Bitterblue Smith
2025-07-15 19:46 ` [PATCH rtw-next v2 2/2] wifi: rtw89: Lower the timeout in rtw89_fwdl_check_path_ready_ax() " Bitterblue Smith
2025-07-16  0:17 ` [PATCH rtw-next v2 1/2] wifi: rtw89: Lower the timeout in rtw89_fw_read_c2h_reg() " Ping-Ke Shih
2025-07-16 21:31   ` Bitterblue Smith
2025-07-17  0:20     ` Ping-Ke Shih [this message]
2025-07-18  6: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=03c5ab84de5e459b87c9c529818ec4e2@realtek.com \
    --to=pkshih@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rtl8821cerfe2@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox