linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: HCI: Add proper tracking for enable status of adv instances
@ 2021-06-29  0:49 Luiz Augusto von Dentz
  2021-06-29  2:01 ` bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2021-06-29  0:49 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds a field to track if advertising instances are enabled or not
and only clear HCI_LE_ADV flag if there is no instance left advertising.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 include/net/bluetooth/hci_core.h |  1 +
 net/bluetooth/hci_event.c        | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index a53e94459ecd..d916729674a0 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -221,6 +221,7 @@ struct oob_data {
 
 struct adv_info {
 	struct list_head list;
+	bool enabled;
 	bool pending;
 	__u8	instance;
 	__u32	flags;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 1c3018202564..d7e85049d49d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1277,7 +1277,9 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev,
 					 struct sk_buff *skb)
 {
 	struct hci_cp_le_set_ext_adv_enable *cp;
+	struct hci_cp_ext_adv_set *set;
 	__u8 status = *((__u8 *) skb->data);
+	struct adv_info *adv = NULL, *n;
 
 	BT_DBG("%s status 0x%2.2x", hdev->name, status);
 
@@ -1288,22 +1290,48 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev,
 	if (!cp)
 		return;
 
+	set = (void *)cp->data;
+
 	hci_dev_lock(hdev);
 
+	if (cp->num_of_sets)
+		adv = hci_find_adv_instance(hdev, set->handle);
+
 	if (cp->enable) {
 		struct hci_conn *conn;
 
 		hci_dev_set_flag(hdev, HCI_LE_ADV);
 
+		if (adv)
+			adv->enabled = true;
+
 		conn = hci_lookup_le_connect(hdev);
 		if (conn)
 			queue_delayed_work(hdev->workqueue,
 					   &conn->le_conn_timeout,
 					   conn->conn_timeout);
 	} else {
+		if (adv) {
+			adv->enabled = false;
+			/* If just one instance was disabled check if there are
+			 * any other instance enabled before clearing HCI_LE_ADV
+			 */
+			list_for_each_entry_safe(adv, n, &hdev->adv_instances,
+						 list) {
+				if (adv->enabled)
+					goto unlock;
+			}
+		} else {
+			/* All instances shall be considered disabled */
+			list_for_each_entry_safe(adv, n, &hdev->adv_instances,
+						 list)
+				adv->enabled = false;
+		}
+
 		hci_dev_clear_flag(hdev, HCI_LE_ADV);
 	}
 
+unlock:
 	hci_dev_unlock(hdev);
 }
 
-- 
2.31.1


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

* RE: Bluetooth: HCI: Add proper tracking for enable status of adv instances
  2021-06-29  0:49 [PATCH] Bluetooth: HCI: Add proper tracking for enable status of adv instances Luiz Augusto von Dentz
@ 2021-06-29  2:01 ` bluez.test.bot
  2021-07-14 19:01   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: bluez.test.bot @ 2021-06-29  2:01 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 3048 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=508287

---Test result---

Test Summary:
CheckPatch                    PASS      0.98 seconds
GitLint                       PASS      0.13 seconds
BuildKernel                   PASS      514.51 seconds
TestRunner: Setup             PASS      338.20 seconds
TestRunner: l2cap-tester      PASS      2.61 seconds
TestRunner: bnep-tester       PASS      1.94 seconds
TestRunner: mgmt-tester       FAIL      29.42 seconds
TestRunner: rfcomm-tester     PASS      2.13 seconds
TestRunner: sco-tester        PASS      2.05 seconds
TestRunner: smp-tester        PASS      2.16 seconds
TestRunner: userchan-tester   PASS      1.99 seconds

Details
##############################
Test: CheckPatch - PASS - 0.98 seconds
Run checkpatch.pl script with rule in .checkpatch.conf


##############################
Test: GitLint - PASS - 0.13 seconds
Run gitlint with rule in .gitlint


##############################
Test: BuildKernel - PASS - 514.51 seconds
Build Kernel with minimal configuration supports Bluetooth


##############################
Test: TestRunner: Setup - PASS - 338.20 seconds
Setup environment for running Test Runner


##############################
Test: TestRunner: l2cap-tester - PASS - 2.61 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: bnep-tester - PASS - 1.94 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: mgmt-tester - FAIL - 29.42 seconds
Run test-runner with mgmt-tester
Total: 446, Passed: 436 (97.8%), Failed: 5, Not Run: 5

Failed Test Cases
Read Ext Controller Info 1                           Failed       0.016 seconds
Read Ext Controller Info 2                           Failed       0.015 seconds
Read Ext Controller Info 3                           Failed       0.013 seconds
Read Ext Controller Info 4                           Failed       0.013 seconds
Read Ext Controller Info 5                           Failed       0.015 seconds

##############################
Test: TestRunner: rfcomm-tester - PASS - 2.13 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: sco-tester - PASS - 2.05 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: smp-tester - PASS - 2.16 seconds
Run test-runner with smp-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: userchan-tester - PASS - 1.99 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 44354 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3561 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 614060 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11681 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9916 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11827 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5457 bytes --]

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

* Re: Bluetooth: HCI: Add proper tracking for enable status of adv instances
  2021-06-29  2:01 ` bluez.test.bot
@ 2021-07-14 19:01   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2021-07-14 19:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Marcel Holtmann

Hi Marcel,

On Mon, Jun 28, 2021 at 7:01 PM <bluez.test.bot@gmail.com> wrote:
>
> 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=508287
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      0.98 seconds
> GitLint                       PASS      0.13 seconds
> BuildKernel                   PASS      514.51 seconds
> TestRunner: Setup             PASS      338.20 seconds
> TestRunner: l2cap-tester      PASS      2.61 seconds
> TestRunner: bnep-tester       PASS      1.94 seconds
> TestRunner: mgmt-tester       FAIL      29.42 seconds
> TestRunner: rfcomm-tester     PASS      2.13 seconds
> TestRunner: sco-tester        PASS      2.05 seconds
> TestRunner: smp-tester        PASS      2.16 seconds
> TestRunner: userchan-tester   PASS      1.99 seconds
>
> Details
> ##############################
> Test: CheckPatch - PASS - 0.98 seconds
> Run checkpatch.pl script with rule in .checkpatch.conf
>
>
> ##############################
> Test: GitLint - PASS - 0.13 seconds
> Run gitlint with rule in .gitlint
>
>
> ##############################
> Test: BuildKernel - PASS - 514.51 seconds
> Build Kernel with minimal configuration supports Bluetooth
>
>
> ##############################
> Test: TestRunner: Setup - PASS - 338.20 seconds
> Setup environment for running Test Runner
>
>
> ##############################
> Test: TestRunner: l2cap-tester - PASS - 2.61 seconds
> Run test-runner with l2cap-tester
> Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
>
> ##############################
> Test: TestRunner: bnep-tester - PASS - 1.94 seconds
> Run test-runner with bnep-tester
> Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
>
> ##############################
> Test: TestRunner: mgmt-tester - FAIL - 29.42 seconds
> Run test-runner with mgmt-tester
> Total: 446, Passed: 436 (97.8%), Failed: 5, Not Run: 5
>
> Failed Test Cases
> Read Ext Controller Info 1                           Failed       0.016 seconds
> Read Ext Controller Info 2                           Failed       0.015 seconds
> Read Ext Controller Info 3                           Failed       0.013 seconds
> Read Ext Controller Info 4                           Failed       0.013 seconds
> Read Ext Controller Info 5                           Failed       0.015 seconds
>
> ##############################
> Test: TestRunner: rfcomm-tester - PASS - 2.13 seconds
> Run test-runner with rfcomm-tester
> Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0
>
> ##############################
> Test: TestRunner: sco-tester - PASS - 2.05 seconds
> Run test-runner with sco-tester
> Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
>
> ##############################
> Test: TestRunner: smp-tester - PASS - 2.16 seconds
> Run test-runner with smp-tester
> Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
>
> ##############################
> Test: TestRunner: userchan-tester - PASS - 1.99 seconds
> Run test-runner with userchan-tester
> Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0
>
>
>
> ---
> Regards,
> Linux Bluetooth


The cmd_sync set depends on this one, so if you can prioritize this
one, or I can include it with the cmd-sync set but I rather have it
separately since as it fixes tracking of advertising instance
programmed in the controller.


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2021-07-14 19:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29  0:49 [PATCH] Bluetooth: HCI: Add proper tracking for enable status of adv instances Luiz Augusto von Dentz
2021-06-29  2:01 ` bluez.test.bot
2021-07-14 19:01   ` Luiz Augusto von Dentz

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).