Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4340405 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: update statistics for suspend"

parents 7100ac69 770cb7cb
Loading
Loading
Loading
Loading
+32 −15
Original line number Original line Diff line number Diff line
@@ -1691,24 +1691,41 @@ static ssize_t wil_read_suspend_stats(struct file *file,
				      size_t count, loff_t *ppos)
				      size_t count, loff_t *ppos)
{
{
	struct wil6210_priv *wil = file->private_data;
	struct wil6210_priv *wil = file->private_data;
	static char text[400];
	char *text;
	int n;
	int n, ret, text_size = 500;


	n = snprintf(text, sizeof(text),
	text = kmalloc(text_size, GFP_KERNEL);
		     "Suspend statistics:\n"
	if (!text)
		return -ENOMEM;

	n = snprintf(text, text_size,
		     "Radio on suspend statistics:\n"
		     "successful suspends:%ld failed suspends:%ld\n"
		     "successful suspends:%ld failed suspends:%ld\n"
		     "successful resumes:%ld failed resumes:%ld\n"
		     "successful resumes:%ld failed resumes:%ld\n"
		     "rejected by host:%ld rejected by device:%ld\n",
		     "rejected by device:%ld\n"
		     wil->suspend_stats.successful_suspends,
		     "Radio off suspend statistics:\n"
		     wil->suspend_stats.failed_suspends,
		     "successful suspends:%ld failed suspends:%ld\n"
		     wil->suspend_stats.successful_resumes,
		     "successful resumes:%ld failed resumes:%ld\n"
		     wil->suspend_stats.failed_resumes,
		     "General statistics:\n"
		     wil->suspend_stats.rejected_by_host,
		     "rejected by host:%ld\n",
		     wil->suspend_stats.rejected_by_device);
		     wil->suspend_stats.r_on.successful_suspends,
		     wil->suspend_stats.r_on.failed_suspends,
		     wil->suspend_stats.r_on.successful_resumes,
		     wil->suspend_stats.r_on.failed_resumes,
		     wil->suspend_stats.rejected_by_device,
		     wil->suspend_stats.r_off.successful_suspends,
		     wil->suspend_stats.r_off.failed_suspends,
		     wil->suspend_stats.r_off.successful_resumes,
		     wil->suspend_stats.r_off.failed_resumes,
		     wil->suspend_stats.rejected_by_host);

	n = min_t(int, n, text_size);


	n = min_t(int, n, sizeof(text));
	ret = simple_read_from_buffer(user_buf, count, ppos, text, n);


	return simple_read_from_buffer(user_buf, count, ppos, text, n);
	kfree(text);

	return ret;
}
}


static const struct file_operations fops_suspend_stats = {
static const struct file_operations fops_suspend_stats = {
+14 −6
Original line number Original line Diff line number Diff line
@@ -405,14 +405,16 @@ static int wil6210_suspend(struct device *dev, bool is_runtime)


	rc = wil_suspend(wil, is_runtime, keep_radio_on);
	rc = wil_suspend(wil, is_runtime, keep_radio_on);
	if (!rc) {
	if (!rc) {
		wil->suspend_stats.successful_suspends++;

		/* In case radio stays on, platform device will control
		/* In case radio stays on, platform device will control
		 * PCIe master
		 * PCIe master
		 */
		 */
		if (!keep_radio_on)
		if (!keep_radio_on) {
			/* disable bus mastering */
			/* disable bus mastering */
			pci_clear_master(pdev);
			pci_clear_master(pdev);
			wil->suspend_stats.r_off.successful_suspends++;
		} else {
			wil->suspend_stats.r_on.successful_suspends++;
		}
	}
	}
out:
out:
	return rc;
	return rc;
@@ -438,11 +440,17 @@ static int wil6210_resume(struct device *dev, bool is_runtime)
	rc = wil_resume(wil, is_runtime, keep_radio_on);
	rc = wil_resume(wil, is_runtime, keep_radio_on);
	if (rc) {
	if (rc) {
		wil_err(wil, "device failed to resume (%d)\n", rc);
		wil_err(wil, "device failed to resume (%d)\n", rc);
		wil->suspend_stats.failed_resumes++;
		if (!keep_radio_on) {
		if (!keep_radio_on)
			pci_clear_master(pdev);
			pci_clear_master(pdev);
			wil->suspend_stats.r_off.failed_resumes++;
		} else {
			wil->suspend_stats.r_on.failed_resumes++;
		}
	} else {
	} else {
		wil->suspend_stats.successful_resumes++;
		if (keep_radio_on)
			wil->suspend_stats.r_on.successful_resumes++;
		else
			wil->suspend_stats.r_off.successful_resumes++;
	}
	}


	return rc;
	return rc;
+5 −3
Original line number Original line Diff line number Diff line
@@ -186,7 +186,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil)
					break;
					break;
				wil_err(wil,
				wil_err(wil,
					"TO waiting for idle RX, suspend failed\n");
					"TO waiting for idle RX, suspend failed\n");
				wil->suspend_stats.failed_suspends++;
				wil->suspend_stats.r_on.failed_suspends++;
				goto resume_after_fail;
				goto resume_after_fail;
			}
			}
			wil_dbg_ratelimited(wil, "rx vring is not empty -> NAPI\n");
			wil_dbg_ratelimited(wil, "rx vring is not empty -> NAPI\n");
@@ -202,7 +202,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil)
	 */
	 */
	if (!wil_is_wmi_idle(wil)) {
	if (!wil_is_wmi_idle(wil)) {
		wil_err(wil, "suspend failed due to pending WMI events\n");
		wil_err(wil, "suspend failed due to pending WMI events\n");
		wil->suspend_stats.failed_suspends++;
		wil->suspend_stats.r_on.failed_suspends++;
		goto resume_after_fail;
		goto resume_after_fail;
	}
	}


@@ -216,7 +216,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil)
		if (rc) {
		if (rc) {
			wil_err(wil, "platform device failed to suspend (%d)\n",
			wil_err(wil, "platform device failed to suspend (%d)\n",
				rc);
				rc);
			wil->suspend_stats.failed_suspends++;
			wil->suspend_stats.r_on.failed_suspends++;
			wil_c(wil, RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD);
			wil_c(wil, RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD);
			wil_unmask_irq(wil);
			wil_unmask_irq(wil);
			goto resume_after_fail;
			goto resume_after_fail;
@@ -272,6 +272,7 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil)
		rc = wil_down(wil);
		rc = wil_down(wil);
		if (rc) {
		if (rc) {
			wil_err(wil, "wil_down : %d\n", rc);
			wil_err(wil, "wil_down : %d\n", rc);
			wil->suspend_stats.r_off.failed_suspends++;
			goto out;
			goto out;
		}
		}
	}
	}
@@ -284,6 +285,7 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil)
		rc = wil->platform_ops.suspend(wil->platform_handle, false);
		rc = wil->platform_ops.suspend(wil->platform_handle, false);
		if (rc) {
		if (rc) {
			wil_enable_irq(wil);
			wil_enable_irq(wil);
			wil->suspend_stats.r_off.failed_suspends++;
			goto out;
			goto out;
		}
		}
	}
	}
+8 −3
Original line number Original line Diff line number Diff line
@@ -83,12 +83,17 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
 */
 */
#define WIL_MAX_MPDU_OVERHEAD	(62)
#define WIL_MAX_MPDU_OVERHEAD	(62)


struct wil_suspend_stats {
struct wil_suspend_count_stats {
	unsigned long successful_suspends;
	unsigned long successful_suspends;
	unsigned long failed_suspends;
	unsigned long successful_resumes;
	unsigned long successful_resumes;
	unsigned long failed_suspends;
	unsigned long failed_resumes;
	unsigned long failed_resumes;
	unsigned long rejected_by_device;
};

struct wil_suspend_stats {
	struct wil_suspend_count_stats r_off;
	struct wil_suspend_count_stats r_on;
	unsigned long rejected_by_device; /* only radio on */
	unsigned long rejected_by_host;
	unsigned long rejected_by_host;
};
};