All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Cleanup patches for LL Privacy work
@ 2020-04-09  6:05 Marcel Holtmann
  2020-04-09  6:05 ` [PATCH 1/4] Bluetooth: Sort list of LE features constants Marcel Holtmann
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Marcel Holtmann @ 2020-04-09  6:05 UTC (permalink / raw)
  To: linux-bluetooth

These are are few cleanup patches before the LL Privacy work can
continue.

Marcel Holtmann (4):
  Bluetooth: Sort list of LE features constants
  Bluetooth: Use extra variable to make code more readable
  Bluetooth: Enable LE Enhanced Connection Complete event.
  Bluetooth: Clear HCI_LL_RPA_RESOLUTION flag on reset

 include/net/bluetooth/hci.h      | 5 ++---
 include/net/bluetooth/hci_core.h | 1 +
 net/bluetooth/hci_core.c         | 8 ++++++++
 net/bluetooth/hci_request.c      | 4 +++-
 4 files changed, 14 insertions(+), 4 deletions(-)

-- 
2.25.2


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

* [PATCH 1/4] Bluetooth: Sort list of LE features constants
  2020-04-09  6:05 [PATCH 0/4] Cleanup patches for LL Privacy work Marcel Holtmann
@ 2020-04-09  6:05 ` Marcel Holtmann
  2020-04-09  6:05 ` [PATCH 2/4] Bluetooth: Use extra variable to make code more readable Marcel Holtmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2020-04-09  6:05 UTC (permalink / raw)
  To: linux-bluetooth

The list of LE features constants has gotten a bit confused. It lost the
order and gained duplicated. Clean this up.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 include/net/bluetooth/hci.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index f4e8e2a0b7c1..ff42d05b3e72 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -460,12 +460,10 @@ enum {
 #define HCI_LE_SLAVE_FEATURES		0x08
 #define HCI_LE_PING			0x10
 #define HCI_LE_DATA_LEN_EXT		0x20
-#define HCI_LE_PHY_2M			0x01
-#define HCI_LE_PHY_CODED		0x08
-#define HCI_LE_EXT_ADV			0x10
 #define HCI_LE_EXT_SCAN_POLICY		0x80
 #define HCI_LE_PHY_2M			0x01
 #define HCI_LE_PHY_CODED		0x08
+#define HCI_LE_EXT_ADV			0x10
 #define HCI_LE_CHAN_SEL_ALG2		0x40
 #define HCI_LE_CIS_MASTER		0x10
 #define HCI_LE_CIS_SLAVE		0x20
-- 
2.25.2


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

* [PATCH 2/4] Bluetooth: Use extra variable to make code more readable
  2020-04-09  6:05 [PATCH 0/4] Cleanup patches for LL Privacy work Marcel Holtmann
  2020-04-09  6:05 ` [PATCH 1/4] Bluetooth: Sort list of LE features constants Marcel Holtmann
@ 2020-04-09  6:05 ` Marcel Holtmann
  2020-04-09  6:05 ` [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event Marcel Holtmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2020-04-09  6:05 UTC (permalink / raw)
  To: linux-bluetooth

When starting active scanning for discovery the whitelist is not needed
to be used. So the filter_policy is 0x00. To make the core more readable
use a variable name instead of just setting 0 as paramter.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_request.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 649e1e5ed446..9ea40106ef17 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -2723,6 +2723,8 @@ static int active_scan(struct hci_request *req, unsigned long opt)
 	uint16_t interval = opt;
 	struct hci_dev *hdev = req->hdev;
 	u8 own_addr_type;
+	/* White list is not used for discovery */
+	u8 filter_policy = 0x00;
 	int err;
 
 	BT_DBG("%s", hdev->name);
@@ -2744,7 +2746,7 @@ static int active_scan(struct hci_request *req, unsigned long opt)
 		own_addr_type = ADDR_LE_DEV_PUBLIC;
 
 	hci_req_start_scan(req, LE_SCAN_ACTIVE, interval, DISCOV_LE_SCAN_WIN,
-			   own_addr_type, 0);
+			   own_addr_type, filter_policy);
 	return 0;
 }
 
-- 
2.25.2


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

* [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event.
  2020-04-09  6:05 [PATCH 0/4] Cleanup patches for LL Privacy work Marcel Holtmann
  2020-04-09  6:05 ` [PATCH 1/4] Bluetooth: Sort list of LE features constants Marcel Holtmann
  2020-04-09  6:05 ` [PATCH 2/4] Bluetooth: Use extra variable to make code more readable Marcel Holtmann
@ 2020-04-09  6:05 ` Marcel Holtmann
  2020-04-14  6:49   ` Sathish Narasimman
  2020-04-09  6:05 ` [PATCH 4/4] Bluetooth: Clear HCI_LL_RPA_RESOLUTION flag on reset Marcel Holtmann
  2020-04-15 13:52 ` [PATCH 0/4] Cleanup patches for LL Privacy work Johan Hedberg
  4 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2020-04-09  6:05 UTC (permalink / raw)
  To: linux-bluetooth

In case LL Privacy is supported by the controller, it is also a good
idea to use the LE Enhanced Connection Complete event for getting all
information about the new connection and its addresses.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 include/net/bluetooth/hci.h | 1 +
 net/bluetooth/hci_core.c    | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ff42d05b3e72..1da8cec8e210 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -460,6 +460,7 @@ enum {
 #define HCI_LE_SLAVE_FEATURES		0x08
 #define HCI_LE_PING			0x10
 #define HCI_LE_DATA_LEN_EXT		0x20
+#define HCI_LE_LL_PRIVACY		0x40
 #define HCI_LE_EXT_SCAN_POLICY		0x80
 #define HCI_LE_PHY_2M			0x01
 #define HCI_LE_PHY_CODED		0x08
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 589c4085499c..0d726d59a492 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -638,6 +638,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 		if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT)
 			events[0] |= 0x40;	/* LE Data Length Change */
 
+		/* If the controller supports LL Privacy feature, enable
+		 * the corresponding event.
+		 */
+		if (hdev->le_features[0] & HCI_LE_LL_PRIVACY)
+			events[1] |= 0x02;	/* LE Enhanced Connection
+						 * Complete
+						 */
+
 		/* If the controller supports Extended Scanner Filter
 		 * Policies, enable the correspondig event.
 		 */
-- 
2.25.2


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

* [PATCH 4/4] Bluetooth: Clear HCI_LL_RPA_RESOLUTION flag on reset
  2020-04-09  6:05 [PATCH 0/4] Cleanup patches for LL Privacy work Marcel Holtmann
                   ` (2 preceding siblings ...)
  2020-04-09  6:05 ` [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event Marcel Holtmann
@ 2020-04-09  6:05 ` Marcel Holtmann
  2020-04-15 13:52 ` [PATCH 0/4] Cleanup patches for LL Privacy work Johan Hedberg
  4 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2020-04-09  6:05 UTC (permalink / raw)
  To: linux-bluetooth

When the controller is being reset or power cycled, then the flag
HCI_LL_RPA_RESOLUTION which indicates if controller based address
resolution is active needs to be also reset.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 include/net/bluetooth/hci_core.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 2f3275f1d1c4..239ab72f16c6 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -645,6 +645,7 @@ extern struct mutex hci_cb_list_lock;
 	do {							\
 		hci_dev_clear_flag(hdev, HCI_LE_SCAN);		\
 		hci_dev_clear_flag(hdev, HCI_LE_ADV);		\
+		hci_dev_clear_flag(hdev, HCI_LL_RPA_RESOLUTION);\
 		hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ);	\
 	} while (0)
 
-- 
2.25.2


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

* Re: [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event.
  2020-04-09  6:05 ` [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event Marcel Holtmann
@ 2020-04-14  6:49   ` Sathish Narasimman
  2020-04-14  6:57     ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Sathish Narasimman @ 2020-04-14  6:49 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Bluez mailing list

Hi Marcel

On Thu, Apr 9, 2020 at 11:38 AM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> In case LL Privacy is supported by the controller, it is also a good
> idea to use the LE Enhanced Connection Complete event for getting all
> information about the new connection and its addresses.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  include/net/bluetooth/hci.h | 1 +
>  net/bluetooth/hci_core.c    | 8 ++++++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index ff42d05b3e72..1da8cec8e210 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -460,6 +460,7 @@ enum {
>  #define HCI_LE_SLAVE_FEATURES          0x08
>  #define HCI_LE_PING                    0x10
>  #define HCI_LE_DATA_LEN_EXT            0x20
> +#define HCI_LE_LL_PRIVACY              0x40
>  #define HCI_LE_EXT_SCAN_POLICY         0x80
>  #define HCI_LE_PHY_2M                  0x01
>  #define HCI_LE_PHY_CODED               0x08
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 589c4085499c..0d726d59a492 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -638,6 +638,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
>                 if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT)
>                         events[0] |= 0x40;      /* LE Data Length Change */
>
> +               /* If the controller supports LL Privacy feature, enable
> +                * the corresponding event.
> +                */
> +               if (hdev->le_features[0] & HCI_LE_LL_PRIVACY)
> +                       events[1] |= 0x02;      /* LE Enhanced Connection
> +                                                * Complete
> +                                                */
> +
>                 /* If the controller supports Extended Scanner Filter
>                  * Policies, enable the correspondig event.
>                  */
> --
> 2.25.2
>
https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/net/bluetooth/hci_core.c#n717

I see LE Enhanced Connection complete event is enabled here.

Regards
Sathish N

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

* Re: [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event.
  2020-04-14  6:49   ` Sathish Narasimman
@ 2020-04-14  6:57     ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2020-04-14  6:57 UTC (permalink / raw)
  To: Sathish Narasimman; +Cc: Bluez mailing list

Hi Sathish,

>> In case LL Privacy is supported by the controller, it is also a good
>> idea to use the LE Enhanced Connection Complete event for getting all
>> information about the new connection and its addresses.
>> 
>> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>> ---
>> include/net/bluetooth/hci.h | 1 +
>> net/bluetooth/hci_core.c    | 8 ++++++++
>> 2 files changed, 9 insertions(+)
>> 
>> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
>> index ff42d05b3e72..1da8cec8e210 100644
>> --- a/include/net/bluetooth/hci.h
>> +++ b/include/net/bluetooth/hci.h
>> @@ -460,6 +460,7 @@ enum {
>> #define HCI_LE_SLAVE_FEATURES          0x08
>> #define HCI_LE_PING                    0x10
>> #define HCI_LE_DATA_LEN_EXT            0x20
>> +#define HCI_LE_LL_PRIVACY              0x40
>> #define HCI_LE_EXT_SCAN_POLICY         0x80
>> #define HCI_LE_PHY_2M                  0x01
>> #define HCI_LE_PHY_CODED               0x08
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index 589c4085499c..0d726d59a492 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -638,6 +638,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
>>                if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT)
>>                        events[0] |= 0x40;      /* LE Data Length Change */
>> 
>> +               /* If the controller supports LL Privacy feature, enable
>> +                * the corresponding event.
>> +                */
>> +               if (hdev->le_features[0] & HCI_LE_LL_PRIVACY)
>> +                       events[1] |= 0x02;      /* LE Enhanced Connection
>> +                                                * Complete
>> +                                                */
>> +
>>                /* If the controller supports Extended Scanner Filter
>>                 * Policies, enable the correspondig event.
>>                 */
>> --
>> 2.25.2
>> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/net/bluetooth/hci_core.c#n717
> 
> I see LE Enhanced Connection complete event is enabled here.

I see. However LE Enhanced Connection complete event has been added for LL Privacy and not for Extended Advertising. The current setting of the event needs to be removed. If you look at the difference on what the event is adding compared to the legacy one, you see it is only about RPAs.

Regards

Marcel


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

* Re: [PATCH 0/4] Cleanup patches for LL Privacy work
  2020-04-09  6:05 [PATCH 0/4] Cleanup patches for LL Privacy work Marcel Holtmann
                   ` (3 preceding siblings ...)
  2020-04-09  6:05 ` [PATCH 4/4] Bluetooth: Clear HCI_LL_RPA_RESOLUTION flag on reset Marcel Holtmann
@ 2020-04-15 13:52 ` Johan Hedberg
  4 siblings, 0 replies; 8+ messages in thread
From: Johan Hedberg @ 2020-04-15 13:52 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Thu, Apr 09, 2020, Marcel Holtmann wrote:
> These are are few cleanup patches before the LL Privacy work can
> continue.
> 
> Marcel Holtmann (4):
>   Bluetooth: Sort list of LE features constants
>   Bluetooth: Use extra variable to make code more readable
>   Bluetooth: Enable LE Enhanced Connection Complete event.
>   Bluetooth: Clear HCI_LL_RPA_RESOLUTION flag on reset
> 
>  include/net/bluetooth/hci.h      | 5 ++---
>  include/net/bluetooth/hci_core.h | 1 +
>  net/bluetooth/hci_core.c         | 8 ++++++++
>  net/bluetooth/hci_request.c      | 4 +++-
>  4 files changed, 14 insertions(+), 4 deletions(-)

All patches in this set have been applied to bluetooth-next. Thanks.

Johan

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

end of thread, other threads:[~2020-04-15 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09  6:05 [PATCH 0/4] Cleanup patches for LL Privacy work Marcel Holtmann
2020-04-09  6:05 ` [PATCH 1/4] Bluetooth: Sort list of LE features constants Marcel Holtmann
2020-04-09  6:05 ` [PATCH 2/4] Bluetooth: Use extra variable to make code more readable Marcel Holtmann
2020-04-09  6:05 ` [PATCH 3/4] Bluetooth: Enable LE Enhanced Connection Complete event Marcel Holtmann
2020-04-14  6:49   ` Sathish Narasimman
2020-04-14  6:57     ` Marcel Holtmann
2020-04-09  6:05 ` [PATCH 4/4] Bluetooth: Clear HCI_LL_RPA_RESOLUTION flag on reset Marcel Holtmann
2020-04-15 13:52 ` [PATCH 0/4] Cleanup patches for LL Privacy work Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.