2
0

328-ath10k-log-when-longer-bmi-cmds-happen.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From: Ben Greear <[email protected]>
  2. Date: Wed, 31 May 2017 14:21:21 +0300
  3. Subject: [PATCH] ath10k: log when longer bmi cmds happen
  4. This lets one have a clue that maybe timeouts are happening
  5. when we just aren't waiting long enough.
  6. Signed-off-by: Ben Greear <[email protected]>
  7. Signed-off-by: Kalle Valo <[email protected]>
  8. ---
  9. --- a/drivers/net/wireless/ath/ath10k/pci.c
  10. +++ b/drivers/net/wireless/ath/ath10k/pci.c
  11. @@ -101,7 +101,8 @@ static int ath10k_pci_init_irq(struct at
  12. static int ath10k_pci_deinit_irq(struct ath10k *ar);
  13. static int ath10k_pci_request_irq(struct ath10k *ar);
  14. static void ath10k_pci_free_irq(struct ath10k *ar);
  15. -static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
  16. +static int ath10k_pci_bmi_wait(struct ath10k *ar,
  17. + struct ath10k_ce_pipe *tx_pipe,
  18. struct ath10k_ce_pipe *rx_pipe,
  19. struct bmi_xfer *xfer);
  20. static int ath10k_pci_qca99x0_chip_reset(struct ath10k *ar);
  21. @@ -1843,7 +1844,7 @@ int ath10k_pci_hif_exchange_bmi_msg(stru
  22. if (ret)
  23. goto err_resp;
  24. - ret = ath10k_pci_bmi_wait(ce_tx, ce_rx, &xfer);
  25. + ret = ath10k_pci_bmi_wait(ar, ce_tx, ce_rx, &xfer);
  26. if (ret) {
  27. u32 unused_buffer;
  28. unsigned int unused_nbytes;
  29. @@ -1910,23 +1911,37 @@ static void ath10k_pci_bmi_recv_data(str
  30. xfer->rx_done = true;
  31. }
  32. -static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
  33. +static int ath10k_pci_bmi_wait(struct ath10k *ar,
  34. + struct ath10k_ce_pipe *tx_pipe,
  35. struct ath10k_ce_pipe *rx_pipe,
  36. struct bmi_xfer *xfer)
  37. {
  38. unsigned long timeout = jiffies + BMI_COMMUNICATION_TIMEOUT_HZ;
  39. + unsigned long started = jiffies;
  40. + unsigned long dur;
  41. + int ret;
  42. while (time_before_eq(jiffies, timeout)) {
  43. ath10k_pci_bmi_send_done(tx_pipe);
  44. ath10k_pci_bmi_recv_data(rx_pipe);
  45. - if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp))
  46. - return 0;
  47. + if (xfer->tx_done && (xfer->rx_done == xfer->wait_for_resp)) {
  48. + ret = 0;
  49. + goto out;
  50. + }
  51. schedule();
  52. }
  53. - return -ETIMEDOUT;
  54. + ret = -ETIMEDOUT;
  55. +
  56. +out:
  57. + dur = jiffies - started;
  58. + if (dur > HZ)
  59. + ath10k_dbg(ar, ATH10K_DBG_BMI,
  60. + "bmi cmd took %lu jiffies hz %d ret %d\n",
  61. + dur, HZ, ret);
  62. + return ret;
  63. }
  64. /*