Message ID | 6b6ecbf19559cb16793d7ef3e96c1181a32b4df5.1586412226.git.marcel@holtmann.org (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Johan Hedberg |
Headers | show |
Series | Cleanup patches for LL Privacy work | expand |
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
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
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. */
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(+)