]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mwifiex: pcie: clear outstanding work when resetting
authorBrian Norris <briannorris@chromium.org>
Fri, 14 Apr 2017 21:51:19 +0000 (14:51 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 20 Apr 2017 07:21:53 +0000 (10:21 +0300)
When we shut down the device (i.e., during 'reset'), we cancel any
outstanding work, but we don't clear any work-related flags. This can
cause problems if, e.g., we begin to queue a new firmware dump or card
reset while the other one is in progress. That might leave work_flags
with a stale value, and we might begin one of these *after* we've
completely reset the device. That doesn't make sense, because all
firmware context will have been lost by then.

This fixes some forms of cascading failures, where I:

(a) force a firmware dump (cat /sys/kernel/debug/mwifiex/mlan0/device_dump)
(b) run a Wifi scan in parallel (iw mlan0 scan)
(c) the scan times out due to (a) hogging the interface
(d) the command timeout triggers another firmware dump and a reset [*]
(e) the 2nd firmware dump flag persists across the reset
(f) as soon as the interface comes back up, we trigger the pending
    firmware dump
(g) subsequent commands time out again, while we are processing the
    firmware dump; return to (d)

[*] Note that automatic card_reset() support is not yet implemented for
the mwifiex PCIe driver, so we won't hit *exactly* this behavior yet.
But we can see similarly-confusing behaviors today.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/pcie.c

index d44bd3faed0eab4b0bb8b158dc7d705a6baf1956..ac62bce50e964b900135cdc600dcdb9032928a3f 100644 (file)
@@ -371,6 +371,8 @@ static void mwifiex_pcie_reset_notify(struct pci_dev *pdev, bool prepare)
                 */
                mwifiex_shutdown_sw(adapter);
                adapter->surprise_removed = true;
                 */
                mwifiex_shutdown_sw(adapter);
                adapter->surprise_removed = true;
+               clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags);
+               clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags);
        } else {
                /* Kernel stores and restores PCIe function context before and
                 * after performing FLR respectively. Reconfigure the software
        } else {
                /* Kernel stores and restores PCIe function context before and
                 * after performing FLR respectively. Reconfigure the software