* [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable
@ 2024-12-13 11:31 Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 1/3] lib: Add BT_ISO_SYNC_FACTOR Iulia Tanasescu
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Iulia Tanasescu @ 2024-12-13 11:31 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
This adds a new user input prompt when configuring a Broadcast Source
endpoint, to configure a QoS sync_factor value. This is useful for the
user to adjust how frequent PA announcements should be sent by the
Source, depending on scenario, instead of always using a hardcoded
value.
Since all BISes in a BIG must be configured with the same QoS settings,
a check is added in the BAP plugin, to ensure that the QoS matches for
all streams. Otherwise, connecting multiple BIS sockets bound for the
same BIG will fail.
Iulia Tanasescu (3):
lib: Add BT_ISO_SYNC_FACTOR
client/player: Make QoS sync_factor configurable
bap: Do not allow BIS QoS mismatch
client/player.c | 30 +++++++++-
client/scripts/broadcast-source.bt | 1 +
lib/bluetooth.h | 12 ++++
profiles/audio/bap.c | 88 +++++++++++++++++++++++++++++-
4 files changed, 127 insertions(+), 4 deletions(-)
base-commit: 92f3a3b108c22e3395c9dab0acefdfb894404cfe
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH BlueZ 1/3] lib: Add BT_ISO_SYNC_FACTOR
2024-12-13 11:31 [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable Iulia Tanasescu
@ 2024-12-13 11:31 ` Iulia Tanasescu
2024-12-13 12:35 ` client/player: Make QoS sync_factor configurable bluez.test.bot
2024-12-13 11:31 ` [PATCH BlueZ 2/3] " Iulia Tanasescu
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Iulia Tanasescu @ 2024-12-13 11:31 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
This defines the default sync factor value to be used by ISO Broadcasters.
---
lib/bluetooth.h | 12 ++++++++++++
profiles/audio/bap.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index 073ed875d..ea9adb83b 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -153,6 +153,18 @@ struct bt_voice {
#define BT_ISO_SYNC_TIMEOUT 0x07d0 /* 20 secs */
+/* For an ISO Broadcaster, this value is used to compute
+ * the desired Periodic Advertising Interval as a function
+ * of SDU interval, based on the formula:
+ *
+ * PA_Interval = SDU_Interval * sync_factor
+ *
+ * This is useful for adjusting how frequent to send PA
+ * announcements for Broadcast Sinks to discover, depending
+ * on scenario.
+ */
+#define BT_ISO_SYNC_FACTOR 0x01
+
#define BT_ISO_QOS_GROUP_UNSET 0xff
#define BT_ISO_QOS_STREAM_UNSET 0xff
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index a561c446a..f382b43a5 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -847,7 +847,7 @@ static struct bap_setup *setup_new(struct bap_ep *ep)
/* Mark BIG and BIS to be auto assigned */
setup->qos.bcast.big = BT_ISO_QOS_BIG_UNSET;
setup->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET;
- setup->qos.bcast.sync_factor = 0x01;
+ setup->qos.bcast.sync_factor = BT_ISO_SYNC_FACTOR;
setup->qos.bcast.sync_timeout = BT_ISO_SYNC_TIMEOUT;
setup->qos.bcast.timeout = BT_ISO_SYNC_TIMEOUT;
setup->qos_parser = setup_parse_bcast_qos;
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH BlueZ 2/3] client/player: Make QoS sync_factor configurable
2024-12-13 11:31 [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 1/3] lib: Add BT_ISO_SYNC_FACTOR Iulia Tanasescu
@ 2024-12-13 11:31 ` Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 3/3] bap: Do not allow BIS QoS mismatch Iulia Tanasescu
2024-12-16 21:50 ` [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: Iulia Tanasescu @ 2024-12-13 11:31 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
This adds a new user input prompt when configuring a Broadcast Source
endpoint, to configure a QoS sync_factor value. This is useful for the
user to adjust how frequent PA announcements should be sent by the
Source, depending on scenario, instead of always using a hardcoded
value.
[bluetooth]# endpoint.config /org/bluez/hci0/pac_bcast0
/local/endpoint/ep0 16_2_1
[/local/endpoint/ep0] BIG (auto/value): 1
[/local/endpoint/ep0] Enter sync factor (value/auto): 2
[/local/endpoint/ep0] Enter channel location (value/no): 1
[/local/endpoint/ep0] Enter Metadata (value/no): no
The PA interval is chosen as the BIG SDU interval multiplied by
sync_factor:
< HCI Command: LE Set Periodic Advertising Parameters (0x08|0x003e)
Handle: 1
Min interval: 20.00 msec (0x0010)
Max interval: 20.00 msec (0x0010)
Properties: 0x0000
> HCI Event: Command Complete (0x0e)
LE Set Periodic Advertising Parameters (0x08|0x003e)
Status: Success (0x00)
< HCI Command: LE Create Broadcast Isochronous Group (0x08|0x0068)
Handle: 0x01
Advertising Handle: 0x01
Number of BIS: 1
SDU Interval: 10000 us (0x002710)
Maximum SDU size: 40
Maximum Latency: 10 ms (0x000a)
RTN: 0x02
PHY: LE 2M (0x02)
Packing: Sequential (0x00)
Framing: Unframed (0x00)
Encryption: 0x00
Broadcast Code[16]: 0102680553f1415aa265bbafc6ea03b8
> HCI Event: Command Status (0x0f)
LE Create Broadcast Isochronous Group (0x08|0x0068)
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e)
LE Broadcast Isochronous Group Complete (0x1b)
Status: Success (0x00)
Handle: 0x01
BIG Synchronization Delay: 912 us (0x000390)
Transport Latency: 912 us (0x000390)
PHY: LE 2M (0x02)
NSE: 3
BN: 1
PTO: 0
IRC: 3
Maximum PDU: 40
ISO Interval: 10.00 msec (0x0008)
Connection Handle #0: 6
This also updates the broadcast-source.bt script, to include a new
input value for sync_factor.
---
client/player.c | 30 +++++++++++++++++++++++++++---
client/scripts/broadcast-source.bt | 1 +
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/client/player.c b/client/player.c
index eed8d2306..f93c9d908 100644
--- a/client/player.c
+++ b/client/player.c
@@ -3724,7 +3724,7 @@ add_meta:
endpoint_set_metadata_cfg, cfg);
}
-static void config_endpoint_iso_group(const char *input, void *user_data)
+static void config_endpoint_sync_factor(const char *input, void *user_data)
{
struct endpoint_config *cfg = user_data;
char *endptr = NULL;
@@ -3733,7 +3733,7 @@ static void config_endpoint_iso_group(const char *input, void *user_data)
bool found = false;
if (!strcasecmp(input, "a") || !strcasecmp(input, "auto")) {
- cfg->ep->iso_group = BT_ISO_QOS_GROUP_UNSET;
+ cfg->qos.bcast.sync_factor = BT_ISO_SYNC_FACTOR;
} else {
value = strtol(input, &endptr, 0);
@@ -3742,7 +3742,7 @@ static void config_endpoint_iso_group(const char *input, void *user_data)
return bt_shell_noninteractive_quit(EXIT_FAILURE);
}
- cfg->ep->iso_group = value;
+ cfg->qos.bcast.sync_factor = value;
}
/* Check if Channel Allocation is present in caps */
@@ -3763,6 +3763,30 @@ static void config_endpoint_iso_group(const char *input, void *user_data)
}
}
+static void config_endpoint_iso_group(const char *input, void *user_data)
+{
+ struct endpoint_config *cfg = user_data;
+ char *endptr = NULL;
+ int value;
+
+ if (!strcasecmp(input, "a") || !strcasecmp(input, "auto")) {
+ cfg->ep->iso_group = BT_ISO_QOS_GROUP_UNSET;
+ } else {
+ value = strtol(input, &endptr, 0);
+
+ if (!endptr || *endptr != '\0' || value > UINT8_MAX) {
+ bt_shell_printf("Invalid argument: %s\n", input);
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ cfg->ep->iso_group = value;
+ }
+
+ bt_shell_prompt_input(cfg->ep->path,
+ "Enter sync factor (value/auto):",
+ config_endpoint_sync_factor, cfg);
+}
+
static void endpoint_set_config_bcast(struct endpoint_config *cfg)
{
cfg->ep->bcode = g_new0(struct iovec, 1);
diff --git a/client/scripts/broadcast-source.bt b/client/scripts/broadcast-source.bt
index 6da9e23e2..1b918efb0 100644
--- a/client/scripts/broadcast-source.bt
+++ b/client/scripts/broadcast-source.bt
@@ -6,6 +6,7 @@ a
4
endpoint.config /org/bluez/hci0/pac_bcast0 /local/endpoint/ep0 16_2_1
1
+a
3
0x03 0x02 0x04 0x00
transport.acquire /org/bluez/hci0/pac_bcast0/fd0
\ No newline at end of file
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH BlueZ 3/3] bap: Do not allow BIS QoS mismatch
2024-12-13 11:31 [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 1/3] lib: Add BT_ISO_SYNC_FACTOR Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 2/3] " Iulia Tanasescu
@ 2024-12-13 11:31 ` Iulia Tanasescu
2024-12-16 21:50 ` [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: Iulia Tanasescu @ 2024-12-13 11:31 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
For Broadcast Source streams, QoS parameters are used for configuring
the PA and BIG. All parameters provided to the LE Create BIG command
are the same for all BISes (Core v5.3, vol.4, part E, page 2573).
Likewise, since the PA train is associated with the BIG, it is unique
for all included BISes. Thus, a stream should not be configured if the
QoS parameters do not match the global BIG configuration.
This commit adds a QoS check before a new stream is configured, to make
sure that all streams share the same settings.
---
profiles/audio/bap.c | 86 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index f382b43a5..77df9455a 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -905,6 +905,83 @@ static void setup_free(void *data)
free(setup);
}
+static bool match_io_qos(const struct bt_bap_io_qos *io_qos,
+ const struct bt_bap_io_qos *match)
+{
+ if (io_qos->interval != match->interval)
+ return false;
+
+ if (io_qos->latency != match->latency)
+ return false;
+
+ if (io_qos->sdu != match->sdu)
+ return false;
+
+ if (io_qos->phy != match->phy)
+ return false;
+
+ if (io_qos->rtn != match->rtn)
+ return false;
+
+ return true;
+}
+
+static bool match_bcast_qos(const struct bt_bap_bcast_qos *qos,
+ const struct bt_bap_bcast_qos *match)
+{
+ if (qos->sync_factor != match->sync_factor)
+ return false;
+
+ if (qos->packing != match->packing)
+ return false;
+
+ if (qos->framing != match->framing)
+ return false;
+
+ if (qos->encryption != match->encryption)
+ return false;
+
+ if (qos->encryption && util_iov_memcmp(qos->bcode, match->bcode))
+ return false;
+
+ if (qos->options != match->options)
+ return false;
+
+ if (qos->skip != match->skip)
+ return false;
+
+ if (qos->sync_timeout != match->sync_timeout)
+ return false;
+
+ if (qos->sync_cte_type != match->sync_cte_type)
+ return false;
+
+ if (qos->mse != match->mse)
+ return false;
+
+ if (qos->timeout != match->timeout)
+ return false;
+
+ if (qos->pa_sync != match->pa_sync)
+ return false;
+
+ return match_io_qos(&qos->io_qos, &match->io_qos);
+}
+
+static bool setup_mismatch_qos(const void *data, const void *user_data)
+{
+ const struct bap_setup *setup = data;
+ const struct bap_setup *match = user_data;
+
+ /* Match setups that are part of the same BIG */
+ if (setup == match ||
+ setup->qos.bcast.big == BT_ISO_QOS_BIG_UNSET ||
+ setup->qos.bcast.big != match->qos.bcast.big)
+ return false;
+
+ return !match_bcast_qos(&setup->qos.bcast, &match->qos.bcast);
+}
+
static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -937,6 +1014,15 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg,
return btd_error_invalid_args(msg);
}
+ if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SOURCE)
+ /* All streams in a BIG should have the same QoS.
+ * Check that the new configuration matches previous ones.
+ */
+ if (queue_find(setup->ep->setups, setup_mismatch_qos, setup)) {
+ setup_free(setup);
+ return btd_error_invalid_args(msg);
+ }
+
setup->stream = bt_bap_stream_new(ep->data->bap, ep->lpac, ep->rpac,
&setup->qos, setup->caps);
bt_bap_stream_set_user_data(setup->stream, ep->path);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: client/player: Make QoS sync_factor configurable
2024-12-13 11:31 ` [PATCH BlueZ 1/3] lib: Add BT_ISO_SYNC_FACTOR Iulia Tanasescu
@ 2024-12-13 12:35 ` bluez.test.bot
0 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2024-12-13 12:35 UTC (permalink / raw)
To: linux-bluetooth, iulia.tanasescu
[-- Attachment #1: Type: text/plain, Size: 1261 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=917572
---Test result---
Test Summary:
CheckPatch PENDING 0.22 seconds
GitLint PENDING 0.27 seconds
BuildEll PASS 21.38 seconds
BluezMake PASS 1682.22 seconds
MakeCheck PASS 15.38 seconds
MakeDistcheck PASS 169.82 seconds
CheckValgrind PASS 226.42 seconds
CheckSmatch PASS 289.94 seconds
bluezmakeextell PASS 103.76 seconds
IncrementalBuild PENDING 0.32 seconds
ScanBuild PASS 907.43 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable
2024-12-13 11:31 [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable Iulia Tanasescu
` (2 preceding siblings ...)
2024-12-13 11:31 ` [PATCH BlueZ 3/3] bap: Do not allow BIS QoS mismatch Iulia Tanasescu
@ 2024-12-16 21:50 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2024-12-16 21:50 UTC (permalink / raw)
To: Iulia Tanasescu
Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
andrei.istodorescu, luiz.dentz
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Fri, 13 Dec 2024 13:31:10 +0200 you wrote:
> This adds a new user input prompt when configuring a Broadcast Source
> endpoint, to configure a QoS sync_factor value. This is useful for the
> user to adjust how frequent PA announcements should be sent by the
> Source, depending on scenario, instead of always using a hardcoded
> value.
>
> Since all BISes in a BIG must be configured with the same QoS settings,
> a check is added in the BAP plugin, to ensure that the QoS matches for
> all streams. Otherwise, connecting multiple BIS sockets bound for the
> same BIG will fail.
>
> [...]
Here is the summary with links:
- [BlueZ,1/3] lib: Add BT_ISO_SYNC_FACTOR
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3db67f12c69e
- [BlueZ,2/3] client/player: Make QoS sync_factor configurable
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=bd2f851be865
- [BlueZ,3/3] bap: Do not allow BIS QoS mismatch
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ead7f4028a10
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] 6+ messages in thread
end of thread, other threads:[~2024-12-16 21:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13 11:31 [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 1/3] lib: Add BT_ISO_SYNC_FACTOR Iulia Tanasescu
2024-12-13 12:35 ` client/player: Make QoS sync_factor configurable bluez.test.bot
2024-12-13 11:31 ` [PATCH BlueZ 2/3] " Iulia Tanasescu
2024-12-13 11:31 ` [PATCH BlueZ 3/3] bap: Do not allow BIS QoS mismatch Iulia Tanasescu
2024-12-16 21:50 ` [PATCH BlueZ 0/3] client/player: Make QoS sync_factor configurable 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.