Skip to contentSkip to conversation

Bluetooth: Fix - During le_conn_timeout disable EXT_ADV

PATCH Superseded Sathish Narsimman 2 participants 5 messages Feb 18, 2020 – Feb 20, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix - During le_conn_timeout disable EXT_ADV

Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command disallowed . This patch fixes that issue and disables EXT_ADV if enabled.

---
 net/bluetooth/hci_conn.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +13 -3
index a582c676e584..a8d8a876363c 100644
@@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
 	 * (which doesn't have a timeout of its own).
 	 */
 	if (conn->role == HCI_ROLE_SLAVE) {
-		u8 enable = 0x00;
-		hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
-			     &enable);
+		if (ext_adv_capable(hdev)) {
+			struct hci_cp_le_set_ext_adv_enable cp;
+
+			cp.enable = 0x00;
+			cp.num_of_sets = 0x00;
+
+			hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
+				     sizeof(cp), &cp);
+		} else {
+			u8 enable = 0x00;
+			hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+				     sizeof(enable), &enable);
+		}
 		hci_le_conn_failed(conn, HCI_ERROR_ADVERTISING_TIMEOUT);
 		return;
 	}
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Hi Sathish,

Quoted 23 lines

Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command disallowed . This patch fixes that issue and disables EXT_ADV if enabled.

---
net/bluetooth/hci_conn.c | 16 +++++++++++++---

1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -3
index a582c676e584..a8d8a876363c 100644
@@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
 	 * (which doesn't have a timeout of its own).
 	 */
 	if (conn->role == HCI_ROLE_SLAVE) {
-		u8 enable = 0x00;
-		hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
-			     &enable);
+		if (ext_adv_capable(hdev)) {
+			struct hci_cp_le_set_ext_adv_enable cp;
+

net/bluetooth/hci_conn.c static void le_conn_timeout(struct work_struct *work) · line 496

Quoted 10 lines
net/bluetooth/hci_conn.c +10 -0
+			cp.enable = 0x00;
+			cp.num_of_sets = 0x00;
+
+			hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
+				     sizeof(cp), &cp);
+		} else {
+			u8 enable = 0x00;
+			hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+				     sizeof(enable), &enable);
+		}

hmmm, I wonder if it is better to create a helper function for this.

Regards

Marcel

#2 lore raw

Hi Marcel

Quoted 39 lines · Marcel Holtmann

Hi Sathish,

Quoted 23 lines

Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command disallowed . This patch fixes that issue and disables EXT_ADV if enabled.

---
net/bluetooth/hci_conn.c | 16 +++++++++++++---

1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -3
index a582c676e584..a8d8a876363c 100644
@@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
       * (which doesn't have a timeout of its own).
       */
      if (conn->role == HCI_ROLE_SLAVE) {
-             u8 enable = 0x00;
-             hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
-                          &enable);
+             if (ext_adv_capable(hdev)) {
+                     struct hci_cp_le_set_ext_adv_enable cp;
+

net/bluetooth/hci_conn.c static void le_conn_timeout(struct work_struct *work) · line 496

Quoted 10 lines
net/bluetooth/hci_conn.c +10 -0
+                     cp.enable = 0x00;
+                     cp.num_of_sets = 0x00;
+
+                     hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
+                                  sizeof(cp), &cp);
+             } else {
+                     u8 enable = 0x00;
+                     hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+                                  sizeof(enable), &enable);
+             }

hmmm, I wonder if it is better to create a helper function for this.

Quoted 4 lines

Regards

Marcel

let me verify and submit patch with __hci_req_disable_advertising

Regards
Sathish N

#3 lore raw

Hi Marcel

Quoted 45 lines · Sathish Narasimman

Hi Marcel

Quoted 41 lines · Marcel Holtmann

Hi Sathish,

Quoted 23 lines

Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command disallowed . This patch fixes that issue and disables EXT_ADV if enabled.

---
net/bluetooth/hci_conn.c | 16 +++++++++++++---

1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -3
index a582c676e584..a8d8a876363c 100644
@@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
       * (which doesn't have a timeout of its own).
       */
      if (conn->role == HCI_ROLE_SLAVE) {
-             u8 enable = 0x00;
-             hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
-                          &enable);
+             if (ext_adv_capable(hdev)) {
+                     struct hci_cp_le_set_ext_adv_enable cp;
+

net/bluetooth/hci_conn.c static void le_conn_timeout(struct work_struct *work) · line 496

Quoted 10 lines
net/bluetooth/hci_conn.c +10 -0
+                     cp.enable = 0x00;
+                     cp.num_of_sets = 0x00;
+
+                     hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
+                                  sizeof(cp), &cp);
+             } else {
+                     u8 enable = 0x00;
+                     hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+                                  sizeof(enable), &enable);
+             }

hmmm, I wonder if it is better to create a helper function for this.

Regards

Quoted 7 lines
Quoted 2 lines

Marcel

let me verify and submit patch with __hci_req_disable_advertising

Regards
Sathish N

calling __hci_req_disable_advertising is not working. the command is not getting executed
I hope the below method is fine? where it works

+static void le_disable_advertising(struct hci_dev *hdev) +{
+ if (ext_adv_capable(hdev)) {

+               struct hci_cp_le_set_ext_adv_enable cp;
+               cp.enable = 0x00;
+               cp.num_of_sets = 0x00;

+
+ hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp),
+ &cp);
+ } else {
+ u8 enable = 0x00;
+ hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+ sizeof(enable), &enable);
+ }
+
+}

Regards
Sathish N

maintainer
#4 lore raw

Hi Sathish,

Quoted 56 lines
Quoted 38 lines
Quoted 38 lines
Quoted 23 lines

Disabling LE_LEGACY_ADV when LE_EXT_ADV is enabled causes 'command disallowed . This patch fixes that issue and disables EXT_ADV if enabled.

---
net/bluetooth/hci_conn.c | 16 +++++++++++++---

1 file changed, 13 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -3
index a582c676e584..a8d8a876363c 100644
@@ -481,9 +481,19 @@ static void le_conn_timeout(struct work_struct *work)
      * (which doesn't have a timeout of its own).
      */
     if (conn->role == HCI_ROLE_SLAVE) {
-             u8 enable = 0x00;
-             hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
-                          &enable);
+             if (ext_adv_capable(hdev)) {
+                     struct hci_cp_le_set_ext_adv_enable cp;
+

net/bluetooth/hci_conn.c static void le_conn_timeout(struct work_struct *work) · line 496

Quoted 10 lines
net/bluetooth/hci_conn.c +10 -0
+                     cp.enable = 0x00;
+                     cp.num_of_sets = 0x00;
+
+                     hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE,
+                                  sizeof(cp), &cp);
+             } else {
+                     u8 enable = 0x00;
+                     hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+                                  sizeof(enable), &enable);
+             }

hmmm, I wonder if it is better to create a helper function for this.

Regards

Quoted 7 lines
Quoted 2 lines

Marcel

let me verify and submit patch with __hci_req_disable_advertising

Regards
Sathish N

calling __hci_req_disable_advertising is not working. the command is not getting executed
I hope the below method is fine? where it works

net/bluetooth/hci_conn.c +6 -0
+static void le_disable_advertising(struct hci_dev *hdev)
+{
+       if (ext_adv_capable(hdev)) {
+               struct hci_cp_le_set_ext_adv_enable cp;
+               cp.enable = 0x00;
+               cp.num_of_sets = 0x00;

net/bluetooth/hci_conn.c static void le_conn_timeout(struct work_struct *work)

Quoted 10 lines
net/bluetooth/hci_conn.c +10 -0
+
+               hci_send_cmd(hdev, HCI_OP_LE_SET_EXT_ADV_ENABLE, sizeof(cp),
+                            &cp);
+       } else {
+               u8 enable = 0x00;
+               hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE,
+                            sizeof(enable), &enable);
+       }
+
+}

at first glance this looks fine.

Regards

Marcel