wifi: rt2x00: fix rt2800 watchdog function
authorShiji Yang <yangshiji66@outlook.com>
Sat, 14 Oct 2023 06:55:01 +0000 (14:55 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 23 Oct 2023 17:25:43 +0000 (20:25 +0300)
commit69708fbb2c698f262e03360d064c7066e0679953
tree3d91b3f9a8555f921c2c0623ab4b1f149d605750
parent359342795d62548f3ba4831914fccf20a24446b5
wifi: rt2x00: fix rt2800 watchdog function

The watchdog function is broken on rt2800 series SoCs. This patch
fixes the incorrect watchdog logic to make it work again.

1. Update current wdt queue index if it's not equal to the previous
   index. Watchdog compares the current and previous queue index to
   judge if the queue hung.
2. Make sure hung_{rx,tx} 'true' status won't be override by the
   normal queue. Any queue hangs should trigger a reset action.
3. Clear the watchdog counter of all queues before resetting the
   hardware. This change may help to avoid the reset loop.
4. Change hang check function return type to bool as we only need
   to return two status, yes or no.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/TYAP286MB0315BC1D83D31154924F0D39BCD1A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM
drivers/net/wireless/ralink/rt2x00/rt2800lib.c