diff options
author | Lazar Alexei <qca_ailizaro@qca.qualcomm.com> | 2017-11-14 08:25:44 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2017-12-02 09:19:17 -0500 |
commit | bd8bdc6ca8180afe21724cbd362847517a73b213 (patch) | |
tree | c11adc407b545bb478eb7831154d98adbeaedc8d | |
parent | 05898dd98830f62e60faa41a4ec6acecb9d6cdd1 (diff) |
wil6210: update statistics for suspend
Currently the statistics show how many successful/failed
suspend/resume operations the system had.
Update the statistics by splitting each successful/failed
suspend/resume operations to radio on/off.
Signed-off-by: Lazar Alexei <qca_ailizaro@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/wil6210/debugfs.c | 47 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/pcie_bus.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/pm.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil6210.h | 11 |
4 files changed, 59 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index edaab0f5a11e..4475937faf25 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -1641,24 +1641,41 @@ static ssize_t wil_read_suspend_stats(struct file *file, | |||
1641 | size_t count, loff_t *ppos) | 1641 | size_t count, loff_t *ppos) |
1642 | { | 1642 | { |
1643 | struct wil6210_priv *wil = file->private_data; | 1643 | struct wil6210_priv *wil = file->private_data; |
1644 | static char text[400]; | 1644 | char *text; |
1645 | int n; | 1645 | int n, ret, text_size = 500; |
1646 | |||
1647 | text = kmalloc(text_size, GFP_KERNEL); | ||
1648 | if (!text) | ||
1649 | return -ENOMEM; | ||
1646 | 1650 | ||
1647 | n = snprintf(text, sizeof(text), | 1651 | n = snprintf(text, text_size, |
1648 | "Suspend statistics:\n" | 1652 | "Radio on suspend statistics:\n" |
1649 | "successful suspends:%ld failed suspends:%ld\n" | 1653 | "successful suspends:%ld failed suspends:%ld\n" |
1650 | "successful resumes:%ld failed resumes:%ld\n" | 1654 | "successful resumes:%ld failed resumes:%ld\n" |
1651 | "rejected by host:%ld rejected by device:%ld\n", | 1655 | "rejected by device:%ld\n" |
1652 | wil->suspend_stats.successful_suspends, | 1656 | "Radio off suspend statistics:\n" |
1653 | wil->suspend_stats.failed_suspends, | 1657 | "successful suspends:%ld failed suspends:%ld\n" |
1654 | wil->suspend_stats.successful_resumes, | 1658 | "successful resumes:%ld failed resumes:%ld\n" |
1655 | wil->suspend_stats.failed_resumes, | 1659 | "General statistics:\n" |
1656 | wil->suspend_stats.rejected_by_host, | 1660 | "rejected by host:%ld\n", |
1657 | wil->suspend_stats.rejected_by_device); | 1661 | wil->suspend_stats.r_on.successful_suspends, |
1658 | 1662 | wil->suspend_stats.r_on.failed_suspends, | |
1659 | n = min_t(int, n, sizeof(text)); | 1663 | wil->suspend_stats.r_on.successful_resumes, |
1660 | 1664 | wil->suspend_stats.r_on.failed_resumes, | |
1661 | return simple_read_from_buffer(user_buf, count, ppos, text, n); | 1665 | wil->suspend_stats.rejected_by_device, |
1666 | wil->suspend_stats.r_off.successful_suspends, | ||
1667 | wil->suspend_stats.r_off.failed_suspends, | ||
1668 | wil->suspend_stats.r_off.successful_resumes, | ||
1669 | wil->suspend_stats.r_off.failed_resumes, | ||
1670 | wil->suspend_stats.rejected_by_host); | ||
1671 | |||
1672 | n = min_t(int, n, text_size); | ||
1673 | |||
1674 | ret = simple_read_from_buffer(user_buf, count, ppos, text, n); | ||
1675 | |||
1676 | kfree(text); | ||
1677 | |||
1678 | return ret; | ||
1662 | } | 1679 | } |
1663 | 1680 | ||
1664 | static const struct file_operations fops_suspend_stats = { | 1681 | static const struct file_operations fops_suspend_stats = { |
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 0592c73745cb..42a5480c764d 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c | |||
@@ -391,14 +391,16 @@ static int wil6210_suspend(struct device *dev, bool is_runtime) | |||
391 | 391 | ||
392 | rc = wil_suspend(wil, is_runtime, keep_radio_on); | 392 | rc = wil_suspend(wil, is_runtime, keep_radio_on); |
393 | if (!rc) { | 393 | if (!rc) { |
394 | wil->suspend_stats.successful_suspends++; | ||
395 | |||
396 | /* In case radio stays on, platform device will control | 394 | /* In case radio stays on, platform device will control |
397 | * PCIe master | 395 | * PCIe master |
398 | */ | 396 | */ |
399 | if (!keep_radio_on) | 397 | if (!keep_radio_on) { |
400 | /* disable bus mastering */ | 398 | /* disable bus mastering */ |
401 | pci_clear_master(pdev); | 399 | pci_clear_master(pdev); |
400 | wil->suspend_stats.r_off.successful_suspends++; | ||
401 | } else { | ||
402 | wil->suspend_stats.r_on.successful_suspends++; | ||
403 | } | ||
402 | } | 404 | } |
403 | out: | 405 | out: |
404 | return rc; | 406 | return rc; |
@@ -424,11 +426,17 @@ static int wil6210_resume(struct device *dev, bool is_runtime) | |||
424 | rc = wil_resume(wil, is_runtime, keep_radio_on); | 426 | rc = wil_resume(wil, is_runtime, keep_radio_on); |
425 | if (rc) { | 427 | if (rc) { |
426 | wil_err(wil, "device failed to resume (%d)\n", rc); | 428 | wil_err(wil, "device failed to resume (%d)\n", rc); |
427 | wil->suspend_stats.failed_resumes++; | 429 | if (!keep_radio_on) { |
428 | if (!keep_radio_on) | ||
429 | pci_clear_master(pdev); | 430 | pci_clear_master(pdev); |
431 | wil->suspend_stats.r_off.failed_resumes++; | ||
432 | } else { | ||
433 | wil->suspend_stats.r_on.failed_resumes++; | ||
434 | } | ||
430 | } else { | 435 | } else { |
431 | wil->suspend_stats.successful_resumes++; | 436 | if (keep_radio_on) |
437 | wil->suspend_stats.r_on.successful_resumes++; | ||
438 | else | ||
439 | wil->suspend_stats.r_off.successful_resumes++; | ||
432 | } | 440 | } |
433 | 441 | ||
434 | return rc; | 442 | return rc; |
diff --git a/drivers/net/wireless/ath/wil6210/pm.c b/drivers/net/wireless/ath/wil6210/pm.c index 9fba237be358..056b180fad7f 100644 --- a/drivers/net/wireless/ath/wil6210/pm.c +++ b/drivers/net/wireless/ath/wil6210/pm.c | |||
@@ -183,7 +183,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil) | |||
183 | break; | 183 | break; |
184 | wil_err(wil, | 184 | wil_err(wil, |
185 | "TO waiting for idle RX, suspend failed\n"); | 185 | "TO waiting for idle RX, suspend failed\n"); |
186 | wil->suspend_stats.failed_suspends++; | 186 | wil->suspend_stats.r_on.failed_suspends++; |
187 | goto resume_after_fail; | 187 | goto resume_after_fail; |
188 | } | 188 | } |
189 | wil_dbg_ratelimited(wil, "rx vring is not empty -> NAPI\n"); | 189 | wil_dbg_ratelimited(wil, "rx vring is not empty -> NAPI\n"); |
@@ -199,7 +199,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil) | |||
199 | */ | 199 | */ |
200 | if (!wil_is_wmi_idle(wil)) { | 200 | if (!wil_is_wmi_idle(wil)) { |
201 | wil_err(wil, "suspend failed due to pending WMI events\n"); | 201 | wil_err(wil, "suspend failed due to pending WMI events\n"); |
202 | wil->suspend_stats.failed_suspends++; | 202 | wil->suspend_stats.r_on.failed_suspends++; |
203 | goto resume_after_fail; | 203 | goto resume_after_fail; |
204 | } | 204 | } |
205 | 205 | ||
@@ -213,7 +213,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil) | |||
213 | if (rc) { | 213 | if (rc) { |
214 | wil_err(wil, "platform device failed to suspend (%d)\n", | 214 | wil_err(wil, "platform device failed to suspend (%d)\n", |
215 | rc); | 215 | rc); |
216 | wil->suspend_stats.failed_suspends++; | 216 | wil->suspend_stats.r_on.failed_suspends++; |
217 | wil_c(wil, RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); | 217 | wil_c(wil, RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); |
218 | wil_unmask_irq(wil); | 218 | wil_unmask_irq(wil); |
219 | goto resume_after_fail; | 219 | goto resume_after_fail; |
@@ -260,6 +260,7 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil) | |||
260 | rc = wil_down(wil); | 260 | rc = wil_down(wil); |
261 | if (rc) { | 261 | if (rc) { |
262 | wil_err(wil, "wil_down : %d\n", rc); | 262 | wil_err(wil, "wil_down : %d\n", rc); |
263 | wil->suspend_stats.r_off.failed_suspends++; | ||
263 | goto out; | 264 | goto out; |
264 | } | 265 | } |
265 | } | 266 | } |
@@ -272,6 +273,7 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil) | |||
272 | rc = wil->platform_ops.suspend(wil->platform_handle, false); | 273 | rc = wil->platform_ops.suspend(wil->platform_handle, false); |
273 | if (rc) { | 274 | if (rc) { |
274 | wil_enable_irq(wil); | 275 | wil_enable_irq(wil); |
276 | wil->suspend_stats.r_off.failed_suspends++; | ||
275 | goto out; | 277 | goto out; |
276 | } | 278 | } |
277 | } | 279 | } |
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index ea04117f2adf..cf27d9711dde 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
@@ -82,12 +82,17 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1) | |||
82 | */ | 82 | */ |
83 | #define WIL_MAX_MPDU_OVERHEAD (62) | 83 | #define WIL_MAX_MPDU_OVERHEAD (62) |
84 | 84 | ||
85 | struct wil_suspend_stats { | 85 | struct wil_suspend_count_stats { |
86 | unsigned long successful_suspends; | 86 | unsigned long successful_suspends; |
87 | unsigned long failed_suspends; | ||
88 | unsigned long successful_resumes; | 87 | unsigned long successful_resumes; |
88 | unsigned long failed_suspends; | ||
89 | unsigned long failed_resumes; | 89 | unsigned long failed_resumes; |
90 | unsigned long rejected_by_device; | 90 | }; |
91 | |||
92 | struct wil_suspend_stats { | ||
93 | struct wil_suspend_count_stats r_off; | ||
94 | struct wil_suspend_count_stats r_on; | ||
95 | unsigned long rejected_by_device; /* only radio on */ | ||
91 | unsigned long rejected_by_host; | 96 | unsigned long rejected_by_host; |
92 | }; | 97 | }; |
93 | 98 | ||