Linux bluetooth development
 help / color / mirror / Atom feed
From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 09/10] Bluetooth: Add debugfs entry for RPA regeneration timeout
Date: Sun, 23 Feb 2014 16:23:57 +0200	[thread overview]
Message-ID: <1393165438-13610-10-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1393165438-13610-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

This patch adds a rpa_timeout debugfs entry which can be used to set the
RPA regeneration timeout to something else than the default 15 minutes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/hci_core.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 973145ad8bf0..73fe644949d5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -492,6 +492,37 @@ static int idle_timeout_get(void *data, u64 *val)
 DEFINE_SIMPLE_ATTRIBUTE(idle_timeout_fops, idle_timeout_get,
 			idle_timeout_set, "%llu\n");
 
+static int rpa_timeout_set(void *data, u64 val)
+{
+	struct hci_dev *hdev = data;
+
+	/* Require the RPA timeout to be at least 30 seconds and at most
+	 * 24 hours.
+	 */
+	if (val < 30 || val > (60 * 60 * 24))
+		return -EINVAL;
+
+	hci_dev_lock(hdev);
+	hdev->rpa_timeout = val;
+	hci_dev_unlock(hdev);
+
+	return 0;
+}
+
+static int rpa_timeout_get(void *data, u64 *val)
+{
+	struct hci_dev *hdev = data;
+
+	hci_dev_lock(hdev);
+	*val = hdev->rpa_timeout;
+	hci_dev_unlock(hdev);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(rpa_timeout_fops, rpa_timeout_get,
+			rpa_timeout_set, "%llu\n");
+
 static int sniff_min_interval_set(void *data, u64 val)
 {
 	struct hci_dev *hdev = data;
@@ -1612,6 +1643,8 @@ static int __hci_init(struct hci_dev *hdev)
 				    hdev, &random_address_fops);
 		debugfs_create_file("static_address", 0444, hdev->debugfs,
 				    hdev, &static_address_fops);
+		debugfs_create_file("rpa_timeout", 0644, hdev->debugfs,
+				    hdev, &rpa_timeout_fops);
 
 		/* For controllers with a public address, provide a debug
 		 * option to force the usage of the configured static
-- 
1.8.5.3


  parent reply	other threads:[~2014-02-23 14:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-23 14:23 [PATCH v2 00/10] LE Privacy support johan.hedberg
2014-02-23 14:23 ` [PATCH v2 01/10] Bluetooth: Set the correct address type in Identity Address Information johan.hedberg
2014-02-23 14:46   ` Marcel Holtmann
2014-02-23 14:23 ` [PATCH v2 02/10] Bluetooth: Add SMP function for generating RPAs johan.hedberg
2014-02-23 14:23 ` [PATCH v2 03/10] Bluetooth: Add timer for regenerating local RPA johan.hedberg
2014-02-23 14:23 ` [PATCH v2 04/10] Bluetooth: Add hci_get_own_address_type() convenience function johan.hedberg
2014-02-23 14:23 ` [PATCH v2 05/10] Bluetooth: Use hci_get_own_address_type() when connecting LE johan.hedberg
2014-02-23 14:23 ` [PATCH v2 06/10] Bluetooth: Use hci_get_own_address_type() for enabling advertising johan.hedberg
2014-02-23 14:23 ` [PATCH v2 07/10] Bluetooth: Use hci_get_own_address_type() for initiating LE scan johan.hedberg
2014-02-23 14:23 ` [PATCH v2 08/10] Bluetooth: Don't write static address during power on johan.hedberg
2014-02-23 14:23 ` johan.hedberg [this message]
2014-02-23 14:23 ` [PATCH v2 10/10] Bluetooth: Add support for Set Privacy command johan.hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393165438-13610-10-git-send-email-johan.hedberg@gmail.com \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox