On 2020-08-15 01:19, Kalle Valo wrote:
...
I have been thinking a different approach for this. I think another
option is to have a function like this:
ath10k_core_firmware_crashed()
{
queue_work(ar->workqueue, &ar->restart_work);
}
In patch 1 we would convert all existing callers to call that
function instead of queue_work() directly.
In patch 2 we would add a new flag to enum ath10k_dev_flags, or maybe
should actually use existing ATH10K_FLAG_CRASH_FLUSH? Don't know yet
which one is better. Now the function would do:
ath10k_core_firmware_crashed()
{
if (test_bit(flag))
return
set_bit(flag)
queue_work(ar->workqueue, &ar->restart_work);
}
It is better to clear_bit ATH10K_FLAG_CRASH_FLUSH/new flag in
ath10k_reconfig_complete
instead of ath10k_core_start because ieee80211_reconfig(called by
ieee80211_restart_work)
of mac80211 do many things and drv_start is 1st thing and
drv_reconfig_complete is last thing.
That way restart_work queue would be called only one time.
Though I'm not sure how ATH10K_STATE_WEDGED would behave after this
change, it might get broken. Ah, actually I think even this patch
breaks
the WEDGED state. This firmware restart is tricky, difficult to say
what
is the best approach. Michal, are you reading? :) Any ideas?
And after looking more about this patch I don't see the need for the
new
ar->restart_count atomic variable. Checking for ATH10K_FLAG_CRASH_FLUSH
would do the same thing AFAICS.
And related to this, (in a separate patch) I think we should utilise
ATH10K_FLAG_CRASH_FLUSH more. For example in ath10k_wmi_cmd_send() to
not even try to send a WMI command if the flag is set. Basically all
hardware access should be disabled except what is needed to restart the
firmware.