* [PATCH v2] Bluetooth: hci_sync: Fix not using conn_timeout
@ 2022-02-17 21:24 Luiz Augusto von Dentz
2022-02-17 22:02 ` [v2] " bluez.test.bot
0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-17 21:24 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When using hci_le_create_conn_sync it shall wait for the conn_timeout
since the connection complete may take longer than just 2 seconds.
Also fix the masking of HCI_EV_LE_ENHANCED_CONN_COMPLETE and
HCI_EV_LE_CONN_COMPLETE so they are never both set so we can predict
which one the controller will use in case of HCI_OP_LE_CREATE_CONN.
Fixes: 6cd29ec6ae5e3 ("Bluetooth: hci_sync: Wait for proper events when connecting LE")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
v2: Add use_enhanced_conn_complete and include comments regarding when the use
of HCI_EV_LE_ENHANCED_CONN_COMPLETE.
include/net/bluetooth/hci_core.h | 8 ++++++++
net/bluetooth/hci_sync.c | 21 +++++++++++++++------
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index c454913794bf..a5ee8a00d52a 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1505,6 +1505,14 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
/* Extended advertising support */
#define ext_adv_capable(dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV))
+/* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 1789:
+ *
+ * C24: Mandatory if the LE Controller supports Connection State and either
+ * LE Feature (LL Privacy) or LE Feature (Extended Advertising) is supported
+ */
+#define use_enhanced_conn_complete(dev) (ll_privacy_capable(dev) || \
+ ext_adv_capable(dev))
+
/* ----- HCI protocols ----- */
#define HCI_PROTO_DEFER 0x01
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 9dbf007e3dc7..b66a2271c433 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3265,10 +3265,10 @@ static int hci_le_set_event_mask_sync(struct hci_dev *hdev)
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 the controller supports LL Privacy feature or LE Extended Adv,
+ * enable the corresponding event.
*/
- if (hdev->le_features[0] & HCI_LE_LL_PRIVACY)
+ if (use_enhanced_conn_complete(hdev))
events[1] |= 0x02; /* LE Enhanced Connection Complete */
/* If the controller supports Extended Scanner Filter
@@ -5188,7 +5188,7 @@ static int hci_le_ext_create_conn_sync(struct hci_dev *hdev,
return __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_EXT_CREATE_CONN,
plen, data,
HCI_EV_LE_ENHANCED_CONN_COMPLETE,
- HCI_CMD_TIMEOUT, NULL);
+ conn->conn_timeout, NULL);
}
int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
@@ -5273,9 +5273,18 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
cp.min_ce_len = cpu_to_le16(0x0000);
cp.max_ce_len = cpu_to_le16(0x0000);
+ /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2261:
+ *
+ * If this event is unmasked and the HCI_LE_Connection_Complete event
+ * is unmasked, only the HCI_LE_Enhanced_Connection_Complete event is
+ * sent when a new connection has been created.
+ */
err = __hci_cmd_sync_status_sk(hdev, HCI_OP_LE_CREATE_CONN,
- sizeof(cp), &cp, HCI_EV_LE_CONN_COMPLETE,
- HCI_CMD_TIMEOUT, NULL);
+ sizeof(cp), &cp,
+ use_enhanced_conn_complete(hdev) ?
+ HCI_EV_LE_ENHANCED_CONN_COMPLETE :
+ HCI_EV_LE_CONN_COMPLETE,
+ conn->conn_timeout, NULL);
done:
/* Re-enable advertising after the connection attempt is finished. */
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [v2] Bluetooth: hci_sync: Fix not using conn_timeout
2022-02-17 21:24 [PATCH v2] Bluetooth: hci_sync: Fix not using conn_timeout Luiz Augusto von Dentz
@ 2022-02-17 22:02 ` bluez.test.bot
0 siblings, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-02-17 22:02 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=615563
---Test result---
Test Summary:
CheckPatch PASS 1.89 seconds
GitLint PASS 0.95 seconds
SubjectPrefix PASS 0.90 seconds
BuildKernel PASS 36.80 seconds
BuildKernel32 PASS 33.44 seconds
Incremental Build with patchesPASS 47.52 seconds
TestRunner: Setup PASS 592.64 seconds
TestRunner: l2cap-tester PASS 18.89 seconds
TestRunner: bnep-tester PASS 7.44 seconds
TestRunner: mgmt-tester PASS 126.90 seconds
TestRunner: rfcomm-tester PASS 10.09 seconds
TestRunner: sco-tester PASS 9.70 seconds
TestRunner: smp-tester PASS 9.34 seconds
TestRunner: userchan-tester PASS 7.85 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [v2] Bluetooth: hci_sync: Fix not using conn_timeout
2022-02-17 21:10 [PATCH v2] " Luiz Augusto von Dentz
@ 2022-02-17 22:03 ` bluez.test.bot
0 siblings, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-02-17 22:03 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=615561
---Test result---
Test Summary:
CheckPatch PASS 2.07 seconds
GitLint PASS 1.09 seconds
SubjectPrefix PASS 0.94 seconds
BuildKernel PASS 41.71 seconds
BuildKernel32 PASS 37.32 seconds
Incremental Build with patchesPASS 49.92 seconds
TestRunner: Setup PASS 648.93 seconds
TestRunner: l2cap-tester PASS 20.15 seconds
TestRunner: bnep-tester PASS 8.38 seconds
TestRunner: mgmt-tester PASS 135.98 seconds
TestRunner: rfcomm-tester PASS 10.65 seconds
TestRunner: sco-tester PASS 10.41 seconds
TestRunner: smp-tester PASS 10.17 seconds
TestRunner: userchan-tester PASS 8.55 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-17 22:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 21:24 [PATCH v2] Bluetooth: hci_sync: Fix not using conn_timeout Luiz Augusto von Dentz
2022-02-17 22:02 ` [v2] " bluez.test.bot
-- strict thread matches above, loose matches on Subject: below --
2022-02-17 21:10 [PATCH v2] " Luiz Augusto von Dentz
2022-02-17 22:03 ` [v2] " bluez.test.bot
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).