From patchwork Mon Oct 2 15:33:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13406378 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 350FBE784BF for ; Mon, 2 Oct 2023 15:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238132AbjJBPeJ (ORCPT ); Mon, 2 Oct 2023 11:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238123AbjJBPeH (ORCPT ); Mon, 2 Oct 2023 11:34:07 -0400 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2087.outbound.protection.outlook.com [40.107.241.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D7DBAC for ; Mon, 2 Oct 2023 08:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kdKFBFuxnElij99u3caiSbWR2SacVEkJGWjQbBYzX/7GukUV77wn5XFK34nMF/dJuuY22YOCfZ8xcr7To29f87WMPGw3KEaGKOb/68GvuUEQZQh6iwkVt1Gv+vMy/+Kv+OSUKp/QtKQhPMtk8R94+p1utu9sg9QDKuGC9nOXkos/5j6S/bxkX8YvMaqVVuo5FqMBeuEECwlOiXN/Pig1n3wGf/1bSdh0SHWlagYyL86ZUXf9v/q2rc+RHoKaYSlvDArjqXMqf9b2t9pZUMVJa07pex2wEfI9xd8q0OVVpvq32ItH3SlPCUeZSCpoCtZJXUfGRNqlVBm3c0z3iLlFLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=NaF4ya0ulJWcROa3yivS9ItCkXLU83x/5+W87QhvTsg=; b=CmMgO2LibxdIACUPOH0R07cfYJ+32j3hSlDrAZv1zfw/mWJ8afRYnyB3P5fm1/r4Q2qO5MORTZPIgRGiLKluRCJprE6lp7W+2mRUCY2HKbdJ1hGyc6gCmkjR0K5O0fer8YG/2Kefu+ykhBtCPjGBe0zVmHutITp64/rM+GBnEEELuOOK07jE0d13w1RQbpBXDyukf+fdD1ngUDRQN3TrVXdfIebjRiY6yoScbfZLXjt9oO8nttJ3EFFljf6zReA6sGG3VlxFwgDvsZm4ezeNIG0VQgIld1GAJr5Gj0AbXJrpjpNvlG9djfHTRp2lQBJxERyS32vJSFy9yDJMoWQKsg== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NaF4ya0ulJWcROa3yivS9ItCkXLU83x/5+W87QhvTsg=; b=JA1a1d1bASkmJ9PBJgl6kmUB/ToTK28e/qzkIGTnEPZFcO6n/Zq1W+QwKfzjI/OHZGhr8OUc7tUnereGGvssj5+EbZxKi5neNFcd7LliEjbc4m7mSBDLdPzJ2RBE/oVs/3PQdL30lB7kNl7Z5Xecd53xbOsq7f0q2iHsHoAdr1k= 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 DU2PR04MB8839.eurprd04.prod.outlook.com (2603:10a6:10:2e2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.29; Mon, 2 Oct 2023 15:34:01 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da%3]) with mapi id 15.20.6838.024; Mon, 2 Oct 2023 15:34:01 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com Subject: [PATCH v2 1/3] shared/bap:Update stream enable/disable flow bcast src Date: Mon, 2 Oct 2023 18:33:50 +0300 Message-Id: <20231002153352.3163-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002153352.3163-1-iulia.tanasescu@nxp.com> References: <20231002153352.3163-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: VI1PR0102CA0051.eurprd01.prod.exchangelabs.com (2603:10a6:803::28) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DU2PR04MB8839:EE_ X-MS-Office365-Filtering-Correlation-Id: 75b81b1f-fb11-4789-29fe-08dbc35d0069 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cYAlwtOstpFaHBgeeihmKTOC9ARd3jA+f9AggAT1u5P5kRmZZwc7vvDLqDjr4i5ISNP2dF1m2JJr20dFN9CQS+OQUNHLILkljouOAz//BsFXhKDDsFsyWROc2gar1tPKRqSXLp3+3NBU1LD+NS3BYdazCr1djuRW/fYCwNtKaI3PLJLwgd8YrziaVvDmSz1TDcpxoVjkt0W7i69nkS1HvqpjTTytHLRLUwzNfiWaRNwwSRwg4iPh+otYau81AKtbHjw/txGyi5F32E//NXTeliFYddz90pLpBBEv5CeHY9kTdsNcBoV4qjjfbSAybGWrPpF8Y74I7uOnARY6zPJHUzSZArNkqVeIcvWwldxBbh/lBM2O8zs++fDPS6lcXd3sMEMHGCYn3AXKLjH+x9r46cm35QQXbqmS2MR7cub1TEv2N6SKj3v+eN8F9SPB5AKxUhof7gvSgS69cUwFif+oa8w4TF43rAznr3yi0sW3c+J2Kzounp4z3T/rj117ovQOd852q2y6AL1qqRs/tFEWPyRoEUcvb+CqbVINJlXuV4soNH9+gt38LDJHSB2hBObc 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:(13230031)(136003)(39860400002)(366004)(396003)(346002)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(36756003)(2906002)(41300700001)(6916009)(316002)(66476007)(86362001)(4326008)(8676002)(8936002)(44832011)(5660300002)(66556008)(66946007)(15650500001)(83380400001)(6486002)(2616005)(1076003)(478600001)(26005)(38100700002)(6666004)(6512007)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mZK/MA23UeVeXsCoQa5Xv1+gqOo7imRzO8GZMQrnYvkbHJHujWGj/qPQ44gjrALUCzdhKAEVzoRhSpVpT6vA0Mt7gAcvNDSdPE+QmoL0h9TM1q5f+TsRPkvsMcx7HRIuKACBDAk2pSmcfAFXrfwoNG9z51PrVt7Hwr0J1M/aS+n2OkSnCfW4d0viGdDKN3nGR5+Qy9uWWIXdU/VwmMtq9QCSphgVOJFj68osa1mPaG6sSz8VqampUg+wVTu2dz9kS4F4hpKOzEJ0smBnT8RA9Cq2hqe0AzoLuROXJ2Tf3r2WK5pFixLXK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yj/PCpDQzXPw/w7UXaOphwxyr4qoz9jQNkZLTKJ/A+5QzsRHlVAlWzY+Th3yJyNe2LGasjS43eC0W8oWnt/2YJ+MN+8xrcS0RW0R7psL51sjXgfKWEBNlojyaUw2akVUnJS5abvcthrqKWPsZfOFvwIkHdq0OBLFKOkbmcJ27HZ94EKMAN2pBRY1YD5UJaw2WQWeEGvQQudtUFqVshjM6wCWM4SWAQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75b81b1f-fb11-4789-29fe-08dbc35d0069 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:34:01.0571 (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: n7lmYpDauWWzb08gibS/2Nv2kBmttWBV0jwguXlo73TL741PRGiXu9HSrdA/0w+Ntfx80I3z0dcA3lKbThSFtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8839 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Silviu Florian Barbulescu Update stream enable/disable flow for BAP broadcast source --- src/shared/bap.c | 100 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 9e9ea1472..925501c48 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1331,6 +1331,11 @@ static void stream_set_state_broadcast(struct bt_bap_stream *stream, ep->old_state = ep->state; ep->state = state; + DBG(bap, "stream %p dir 0x%02x: %s -> %s", stream, + bt_bap_stream_get_dir(stream), + bt_bap_stream_statestr(stream->ep->old_state), + bt_bap_stream_statestr(stream->ep->state)); + bt_bap_ref(bap); for (entry = queue_get_entries(bap->state_cbs); entry; @@ -1347,6 +1352,9 @@ static void stream_set_state_broadcast(struct bt_bap_stream *stream, case BT_ASCS_ASE_STATE_IDLE: bap_stream_detach(stream); break; + case BT_ASCS_ASE_STATE_RELEASING: + bap_stream_io_detach(stream); + break; } bt_bap_unref(bap); @@ -1492,7 +1500,12 @@ static void ep_config_cb(struct bt_bap_stream *stream, int err) return; if (bt_bap_stream_get_type(stream) == BT_BAP_STREAM_TYPE_BCAST) { - stream_set_state_broadcast(stream, BT_BAP_STREAM_STATE_CONFIG); + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) + stream_set_state_broadcast(stream, + BT_BAP_STREAM_STATE_QOS); + else if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) + stream_set_state_broadcast(stream, + BT_BAP_STREAM_STATE_CONFIG); return; } @@ -4914,8 +4927,13 @@ unsigned int bt_bap_stream_enable(struct bt_bap_stream *stream, queue_foreach(stream->links, bap_stream_enable_link, metadata); break; case BT_BAP_STREAM_TYPE_BCAST: - stream_set_state_broadcast(stream, - BT_BAP_STREAM_STATE_STREAMING); + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) + stream_set_state_broadcast(stream, + BT_BAP_STREAM_STATE_CONFIG); + else if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) + stream_set_state_broadcast(stream, + BT_BAP_STREAM_STATE_STREAMING); + return 1; } @@ -4933,30 +4951,40 @@ unsigned int bt_bap_stream_start(struct bt_bap_stream *stream, if (!bap_stream_valid(stream)) return 0; - if (!stream->client) { + switch (bt_bap_stream_get_type(stream)) { + case BT_BAP_STREAM_TYPE_UCAST: + if (!stream->client) { + if (stream->ep->dir == BT_BAP_SINK) + stream_start(stream, NULL); + return 0; + } + if (stream->ep->dir == BT_BAP_SINK) - stream_start(stream, NULL); - return 0; - } + return 0; - if (stream->ep->dir == BT_BAP_SINK) - return 0; + memset(&start, 0, sizeof(start)); - memset(&start, 0, sizeof(start)); + start.ase = stream->ep->id; - start.ase = stream->ep->id; + iov.iov_base = &start; + iov.iov_len = sizeof(start); - iov.iov_base = &start; - iov.iov_len = sizeof(start); + req = bap_req_new(stream, BT_ASCS_START, + &iov, 1, func, user_data); - req = bap_req_new(stream, BT_ASCS_START, &iov, 1, func, user_data); + if (!bap_queue_req(stream->bap, req)) { + bap_req_free(req); + return 0; + } - if (!bap_queue_req(stream->bap, req)) { - bap_req_free(req); - return 0; + return req->id; + case BT_BAP_STREAM_TYPE_BCAST: + stream_set_state_broadcast(stream, + BT_BAP_STREAM_STATE_STREAMING); + return 1; } - return req->id; + return 0; } static void bap_stream_disable_link(void *data, void *user_data) @@ -4996,24 +5024,36 @@ unsigned int bt_bap_stream_disable(struct bt_bap_stream *stream, return 0; } - memset(&disable, 0, sizeof(disable)); + switch (bt_bap_stream_get_type(stream)) { + case BT_BAP_STREAM_TYPE_UCAST: + memset(&disable, 0, sizeof(disable)); - disable.ase = stream->ep->id; + disable.ase = stream->ep->id; - iov.iov_base = &disable; - iov.iov_len = sizeof(disable); + iov.iov_base = &disable; + iov.iov_len = sizeof(disable); - req = bap_req_new(stream, BT_ASCS_DISABLE, &iov, 1, func, user_data); + req = bap_req_new(stream, BT_ASCS_DISABLE, &iov, 1, func, + user_data); - if (!bap_queue_req(stream->bap, req)) { - bap_req_free(req); - return 0; - } + if (!bap_queue_req(stream->bap, req)) { + bap_req_free(req); + return 0; + } - if (disable_links) - queue_foreach(stream->links, bap_stream_disable_link, NULL); + if (disable_links) + queue_foreach(stream->links, bap_stream_disable_link, + NULL); - return req->id; + return req->id; + + case BT_BAP_STREAM_TYPE_BCAST: + stream_set_state_broadcast(stream, + BT_BAP_STREAM_STATE_RELEASING); + return 1; + } + + return 0; } unsigned int bt_bap_stream_stop(struct bt_bap_stream *stream, From patchwork Mon Oct 2 15:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13406379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 209DBE743C3 for ; Mon, 2 Oct 2023 15:34:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238134AbjJBPeK (ORCPT ); Mon, 2 Oct 2023 11:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238130AbjJBPeJ (ORCPT ); Mon, 2 Oct 2023 11:34:09 -0400 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2087.outbound.protection.outlook.com [40.107.241.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F359EB7 for ; Mon, 2 Oct 2023 08:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=liFG0SDLI+metZX3yWqgCTYuxIv0csd/xywywjMO0rC61eaaY016nYEO3NpiJfHWOP5LjTeNaL1i/WurJSbsFwUPEm5wmL2coeu6rhJcFDKEEa2br1Ple+PAKeaPtDH/m001XFBnXgq3owZcYgnBm2xcln/5zCHJVS2S3ruNkprZtMQT1t84UFOOhU5cf64qZg09W0b2pDV1lTUlkHbJAxrz/KBDCAU66+6VBUAZc6MLeOueURbo4G7sXxVeIN7JvNhKXwU7eS2j5+9pahg7433n0ivOb6apUZrtaT6+DnKZhZV/RcKd4HN6oBx4EW8/34+UqnPjaJd87sj9lzbnDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=kz5QI6WQMn6cnpEm0g/1seYaY0nchyG0MftLd55y+vI=; b=ZjfWEi5cvPt4n53AK3/31xbltEqTVpjkBXfQAf9/jFE3mC9xG6BDU2Z7pJ3klyE2mXCsmi8EmSeWBmTQUKzO0ECz7cn9UOR5ybL9LcnxkguWEeJ/lZezPSBVuwvfwLebVvh2Eq8JEGH9UgiE7TJu55U1C4Z9slVp+FtbELptY8t1MTyhMCuaNo8jwIUiD3Wssra+esFEfG/APXGR++wkAOICECbj0PQ27uoYqd42QJsnXiJkwwRjf1lOZpUdz77uc5zadfghKAt9GZFPRM6EMDaR6SojJYwdAe+u55+dKjKO/0q11A8XbCk7WhN6wAxdfdihvrvBEGKbvUWV9k6Iug== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kz5QI6WQMn6cnpEm0g/1seYaY0nchyG0MftLd55y+vI=; b=Ht+534lGDmumYHDBrWntAERVonbuZ4kigfsrwZ/SSuw1sffa5OI2hbWG9494JCmGRqeasLDl1bz4xRPB/ImNY4jLWBg27YK5RmxwQseDnxJ7nCNY2hITMjBG3lH7dzr+797T0Qwi2qQRfo0UgKdvwW+jjUfqhqRO0m/p0IE7IWA= 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 DU2PR04MB8839.eurprd04.prod.outlook.com (2603:10a6:10:2e2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.29; Mon, 2 Oct 2023 15:34:04 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da%3]) with mapi id 15.20.6838.024; Mon, 2 Oct 2023 15:34:04 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com Subject: [PATCH v2 2/3] transport: Update transport release flow for bcast src Date: Mon, 2 Oct 2023 18:33:51 +0300 Message-Id: <20231002153352.3163-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002153352.3163-1-iulia.tanasescu@nxp.com> References: <20231002153352.3163-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: VI1PR0502CA0008.eurprd05.prod.outlook.com (2603:10a6:803:1::21) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DU2PR04MB8839:EE_ X-MS-Office365-Filtering-Correlation-Id: 74715c15-3f7d-4944-6fb6-08dbc35d026e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WY5HyawlAUD6NFchQxVSrQyY6zBcVwB7pnHi5mEMtnRLjkr5F69TN/7ZBPBbBz9TuxW3TiBSaFJc/LDFRLF8VXtaed1/fwA8C2bPKI4OnfYL6SGVf9DJN4s3YZG+qsYv6wD/njNhFSYsV/lG9Ha1+9ppmFiwaxWhC8/muxBMRJWGHjEvC75K/Ub+TmYQijFwRQiRzJZeri1gyrz2mRHZA1bbtucahh2wZGtUQ3zkBghiYqBnpmiv7/T93O8Xp3JDNOpCRPICkpK+/7yaP/mHxkzjFhMutMUz9swgJkW3nt7V22GooRBnRk5MTRBwginp1ZUEcErgFOOOD5Ao3j4uxKxkNCLStz5Pn47JEDV+BWNtMr+3Vb6VEtI+pM15vYzPrEGEeb71FONTLwt+3GRsakfez4gF+VqzrxxmrGRs5NhN5QUjuGUDiCnic5sAqGFfMZ3OcQeKWXtEAHII1kLmx7PJdE4pDXhkGc0P3T2zBNeVv3jWZCRnPWVuq6A35U5mUomTgLMUkpMRdbQBOQXTBsbjMIVy6YuHdNoAQRYYgx74cAFVAAupCpfWdqPE7OfE 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:(13230031)(136003)(39860400002)(366004)(396003)(346002)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(36756003)(2906002)(41300700001)(6916009)(316002)(66476007)(86362001)(4326008)(8676002)(8936002)(44832011)(5660300002)(66556008)(66946007)(15650500001)(83380400001)(6486002)(2616005)(1076003)(478600001)(26005)(38100700002)(6666004)(6512007)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zZ/8oSsEQCRZROfuglCizXHnEZSNNiTxMlCSHA6J9SkUCOcHp/FI3x/XG/rpOrJ2VKCGuBauUVQODr6R+ErAl2NeWgED4Mw047y+JAE564WFUtrXI3wfnjusdYvO7anyKzXpiq17X1Jyt20NxgXJwN8GJ6I3LCMhl3zIH5CmQUgEYRGqE62AHYC+WI8j1w5f9jKP0bIwFrhKvpkMx9yuB7gsS4gOFEYDaZueUMQPrQq9nvHn7S7lXfrratwQ37j5XC2gU0tXI1NQDA1Z6lZJE3jmTt64A/C2d/ZA+TOWh7+hav3SyLkNpUa7R9ENguRpjO5G0KrgVUdbdaDoSRxQLFiGqw93L0R0ojDgNAclzRT5ztw2Xg0DEa2X5xXgMtGnLnB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AEMkVFedT4imZe/SzFGzqfj3qxRRbMweSN7HxyrxRWIXuHN3xONg0bN2O6g231wttF+voDyollnMS9hqSbrWCZaDvzu1DT2pU8w1Vban4wpS7bpCrh2H3nTl4yeHMZkDuGVgkhHvrjwqiYkbs18S35MZZyN82vHPuYX4AA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74715c15-3f7d-4944-6fb6-08dbc35d026e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:34:04.4961 (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: PKZcdCEDZAH2f2l/EDOm0zO2rfOcEwvt3/wVXlJWEAhXdQBBvA18TTMPXiDU1g2Sy52ZKpZ0VV2YgPiW77Dv+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8839 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Silviu Florian Barbulescu Update transport release flow for broadcast source --- profiles/audio/transport.c | 63 ++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 1e03b7b51..646061358 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -606,11 +606,38 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg, return NULL; } +static void bap_stop_complete(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + struct media_owner *owner = user_data; + struct media_request *req = owner->pending; + struct media_transport *transport = owner->transport; + + /* Release always succeeds */ + if (req) { + req->id = 0; + media_request_reply(req, 0); + media_owner_remove(owner); + } + + transport_set_state(transport, TRANSPORT_STATE_IDLE); + media_transport_remove_owner(transport); +} + +static void bap_disable_complete(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + bap_stop_complete(stream, code, reason, user_data); +} + static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, void *data) { struct media_transport *transport = data; struct media_owner *owner = transport->owner; + struct bap_transport *bap = transport->data; const char *sender; struct media_request *req; guint id; @@ -642,6 +669,11 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, req = media_request_create(msg, id); media_owner_add(owner, req); + if (bt_bap_stream_get_type(bap->stream) == + BT_BAP_STREAM_TYPE_BCAST) { + bap_disable_complete(bap->stream, 0x00, 0x00, owner); + } + return NULL; } @@ -1370,32 +1402,6 @@ static guint resume_bap(struct media_transport *transport, return id; } -static void bap_stop_complete(struct bt_bap_stream *stream, - uint8_t code, uint8_t reason, - void *user_data) -{ - struct media_owner *owner = user_data; - struct media_request *req = owner->pending; - struct media_transport *transport = owner->transport; - - /* Release always succeeds */ - if (req) { - req->id = 0; - media_request_reply(req, 0); - media_owner_remove(owner); - } - - transport_set_state(transport, TRANSPORT_STATE_IDLE); - media_transport_remove_owner(transport); -} - -static void bap_disable_complete(struct bt_bap_stream *stream, - uint8_t code, uint8_t reason, - void *user_data) -{ - bap_stop_complete(stream, code, reason, user_data); -} - static guint suspend_bap(struct media_transport *transport, struct media_owner *owner) { @@ -1499,9 +1505,12 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, return; break; case BT_BAP_STREAM_STATE_STREAMING: - if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) bap_update_bcast_qos(transport); break; + case BT_BAP_STREAM_STATE_RELEASING: + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) + return; + break; } io = bt_bap_stream_get_io(stream); From patchwork Mon Oct 2 15:33:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13406380 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BCC2E784BC for ; Mon, 2 Oct 2023 15:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238135AbjJBPeP (ORCPT ); Mon, 2 Oct 2023 11:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238123AbjJBPeO (ORCPT ); Mon, 2 Oct 2023 11:34:14 -0400 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2041.outbound.protection.outlook.com [40.107.241.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4DD9BD for ; Mon, 2 Oct 2023 08:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DBSR3qBdyAozPoM5gSVUxhzxF5JzJmsDYoxus954yIgddZYT472U0sf5etJgO3sZF/MZDY4sjIFGyeTch+SzqtnJACfNw/D9knK0LW2RE6YwV1+YE010WqgbVXxcIK+yh8QrnO4QNcdmtMuLiFhl4CJS0uCZ1wUgYNWJjKAwHhr3vOZ9RR5Ksu6lTwabPahiBJG4QZa3DyqAFv3s3vFHc9EXeFki2W3fTM2qU4/Kum8wCVAR9QaNoirDJVhSW+H+IosHhessp9swmr8pJodFDTGnZwNvCobrejsvIr6UXaf+Ia3TgvCRR2RiiDQutx10IFJsv/nwnJyrvrXvF0SCsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=jiPDUswL6jCg5ollJgqjcCO4jzlrHvAH0G0HqFV3/QM=; b=TnM3y7ipwCfS5L9jjdImjq5ahEcsc1eAU/UP/GRw1xRokjGJp6bo7QkfOCu+pi1+GXHuody7G0F1qJ/1VV62/eo24QTFNNej3HNhQ2X98HrXtRFInV4SSH0RT8bffabZt6wBsmSluJAYKfeyGqxiNqRKS1FekDDlnkJa8PsU1sfa6e7GRZ1Njeajei7Zm7/hRsu5IWq4wGZd3oeq1FPynnDfpf9+uI7cTp0GBXC9DjUC2ivS3WNLKEj95JXOlT/FDdX6JphySIAmGeRcqX9ZMkI5uq55TCfga+m8dM+HbpatLocJu8FFmECk/xNKG29vB0yBvMJL3r0xPRvBi5Jbuw== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jiPDUswL6jCg5ollJgqjcCO4jzlrHvAH0G0HqFV3/QM=; b=rqTNlanD15B8+zgCYwYqsGW73MJwD9jl1qYqUg7vrXPKVZTlKb/dxoqbSa2E9cPDFMKM/wT4m+KKniOLLj+vmDV6zFAJWiBA5uvgpSAYFqw5A+Wqykw11V7TRR8LHUz0yt3tSQyGDt4a+tHz6udhx3ZzFu35pUsgQdN8kVKZe9E= 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 DU2PR04MB8839.eurprd04.prod.outlook.com (2603:10a6:10:2e2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.29; Mon, 2 Oct 2023 15:34:07 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da%3]) with mapi id 15.20.6838.024; Mon, 2 Oct 2023 15:34:07 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com Subject: [PATCH v2 3/3] bap:Update transport acquire/release flow for bcast src Date: Mon, 2 Oct 2023 18:33:52 +0300 Message-Id: <20231002153352.3163-4-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002153352.3163-1-iulia.tanasescu@nxp.com> References: <20231002153352.3163-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: VI1P190CA0035.EURP190.PROD.OUTLOOK.COM (2603:10a6:802:2b::48) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DU2PR04MB8839:EE_ X-MS-Office365-Filtering-Correlation-Id: 265e739f-012d-4da6-e20a-08dbc35d043c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D5gfJB11V8/LSEiRnGkW/MoVrcP76cQJrHtNxV/3mnpc9vWjYA8vWD/e1lGNfQ+XF/gsroqiEKYSVU4qb5WCaUQ4wNw1VmC2bALFtr2ac4mGoQ9ssFS36C2LElIvTY9Z8WtuEj76ZnG6e5UnE43sMYYwQc+bMgL6Tiu1pbNx8fbTS4xaE7joHNw80/0oGgXPo41fQQrMOyCZVjhJxE4fcZcDkGMJgAnN4tjwQGigngukQJ9odbQYz1Q2ildOClJSP1qLHI9RqmiZH1F71fNlY2OxXojj6TK0jIgfmVnL54jBr9qYveJ+bbFutwDsKHh9u1a5ZPVrG9iLKz9OsOdKpP3MZ+REFr18QD7f8hKOv7antovONfkC5LVsL0YqY5tmaH8D0YyuEWI9NVtWlSWQ9XKHYlk+ke5902ClX8xn7nrkbZko9Au3vHzP2Wg0S/4C+NQxHhF90P96xZNNEWF5uDLD6O47x/YbRZ9qadlqS+w/rVc7F109GxW8BOQlqNtgY3NvJvDIHG8x65BO9wFCgeb83nn/jgj+WIy3EQ9mvUihhWVYfdMFcEbqYwIuTlZ/ 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:(13230031)(136003)(39860400002)(366004)(396003)(346002)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(36756003)(2906002)(41300700001)(6916009)(316002)(66476007)(86362001)(4326008)(8676002)(8936002)(44832011)(5660300002)(66556008)(66946007)(15650500001)(83380400001)(6486002)(2616005)(1076003)(478600001)(26005)(38100700002)(6666004)(6512007)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6FGkAbpSwyuj8FuMRj4ofliUyBh6v4wrfBcH/Vtp9Z7FlmEQ0T6TzRvl/tlGnoa4Ocylo1CVpgkdCxFKGtOlN6N8bLSfmNSGJtL3jAeuvqO6aHuK0cTfwk9kn22mWGT2TVJ+W7UZVuyV0Ak1rRDZbBKmBKSwDgRDipiWE1tZqS8qrpG5z3Z9t4qj39fDzs+nGeYzJ5/SGOMOdS7TqrZkRZQ5j/eldgbKn9sHuwdmG4wpfbWDNJk8/LdJx8m4ClxtUf07lZQHkBwqLQnx+jRNciPIxaREU82tfk32zzbrjr2nzSAqrov1a2gFR8nNbUC+44KF9Ham6YZPy3rPxMWEKzZYH7lSYGcnX7KBzZeIblIGJ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ug3CzVnbRCZRLJduUU90uD3fGyAzr8eY5a1sbTbbz1vQKfu3zdx3FlXvDGhDgVWE1pm6MXjxFZ3MHAJ71Zya2S9lqlaa6eL44eRJA2QydJpJ/yI8aJsXqC52E8EYbRV7iM/GJcLHZ+VLcN7ihyl0PZU9NB48ZDzdUQ/OvXNzxcYA5aHDkTAIXXuQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 265e739f-012d-4da6-e20a-08dbc35d043c X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:34:07.4493 (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: UC3+jFqzs60kPkplmrL47/c7tgFaYcmkGukiQkjtNyasaFjsrDXOmZSoSzAI866VTVie/Hp+Gp3zDDyeYwEF1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8839 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Silviu Florian Barbulescu Update transport acquire/release flow for BAP bcast source --- profiles/audio/bap.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 48a1a4f86..9a46b16ab 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1328,6 +1328,10 @@ static void iso_connect_cb(GIOChannel *chan, GError *err, gpointer user_data) fd = g_io_channel_unix_get_fd(chan); if (bt_bap_stream_set_io(stream, fd)) { + if (bt_bap_stream_get_type(stream) == + BT_BAP_STREAM_TYPE_BCAST) { + bt_bap_stream_start(stream, NULL, NULL); + } g_io_channel_set_close_on_unref(chan, FALSE); return; } @@ -1887,18 +1891,16 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state, } break; case BT_BAP_STREAM_STATE_QOS: - bap_create_io(data, ep, stream, true); + if (bt_bap_stream_get_type(stream) == + BT_BAP_STREAM_TYPE_UCAST) { + bap_create_io(data, ep, stream, true); + } break; case BT_BAP_STREAM_STATE_ENABLING: if (ep) bap_create_io(data, ep, stream, false); break; case BT_BAP_STREAM_STATE_STREAMING: - if (bt_bap_stream_get_type(stream) == - BT_BAP_STREAM_TYPE_BCAST) { - if (ep) - bap_create_io(data, ep, stream, false); - } break; } } @@ -2116,6 +2118,8 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd, ep->qos.bcast.big = qos.bcast.big; ep->qos.bcast.bis = qos.bcast.bis; + bt_bap_stream_config(ep->stream, &ep->qos, + ep->caps, NULL, NULL); } DBG("stream %p fd %d: BIG 0x%02x BIS 0x%02x", stream, fd,