linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] v3 Fast Advertising Interval
@ 2019-07-15 11:35 spoorthix.k
  2019-07-15 17:14 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: spoorthix.k @ 2019-07-15 11:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.b.panda

From: Spoorthi Ravishankar Koppad <spoorthix.k@intel.com>

Changes made to add support for fast advertising interval
as per core 4.1 specification, section 9.3.11.2.

A peripheral device entering any of the following GAP modes and
sending either non-connectable advertising events or scannable
undirected advertising events should use adv_fast_interval2
(100ms - 150ms) for adv_fast_period(30s).

         - Non-Discoverable Mode
         - Non-Connectable Mode
         - Limited Discoverable Mode
         - General Discoverable Mode

Signed-off-by: Spoorthi Ravishankar Koppad <spoorthix.k@intel.com>
---
 include/net/bluetooth/hci_core.h |  2 ++
 net/bluetooth/hci_request.c      | 32 ++++++++++++++++++++++----------
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7dfe6ff..a69534d 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1512,6 +1512,8 @@ struct hci_mgmt_chan {
 #define DISCOV_INTERLEAVED_INQUIRY_LEN	0x04
 #define DISCOV_BREDR_INQUIRY_LEN	0x08
 #define DISCOV_LE_RESTART_DELAY		msecs_to_jiffies(200)	/* msec */
+#define DISCOV_LE_FAST_ADV_INT_MIN     100     /* msec */
+#define DISCOV_LE_FAST_ADV_INT_MAX     150     /* msec */
 
 void mgmt_fill_version_info(void *ver);
 int mgmt_new_settings(struct hci_dev *hdev);
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index ca73d36..d42b6fd 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -1082,19 +1082,31 @@ void __hci_req_enable_advertising(struct hci_request *req)
 		return;
 
 	memset(&cp, 0, sizeof(cp));
-	cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
-	cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
-
-	if (connectable)
-		cp.type = LE_ADV_IND;
-	else if (get_cur_adv_instance_scan_rsp_len(hdev))
-		cp.type = LE_ADV_SCAN_IND;
-	else
-		cp.type = LE_ADV_NONCONN_IND;
-
 	cp.own_address_type = own_addr_type;
 	cp.channel_map = hdev->le_adv_channel_map;
 
+	if (connectable) {
+		cp.type = LE_ADV_IND;
+		cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
+		cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
+	} else {
+		if (get_cur_adv_instance_scan_rsp_len(hdev))
+			cp.type = LE_ADV_SCAN_IND;
+		else
+			cp.type = LE_ADV_NONCONN_IND;
+
+		if (!hci_dev_test_flag(hdev, HCI_DISCOVERABLE) ||
+		    hci_dev_test_flag(hdev, HCI_LIMITED_DISCOVERABLE)) {
+			cp.min_interval =
+				cpu_to_le16(DISCOV_LE_FAST_ADV_INT_MIN);
+			cp.max_interval =
+				cpu_to_le16(DISCOV_LE_FAST_ADV_INT_MAX);
+		} else {
+			cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
+			cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
+		}
+	}
+
 	hci_req_add(req, HCI_OP_LE_SET_ADV_PARAM, sizeof(cp), &cp);
 
 	hci_req_add(req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), &enable);
-- 
1.9.1


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

* Re: [PATCH] v3 Fast Advertising Interval
  2019-07-15 11:35 [PATCH] v3 Fast Advertising Interval spoorthix.k
@ 2019-07-15 17:14 ` Marcel Holtmann
  2019-07-16  3:43   ` K, SpoorthiX
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2019-07-15 17:14 UTC (permalink / raw)
  To: SpoorthiX K; +Cc: linux-bluetooth, bharat.b.panda

Hi Spoorthi,

> Changes made to add support for fast advertising interval
> as per core 4.1 specification, section 9.3.11.2.
> 
> A peripheral device entering any of the following GAP modes and
> sending either non-connectable advertising events or scannable
> undirected advertising events should use adv_fast_interval2
> (100ms - 150ms) for adv_fast_period(30s).
> 
>         - Non-Discoverable Mode
>         - Non-Connectable Mode
>         - Limited Discoverable Mode
>         - General Discoverable Mode
> 
> Signed-off-by: Spoorthi Ravishankar Koppad <spoorthix.k@intel.com>
> ---
> include/net/bluetooth/hci_core.h |  2 ++
> net/bluetooth/hci_request.c      | 32 ++++++++++++++++++++++----------
> 2 files changed, 24 insertions(+), 10 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* RE: [PATCH] v3 Fast Advertising Interval
  2019-07-15 17:14 ` Marcel Holtmann
@ 2019-07-16  3:43   ` K, SpoorthiX
  0 siblings, 0 replies; 3+ messages in thread
From: K, SpoorthiX @ 2019-07-16  3:43 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth, Panda, Bharat B

Hi Marcel,

	Thank you for applying the patch.

Regards,
Spoorthi

-----Original Message-----
From: Marcel Holtmann [mailto:marcel@holtmann.org] 
Sent: Monday, July 15, 2019 10:44 PM
To: K, SpoorthiX <spoorthix.k@intel.com>
Cc: linux-bluetooth@vger.kernel.org; Panda, Bharat B <bharat.b.panda@intel.com>
Subject: Re: [PATCH] v3 Fast Advertising Interval

Hi Spoorthi,

> Changes made to add support for fast advertising interval as per core 
> 4.1 specification, section 9.3.11.2.
> 
> A peripheral device entering any of the following GAP modes and 
> sending either non-connectable advertising events or scannable 
> undirected advertising events should use adv_fast_interval2 (100ms - 
> 150ms) for adv_fast_period(30s).
> 
>         - Non-Discoverable Mode
>         - Non-Connectable Mode
>         - Limited Discoverable Mode
>         - General Discoverable Mode
> 
> Signed-off-by: Spoorthi Ravishankar Koppad <spoorthix.k@intel.com>
> ---
> include/net/bluetooth/hci_core.h |  2 ++
> net/bluetooth/hci_request.c      | 32 ++++++++++++++++++++++----------
> 2 files changed, 24 insertions(+), 10 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2019-07-16  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 11:35 [PATCH] v3 Fast Advertising Interval spoorthix.k
2019-07-15 17:14 ` Marcel Holtmann
2019-07-16  3:43   ` K, SpoorthiX

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).