* [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss @ 2026-06-09 21:11 Simon Mikuda 2026-06-09 22:15 ` Pauli Virtanen 2026-06-09 23:02 ` [BlueZ] " bluez.test.bot 0 siblings, 2 replies; 8+ messages in thread From: Simon Mikuda @ 2026-06-09 21:11 UTC (permalink / raw) To: linux-bluetooth; +Cc: Simon Mikuda stream_io_disconnected() only handled the Releasing state, leaving Enabling, Streaming and Disabling ASEs stuck when the CIS was lost unexpectedly. The ASE shall autonomously move to QoS Configured on loss of the CIS and notify the peer; add that transition. Fixes PTS test BAP/USR/SCC/BV-167-C --- src/shared/bap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index deb85b264..350ed53d9 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6779,6 +6779,14 @@ static bool stream_io_disconnected(struct io *io, void *user_data) if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING) stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + /* On loss of the CIS the ASE shall autonomously transition to QoS + * Configured and notify the peer. + */ + if (stream->ep->state == BT_ASCS_ASE_STATE_STREAMING || + stream->ep->state == BT_ASCS_ASE_STATE_ENABLING || + stream->ep->state == BT_ASCS_ASE_STATE_DISABLING) + stream_set_state(stream, BT_BAP_STREAM_STATE_QOS); + bt_bap_stream_set_io(stream, -1); return false; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss 2026-06-09 21:11 [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss Simon Mikuda @ 2026-06-09 22:15 ` Pauli Virtanen 2026-06-10 7:57 ` Simon Mikuda 2026-06-09 23:02 ` [BlueZ] " bluez.test.bot 1 sibling, 1 reply; 8+ messages in thread From: Pauli Virtanen @ 2026-06-09 22:15 UTC (permalink / raw) To: Simon Mikuda, linux-bluetooth ti, 2026-06-09 kello 23:11 +0200, Simon Mikuda kirjoitti: > stream_io_disconnected() only handled the Releasing state, leaving > Enabling, Streaming and Disabling ASEs stuck when the CIS was lost > unexpectedly. The ASE shall autonomously move to QoS Configured on loss > of the CIS and notify the peer; add that transition. > > Fixes PTS test BAP/USR/SCC/BV-167-C > --- > src/shared/bap.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index deb85b264..350ed53d9 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -6779,6 +6779,14 @@ static bool stream_io_disconnected(struct io *io, void *user_data) > if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING) > stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); > > + /* On loss of the CIS the ASE shall autonomously transition to QoS > + * Configured and notify the peer. > + */ > + if (stream->ep->state == BT_ASCS_ASE_STATE_STREAMING || > + stream->ep->state == BT_ASCS_ASE_STATE_ENABLING || > + stream->ep->state == BT_ASCS_ASE_STATE_DISABLING) > + stream_set_state(stream, BT_BAP_STREAM_STATE_QOS); > + > bt_bap_stream_set_io(stream, -1); > return false; > } iirc it may be also broadcast source here, does it do the right thing? -- Pauli Virtanen ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss 2026-06-09 22:15 ` Pauli Virtanen @ 2026-06-10 7:57 ` Simon Mikuda 2026-06-10 13:10 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 8+ messages in thread From: Simon Mikuda @ 2026-06-10 7:57 UTC (permalink / raw) To: Pauli Virtanen, linux-bluetooth this check is for ep (struct bt_bap_endpoint) that is used only for unicast. broadcasts use different state in struct bt_bap_stream, so it should be OK On 6/10/26 00:15, Pauli Virtanen wrote: > ti, 2026-06-09 kello 23:11 +0200, Simon Mikuda kirjoitti: >> stream_io_disconnected() only handled the Releasing state, leaving >> Enabling, Streaming and Disabling ASEs stuck when the CIS was lost >> unexpectedly. The ASE shall autonomously move to QoS Configured on loss >> of the CIS and notify the peer; add that transition. >> >> Fixes PTS test BAP/USR/SCC/BV-167-C >> --- >> src/shared/bap.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/src/shared/bap.c b/src/shared/bap.c >> index deb85b264..350ed53d9 100644 >> --- a/src/shared/bap.c >> +++ b/src/shared/bap.c >> @@ -6779,6 +6779,14 @@ static bool stream_io_disconnected(struct io *io, void *user_data) >> if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING) >> stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); >> >> + /* On loss of the CIS the ASE shall autonomously transition to QoS >> + * Configured and notify the peer. >> + */ >> + if (stream->ep->state == BT_ASCS_ASE_STATE_STREAMING || >> + stream->ep->state == BT_ASCS_ASE_STATE_ENABLING || >> + stream->ep->state == BT_ASCS_ASE_STATE_DISABLING) >> + stream_set_state(stream, BT_BAP_STREAM_STATE_QOS); >> + >> bt_bap_stream_set_io(stream, -1); >> return false; >> } > iirc it may be also broadcast source here, does it do the right thing? > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss 2026-06-10 7:57 ` Simon Mikuda @ 2026-06-10 13:10 ` Luiz Augusto von Dentz 2026-06-14 10:02 ` [PATCH BlueZ v2 1/2] " Simon Mikuda 0 siblings, 1 reply; 8+ messages in thread From: Luiz Augusto von Dentz @ 2026-06-10 13:10 UTC (permalink / raw) To: Simon Mikuda; +Cc: Pauli Virtanen, linux-bluetooth Hi Simon, On Wed, Jun 10, 2026 at 4:03 AM Simon Mikuda <simon.mikuda@streamunlimited.com> wrote: > > this check is for ep (struct bt_bap_endpoint) that is used only for > unicast. broadcasts use different state in struct bt_bap_stream, so it > should be OK > > On 6/10/26 00:15, Pauli Virtanen wrote: > > ti, 2026-06-09 kello 23:11 +0200, Simon Mikuda kirjoitti: > >> stream_io_disconnected() only handled the Releasing state, leaving > >> Enabling, Streaming and Disabling ASEs stuck when the CIS was lost > >> unexpectedly. The ASE shall autonomously move to QoS Configured on loss > >> of the CIS and notify the peer; add that transition. > >> > >> Fixes PTS test BAP/USR/SCC/BV-167-C > >> --- > >> src/shared/bap.c | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/src/shared/bap.c b/src/shared/bap.c > >> index deb85b264..350ed53d9 100644 > >> --- a/src/shared/bap.c > >> +++ b/src/shared/bap.c > >> @@ -6779,6 +6779,14 @@ static bool stream_io_disconnected(struct io *io, void *user_data) > >> if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING) > >> stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); > >> > >> + /* On loss of the CIS the ASE shall autonomously transition to QoS > >> + * Configured and notify the peer. > >> + */ > >> + if (stream->ep->state == BT_ASCS_ASE_STATE_STREAMING || > >> + stream->ep->state == BT_ASCS_ASE_STATE_ENABLING || > >> + stream->ep->state == BT_ASCS_ASE_STATE_DISABLING) > >> + stream_set_state(stream, BT_BAP_STREAM_STATE_QOS); > >> + I think converting this to a switch statement might be better, as it would allow us to handle all states, including releasing, within it. It would be great to have test-bap cover these types of tests as well. > >> bt_bap_stream_set_io(stream, -1); > >> return false; > >> } > > iirc it may be also broadcast source here, does it do the right thing? > > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH BlueZ v2 1/2] shared/bap: Transition ASE to QoS Configured on CIS loss 2026-06-10 13:10 ` Luiz Augusto von Dentz @ 2026-06-14 10:02 ` Simon Mikuda 2026-06-14 10:02 ` [PATCH BlueZ v2 2/2] unit/bap: Add CIS loss test Simon Mikuda 2026-06-14 13:12 ` [BlueZ,v2,1/2] shared/bap: Transition ASE to QoS Configured on CIS loss bluez.test.bot 0 siblings, 2 replies; 8+ messages in thread From: Simon Mikuda @ 2026-06-14 10:02 UTC (permalink / raw) To: linux-bluetooth; +Cc: Simon Mikuda stream_io_disconnected() only handled the Releasing state, leaving Enabling, Streaming and Disabling ASEs stuck when the CIS was lost unexpectedly. The ASE shall autonomously move to QoS Configured on loss of the CIS and notify the peer Fixes PTS test BAP/USR/SCC/BV-167-C --- src/shared/bap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index deb85b264..8d1f25719 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6776,8 +6776,16 @@ static bool stream_io_disconnected(struct io *io, void *user_data) return false; } - if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING) + switch (stream->ep->state) { + case BT_ASCS_ASE_STATE_RELEASING: stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + break; + case BT_ASCS_ASE_STATE_ENABLING: + case BT_ASCS_ASE_STATE_STREAMING: + case BT_ASCS_ASE_STATE_DISABLING: + stream_set_state(stream, BT_BAP_STREAM_STATE_QOS); + break; + } bt_bap_stream_set_io(stream, -1); return false; -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH BlueZ v2 2/2] unit/bap: Add CIS loss test 2026-06-14 10:02 ` [PATCH BlueZ v2 1/2] " Simon Mikuda @ 2026-06-14 10:02 ` Simon Mikuda 2026-06-14 13:12 ` [BlueZ,v2,1/2] shared/bap: Transition ASE to QoS Configured on CIS loss bluez.test.bot 1 sibling, 0 replies; 8+ messages in thread From: Simon Mikuda @ 2026-06-14 10:02 UTC (permalink / raw) To: linux-bluetooth; +Cc: Simon Mikuda Verify a Source ASE in the Enabling state transitions to QoS Configured rather than Disabling when its CIS is lost. Assisted-by: ClaudeCode:claude-opus-4.8 --- unit/test-bap.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/unit/test-bap.c b/unit/test-bap.c index 03b19678e..2847f5743 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -1486,6 +1486,37 @@ static void test_server(const void *user_data) tester_io_send(); } +static void bap_attached_state(struct bt_bap *bap, void *user_data) +{ + struct test_data *data = user_data; + + data->bap = bap; + + bt_bap_set_debug(data->bap, print_debug, "bt_bap:", NULL); + + bt_bap_state_register(data->bap, data->cfg->state_func, NULL, data, + NULL); +} + +/* Like test_server() but registers the config's state callback so the test can + * drive autonomous server transitions (e.g. loss of the CIS). + */ +static void test_server_state(const void *user_data) +{ + struct test_data *data = (void *)user_data; + struct io *io; + + io = tester_setup_io(data->iov, data->iovcnt); + g_assert(io); + + tester_io_set_complete_func(test_complete_cb); + + data->id = bt_bap_register(bap_attached_state, NULL, data); + g_assert(data->id); + + tester_io_send(); +} + static void test_usr_disc(void) { /* BAP/USR/DISC/BV-01-C [Expose Audio Sink Capabilities] @@ -4427,6 +4458,48 @@ static void test_spe(void) IOV_DATA(0x1b, 0x16, 0x00, 0x01, 0x04, 0x00, 0x00, 0x04, 0x03, 0x02, \ 0x01, 0x00) +static void state_cis_loss(struct bt_bap_stream *stream, uint8_t old_state, + uint8_t new_state, void *user_data) +{ + struct test_data *data = user_data; + int fds[2]; + int err; + + if (new_state != data->cfg->state) + return; + + /* Attach a CIS and tear it down to simulate its loss. */ + err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, fds); + g_assert(err == 0); + g_assert(bt_bap_stream_io_connecting(stream, fds[0]) == 0); + close(fds[1]); +} + +static struct test_config cfg_src_enabling_cis_loss = { + .cc = LC3_CONFIG_16_2, + .qos = LC3_QOS_16_2_1, + .src = true, + .state = BT_BAP_STREAM_STATE_ENABLING, + .state_func = state_cis_loss, +}; + +/* On loss of the CIS a Source ASE in Enabling moves to QoS Configured, not + * Disabling. + */ +#define SCC_SRC_ENABLING_CIS_LOSS \ + SCC_SRC_16_2_1, \ + ENABLE_ASE(SRC_ID(0)), \ + QOS_SRC_NOTIFY(0, 0, 0x10, 0x27, 0x00, 0x00, 0x02, 0x28, 0x00, \ + 0x02, 0x0a, 0x00, 0x40, 0x9c, 0x00) + +static void test_usr_scc_cis_loss(void) +{ + define_test("BAP/USR/SCC/BV-167-C [USR SRC QoS Configured on CIS loss]", + test_setup_server, test_server_state, + &cfg_src_enabling_cis_loss, + SCC_SRC_ENABLING_CIS_LOSS); +} + static struct test_config str_snk_ac2_8_1_1 = { .cc = LC3_CONFIG_8_1_AC(1), .qos = LC3_QOS_8_1_1_AC(1), @@ -7287,6 +7360,7 @@ static void test_scc(void) test_scc_enable(); test_scc_disable(); test_scc_release(); + test_usr_scc_cis_loss(); test_scc_metadata(); test_str_1_1_1_lc3(); } -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [BlueZ,v2,1/2] shared/bap: Transition ASE to QoS Configured on CIS loss 2026-06-14 10:02 ` [PATCH BlueZ v2 1/2] " Simon Mikuda 2026-06-14 10:02 ` [PATCH BlueZ v2 2/2] unit/bap: Add CIS loss test Simon Mikuda @ 2026-06-14 13:12 ` bluez.test.bot 1 sibling, 0 replies; 8+ messages in thread From: bluez.test.bot @ 2026-06-14 13:12 UTC (permalink / raw) To: linux-bluetooth, simon.mikuda [-- Attachment #1: Type: text/plain, Size: 2577 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=1111249 ---Test result--- Test Summary: CheckPatch FAIL 0.85 seconds GitLint PASS 0.58 seconds BuildEll PASS 20.31 seconds BluezMake PASS 653.75 seconds MakeCheck PASS 19.29 seconds MakeDistcheck PASS 248.27 seconds CheckValgrind PASS 296.98 seconds CheckSmatch WARNING 353.24 seconds bluezmakeextell PASS 184.97 seconds IncrementalBuild PASS 975.52 seconds ScanBuild PASS 1043.13 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v2,2/2] unit/bap: Add CIS loss test WARNING:BAD_SIGN_OFF: Non-standard signature: Assisted-by: #102: Assisted-by: ClaudeCode:claude-opus-4.8 ERROR:BAD_SIGN_OFF: Unrecognized email address: 'ClaudeCode:claude-opus-4.8' #102: Assisted-by: ClaudeCode:claude-opus-4.8 /github/workspace/src/patch/14628094.patch total: 1 errors, 1 warnings, 92 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/patch/14628094.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures https://github.com/bluez/bluez/pull/2230 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss 2026-06-09 21:11 [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss Simon Mikuda 2026-06-09 22:15 ` Pauli Virtanen @ 2026-06-09 23:02 ` bluez.test.bot 1 sibling, 0 replies; 8+ messages in thread From: bluez.test.bot @ 2026-06-09 23:02 UTC (permalink / raw) To: linux-bluetooth, simon.mikuda [-- Attachment #1: Type: text/plain, Size: 1600 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=1108825 ---Test result--- Test Summary: CheckPatch PASS 0.45 seconds GitLint PASS 0.48 seconds BuildEll PASS 20.19 seconds BluezMake PASS 625.65 seconds MakeCheck PASS 12.74 seconds MakeDistcheck PASS 236.69 seconds CheckValgrind PASS 257.53 seconds CheckSmatch WARNING 326.14 seconds bluezmakeextell PASS 165.85 seconds IncrementalBuild PASS 622.35 seconds ScanBuild PASS 935.06 seconds Details ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures https://github.com/bluez/bluez/pull/2209 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-06-14 13:12 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-09 21:11 [PATCH BlueZ] shared/bap: Transition ASE to QoS Configured on CIS loss Simon Mikuda 2026-06-09 22:15 ` Pauli Virtanen 2026-06-10 7:57 ` Simon Mikuda 2026-06-10 13:10 ` Luiz Augusto von Dentz 2026-06-14 10:02 ` [PATCH BlueZ v2 1/2] " Simon Mikuda 2026-06-14 10:02 ` [PATCH BlueZ v2 2/2] unit/bap: Add CIS loss test Simon Mikuda 2026-06-14 13:12 ` [BlueZ,v2,1/2] shared/bap: Transition ASE to QoS Configured on CIS loss bluez.test.bot 2026-06-09 23:02 ` [BlueZ] " bluez.test.bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox