Skip to contentSkip to conversation

Bluetooth: hci_sync: Fix not always pausing advertising when necessary

PATCH Superseded Luiz Augusto von Dentz 1 participant 2 messages Dec 8, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/2 Bluetooth: hci_sync: Fix not always pausing advertising when necessary

From: Luiz Augusto von Dentz <[email protected]>

hci_pause_advertising_sync shall always pause advertising until hci_resume_advertising_sync but instance 0x00 doesn't count in adv_instance_cnt so it was causing it to be skipped.

---
v2: Add fix for l2cap-tester direct advertising test cases which was caused by hci_pause_advertising_sync not pausing advertising when instance 0x00 is used.

 net/bluetooth/hci_sync.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/bluetooth/hci_sync.c +2 -4
index 3d28ca7ebe45..fd15fb37a52a 100644
@@ -1701,10 +1701,8 @@ static int hci_pause_advertising_sync(struct hci_dev *hdev)
 	int err;
 	int old_state;
 
-	/* If there are no instances or advertising has already been paused
-	 * there is nothing to do.
-	 */
-	if (!hdev->adv_instance_cnt || hdev->advertising_paused)
+	/* If already been paused there is nothing to do. */
+	if (hdev->advertising_paused)
 		return 0;
 
 	bt_dev_dbg(hdev, "Pausing directed advertising");
Signature · 1 line
2.33.1
author maintainer
#1 lore raw

PATCH v2 2/2 Bluetooth: hci_sync: Add hci_le_create_conn_sync

From: Luiz Augusto von Dentz <[email protected]>

This adds hci_le_create_conn_sync and make hci_le_connect use it instead of queueing multiple commands which may conflict with the likes of hci_update_passive_scan which uses hci_cmd_sync_queue.

---
 include/net/bluetooth/hci_core.h |   1 +
 include/net/bluetooth/hci_sync.h |   4 +
 net/bluetooth/hci_conn.c         | 300 ++-----------------------------
 net/bluetooth/hci_sync.c         | 295 ++++++++++++++++++++++++++++++
 4 files changed, 315 insertions(+), 285 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
index 4d69dcfebd63..c41ad7847d9d 100644
@@ -646,6 +646,7 @@ struct hci_conn {
 	__u8		init_addr_type;
 	bdaddr_t	resp_addr;
 	__u8		resp_addr_type;
+	bdaddr_t	direct_rpa;
 	__u8		adv_instance;
 	__u16		handle;
 	__u16		state;
include/net/bluetooth/hci_sync.h +4 -0
index f4034bf8f1ce..0d2a75d88e7c 100644
@@ -101,3 +101,7 @@ int hci_stop_discovery_sync(struct hci_dev *hdev);
 
 int hci_suspend_sync(struct hci_dev *hdev);
 int hci_resume_sync(struct hci_dev *hdev);
+
+struct hci_conn;
+
+int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn);
net/bluetooth/hci_conn.c +15 -285

344 lines not on this page · raw message

net/bluetooth/hci_sync.c +295 -0

298 lines not on this page · raw message

Signature · 1 line
2.33.1