All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 1/2] doc/mgmt: Document Advertising setting as Global Advertising
@ 2026-10-05 15:21 Luiz Augusto von Dentz
  2026-10-05 15:21 ` [PATCH BlueZ v1 2/2] mgmt-tester: Add Global Advertising tests for extended advertising Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-05 15:21 UTC (permalink / raw)
  To: linux-bluetooth

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

The Advertising setting always uses instance 0, and with extended
advertising it has a dedicated advertising set, so only instances
sharing that set are overridden by it; the others are advertised
concurrently and removing instances never disables it.

Assisted-by: OpenCode:claude-opus-5.5
---
 doc/mgmt-protocol.rst | 70 +++++++++++++++++++++++++++++--------------
 1 file changed, 47 insertions(+), 23 deletions(-)

diff --git a/doc/mgmt-protocol.rst b/doc/mgmt-protocol.rst
index f4c6822bfec1..ed2bd3349f25 100644
--- a/doc/mgmt-protocol.rst
+++ b/doc/mgmt-protocol.rst
@@ -306,7 +306,7 @@ following available bits:
     7, Basic Rate/Enhanced Data Rate
     8, High Speed
     9, Low Energy
-    10, Advertising
+    10, Advertising (Global Advertising - instance 0)
     11, Secure Connections
     12, Debug Keys
     13, Privacy
@@ -1714,6 +1714,12 @@ Set Advertising (since 1.4)
 :Return Parameters:	Current_Settings (4 Octets)
 
 This command is used to enable LE advertising on a controller that supports it.
+This is referred to as Global Advertising and it always uses advertising
+instance 0, its advertising data is generated by the kernel based on the
+current settings (e.g. Flags, TX Power, Local Name and Appearance) and is not
+related to the advertising instances added with Add Advertising or Add
+Extended Advertising Parameters/Data commands, which start at instance 1.
+
 The allowed values for the Advertising command parameter are:
 
 .. csv-table::
@@ -1742,10 +1748,20 @@ The value 0x02 should be the preferred mode of operation when implementing
 peripheral mode.
 
 Using this command will temporarily deactivate any configuration made by the Add
-Advertising command. This command takes precedence. Once a Set Advertising
-command with value 0x00 is issued any previously made configurations via
-Add/Remove Advertising, including such changes made while Set Advertising was
-active, will be re-enabled.
+Advertising command that shares the same advertising set as Global Advertising.
+This command takes precedence. Once a Set Advertising command with value 0x00
+is issued any previously made configurations via Add/Remove Advertising,
+including such changes made while Set Advertising was active, will be
+re-enabled.
+
+If the controller does not support extended advertising, there is only a single
+advertising set, so all instances are deactivated while Global Advertising is
+enabled. If the controller supports extended advertising, Global Advertising
+uses a dedicated advertising set (handle 0x00) so instances using other
+advertising sets continue to be advertised concurrently and are not affected
+by this command. Only an instance that would need to share the advertising
+set of Global Advertising (e.g. when the controller supports a single
+advertising set) is deactivated.
 
 A pre-requisite is that LE is already enabled, otherwise this command will
 return a "rejected" response.
@@ -2757,10 +2773,12 @@ This command is used to configure an advertising instance that can be used to
 switch a Bluetooth Low Energy controller into advertising mode.
 
 Added advertising information with this command will not be visible immediately
-if advertising is enabled via the Set Advertising command. The usage of the Set
-Advertising command takes precedence over this command. Instance information is
-stored and will be advertised once advertising via Set Advertising has been
-disabled.
+if Global Advertising is enabled via the Set Advertising command and the
+instance shares the same advertising set (see Set Advertising command). The
+usage of the Set Advertising command takes precedence over this command.
+Instance information is stored and will be advertised once advertising via Set
+Advertising has been disabled. If the controller supports extended advertising
+the instance is advertised concurrently with Global Advertising.
 
 The Instance identifier is a value between 1 and the number of supported
 instances. The value 0 is reserved.
@@ -2880,10 +2898,12 @@ When the Instance parameter is zero, then all previously added advertising
 Instances will be removed.
 
 Removing advertising information with this command will not be visible as long
-as advertising is enabled via the Set Advertising command. The usage of the Set
-Advertising command takes precedence over this command. Changes to Instance
-information are stored and will be advertised once advertising via Set
-Advertising has been disabled.
+as Global Advertising is enabled via the Set Advertising command and the
+instance shares the same advertising set (see Set Advertising command). The
+usage of the Set Advertising command takes precedence over this command.
+Changes to Instance information are stored and will be advertised once
+advertising via Set Advertising has been disabled. Removing instances never
+disables Global Advertising.
 
 Removing an instance while it is being advertised will immediately cancel the
 instance, even when it has been advertised less then its configured Timeout or
@@ -3048,7 +3068,7 @@ currently the following available bits:
 	7, Basic Rate/Enhanced Data Rate
 	8, High Speed
 	9, Low Energy
-	10, Advertising
+	10, Advertising (Global Advertising - instance 0)
 	11, Secure Connections
 	12, Debug Keys
 	13, Privacy
@@ -3779,10 +3799,12 @@ advertising instance. This command is expected to be followed by an Add Extended
 Advertising Data command to complete and enable the advertising instance.
 
 Added advertising information with this command will not be visible immediately
-if advertising is enabled via the Set Advertising command. The usage of the Set
-Advertising command takes precedence over this command. Instance information is
-stored and will be advertised once advertising via Set Advertising has been
-disabled.
+if Global Advertising is enabled via the Set Advertising command and the
+instance shares the same advertising set (see Set Advertising command). The
+usage of the Set Advertising command takes precedence over this command.
+Instance information is stored and will be advertised once advertising via Set
+Advertising has been disabled. If the controller supports extended advertising
+the instance is advertised concurrently with Global Advertising.
 
 The Instance identifier is a value between 1 and the number of supported
 instances. The value 0 is reserved.
@@ -3936,11 +3958,13 @@ advertisement registration process.
 
 If extended advertising is available, this call will initiate HCI commands to
 set the instance's advertising data, set scan response data, and then enable the
-instance. If extended advertising is unavailable, the advertising instance
-structure maintained in kernel will have its advertising data and scan response
-updated, and the instance will either be scheduled immediately or left in the
-queue for later advertisement as part of round-robin advertisement rotation in
-software.
+instance, regardless of Global Advertising being enabled via Set Advertising
+command, unless the instance shares the same advertising set (see Set
+Advertising command). If extended advertising is unavailable, the advertising
+instance structure maintained in kernel will have its advertising data and scan
+response updated, and the instance will either be scheduled immediately or left
+in the queue for later advertisement as part of round-robin advertisement
+rotation in software, or until Global Advertising is disabled.
 
 If Scan_Rsp_Len is zero and the flags defined in Add Extended Advertising
 Parameters command do not have connectable flag set and the global connectable
-- 
2.55.0


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

* [PATCH BlueZ v1 2/2] mgmt-tester: Add Global Advertising tests for extended advertising
  2026-10-05 15:21 [PATCH BlueZ v1 1/2] doc/mgmt: Document Advertising setting as Global Advertising Luiz Augusto von Dentz
@ 2026-10-05 15:21 ` Luiz Augusto von Dentz
  2026-10-05 20:18 ` [BlueZ,v1,1/2] doc/mgmt: Document Advertising setting as Global Advertising bluez.test.bot
  2026-10-06 16:53 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-05 15:21 UTC (permalink / raw)
  To: linux-bluetooth

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

With extended advertising, instances are advertised concurrently with
Global Advertising, so update "Set Adv off override" to expect only
the set of instance 0 to be disabled, and add tests checking that
adding an instance enables it and that removing the last instance does
not disable Global Advertising.

Assisted-by: OpenCode:claude-opus-5.5
---
 tools/mgmt-tester.c | 110 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 107 insertions(+), 3 deletions(-)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index d8e3c413f8c9..75a1431fdf19 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -8656,6 +8656,18 @@ static const struct generic_data add_ext_advertising_success_4 = {
 	.expect_hci_len = sizeof(set_ext_adv_data_txpwr),
 };
 
+static const char set_ext_adv_disable_param_0[] = {
+	0x00,		/* Disable */
+	0x01,		/* No of sets */
+	0x00,		/* Handle */
+	0x00, 0x00,	/* Duration */
+	0x00,		/* Max events */
+};
+
+/* With extended advertising instance 1 is already advertising alongside
+ * Global Advertising (instance 0), so disabling it shall only disable the
+ * advertising set used by instance 0.
+ */
 static const struct generic_data add_ext_advertising_success_5 = {
 	.send_opcode = MGMT_OP_SET_ADVERTISING,
 	.send_param = set_adv_off_param,
@@ -8663,9 +8675,61 @@ static const struct generic_data add_ext_advertising_success_5 = {
 	.expect_status = MGMT_STATUS_SUCCESS,
 	.expect_param = set_powered_ext_adv_instance_settings_param,
 	.expect_len = sizeof(set_powered_ext_adv_instance_settings_param),
-	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_DATA,
-	.expect_hci_param = set_ext_adv_data_test1,
-	.expect_hci_len = sizeof(set_ext_adv_data_test1),
+	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE,
+	.expect_hci_param = set_ext_adv_disable_param_0,
+	.expect_hci_len = sizeof(set_ext_adv_disable_param_0),
+};
+
+static uint16_t settings_powered_le_advertising[] = { MGMT_OP_SET_LE,
+					MGMT_OP_SET_ADVERTISING,
+					MGMT_OP_SET_POWERED, 0 };
+
+/* Instances not sharing the advertising set of Global Advertising
+ * (instance 0) shall be advertised right away.
+ */
+static const struct generic_data add_ext_advertising_global_adv = {
+	.setup_settings = settings_powered_le_advertising,
+	.send_opcode = MGMT_OP_ADD_ADVERTISING,
+	.send_param = add_advertising_param_uuid,
+	.send_len = sizeof(add_advertising_param_uuid),
+	.expect_param = advertising_instance1_param,
+	.expect_len = sizeof(advertising_instance1_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_alt_ev = MGMT_EV_ADVERTISING_ADDED,
+	.expect_alt_ev_param = advertising_instance1_param,
+	.expect_alt_ev_len = sizeof(advertising_instance1_param),
+	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE,
+	.expect_hci_param = set_ext_adv_on_set_adv_enable_param,
+	.expect_hci_len = sizeof(set_ext_adv_on_set_adv_enable_param),
+};
+
+static const struct generic_data adv_data_global_adv = {
+	.setup_settings = settings_powered_le_advertising,
+	.send_opcode = MGMT_OP_ADD_EXT_ADV_DATA,
+	.send_param = ext_adv_data_valid,
+	.send_len = sizeof(ext_adv_data_valid),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = ext_adv_data_mgmt_rsp_valid,
+	.expect_len = sizeof(ext_adv_data_mgmt_rsp_valid),
+	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE,
+	.expect_hci_param = set_ext_adv_on_set_adv_enable_param,
+	.expect_hci_len = sizeof(set_ext_adv_on_set_adv_enable_param),
+};
+
+/* Removing the last instance shall not disable Global Advertising */
+static const struct generic_data remove_ext_advertising_global_adv = {
+	.send_opcode = MGMT_OP_REMOVE_ADVERTISING,
+	.send_param = remove_advertising_param_1,
+	.send_len = sizeof(remove_advertising_param_1),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = remove_advertising_param_1,
+	.expect_len = sizeof(remove_advertising_param_1),
+	.expect_alt_ev = MGMT_EV_ADVERTISING_REMOVED,
+	.expect_alt_ev_param = advertising_instance1_param,
+	.expect_alt_ev_len = sizeof(advertising_instance1_param),
+	.expect_hci_command = BT_HCI_CMD_LE_REMOVE_ADV_SET,
+	.expect_hci_param = advertising_instance1_param,
+	.expect_hci_len = sizeof(advertising_instance1_param),
 };
 
 static const struct generic_data add_ext_advertising_success_6 = {
@@ -12071,6 +12135,32 @@ static void test_command_generic(const void *test_data)
 	test_add_condition(data);
 }
 
+static void global_adv_disable_hci_callback(uint16_t opcode,
+					const void *param, uint8_t length,
+					void *user_data)
+{
+	const uint8_t *cp = param;
+
+	if (opcode != BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE || length < 2)
+		return;
+
+	/* Fail if all sets, including Global Advertising, are disabled */
+	if (!cp[0] && !cp[1]) {
+		tester_warn("Global Advertising disabled");
+		tester_test_failed();
+	}
+}
+
+static void test_command_global_adv(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+
+	hciemu_add_central_post_command_hook(data->hciemu,
+					global_adv_disable_hci_callback, data);
+
+	test_command_generic(test_data);
+}
+
 static void setup_set_static_addr_success_2(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -14627,6 +14717,10 @@ int main(int argc, char *argv[])
 					setup_set_and_add_advertising,
 					test_command_generic);
 
+	test_bredrle50("Add Ext Advertising - Success (Global Adv)",
+					&add_ext_advertising_global_adv,
+					NULL, test_command_generic);
+
 	test_bredrle50("Add Ext Advertising - Success 6 (Scan Rsp Dta, Adv ok)",
 					&add_ext_advertising_success_6,
 					NULL, test_command_generic);
@@ -14807,6 +14901,11 @@ int main(int argc, char *argv[])
 						setup_add_advertising,
 						test_command_generic);
 
+	test_bredrle50("Remove Ext Advertising - Success (Global Adv)",
+					&remove_ext_advertising_global_adv,
+					setup_set_and_add_advertising,
+					test_command_global_adv);
+
 	/* When advertising two instances, the instances should be
 	 * advertised in a round-robin fashion.
 	 */
@@ -14989,6 +15088,11 @@ int main(int argc, char *argv[])
 				setup_ext_adv_params,
 				test_command_generic);
 
+	test_bredrle50("Ext Adv MGMT - AD Data (5.0) Success (Global Adv)",
+				&adv_data_global_adv,
+				setup_ext_adv_params,
+				test_command_generic);
+
 	test_bredrle50("Ext Adv MGMT - AD Scan Response (5.0) Success",
 				&adv_scan_rsp_success,
 				setup_ext_adv_params,
-- 
2.55.0


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

* RE: [BlueZ,v1,1/2] doc/mgmt: Document Advertising setting as Global Advertising
  2026-10-05 15:21 [PATCH BlueZ v1 1/2] doc/mgmt: Document Advertising setting as Global Advertising Luiz Augusto von Dentz
  2026-10-05 15:21 ` [PATCH BlueZ v1 2/2] mgmt-tester: Add Global Advertising tests for extended advertising Luiz Augusto von Dentz
@ 2026-10-05 20:18 ` bluez.test.bot
  2026-10-06 16:53 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-10-05 20:18 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1315 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/series/1179727/

---Test result---

Test Summary:
CheckPatch                    PASS      3.18 seconds
GitLint                       FAIL      0.70 seconds
BuildEll                      PASS      19.71 seconds
BluezMake                     PASS      387.42 seconds
MakeCheck                     PASS      14.37 seconds
MakeDistcheck                 PASS      139.06 seconds
CheckValgrind                 PASS      230.47 seconds
CheckSmatch                   PASS      290.67 seconds
bluezmakeextell               PASS      94.96 seconds
TestFunctional                PASS      1098.63 seconds
IncrementalBuild              PASS      394.26 seconds
ScanBuild                     PASS      1114.41 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1,2/2] mgmt-tester: Add Global Advertising tests for extended advertising

1: T1 Title exceeds max length (81>80): "[BlueZ,v1,2/2] mgmt-tester: Add Global Advertising tests for extended advertising"


https://github.com/bluez/bluez/pull/2627

---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ v1 1/2] doc/mgmt: Document Advertising setting as Global Advertising
  2026-10-05 15:21 [PATCH BlueZ v1 1/2] doc/mgmt: Document Advertising setting as Global Advertising Luiz Augusto von Dentz
  2026-10-05 15:21 ` [PATCH BlueZ v1 2/2] mgmt-tester: Add Global Advertising tests for extended advertising Luiz Augusto von Dentz
  2026-10-05 20:18 ` [BlueZ,v1,1/2] doc/mgmt: Document Advertising setting as Global Advertising bluez.test.bot
@ 2026-10-06 16:53 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-06 16:53 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon,  5 Oct 2026 11:21:10 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> The Advertising setting always uses instance 0, and with extended
> advertising it has a dedicated advertising set, so only instances
> sharing that set are overridden by it; the others are advertised
> concurrently and removing instances never disables it.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1,1/2] doc/mgmt: Document Advertising setting as Global Advertising
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9b18ccef2c09
  - [BlueZ,v1,2/2] mgmt-tester: Add Global Advertising tests for extended advertising
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f8f352d133fa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-10-06 16:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 15:21 [PATCH BlueZ v1 1/2] doc/mgmt: Document Advertising setting as Global Advertising Luiz Augusto von Dentz
2026-10-05 15:21 ` [PATCH BlueZ v1 2/2] mgmt-tester: Add Global Advertising tests for extended advertising Luiz Augusto von Dentz
2026-10-05 20:18 ` [BlueZ,v1,1/2] doc/mgmt: Document Advertising setting as Global Advertising bluez.test.bot
2026-10-06 16:53 ` [PATCH BlueZ v1 1/2] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.