linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath6kl: Implement support for background scan control from userspace
@ 2011-10-19  0:20 Rishi Panjwani
  2011-10-19  0:20 ` [PATCH v2] " Rishi Panjwani
  0 siblings, 1 reply; 3+ messages in thread
From: Rishi Panjwani @ 2011-10-19  0:20 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Rishi Panjwani

The feature allows controlling background scan intervals

Rishi Panjwani (1):
 ath6kl: Implement support for listen interval from userspace

drivers/net/wireless/ath/ath6kl/debug.c |   34 +++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] ath6kl: Implement support for background scan control from userspace
  2011-10-19  0:20 [PATCH] ath6kl: Implement support for background scan control from userspace Rishi Panjwani
@ 2011-10-19  0:20 ` Rishi Panjwani
  2011-10-25  7:00   ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Rishi Panjwani @ 2011-10-19  0:20 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Rishi Panjwani

In order to allow user space based control of background scan interval,
we use available debugfs infrastructure. The feature has been added for
testing purposes. The user has to write the bgscan interval (in secs) to
the bgscan_interval file in ath6kl debug directory. To disable bgscan,
a '0' is to be written to the bgscan_interval file.

Example:

echo "2" > bgscan_interval

This will make the background scan interval as 2 seconds

Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/debug.c |   37 +++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index e109f29..3eaa291 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -1455,6 +1455,40 @@ static const struct file_operations fops_delete_qos = {
 	.llseek = default_llseek,
 };
 
+static ssize_t ath6kl_bgscan_int_write(struct file *file,
+				const char __user *user_buf,
+				size_t count, loff_t *ppos)
+{
+	struct ath6kl *ar = file->private_data;
+	u16 bgscan_int;
+	char buf[32];
+	ssize_t len;
+
+	len = min(count, sizeof(buf) - 1);
+	if (copy_from_user(buf, user_buf, len))
+		return -EFAULT;
+
+	buf[len] = '\0';
+	if (kstrtou16(buf, 0, &bgscan_int))
+		return -EINVAL;
+
+	if (bgscan_int)
+		ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, bgscan_int, 0, 0, 0, 3,
+			0, 0, 0);
+	else
+		ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0xffff, 0, 0, 0, 3, 0,
+			0, 0);
+
+	return count;
+}
+
+static const struct file_operations fops_bgscan_int = {
+	.write = ath6kl_bgscan_int_write,
+	.open = ath6kl_debugfs_open,
+	.owner = THIS_MODULE,
+	.llseek = default_llseek,
+};
+
 int ath6kl_debug_init(struct ath6kl *ar)
 {
 	ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
@@ -1534,6 +1568,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
 	debugfs_create_file("delete_qos", S_IWUSR, ar->debugfs_phy, ar,
 				&fops_delete_qos);
 
+	debugfs_create_file("bgscan_interval", S_IWUSR,
+				ar->debugfs_phy, ar, &fops_bgscan_int);
+
 	return 0;
 }
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ath6kl: Implement support for background scan control from userspace
  2011-10-19  0:20 ` [PATCH v2] " Rishi Panjwani
@ 2011-10-25  7:00   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2011-10-25  7:00 UTC (permalink / raw)
  To: Rishi Panjwani; +Cc: linux-wireless

On 10/19/2011 03:20 AM, Rishi Panjwani wrote:
> In order to allow user space based control of background scan interval,
> we use available debugfs infrastructure. The feature has been added for
> testing purposes. The user has to write the bgscan interval (in secs) to
> the bgscan_interval file in ath6kl debug directory. To disable bgscan,
> a '0' is to be written to the bgscan_interval file.
> 
> Example:
> 
> echo "2" > bgscan_interval
> 
> This will make the background scan interval as 2 seconds

Thanks, applied. But I did one change:

> +	if (bgscan_int)
> +		ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, bgscan_int, 0, 0, 0, 3,
> +			0, 0, 0);
> +	else
> +		ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0xffff, 0, 0, 0, 3, 0,
> +			0, 0);

I changed that to more simple form:

	if (bgscan_int == 0)
		bgscan_int = 0xffff;

	ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, bgscan_int, 0, 0, 0, 3,
				  0, 0, 0);

Please check that I didn't break anything.

Kalle

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-25  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-19  0:20 [PATCH] ath6kl: Implement support for background scan control from userspace Rishi Panjwani
2011-10-19  0:20 ` [PATCH v2] " Rishi Panjwani
2011-10-25  7:00   ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).