From patchwork Thu Oct 24 11:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848776 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 901A81CACCE for ; Thu, 24 Oct 2024 11:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767779; cv=fail; b=OklHqMaBlGKDUI547F6h/TMp9/mSrj3a2JCWUF/idOzeqT59UoL9D34PpXxHJFYrgYg8xeX2CP8nZSH08Rza+7rszNAHO0dsabtvpWPk2NAeNEMZHyLQpNCQYAzrgmfnCcwygnU0vff8kwvoP3pXuDRP4tVi7Wb3zTrYgDW61to= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767779; c=relaxed/simple; bh=vGoYHrV9It3hSCFhh0q5y6vymuna8Qe7Qal+Y+1Ry5I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=WAtAfEiOs2REe95aA97JP4/KQZogeY1ewymdHSZA4D0vA4CaEZRaHvpk963QWT4QcuWiOO4J01hJb17GjYP/lyAS4eNXq1WqJAR2V1l9i6NcTgrwNrYiSg1pdegl6HX8UQq3uX4vVEPoEwe7Siho9IlOkT7/Z2EDvnpSsiueoQU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=B286stF/; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="B286stF/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=og2bSSwssZ1c94h//NB6fpJ3eJXtiaaojxyZsUQVqJZwICgiFR9LHEPZmCyMo1MNGA5WNuQ4bAw/u+IvYNttoLcZpmj4ePiMpxLYY9bSqznR2q9sZohuaGCOWvtajGeHaoFcBEX7RdKLl/g4cTlQOx0IzsjxyGBra++Igq5a8ZfByScuzgY5LNu84XvOlirlvmGvinLvDadgNJwmtpq20wYv3eV8l9d7j5tAxhRg6K9PrVtNwODc+VcYOno6pNOp1j0Me7sIsozHtO+5mTZVLpVcB/04jNg1E6PXIXnDia+hu3x7rNUJ6OqXc2RpXqlN0ViLzOGZ1sV0PX3jSW3MHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JwtOVH5eehtjp/++jGhxfvvjytHVqR+38TKX8bsnJdc=; b=ouitVyBwRVhPEmp6io4tqUjQ+deGbowLEGgk1SCD01WbBwbVOLXA6Qz1xjjkT4C5FgM6frejqjDGRhD36aH8nM6yd5IcKInhmSolcttuDGu3hqakZCnOhR0OZHxgGdx9QvdXZz5orm5glbxcYZ7JwI3lOgebHQR4zfk6OUMlxCBpSc3Zehv1tREND/KnXpZTICujly3zmKcUkbVcW2IAqx75n5/x3rSVhbbkSpsWwWjI30lCon47z5LNm8NVYJMpOhaRwFmyPEjo3b69WQg6DXCDSfAE95iUDjiq+BXbZk21c99lqr4q0TWIJOVYP0kFl639yF6TrzS6B+hT4IYdvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JwtOVH5eehtjp/++jGhxfvvjytHVqR+38TKX8bsnJdc=; b=B286stF/ws8cidl74L9EFJb13D4dXLvFrtPcGr0qHhxxJWUXoy6kEzsaC69EBiJ4XwEBo5sWhHrczsCWAcTnfUlzS/gS3Kh+Cucy+3R2M1gYt8UqN5RK2+0DLHVBJ8NKalGRacSYPviPxzMXAAg2kJPrCgD64OD0tm3yNRSj9ioyvX7aO0+C21zmrmjxdb/ZRYC6+BOa2l/+cytjzK6wZ3fCrVtTbwjwzu6H6Qc6iKzpTrFknsoX0SsWJZl52Bc++LIDLqXyJkW4IWvrrt2JMO5FXrNrW4PiO9Vym3/KwqZgwyfvMA8G0weJdJdoCTaCbK+vfcvID0B16uaUvGHprg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:02:52 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:02:52 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 01/14] shared/bap: Allow multiple links per stream Date: Thu, 24 Oct 2024 14:02:10 +0300 Message-ID: <20241024110223.77254-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ac12da1-13a4-497e-bd39-08dcf41b67c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 4ZFhdFUbEhXPHurTj+YdszQN8PNCoYqNAS+gtQ7FFG1F7+/BIhIWMrcuX1suXOdK0n2ZJujni5q66nrolpcoPJLTSwn7FkU1QoY/Wl+rivyDJd27Q6BlMRuTucd00Xe275WS/30e9Pjd7FS4NbJ1I87WqwOKZ/F73dzCQ0F6NTw83fE1aSO3fP8YxPP8uUZA1cVB1IJvQWkSGJlSEL0INnEt+xMnECpjXaZ+Q4xVodEqQWFrxo0k+lQfejYwezgt0sXAlk2e21cBuuHfUy28PcZ8dn99ZnSS3+e3d1DfjhTmCJSD+NTF7IFF175A+jqZ+zFjwnQyLOiyujiEAtHt3Hk3qA2mJTO4AiQaW4sqjtbWlpZzj1A0DB8YS6PVJXApHEOXQYFrSOaxaLKMGX8W6FgxEw0qeLoXFNiqdltszlHy1uZZDjCIOG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:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jQcFkoutC4NOAU4+858RFj+wZodOa8FrhnZtFYAE1w+c2GHNhbDxIhszA4LI/PfTcRVO9xHuM2H6Ql3CR3qc+YHHsQ1yw8D3QkTCNsqWF3MJGOhIFWwmzrg4dzvOxvHtrH5zVWXdATHtgj5o+hOEZqk0crQ+ERu0Tnj0UphYqQK9mJWv3AKD8pI61I160jovcyk57ymGlvc8knZHxrv5AnZ4LD9NJyMeuxOtbV2gpv7LnHFPvnff+Xsj4/SgISNvW9GD4rWnrEBAPbu0I/ta3llx+ge39Cg+zuj4XOacMdx4O6V2sMxImC4t1ifgcl+QBBdgiJ0oZQIZiGUcwWgERV9GqvjHRl7ODtMc0nGTQjfkpOpaTqKdbl1MuPywmITXsgOe63FxYh3sCPZCSAVOYLXuBg5ZAlheWnGEa+qrlCY6dTY3ySMNJK2XefdE/p7ytq0UicHyijNozJSRQPul6D+TkMyk6ve4gCmumgwVwByE5Q8XZlBv6HdudAgcXTsqneswEaC4lNevpZrE22qVjI6vsyvYRB0hgjL+U7mBwqvEMXZvvBTi9/2lih9rmy99Io3yI+OiVbXM6bsup72C3Iin9EhKU8kcleZi9g2QKgGUPepHPv4Vmt9Mi4SBOfS4hZdQG9HhGmGknSomXLD6dpG3DNLhBiWzWQxAKgQDzyhM6P21rD3U8N3ogGHS5tVBlrWlTWEfZbaacuMafe9CAyPwWzE1oOA2QHaZEuejzflIiWnJ/iE5siDLSjBRCG9rWYjHxmSbfRafXUIiyKvIIgVslG34+UdDveigtvqrXJy1+Z24P70QO2quzzjP0k3q73TKorryF6bs4HxTsiWWdFgou9UZBrT9TYZR/txIFDxk3OYg9bJOaxdaxW+KPJMe3Na+4fYpEo/OS7ZvBPEsmvhrBq7hf4DcFyRWa/MwCVvHmZKb/58vf849J0+GvDAADxZBlzptG0El2CTQwayCK3XZhpM+vQN6v+LX9FLJcRnRWrvJx+Ou59AdI7C3fU4Fnkko5w/mohPOqtjzH62pZg/03BE2speC/R0PS4aMpOSpqEYE5eCmpYXi1zDGaLkD/ZZsuEQ+Ya/Am4N03QS+PsHDJdvGzewMYFQppHlIdv856HSYzcmwX0Rur6joDfX8L6Xp1P09Nne6rDLvL8EDh6dk4KsyTAX+nFNfcUVnge2mYMwEmcjxXOIJyOLeM5E1rOAy+6VQ8b8+7IRgp43/Ec3CSxGKVWD5w3xcTUrtH9XGxUHeqQTCpWk4o9pdeCMalhoR2bgSCnIj0MowFlwSQro8rwrYsW26cTHhvH3ipVPhehzDzfI3zVtsxT850XTpODybp3qYbANMDh0kiQhzVJ9RRYFfRlwvRWZpdZuWtfH1GYGRPQ8SpwgAC/ODhB+i38S13YOrZoP8O8/nR5tZZSbcAgqRO1cLMw9Sj5wzSWJGXBykaVTGykKjuA2MiH5AvCeyFdXHZauoqfGod4C0ECbD94MmEBMwQUwZ8NjQbkqSBnxVv1oWMKdk/5ZcdSokVcs4CYDpZssGsLTJMwJMlJ6yySSyjAZrPn+ZsPNWVYbjF0J824Z6K38Y1BOT7RBKqTm705p0SfDXhJVJT2/Mxw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ac12da1-13a4-497e-bd39-08dcf41b67c9 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:02:52.3868 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3c+QPECeKMpQbmaMKNv5DbGDIWMLw1pDry1T3qIcByliMelLTGk4lrkdmF/1Cclaf83zTJ8EtipQpF9YRQ8m0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 This commit adds support to link multiple streams together, creating the foundation for implementing broadcast links: for Broadcast Sinks, the user could select multiple streams to receive audio from. All selected streams need to be linked together and considered when creating BIG sync. --- profiles/audio/transport.c | 38 ++++++-------- src/shared/bap.c | 104 +++++++++++++++++++++++++++++-------- src/shared/bap.h | 2 +- 3 files changed, 97 insertions(+), 47 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 68192bae6..d71013077 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -330,12 +330,9 @@ static void transport_bap_remove_owner(struct media_transport *transport, { struct bap_transport *bap = transport->data; - if (bap && bap->linked) { - struct bt_bap_stream *link; - - link = bt_bap_stream_io_get_link(bap->stream); - linked_transport_remove_owner(link, owner); - } + if (bap && bap->linked) + queue_foreach(bt_bap_stream_io_get_links(bap->stream), + linked_transport_remove_owner, owner); } static void media_transport_remove_owner(struct media_transport *transport) @@ -581,12 +578,9 @@ static void transport_bap_set_owner(struct media_transport *transport, { struct bap_transport *bap = transport->data; - if (bap && bap->linked) { - struct bt_bap_stream *link; - - link = bt_bap_stream_io_get_link(bap->stream); - linked_transport_set_owner(link, owner); - } + if (bap && bap->linked) + queue_foreach(bt_bap_stream_io_get_links(bap->stream), + linked_transport_set_owner, owner); } static void media_transport_set_owner(struct media_transport *transport, @@ -1129,14 +1123,14 @@ static gboolean get_links(const GDBusPropertyTable *property, { struct media_transport *transport = data; struct bap_transport *bap = transport->data; - struct bt_bap_stream *link = bt_bap_stream_io_get_link(bap->stream); + struct queue *links = bt_bap_stream_io_get_links(bap->stream); DBusMessageIter array; dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH_AS_STRING, &array); - append_link(link, &array); + queue_foreach(links, append_link, &array); dbus_message_iter_close_container(iter, &array); @@ -1572,15 +1566,15 @@ static bool match_link_transport(const void *data, const void *user_data) static void bap_update_links(const struct media_transport *transport) { struct bap_transport *bap = transport->data; - struct bt_bap_stream *link = bt_bap_stream_io_get_link(bap->stream); + struct queue *links = bt_bap_stream_io_get_links(bap->stream); - if (bap->linked == (!!link)) + if (bap->linked == !queue_isempty(links)) return; - bap->linked = link ? true : false; + bap->linked = !queue_isempty(links); /* Check if the links transport has been create yet */ - if (bap->linked && !match_link_transport(link, NULL)) { + if (bap->linked && !queue_find(links, match_link_transport, NULL)) { bap->linked = false; return; } @@ -1757,15 +1751,13 @@ static void transport_bap_set_state(struct media_transport *transport, transport_state_t state) { struct bap_transport *bap = transport->data; - struct bt_bap_stream *link; if (!bap->linked) return; - link = bt_bap_stream_io_get_link(bap->stream); - - /* Update link */ - link_set_state(link, UINT_TO_PTR(state)); + /* Update links */ + queue_foreach(bt_bap_stream_io_get_links(bap->stream), link_set_state, + UINT_TO_PTR(state)); } static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, diff --git a/src/shared/bap.c b/src/shared/bap.c index 00c3b9ff6..1b70df4d5 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -262,7 +262,7 @@ struct bt_bap_stream { struct iovec *cc; struct iovec *meta; struct bt_bap_qos qos; - struct bt_bap_stream *link; + struct queue *links; struct bt_bap_stream_io *io; const struct bt_bap_stream_ops *ops; uint8_t old_state; @@ -1101,6 +1101,14 @@ static void stream_io_unref(struct bt_bap_stream_io *io) stream_io_free(io); } +static void bap_stream_unlink(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct bt_bap_stream *link = user_data; + + queue_remove(stream->links, link); +} + static void bap_stream_free(void *data) { struct bt_bap_stream *stream = data; @@ -1110,8 +1118,8 @@ static void bap_stream_free(void *data) if (stream->ep) stream->ep->stream = NULL; - if (stream->link) - stream->link->link = NULL; + queue_foreach(stream->links, bap_stream_unlink, stream); + queue_destroy(stream->links, NULL); stream_io_unref(stream->io); util_iov_free(stream->cc, 1); @@ -1246,6 +1254,17 @@ static void bap_stream_update_io_links(struct bt_bap_stream *stream) queue_find(bap->streams, bap_stream_io_link, stream); } +static bool match_stream_io(const void *data, const void *user_data) +{ + const struct bt_bap_stream *stream = data; + const struct bt_bap_stream_io *io = user_data; + + if (!stream->io) + return false; + + return stream->io == io; +} + static bool bap_stream_io_detach(struct bt_bap_stream *stream) { struct bt_bap_stream *link; @@ -1259,7 +1278,7 @@ static bool bap_stream_io_detach(struct bt_bap_stream *stream) io = stream->io; stream->io = NULL; - link = stream->link; + link = queue_find(stream->links, match_stream_io, io); if (link) { /* Detach link if in QoS state */ if (link->ep->state == BT_ASCS_ASE_STATE_QOS) @@ -1803,6 +1822,14 @@ static unsigned int bap_bcast_config(struct bt_bap_stream *stream, return 1; } +static void bap_stream_enable_link(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct iovec *metadata = user_data; + + bap_stream_metadata(stream, BT_ASCS_ENABLE, metadata, NULL, NULL); +} + static unsigned int bap_ucast_enable(struct bt_bap_stream *stream, bool enable_links, struct iovec *data, bt_bap_stream_func_t func, @@ -1821,9 +1848,7 @@ static unsigned int bap_ucast_enable(struct bt_bap_stream *stream, if (!ret || !enable_links) return ret; - if (stream->link) - bap_stream_metadata(stream->link, BT_ASCS_ENABLE, data, - NULL, NULL); + queue_foreach(stream->links, bap_stream_enable_link, data); return ret; } @@ -1872,6 +1897,13 @@ static unsigned int bap_ucast_start(struct bt_bap_stream *stream, return req->id; } +static void bap_stream_disable_link(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + + bt_bap_stream_disable(stream, false, NULL, NULL); +} + static unsigned int bap_ucast_disable(struct bt_bap_stream *stream, bool disable_links, bt_bap_stream_func_t func, @@ -1895,7 +1927,7 @@ static unsigned int bap_ucast_disable(struct bt_bap_stream *stream, } if (disable_links) - bt_bap_stream_disable(stream->link, false, NULL, NULL); + queue_foreach(stream->links, bap_stream_disable_link, NULL); return req->id; } @@ -2327,18 +2359,30 @@ static struct bt_bap_stream_io *stream_io_new(struct bt_bap *bap, int fd) return stream_io_ref(sio); } +static void stream_find_io(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct bt_bap_stream_io **io = user_data; + + if (*io) + return; + + *io = stream->io; +} + static struct bt_bap_stream_io *stream_get_io(struct bt_bap_stream *stream) { + struct bt_bap_stream_io *io = NULL; + if (!stream) return NULL; if (stream->io) return stream->io; - if (stream->link) - return stream->link->io; + queue_foreach(stream->links, stream_find_io, &io); - return NULL; + return io; } static bool stream_io_disconnected(struct io *io, void *user_data); @@ -5846,8 +5890,7 @@ bool bt_bap_stream_set_io(struct bt_bap_stream *stream, int fd) bap_stream_set_io(stream, INT_TO_PTR(fd)); - if (stream->link) - bap_stream_set_io(stream->link, INT_TO_PTR(fd)); + queue_foreach(stream->links, bap_stream_set_io, INT_TO_PTR(fd)); return true; } @@ -5902,7 +5945,8 @@ int bt_bap_stream_io_link(struct bt_bap_stream *stream, bap = stream->bap; - if (stream->link || link->link) + if (queue_find(stream->links, NULL, link) || + queue_find(link->links, NULL, stream)) return -EALREADY; if (stream->client != link->client || @@ -5911,8 +5955,14 @@ int bt_bap_stream_io_link(struct bt_bap_stream *stream, stream->ep->dir == link->ep->dir) return -EINVAL; - stream->link = link; - link->link = stream; + if (!stream->links) + stream->links = queue_new(); + + if (!link->links) + link->links = queue_new(); + + queue_push_tail(stream->links, link); + queue_push_tail(link->links, stream); /* Link IOs if already set on stream/link */ if (stream->io && !link->io) @@ -5925,12 +5975,12 @@ int bt_bap_stream_io_link(struct bt_bap_stream *stream, return 0; } -struct bt_bap_stream *bt_bap_stream_io_get_link(struct bt_bap_stream *stream) +struct queue *bt_bap_stream_io_get_links(struct bt_bap_stream *stream) { if (!stream) return NULL; - return stream->link; + return stream->links; } static void bap_stream_get_in_qos(void *data, void *user_data) @@ -5973,11 +6023,11 @@ bool bt_bap_stream_io_get_qos(struct bt_bap_stream *stream, switch (stream->ep->dir) { case BT_BAP_SOURCE: bap_stream_get_in_qos(stream, in); - bap_stream_get_out_qos(stream->link, out); + queue_foreach(stream->links, bap_stream_get_out_qos, out); break; case BT_BAP_SINK: bap_stream_get_out_qos(stream, out); - bap_stream_get_in_qos(stream->link, in); + queue_foreach(stream->links, bap_stream_get_in_qos, in); break; default: return false; @@ -5988,6 +6038,14 @@ bool bt_bap_stream_io_get_qos(struct bt_bap_stream *stream, return in && out; } +static void bap_stream_get_dir(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + uint8_t *dir = user_data; + + *dir |= stream->ep->dir; +} + uint8_t bt_bap_stream_io_dir(struct bt_bap_stream *stream) { uint8_t dir; @@ -6007,8 +6065,7 @@ uint8_t bt_bap_stream_io_dir(struct bt_bap_stream *stream) } - if (stream->link) - dir |= stream->link->ep->dir; + queue_foreach(stream->links, bap_stream_get_dir, &dir); return dir; } @@ -6043,7 +6100,8 @@ int bt_bap_stream_io_connecting(struct bt_bap_stream *stream, int fd) return -EINVAL; bap_stream_io_connecting(stream, INT_TO_PTR(fd)); - bap_stream_io_connecting(stream->link, INT_TO_PTR(fd)); + + queue_foreach(stream->links, bap_stream_io_connecting, INT_TO_PTR(fd)); return 0; } diff --git a/src/shared/bap.h b/src/shared/bap.h index bf928bc2d..cd5ea2eba 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -231,7 +231,7 @@ int bt_bap_stream_cancel(struct bt_bap_stream *stream, unsigned int id); int bt_bap_stream_io_link(struct bt_bap_stream *stream, struct bt_bap_stream *link); -struct bt_bap_stream *bt_bap_stream_io_get_link(struct bt_bap_stream *stream); +struct queue *bt_bap_stream_io_get_links(struct bt_bap_stream *stream); bool bt_bap_stream_io_get_qos(struct bt_bap_stream *stream, struct bt_bap_qos **in, struct bt_bap_qos **out); From patchwork Thu Oct 24 11:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848777 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E82B91C879E for ; Thu, 24 Oct 2024 11:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767783; cv=fail; b=RyOd08vpNr5k85eYcLShLVJekC6wn7ZGjKonWDM4Ovg8fWpj6nWlQ1CkWix3cdOSYzC9El6ndfweXTOlaIaxERXZgHkP3b9OgIYVdHfzVF7UxmHzpaKTXSkZtIfkSe2qio6njCkENwKZf3DNEir21fUsxw4UnJBnawBeklPZr1Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767783; c=relaxed/simple; bh=ucefT6OfmipidtrcCAGm5IVbEdm5IZbQNQOOVJ5jnR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Te2QSPksE1unBpiDwWDkEOZPjNub21vtetGvK8nQDRgKNLcBZWZ9OAdLOQifP7cTm24bY6HU1hJGlEIZ0PhU3XqHvLKCeIVGdVn+ZVtf8StJm2cC+enThpVhNHcjlAtEs7YolNGU/cxKtHxhmH9ZAd7fZElFkUwsThzKxq8+H+E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=k2croH/g; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="k2croH/g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J2Yv7lUTNCAjDD0r4JhzmF8/nl4R2/UXoJvfpLtP11hvEyH1ClcOY6irpQGBuyZEQEWxuOqsbJV4zX2jwcuyV1cCNEPpURayIoS5x6zgkLRMQdBBT7x6OETtaGHc44wMOf+5edE4F8fH49yFZvEufYSMJmYgSPeCQcecqEoe64LP5Bu/3qIgSaGsFRIHVBunZjenzd2QE7TZxjnr01sph55AtP8oDwE+qZ7IGHoj2SnWSfJe6a8U2jHdcGkU9qzVpd3Hr+n0KBQnnSgnubhUoQS2bLlLB9gA2DmWOwo3SPVa+5qT032es3/2qMp84qy2xJeGYR/FO/asRuNDwE2tCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GGv+Jqne9+oFo07LZMbU2TJ4o4hsoXrrxD4gv2nRhI8=; b=CKgeSYSn0AXc+y0jNbescu5xnDrDHj5zNq2r/046ywzXs2ruKuxiuND9gMDiruyLUCjjr094nfZWlBew0fRJrkxu18svRE0eEwYPQfDqRJnu1qmv8+0W/gqt5Z98CDOmlQ+Gi5zrndh9cBo/DwNkd9bTKAzzzVMzDu1duKmzyBss57/sfAQf6YdJv9GRddL6AOIGZtSd/WrdogPGRG8pf3Trd0M+eKd6reSkPRMjRiL/ziUtP7cwSu2ra6zw9C5O/77aTePB57nxituY0Lw0C1ozt0j1ILdLK5fbv6aJYk7agUYmGHdQoKQfu93SZPmoUwkH/gOe73wFerxjX/8F4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GGv+Jqne9+oFo07LZMbU2TJ4o4hsoXrrxD4gv2nRhI8=; b=k2croH/gnqtG83oSVcqzU75XCKlXIeqleXOCKSSHi2+7Ohe6vFhlk1Fnc3DBKNuWACl556Ase+WKKwLFfuA/gpmmd21/WNKov9frWyXp7WpFMiIu6sc2sS/CLR47ppoFLcMmDboiJHadAebILMGC3WpVnQWoPu3tBvzRIWr6j26AmiIbNqEStb62t/awM4dhVf96MU3PhCwmeaHvrhVnLAlwK7nskdozxBhgP8ycke2gF9Ylg86uLw70ugx1yN4gPiqVV8Lzr7uh1WH+1qULhoaN9xeNrxLk0YyYhpxc418zkqUP+GUBU2QNQoExXSBpzuqebmaFDpralfoDeEeUgg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:02:54 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:02:54 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 02/14] shared/bap: Add support for handling broadcast links Date: Thu, 24 Oct 2024 14:02:11 +0300 Message-ID: <20241024110223.77254-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: 602b95a3-ceeb-4b81-55b3-08dcf41b6907 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: reej14q6oI23S+gSXFKoIXwr/wlwgPPRG5php9qPJ147SMizrtVcFuypiOGkcpaDTSGy3v1d1XxZLLuFc73oBQ/24heaALsHZu6220y3eMRUQgc/ThyhOhC2fi+6Sz38PxagCsbq5lfJbKOQwcNP6BZQsrslBdwh59KUyCQVMiqx343TFlmj4WWLKwatBrlcOlRbfs99o8g+owrkqa6xEReHLugJ43ukON2JRucBhsAveGhmxRhsnrO08sIRfZ53k8BRB5a3XByJbCfA2PbMXn42ICkE+sWpvwkT/e+hhkxgxkIurfJNC9xto57UUqumS48/AodLuIccrAN5+39jW3kDk0N28PoCxe+THhpmJJN+N8KthcA1lW1WYNYKvH8eWsNzqbt4X3A8jsQmcidCwSIOY7Zh0ojrarj3FIeXyo27zm0XQjpoHi0SVxCpal4E5zQ0KUPq7FnCVIGgX3IaG5B9lhRH2X1gPqMdGXaF8xysYEl6aD0QD0j3J2IgFYKADXACRb+U8YdLH1zWclPj0iVr2FKrwO5LdrNzJl5g8EmtPjpAYiI3elLUw4hGeUjcjl801Hn4mV+uPpvqeubND2mXz6dVJVQ0wKBiOVKx0IIcoQ7UKo41NfHgkBfRqDgOCZc9YH4/V/7zHYaKddHDxY1cR6qiy6//AkS17vGAGem2OnH1q5pmrD6KthJg0A9bH+FpBDxDi2noj35CBaBGHbtUaJ4ELQEagwmMkkhPE+4hNPcWmEszFEgfuClS+/qfrWh7Xc0S9NvqlgRqWaVbe2qdsA7cTOGrt5vayKfaKcv1ozYES4Gg8scaPmK+OFvsNP3wA+SxWf2+M3i+/ZRpg59KbiTz0DrrHo1hSJ8IvTeHBRrzeuzC7ZY1qTXc1TehQzSG1fMlbdCoxYIZ9sgdPCjHANXGPL7pRqjlYkLynUmPXlij5J6c3ZzD90p5sOc3XwRbX4OhnAt2TlIY6QbWJZctur1P6VuSb1bhKMr4QKUjxkQ/ZtYkPVY+Aar6sJEsaXLQB2h1B9Onmp3DJ6RnN6UyVxBQMHSgy0eXWDrwoIhyGgfIX177g3qJL3fFKFFdwbFQdoECuZb9p9dQ1s8N15t36bbNIrSIf2lHfBNGPkDEHaNYp76sIVgpDsswXilHEZ70epfWAn4//XMWLoVLXBcFc8KQCHsawpS9UrKTFNIdKVwYCezlnRvYMsxBkuqbkaYw/p5SZGFY2c209bOEFTbrQ7WUTwIRUJV8QTL/PMWAJJM/9g91ahsnf6CDFjihSz6gYFjGQhpFPq64WWC+/8B5/MESFR5TJb5u096093/NJOMw+6YPGhAAr2P/OJNZHjWJ/JP6WZjWDRZf04yIiVU3vGr0sznZ2zAReSX1kfk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1LBUjcIAxbBHlGec0QYe4OvZiWf9VbF2k4LsDW/gGh07RbX82TPVk37IlYKVVPsvM4mfNOspb15+rWSw9IbkThVQ8nHMpBcvSMd6oWcabwemUBI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A5cFN/v5ScuRTuHHctti7fl4ng9ZnCKIj1QBROZiEqQQ/Fz8viSY04xV8dEhoD9MuZ81OJRJsYrzK0xs4MV20HWvpC3GTmZmeKg78ElNuALpc2rGRIUhurtxBgYDYXrY1jnFssLGAFwllifNNztCDKP2CTCSWFyKJJlX23GigS1ZYX3OI84FX54EHEvgBr4FYHsTC2GEoSxWDTUEiy7jwpiFq9M2YxPf1ZGg8y7x4Zhg332XR13aIHahSUtFjvi27TcRuZ+AxJ7M9kB1mVjygzu2F9rqnrpa71MJnpWCsrKdV2mFWR1Q0RAPxPWWjLaR6Y9kYWyhhjgpHRAg+30iNEOglBlxKJXQBo5urfchujb49rFyKA90EEel+5tGD+Dmc2B66XihU8WbyV0nsh+N4pYYjKErnVdLJD8OrJ50tT69vPKUPu9CWpIlqpovcTBZmIw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 602b95a3-ceeb-4b81-55b3-08dcf41b6907 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:02:54.5767 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eSTLMQp/6JNRQv1X0Xz4oYuxRFwBeqM2CM7OZaoSF3Uk/7IVRWx93/l/pDIyzic6cCYr7SLqnsk7oIWM4TTnyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 This commit implements io handling functions as stream ops, since broadcast links need to be handled differently than unicast: Unicast links share the same IO, while broadcast links stand for separate BISes with independent IOs. Unicast links have different directions, while broadcast links share the same one. This also adds a function for unlinking broadcast streams. --- src/shared/bap.c | 336 ++++++++++++++++++++++++++++++++++++++++------- src/shared/bap.h | 2 + 2 files changed, 291 insertions(+), 47 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 1b70df4d5..ddf8ab84d 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -252,6 +252,13 @@ struct bt_bap_stream_ops { unsigned int (*release)(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data); void (*detach)(struct bt_bap_stream *stream); + bool (*set_io)(struct bt_bap_stream *stream, int fd); + struct bt_bap_stream_io* (*get_io)(struct bt_bap_stream *stream); + uint8_t (*io_dir)(struct bt_bap_stream *stream); + int (*io_link)(struct bt_bap_stream *stream, + struct bt_bap_stream *link); + int (*io_unlink)(struct bt_bap_stream *stream, + struct bt_bap_stream *link); }; struct bt_bap_stream { @@ -324,6 +331,13 @@ static struct queue *bap_db; static struct queue *bap_cbs; static struct queue *sessions; +static void bap_stream_set_io(void *data, void *user_data); +static void stream_find_io(void *data, void *user_data); +static void bap_stream_get_dir(void *data, void *user_data); +static struct bt_bap_stream_io *stream_io_ref(struct bt_bap_stream_io *io); +static int bap_bcast_io_unlink(struct bt_bap_stream *stream, + struct bt_bap_stream *link); + static bool bap_db_match(const void *data, const void *match_data) { const struct bt_bap_db *bdb = data; @@ -2238,9 +2252,194 @@ static unsigned int bap_bcast_release(struct bt_bap_stream *stream, return 1; } +static bool bap_ucast_set_io(struct bt_bap_stream *stream, int fd) +{ + if (!stream || (fd >= 0 && stream->io && !stream->io->connecting)) + return false; + + bap_stream_set_io(stream, INT_TO_PTR(fd)); + + queue_foreach(stream->links, bap_stream_set_io, INT_TO_PTR(fd)); + + return true; +} + +static bool bap_bcast_set_io(struct bt_bap_stream *stream, int fd) +{ + if (!stream || (fd >= 0 && stream->io && !stream->io->connecting)) + return false; + + bap_stream_set_io(stream, INT_TO_PTR(fd)); + + return true; +} + +static struct bt_bap_stream_io *bap_ucast_get_io(struct bt_bap_stream *stream) +{ + struct bt_bap_stream_io *io = NULL; + + if (!stream) + return NULL; + + if (stream->io) + return stream->io; + + queue_foreach(stream->links, stream_find_io, &io); + + return io; +} + +static struct bt_bap_stream_io *bap_bcast_get_io(struct bt_bap_stream *stream) +{ + if (!stream) + return NULL; + + return stream->io; +} + +static uint8_t bap_ucast_io_dir(struct bt_bap_stream *stream) +{ + uint8_t dir; + + if (!stream) + return 0x00; + + dir = stream->ep->dir; + + queue_foreach(stream->links, bap_stream_get_dir, &dir); + + return dir; +} + +static uint8_t bap_bcast_io_dir(struct bt_bap_stream *stream) +{ + uint8_t dir; + uint8_t pac_type = bt_bap_pac_get_type(stream->lpac); + + if (!stream) + return 0x00; + + if (pac_type == BT_BAP_BCAST_SINK) + dir = BT_BAP_BCAST_SOURCE; + else + dir = BT_BAP_BCAST_SINK; + + return dir; +} + +static int bap_ucast_io_link(struct bt_bap_stream *stream, + struct bt_bap_stream *link) +{ + struct bt_bap *bap; + + if (!stream || !link || stream == link) + return -EINVAL; + + bap = stream->bap; + + if (queue_find(stream->links, NULL, link) || + queue_find(link->links, NULL, stream)) + return -EALREADY; + + if (stream->client != link->client || + stream->qos.ucast.cig_id != link->qos.ucast.cig_id || + stream->qos.ucast.cis_id != link->qos.ucast.cis_id || + stream->ep->dir == link->ep->dir) + return -EINVAL; + + if (!stream->links) + stream->links = queue_new(); + + if (!link->links) + link->links = queue_new(); + + queue_push_tail(stream->links, link); + queue_push_tail(link->links, stream); + + /* Link IOs if already set on stream/link */ + if (stream->io && !link->io) + link->io = stream_io_ref(stream->io); + else if (link->io && !stream->io) + stream->io = stream_io_ref(link->io); + + DBG(bap, "stream %p link %p", stream, link); + + return 0; +} + +static void stream_link(void *data, void *user_data) +{ + struct bt_bap_stream *stream = (void *)data; + struct bt_bap_stream *link = (void *)user_data; + + bt_bap_stream_io_link(stream, link); +} + +static int bap_bcast_io_link(struct bt_bap_stream *stream, + struct bt_bap_stream *link) +{ + struct bt_bap *bap; + + if (!stream || !link || stream == link) + return -EINVAL; + + bap = stream->bap; + + if (queue_find(stream->links, NULL, link) || + queue_find(link->links, NULL, stream)) + return -EALREADY; + + if (!stream->links) + stream->links = queue_new(); + + if (!link->links) + link->links = queue_new(); + + queue_push_tail(stream->links, link); + queue_push_tail(link->links, stream); + + DBG(bap, "stream %p link %p", stream, link); + + queue_foreach(stream->links, stream_link, link); + + return 0; +} + +static void stream_unlink(void *data, void *user_data) +{ + struct bt_bap_stream *stream = (void *)data; + struct bt_bap_stream *link = (void *)user_data; + + bap_bcast_io_unlink(stream, link); +} + +static int bap_bcast_io_unlink(struct bt_bap_stream *stream, + struct bt_bap_stream *link) +{ + struct bt_bap *bap; + + if (!stream || !link || stream == link) + return -EINVAL; + + bap = stream->bap; + + if (!queue_find(stream->links, NULL, link) || + !queue_find(link->links, NULL, stream)) + return -EALREADY; + + queue_remove(stream->links, link); + queue_remove(link->links, stream); + + DBG(bap, "stream %p unlink %p", stream, link); + + queue_foreach(stream->links, stream_unlink, link); + + return 0; +} + #define STREAM_OPS(_type, _set_state, _get_state, _config, _qos, _enable, \ _start, _disable, _stop, _metadata, _get_dir, _get_loc, _release, \ - _detach) \ + _detach, _set_io, _get_io, _io_dir, _io_link, _io_unlink) \ { \ .type = _type, \ .set_state = _set_state, \ @@ -2256,6 +2455,11 @@ static unsigned int bap_bcast_release(struct bt_bap_stream *stream, .get_loc = _get_loc, \ .release = _release, \ .detach = _detach, \ + .set_io = _set_io, \ + .get_io = _get_io, \ + .io_dir = _io_dir, \ + .io_link = _io_link, \ + .io_unlink = _io_unlink, \ } static const struct bt_bap_stream_ops stream_ops[] = { @@ -2265,28 +2469,40 @@ static const struct bt_bap_stream_ops stream_ops[] = { bap_ucast_start, bap_ucast_disable, bap_ucast_stop, bap_ucast_metadata, bap_ucast_get_dir, bap_ucast_get_location, - bap_ucast_release, bap_ucast_detach), + bap_ucast_release, bap_ucast_detach, + bap_ucast_set_io, bap_ucast_get_io, + bap_ucast_io_dir, bap_ucast_io_link, + NULL), STREAM_OPS(BT_BAP_SOURCE, bap_ucast_set_state, bap_ucast_get_state, bap_ucast_config, bap_ucast_qos, bap_ucast_enable, bap_ucast_start, bap_ucast_disable, bap_ucast_stop, bap_ucast_metadata, bap_ucast_get_dir, bap_ucast_get_location, - bap_ucast_release, bap_ucast_detach), + bap_ucast_release, bap_ucast_detach, + bap_ucast_set_io, bap_ucast_get_io, + bap_ucast_io_dir, bap_ucast_io_link, + NULL), STREAM_OPS(BT_BAP_BCAST_SINK, bap_bcast_set_state, bap_bcast_get_state, bap_bcast_config, bap_bcast_qos, bap_bcast_sink_enable, bap_bcast_start, bap_bcast_disable, NULL, bap_bcast_metadata, bap_bcast_sink_get_dir, bap_bcast_get_location, - bap_bcast_release, bap_bcast_sink_detach), + bap_bcast_release, bap_bcast_sink_detach, + bap_bcast_set_io, bap_bcast_get_io, + bap_bcast_io_dir, bap_bcast_io_link, + bap_bcast_io_unlink), STREAM_OPS(BT_BAP_BCAST_SOURCE, bap_bcast_set_state, bap_bcast_get_state, bap_bcast_config, bap_bcast_qos, bap_bcast_src_enable, bap_bcast_start, bap_bcast_disable, NULL, bap_bcast_metadata, bap_bcast_src_get_dir, bap_bcast_get_location, - bap_bcast_release, bap_bcast_src_detach), + bap_bcast_release, bap_bcast_src_detach, + bap_bcast_set_io, bap_bcast_get_io, + bap_bcast_io_dir, bap_bcast_io_link, + bap_bcast_io_unlink), }; static const struct bt_bap_stream_ops * @@ -2372,15 +2588,23 @@ static void stream_find_io(void *data, void *user_data) static struct bt_bap_stream_io *stream_get_io(struct bt_bap_stream *stream) { - struct bt_bap_stream_io *io = NULL; + struct bt_bap_stream_io *io; + struct bt_bap *bap; - if (!stream) + if (!bap_stream_valid(stream)) return NULL; - if (stream->io) - return stream->io; + if (!stream->ops || !stream->ops->get_io) + return NULL; - queue_foreach(stream->links, stream_find_io, &io); + if (!bt_bap_ref_safe(stream->bap)) + return NULL; + + bap = stream->bap; + + io = stream->ops->get_io(stream); + + bt_bap_unref(bap); return io; } @@ -5885,14 +6109,25 @@ static bool stream_io_disconnected(struct io *io, void *user_data) bool bt_bap_stream_set_io(struct bt_bap_stream *stream, int fd) { - if (!stream || (fd >= 0 && stream->io && !stream->io->connecting)) + bool ret; + struct bt_bap *bap; + + if (!bap_stream_valid(stream)) return false; - bap_stream_set_io(stream, INT_TO_PTR(fd)); + if (!stream->ops || !stream->ops->set_io) + return false; - queue_foreach(stream->links, bap_stream_set_io, INT_TO_PTR(fd)); + if (!bt_bap_ref_safe(stream->bap)) + return false; - return true; + bap = stream->bap; + + ret = stream->ops->set_io(stream, fd); + + bt_bap_unref(bap); + + return ret; } static bool match_req_id(const void *data, const void *match_data) @@ -5938,41 +6173,49 @@ int bt_bap_stream_cancel(struct bt_bap_stream *stream, unsigned int id) int bt_bap_stream_io_link(struct bt_bap_stream *stream, struct bt_bap_stream *link) { + int ret; struct bt_bap *bap; - if (!stream || !link || stream == link) + if (!bap_stream_valid(stream)) + return -EINVAL; + + if (!stream->ops || !stream->ops->io_link) + return -EINVAL; + + if (!bt_bap_ref_safe(stream->bap)) return -EINVAL; bap = stream->bap; - if (queue_find(stream->links, NULL, link) || - queue_find(link->links, NULL, stream)) - return -EALREADY; + ret = stream->ops->io_link(stream, link); - if (stream->client != link->client || - stream->qos.ucast.cig_id != link->qos.ucast.cig_id || - stream->qos.ucast.cis_id != link->qos.ucast.cis_id || - stream->ep->dir == link->ep->dir) + bt_bap_unref(bap); + + return ret; +} + +int bt_bap_stream_io_unlink(struct bt_bap_stream *stream, + struct bt_bap_stream *link) +{ + int ret; + struct bt_bap *bap; + + if (!bap_stream_valid(stream)) return -EINVAL; - if (!stream->links) - stream->links = queue_new(); + if (!stream->ops || !stream->ops->io_unlink) + return -EINVAL; - if (!link->links) - link->links = queue_new(); + if (!bt_bap_ref_safe(stream->bap)) + return -EINVAL; - queue_push_tail(stream->links, link); - queue_push_tail(link->links, stream); + bap = stream->bap; - /* Link IOs if already set on stream/link */ - if (stream->io && !link->io) - link->io = stream_io_ref(stream->io); - else if (link->io && !stream->io) - stream->io = stream_io_ref(link->io); + ret = stream->ops->io_unlink(stream, link); - DBG(bap, "stream %p link %p", stream, link); + bt_bap_unref(bap); - return 0; + return ret; } struct queue *bt_bap_stream_io_get_links(struct bt_bap_stream *stream) @@ -6049,23 +6292,22 @@ static void bap_stream_get_dir(void *data, void *user_data) uint8_t bt_bap_stream_io_dir(struct bt_bap_stream *stream) { uint8_t dir; + struct bt_bap *bap; - if (!stream) - return 0x00; + if (!bap_stream_valid(stream)) + return 0; - if (stream->ep) - dir = stream->ep->dir; - else { - uint8_t pac_type = bt_bap_pac_get_type(stream->lpac); + if (!stream->ops || !stream->ops->set_io) + return 0; - if (pac_type == BT_BAP_BCAST_SINK) - dir = BT_BAP_BCAST_SOURCE; - else - dir = BT_BAP_BCAST_SINK; + if (!bt_bap_ref_safe(stream->bap)) + return 00; - } + bap = stream->bap; - queue_foreach(stream->links, bap_stream_get_dir, &dir); + dir = stream->ops->io_dir(stream); + + bt_bap_unref(bap); return dir; } diff --git a/src/shared/bap.h b/src/shared/bap.h index cd5ea2eba..126348e81 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -231,6 +231,8 @@ int bt_bap_stream_cancel(struct bt_bap_stream *stream, unsigned int id); int bt_bap_stream_io_link(struct bt_bap_stream *stream, struct bt_bap_stream *link); +int bt_bap_stream_io_unlink(struct bt_bap_stream *stream, + struct bt_bap_stream *link); struct queue *bt_bap_stream_io_get_links(struct bt_bap_stream *stream); bool bt_bap_stream_io_get_qos(struct bt_bap_stream *stream, struct bt_bap_qos **in, From patchwork Thu Oct 24 11:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848778 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C04F1C9B68 for ; Thu, 24 Oct 2024 11:03:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767786; cv=fail; b=X7AU/guhO2DuWiyoIvpXDw90asH3gp4NXrdz+MWjQFvw/FrMtkHTgVVC9RCbEVjGavhvUAdSL63nZVUBWcoGtOZ4o5BTjiPJWcvDwAGyU6+uZs6E+hkr/VHMk7TU/EKms2T0J0/x6YeiKiT6QsZ2/HcsbZBPVolkiEZJHy7wRGM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767786; c=relaxed/simple; bh=+YJ4lQkKR64sWBWXE1mQtWFPDnweSL6VRli84jxYYls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=tYDZoBXHzqPHfCuzVpc2WAoHVIe8no0Oihz4TSMkU2gaA0l6c+GOTRl5KqGI/d7SSWAjD8n+OMb9B8iRtvhMoxp3LHFT/NnBBNdzS7d/612Kk8d0jmPtitKTFe1Q/yMP7ZtuJKInvMccVsEXD/jAL1K4YQLHEskCoJ6mhAEz4Xc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Ru7FmxWd; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Ru7FmxWd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bT6bWQTWA9TY88oThZ1owW6sjBHFhN+IWJQBurm+voNFU2XNVc/EDhmvxFoA51DDcfiDLzSDxFOhb6H3FTvsk9cJDBlQAbiiAsmaEr+RjbS2W5p9/7SSk3BL7yLJGwF27EM/C5ODWM615BSlN7GPi+72C+XheImuDoULiUBRc3Yy4Adj2XqmKYG1xjz0kWmGHHKDfwKzYMbyQ5TC8eHEkxbUXp3upm5EH9Iq3698EYPdDLkdX3m9/jJN5LBXNMFvqAwvQl17qJN7XMHUwdDnMDjG4mq9/Jdx5vzua/tE8w+YlBhvKm+qCCc/d4uIijVV78onzahxQc4zbaadx478Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CeQS4U5MDyh0ZG/10HnEvqs8K/O7Tkj+eucr6oAqRIw=; b=y7BNI37FzXQyQc9rtMad8FVOqzBXStthzKxR4o/wehFYT10VCfwGZ0+c3QK2JxVfs/XE86g7WCXkcRzouJanAowFgMy5uobQTE+Awi4TEGEtqPqD3+F68GDjjkTyMJx7k+18+95w/M+TgPANQ1wXD05maAEcC12wkacIixdNkAlUDtfB7/tDjf0BmGzFQRKVC+EfufbqjBVPvKcPRb/F81cwiCixddwrsX3aNDSNvPf5PacHNYyE40ONhQfNF8Sy72qqUlZrf39tPUCRW0GFF4Q27pl1d96gGSo5au/pTeNEvZVs6MphYfivooXJwT6P8CNPEzqiiWbkbK2snsL7EQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CeQS4U5MDyh0ZG/10HnEvqs8K/O7Tkj+eucr6oAqRIw=; b=Ru7FmxWdBtoo3rNR5ObnAYjuhdleYGfxAplzA3WjmlyvaezHKSU0TrxcanT+8mZltWBudDNVziMaWeVlcDCcQ3wbL+U0SIBwOOWKC5F/4qF2MTzPW0ExUOMVncHLqEw1NMrosaXjM4Rb+OsQehqW92H1qF3hjYulo55NGGYW5/5v76vuMKb8ax2uZIupGgdA13won8cHeFDb7uDQ5PeFw+fPbCDePiEKLNZMyzL395kAwXF6Ki5+SYV3MOrVzyeDd4lmsD4DpA0H0P+4OD/gZIylytmJ3FTAlnP/SwIe+omWpneHKxGC944I0R2IRoeeVN89qaTLXqg1jSe6SyJ85A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:02:56 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:02:56 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 03/14] shared/bap: Fix broadcast set state Date: Thu, 24 Oct 2024 14:02:12 +0300 Message-ID: <20241024110223.77254-4-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: 01739cd7-f742-4d39-9a22-08dcf41b6a55 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: nakkLaUt3sjzVgnvDy1T5syhTJd89zhbP+3CtXdCLRoW0rTLNOPkYAg4LmcC6OKf04wi8gCzIIxvpSAK/+MLKsqBvpsHREDbXAeLwIJz2vk+u+5l6SrAl2hL5r42g0QFbJOk+Q4Fr0NqzvBDcaYsUBp9Kp3/6b0BmUzgegK4Yq3WF/q4JHSR6gybUngbHgneTVOA0rjLkecZzaXV1Pubje0EDxZaEks2FbiaftBQ88/gONHQjTweb52Mg8bt3CTcgDNMkqD9D9z2rDQiVbJFba911Pw6YOX+gh9ewjx3Tvpxwy8qM4S7sZ4NK0y7kabZI3sV02xOQw79csJjVUryYNzwLvhmPiogRfcJHtLJjYRGCT36W3yzGNxeeX+BK2PkB5T3Y+qqGDXTSSelM1MTme5ShaJPZEQpEtCcxF0EYc+njwkl1NgTSwU/vSpcJiRAZCNR8I3egAoGWfJ/es8mJ9iuqgfXTSGWeLeUBFpe8oARckJJfOyGwl+J/P4G5CXqxpD7K4G1nYKStaxJf38Sm8rcA/FOYXM3G1RBRzMp8PkpYbPkqOR75IViwanEO2LmHFjbA8Og9nTpHrLUE+ncypD6Lice8yXZ7fcNVthd4C8m8Mp8J58qa9tc6yyGKzCYfF2kIsMMUF4bZp3Kl8LZYHbv/rndv5veP+BMbt9jwvL/iUXmP6VFrddUclikB/NdRsgdDw7jPFPIhCt2RSmZauunJTrvPSHsbxNonSN/URSqSDNXxG4ZLpmq+UKowTL1ep1qH/9nJWHkkivHw8Vlyl6RurOPk6Hw3/Hed1zDo32DJSz+O4ki6YWTSJMTXPn/bkq3wCHBPCjZWmlDyCMy9OKiqUwn4B7M8WI4K98ozTIjZiXLF4B96w+S4xDUizTBPuCI4yofgjGndy6kR5Sih4mQ3riwkyD2Cx6l8PasETLhAPePxy0sFQizi2+sHpRlBySnW6+hXaESdjdaS+enLAous4v6A6W7ApPx793yPoU8mrWJZ+sW21KTsYkuVS9j0hxlcquWWlDScLHvUWzuPm+nI1ioPHEZMQ4nR1+2W56alPpYuRzIzdzcLTDvGjUK8lqG5iDVSZCgrugyADN+43z2ZdyITulxeidFfbFuUE9ZVbRVGE0Pcc1Xk6AoauGSwtkKoWvjTpGyTx4rUnUXELFULnXlrMFkMUpq5fd8RJwV14w7MS6s9jUlchnlK8CRdjDmrzNA5MJWyTM2Yh9qznscQWVPNuWpXahjwB9UFSy94rsFOwJXnJZrxbVZS6OSkH0lSxocOjne0hCL3n4pdpzMQQ0K7DmfhmlDAK2lvawEy37e2rVt7Oql5J1WH7yYkb6xu9iciK6U2WS2dHliTR/zrmr9UlKL+z2t3r11y+c= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VdPiMVVMlAtFrnLG0Bxte3Vd8HajxSkh9tZrK9GhTct0kKTxHjVQDYZjeWKtITVmNQ1wYQZSHS7Z7kUwMIXL2voKpOLF9MXEU5x1d2c8sZBYrNuHqTuXv1R5QAsbiarnbq2NpS+F+BYZpDZPG8Ce08XLQirQ6Fq2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/ES0dd+OYsj1gp5C1UUZ7htlHh4oRBme9bpiLpriGWCfIndJrJOsuoOAJ0tdgOkPiaWD6dRiTBBNnYRBk8barhQEFLO6XayQ2Qvdv7Hddc8NCo2zYbT0oATYFgOnU184b5IsbSsq5U2XGd2AUPjmMORekpKbIN1zPUzqE2TW18Gg0K2VoY0ekhsldjwNHuUWyrSo7/+fdsm3PZoEVrRRNMCQY/PSi5LtYkiNIT+cEhl7x/nTKigAPePBq8X3V7qhY5Py1CXq285EeADuwcsvYORIVETpqjXDFrBvKry1ow+6ThL1eUaIkdRmjM0xehyAqwGo3DBxLHqIdwZ1SKWabzBhfQGSJ4JDHOLhe94iCO7H0q1LsdFDIPREv7UCG2JQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01739cd7-f742-4d39-9a22-08dcf41b6a55 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:02:56.6136 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ogp4ckKgsc0U4K9KHy0h5TbYuKJqHpb4VXylu5o1Ea0PJv0SBafJxNPKMIdICk/QQZ6fZh14SELQqwOcVolUDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 When a stream changes state, the update is notified to other drivers that registered a state changed callback. These callbacks might further change the stream state, leading to the stream being freed. To avoid use after free errors post notifications, this commit adds support to ref/unref streams, to make sure that the stream is kept alive until all processing is completed. This also updates the switch condition post notifications, to handle the stream based on its current state. --- src/shared/bap.c | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index ddf8ab84d..46ed490d1 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -262,6 +262,7 @@ struct bt_bap_stream_ops { }; struct bt_bap_stream { + int ref_count; struct bt_bap *bap; struct bt_bap_endpoint *ep; struct bt_bap_pac *lpac; @@ -1204,6 +1205,17 @@ static void bap_abort_stream_req(struct bt_bap *bap, queue_remove_all(bap->reqs, match_req_stream, stream, bap_req_abort); } +static void bt_bap_stream_unref(struct bt_bap_stream *stream) +{ + if (!stream) + return; + + if (__sync_sub_and_fetch(&stream->ref_count, 1)) + return; + + bap_stream_free(stream); +} + static void bap_ucast_detach(struct bt_bap_stream *stream) { struct bt_bap_endpoint *ep = stream->ep; @@ -1220,7 +1232,7 @@ static void bap_ucast_detach(struct bt_bap_stream *stream) stream->ep = NULL; ep->stream = NULL; - bap_stream_free(stream); + bt_bap_stream_unref(stream); } static void bap_bcast_src_detach(struct bt_bap_stream *stream) @@ -1238,7 +1250,7 @@ static void bap_bcast_src_detach(struct bt_bap_stream *stream) stream->ep = NULL; ep->stream = NULL; - bap_stream_free(stream); + bt_bap_stream_unref(stream); } static void bap_bcast_sink_detach(struct bt_bap_stream *stream) @@ -1248,7 +1260,7 @@ static void bap_bcast_sink_detach(struct bt_bap_stream *stream) queue_remove(stream->bap->streams, stream); bap_stream_clear_cfm(stream); - bap_stream_free(stream); + bt_bap_stream_unref(stream); } static bool bap_stream_io_link(const void *data, const void *user_data) @@ -2115,6 +2127,16 @@ static unsigned int bap_ucast_release(struct bt_bap_stream *stream, return req->id; } +static struct bt_bap_stream *bt_bap_stream_ref(struct bt_bap_stream *stream) +{ + if (!stream) + return NULL; + + __sync_fetch_and_add(&stream->ref_count, 1); + + return stream; +} + static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) { struct bt_bap *bap = stream->bap; @@ -2123,6 +2145,8 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) stream->old_state = stream->state; stream->state = state; + bt_bap_stream_ref(stream); + DBG(bap, "stream %p dir 0x%02x: %s -> %s", stream, bt_bap_stream_get_dir(stream), bt_bap_stream_statestr(stream->old_state), @@ -2138,7 +2162,7 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) } /* Post notification updates */ - switch (state) { + switch (stream->state) { case BT_ASCS_ASE_STATE_IDLE: if (stream->ops && stream->ops->detach) stream->ops->detach(stream); @@ -2148,6 +2172,8 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE); break; } + + bt_bap_stream_unref(stream); } static unsigned int bap_bcast_get_state(struct bt_bap_stream *stream) @@ -2544,7 +2570,7 @@ static struct bt_bap_stream *bap_stream_new(struct bt_bap *bap, queue_push_tail(bap->streams, stream); - return stream; + return bt_bap_stream_ref(stream); } static struct bt_bap_stream_io *stream_io_ref(struct bt_bap_stream_io *io) @@ -4145,6 +4171,13 @@ static void bap_detached(void *data, void *user_data) cb->detached(bap, cb->user_data); } +static void bap_stream_unref(void *data) +{ + struct bt_bap_stream *stream = data; + + bt_bap_stream_unref(stream); +} + static void bap_free(void *data) { struct bt_bap *bap = data; @@ -4163,7 +4196,7 @@ static void bap_free(void *data) queue_destroy(bap->reqs, bap_req_free); queue_destroy(bap->notify, NULL); - queue_destroy(bap->streams, bap_stream_free); + queue_destroy(bap->streams, bap_stream_unref); free(bap); } From patchwork Thu Oct 24 11:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848779 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 620261CACFC for ; Thu, 24 Oct 2024 11:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767788; cv=fail; b=S8b/y76krvqAOmWd98rcU8PsR0n7X9jQbdtOpiZza6fx3d0GBXtCQ4gAHgpWbAeCaiP6vY4N4TvPVjlU7VadfY5Xx+O45VtoUG6/m5uYNJVH0aiZOsUQ46cjGyQY+eSppECyKjlq8eix6iblNRIU1vh3GC76rZ8FKlhzJKFRZJk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767788; c=relaxed/simple; bh=+MALGdDd7EySkRkU5XLFMHWfRYgSmE2/7sC9p1j1X1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=G2uERykNGGvCiPFBSOTIQ3FPuPQLE/uKIAD1IV769aCf3v4rShiosVaKKhf8WrO5ePCvXxJ/3gjDZj2m+J6onphiwt8fQFWfFnCgZqGDbDmR9NYdN0j06VmVmIgBpJrj0+MxkvD16IxoDUy69l6P/6fl8WQiz3x9LF5zlnbb0XM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=KtmsMg7r; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="KtmsMg7r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZWgRrXncj3UTkMdCzoL+MChTM/45stcr7KNH0MA9oGRIU/K00eglX1ZrouznLEkAIx09U438dMVHJ4w26iUDMDSlOSOK8XZZ1f0hRxWEXowhyd9QCtUrza9/wtav9xlR/fUgZiRKvO13WWEFEs4IAnIjeatRsETotRleH59wb4aQxl+0Hob5CG8XBnDGdb/YLJigXRZqAXdYo26nBJvnauO6he1BftBd2pNjg0tq7ZiFG+qDptGNabpjndIUWI0Cy2/qYA4kvvZ5webU8ZIydzzHzh7BRnMS0MnDOObx4PmKfr9O1bkqw20ns4wSeUtjSBE5/hdGDChnHGejPlxV7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3mLuqgmV0vm8IfMVhrCCQYByBGTtkc+fDKzKuAxBh+U=; b=rKlLuwpZ44lURFBKvxF2cJ2CnNxXF6fBxJqXzX64q1VT4F52TA5RrqSmBRObvofG/sHqgRGiFVOTTlncM9gKzjxAHqO40FovSuLDfsvVPaYjJLFwY4wAun5har4BRfIqOc8jhupV1C3LlT0APSZAa4W9vji52t7goPIOzHKYnuhqTGERlgNgW5CzEayqtXn0OiYc+p/fW2POskWYAbiWoIOJLNDe8XXZo5VPq3s75K6BBwqLEGi6Y2s5TYSIZlgsNdGrPsyQeIacdn/ddhQelv1N8rRUGwcfcrPAbB7EyNauj3Ple76mU8PZOIPori37y0I6cp60sIx0bqGs3w2mfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3mLuqgmV0vm8IfMVhrCCQYByBGTtkc+fDKzKuAxBh+U=; b=KtmsMg7rWbjo+wSgZs5bqITefr9pl03RU8EGvoBnOGI8gt/lF+KN65s7jxOOMT1gq2ALK2yMEciF7GDFnZ9dustWHMQtNP7j3v3VQYbvHY0DQaysb7TJkd8DFSAgVF6nx05yWlY54SCwQjqD+y2TgXoWrRwjU3kTsqJqVKaLYmcuOj0wa45G2ufWALHTO+IB23l7dP+uAPESOdh8unH173KtrTTfQtIoVD9tONgZ19nXi3CacoV2Qk89vzsnxWEiLMue7KjpzE88fHE43fbmhUot97/752n+2kuPZ2sK9V5Vk3c/s8mdJvrAscGS8jc1pTJUa7FbBQupapqEnifsWA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:02:58 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:02:58 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 04/14] shared/bap: Use enabling state for bcast sink streams Date: Thu, 24 Oct 2024 14:02:13 +0300 Message-ID: <20241024110223.77254-5-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: d10c21ff-2a43-4bc1-4d11-08dcf41b6b9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: djSlNzCP39Xk2pvcxujEig6CDrRyek+zxZ2oRQr7iHFbhBUL4LC5s2IlubIL3/CVEMGLAHVIjkU1wIBlTKJOoLNtihNO9bAg1yjqI1K8tVi0FuXl1GTVKwpuH+8SFuzZUWIqKMBJjSyaa3qblP5UXBBJ16Objj//gNwnHdqpuq2Ew+1vybbK7fDE91Peaqsp7/XstPgTjigd/rmWZyeirf79A1xyOCKVKJioVTH9F3Z1QxxrXPjS3kwYofmGF8Y5FVipnDvqnceedaUd7NOlG7TPXKbaa6/3gQONLcO602kIUJgd0aGyDp7Gp7dTFZiGegRwj7EL9iLvjlJZdWyuSsGSvBvpoqlh/gRJIEK1N/etsJFadmZfa/C4UhsttirNUob4b8gao61iSnVPLh5MKakwPDK7t1OToeL3VNTSx88kwjBzQByA8qePHcmvrkSkBOVy3rYESkdw7DqbDTWWU+iMWtIgMhXIONemf77zWfz2MyPKjNpni5OykPazMvl4u6dmVHhgaD8d+NitKu/jJco7U6xjJ1GpLVTEiEX5CaLMkHwAYAZ78NjklIjT1J+7nT5WTjcsIqXM21Kyp9vnSwnRvDnPe6glwxH9t1z6GIr+Ose0P9xDyI9T2v8OAqHy/aqAZ+nzQ35CKCg0dZ9nqp4mIcJWMrwWXmwNwiYsP9e3kYZXG+meQwKvAYxfeMsYV4gUv8oNG0tami/fkwlWqvVE+KJmRzWVpvXslnjnS7zxIyxnfDZAwUj5VtnujmcM1vvx6ouE7UEukservPpYIq3fb1d6I0AXtUvnMWI/6AhHCL7Fhoe469BjwjrNPms3mdplsHicdEzcIeJfc7qgrtpWiL95hEhhLwqvKhOKHirr9za64x6wUk912ZZ6u1AWA5YC1syqarsURBpvR19/QyFZZqXOV/mI/2P2ycZc3UxVyb5hLfbF/3p70E7rD19Ee1iW29VKsUiS/A/SglKPl2nejd1r39m5+g0pTFfxpGv3ZczwD9WirvQSBGxvrP2xTgmdD2V52DM6XiVn/AMzBlsudedr7m8RoMVM+hsoTv2cHAODHmZdL0i9Y26pFHHzb5UTDwiJbH7p1lFqFCltHd3NxBUf2gm1WJmWpoDuE6VFgEL84zspFBef2wML/kioBuwKkQ6SDfjse3N6w+JpHwv12CIgd2Osb2IV0nesdVRVxW8sCHj5/2b3p23pazAUOEuB8CEXk1ugi982uiHJQprvIeGD/RR28v+L3+vEJYnXQHBzDTLTAbX6gnWJtHjRhfx23LrsC2MEEuhrCxnCM2xFxrNwGBrUzCLRCAiOSTvSdD9mjsaCw18cYOOu0LcFBFXMdVBkFy/GQbzyq0vJ+aKdFrx+jd9IvpL5nD7mUVA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yjY8O3veqqRLJiw0Ai4IxibPvXaq/vJ1o6SXtlJKSjlrENUdAeX4rSlIlm2w/O/x1M1KYgUDhYRE40kmETZ578pobcSJoo6H+AURtQyAvo42Eajmiq3nTb0ykVfxqktFPFugPwAu3QGH/BrN1NJ3x3PnG1xHBpuI8entbda8m/6oMH/6oOPa3qJ8JzMSsNfJPdk8vgaFxB6No0qcYbT+z/731tJ94BSucLiQ1VsPT/zBWMUDV4RuOIyxSLywmf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uYGOu5pxc5fY6iFK1zClI365rz0EpNRShn9Z9QwvYCmr4IoYplRMbhBFbRvMV0lZmiBanMDRAFIf+vbmqlMhdOgmYcioL/mYuv2FO2EwXWs/+AEn7hogqt1kE4bf65MnF33208lVQicx+DDDLRIqNA/X/5s8JeNV0mI94l8IC21Iy4yj0GHr/UxBw6fV25l3iOjhGEud+Z8mEre01iFaCrWSclciFBIxtzNWYRK3Bawkd2p75n9IoaZvrl9hgPVtXuLwnk+SA8JpXpg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d10c21ff-2a43-4bc1-4d11-08dcf41b6b9e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:02:58.7633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aF53mcJsXrxtwsVPtpMG/mbiUc+GUTHuQPblRK/V9i9OwltYMhMz4OIO0lD4Fu/A8EAIzJ2u7Doi3B8zM61LQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 This updates the stream state transition from CONFIG to ENABLING, on enable for Broadcast Sink streams. This is done to differentiate between streams discovered in the BASE after short-lived PA sync and streams that have been selected and enabled by the user. --- profiles/audio/bap.c | 7 +++---- src/shared/bap.c | 2 +- unit/test-bap.c | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index c45717ef2..4d250db52 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1020,7 +1020,6 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) free(req); if (bt_bap_stream_set_io(setup->stream, fd)) { - bt_bap_stream_start(setup->stream, NULL, NULL); g_io_channel_set_close_on_unref(io, FALSE); return; } @@ -2676,13 +2675,13 @@ static void bap_state_bcast_sink(struct bt_bap_stream *stream, case BT_BAP_STREAM_STATE_CONFIG: if (!setup) break; - if (old_state == - BT_BAP_STREAM_STATE_CONFIG) - setup_create_io(data, setup, stream, defer); if (old_state == BT_BAP_STREAM_STATE_STREAMING) setup_io_close(setup, NULL); break; + case BT_BAP_STREAM_STATE_ENABLING: + setup_create_io(data, setup, stream, defer); + break; } } diff --git a/src/shared/bap.c b/src/shared/bap.c index 46ed490d1..6a2e12577 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2186,7 +2186,7 @@ static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data) { - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + stream_set_state(stream, BT_BAP_STREAM_STATE_ENABLING); return 1; } diff --git a/unit/test-bap.c b/unit/test-bap.c index 9cfc8c403..0c190d7fe 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -6419,14 +6419,15 @@ static void bsnk_state_str(struct bt_bap_stream *stream, uint8_t old_state, /* Enable stream */ bt_bap_stream_enable(stream, true, NULL, NULL, NULL); - } else if (old_state == BT_BAP_STREAM_STATE_CONFIG) { - /* Start stream */ - bt_bap_stream_start(stream, NULL, NULL); } else { /* Other state transitions are invalid */ tester_test_failed(); } + break; + case BT_BAP_STREAM_STATE_ENABLING: + /* Start stream */ + bt_bap_stream_start(stream, NULL, NULL); break; case BT_BAP_STREAM_STATE_STREAMING: queue_foreach(data->streams, stream_count_streaming, &num); From patchwork Thu Oct 24 11:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848781 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F145C1CACC9 for ; Thu, 24 Oct 2024 11:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767791; cv=fail; b=K0nwSPn4yiLwkyZhX8CF6gLCvEqV/6XFCb4JhUNdjVvUJZmkeQCriqVZlP/tBrswagRjGuQ2AMiHg7zcdQwLfEXEOoiH8v/z9LaUzGYwnjl8SbgrqfEVsRMuCIyJdBZdY7dxPTDybn44d7ZbyM4ublhNZVGoGcG/hy7OlqPb2Hk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767791; c=relaxed/simple; bh=Y+Tp06REaj1ZhgxLQ9xgZOrTOq9JjDdglNUd3ZuumY4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=CZEnyQxyErN/SuWChzIfeDqqEZTUtST4ToaJZVRy4hWHjO6qD/j1ehz2AlKAois1fnbi4LCX7UEEQnoXCL26QROV0rM9cKGk3hyMbjXrjGFG01SNDytAP5iAMNNVTIcsu6YCD4uLzMHJ6ur+2Iv8a6usO+b9kkjWkrs6e+bore4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=Wi59HJF9; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="Wi59HJF9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EQ0HRPDwUsnkrqrA1SlprfVA0MB6UtkGESXXG9MDZ2Co76Ux9spPkegL1zISHTMFxTXbvRKP/vuzlmaLAKPudvwn9Yh9oiL8M1wlZ3OU+f13/JyZgmZY0SOtcubXdyhvpIA3HktewN63zSXRUR5rFLjkWYEBTYnALiWuNrQm2bjgO6zM67oau4Hwe9to1hJTbvV7qI3P2+DJqS67yyC86UDB/U1ruKGemIFvcmlPtrI7qdrJRr0tHjFkiUc7uAjR1xV0RKdhRdUrXDF8Xq5nNSwJrg49bTvid2GrEjTD84mSQcvQSABLd9zkEW/HOaHgBAM023xQL9Wxso+ZTqZcKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VC6Yq2BvZVY7sLR6HMyH2kJTyj9o2gTdDAX53tA16Lo=; b=dqegDN6mqjx3wfWKnhCzaA02k6lmzV9fj9fHLvDZfZ8y3U34/XDU23Zr2AeG04/DZTTeCFo89ssJSO9y76y7y0Ns/h/53MbFb8F8IWstQfhKwOV0GjktVc/MvH1OtYZF3xGpkRHjwhqnYca/WTJQHNxXwEVb27hn+n6egYkhZR9pm4/UjiWi9abMdc9Gjs+inLzB4MEUeLna8MzhscsQOGLZCEPHymrtAJ2nmPyj2obyAl+IdagUmON0+wuZcl8OjFJzx+SX1D354yYmNlV2H2TXXOKcKdOrdxm3+KgJm/L5bnufWcHZi4A12Jqj7/s6UASH1Yq+KoPFPf78SXfokg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VC6Yq2BvZVY7sLR6HMyH2kJTyj9o2gTdDAX53tA16Lo=; b=Wi59HJF9jzVu+Z8rSISixzyL+aZlc56kc5tSIplpZcPM+A7jlp9Th77opznO2EFvRJnXrpWZcw6/Go8UsiGlo/jC1VSE6e7C7XvoeBSPZMSQCS5u+vObKWq+DHOp/Zke4gWu7nmPiQqStuomsJ58oRcYQAhOWGfL9872xCFbPFD8soGbIVE6FEVWBKvRRZ3UbIDJKsaL4wR7KBdioH1OA94UkIIIDZtwVQYIbNEoibDpm1dU1jjygel5x92wh/dp4pwmJ79qbF6QvtE4JS/7w0S6PM9Pd2H3X4f45ZYW4Vy2sErmBo5cYBbFfbYcBBz1i6KE4At3D9ip2KhbK6yh3w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:03:00 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:00 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 05/14] bap: Add support for syncing to multiple BISes Date: Thu, 24 Oct 2024 14:02:14 +0300 Message-ID: <20241024110223.77254-6-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fa382b8-2141-44a6-6620-08dcf41b6c83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: P6QOomn8Gq6mKv0q+anPIG5skE6y6gRwyxWwXi57/mXWk00Tb8LXumBgCjaEx6LOI7rE1b6gcCqEnWefWsRyHT8slJSqrz5qH05R1vVSp5pokegKrjsAL3PZ9WRGfjKMAAc49ua1q5yKdMscgx/IRVMseMMfQsEpEEI3hWsF84XKNmGiLuxZVJo6hhJ8TlKN5Ft2oZQb+6WL/XspNcQpzHnfCf4H97byRU1rvvce54PjUq/U2XZqr9giN1/r/08O/cCuHleT2sA4Z6S9ahmCLsF1apn42gaFWX02z4ZsPRKUM1gTPhYa2Q8gxqCRDyEdAz82FaWynNnH9HkbmZjWloMlExvCcHk8YFVW955Ozozix9oYI+8TcAeJgl8KoOBlH5OOHJxEuUsbhXCOIGCXVXoQGMJ0Tlf/uE8HYuFvoR0rPe7h8qzM7ikZ24AUPYW0P5You7joPN3WtgsP92OXXV79bycqfuc9AcO7gFmKrFVrYm6jG3QZ7grFkNEs+JEiSK3+WJuxwkG00W/ihO1rptyURwkpqSm3+TjRMnEiFJvMKZB6YgBwAyvQZHSRYrKGLqrk2QsjIGkij6hxxLhnAZ9D9lIugGcnONBNcPWWNZimiISgo3J2CFGwZUmfNXMFd4DRciH7KaZpKHd/CzBNWobsHYOspaYdi4JjylueKpYah3BL8O9Z/sN5WXO0OT9b4D5XqhQYukgY1KvfBIgUZTTFEMY/xM8O6YDUhGUGxDkkK1E++xjuwkpzsdnsUpPF98+IIZlSFpJvx90lxnNrntAxKaw/b3lVV6cXsONgkXFtlTxJvfoGtR0b/OhnH9CVUOAXaNsSHgzSxO9AevDG3v8pX84tJJvNQ5KrINXvuzJyLki5sVlLhJgiQL7v4ARvmUAbIpoYwOXrES3EW7xtwIHE8QiSLUfzqqHY2DPH7vhM7Hy4xAfwVVTGwximtFecuJ+WZRdGUhSJHSCWnf16F6/09t5J9ba2wfMBu2FGmo/k7FPESHhCeAuZH5moq84Gi0CXZ/CIsBCea46JbLlSaAKNjKCLZ2XXPEieyjwfuHNbJg+2kpGn2Qdcu0OW7yeBiIplizvbF/GCFuR/7il+i2EE+i3gj9ha88D4O5X+EuKZbo00iht4qsVqYQ0K2kIM76H4YqQSddqsJd/JL4euLQxJs4+atS8+AxnGGQ0fKvI48D4G0WHhlU9UPOsTQPzoIw6JSBC18Z8ALWNYDVlNi/oBlEVshAoUhV1x06Qgocw2BUENAVH1zHWaMaKWfy9pNyJ1bvDCSAwlGD6cdx67/t+ZG//Z1VoKxtFd2zUK7dd9tUBG4/wS1Wk5XhIJTxyOhldTRX1WDW73ebulhl5HPkfZnnr3TsSjVVY0ifmXu+4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MEyS+jDFownKCnv6Xv71vpS9j7TJbzV694q6LubOJoqcsHy3oqrP95Nngkfr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BVdE4u6u70EsguClr2k2SL6A0LEOb2vay0xPQklVOPjrWhrdJUGB7rK6gi2dUK25tV9HWq7ogIixSXjnJV1L3Qo/hGkZ5kHc1paNO7Qq814CbR61hDZVeeF+R4S2IofTlCpD+jAofoRackdSczelAbBggzey+Z2DHWKyZAiWb+pZ0OoF4ngy8aHnKOdw60LTjJk4ZLJ/53xJJghNo9p1neSjwydPc8Sn6lqmoOr2sh3pc/NfgNUF1BfcOZDx8Qs7KiQdbExxLvvNi/7j9+5M4LtITr+DsDEZPp3dpEcP8Cg/ro2DimcI1BCKBCt5sywBcPCc1Il8sEMHNPUZzpCQfNKyeQK4TCuE0XnaYlXrEn6Vti8bdnnMhdC1uQQCrTo383RtExM3U3lDYNlsnW5Ryw/PWXw3W+t/cfxUElQV8RLlFTXFm6gCVCNfenvrRUriAZ1jEf+cgPfD1klZQYo5up8Dsy5EwphISCHRXvUW/fdlaCh8DNTiriJexSp/Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9fa382b8-2141-44a6-6620-08dcf41b6c83 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:00.2611 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k/+WKtG0kLWolMLZ5rNIcj1XNUG8svouq5VgLNRRfcXU6GuO0HpZGaxLkzN7SGVYo13E/kVYsVs6IU0wIiR7Dg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 This adds support for a Broadcast Sink to synchronize to multiple BISes from a Source. BISes selected by the user need to be linked together and then enabled one by one. The first enabled stream will enqueue all its links in a request for PA and BIG sync. After BIG sync is established, the confirm callback will be called for each BIS io created in the kernel. Each fd will be set inside the corresponding link, even the links that have not yet been enabled. The enabled links will be started as soon as the fds are ready. --- profiles/audio/bap.c | 169 +++++++++++++++++++++++++++---------------- 1 file changed, 108 insertions(+), 61 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 4d250db52..a02c58d13 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -134,11 +134,13 @@ enum { struct bap_bcast_pa_req { uint8_t type; bool in_progress; + struct bap_data *bap_data; union { struct btd_service *service; - struct bap_setup *setup; + struct queue *setups; } data; unsigned int io_id; /* io_id for BIG Info watch */ + GIOChannel *io; }; static struct queue *sessions; @@ -997,27 +999,34 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) { struct bap_bcast_pa_req *req = user_data; - struct bap_setup *setup = req->data.setup; + struct bap_setup *setup; int fd; - struct bt_bap *bt_bap = bt_bap_stream_get_session(setup->stream); - struct btd_service *btd_service = bt_bap_get_user_data(bt_bap); - struct bap_data *bap_data = btd_service_get_user_data(btd_service); + struct bap_data *bap_data = req->bap_data; DBG("BIG Sync completed"); - if (setup->io) { - g_io_channel_unref(setup->io); - g_io_channel_shutdown(setup->io, TRUE, NULL); - setup->io = NULL; - } + /* The order of the BIS fds notified from kernel corresponds + * to the order of the BISes that were enqueued before + * calling bt_io_bcast_accept. + */ + setup = queue_pop_head(req->data.setups); - /* This device is no longer needed */ - btd_service_connecting_complete(bap_data->service, 0); + if (queue_isempty(req->data.setups)) { + /* All fds have been notified. Mark service as connected. */ + btd_service_connecting_complete(bap_data->service, 0); - fd = g_io_channel_unix_get_fd(io); + if (req->io) { + g_io_channel_unref(req->io); + g_io_channel_shutdown(req->io, TRUE, NULL); + req->io = NULL; + } - queue_remove(bap_data->adapter->bcast_pa_requests, req); - free(req); + queue_remove(bap_data->adapter->bcast_pa_requests, req); + queue_destroy(req->data.setups, NULL); + free(req); + } + + fd = g_io_channel_unix_get_fd(io); if (bt_bap_stream_set_io(setup->stream, fd)) { g_io_channel_set_close_on_unref(io, FALSE); @@ -2265,6 +2274,8 @@ static void setup_accept_io_broadcast(struct bap_data *data, { struct bap_bcast_pa_req *req = new0(struct bap_bcast_pa_req, 1); struct bap_adapter *adapter = data->adapter; + struct queue *links = bt_bap_stream_io_get_links(setup->stream); + const struct queue_entry *entry; /* Timer could be stopped if all other requests were treated. * Check the state of the timer and turn it on so that this request @@ -2281,7 +2292,21 @@ static void setup_accept_io_broadcast(struct bap_data *data, */ req->type = BAP_PA_BIG_SYNC_REQ; req->in_progress = FALSE; - req->data.setup = setup; + req->bap_data = data; + + req->data.setups = queue_new(); + + /* Enqueue all linked setups to the request */ + queue_push_tail(req->data.setups, setup); + + for (entry = queue_get_entries(links); entry; + entry = entry->next) { + struct bt_bap_stream *stream = entry->data; + + queue_push_tail(req->data.setups, + bap_find_setup_by_stream(data, stream)); + } + queue_push_tail(adapter->bcast_pa_requests, req); } @@ -2647,6 +2672,15 @@ static void bap_state_bcast_src(struct bt_bap_stream *stream, uint8_t old_state, } } +static bool link_enabled(const void *data, const void *match_data) +{ + struct bt_bap_stream *stream = (struct bt_bap_stream *)data; + uint8_t state = bt_bap_stream_get_state(stream); + + return ((state == BT_BAP_STREAM_STATE_ENABLING) || + bt_bap_stream_get_io(stream)); +} + static void bap_state_bcast_sink(struct bt_bap_stream *stream, uint8_t old_state, uint8_t new_state, void *user_data) @@ -2680,7 +2714,17 @@ static void bap_state_bcast_sink(struct bt_bap_stream *stream, setup_io_close(setup, NULL); break; case BT_BAP_STREAM_STATE_ENABLING: - setup_create_io(data, setup, stream, defer); + /* Create stream io if not already created and if no + * link has been enabled or started. + * + * The first enabled link will create and set fds for + * all links. + */ + if (!bt_bap_stream_get_io(stream) && + !queue_find(bt_bap_stream_io_get_links(stream), + link_enabled, NULL)) + setup_create_io(data, setup, stream, defer); + break; } } @@ -3044,63 +3088,69 @@ static int pa_sync(struct bap_bcast_pa_req *req) return 0; } -static void iso_do_big_sync(GIOChannel *io, void *user_data) +static void append_setup(void *data, void *user_data) { - GError *err = NULL; - struct bap_bcast_pa_req *req = user_data; - struct bap_setup *setup = req->data.setup; - struct bt_bap *bt_bap = bt_bap_stream_get_session(setup->stream); - struct btd_service *btd_service = bt_bap_get_user_data(bt_bap); - struct bap_data *data = btd_service_get_user_data(btd_service); - struct sockaddr_iso_bc iso_bc_addr; - struct bt_iso_qos qos; - char *path; - int bis_index = 1; + struct bap_setup *setup = data; + struct sockaddr_iso_bc *addr = user_data; + char *path = bt_bap_stream_get_user_data(setup->stream); + int bis = 1; int s_err; const char *strbis = NULL; - DBG("PA Sync done"); - - if (setup->io) { - g_io_channel_unref(setup->io); - g_io_channel_shutdown(setup->io, TRUE, NULL); - setup->io = io; - g_io_channel_ref(setup->io); - } - - /* TODO - * We can only synchronize with a single BIS to a BIG. - * In order to have multiple BISes targeting this BIG we need to have - * all the BISes before doing bt_io_bcast_accept. - * This request comes from a transport "Acquire" call. - * For multiple BISes in the same BIG we need to either wait for all - * transports in the same BIG to be acquired or tell when to do the - * bt_io_bcast_accept by other means - */ - path = bt_bap_stream_get_user_data(setup->stream); - strbis = strstr(path, "/bis"); - if (strbis == NULL) { + if (!strbis) { DBG("bis index cannot be found"); return; } - s_err = sscanf(strbis, "/bis%d", &bis_index); + s_err = sscanf(strbis, "/bis%d", &bis); if (s_err == -1) { DBG("sscanf error"); return; } - DBG("Do BIG Sync with BIS %d", bis_index); + DBG("Do BIG Sync with BIS %d", bis); + + addr->bc_bis[addr->bc_num_bis] = bis; + addr->bc_num_bis++; +} + +static void setup_refresh_qos(void *data, void *user_data) +{ + struct bap_setup *setup = data; + + setup->qos = *bt_bap_stream_get_qos(setup->stream); +} + +static void iso_do_big_sync(GIOChannel *io, void *user_data) +{ + GError *err = NULL; + struct bap_bcast_pa_req *req = user_data; + struct queue *setups = req->data.setups; + struct bap_setup *setup = queue_peek_head(setups); + struct bap_data *data = req->bap_data; + struct sockaddr_iso_bc iso_bc_addr = {0}; + struct bt_iso_qos qos; + + DBG("PA Sync done"); + + if (req->io) { + g_io_channel_unref(req->io); + g_io_channel_shutdown(req->io, TRUE, NULL); + req->io = io; + g_io_channel_ref(req->io); + } iso_bc_addr.bc_bdaddr_type = btd_device_get_bdaddr_type(data->device); memcpy(&iso_bc_addr.bc_bdaddr, device_get_address(data->device), sizeof(bdaddr_t)); - iso_bc_addr.bc_bis[0] = bis_index; - iso_bc_addr.bc_num_bis = 1; - /* Refresh qos stored in setup */ - setup->qos = *bt_bap_stream_get_qos(setup->stream); + /* Append each linked BIS to the BIG sync request */ + queue_foreach(setups, append_setup, &iso_bc_addr); + + /* Refresh qos stored in setups */ + queue_foreach(setups, setup_refresh_qos, NULL); + /* Set the user requested QOS */ memset(&qos, 0, sizeof(qos)); qos.bcast.big = setup->qos.bcast.big; @@ -3142,10 +3192,7 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) static void pa_and_big_sync(struct bap_bcast_pa_req *req) { GError *err = NULL; - struct bap_setup *setup = req->data.setup; - struct bt_bap *bt_bap = bt_bap_stream_get_session(setup->stream); - struct btd_service *btd_service = bt_bap_get_user_data(bt_bap); - struct bap_data *bap_data = btd_service_get_user_data(btd_service); + struct bap_data *bap_data = req->bap_data; req->in_progress = TRUE; @@ -3160,7 +3207,7 @@ static void pa_and_big_sync(struct bap_bcast_pa_req *req) } DBG("Create PA sync with this source"); - setup->io = bt_io_listen(NULL, iso_do_big_sync, req, + req->io = bt_io_listen(NULL, iso_do_big_sync, req, NULL, &err, BT_IO_OPT_SOURCE_BDADDR, btd_adapter_get_address(bap_data->adapter->adapter), @@ -3171,7 +3218,7 @@ static void pa_and_big_sync(struct bap_bcast_pa_req *req) BT_IO_OPT_MODE, BT_IO_MODE_ISO, BT_IO_OPT_QOS, &bap_sink_pa_qos, BT_IO_OPT_INVALID); - if (!setup->io) { + if (!req->io) { error("%s", err->message); g_error_free(err); } From patchwork Thu Oct 24 11:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848783 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11F971CB9E6 for ; Thu, 24 Oct 2024 11:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767794; cv=fail; b=TwCF6ZD63pzQM4Bc1l7NsDfSVBJHCtn/veIabQkxs7a8dBETJD1CLCQZQvaanQgfW/tRY6yhMxy4+xuQF4YLGOvF5KHHhUwTLLLp1g/nSKxL6lkqar12TwkkKMLWOLHpCVHcZjL7rHBTS4McasBr90Q3iHTZrlbGIYRp8MQQPn0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767794; c=relaxed/simple; bh=TgNXcreGhrXUXtDiUfiyixwY27xJq2IME6+s2l64mYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=caGm2If/rUsZSPv2Om4XnMw6eEOTBW1TRpEHGtMKwITAZwFbxkIfBfv0+2RehCjYd3VgLLwYbCh0wRBMDDlVV3OYd4EZ0v36k70BTXnTCQHru6a9aICGXJgYkNs1IFqqMVvSVDhWKxQpZxTArQm1YYG0ghQaF8+L9YU/VQmzoeQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=bsimc51T; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="bsimc51T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CdqU8DLZHyVyANZZVqwqUv88kkmeIPH/58/MuS3XVBmhX1YfR3336SAKRZz4a3PG+VACPz3daIJoIgxH+8LVCjvyQM07AnQyCeX33DZg6USojfGjyiMatnC7pudMqOamV1JxVWlJ6T2h+Zome3ToyVaZkYmP/i9CP06g5l6/l0OjKrRsrIq/uMfvpcony9Kz8QWJLGu2bmENeQW97Gy1Y+i97MckN1S8LiGAnnokGYueAZQPOGs7VN0NWmaYJPNfG8s22JsbA732EEDiJH+se2RjvsW1djYQbWxZCEsESdhf69ZrmZ6wDQ+0D2+/2HHZ4VniQGgjEWl6OUCAfoz/Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NBzmjkaYtJbHi2eMpGY7P5YU1YWrDGiACCyJTsCSV4U=; b=ZRMZNoh0t6cCKubprOErRC0G2BYG+MSdeGBu1tkHPYqfWCHy1YDL7kq/usfcZkMuc2OH1g5d90w4m3YkHNpVvuOx46h2h1KB20zIuHEQxw0nhk0+aSURtEfePqPgVAn+UWt7SOm4gF8dSrhe4WRiWqzZSqx6ri4Bh3IvQmnjV3dx5QFLewng1cHPyHxz82kpy1m27lRES7lrlvIPHDECLPFHzi/dtwiCFZuTS8ksQlkRN+1MmgGYPQBoXmYbjX0UAjBlcXJX2JCYhSn1ZbmSy1gkcqGK7vRI96RFiFjOIdEl8R/HZ909fo2vwIdhfCvetE5FEMPpsd+KI3OIXsubrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NBzmjkaYtJbHi2eMpGY7P5YU1YWrDGiACCyJTsCSV4U=; b=bsimc51TI2Ho2rGt/sNQhgkRbqaLUo6ZpvhEKrp8qEXM1nweMq/ivgbrP0nAI/PxXcWbu47Bi+km9w7vjnChNMsuWDOGATaT6AO9TNh6vGbnlc1oTT1V7sRGcWqtgqgY7cd6y6LsnJn7rLTZ8yS/aGx2fKx4QKH2sKwxupOHHacvoTsA0ZXrEqpUA9Rh6MYsyVaT8q6h9E+wEIpxEsllunZP10Fj7Zh0gWVuMe+nUAbL2MYot/yxyZ1VuabacIw5ucQ+C9QH5NpPKNWBEZUYmbK5+WwQgPULHL8SI4Tv0NNfK6UdNOGQUcAkRMtsAy7ji0L0ZkPHL/LP9r/xPqd8zA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:03:01 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:01 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 06/14] shared/bap: Handle multiple bcast sink streams Date: Thu, 24 Oct 2024 14:02:15 +0300 Message-ID: <20241024110223.77254-7-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d5b8986-94f5-4a4f-f299-08dcf41b6d6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 2fJzH+ZJ2x212qiJZa2vDvkHa0uuvDl0qOzVg3ix5BAdTtH8lm3ChKeWiH2kgaanvs7KgjbCvIQSmnxEIBuvlqI8B81SV8Nr9UnbauEWatLr/OuB9r3qOnW1vztEPhoJI56KXIBrkXPfLbYOeH4MXKHZ3MaJGkH1E4zBsnTA0dtCntsO9E6O+/X707x2mNi5qFBbqe53/pC5dTf9SbcVvf7gPbkZBRHsKaEBGHbmtc/zu7jX8N7K8+iD1bMHewPEZFSSqz734l4oSRPNSrm2gZ70mlW11Kx0GRFzxzfNKNe+a4VV2zXjJHgX279jcuVQJzxXq0xLMrnqQg6uzIBpkrSBWBxpjxiH9/X16oRYMgrdy6uocxGwTiQmjB/FmqoCFDBj8VPDlA8P7j2/NQYXORNrSMqWVm/ewo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outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N8s1yxViryNxjuoOs0OuG6332tahmR36VEt4rbGg/txEJK+HUt0vbYeFmLwRfy/xWUg2Jhf/sFYhTqhBOXteLC9UxCqcvZyeQBECZ5++lCCDo+GJaCrJP8B3dCPAitVrJJm2hEO68o+E3ySylnUjYutyyNeNy6/hRVf3JlEFvruDlwlvNQ1ZcnYxxizEMlte+TKjNaT3H/YUcYg1zUjb3WPR8R7/CEZS0MkFlkaQviPFfAuuGZY7xpbE2sfqnwgD6hXka6QF0UX0+Hyte5xcQRKii5502O0rwXcRgL1Syn1NznWT2f95v8sBJxLbiK6pK6MQ1pkbOW/Tw95bcM4dNpqSmyTP3ryRyG5uubhq7H/L0gXCFi8SHwqgkEpPW+SsUzpM8OaRe08IN6XZTiSHosx2gxk3ED0XZOMUDLhqQyF1+tTpBw0n5GcUdiP2Z3S3zIuA1je5Ofl+/3K5ZC91esJiRmtVS1TwtnB3vpJeShTAGQoDiuAqX+bn/R6hRajJ8BVF4QLE7FLe2ApqRPpYPFj6Gi01F3pEchmrQJ8EF1bGuBC/heMKwVf9N1umc+NYTuLSBC7iQTZ3ZB5ALxXGGac7fBeBMbMwap1JhXQEZpP03gQNNLSDvyuUQY3vhRBs2zFkcRJAdLhaaWczvxLlEWXLcQ1BlIl3KHE5pPO43PKCqBnIxqO3aY5+Rabj6RHS5fkBsIyrvhw1szNE9HkHEGHqEYxLUKsHuaL9RVqhQNSA4/sc78Bar2mhsCVAwK5CG48w6la5Lw/f+k5VXZBsMxDM7RddqDj9++gLpBTQYILY/s7FfN8FBdtV4pGv1mNiiK84gdjGekBJCUXHf2vA7LS8Z9FYeeucqph/eM/dRmUtSrQDfaaVg1MCVuSgMY8Zjlvv6assxQN/aNe2e1ZGrM2mCuCr5woWIUO8tRxGKXbbC/m+87JU+gKmvsHAeJyHMdUu/XoVB7pSw9XckUkS2FNP9f9UNb9Be1xY2Zs3c4QbNIKKic+9bE5A0GcfvD8bTDNcn3WGxgd7lnjjEIbMTvOYi7TfctMrAtZLYwvpG1xg0bORjjU8KrCeMemzUFWtstkDcOV0MQk3XPLr5PiFbgKx0k9+UpbmAh3spoFHrqGIRnZ4EpFaUzocNTpLuV1748tCi9AWq2w+X92VMe2AqV93YH4kqlC2nSI8dYeK317twB6rQ5TnZLXubQEWck8LZHLPYdBBYj6KFS8seQ5ODk/9Jv3Bw2kIXCIPV/xWBM4rPpA8besQrq1ff1qrQ8XEPVtx34/YySNMMwC3lHBwj5ckoL+dimBbJlQOC09LJGY2vbEMWLjLifYA/0XRct6OiVBjrR1NHsTzkocXARhgXT8yqfIDu2f1m+7VBKCOVgnUtkCsFVujJAnwF5HN7ZXJFMJ3W4+bW/eNO7X61OYK2+Eob5XLdJghKlhW7N/ppUv5YEQYyjbgPe0Yqh7blBTfgOQrVo01PjFQeBoNJFY0H9W2mWgameAFCyyOOy1ZZxhFcmRN1KtiRxtPigE3VFdHKb7xRP/63l6kHK6IVLtQ855I192oZYiDo4T6hzRj5Q2Dy4OrBmi2n4Nz2awhlt+edBg35PdoUg+SI9WU4s/y3g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d5b8986-94f5-4a4f-f299-08dcf41b6d6e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:01.8732 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: R/2RUwwsu7zQvx189NVHLQ0KMyyFy3+lCq9BgM7toZYXvejaY7QgMLeyfzu50dEo4kZd7uOsRjl9KslArnKRxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 This adds shared/bap support for enabling and starting multiple Broadcast Sink streams. Stream enabling should fail if any other Broadcast Sink streams are in the process of enabling or have been enabled for the same source. Also, a stream that has been enabled and already has the fd set should be started on the spot. --- src/shared/bap.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index 6a2e12577..066e89854 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2171,6 +2171,12 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) bap_stream_io_detach(stream); stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE); break; + case BT_ASCS_ASE_STATE_ENABLING: + if (bt_bap_stream_get_io(stream)) + /* Start stream if fd has already been set */ + bt_bap_stream_start(stream, NULL, NULL); + + break; } bt_bap_stream_unref(stream); @@ -2181,11 +2187,40 @@ static unsigned int bap_bcast_get_state(struct bt_bap_stream *stream) return stream->state; } +static bool bcast_sink_stream_enabled(const void *data, const void *match_data) +{ + struct bt_bap_stream *stream = (struct bt_bap_stream *)data; + struct bt_bap_stream *match = (struct bt_bap_stream *)match_data; + uint8_t state = bt_bap_stream_get_state(stream); + + if (stream == match) + return false; + + if (queue_find(stream->links, NULL, match)) + return false; + + /* Ignore streams that are not Broadcast Sink */ + if (bt_bap_pac_get_type(stream->lpac) != BT_BAP_BCAST_SINK) + return false; + + return ((state == BT_BAP_STREAM_STATE_ENABLING) || + bt_bap_stream_get_io(stream)); +} + static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream, bool enable_links, struct iovec *data, bt_bap_stream_func_t func, void *user_data) { + struct bt_bap *bap = stream->bap; + + /* The stream cannot be enabled if there is any other + * unlinked stream for the same source that is in the + * process of enabling or that has already been started. + */ + if (queue_find(bap->streams, bcast_sink_stream_enabled, stream)) + return 0; + stream_set_state(stream, BT_BAP_STREAM_STATE_ENABLING); return 1; From patchwork Thu Oct 24 11:02:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848785 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2060.outbound.protection.outlook.com [40.107.249.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C61D1CACE9 for ; Thu, 24 Oct 2024 11:03:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767796; cv=fail; b=dcZQseaa/4ywS+FOpbF3V99Co1+moBLiX3iV1SIWwqXYQPlmeA2dXYosyVPB6inzihmUOoHwXvuZB0Qz5dt3XCrObNzHJy4lQm5FrZLbgQs3LenWlreShK1hrcfnR8gP3WT0NdhKvxN7NgvC13sci8GH1IXmRb5BAU7b5dvyGyA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767796; c=relaxed/simple; bh=RBkN4v8HbOrapJSD7ZWet5Tdlo6IkOvkm2+1rTmxx1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=IiczaaX/QBKPT50az6BMmSh/JbXnr4ljWHvZ93dJ7LUc2uji4/+NObw3zJ3D5bKwM599H4X144C8WyyEXc44dogDTpEdtsf5UCGwS8RUX/hw5kSHcCl37Ng72CIyh2b7+O0CkOdqsu3RAlugsCmRL6iFRqL+eVUXba5Gnhh6Q1I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=dZn9aTWd; arc=fail smtp.client-ip=40.107.249.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="dZn9aTWd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iOrKXAIQFa/HdhjyeklXXIlZdA9mqyVrYPWV2NlPBOk5wzaLBXDIS3QNQuNWAfZ+sQcQTnAwL7jt7t9XtIkHBdgs1zi3Geyka3lIA6G8vxbiZz9o1A8iNpoVLiDzSGEhmW6/r0GkCU75mPEMXwIuOBxTIYraibf5ROK65TGG3GDz5N07PXTxDK1qGKdY1dOCiw9pnx/an3RbGdbYjkTv9lJNpp0OfNblZkJnfMtZR+hx8dZ59W1WiD1Yi86zkS3E4qFe3C2C2U94u/cC6Uv/G+OB7ZVru+jFCHl/K5nCzD0fQn4c+uNPoEyvpK58QBI/wm5vuLszznDChnp73qKHPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HW2MlkTctZWRz39nmD/nTbjenO9cNqJ5OKsAgyabizQ=; b=vQTst+hh902ioJxRf9POO8RP4fgsGEsyB9Nv3MEl+AMVsBrydV8JZ3EwiH0im3tf91/lyLjAlnsybY/zBNawzxQ1Bacfp+y1Dl8QQgmOHM9bmc3xIYbhFUefltTfRzRjSC9bwkkJagZg/VT1Kt/QOeDdqGzNtDVragjQNYE3LoeTa/ZNDb5Y8CtQtfYb3TDv/YwfmPzpqRATKICjT5LOt9XpxQaLlIY2qZV7zEHV7Jy2rUVBNcs1nhBkimL24yqMSfR1wwm2QpkYd2exQGeqR0FT8yJ19W83THiIZXv3tSWYh+qb+8MLS+EZDTTgdTL3X2eQuzbXnyIF/ztjHFs/ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HW2MlkTctZWRz39nmD/nTbjenO9cNqJ5OKsAgyabizQ=; b=dZn9aTWdLZDbfoWzqbKmm6IXQk5jcmOMnG0Ktt3NAEjN3iGcqgCTE4of2jwKIpyuXhXbCX3mf3h++kfJiBugVwIivHMM/4uzlbijuClaA1SiiDQHfAMfZ1uKK9sPEbpACOTVsIQhJnK6IKwdxeJOn7EhfOhuh48M7KoQdB0RnO/D7Tw9Lxz8uWkUppXVvaE7JYEosJkOWmuHDdeTSGZ/gX1SMudZWElJPpoJgQEww2kEXkav/lkCc1Giq/sA7Nxgl32EYPaoa6fHul8eLi5wgq5D5HyXHPSyYCilKdUYfuqGp25zHyaz/ejxa/sbmK4ZAsIhj8MwzcOsFJFhjZnh0g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS4PR04MB9622.eurprd04.prod.outlook.com (2603:10a6:20b:4cc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Thu, 24 Oct 2024 11:03:03 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:03 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 07/14] transport: Unset transport owner before owner free Date: Thu, 24 Oct 2024 14:02:16 +0300 Message-ID: <20241024110223.77254-8-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS4PR04MB9622:EE_ X-MS-Office365-Filtering-Correlation-Id: dca8abc7-1ea0-48fa-58e5-08dcf41b6e5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: D5hD6NQ32btTtp+ciVQn/++jLLT9HybfYlSKx4cxleMBQ+JTNIYEWnf0EFK43iSYPaRKgnEPswt9AxWaN3X0QO8l2x9PO0f4QkygYU7V0reU7NsPCzuJN8+DviBdTcO8GUdUafusrlsQR7f7wAa8eD84NZ/DTE2JKyT1LjCvtfygGFonVh/Z7tT9zw1D6Vy5n2rG0K3TwjuOP/ZJBQjRnCNm1AuZVM+qjfCa6FZdoxSQd5WTkCKYBJpA7jQXTdBeqft9msGQt4w31Mtu3xBA+PVj1w8n8pH17K7QsnIY8kbgYVAlexc907thpRY0/xgOlcqUpHOhZZnjcYARvCk293eC7M+60od+Wz48Z8ip8UtFQIjg9PYL3BYAJ63Hv3B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PM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 27wASaqysL7gKpK5tRbKIWZXnwnJ3lrXqCWsSrrHzbZCkwGlVzBdx11bYJrObx/I/A+wZS8oxnXtA1/pcUgcb22XLY7tJxec1mFV6agQNeTnZeFhIzgLGyz43R0tkqUgC9tQ2XkhmDkcix6+01LFMLmr/Q7fMlQXUa3BViHteVrF0Z41Yo+BtwqGvSCyxCB4XboHNGmVqsMSlyFydwUOXrrpputosK5aLn4l3z6WfpF5GYLstLta7HsC9gysca4YLBZj+sC7Epkeiazszr9noIFKd31X6iKLkZYpuRu/89mZLrrCrDtqVtRxLcNR9JFXQSWxAjTpEgyqlCiOAvQ0g6FoMT49G6hy+x0W/q1Odo7XPIOPPdcVb//ysZai/IMdO9Bn6+YdGieoFjv3GfDAbr/zljJfxO7joiJfIDxcKkeAZj1lVeZIHDeSmJh5xzr6VcKziBTWoYYQfgul0JI8V4XVZdBwHa4t0rWCF9OiE+9wJ0tVCdFb4RK42jab3jSo6UUp8KQCZHEYN2XHCOkBtxfFt0DDnD0w6ceNNdTAL7BMEVVKy+jLbXrBlXIKPHCoyi/TiY3yVWMZ1EpV/WFcgqTWa1OVmkhc4g4XGnJiqCIDC3G8/t3f0/BSi40JD4DDNeEWF2yvthhhpK2waVelJCx5v/tLa4pEK0UI4dT/XuDEpaAt7HjY8Jb12b1hHl5e7lKZN4GHnk3oqDwb/qRrJfByLEOshBuEgnl8mFp82ivPd+T1keAOjqt16EDg6z8Cya0RX0H1LkStt4IHyZyppdWv54TNBNWXvu4b6W9FC/o9So9981Qj6OTUcRl9S3BTXFtV3Lq/vC9nLOEHCY+MEDLElZT0F+KJ3sfDN6XabTa6Dn+C7Qb0MBoLiXb+HHiKYIgFb4AR/UMPsKnRxnnP6xX40WU1jSfVyTS9TKGA2vMCYsUn8NJlV6qRZGQAlkqsP5sm29d8JcRvDgHiPqhFXfaW/BUfWtaILguwz6jnzt1+ZSF+0I+4qhmCx+XihWZNgVa8Yq2L/SBnWMtIKLgNBXwatSAi2GBL0EPmFIiTeGrXPGZY8w5U2sI4erEdxeu1MeHc7sGamRCcYljVJlp0uVb0MoEmIczkSOSIQTmLRo5jDUWOUm50BZKj/oEreBJVJJ2ntTTJvpGeo2aKJ1qAXxh/C1+KV4uhiu7NjkipUYZQdy7SFVlmoidIgxC3QyGWysmuTEHboFgIFSQCHm0mbDN4cAm68ykKSBtX9C/DAwZ2/Krol1sywT+7NaYFhOdaho6A6BuGi+fltupTm6emWORHPTYP6+Twb6sdEpcW1YD/wJuFx/KaOqm2F9X74dmOAnAsu9+j9DZ20kZPCEngaMPnnTtoLr0lSTHtp8ubJZhRjthIpZrFAOf+Wct2pyO4s+6nzOihj26AS+kS3U2FVr9pysLy5qMncPgSAKBrgZEfMhdalRIWXW8HmwN/SNFD8JczRsXNYBvSQQaP1IjR2Lo8AQ0CNOrJ3Z+ALAAAg1Ok2x4W71vgScYGfZO1oK/cSR7LPE+ms6mPlzU67LzJmfguBb/fM9L5uRBQjgi/iFjAA3UMeslSX5IBF7cpXvuKwoWN948WP2FnzlrQQM7/vA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dca8abc7-1ea0-48fa-58e5-08dcf41b6e5c X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:03.3323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VM1QWtwPMxmH57NekpRju2pKhF3ZnLsHu09GooNdYugEvhgCPmwRVc3vy39Rbmfpp5vFIWf7H2Qrv4fFjLZ3EQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR04MB9622 This sets the transport owner back to NULL, before the owner object is freed. --- profiles/audio/transport.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index d71013077..dafd1c471 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -287,10 +287,15 @@ static void media_owner_remove(struct media_owner *owner) static void media_owner_free(struct media_owner *owner) { + struct media_transport *transport = owner->transport; + DBG("Owner %s", owner->name); media_owner_remove(owner); + if (transport) + transport->owner = NULL; + g_free(owner->name); g_free(owner); } From patchwork Thu Oct 24 11:02:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848780 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 804141C174A for ; Thu, 24 Oct 2024 11:03:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767790; cv=fail; b=BQfvljfFeH5NNfwHhyrowZ5rVJMMyb+Mr9OTm0MK/B4UiZQFKonhnQvWNN6dDdIk+UH3u4qlgauGZxXoLDQY3ejJQ+Sf8F0B8NSBEF0cuvzkTwPIDDZcWEtbnOyPfo/t/N/x2yO2As6o+7rf9fi6BDWJB0aaYaNVQ7AsUp30/6o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767790; c=relaxed/simple; bh=ZFFXxRCSf9Jx4GbQa2m//6EfaqXcj+5DDEi+eCi7Slo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=RtIbm76BN/clRMiOZDZOfS6RMFTBxS1YKfxyWPEQBYIx4bVk3DqNL62z9OtCRsuie4z8zf6b7bVjgaSIMLlVe6kjxBn25MT0lGwhyb5kYHS3OWEOCbNkNcDmoO5oDZb0kdXs2H+8TI2Fr2Ts6qeb6utm7YrM63XvDBntk+PLjlY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=HhCaDyIk; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="HhCaDyIk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CbB8nuNAbrdSXjSVhzMPPE/EcqzYhyVyTAugQe+LiLWLspgsfVTyYsUUdws0nwmH/rDUddyswsz7usp736pGIXRkI0mzh65cthYm2SEJBjR5FCGo1owtZ0jx3dnPmpXxahzEw37ga/n3TjMiWdziM9I72xN6QGeZDEDKGYkO4gjrqgytmAcoTdljOJeTyC29Zg82VMNoRD2SSOEtYIb9hx1dgDHMgMWYbpDATwWBTFiCVd+7Xr7ZR1MNwmHl0WZcyyzNq5Uz5FxixWK8PNxOCPQieQBKwRHBEGIDWmuoaMLBXIhzXKQIw257nE/F4ktzLq6nlr0bFbS1DljL9z0G8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E/70KQ7Y2mqGgTXupXPGpsWqexp8myFutK+mNYzAWdU=; b=fU3nbXmjNVE5sT/iuplNyde2Up/ZD6x/mPrMlPo9RvGazBIP2+Si0sOvKLtebG037mljGO4YHdFsyQSQnDLLk0h3G5qqEBgFfZNnYGQ3wL5lpxjXrX3JI0mzEgHfWjFBOwdytQD1O0hKS6OQuXxNkpe4xyuKYuGo0cmJgvj+KV215ysYDncYxjIg0ojyntEeFfLRqpZlAl+GKxPG5ctgqyzLCkh0iXqdvVvLNMAb7F8sATBt7+DN4CkMwGOXmsDM/wPXsZQnR2QLDmq8sYsB+H894Mu6J3EkIz1I3Kf7IzIrV0Kl76Yh06+Q6pPZ2lW7iLKC+XGcViPpXK/hqgLgyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E/70KQ7Y2mqGgTXupXPGpsWqexp8myFutK+mNYzAWdU=; b=HhCaDyIkQnrWkjrv33ZDR3RM7bR557mcI01B4WjAp8ddIHbJIWvNFh5cf5AdRVySHiinnW9SU85PlrD+tRbOku71PM/8xMqczh0S+z+oiML7tQpqoUPu/B63AkIW3Y6tYczcXRGfSJh5mPJMyGl9Cqe7MEA//rnc/jZtQJDRIlqEVeliSAZsZOS5JYKyLmvt00HyW0il1Pyz5oU78advTBDUI8vaor8Xvx+5e2XQXDBLKW3QwFxdey8Yih/Qs/IAYEz6gg4eDJ/Ef1TrdAaWn1dWeuOtq0ptVvwN2ATXgQff+UAZi6rErCDbnKHj8SlhBxFc5+stC9g/yzeENvPkzQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:04 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:04 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 08/14] transport: Add Links property for broadcast transports Date: Thu, 24 Oct 2024 14:02:17 +0300 Message-ID: <20241024110223.77254-9-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: 462c239a-c986-487e-7938-08dcf41b6f34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: HxYeRwCqRmZ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hA1GH28Af87jUATQHsKqoDEaKZ/7XTvbBIgaAsFtfsFNCpAQrT90g0tgM8bWRvWGehqtxfHJfl1NZLqGOYKZDHsHnkc2wL0rwasTB0AP6TkwyjNozhvO9V4N+iPAIT+WK4Bf0LedqVkPzaIDNVhqfn60JjSuEjqlg6Y/L2x80UeziWxdQ/fNQ14zCJGqeUTeJ72HnXMqGv9YxBaA5zhRPs823MqxiUqnNnB4VecaPBLIbmW+T/DXiUHe9Xto/Iuzgltoesh7N8QHgG7ISEFgdnBIOeHvTMh5I= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a1V117PotcbwDSyWUCyOSTKTgROTKJqzMeApJCTT4pcsoyNhOJ9Bd386IdmDpodfsndC7SFhAQmm56hYPqraldkd1fMn+4eRp6i+QknBykWNX02f19hJ3+NuDFgLhMMs/pEXauwBxwsKvqpmrlbVTP2gUUpdgZ0mp/TtmBf46Y0jtnPxe97aYzcysWUsBaTZEouCk2ej1jJtrcDsySHwEn7S90JSRv/PsO5iaPd49pADnbTIBhEqqdTQSm+GLIFf9McR5y/LM/1A20RnCfsf0nLumZN6y0yp6/4UUMGbvFx4NZu+cnrTfLZOHGb3GGCeqvGnSuDL5agfcof4MeDEj9/RKrZiFjqip5XNidmmD3HGRaNqnhF2jMroJvCGyGWbtG7fXiVqGIHM7TqqwN+MUe/9PcPb3CixH1NCTSFi6Rbc0Z3koUI+Q04t2CHGd6AVP+9aUlSDpUIm9Obx9+XKNaz+HhWVWBEXdl2TkXd7mm+DGPAv18jJA2G56Jw8zvmxxzBsxqiSShdaTOjDdtbB8Mr3r7gtoh9jxEi4VCrUXBm+RpMabh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Network-Message-Id: 462c239a-c986-487e-7938-08dcf41b6f34 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:04.7786 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: B3mikXwvDGFXhL/YM98vG2eXTJLnLXzdF2q5EMn0gLpwLZvm7aUEsdmqX4DrERB1P17OyNHTSnxRYK60vrBs+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This adds the "Links" property for broadcast transports, which allows upper layer applications to write and link transports together. --- profiles/audio/transport.c | 62 +++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index dafd1c471..b3bcbaa19 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -183,7 +183,8 @@ find_transport_by_bap_stream(const struct bt_bap_stream *stream) struct bap_transport *bap; if (strcasecmp(uuid, PAC_SINK_UUID) && - strcasecmp(uuid, PAC_SOURCE_UUID)) + strcasecmp(uuid, PAC_SOURCE_UUID) && + strcasecmp(uuid, BAA_SERVICE_UUID)) continue; bap = transport->data; @@ -1142,6 +1143,64 @@ static gboolean get_links(const GDBusPropertyTable *property, return TRUE; } +static struct media_transport *find_transport_by_path(const char *path) +{ + GSList *l; + + for (l = transports; l; l = g_slist_next(l)) { + struct media_transport *transport = l->data; + + if (g_str_equal(path, transport->path)) + return transport; + } + + return NULL; +} + +static void set_links(const GDBusPropertyTable *property, + DBusMessageIter *iter, + GDBusPendingPropertySet id, void *user_data) +{ + struct media_transport *transport = user_data; + struct bap_transport *bap = transport->data; + DBusMessageIter array; + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY) { + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InvalidArguments", + "Invalid arguments in method call"); + return; + } + + dbus_message_iter_recurse(iter, &array); + + while (dbus_message_iter_get_arg_type(&array) == + DBUS_TYPE_OBJECT_PATH) { + struct media_transport *link; + struct bap_transport *bap_link; + const char *path; + + dbus_message_iter_get_basic(&array, &path); + + link = find_transport_by_path(path); + if (!link) { + g_dbus_pending_property_error(id, + ERROR_INTERFACE ".InvalidArguments", + "Invalid arguments in method call"); + return; + } + + bap_link = link->data; + + /* Link stream */ + bt_bap_stream_io_link(bap->stream, bap_link->stream); + + dbus_message_iter_next(&array); + } + + g_dbus_pending_property_success(id); +} + static gboolean qos_ucast_exists(const GDBusPropertyTable *property, void *data) { struct media_transport *transport = data; @@ -1295,6 +1354,7 @@ static const GDBusPropertyTable transport_bap_bc_properties[] = { { "Endpoint", "o", get_endpoint, NULL, endpoint_exists }, { "Location", "u", get_location }, { "Metadata", "ay", get_metadata }, + { "Links", "ao", get_links, set_links, NULL }, { } }; From patchwork Thu Oct 24 11:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848782 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29B3B1CACE9 for ; Thu, 24 Oct 2024 11:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767793; cv=fail; b=bEXjRuXs6vnq7s9sy/baQhqvBmyo1WeZbrE3PpxTZnYMAwLXqsfR28nwWtD1tqKDkK8EQSVn109A5rJ2rihfFCH+aea7hTpSKPtPGInrB/QKrlWC8bEN2ZBcVKefESN3kXRY/Ttv4fjsm/nU9kYD0S7+OoTBy2F1CnFf6rA9I6w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767793; c=relaxed/simple; bh=riagUk8Xxr0Cktzk4sHScUpvK/r5x0fMe64DRNDzWgU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ZpSn+Qukpi2/6YCtGqolbFe5tGU6l2G81FjcsZNQOnqArMA3Y8L9IvsXQaanslMxFtNNmTsE//i4XY54wqKpTEZXcGQSHeo0VrwOpyu8ypHySFycqzZj0+rZk0MgS6W7mJZ1kO236VEuX+WObPWB7gKSKwNkFiCNgpPyk2WRrN4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=bJEGPmbL; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="bJEGPmbL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Xq7zjcnEW+VQJjdQXtmaMbXX+t1Y32QhcJQhtXcQxXY7eJPab+6UAKNnKzBEDguiZda/c7AU34M+MnjivS07enIfyJQCqkqWwFKbTOH2pHQnFrhBsannGGrHBgFmnne4Xg5C6MCf6MTEEYyNZCLZ2z3+MPeQGV/wRteQXSlR2qNHlLddPlYEExnQPArMM6L95mW+H6+wEcYLiDwfYDdEIeEk+pgD3k8WyaPvfkKlU6hbOvvPyuW1AwPGoZ8A+qVKqME9IgM8HHfaqToxk8KFcYjZjYW8PhpT3hejrcMjlnhfIDjbE09MoLLyY89t2lTZ/A/qeM8obLoLoAYIJt9eiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0NhqylQQdv+u6MmA4OBs5PD9do0FH9Ogit451oRFxG8=; b=ipNEs8MFOrBj41NJrs+Ft3XykHYD64e9H3CVe9sx+rlHY3/oKkkrYeO7iPgXdoAyB+fgaeaifpBkmc5j5PFlyG73+iZDPSX92S8UvfUxw5wzx1Z3OP0xNhJO/fMEsmA5ilBtFdkBRe/AgNuLuuFnfD14EkR53mNkxGKTOYxSfLEUFzhZjeTDqRXi+iNm0tVWCLoxxk6HVnX2qAdsoIotThawWuMo7/noTe0iDrffVuMqgGre6oLy1DUV7qWkQBvBp6vjtT5U8YZFn3eA6PnnWGg73hZIprbb5yioMNYngOaIuEdAqMIRxZIO/ojHIQqKNGTXMZZtwI0sjzySJgeNxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0NhqylQQdv+u6MmA4OBs5PD9do0FH9Ogit451oRFxG8=; b=bJEGPmbLoUhlbSHrK/vPDyBy/g3QwsCCIZhNlAutp7plnoiszyCRmJTuQx8/VcjTnYS8HLq7ebVUMsX9D4EL2RmrFIEDhqQ8NtouBw4Thj/1TSk6w580S4CJPYWS6vQa0OFk1SYSeey1fhgWEZA5uFifzWqZUOiiRL6P2Yfozfm3rA92J7YduCL/EJ37uqeOi9eGjof5TSjNse/FYmwXfumH0sAkOLQFxUrofmfb68fV4kS1Co6rWoY/XZ/ZKk3EBmqBAG2wBUx2XQSSQ8Z2onQKDkJXCSdXGomZnC24tOVvvkm46Hq4iscmSYjuoDTx19MXeLPtDzwLtZLIk8+E1A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:06 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:06 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 09/14] doc/media: Update Links property for broadcast Date: Thu, 24 Oct 2024 14:02:18 +0300 Message-ID: <20241024110223.77254-10-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: 52fbcb76-b0e3-40da-daf3-08dcf41b7011 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: sWuOjT0ZKuK3NpMm3mzA0DS3qdtKd5GXHw83Z8IIGxdvNo+jFsGQ1WSlbhqQO8sMAE3PDbXTM9LMeMz2iGwqvCzouR3r2unLlgbc9Hrgakm5F76DuC7/ebYjOYhoLLZ1Ywpt0UuRy9qB4z9dkuP+h6FnHUVq8b1JKQP2U1B60TP7JQgk+0UZoDEEn93g87+C480dJrDgO8lmWd2ugDlnEsy/RR84Pgv7jjBm6Zfugenj/dZz0heKgwTo7DQVHNmOadgRYzM9rN525qD+/A7JNJy5GiTDh15Kxnu7TImevr1feNMlBVGbGTGH9U5lHxv0DTvAoAnby0XPLcsHizUwEHUWia8y8XsoYafDPbjLGQpV1B++96JS+5r+ZJHmaKih50et39jEGaYVpEUf4+WYFiba+HcBvcltUXgTo4movZLMjIYh32EO38+Wfy7oM5WdrMVbGqOubvr93EClHlcvC2KRtgRRSiJRXlEOX1+oBFruH4oUEdXtPbJpzs9BSvj4Q7ZRNqLfEbGWgG2lrR5CJ179tnyIuGUVyUMJR3RTGrMcIe4TVHqLUBbqgprOPpwCo8O6obs4aEL5mvcPkEwgWV0GhacIO/BvC6YApE7buIxciJcBreptESavIxGmdwQwdQANz/HdVnm78rXQkzb+zlkU7dVV0NGYQG4qBwMAbeWkcqLx/o+dVSgU05Kkmcpx/oW7RKDBQHuKzmseoNscYYlh6lO6CQVLRJif5gVXXKoD3Mylo9CvMBgY4zAPPobDi7p3fcusBnYG2EXeoGQxreGcxEACImMtg77MqXJEr67PiCZvv6Ao7LLNO+KXrrLqn04qM0UI9rqNvRONi3r8EyZEMzhaHTY7yJoTg2PKwrdtkAPa0q9NK/c6U0wvSX0xdbsne3QK1Sr+lB5TsPgIHfMrijS6I1jY09Of8MRNjXDuzwiBJwXg3pyR1VmSSFJR7Lgp4yOcc3XlZ292GfyApwwV7pyp5HOJQFK4f8nql3Yt0aH4lL8m2xFLGkIn4shOfAeaNH8B1MLwM8Yq2yN+68Nhuzq/csNb0US2Hr3yOYHCppQ098Q3LhWW4dd7whFAlTm1fZmx0jL7eRh4vPRq+69cEFa06UwNpn/B83XKNWf9g9FjygPV45KC3FHdTtvCpFWy6lUbFj9f46Mu/L/SecUYJ25P/y/wABonEkTuprJL7Ng9L5i+iA8cT5zcKCZrYdR39viVPCN7IxamSrljEKN7dSVnXAJA088RKPnHhe/BwkTVRtjlXxUnvVjcP+dP58Bvx5TIpD8MMpJ3Men+SCY/mpDWNgQhQRbrXvUIDBVaP6rht5DyjTD7/SNPcuMSe2oXyUmdlgiUtMG88W9S110NQAab+fc3xWA3Gq+aOIE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mQ1tzCsf17V7QhFjGDdeArsTYp6dqzYwFbvhEom/LzcVREeoaLvrzzzM6A16A4O2iUkK2x7VnlEGI7MNSn+5VSEQzcrkF6xW5t/SS/Dp9QUS6WuHse1wTX5gDAEFhpZaFHMC8XINsdyrRHfNnfc2U1b3QLDoEpD+d692ETeFiXSFfwOFG7Irb39+7VFA7ssuZaslhGrh9cJfy/pK80iwMls7Gc+0MCMjgPA8zGW/hOaQeZpgJx4Us/0YSRwW4dK3y1Dd5fgGBK1DBTdm15ut8mdhVG3kuk0dr3hGlvonxQugZLLSRe5qBZO+Gg0ruMjF6SovSdWI6Nsg4L8rvf08LQ2zv4aPzELwyiPx6Ljq9J8xh2iblRm3Tly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IQ7/V1ouxwgv1/SxolSohzAQYDxZVGi6NsFeRO3QMfpOAkPAGNBQnYGwaG9sWhrRZeACKBpkr9eQ5pcEMBEQlyePK98NtMs3WpIGodxcinK8IBCy07TYxhM6z/VpdEH+0CGLwSKKqq43SYsk7Z9JGb2lM79kj6uoz9+qVA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52fbcb76-b0e3-40da-daf3-08dcf41b7011 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:06.2422 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UAcQ9o3aLjU9cfLf7JbgCTio9XYBOks7AZG0V/xlRpS7Os0er7BdZMc15VoSVKA5oz1yq0hQk9n7qP9zr6r/bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This adds details about the "Links" property for broadcast. --- doc/org.bluez.MediaTransport.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/org.bluez.MediaTransport.rst b/doc/org.bluez.MediaTransport.rst index 4d998b2a8..2173e0177 100644 --- a/doc/org.bluez.MediaTransport.rst +++ b/doc/org.bluez.MediaTransport.rst @@ -149,6 +149,9 @@ array{object} Links [readonly, optional, ISO only, experimental] Linked transport objects which the transport is associated with. + For Broadcast transports, the property is writable and it is + not optional. + dict QoS [readwrite, optional, ISO only, experimental] `````````````````````````````````````````````````````` From patchwork Thu Oct 24 11:02:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848784 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFBAC1CACC9 for ; Thu, 24 Oct 2024 11:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767796; cv=fail; b=GW1q7OQjOat7HlwHe1Mk5vndiIYqqHbG7a5GWN5G5xJFuQvxB13gXaSJoasax+9mL2ugOSlNIsbjRCArbPJ/ySAVdrTm/ws0xQzcrYcuXse/RHiGdGxkSy6cJ+jpoYuU/X5IgQ/QfPGgALMV+fqfGVNaWBHAHolVdZt9zCOM6sU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767796; c=relaxed/simple; bh=DBjw1HuhG9Hc1TTXpFthYCiqbR6nNuTPlts6WlPno80=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=t76jw4AwSO2rYXOhrie46iFi2u/Lp0QyZdcale5uk2LcLu1IgOuLNO6i3Aj5kbpTFCEnjwS6so4G/5PytB1euKbw0CuH7I5zfoYriPftbYeiMghB1Q+478mPFFYsrDMc4CjSCqJX7Cd2efx/bJ4Jb0Fm4twfRWn7UnHa3NxCG+w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=NasWlrkY; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="NasWlrkY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F3/OrAAMG3bGE9TD61bs2Xr7/iFHiqqGehuUIN2IpJf0gGfGibAuzQO9eGb9qEuN3OxhsA3pK8TstfG3gqGnlwE6hbo9RXFMANkQSmjCFStJm3dLGlRayhl2VOFtosaK8N/DjJvOvgfsqecxsE5+MnpQaFcUQZ2YQD2uHcOg6JtHYbHitu3j2M3wRrSHoY1I0a6x3SwvhcW5fAwM2RuTt6yXVhntQ3kkICbHsDjsL6ZeTvNsDPZMU2WpAVEZePB8Re8tse8lINdiof1wUhYEBwlYMcSZl5HueG88y1wOykFS1yZbrt8DhYh5CBiJpIKt9X3R0h4d6Y9qKGqKaIDPOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kwWf7rVpAhkvNGcoWH8mWav+kcSOW7QebguyLx4xXQE=; b=wS3FcxWA7Nzn0G2DsIgIXRgnyIlPWBlIDk8Iz09Ndsw/BAVQ+zd8zXEWORps749GqJ67YD8K0hIBRR9vYll6/kq4UcHWLvTIo/KOLqXufbZmjgad7GmO2bna1lBjM3MxIEpK+ku1KT3M4BncHO82p3+tpQpkRqhkNKxQd3/nlfc8TTn+udGCXfnp/40zhbopaDAykhzd6gM0QzL2vfdnyl7ig7hZFw0T5+dFY8F7Fbz9Ou9qr10L3zvupSG3Hg/Mkh6gDdG5HFshr2z8sAaL15NkpvX6Q1IakLPGDwF+Bs4iftjV63V4Qw3U0PnCMdcmxzyC0HrkdkSvW51qAZczrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kwWf7rVpAhkvNGcoWH8mWav+kcSOW7QebguyLx4xXQE=; b=NasWlrkYiEDMKToQ8Ruj7DT25iEyZCnww6d2AfC1NMxGDOcPYweA+0JQclngWMfMwqP0a+1/8zwlWI1Ya7mpUp2niBpxHNQN3vyO2WmHacZoV2uLk7i4H2XfN+tLzuV3JqWbLjZ47eBKgg4gxuq4Kv8g0cZ15qnpg22RmKX5NPI4I9h8G5ZDskvDmGan/bdSLOZ5hYwgNonGAOtF5qEgU6QeCeTtpvV0tcOdxJ9go+HB398XpgTtNr8kWIF/NPlDGNegyWCFjFK7u8PwGdI0vrWkYcLnS+25kDXaAEgChkXfFvm/4VyjjLh3pOy4cUIp1U/o2v3EfFPecM176/0WsQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:07 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:07 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 10/14] transport: Set bap_update_links as transport op Date: Thu, 24 Oct 2024 14:02:19 +0300 Message-ID: <20241024110223.77254-11-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: 87f3a239-3597-4807-ce87-08dcf41b70e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: 5xiMTA7POO70Ht2wgJWS0VQsp7s7DRuRK/GUjHi9K9wL/qZ/orjn4s5aHHTl03TJfDgVMwDNatMjgrgN01KqLDAhLIw2N34gkCanIap7RUVuic652TJliPTfzZqd3TEx9kylcniBw4FUQJW+3ukQC80wliQryeF0vcmQ6+PLjHBZycRj4wgOrvQ4/DmHRDoNmzbkJo6zS9GimrRKMvLukdiTCrh/Pb60emw8f6thbBBPHpgNA1W78zqtz1V1myJLFXOPdDGC1tB6dbpN+jcz7TeuwbdYiGHHeA2uEmFnah4jfpVQmRapwtuVALhdlqN8CbzqCB0FKT4bV06ELlHY+YggbVrPQ/KPtecKYmi0WxPqfKGaHtMSriW1jYO0pEcmhRZQ9FAvJg7PftNpFc/RW/O5cee32g7qGM7jRXlAhe0Oqa5jx55yS4g1A+l37xEvCDvNpbv5MuPLKQpKpDunuLwb6jFo1SSz2sACo6XTKaD+NGl8L7cv6lDb6Md2sPVx9009rQ6nSPTO1ktaym9KB5/MxD91LRsN2qeovu64uUqnOjCukQvWXdY9DVaoxapGoFL9nqorJEgst1xCKClH4VLSHd9WRPSP7MdWCsDzlqnBi70mPT/Qz0HS5cR6ttm0YonsRZjWyVM/8QgLols86rJPZThWbu3rJ6GPHf+mvIWKD/SDygM7W0iqZv6TcytXvtcXQTTinGIWdh4sKQOe2gxF9HJXe/LJIUwhQdoAMo3lKSGQbAXxSPkcyNCgU5FS+OLc2Dv80siY8PcmUUdSL2fi8hy3vc6dQV9Taxe7qifGYeyvTsMYQpj6e3VyUNYzZmdmDpbIZH9zbxkF2/sVrrKEeMboB5/pfumkfeCY0u0wISacRGwP+DhyyZINVO2Lom7uRC+yStx4ukG0V/N9NaPz1EledqDEYMd+YBScf6tBe5vCqZWAh7+w+9gKcyCKh7T3NkzUAI1QBsFMgPf/YFg5mybqHOJrMJOeM/OT0pxTYjXvuw82OgOT2sSxoKuWhDxaX6TZihAp03gfg0deXPEyei/2pYV22lN7fvKg1Ke9fG45I5+TW5YxtETfWeDFcgnC4sBMCRGyCrS5R9egNl9fv4iDITDaogtIVMnubxiWBOnD3x1SjN5CSh6HeSW/CPiI/UMiY5g5L1P0TiNurGiS6RtlAz1idLG3ya0FLR1tgK97h7NP8xSHjr0/i6pFFUGSpEPCkPbyiXMkkEL+7X/2UZcRduXAIImAc9uEM2FXGM35SFRPURb2Zh2/2noe5L8QGEVjY76ACCVEduAxtVN7CYrTyRzTsMJJyvmBxTVgf+Z1vwORk2uEIVh9S1aWtrqEjb3ojswq6iHPGo8nyIrxRPvXrQvdPjav5gixNB0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eXRj7Ql6Z4joKw3/aN1VlaeW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WbQSZoB8Ruua0sKM7cbYAlRyIY+BhWOoqhxZipqCg6fD/YYfTdxYUERyigmxYSkrcRbdZvC8+ebzpGUyCYmCN1rpMPTXunRB86xEhHhL19iShxT0X+zFiqkTplQY3E0x1nE/Ce1FbE/GNXDg7ofv8ov0HDd4kwSaefGmFRkRe8kd7xs+/XSqD6DdeSmnU0DJTIY3YFP3+pbXLmhb7XjdvfuLpThY4V6xN9BQcrk7rVYL+m6pKDCsYjEZx4C2/5cpGs/Lf0lv4sI41gM8HkBhnJvZY+7sV+fO79xEXkvCtR1hQkELadvWjFJ8Imi1hbRy3C4H4WdwjyW5Q7IIeo6hTlew9iaelvnBv6jTMm167PbCMSXtCJRVnS9/nhLMWmq1AFhqqDwkb09nVulxmeInhZAxfF6fbifwT4oriRwhwJgk+C94BeN6F1AZJ3pCu81rnyYAyN1z2j3UXHLYk7SN2sHF0ZXQ/vicvYUaD4UUBmN4668YPdYOHIu9HynzGvt0Zw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87f3a239-3597-4807-ce87-08dcf41b70e7 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:07.6801 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2vNAmALi7b5dWPyIQgL84P9FTV3og9w33kqbQ2D1Zb3tN/MEs4p1wqahQsPbYrwepLbv27FTpMXZKUGmVXC4Lg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This implements bap_update_links as transport op, since broadcast links need to be handled differently for unicast, which only allows one link. For broadcast, the property changed signal should be emitted everytime a new link is added or removed. --- profiles/audio/transport.c | 45 +++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index b3bcbaa19..2f5ff6de0 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -116,6 +116,7 @@ struct media_transport_ops { void *(*get_stream)(struct media_transport *transport); int8_t (*get_volume)(struct media_transport *transport); int (*set_volume)(struct media_transport *transport, int8_t level); + void (*update_links)(const struct media_transport *transport); GDestroyNotify destroy; }; @@ -1628,7 +1629,8 @@ static bool match_link_transport(const void *data, const void *user_data) return true; } -static void bap_update_links(const struct media_transport *transport) +static void transport_bap_update_links_uc( + const struct media_transport *transport) { struct bap_transport *bap = transport->data; struct queue *links = bt_bap_stream_io_get_links(bap->stream); @@ -1651,6 +1653,30 @@ static void bap_update_links(const struct media_transport *transport) DBG("stream %p linked %s", bap->stream, bap->linked ? "true" : "false"); } +static void transport_bap_update_links_bc( + const struct media_transport *transport) +{ + struct bap_transport *bap = transport->data; + struct queue *links = bt_bap_stream_io_get_links(bap->stream); + + if (!queue_isempty(links)) + bap->linked = true; + else + bap->linked = false; + + g_dbus_emit_property_changed(btd_get_dbus_connection(), transport->path, + MEDIA_TRANSPORT_INTERFACE, + "Links"); + + DBG("stream %p linked %s", bap->stream, bap->linked ? "true" : "false"); +} + +static void bap_update_links(const struct media_transport *transport) +{ + if (transport->ops && transport->ops->update_links) + transport->ops->update_links(transport); +} + static void bap_update_qos(const struct media_transport *transport) { struct bap_transport *bap = transport->data; @@ -2105,7 +2131,7 @@ static void *transport_asha_init(struct media_transport *transport, void *data) #define TRANSPORT_OPS(_uuid, _props, _set_owner, _remove_owner, _init, \ _resume, _suspend, _cancel, _set_state, _get_stream, \ - _get_volume, _set_volume, _destroy) \ + _get_volume, _set_volume, _update_links, _destroy) \ { \ .uuid = _uuid, \ .properties = _props, \ @@ -2119,6 +2145,7 @@ static void *transport_asha_init(struct media_transport *transport, void *data) .get_stream = _get_stream, \ .get_volume = _get_volume, \ .set_volume = _set_volume, \ + .update_links = _update_links, \ .destroy = _destroy \ } @@ -2127,22 +2154,24 @@ static void *transport_asha_init(struct media_transport *transport, void *data) transport_a2dp_resume, transport_a2dp_suspend, \ transport_a2dp_cancel, NULL, \ transport_a2dp_get_stream, transport_a2dp_get_volume, \ - _set_volume, _destroy) + _set_volume, NULL, _destroy) -#define BAP_OPS(_uuid, _props, _set_owner, _remove_owner) \ +#define BAP_OPS(_uuid, _props, _set_owner, _remove_owner, _update_links) \ TRANSPORT_OPS(_uuid, _props, _set_owner, _remove_owner,\ transport_bap_init, \ transport_bap_resume, transport_bap_suspend, \ transport_bap_cancel, transport_bap_set_state, \ - transport_bap_get_stream, NULL, NULL, \ + transport_bap_get_stream, NULL, NULL, _update_links, \ transport_bap_destroy) #define BAP_UC_OPS(_uuid) \ BAP_OPS(_uuid, transport_bap_uc_properties, \ - transport_bap_set_owner, transport_bap_remove_owner) + transport_bap_set_owner, transport_bap_remove_owner, \ + transport_bap_update_links_uc) #define BAP_BC_OPS(_uuid) \ - BAP_OPS(_uuid, transport_bap_bc_properties, NULL, NULL) + BAP_OPS(_uuid, transport_bap_bc_properties, NULL, NULL, \ + transport_bap_update_links_bc) #define ASHA_OPS(_uuid) \ TRANSPORT_OPS(_uuid, transport_asha_properties, NULL, NULL, \ @@ -2150,7 +2179,7 @@ static void *transport_asha_init(struct media_transport *transport, void *data) transport_asha_resume, transport_asha_suspend, \ transport_asha_cancel, NULL, NULL, \ transport_asha_get_volume, transport_asha_set_volume, \ - NULL) + NULL, NULL) static const struct media_transport_ops transport_ops[] = { A2DP_OPS(A2DP_SOURCE_UUID, transport_a2dp_src_init, From patchwork Thu Oct 24 11:02:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848786 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A63AD1CACDD for ; Thu, 24 Oct 2024 11:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767798; cv=fail; b=pvT+gtxY/OQ+ahKA438/QCuideaX8t+Twx7oSYFuSrDq3mRu6IUNm5lCiA19xmHdsXDmUihbxUf81ms1bhhrv25E+o/t0vwsM1A/bI0cC+lybmXuZMq+G8XlKar9ggfEx8fL8uNMrnQYID6uyj/pUTO2m/oV1/V9AtGCpBpGwik= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767798; c=relaxed/simple; bh=DgyPv53iHdnTPOrLt2LwIbzrvEY19ZYNPyeIZR3Sbas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qa3fixYBj0MhJJhPPRtF48AtEgcHwyR/uv8Dm+kgzeijBvK50EOeiQ/QGE2L9Kj50CQ+nssdyNC1tX5D9M9MUs9kHrKjAhpfsM/LDcUWdaQCMXjB74NO2oWEaUUIsXrhimCUBQY9pxLz63TVIlyu+kpvPIeDEsRCGh839G1DBxc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=NWxRIVfM; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="NWxRIVfM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LzVAHerqfJmtjMetaksexsRoOuvOHiTG1N4ZZUeMpwIv1N0NzfAOnJQK7KTR6RPlA3CQ9EnZGWURjxTY/Y8pRtO2bJvwsR3m1x0buuVTKZ+0qTBpu51mVAE2fEn75gtaA9p5h8wIOAU1QjgrMiFFi/YWwGEXcrPQ/D9UHeX0gYo3vdYQY+f8wRUbEgm5HCcDCljdv5YH7jcFKwUUVHkMT0dwHVmXv5DR4W+MFzO3XcW/3cHW7wxuJrFwCtlsAWsXfvHmOPXcGmNQhsC4k4aMMtDoSGVsmlQg25DHMpk7U8vMYy5J+SWDYLhc559mC2TbSTuC+MDTPF3joUINxTs29g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=StK26AHiMKpFaYLOHxcQCIgxucrxIA3twyNPzY8kVIM=; b=wQaMDigr/Yznr2gA8RqYJ52PzzAbD2prTSkVLxNg+v2LkVS2SAGgaf8kj//VhJFIb6Y9YmRIKJTqqJ0dakUyfF2wviooJVnexccTEnqJWKU6rD99ycu43qMQe/bzxLNthzAvDv8rKbkSUBrCexqNXyxWoDhwYbERJX5qNsmZhC24kqlqKv+wa2qmGTWqkLS9pCoSkiQj8p7JEYTc2Ee1Hsg/k6CSsXfvaVcMwsf1dnuuAdRbrekj/UMfFXdCXVcZoxo4qou3n5qGacgOkXj0DExOpUtnwbsv4KVEHC4zgl7my0lv/5EHZvPZkkCab0ieQeTXaqRzDkVps9mmByo9JA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=StK26AHiMKpFaYLOHxcQCIgxucrxIA3twyNPzY8kVIM=; b=NWxRIVfMnbNG71ZZecQ0cMPAS81we9pTSMEfoKAWHvM5z96dzDizNkYbLhzCvaoRq75u74A3iotTw+upZ+G9sUdQmo/d909RFjAcnkX7RtDpx1A8No/kfNlwC0jPFweAcpxMb80DEIep4uvYiL/az5T9TES4wM6DFvllyoM7ZXc11KWuvrDENUjq6TDltb/bbNw8HA2nDMmbw7/bQysoC9c01KES3hxA97dtZdp+tSx7hCdvZQZRoq8ALRRk004fZE+XSxunVMMyUBu0sB26O/cvqIRUh2Crgb2VWEKhj9And/KNzf7OFJO8cSi/AmcV1u6AJmTVwurqUXNBX9cV8g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:09 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:09 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 11/14] transport: Make transport_bap_set_state part of BAP_OPS Date: Thu, 24 Oct 2024 14:02:20 +0300 Message-ID: <20241024110223.77254-12-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: fc14cf3f-f16a-4607-18aa-08dcf41b71c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: ZkQd8p7DIou4YyYNjpV/VBGh1BDLuVXEmsK4p1xjSWG2xMrbEwzdRYmptP0nxULSH8YAVcG4thfnUwsZt79LcQsURY593c9Amu6DG8y9Qzcvb4zgyz2kqFYnVXV/N3Dzc3pcxuzot1SrCzmZjlUL2sgl5Dk1yuGlk8uM9xY0MV+hgPrt2zT118552cl5JgKNuZaV4E9QnhrWgQ8Hu7ntgdjTKlJjgROboXV08qPy1t+cb+0DPrEkxcVJtey3eC59agCjCCOehFfnTGvWGGojmVOyBM7GWNzfgz5lR5ED+ycwGovA/dTny2tqqUnFsTb3Hw4+L+uR02plSgn3BraJcWDxd8qWJz6hJbXU6jRkUJfPT3k3e5ifQ0BSXuFLBryuY9yI3NDag88I73Zr1o/rMGdpeah1Rgv8aMxChmbky0bow5MPD2nEhocmbo1mmKZhddiOeR/8fs3aZEAtvyXmEJbtlrOzL5iD3e4yN/52ja93tCwLHBRPCftUW2D0aHAfg9HDBqCyAi55MAzNLSzHY/7Ddg+nAiBjE0T2x5bF08wH89ESZn08Rj45dM8A9zO30KSKQT6ddHKWtpe1sBDjxhDwqwM2rzpUXwq8WZF/zEiv9Ir+M0MBfRh1mTQoF1vdSL8GOw4LMzit3kzyHvfrYFPAysRFO6BqzWNpRtt14cWKQZLQ3ZaNvgQxZeX9YXgNW3UD6vHZpVX4UYS9z9HLB4kilCfZ0OSA4rgzKxhRWATqzbmA8Z5W+KMOdSAm9M5ANgk5B2lrdH88oafPCEdsfC0qV3gY4OHxOoWxkESGtqXu2ZKYJEg5FXliNrLSj0ugKx3Bbo9E85c5SsQMGS4ClfxY8Avvf97GyAY950t9GZneWMzPTqOMPFIzbdHFtmhCf+CnX4ENKQGU+D3vcE18xtfHyl4BdIpp6DsSUxprH0zRDiqvt+To+6wt4HdUS+04llOPHOIxckdVtXMVDwSZ5AHJaqIx9yhIy6EzgjmZGO/xTQQqn1Cgia2qTrRAZLBrU7yP+4dNb+IL7NstuvkKtouy7FXBmC+hP3en5NozOXQLH5fbXjX/lpUASOyoH5JpEzHzqoLY3kevLj+IQVJ69EwZPwzQ9UoKH+JyVMpw8Lluk038+zJvvc0+PDJcKqL6NyE0AzunZ26lsO0h8vZrod+hACpi5rM8dxpJKhWQyx1ShPGZRtBwzIIiipASYhWxeJddqbMpWPrpSvLv/0fZRIMwPD8e2WXZ52im/hAkAptcEAcqXONE2B03Ah5+IRhL/CebDmE/8nOTS0tVfeKJ9xclTeZDUzsTpet1Ca0W2VHkFoRkovHRSMN41W09QMcEJwmsKMI2nVfcE2UDFKcfsY95Ynd04+K8P2o+gyFP/K0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rV5Xkmo5yV0VpBjdhqISUr8CXJ8UahcS02FqJD6/lbPC5+VvlfVn98AUrZu0jwx5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9BfLc3WCZJ/9SEh+uVmZzOcqJ9UdX35pe+I3JTTz6Xy3d/QlBe+Kb5Z/66K8Nf1kB5smG9++OY0WBgj1/Xn8J9kPnkrumwhRZqpWOsjuAatoN7VlSsGTE6BR14duMqAOPmkOOhbHwa9u+N77F+3V/IaZWd4o86OjN5Iz6YQR9YXCUT/G7tVg/lM3dAIhUi7ZMZIIe/KG4750FOnYNp2sGn3ytf8Jc19d3Nezcx9BpyeLQ1Nvte0afqGPh4CTTZM1BMwJOge9o6JkJIQihuuWbxkTuZ8cs35weAc88VsVWzEu1LZIq1o6WacWS4Nfg5RSPwyIUtLfUIzhEjAb5p9/NMsbit3tmNI73y4U35EiYd6SLqrTXo4SpZKkwwJ6RyMxVER2WPUec/FIJ2BTe5HArKc9JCSycXz/GAlIkyEHXxU9B02cuqzLlwtDT2xU47GBFftn2f1FaF/CetusEOrNR0hrDDfXr1YLL55Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc14cf3f-f16a-4607-18aa-08dcf41b71c5 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:09.1108 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fLVJtUquOwPGWO2qQBcxwCsk3Y5FY0cQI8ez5qxDYpX9KITQ2tPR9eEkFmWDb7IIDlPLymia3nW1BJGOLdVMpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This splits the transport set_state operation for unicast and broadcast, by implementing it as a transport op. Unlike unicast, broadcast transports need to be acquired/released separately, so changes in a transport state should not affect its links. --- profiles/audio/transport.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 2f5ff6de0..bb2ce8a4a 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -2156,22 +2156,23 @@ static void *transport_asha_init(struct media_transport *transport, void *data) transport_a2dp_get_stream, transport_a2dp_get_volume, \ _set_volume, NULL, _destroy) -#define BAP_OPS(_uuid, _props, _set_owner, _remove_owner, _update_links) \ +#define BAP_OPS(_uuid, _props, _set_owner, _remove_owner, _update_links, \ + _set_state) \ TRANSPORT_OPS(_uuid, _props, _set_owner, _remove_owner,\ transport_bap_init, \ transport_bap_resume, transport_bap_suspend, \ - transport_bap_cancel, transport_bap_set_state, \ + transport_bap_cancel, _set_state, \ transport_bap_get_stream, NULL, NULL, _update_links, \ transport_bap_destroy) #define BAP_UC_OPS(_uuid) \ BAP_OPS(_uuid, transport_bap_uc_properties, \ transport_bap_set_owner, transport_bap_remove_owner, \ - transport_bap_update_links_uc) + transport_bap_update_links_uc, transport_bap_set_state) #define BAP_BC_OPS(_uuid) \ BAP_OPS(_uuid, transport_bap_bc_properties, NULL, NULL, \ - transport_bap_update_links_bc) + transport_bap_update_links_bc, NULL) #define ASHA_OPS(_uuid) \ TRANSPORT_OPS(_uuid, transport_asha_properties, NULL, NULL, \ From patchwork Thu Oct 24 11:02:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848787 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 241A31CB509 for ; Thu, 24 Oct 2024 11:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767801; cv=fail; b=l3hj4SMGA+1RhEGRgTDhXLLohCo4zWmXBqy3Qu4XH2D6KnSOh6Qr2f5jfi3qmvx0SNZVIjEx98cKsksLPX5vfSb3B5Er13L4wMuGy4LSJ+ECJTksN3KoGO8nxzlmEbWYBPioH1SLInJDJ1DN9U+OMINhSKONw9hAdHh72uuOofU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767801; c=relaxed/simple; bh=172d8i8/zHicvfv8mroJyrMbtl7MeOWvVjr2WBMQSH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Vx9nH4IeBHIWf2o8ZE2StdYi+7ER+yZUSrucNp0+R4miXDRhyAsBOl+JFIz2iI5Af20InJJwIqxP79W0JB6B61px82ks+F1ZYfZFPDnoyWjHLShiYc30g6Nu8lpVYOjLiWzOI/Y6mpwJVTv2IQG1a0wS3yWO2EGm9RFtkhFcm+I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=a8g/E8Wv; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="a8g/E8Wv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qlBL+j3wug5x/cXKfchaPNiffVryJ3foXlIYEZpP5EghoZJZILbJ0bGjs55yxov9JylK1/fhiB5YUTQTZ6D4a8j8EbNklAjLB439ldXzan1VcffgqDydbD1vu59p7hp/SzFp4N+zxaBn1KYxefkvjM6pT0o18RQF6f4IdLJ9Lu5YQoafIEl7haK7Vhw7gzYmvAmeK+J4/yYVcAlakPKNnfTh1XzMLEqKilWWqAqMN5qY1OgIO9gNQNcg1jeKfL1pzbadoZ+scYUg4omLNlEwHzLOGXPaSAQrdotNmoPH33CE/xr+gadaSxEDxScrSyNLSXB2rJvXYtvYQqEvDzdtYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kqvVCmP5C3DRSJ0975nWdThfMmLvqcPyJT8hORJkPrY=; b=hEfrxYuUjIY5O37m7j8FbgiUvEWV+qjyfMeyR93kjJNi1bCOVH5xa5gBQldSEIAEzE/rfjMoi2UrPUC9lhGpEYTs6mQKQFTdEpRPrk6tbb6z39Trxtf5OUM78I+mJKamA2+O42eliE2ZixSrvydlwYYfrdWGiln7WJ5Y0CRCNBdYhmZakwqlejgHK2AdxFEgHF9BzuR50PVWnQuya1FawDILCeCP0dufMI+g6N/ggCvivayImhXlyxMrsbIQjyxGnFiZHGkwYX3gXnNzaNtHTg6qu+hsqnFt2V5dr04ZbzXrAF7lKWTPJjh3/3K4DlPlbpIbbYiRvGyBN/INnfo8/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kqvVCmP5C3DRSJ0975nWdThfMmLvqcPyJT8hORJkPrY=; b=a8g/E8WvbXoYlvH8OKJH4oxjCZyyLGyUtJHO4X9VrE3ZGhY08MR8X4Lk3qtAhiVC6kRFh3x2j/FRF/FxlZdE6ExHj0QVcOywWNhEVcXwh4q8bWvANl07XkSjw2+k36y0Xmn9iyvWfu8BNsh25soHzF+IHAcXsZco13oYVHChTxUsfLWZO2k4yp2US4AaNvTIAZ+jJJSaGNJNC9b/8m9AzcBod/3Ygh9ofhpKiBrlbcBUSic9ClNoBCa4BW+m9FiQ/TWazO9RihKVf3rqh4qwkr+mqZKUJBQbcWbDup3bXYEAHeVU0UZ6QaYDd5hblZXe+RzWNS4FwVz6quPnLPdevg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:12 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:12 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 12/14] client/player: Handle acquiring broadcast links Date: Thu, 24 Oct 2024 14:02:21 +0300 Message-ID: <20241024110223.77254-13-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: a0ac9f17-7f7b-4e97-9048-08dcf41b73c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: TVhBvdtFNdA6sxx5NKuDevl9JMQs4pfwozwc44Snvl7RzoF46yfEzvHUF23GLBG77xfK1qbEMPm83/7WiDRdFoU4BOyQxIjuTG+ZTr14HmttHY24JFq2verm/eqXvCVgBH23mCunfjLgeCCutydMgs5wgWJ6ANsCHTTmd2qnf3N/vAkXQDzYlPYrM591KDKYbxPbpFCEVYBjm0wvr0nIrrgsDJiXHrmsjIo9kt9WVU1fZihrYuGdcM9g3M8jGwkInrPIfWGqNTgvlY3lkXk1Vo56/7x2CL4kD7YmtpYPILIoRxehNaWBey8og3nZ9iTlkbGwB940lXFSPzUmy3I0hreERe9qZxupCrnpFLpfIRq+Tw2/LPam/fhnfUDjFU6Y/cKbp04xSTD76YpeeE/POaW7aczlbh4hKSIRpMJQMin1gDrCFPM/wttWjSr8W33W2T0EWcVklA8tIvoKU+hcuI1uWhxoM+UgwV8lwXzgXN3iBPxZHLV4suAYi1M6y3XhgKZJxgV1izjMdG5awjWO6bt1I22vLMSHkUC5A0uPg+Ft0aM+0Jv849ectrtI9oQ47Yk+JSmTcjrsXp4Q8LG0JGCfDDoH0b8c+MeK5yqIJEt+QToAVruCtQruCkcgku2sfCE7ZqUTCcsUjKTgod5rFSC9yZr/lpspsJg61DCmFM4pvCNpHwrx5ZQCsfd09P7+Ppz54WILj0XzTO5Lm0Cnoi0JoDwnJJazIuueW3cgmqY8y5epHPbMa3Owdx0mX2XI5zzX7so8h/cy3/8pUypkMFfGk1LKjtyMIZBgnG/zcM/DOAIVACnQmJWeYlp9ojegwBTu5YYNvrKw1Dg+cS3h1uqAqc4kJ/XgwbWxuj2IJ4qeuqapfFUWX13ixE3R8tzdcsrx4fzTzSHPOr8YTmKM59Wx7wILCqfDQlvjA4utSjUdnCBWAtt/SjRnMhxYFddkWd58g9HXl8XapwxoCHXf7BqucBxA9/Stz6Lakl5gbMPZYTo1xxen7TDKh0yg/MuiyV4D/OOx6BcmXHbPfI7hUDeUOXmhTd1D+SfAHGKS9hOmpKS/lRpZMzJn7SJj1l53G0rTB8SBfauxizhGiq5xvcMC9PE5U9zacLm8h/428oZApZGg+P2YdTZoEyE/5OhCCaFrcG6A+TcTZo42gJ3CO7JeJG+xWKZvRr7VcmTWv3JS0EtoElbiLUJGcqk8NJDbFBBFrCdWiWGuzrcI2GuMxK/d0IenZOVanw+sjBUEQOCIlYF2jlWYl32Cb7/7NTA4EYrCJ9KJFG3PLMq3PdoUIsntUkX1FiXGHqVly7ZyXeRF1utTEV+BTwMcCPG65AkwN7GkCYOfzJXgZ6XeZXAgOM5Q5Cuj7+JqGk9qmbZeRcA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xe/bz6yQkjjhSWsO1crfzedNshCgeeyNKoiQnPnM/PR99ytTKsPpIOx2oX1ncCjl67VVx7lmQdWNvIfy7D1YYtOkVZiszwg24dyt4N6DJlDIca3jEAUOfmjmRjhBO4NN4HSfbMlGuokrSye/bLkAMVMCAKbvRXcroWARWO24bQ+5mkrIIysGSgZsl8wdRhaC7QzLkBZMSE9d99t5RVfBklm5xbs3d4bOqPQmyL7gJvhw4FUmdMZfyuZyvzA99eHSZ8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4txPJcsjVo9+Ju5zI5OawiCHVb+w7kS6xgf9KDH9fr8nMeFFeWQu8b6+FSSqmGND5cLOP9YJ9+yNPZflzq/3Cz4v771dxGzic11b7GJkjz6Y3wJkuxQHHiVfm4L1VX9a8Cgrx7mE/GOrK8IsA2DqVUCXlcdfPvCt/oHtM3XHM5CHqoF6Tpe99CDQ/PjmTll8bgYUWpn9H6qwsx1y7JVhfG5G/jbUzK/krq/dzjszjkzr4ZC/InDsDR47iKflmVFj+MEkqK63yZ5hE8QYJS78jHG4w7lHwbg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0ac9f17-7f7b-4e97-9048-08dcf41b73c3 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:12.4572 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qjlIJW8FZCkj8nILlY+e58ceBG0XN4AAo9kHkdCZ0nlL2klq9NNa1IyIghgs6e7EnUCyWXPgzjghBXGwTJCRBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This adds support for acquiring linked broadacast transports: Each link should be acquired separately, unlike unicast. --- client/player.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/client/player.c b/client/player.c index 188378175..81d967a28 100644 --- a/client/player.c +++ b/client/player.c @@ -4812,13 +4812,15 @@ static void transport_set_acquiring(GDBusProxy *proxy, bool value) ep_set_acquiring(ep, proxy, value); - link = find_link_by_proxy(proxy); - if (link) { - ep = find_ep_by_transport(g_dbus_proxy_get_path(link)); - if (!ep) - return; + if (!ep->broadcast) { + link = find_link_by_proxy(proxy); + if (link) { + ep = find_ep_by_transport(g_dbus_proxy_get_path(link)); + if (!ep) + return; - ep_set_acquiring(ep, link, value); + ep_set_acquiring(ep, link, value); + } } } @@ -4919,12 +4921,14 @@ static void transport_acquire(GDBusProxy *proxy, bool prompt) if (!ep || queue_find(ep->acquiring, NULL, proxy)) return; - link = find_link_by_proxy(proxy); - if (link) { - ep = find_ep_by_transport(g_dbus_proxy_get_path(link)); - /* if link already acquiring wait it to be complete */ - if (!ep || queue_find(ep->acquiring, NULL, link)) - return; + if (!ep->broadcast) { + link = find_link_by_proxy(proxy); + if (link) { + ep = find_ep_by_transport(g_dbus_proxy_get_path(link)); + /* if link already acquiring wait it to be complete */ + if (!ep || queue_find(ep->acquiring, NULL, link)) + return; + } } if (ep->auto_accept || !prompt) { From patchwork Thu Oct 24 11:02:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848788 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95CC41CACCC for ; Thu, 24 Oct 2024 11:03:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767804; cv=fail; b=H7MFbGdQNH+m7ufVfalwC5yV4vLxgicLshyPRNd3VvSIUUag3FPRHb77PiusTE6SdvWI1Gj0g9+TQBquw4qqc38Ztf/Ch0zxIJnMlVPoW5WAj7WMkWfzTY2y2RBqj+keYWKsDtmioWIR6OSLljM9dxhpeFp1EFBWUMkWpkeGLdU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767804; c=relaxed/simple; bh=A0KlTM+60pSi/BKDq4BjaLDPFP2MgJPBvuFCET9441Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=e0Nu/f9023+h2YxexHTwTODo7oFAAObKox3ayJdB1Ac6GooRM0D7zpq0jZch33/NuXSHjRerS6pduYgb8rPqowjS0Wxil3flCsvOr61NtygU6aV7HwgRaDXByssA0Ex0m8LfKMYl8bGxVx4jlnpyzte5ZwNABDN1kcUZrcTw20Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=CG7cP3J4; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="CG7cP3J4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xAtPMl6aLZ+fyyQrY5lFVuYIfZKzGnhiUB01+AhBBr2mSlrVgMC7PI+SZaMK4FifLuuhZswegL+0QcZAbYsEsO0AwyQ56vjD+V24myl1vAHECUubQAHFKpu3BaXNfk3dhEJyAfdah70eDN7RM0yCC+K7IDxa7kIolnQjO7BTESqaOpM3tWqt9NJZD/NCJvFZT0CmFI3wxHBnX0Zc9C7wnpDFM/KYgYU9dj2NQPJu+MGcEnECoqIsRZnA9SHwjyFshAxGR84x79s/ymAf+8COGRa8dZTV5Hq0pBSAJJp16KHX5Nu8DGNi55n8gLG/PTvmnh++OMb0ER+QmQIyC5i12g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XjqyURUXzN1ULLwz0SXvnnDaimcQuKYmFBvTLDq0ePM=; b=KjFKIR+WLTbo8NNwbeFsSBOzm4Gycph8mgYXJP7Guc6dYXO9lBWZaRpMttubJLVTEZx+MdeDgkqBvscTgCq4FT5NjTxS2hEt/9QlEt7VV26UWiCZIRBns9l8qjlHUgM6yZjYIoZh6Y2fTj60YXGqWkN1Dlip4dtg6x6c+SjOFxKjyoMJ+7bbMQGXhhB0he/nfz4+LRTot4NPLTwikesHt9FHOP4n59ahytihCyaYWhSGkPt0M6QTiNU+4hD4/A07QtygD+fTAqgrC3tkKbPlDjY/5LnmDCqYLe9F+p6so66fzDlvnkn7qEYJ2rEwsFA/ToBIz1LernSKfWql0XOgJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XjqyURUXzN1ULLwz0SXvnnDaimcQuKYmFBvTLDq0ePM=; b=CG7cP3J4qqN/0mLIjGGMV9V1GYufS4nM5BqIfYEK7MqHMPiramScflW4wTvFkVaWwYGFkq3RLOhXeRnT3fc69jWFNQJNDPk8oKkMwzgmG6tWXaxLCAiOoSCsZunDHiKBlfiJqmImnRXStnlhSsOAhccWrIgZjMuFlMRmLC/tuq6FODNErbRA40DQpE4O3xzJ/6jP+oV1sKsEzkRRJ7fucugF6N/hdp3N7fLqph/3y7Id4gy4WItREhZ1br/WhkYw2R2Ric0o60iIEIRHMFxIhDJBEwlAvkDNYmSVHGP/YNLiJh/dhZG+6kpp0G0GuiBZLRui3vtb36DXG+y627TL9g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:14 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:13 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 13/14] client/player: Add support to select multiple transports Date: Thu, 24 Oct 2024 14:02:22 +0300 Message-ID: <20241024110223.77254-14-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: 319ec9b6-de89-46e8-4af2-08dcf41b749f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: UPwXyYa3dmK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zGF+XvzWzWJTS8zb1tTtncMgb1NCG8jKz9X9fl57hCLi2HV5TjkAtGpdwZnMWt+F2TrjqHtDyWq4tTeE+DRn7tlGXtj6aMB/IKDzB2t55Sqbr3H5ycDijSvPNusNpk+ukdkuRf51kfwO19mcA67SGbQMepz2VtSqxQcwSDxzhcWntPNxwaN8oWS0M6Yue0lbOgjjzQLVclMwgNzTOa/fGERzTPRP9CsfxJ0FzJXpSssGBf/3BwmMj9keRuHl9Fv/mjAXZu6OwJ49Sx3VxfM2Bz+3pvR+hZi5jV11lys= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KYXTYReVcPbw7+ZPTH+YCBLrohqrH1F4tRy4x7gq5dShCJ6HdEZpB1MPGCaSR/9IRELTl8qsqmnFU0WY7SG4oQZIEOnY5PWp1C22pwph1rZU2bgFVtS5IlYLS8MvHj+i/Fw2IC9EG4QqmZSdOGCDHwI+X629ZnkvScUSgUYsybKjBM23qzFJkhtaC8VWwl8wAgSf2gSmFgVl0h9gfrydIeNocgtZcW/Fq6SBAqcoXjwKgRNJEnpPPGm0Zzb5XY/1JlvZBvPoYFtH2EecmadiMTwnGHyWr7ZHDv8pRtat7lnyQouO3E0x8hwPb0lcomaEt0IMZjbABYFMOt5098PwpR2Zeo31TrP/pbl/4tfvn+ydsEGKADi3xOcQU0u94Uy7rW1vHLxAk/a0QQ9ylPNyjMU24KyumtMpR/ssR3tJbW8fDVEBBFUouGnKL02sSKhfGlkGQpWNeRhzFEUJKwNjdRsxPafqdaNKDZkxOtd1/fqqpVSPprWJZh+oKTdY2O4IdvcnNTjlqPdVsFl9SOOIYBnWwPUpufAd49Sh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+g30YeSXFByw9KA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 319ec9b6-de89-46e8-4af2-08dcf41b749f X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:13.9307 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YF4zr7sXX+dNz0LIyOPe72mdfGgZeX9Pz7T+wRLZL51cpYdqL/BIG1O6tm9zLs8ueSQGknDrV3WlAqyHZOio4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This updates transport select to link transports together before calling the "Select" method for each of them. The bluetoothctl log below shows a Broadcast Sink detecting 2 streams from a source and selecting both of them. After the first transport is acquired, the link is created and the first transport goes active. client/bluetoothctl [bluetooth]# endpoint.register 00001851-0000-1000-8000-00805f9b34fb 0x06 [/local/endpoint/ep0] Auto Accept (yes/no): y [/local/endpoint/ep0] Max Transports (auto/value): a [/local/endpoint/ep0] Locations: 1 [/local/endpoint/ep0] Supported Context (value): 1 Capabilities: 03 01 ff 00 02 02 03 05 04 1a 00 f0 00 02 03 01 Metadata: [bluetooth]# Endpoint /local/endpoint/ep0 registered [bluetooth]# scan on [bluetooth]# [NEW] Device 17:7A:80:64:A7:93 17-7A-80-64-A7-93 [17-7A-80-64-A7-93]# [NEW] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 [17-7A-80-64-A7-93]# [NEW] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 [17-7A-80-64-A7-93]# transport.select /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 State: broadcasting [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 State: broadcasting [17-7A-80-64-A7-93]# transport.acquire /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 Links: /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 [17-7A-80-64-A7-93]# Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 acquiring complete [17-7A-80-64-A7-93]# Acquire successful: fd 8 MTU 40:0 [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 State: active The btmon log shows that sync has been established with both BISes: < HCI Command: LE Broadcast Isochronous Group Create Sync (0x08|0x006b) BIG Handle: 0x00 BIG Sync Handle: 0x0000 Encryption: Unencrypted (0x00) Broadcast Code[16]: 00000000000000000000000000000000 Maximum Number Subevents: 0x00 Timeout: 20000 ms (0x07d0) Number of BIS: 2 BIS ID: 0x01 BIS ID: 0x02 > HCI Event: Command Status (0x0f) plen 4 LE Broadcast Isochronous Group Create Sync (0x08|0x006b) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 19 LE Broadcast Isochronous Group Sync Estabilished (0x1d) Status: Success (0x00) BIG Handle: 0x00 Transport Latency: 0 us (0x000000) NSE: 3 BN: 1 PTO: 1 IRC: 3 Maximum PDU: 40 ISO Interval: 10.00 msec (0x0008) Connection Handle #0: 6 Connection Handle #1: 7 < HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13 Handle: 6 Data Path Direction: Output (Controller to Host) (0x01) Data Path: HCI (0x00) Coding Format: Transparent (0x03) Company Codec ID: Ericsson Technology Licensing (0) Vendor Codec ID: 0 Controller Delay: 0 us (0x000000) Codec Configuration Length: 0 Codec Configuration[0]: > HCI Event: Command Complete (0x0e) plen 6 LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 6 < HCI Command: LE Setup Isochronous Data Path (0x08|0x006e) plen 13 Handle: 7 Data Path Direction: Output (Controller to Host) (0x01) Data Path: HCI (0x00) Coding Format: Transparent (0x03) Company Codec ID: Ericsson Technology Licensing (0) Vendor Codec ID: 0 Controller Delay: 0 us (0x000000) Codec Configuration Length: 0 Codec Configuration[0]: > HCI Event: Command Complete (0x0e) plen 6 LE Setup Isochronous Data Path (0x08|0x006e) ncmd 1 Status: Success (0x00) Handle: 7 The second transport can then be acquired and it will go straight to active, since the fd has already been set: [17-7A-80-64-A7-93]# transport.acquire /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 Links: /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 [17-7A-80-64-A7-93]# Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 acquiring complete [17-7A-80-64-A7-93]# Acquire successful: fd 9 MTU 40:0 [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 State: active The transports can them be released one by one: [17-7A-80-64-A7-93]# transport.release /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 [17-7A-80-64-A7-93]# Transport fd disconnected [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis1/fd0 State: idle [17-7A-80-64-A7-93]# Release successful [17-7A-80-64-A7-93]# transport.release /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 [17-7A-80-64-A7-93]# Transport fd disconnected [17-7A-80-64-A7-93]# [CHG] Transport /org/bluez/hci0/dev_17_7A_80_64_A7_93/bis2/fd1 State: idle [17-7A-80-64-A7-93]# Release successful --- client/player.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/client/player.c b/client/player.c index 81d967a28..66a26ef40 100644 --- a/client/player.c +++ b/client/player.c @@ -5173,8 +5173,9 @@ static void set_bcode(const char *input, void *user_data) g_free(bcode); } -static void transport_select(GDBusProxy *proxy, bool prompt) +static void transport_select(void *data, void *user_data) { + GDBusProxy *proxy = data; DBusMessageIter iter, array, entry, value; unsigned char encryption; const char *key; @@ -5220,28 +5221,62 @@ static void transport_unselect(GDBusProxy *proxy, bool prompt) } } +static void set_links_cb(const DBusError *error, void *user_data) +{ + GDBusProxy *link = user_data; + + if (dbus_error_is_set(error)) { + bt_shell_printf("Failed to set link %s: %s\n", + g_dbus_proxy_get_path(link), + error->name); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + bt_shell_printf("Successfully linked transport %s\n", + g_dbus_proxy_get_path(link)); +} static void cmd_select_transport(int argc, char *argv[]) { - GDBusProxy *proxy; + GDBusProxy *proxy = NULL, *link; + struct queue *links = queue_new(); + const char *path; int i; for (i = 1; i < argc; i++) { - proxy = g_dbus_proxy_lookup(transports, NULL, argv[i], + link = g_dbus_proxy_lookup(transports, NULL, argv[i], BLUEZ_MEDIA_TRANSPORT_INTERFACE); - if (!proxy) { + if (!link) { bt_shell_printf("Transport %s not found\n", argv[i]); return bt_shell_noninteractive_quit(EXIT_FAILURE); } - if (find_transport(proxy)) { + if (find_transport(link)) { bt_shell_printf("Transport %s already acquired\n", argv[i]); return bt_shell_noninteractive_quit(EXIT_FAILURE); } - transport_select(proxy, false); + queue_push_tail(links, link); + + if (!proxy) { + proxy = link; + continue; + } + + path = g_dbus_proxy_get_path(link); + + if (g_dbus_proxy_set_property_array(proxy, "Links", + DBUS_TYPE_OBJECT_PATH, + &path, 1, set_links_cb, + link, NULL) == FALSE) { + bt_shell_printf("Linking transport %s failed\n", + argv[i]); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } } + + queue_foreach(links, transport_select, NULL); } static void cmd_unselect_transport(int argc, char *argv[]) From patchwork Thu Oct 24 11:02:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13848789 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011044.outbound.protection.outlook.com [52.101.70.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A9021CACD0 for ; Thu, 24 Oct 2024 11:03:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767806; cv=fail; b=m1rvkloP9AeD22QPpcBMd7UNcH0G/ESg/Ua4IvhsXHJHlZ74EUCG6NKqNg6P6XlBSyRslzGqftsCaQA+66Hzia3dooPx3NbC62/x2iE8kry7YiOdrvgP0/ZKvhVhPCfajAjgwA912JD7LclJbEvjg8je/3DeIPZZbN2uSURFL2Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729767806; c=relaxed/simple; bh=aptpSCqH6pxjKOB/xIFyw1qsWYabgNFS7EDrumA7kxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=YzDHYP/wLqUxJ30c+xPzACqNgMNWMn0xk2sqjWEgTsMNNufKQ69nf5tRMn+GHY+xCi7ojwOatBi1+mo7yXdTfRl/F1uT7/FtMKbo1yXkxlT7ZdNvWr8usxxgZOC12CBEv+eL60YZqOVs//FAr7XevYZd3pl5L2QEZPHfvwxEUp0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=L+TleTwN; arc=fail smtp.client-ip=52.101.70.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="L+TleTwN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ao4sX9npY2I0IcIPEalZbTWquj2S2kvBZYe+Ji63rjHW3RzR0enXSz5sh9H7gRpc5KbRKNItT2KpSBN/Evqwu8i4HoiH89M58aZrpIxKvSSyDVxRDFcV0FCAOjN3CkfPYxvHYsLDdx9lxmeXpF2hKPdkwYMsFUUoqioBy4bw2fL2LWOrZgq/KJP9poxpLplESBcY6StGComNeEDVfh6Csuz9gPZsLTg23MZGwKEo9ZH/pnUY5Frdtmclu4BfhJixf4s3nwU05r/fHDiPIjXfVyMYD1bXgWb0FTQnjirqyKrf2nhUEx9Tx0txdK4dDr8BvPA5wjy7sgePFhAL/Cl/MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L2aUKoPzRSyH7ntYn26/cxnlFeEcu2EtfFfDD2XBHlQ=; b=KPNKAivTLDkSv+ikrRWLA5hS9as0q9xbNNYDmgNvTWaCdou22sON1buUMYYtLPJ3/hgyTZhh3419nWBIxA9I5PZG0Kar8VUhcU05+pMWieoIe4rWwyBr512RmzxGW5d8rnlseCOIRW2kOqPRqTpH2Q6SauXBsSnDTO2AGlnCzOyu50bd5e5sOloUnXXICLKNI0f9qvi9AMDan2rY+eUFtv0euOF0CiswTZW9K7STT5w2xO/ELyE9v9qM3NsFYvSg7LzrWKMKK5mMMtYEco8RH3j55AEcZTPuoGvTppT8/a5lv0DniYRdzCYg9AydxznG4A9wVnw1eI31N4LfMopJhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L2aUKoPzRSyH7ntYn26/cxnlFeEcu2EtfFfDD2XBHlQ=; b=L+TleTwNjc3Y+n5Jlcf+swPWJlBFjftvE1LCPKSWksGYTXfci2w77A0L56skRVyuIoDuE3kXqiZ1w46dA7KOlDXyAFRi0tLhlGSdGKqd7yBUrjd0tStQDRcBT0/Ar19I3IIfUUfcT6AOAjmXGzWrXYpxcBeVpdP8vmDvbjvTWrsTMJqdsV7esbCXbHy6nCDPme48Wgpd2kNzdsRejt2qAbQsN66kxhNKxqQgAZFnxbTKhjOlzl06/HRAaRbVIAhiHQcXJ6aKO2/oMco+0WzpIqZxlzP273Jx5NMOX3tHpsNiljEakIsxhYXR5xaZ6CuiE8rM4UetL1WiR5a+8C2Peg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DB9PR04MB9964.eurprd04.prod.outlook.com (2603:10a6:10:4c1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Thu, 24 Oct 2024 11:03:15 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.014; Thu, 24 Oct 2024 11:03:15 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 14/14] transport: Unlink broadcast transport at release Date: Thu, 24 Oct 2024 14:02:23 +0300 Message-ID: <20241024110223.77254-15-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024110223.77254-1-iulia.tanasescu@nxp.com> References: <20241024110223.77254-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::6) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DB9PR04MB9964:EE_ X-MS-Office365-Filtering-Correlation-Id: eded5710-f6e9-4c01-403c-08dcf41b7573 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: ZxvIBRXpQpKfh1upmof2iV9LcslQNNGjxCij57Bs/wtQ2+knF2W199+MQeOjgzx7SYBsN8OwNvRQQf/x7a6JdR0jKBI8lqpFNDyF0ydwJhvxfCh81L25gL6cxZkWmvCKE26JCPacXveGd6me7F36F9dX+RTnexFqFnp4UNRSotu1tZU15aQVeQtgcJ7UWmEnwetp954/XJYzimt1khOPGYRLmcLG6+TWQEZ2WvvfnzBbiOqiEiSunxTg1K+21xJZRdunLzv9LIix60KaBetv3261se7Q4Hr7zvdub6FrASUBERNQtww5RhGv+cp2l8roBhvTbiK3kUT48hcr2UrDKGrZEFSmhDHTRDdMcLAIv/95AWsZ2EwAAPQjZjKRt8jxX99k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:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iGdGIstCGK+F3H0dyApaVvI+QfpFXNyoLXY4prDpvQi2on0ECPljXc+qrE5VECwJF9JWvXC2wKqJ1UziZE3TznIH2b6xj2s/5ARkXGMqdUeS6MT1kuMMW8nCKL5yrsCY6fGk/U5DbHAPNsqXjxrRyB3HiMlfFnXFSCVG0bsjsETWE2FIiKWgPXQ0JE+ZIA/Z2vTrIH3bokSnm1PIlRqqjcQz4bZgUO7v7HJ3ea7fCfXY0ddM6Rz76sdgTDX/22P94i5gYdZrQauXhbbt9WeMOSQpdtWbNwJ6CnjXTlcsK65vDAjJmS2baDG1xoUDSb5MHPOsNReEYFKxR548efhZ+7sWyB8McOrWWUy61o9uUTOzUzwYOlRBXwvdeYSJmwKrgPp7AO2tA2HkVIChaNbaVvYUinmNu5OawP6HavT8LX0LJR51mf3BuRT0CMicrHS9Nzq6kdHCn5HCPwJBgJDR+JkzD9+pG8EbOdiVgKiQK/QDMtyU4ngaNdKVS1C3EcJeXTlqn1S4ezOIPCapqnn0k4kTRILcw9IYo/QZO0VOl+Ga+LInpe1QkbyGKtYv3nvXPbcXHJUdRgdWNQwXC1wi0+kHa1nMzs4ptja7JYmr7ofzJKBInvw6aTopvOJH7YO5YuW6keC0fclz6QaifdG/It01y4KYTeU9eS5XMgSIVTfGHzpUfsSbU+RJdRv05HP6QikcE4dnAMaghGDyzHKlqdewbgSqjeTZLAEGJbZOWqr+DhDqJytvDfpT0gO2twtVPngFgBu0O3KMKtGwHPqPjFXOOEu+ftkas22jR6/p9yBPtxUceINQFGm5YtyIvp5j8e2G8dkG74HN/1QwzHE7EVrHYsscP4Wm/1qCf8GuUVNyOEBx+PWCeNWAkT1Sun+uXB3WoebUtL6IYWK0+rYwLuXjasrsvdbtWqtZZlAItZGqsAcR/qkbySiOwUv+U+G1WntAJ4Bt0odAKNDkL0TueEzWHGHm3h5R4Db1qAk4LVGWvRvhahaNlbZgZLngqD6CEwCcvlR6azoy8fs4W+B+S0uU9LbVWBzs7WR7IyjfA/UE9Exj2VWV+UBhaBIYKKkkXxZ/TfjQOY2todprvWuOqsGzzzFvRUIbQp5fN05z0xDb9D9fdVbctF+4eGql6nYt6s9OhYz+PfN2leLOqR5FDK3u0QA+uJSjAcUn0Nm/zJXYU6LrLJTXWsrRIWdCr5Hh91d0JVdHvBrj8N/ARe8VBw5lwlTMHfaGnwLv8cjSoHXsJ5+MB/lk2vwfx/bxt/+gWAwFv77TRmdaR0kncIhGaqWfvFbvnewSrMUVTtwA8Ba2xJtkiAHNEk7njqgTSCOpexhfwYt61xlxCf/MHI7IqZJN1JfjNCVfCv/l8QIMMKx1G0PVJvz4LeK6SsYgiuO7Reei6WzBCjYWTBRTRZR0cdDCXyJ1MGnVMALViEr9ST6Ns8XxVNGqwjmTiDUNx/LtEzlwp7yQ4Lw5vys2a5tDMpeA1gY7RapaQufDYXwTIpG5pNtAOne3J7iPAgIcytD8hDm6hdA21Tgr1E/XuiSiy48rIXvEX5qeUNNKlC10CZE0QD9OkuVtDTxByY46FOOM92HInRM2Yl9bNWU82CLfxQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eded5710-f6e9-4c01-403c-08dcf41b7573 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2024 11:03:15.3072 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rA6gdVrV1cpxNziFWzAkQPT36D1KKyImbbuhxOTNkM2l+k9qirOFXrTeRopUtN5AeGz0gWzWxxtN4MC01OfKBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9964 This updates broadcast transport release to unlink stream from all its links. --- profiles/audio/transport.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index bb2ce8a4a..5646b2004 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -1779,10 +1779,45 @@ static guint transport_bap_resume(struct media_transport *transport, return id; } +static void update_links(void *data, void *user_data) +{ + struct bt_bap_stream *link = data; + struct media_transport *transport; + + transport = find_transport_by_bap_stream(link); + if (!transport) { + error("Unable to find transport"); + return; + } + + bap_update_links(transport); +} + +static void transport_unlink(void *data, void *user_data) +{ + struct bt_bap_stream *link = data; + struct bt_bap_stream *stream = user_data; + struct media_transport *transport; + + transport = find_transport_by_bap_stream(link); + if (!transport) { + error("Unable to find transport"); + return; + } + + bt_bap_stream_io_unlink(link, stream); + + bap_update_links(transport); + + /* Emit property changed for all remaining links */ + queue_foreach(bt_bap_stream_io_get_links(link), update_links, NULL); +} + static guint transport_bap_suspend(struct media_transport *transport, struct media_owner *owner) { struct bap_transport *bap = transport->data; + struct queue *links = bt_bap_stream_io_get_links(bap->stream); bt_bap_stream_func_t func = NULL; guint id; @@ -1794,6 +1829,10 @@ static guint transport_bap_suspend(struct media_transport *transport, else transport_set_state(transport, TRANSPORT_STATE_IDLE); + if (bt_bap_stream_get_type(bap->stream) == BT_BAP_STREAM_TYPE_BCAST) + /* Unlink stream from all its links */ + queue_foreach(links, transport_unlink, bap->stream); + bap_update_links(transport); id = bt_bap_stream_disable(bap->stream, bap->linked, func, owner);