From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <damon.chen@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 10/12] wifi: rtw89: debug: add SER SW counters to count simulation
Date: Fri, 13 Feb 2026 14:15:50 +0800 [thread overview]
Message-ID: <20260213061552.29997-11-pkshih@realtek.com> (raw)
In-Reply-To: <20260213061552.29997-1-pkshih@realtek.com>
From: Zong-Zhe Yang <kevin_yang@realtek.com>
Some chipsets, e.g. Wi-Fi 7, will not record SER (system error recovery),
which are triggered by simulations, in the HW counters. Their HW counters
only record the SER happen in field. However for verification, it's still
needed to check if simulations are triggered. So, add SW counters to count
any causes that SER happen. But, SW can only count L1 and L2. SW does not
involve L0 SER, so SW cannot count it.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/core.h | 7 +++++++
drivers/net/wireless/realtek/rtw89/debug.c | 6 ++++++
drivers/net/wireless/realtek/rtw89/ser.c | 2 ++
3 files changed, 15 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 1ad1fd2a1f6f..5d1cec20bc80 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -5753,11 +5753,18 @@ enum rtw89_ser_rcvy_step {
RTW89_NUM_OF_SER_FLAGS
};
+struct rtw89_ser_count {
+ unsigned int l1;
+ unsigned int l2;
+};
+
struct rtw89_ser {
u8 state;
u8 alarm_event;
bool prehandle_l1;
+ struct rtw89_ser_count sw_cnt;
+
struct work_struct ser_hdl_work;
struct delayed_work ser_alarm_work;
const struct state_ent *st_tbl;
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index d46691fa09bc..4cff3d927a69 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -3780,6 +3780,7 @@ static ssize_t rtw89_debug_priv_ser_counters_get(struct rtw89_dev *rtwdev,
struct rtw89_debugfs_priv *debugfs_priv,
char *buf, size_t bufsz)
{
+ const struct rtw89_ser_count *sw_cnt = &rtwdev->ser.sw_cnt;
const struct rtw89_chip_info *chip = rtwdev->chip;
struct rtw89_dbg_ser_counters cnt = {};
char *p = buf, *end = buf + bufsz;
@@ -3797,6 +3798,11 @@ static ssize_t rtw89_debug_priv_ser_counters_get(struct rtw89_dev *rtwdev,
return -EOPNOTSUPP;
}
+ p += scnprintf(p, end - p, "SER L1 SW Count: %u\n", sw_cnt->l1);
+ p += scnprintf(p, end - p, "SER L2 SW Count: %u\n", sw_cnt->l2);
+
+ /* Some chipsets won't record SER simulation in HW cnt. */
+ p += scnprintf(p, end - p, "---\n");
p += scnprintf(p, end - p, "SER L0 Count: %d\n", cnt.l0);
p += scnprintf(p, end - p, "SER L1 Count: %d\n", cnt.l1);
p += scnprintf(p, end - p, "SER L0 promote event: %d\n", cnt.l0_to_l1);
diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c
index 7fdc69578da3..b2c910cf9587 100644
--- a/drivers/net/wireless/realtek/rtw89/ser.c
+++ b/drivers/net/wireless/realtek/rtw89/ser.c
@@ -498,6 +498,7 @@ static void ser_reset_trx_st_hdl(struct rtw89_ser *ser, u8 evt)
switch (evt) {
case SER_EV_STATE_IN:
wiphy_lock(wiphy);
+ ser->sw_cnt.l1++;
wiphy_delayed_work_cancel(wiphy, &rtwdev->track_work);
wiphy_delayed_work_cancel(wiphy, &rtwdev->track_ps_work);
wiphy_unlock(wiphy);
@@ -730,6 +731,7 @@ static void ser_l2_reset_st_hdl(struct rtw89_ser *ser, u8 evt)
switch (evt) {
case SER_EV_STATE_IN:
wiphy_lock(rtwdev->hw->wiphy);
+ ser->sw_cnt.l2++;
ser_l2_reset_st_pre_hdl(ser);
wiphy_unlock(rtwdev->hw->wiphy);
--
2.25.1
next prev parent reply other threads:[~2026-02-13 6:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 6:15 [PATCH rtw-next 00/12] wifi: rtw89: refine to read HW parameters from file, and update SER code Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 01/12] wifi: rtw89: fw: add fw_def struct to put firmware name and format version Ping-Ke Shih
2026-03-03 2:48 ` Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 02/12] wifi: rtw89: fw: recognize firmware type B by AID Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 03/12] wifi: rtw89: add general way to generate module firmware string Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 04/12] wifi: rtw89: 8852b: update supported firmware format to 2 Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 05/12] wifi: rtw89: 8852a: move DIG tables to rtw8852a.c Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 06/12] wifi: rtw89: 8852a: update supported firmware format to 1 Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 07/12] wifi: rtw89: 8851b: " Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 08/12] wifi: rtw89: add H2C command to protect TX/RX for unused PHY Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 09/12] wifi: rtw89: rfk: add hardware version to rtw89_fw_h2c_rf_pre_ntfy_mcc for new WiFi 7 firmware Ping-Ke Shih
2026-02-13 6:15 ` Ping-Ke Shih [this message]
2026-02-13 6:15 ` [PATCH rtw-next 11/12] wifi: rtw89: ser: Wi-Fi 7 reset HALT C2H after reading it Ping-Ke Shih
2026-02-13 6:15 ` [PATCH rtw-next 12/12] wifi: rtw89: ser: post-recover DMAC state to prevent LPS 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=20260213061552.29997-11-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=damon.chen@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
/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