Skip to content

Commit

Permalink
rtw88: refine fw_crash debugfs to show non-zero while triggering
Browse files Browse the repository at this point in the history
The usage of fw_crash debugfs is to write 1 to it to trigger fw crash
simulation and to read from it to check the state. When zero is read,
it is supposed to mean fw crash/restart process is done. Then, some
test plans can be designed for crash/restart.
e.g.
step 1. trigger fw crash simulation
step 2. poll the state until zero is read
step 3. check connection by ping test

However, in certain connection cases, triggering fw crash simulation
will take a while. If the state is queried too early before restart
begins processing, it may mistakenly think restart process has been
done. If some tests are started at this time, something unexpected
might happen due to the follow-up restart process.

To avoid that, let fw_crash also show non-zero when a simulation
is still triggering.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211001082301.4805-1-pkshih@realtek.com
  • Loading branch information
Zong-Zhe Yang authored and Kalle Valo committed Oct 5, 2021
1 parent c5a8e90 commit 6cd4b59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/wireless/realtek/rtw88/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ static ssize_t rtw_debugfs_set_fw_crash(struct file *filp,

mutex_lock(&rtwdev->mutex);
rtw_leave_lps_deep(rtwdev);
set_bit(RTW_FLAG_RESTART_TRIGGERING, rtwdev->flags);
rtw_write8(rtwdev, REG_HRCV_MSG, 1);
mutex_unlock(&rtwdev->mutex);

Expand All @@ -897,7 +898,9 @@ static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v)
struct rtw_debugfs_priv *debugfs_priv = m->private;
struct rtw_dev *rtwdev = debugfs_priv->rtwdev;

seq_printf(m, "%d\n", test_bit(RTW_FLAG_RESTARTING, rtwdev->flags));
seq_printf(m, "%d\n",
test_bit(RTW_FLAG_RESTART_TRIGGERING, rtwdev->flags) ||
test_bit(RTW_FLAG_RESTARTING, rtwdev->flags));
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/realtek/rtw88/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ static void __fw_recovery_work(struct rtw_dev *rtwdev)
int ret = 0;

set_bit(RTW_FLAG_RESTARTING, rtwdev->flags);
clear_bit(RTW_FLAG_RESTART_TRIGGERING, rtwdev->flags);

ret = rtw_fwcd_prep(rtwdev);
if (ret)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/realtek/rtw88/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ enum rtw_flags {
RTW_FLAG_BUSY_TRAFFIC,
RTW_FLAG_WOWLAN,
RTW_FLAG_RESTARTING,
RTW_FLAG_RESTART_TRIGGERING,

NUM_OF_RTW_FLAGS,
};
Expand Down

0 comments on commit 6cd4b59

Please sign in to comment.