mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luka Gejak" <luka.gejak@linux.dev>
To: "Kalpesh Solanki" <skalpesh942@gmail.com>,
	pkshih@realtek.com, kvalo@kernel.org
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Kalpesh Solanki" <skalpesh942@gmail.com>
Subject: Re: [PATCH v2 2/2] wifi: rtw88: ps: Trigger firmware recovery when failing to leave LPS state
Date: Fri, 06 Nov 2026 15:33:49 +0000	[thread overview]
Message-ID: <0dbdce9823a6ac3f68640fdeb3b3d1197b04fa58@linux.dev> (raw)
In-Reply-To: <20261103031434.14449-2-skalpesh942@gmail.com>

Hi Kalpesh,

Thanks for the patch. I know this is already applied, but I have two
comments.

November 3, 2026 at 4:14 AM, "Kalpesh Solanki" <skalpesh942@gmail.com> wrote:

> diff --git a/drivers/net/wireless/realtek/rtw88/ps.c b/drivers/net/wireless/realtek/rtw88/ps.c
> index add5a20b8432..8dba60f3464c 100644
> --- a/drivers/net/wireless/realtek/rtw88/ps.c
> +++ b/drivers/net/wireless/realtek/rtw88/ps.c
> @@ -166,6 +166,7 @@ static void rtw_fw_leave_lps_check(struct rtw_dev *rtwdev)
>               rtw_write32_clr(rtwdev, REG_TCR, BIT_PWRMGT_HWDATA_EN);
>               rtw_warn(rtwdev, "firmware failed to leave lps state\n");
>               rtw_fw_dump_dbg_info(rtwdev);
> +             rtw_fw_recovery(rtwdev);
>       }
>  }

As far as I can see, this timeout doesn't always mean the firmware is
stuck. The comment in __rtw_fw_leave_lps_check_reg() says REG_TCR is
only restored once the AP has acked the null frame, and 3a2dd6b7cadf
("rtw88: check firmware leave lps successfully") says that frame can
take much longer in a noisy environment. That is why the old code just
cleared the bit and warned.

So if I read it right, a busy channel or a weak link now ends in the
WARN() in __fw_recovery_work() and a full ieee80211_restart_hw(). The
watchdog leaves LPS every two seconds on an idle link, and
BCN_FILTER_NOTIFY_BEACON_LOSS leaves it right when the AP may be gone.
This also reaches USB and SDIO now, which had no way to trigger
rtw_fw_recovery() before.

rtw89 only recovers after RTW89_PS_HANG_MAX_CNT failures in a row.
Would you be willing to send a follow up that does the same here?

There also seems to be a path where the recovery never completes.
rtw_leave_lps() also runs from ieee80211_set_disassoc() through
rtw_recalc_lps(). If the check times out there while the last interface
goes down, or on a suspend without WoWLAN, the queued work runs before
drv_stop(). mac80211 then never calls drv_reconfig_complete() with
IEEE80211_RECONFIG_TYPE_RESTART, so RTW_FLAG_RESTARTING stays set and
rtw_fw_recovery() does nothing until the driver is reloaded, also for
real firmware crashes. Maybe rtw_ops_stop() could clear it as well?

Best regards,
Luka Gejak

  parent reply	other threads:[~2026-11-06 15:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03  3:14 [PATCH v2 1/2] wifi: rtw88: pci: Add DMI quirk for HP Laptop 15s-fr5xxx Kalpesh Solanki
2026-11-03  3:14 ` [PATCH v2 2/2] wifi: rtw88: ps: Trigger firmware recovery when failing to leave LPS state Kalpesh Solanki
2026-11-03  3:17   ` Ping-Ke Shih
2026-11-06 15:33   ` Luka Gejak [this message]
2026-11-03  5:54 ` [PATCH v2 1/2] wifi: rtw88: pci: Add DMI quirk for HP Laptop 15s-fr5xxx 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=0dbdce9823a6ac3f68640fdeb3b3d1197b04fa58@linux.dev \
    --to=luka.gejak@linux.dev \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=skalpesh942@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

all inboxes | Powered by JetHome®