Linux bluetooth development
 help / color / mirror / Atom feed
From: raghu447 <raghavendra.rao@collabora.com>
To: linux-bluetooth@vger.kernel.org
Cc: raghu447 <raghavendra.rao@collabora.com>
Subject: [PATCH BlueZ 1/1] bap: set QOS state when CIS is lost while the state is streaming/enabling
Date: Mon, 11 May 2026 16:28:45 +0530	[thread overview]
Message-ID: <20260511105845.8008-2-raghavendra.rao@collabora.com> (raw)
In-Reply-To: <20260511105845.8008-1-raghavendra.rao@collabora.com>

This is used to Pass PTS tests BAP/USR/SCC/BV-167-C abd BV-168-C.
---
 src/shared/bap.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 78ba22259..2edd4b249 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -6670,9 +6670,38 @@ bool bt_bap_match_bcast_sink_stream(const void *data, const void *user_data)
 	return stream->lpac->type == BT_BAP_BCAST_SINK;
 }
 
+static void stream_io_qos_disconnect(struct bt_bap_stream *stream,
+					struct bt_bap_stream_io *io)
+{
+	uint8_t state;
+
+	if (!stream || !stream->ep || stream->io != io)
+		return;
+
+	state = stream->ep->state;
+
+	DBG(stream->bap, "CIS disconnected for stream %p state %u", stream,
+								state);
+
+	if (state != BT_ASCS_ASE_STATE_ENABLING &&
+			state != BT_ASCS_ASE_STATE_STREAMING)
+		return;
+
+	DBG(stream->bap, "Moving ASE %u to QoS Configured after CIS loss",
+							stream->ep->id);
+
+	stream_set_state(stream, BT_BAP_STREAM_STATE_QOS);
+}
+
+static void stream_link_io_qos_disconnect(void *data, void *user_data)
+{
+	stream_io_qos_disconnect(data, user_data);
+}
+
 static bool stream_io_disconnected(struct io *io, void *user_data)
 {
 	struct bt_bap_stream *stream = user_data;
+	struct bt_bap_stream_io *sio;
 
 	DBG(stream->bap, "stream %p io disconnected", stream);
 
@@ -6685,6 +6714,12 @@ static bool stream_io_disconnected(struct io *io, void *user_data)
 		return false;
 	}
 
+	sio = stream->io;
+	if (sio) {
+		stream_io_qos_disconnect(stream, sio);
+		queue_foreach(stream->links, stream_link_io_qos_disconnect, sio);
+	}
+
 	if (stream->ep->state == BT_ASCS_ASE_STATE_RELEASING)
 		stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
 
-- 
2.43.0


  reply	other threads:[~2026-05-11 10:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 10:58 [PATCH BlueZ 0/1] /bap: Handle CIS loss during streaming raghu447
2026-05-11 10:58 ` raghu447 [this message]
2026-05-11 14:09   ` [PATCH BlueZ 1/1] bap: set QOS state when CIS is lost while the state is streaming/enabling Luiz Augusto von Dentz
2026-05-11 14:28   ` /bap: Handle CIS loss during streaming bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260511105845.8008-2-raghavendra.rao@collabora.com \
    --to=raghavendra.rao@collabora.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox