]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: debug: add SER SW counters to count simulation
authorZong-Zhe Yang <kevin_yang@realtek.com>
Fri, 13 Feb 2026 06:15:50 +0000 (14:15 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 3 Mar 2026 02:38:40 +0000 (10:38 +0800)
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>
Link: https://patch.msgid.link/20260213061552.29997-11-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/debug.c
drivers/net/wireless/realtek/rtw89/ser.c

index 1ad1fd2a1f6f20be74832decc332c316be8c8194..5d1cec20bc80c8ba6d1858cafa5c03543d82eda6 100644 (file)
@@ -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;
index 012ead92f5f2e7c084234495506b0f8c37ad9a76..3e16ed2c4570d54c25cf039829ce6c68c6706e64 100644 (file)
@@ -3781,6 +3781,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;
@@ -3798,6 +3799,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);
index f91e66133b3065d7189dca1b9c3e79fd29206781..75220042a9a7a5ea8985e25c7fbee8ca8ae96001 100644 (file)
@@ -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);