qtnfmac: improve control path timeout handling

Control path will not be operational after firmware failure. Change bus
state to QTNF_FW_STATE_EP_DEAD after the control path timeout.
Don't wait for timeout if control path is already dead.

Signed-off-by: Dmitry Lebed <dlebed@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Dmitry Lebed 2018-05-29 15:00:01 +03:00 committed by Kalle Valo
parent 9a3beeb5b7
commit 9e33e7fb47
3 changed files with 15 additions and 5 deletions

View File

@ -27,7 +27,8 @@ enum qtnf_fw_state {
QTNF_FW_STATE_FW_DNLD_DONE,
QTNF_FW_STATE_BOOT_DONE,
QTNF_FW_STATE_ACTIVE,
QTNF_FW_STATE_DEAD,
QTNF_FW_STATE_DETACHED,
QTNF_FW_STATE_EP_DEAD,
};
struct qtnf_bus;

View File

@ -628,7 +628,7 @@ void qtnf_core_detach(struct qtnf_bus *bus)
if (bus->fw_state == QTNF_FW_STATE_ACTIVE)
qtnf_cmd_send_deinit_fw(bus);
bus->fw_state = QTNF_FW_STATE_DEAD;
bus->fw_state = QTNF_FW_STATE_DETACHED;
if (bus->workqueue) {
flush_workqueue(bus->workqueue);

View File

@ -751,8 +751,16 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb)
static int qtnf_pcie_control_tx(struct qtnf_bus *bus, struct sk_buff *skb)
{
struct qtnf_pcie_bus_priv *priv = (void *)get_bus_priv(bus);
int ret;
return qtnf_shm_ipc_send(&priv->shm_ipc_ep_in, skb->data, skb->len);
ret = qtnf_shm_ipc_send(&priv->shm_ipc_ep_in, skb->data, skb->len);
if (ret == -ETIMEDOUT) {
pr_err("EP firmware is dead\n");
bus->fw_state = QTNF_FW_STATE_EP_DEAD;
}
return ret;
}
static irqreturn_t qtnf_interrupt(int irq, void *data)
@ -1238,7 +1246,7 @@ static void qtnf_fw_work_handler(struct work_struct *work)
goto fw_load_exit;
fw_load_fail:
bus->fw_state = QTNF_FW_STATE_DEAD;
bus->fw_state = QTNF_FW_STATE_DETACHED;
fw_load_exit:
complete(&bus->firmware_init_complete);
@ -1408,7 +1416,8 @@ static void qtnf_pcie_remove(struct pci_dev *pdev)
wait_for_completion(&bus->firmware_init_complete);
if (bus->fw_state == QTNF_FW_STATE_ACTIVE)
if (bus->fw_state == QTNF_FW_STATE_ACTIVE ||
bus->fw_state == QTNF_FW_STATE_EP_DEAD)
qtnf_core_detach(bus);
priv = get_bus_priv(bus);