1 From: Ben Greear <greearb@candelatech.com>
2 Date: Wed, 31 May 2017 14:21:21 +0300
3 Subject: [PATCH] ath10k: log when longer bmi cmds happen
5 This lets one have a clue that maybe timeouts are happening
6 when we just aren't waiting long enough.
8 Signed-off-by: Ben Greear <greearb@candelatech.com>
9 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
12 --- a/drivers/net/wireless/ath/ath10k/pci.c
13 +++ b/drivers/net/wireless/ath/ath10k/pci.c
14 @@ -101,7 +101,8 @@ static int ath10k_pci_init_irq(struct at
15 static int ath10k_pci_deinit_irq(struct ath10k *ar);
16 static int ath10k_pci_request_irq(struct ath10k *ar);
17 static void ath10k_pci_free_irq(struct ath10k *ar);
18 -static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
19 +static int ath10k_pci_bmi_wait(struct ath10k *ar,
20 + struct ath10k_ce_pipe *tx_pipe,
21 struct ath10k_ce_pipe *rx_pipe,
22 struct bmi_xfer *xfer);
23 static int ath10k_pci_qca99x0_chip_reset(struct ath10k *ar);
24 @@ -1843,7 +1844,7 @@ int ath10k_pci_hif_exchange_bmi_msg(stru
28 - ret = ath10k_pci_bmi_wait(ce_tx, ce_rx, &xfer);
29 + ret = ath10k_pci_bmi_wait(ar, ce_tx, ce_rx, &xfer);
32 unsigned int unused_nbytes;
33 @@ -1910,23 +1911,37 @@ static void ath10k_pci_bmi_recv_data(str
37 -static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
38 +static int ath10k_pci_bmi_wait(struct ath10k *ar,
39 + struct ath10k_ce_pipe *tx_pipe,
40 struct ath10k_ce_pipe *rx_pipe,
41 struct bmi_xfer *xfer)
43 unsigned long timeout = jiffies + BMI_COMMUNICATION_TIMEOUT_HZ;
44 + unsigned long started = jiffies;
48 while (time_before_eq(jiffies, timeout)) {
49 ath10k_pci_bmi_send_done(tx_pipe);
50 ath10k_pci_bmi_recv_data(rx_pipe);
52 - if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp))
54 + if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp)) {
66 + dur = jiffies - started;
68 + ath10k_dbg(ar, ATH10K_DBG_BMI,
69 + "bmi cmd took %lu jiffies hz %d ret %d\n",