diff mbox series

[BlueZ,v1] shared/bap: Fix not starting released operation

Message ID 20250228171321.3465285-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 4130fe22fb8af7ebc02e737f2841da766e726b16
Headers show
Series [BlueZ,v1] shared/bap: Fix not starting released operation | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch warning CheckSparse WARNING src/shared/bap.c:305: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:305: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:305:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz Feb. 28, 2025, 5:13 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The release operation is intended to release CIS resources:

  'Releases resources associated with an ASE, immediately decouples the
  ASE from any previously coupled CIS, and tears down any CIS previously
  established for the ASE for one or more ASEs.

  Valid only if ASE_State field value = 0x01 (Codec Configured),
  0x02 (QoS Configured), 0x03 (Enabling), 0x04 (Streaming), or 0x05
  (Disabling).'

But as the stated in ASCS specification release can also be used with
the likes of Codec/QoS Configured which may not require the CIS to be
established and in that case released operation shall start
autonomously:

  'The Released operation shall be initiated autonomously by the server
  if:
  The Release operation for an ASE has been completed and the server
  controller has indicated that the underlying CIS for the ASE has been
  torn down.'
---
 src/shared/bap.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com Feb. 28, 2025, 6:32 p.m. UTC | #1
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=939100

---Test result---

Test Summary:
CheckPatch                    PENDING   0.21 seconds
GitLint                       PENDING   0.22 seconds
BuildEll                      PASS      20.30 seconds
BluezMake                     PASS      1536.37 seconds
MakeCheck                     PASS      12.92 seconds
MakeDistcheck                 PASS      157.14 seconds
CheckValgrind                 PASS      213.05 seconds
CheckSmatch                   WARNING   283.24 seconds
bluezmakeextell               PASS      97.43 seconds
IncrementalBuild              PENDING   0.27 seconds
ScanBuild                     PASS      855.57 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:305: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:305: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:305:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Feb. 28, 2025, 8:40 p.m. UTC | #2
Hello:

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

On Fri, 28 Feb 2025 12:13:21 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> The release operation is intended to release CIS resources:
> 
>   'Releases resources associated with an ASE, immediately decouples the
>   ASE from any previously coupled CIS, and tears down any CIS previously
>   established for the ASE for one or more ASEs.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] shared/bap: Fix not starting released operation
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4130fe22fb8a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 8b860ce8b984..f7e42fc15a81 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2099,7 +2099,24 @@  static uint8_t stream_release(struct bt_bap_stream *stream, struct iovec *rsp)
 
 	ascs_ase_rsp_success(rsp, stream->ep->id);
 
-	stream_set_state(stream, BT_BAP_STREAM_STATE_RELEASING);
+	/* In case the stream IO is already down the released transition needs
+	 * to take action immeditely.
+	 */
+	if (!stream->io) {
+		switch (bt_bap_stream_get_state(stream)) {
+		case BT_BAP_STREAM_STATE_CONFIG:
+			/* Released (no caching) */
+			stream_set_state(stream, BT_BAP_STREAM_STATE_RELEASING);
+			stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE);
+			break;
+		default:
+			/* Released (caching) */
+			stream_set_state(stream, BT_BAP_STREAM_STATE_RELEASING);
+			stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
+			break;
+		}
+	} else
+		stream_set_state(stream, BT_BAP_STREAM_STATE_RELEASING);
 
 	return 0;
 }