From patchwork Fri Oct 4 12:35:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 833092 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010043.outbound.protection.outlook.com [52.101.69.43]) (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 EE2C91D3580 for ; Fri, 4 Oct 2024 12:35:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045345; cv=fail; b=pWpZQVFhTZwhk0yRZ4I+NVfgLfn7ITRxpkp3eidRdlRaJJFM09+e5uGPA3KkWafmGR0UfVdQ6MjbtkSx2UTZwymNJJL0SyQMgSlYFg4KRfp8Aj0vtC717Q09klIiTcE3owaW6xLTq5OaLMl+fYa+OusXP5Ki/qjkunXc8NMZQDI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045345; c=relaxed/simple; bh=XvJGS03WSoBqcrI1qyXGZu8RPaYTP7hHdijfi3Ex1gA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=J1h+RtyGAyoXl+qwTDb5lE+gyAa8XHzQd1doit6IJefTjPinoWkjTdUYU8bzdiW+QJ2SbCBpD8+XM02q7AOLkXezF4m/idClP3lgw6lCFC07fZPCB8U7u/A0TY/WZG1utdsNFwWeH74W+Sgma8EQ56cilwdk3RwQWA1NO/3FGw4= 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=S2xSd5Zi; arc=fail smtp.client-ip=52.101.69.43 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="S2xSd5Zi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tJGaPd56w0+OLyUHRrJdcJtJ9jhqKt82zVRX0yvd30LjifrUHQgc68yX0OP56WfzQu5WdFRnp6et+yZHBhVH1tAZdJeTG+Qi4tW5PiUyxFtTVlcmzSenilVQk6nauwYKVAoEHwV+p4g+a2Ws3RawqZGx2jHwSc7PTUdENMDMH/5RGYOw4i4cETGdapBAouj1PLt2xYAvSLRWowSUYtTLO3ee1S1g/UxnNhqxb3jZHzyQrbqUhYXHV4zQzry8mb97ea2JhpUr4tQwivTJcYEDVh+YxE8B31J+5kGYJB4dzAmzvmyiiEdXbMj+PS5SK3imoikGvlribZ7KzOhe+geakA== 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=xjrT5vOa3/NpeVUschanLFV0HQj8JvghIvNFcWfaiIk=; b=Wri33zKr72aAQ+Jl4FXFF/27/OkeSCagiLje+rluIBSlCgO7RG8acZ5+tudRcz/ADtCKTW+TEeDSyM72uGA8psmRe1ds7XcxS7WNMHJVh3t7Yawu9UeWcXXeuuaFeMLTKstCtaPX5KJ6tuC9LabBMDopxiQT9VdaELl9Ws93LzhgZZSmBzOF9E6y58rEdKxCCcAcws3VETAQaZAeZSS+9pprpFeh6bVmPMHs5hlD0OOlpWpFbcPzI+fl2/Wls2s1GMa50xZ7GXRN5Lj/0ybWDMKWhu/6OLAOrYiJ+if92iEDSDbOAu5hsAPbgxG4coOCgU0Nr3sd0Pjmumx+YEqDCQ== 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=xjrT5vOa3/NpeVUschanLFV0HQj8JvghIvNFcWfaiIk=; b=S2xSd5Zi9+Pad0UEXpll+q2EJ1PEENojMr+/9cNZXB37xLvrgwFSb1+DceREVTIKNg/jEHa+ZUlodWGFmjC5Z7h9GCVPBgEGq+O3YtvHGCn+BthweR5RZa0VuAddChUaxHPNZLFY3WIRjSgGszfkxUHaTkOmdKB8Mb0mpXwmm/QDRIW28H3Tfhx0yBdTi2wVJ30UUZgAQ3Rm7at0susaf1lWuGt/ChNAv+fjovDkjzHBNN7s81uMV+8wp4YEGbgM/ODpzGULOzyxXpn3yZIB0vYx4QLR4pJ5UwDZ+JuaYLackTQJ8VTUH59v4W9g4IBBlBIx7k9UN2uEtsPq6nQWag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by DB9PR04MB9963.eurprd04.prod.outlook.com (2603:10a6:10:4ec::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:40 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:40 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 1/9] bap: Add helper function get_bis_from_stream Date: Fri, 4 Oct 2024 15:35:15 +0300 Message-Id: <20241004123523.1012743-2-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|DB9PR04MB9963:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c2cbd8b-0f8d-41e2-9e27-08dce4710e85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: JEwiSsk/G7i6NOZlSRTHBGSXh1QTU6g7aLQ9Z6zI8P7tI8tp01bwu1m2xJSd1zHbPqOqCgJBrOBsU9wg/DWgZAx1TWNElItkD+R0cA8UR60OdyUOpq5N7EsQYKXpIGNav2b08Koeeqbju3X0d0el8oMbOlEa9Fb2lQ498uVG+ta3ECRwKfby7ni07bYH0bEl4mX3jVehagMfmNsX3K7LRcagxVdxHwfuEzfeE/3tDy/f45kaDKd2cb1xcTMBaHkd1SLqziRhLPl/RZ2c8Xu84zfLRryg95o1r8AoWJg9rRhrQ34zQmZM8aCNF96Q7Zvrc0aM4V+Z09WaKSUdLrdACDmt3w5+3ETPzGQgFgw9iZlddZwulLQAp+j4CHehbHjJ6W8KsY/fVuX7tjMcVUk+Idu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89ISbr1NaJHEUr9m11zAQycXUTCz3b0OzZP+PpWU0xImgZKp1c5pcDfoReInXQiUIU7cPIPs07sRgnclOQd8V2MxiMTqUFkaTX2XvdyZdvNE1yaDMYSzk1AykYjV7Y0f0sB37BE5vivDeDS1UGpW9ccTjWzKA0bKWMsEGPV9eHcmwQQe0UxaXfNwpQqg4z7WVebtwWlkzavz3bou1iotWW91bpvImwF03Kyg9etOJzF+eUSAQpam6I7B6gQ1OxSEZgWoXifyXJJfvVmeDjjvZtAayi+ImbNVl3H8OoOAieMWEia5eCrLU3my6xu6A24kVvtfjmoKT6s1pRL89TkOLp1cSyzPVhzODWd0+6huofPV657A2P/3GsioVhNujv8/QAvB7p7a0g5WH9BwHo+DY/R5oqkevns0jQuVBUCCF/7XdpffmQZC4JGMNHSYbZaomEdLY35aWulKdbrAVguRI028jM0UUE+KehoHLLytj+aGIq1s0NeVkNmUaOziWj6sR9svAa+RgkE75laqfnXbAN+uCO1B7+FiGira10Ib3oaG7/uZ3RsbLRSiJFMlLX1HtViamWUjoTvnoacHggKJvnWeUI/L+ix+0rUaqey8Fo3Nwjjjp+4fBb5zrOU+MzFq6xuUA9P3Z/ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c2cbd8b-0f8d-41e2-9e27-08dce4710e85 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:40.7367 (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: dR3js8D8RvMfJ3vaqQv0bKfb1grDAxKw15qwR1VRlqihNHa2Jq+o1WhZi3q2pyMk3VeA/jay/OxOCFD+ZdSIrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9963 This function receives a bt_bap_stream as a parameter and returns a number, representing the index of the BIS for which the stream was created. --- profiles/audio/bap.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 100acca57..b48fe2c2f 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -994,6 +994,30 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, return NULL; } +static int get_bis_from_stream(struct bt_bap_stream *stream) +{ + char *path; + int bis_index = 1; + int s_err; + const char *strbis = NULL; + + path = bt_bap_stream_get_user_data(stream); + + strbis = strstr(path, "/bis"); + if (strbis == NULL) { + DBG("bis index cannot be found"); + return 0; + } + + s_err = sscanf(strbis, "/bis%d", &bis_index); + if (s_err == -1) { + DBG("sscanf error"); + return 0; + } + + return bis_index; +} + static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) { struct bap_bcast_pa_req *req = user_data; @@ -3055,10 +3079,7 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) 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; - int s_err; - const char *strbis = NULL; + int bis_index = get_bis_from_stream(setup->stream); DBG("PA Sync done"); @@ -3078,19 +3099,6 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) * 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) { - DBG("bis index cannot be found"); - return; - } - - s_err = sscanf(strbis, "/bis%d", &bis_index); - if (s_err == -1) { - DBG("sscanf error"); - return; - } DBG("Do BIG Sync with BIS %d", bis_index); From patchwork Fri Oct 4 12:35:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 832812 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010043.outbound.protection.outlook.com [52.101.69.43]) (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 1499C1D359F for ; Fri, 4 Oct 2024 12:35:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045348; cv=fail; b=RCu5ZReGdyFEiehi20wcs12F6+U7JYECbEbdFq5z8DX17vOYIaLRKIuhi+seeMxbibEBsla5O6zSejaWTwt423mJd2jdC1MbrLdpbeSiVtTDr24Do18J4hd6z0UvOSDnLAYCXJL7lhjD7IPbPRwFCVekjxrPAvDapoTMFwO/ImY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045348; c=relaxed/simple; bh=PxND3jv0E4h02kPQYqG/eW3ZLTtmW2BmxwisxFyiVnA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=PcKVAHZrVYLXbW/SISnj41VdWTSxbcgdmbxwaxQp3+VjJ2TPrvmHcRLKAUtR4IS7iM/ISCySRuc78wXBCiDfGqN/knny9eFqiYiiA8W7jaHG64Ehugi6EbxD0R81vcljUDSXVp1ECwINoTozrpjhMXGvco7p9HuD8UvelaNPSiA= 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=iI53L9rC; arc=fail smtp.client-ip=52.101.69.43 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="iI53L9rC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bfVYi/KoHzBDSW6gd9YObKTlQ01fH8/WdXe3uyhFmDgP/yxOlQMhJvE38dCpEtf6QSDeqTKxZZJ6dfpWK/+dexf5xmo09Rn1cHJQ7xilBML2yK9L+1yKGZEBY2RQKBcduquHLznYhB4b1HZ/flA97p3v3J6niXZgYpMOvsburplf2Yh8bbfrYnyalS+VsELtFjp0KOYFtuD+pxYswNkiaHUjHPQWquGkK4iPgDSOxjS6EJhieSgtLEcdawVm0EhLMzbjFtdvinnCGv/Ah7801sfq/9JZNtaqT5+kr0XLbPl1dIZDMz/Zsf0NBZdm22gYZvLPecB+MiFqUekOljdVEQ== 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=D7jTBQpSnhsG7XQlCby6cFZyurqF5+a5KfC0jxy9qdk=; b=Z/Oo3yHANzGCGDMDzjKC2eMpNVYUPpTugIlqsBlWeCVcyaAXEGmFqlUkPfdwYaZFsixUCCwp/xNwzuAm8VABF8p0p4WLbxHgC5LPRCqaulFHEu17++mbnNpSWRq+P0aGYD8HU57zVVRnsTn2mawR6RsjfQ/DARm2PDhlsJMMMWleENngfd5UvVSH38G8OLtRhqOg0siA195/XXlSWkluHk25YRKomlXeC7jF7C1Yqv486s2VCiWePTY7xVdF+re5Rvdg9QH6z2WSerArjx3sjR4mvSgV1W1tfGb+ELHUoA7mcXWDvR6TrSjxylp+eNtkg2HUTCMQmOrX6gC6uBcTlQ== 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=D7jTBQpSnhsG7XQlCby6cFZyurqF5+a5KfC0jxy9qdk=; b=iI53L9rCFkZ16I5gv1yJvtCbWrpWHdwbEte/TwGVAw7q2kOSbxCAPikZx5BmgjkGmCNUFGh0CAcM59/fPTrL3iufS3XF1HBl8GFSx4NIPt81rqMVKh6NBL7kgJqjcv5DBuinwKEyawymrGErjURtcEafJrcQAV/Gdaq6dnysHm6Z6xSP/cz/43pvM8RpbZnHENt7xsLd9pRzckIOq1dvzb986TRU/JDJoMq+ux3IPaL9+n0tayKVrNMyKv8O1jkh9hYS3b4SJju87U82clJyswiFCIhLt5FKUn1NiQl7f12iI8In7rOGYgbjW7v/TnOcVmImvD73mlr1vqcpTxKFYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by DB9PR04MB9963.eurprd04.prod.outlook.com (2603:10a6:10:4ec::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:43 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:42 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 2/9] bap: Drop union from bap_bcast_pa_req and add setups queue Date: Fri, 4 Oct 2024 15:35:16 +0300 Message-Id: <20241004123523.1012743-3-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|DB9PR04MB9963:EE_ X-MS-Office365-Filtering-Correlation-Id: 05dd5f66-4617-47d7-25ec-08dce4710fd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: 1FHan3i48XDCfFyNf2vjxDaDM95bm80qHpGcuK/J+OZjCd1ofnzQYaRAhzcWortxtWCj2QKu2GEycroK67XaSDIwJUHf1N4rl/Xwm9dAvTinLGX4p9JG/MaZ5m0rTgHCuJkTVnGWBJxttZnX70nHkbLg/4ONNOcoESISjytwz1dSdt9fVNv0hwHK/COBwM7KpdQpL2hRbkV08M1epqSsCfKp5FN/Kd68570+Y1/dd/xBCWGpYgq83jX5vRkHAb5xQKk+gG7pmp66RgXDVnUYgtRQra04kwgTxVKsUMMKqhzN1SrHR9NF7QsGEmyh46j/OBlMDfHYOWVoNiqE1W6TnKqlOVrMD6Fy5zcKYKQXjhGFX9ZqS6Wj94I0h0D3tUQG1Rq5DVo9e4LM6EOPyu6Irh71430Ct2l3BvlMYdWqeU329vavAjLL5sSsvGrVt/b1teTvXjqvuBj/91lreQ39groTlRfC7q+QICFX5Zh7i5oMvhM4rpL2VABh5KfqUgutaH/CujX1Cu++hs0cfC4ylMacUOvNXELodvU6l5fTsXsbECYIaSYA0MchgILj/Cigx/YsaoyvOBn7peu4lLMQDXv13Uq2Y0rdOFhe/TvfH0JU9yc5IUc458f/H1CqrCJy9mEJSu9llcoqEP0ZsH19D6q14b7cxtkBpVNeGJCOclDma9YnwK0V8JBSCZ+LCFOmBwUL8Wmj8VGySe4cj/+Vo4LOatRmZjfxwPqe0z6QEBf/ftzwPTzqk/fQKOee/yCWyRc4jSLK7IvXybORLpwOSPybOXDYipbkBuhSWe9MHZ++cVnrV4EXxL91jTs/hH79X9xJ0iEEUsujBXw/z11hy4KLfXwc0MmMokXTZGpzWvwlLeDjoWjizh6jc0AvVvKHRiYnX/8NbTvY7qXpbhQQGQbljf282z6E/CFw09yld7gD1JKUggCiqEZVqt/xGvyqeyunkkI2GXadnqG2quvibYRCzfMCXQKF5BMsQHYzVKWZEhDpRO9t05lRjkjfR0QL0YOiWpV7QVwKHgOwQDMteQ9fwlaWMMhoLLINhdUCHtQ6IOUPPiwusMnXC1mR+YubltTK1D1DJd3HTmWjUpqWE6DtH+7yydGMLgUg1WOugbU5gs9V0hI8rEi3F2OtCn3oQRfjiX+NdV6OUZOFTq3mCJY7CSaYiP+IKNCSOG0FPGCEL7nDJF8g1Yt9JF5FU8XvSkrDraHI5C5i6c+qiBbkoq1R2V6Y1XdzYQhvuTYRlf++lNvaldwpkZkZoc0v+bSzOQWVVHn+ddnVUQlNNGlOvAbPQn9hjC3prxJ5Y5kN1tUvPD8g3eqtzfXfcuUL5bILEM7JcW/RvXgFFCkq9Mu4Gg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rNKIXSCP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I02a24h3Ig81vvXOI/RV/1xoEFrFc3KsoYYVOYBwngpCQhGIjtvIdG2h8TmoLQOSQDqfzC2oiq85Rz+USRj/AnudxYHzFEZ8u9KUH5lhzqY5ZjmGiD/MaBQLeKmP9CPv/pJiXZIW4LHNHV0/w0vK3nG7nyJv7LPHXtohQpt6ez6V28xx14qi6VqUpVP8QUIy3phKixjJs/0myiewLBCFs9zx9ecUN+NrHsftXIGIflws1xcsYayZHJ7NfKNszEVRgEBhKDVJWblW4iGJUiLkhhjhfQ+A5gTgfDT4MyJnHZEES2xtHwE8J0k12IhL688cYxyeLx/F0USqPslUuj9uvd2/XUAUPdROlCIIrDGkFcgtnNQz1qP44db0Hm0q1fZl5Aov3qTcndcZmxPbiPjtVGk5cB1olxG1rfdvDIbzowva3cWMn0K2Cdf1nb7zvudme4R2y/cFpzkIc4SvhX8By1iOE/feuiCQlZyLrsto1a0J X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05dd5f66-4617-47d7-25ec-08dce4710fd4 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:42.9264 (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: 4t1R0h659UWB8lSdcV3/QbOvVU4BnF2HBkCGLeROAjYZHoqHwCqJ+o1/VA/4i7DxHRxdKJfBQxccpl+jmiSXEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9963 For syncing to multiple BISes from the same BIG only one PA request will be created and issued. But, for each stream (associated with a BIS) there is a setup. To have all these setups in the PA request, a queue of setups has been added to the structure. Thus, the old union of setup and service has been removed. --- profiles/audio/bap.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index b48fe2c2f..94c7b7401 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -134,10 +134,8 @@ enum { struct bap_bcast_pa_req { uint8_t type; bool in_progress; - union { - struct btd_service *service; - struct bap_setup *setup; - } data; + struct btd_service *service; + struct queue *setups; unsigned int io_id; /* io_id for BIG Info watch */ }; @@ -1021,7 +1019,10 @@ static int get_bis_from_stream(struct bt_bap_stream *stream) 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; + /* All confirm callbacks will arrive in the same order as the + * setups were enqueued. + */ + struct bap_setup *setup = queue_pop_head(req->setups); 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); @@ -1041,6 +1042,7 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) fd = g_io_channel_unix_get_fd(io); queue_remove(bap_data->adapter->bcast_pa_requests, req); + queue_destroy(req->setups, NULL); free(req); if (bt_bap_stream_set_io(setup->stream, fd)) { @@ -1273,7 +1275,7 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, { GError *err = NULL; struct bap_bcast_pa_req *req = user_data; - struct bap_data *data = btd_service_get_user_data(req->data.service); + struct bap_data *data = btd_service_get_user_data(req->service); struct bt_iso_base base; struct bt_iso_qos qos; @@ -1317,10 +1319,11 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond, */ parse_base(data, &base, &qos, bap_debug); - service_set_connecting(req->data.service); + service_set_connecting(req->service); queue_remove(data->adapter->bcast_pa_requests, req); req->io_id = 0; + queue_destroy(req->setups, NULL); free(req); return FALSE; @@ -2291,6 +2294,9 @@ 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; + req->setups = queue_new(); + queue_push_tail(req->setups, setup); + /* Timer could be stopped if all other requests were treated. * Check the state of the timer and turn it on so that this request * can also be treated. @@ -2306,7 +2312,6 @@ 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; queue_push_tail(adapter->bcast_pa_requests, req); } @@ -3037,7 +3042,7 @@ static void bap_detached(struct bt_bap *bap, void *user_data) static int pa_sync(struct bap_bcast_pa_req *req) { - struct btd_service *service = req->data.service; + struct btd_service *service = req->service; struct bap_data *data = btd_service_get_user_data(service); GError *err = NULL; @@ -3069,11 +3074,19 @@ static int pa_sync(struct bap_bcast_pa_req *req) return 0; } +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 bap_setup *setup = req->data.setup; + /* Only the last setup in the queue will hold the listen io */ + struct bap_setup *setup = queue_peek_tail(req->setups); 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); @@ -3109,7 +3122,7 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) iso_bc_addr.bc_num_bis = 1; /* Refresh qos stored in setup */ - setup->qos = *bt_bap_stream_get_qos(setup->stream); + queue_foreach(req->setups, setup_refresh_qos, NULL); /* Set the user requested QOS */ memset(&qos, 0, sizeof(qos)); qos.bcast.big = setup->qos.bcast.big; @@ -3151,7 +3164,8 @@ 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; + /* Only the last setup in the queue will hold the listen io */ + struct bap_setup *setup = queue_peek_tail(req->setups); 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); @@ -3279,7 +3293,7 @@ static int bap_bcast_probe(struct btd_service *service) req = new0(struct bap_bcast_pa_req, 1); req->type = type; req->in_progress = FALSE; - req->data.service = service; + req->service = service; queue_push_tail(data->adapter->bcast_pa_requests, req); return 0; @@ -3289,7 +3303,7 @@ static bool match_service(const void *data, const void *match_data) { struct bap_bcast_pa_req *req = (struct bap_bcast_pa_req *)data; - return req->data.service == match_data; + return req->service == match_data; } static void bap_bcast_remove(struct btd_service *service) @@ -3317,6 +3331,7 @@ static void bap_bcast_remove(struct btd_service *service) g_source_remove(req->io_id); req->io_id = 0; } + queue_destroy(req->setups, NULL); free(req); /* Notify the BASS plugin about the removed session. */ From patchwork Fri Oct 4 12:35:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 833091 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010043.outbound.protection.outlook.com [52.101.69.43]) (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 470071D3647 for ; Fri, 4 Oct 2024 12:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045350; cv=fail; b=CayUumILztjxw8WRLHG9rn6H7/sWBcgVZb7YlossBNzoqApvEwuEsJk57TX5qyPZ11pO8dlikl32PLV1Zh6o56yFq4UIQJGTsCVyXbjB70p+RdWmtC6T2L5CmKswc5VoEM985hzvLUc/qIfJ7oS+cl5bZscs5/g8xzzjeymBBFw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045350; c=relaxed/simple; bh=IogroUYM13qKV15iZAHl8EpbiS7ZmuCiWiKxF6TCM8I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BQsd9aGzTQimNTjOKlik3k2o2Retz2/GPjUCxEIliG/lk5KsfN1mrpEr35TND0xXNlENIXMPtn7966iighidvWfhTgto4WvMnPIbIy6u/xd835CfBQw2eZRlXUfqflgMH71k0lmmFw+W3w7pDPfIX+NoOGX20i/eIMlN9honJME= 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=MQFQ35oB; arc=fail smtp.client-ip=52.101.69.43 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="MQFQ35oB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A9jbjUqQUROpg5wraUSSbaOFt2l8ioeI7Ai3ankh9iE/bVKhnu/dkx+C7h+mp4e/KaYVOO+zysXxGMq9w7lbZx2eZWuAn+ejLZppK8jUT42mvb3esil5FwxveQncW6Mc+xSOXszN99sEsj1Vd+IrHrtx0As09xIiyW2jSCxWzffiW59zHSwOggdxOWqOeRo9KnGsFA+3XHytzpnc7xlJgdvAJQNj2k3AhKmBe92IWWyFGwkaYTxB4zh/OkmwdeUf5vG/fr+9E+qMnIljZCVWAjPUXY+4oNv7ZqHZNvIE7AiX/3O0+S2caFHuXXgvdsv+nDOrbDpS+GsDDU8rgAEklA== 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=SR3sEy1WDkj+oVFjgtGoAcQ1aecYjfOjX3lJVMacNho=; b=q+n8BdxWa9gu4S7uYskvotOk6fsWB53tWxE5OmjZLIAfv2E7rBblztOILrYcYEg3gBBf/c+Js/UzJU4LsW4A4Jtw8oLZ12o10O+o4xbJd7X/fYOlvmsckKLf2If6ZJsGQ5SFsIIanDbj50MoZpMWnEFSXEFpaNUZ4DWmEh5y+6Mt4rQ+cW/n5ZXcgIZH39Sy002Mq4pDW5HSXsRm86TE1dyLU5W4lVGF3g3pZA+RPLKcsgJmbO3svQTd0AHMn+soNLJtFcGLS1eiTNfqFDFhBtxHyRX3kGr5i1caqUgdghYgHGGatpsUoZxlii5pazCY3UeDakB4Os4K2HuqBfF4ww== 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=SR3sEy1WDkj+oVFjgtGoAcQ1aecYjfOjX3lJVMacNho=; b=MQFQ35oBSYObztwh86+hQFkq3RCm9TdFcLQCGqEsWIPDZ4UBfUOKokAsuwSqqdkSrJsqUg/8VU1t8vBFi9UEugSvV8HepBKl4yq2/Gzi7pA1JdfBX9Ua8t227UY1lPrp69cqkcrZQcC3F012RQGofGXzTfJeNzaAJHOZKFGCoqhN36cqWhvBHzuTbaY3aw/WU19DPQdXzmj9hV3tWfIWdjMFD53BHM+Vj1l7xvmAhLDNWhhXYgRT9I7F9eN/kWeKvsRXlVNs9sJDbJ/7Yn1wknWLGUsLg3WZMciOHkc7YL/WdtPJhw1zS3xE2NctdMacY3TRg5Plh+LUzaSm1ZSSMA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by DB9PR04MB9963.eurprd04.prod.outlook.com (2603:10a6:10:4ec::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:44 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:44 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 3/9] bap: Store sockaddr_iso_bc in bap_bcast_pa_req Date: Fri, 4 Oct 2024 15:35:17 +0300 Message-Id: <20241004123523.1012743-4-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|DB9PR04MB9963:EE_ X-MS-Office365-Filtering-Correlation-Id: 5914f0b4-5339-4879-4da7-08dce47110c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|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OryuB42UlZegaHbGLN3gJKtMTXgJaf1A0H0pc2FaEbxBM8Z74u4Jxga9eqPEDt0GT19wkp9lihdM6p93biPjdmN5E3CNhuU4ncrM7JEf5IbLH66eD9MQ0ooG1fIRXNfX2YPYTSFr1PCvSShm7A/TvRd81hV9swUdeRn7WFwv1VrPjO/R9e3tqOBD0UN/MFuHgeHUybUi+ydzm2kQOp8arkQE8XzTAFp2lAp5d7+wwj63wM6wlzhY3Y8FhAujVv2JWwwb1TMXGIfM+oiZgmvMf9gS+C3X9JfB+C91/L9IjF7d7yO7EfVY81wW5nQT+N7Hf+A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NwuCLe1Vs7++CO9wCI6s1oH782Qbwdq9TBXD3HPAMFEkJdXAOQX/RAoUfXQfvnWH6BMXtPPfLfIzGvZ54dy6Jw/rjtZAQIk/wkigGXDuUOETXbrAAHk4XbkLV3H960jBgH4NnwGi1EVZtmnuaccAaH8fTYjSRCQ9vvURjuG75XPnz1suI0jcd9zC3vVaBC9+/93QgXKzZY6QellT5UB4P3SddYCYeZ8dgvz8MuSEJxG6QqKE6n6L1cGB4u3DdM6jy0+XFR22znmj6yoa7DMURI2yNaCjKLl7SxaUfzyWuoiBKKvvDCe0mE5xiMEdYgFtkgpIUPlH1jAP2d6CYkkTcvvPQN/5sy4iRm0reIRE1B/vtJV7klS3JP9dtbsA3V4VBYpXBcKkeCzdyMELAIhYD8dzZFB27EUMTSnVeQfyvtivGa8o6LhvPSAzgZfcd3Bz5EY0pZu1fGcMU1BJwdAp95CKM+5oNVdW+kPtwNSeyDeDBPWmIBIN9ioiqlK0pbwY50AcBx8s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OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5914f0b4-5339-4879-4da7-08dce47110c6 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:44.5539 (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: NV7vfMiRVM2RsElZISy1HK05DDb7XmEqWVGjTEA8PBf7CtKnvKxWYA4+1vqRlSIOoETuI6Ddh9yd+polweSuJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9963 For each BIS that we need to sync to, a call to setup_accept_io_broadcast will be made. BISes from the same BIG only one PA request will actually be allocated. sockaddr_iso_bc needs to be stored in this request, so that with each call, BISes can be added to it. --- profiles/audio/bap.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 94c7b7401..666d3324e 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -136,6 +136,7 @@ struct bap_bcast_pa_req { bool in_progress; struct btd_service *service; struct queue *setups; + struct sockaddr_iso_bc iso_bc_addr; unsigned int io_id; /* io_id for BIG Info watch */ }; @@ -2295,6 +2296,13 @@ static void setup_accept_io_broadcast(struct bap_data *data, struct bap_adapter *adapter = data->adapter; req->setups = queue_new(); + req->iso_bc_addr.bc_bdaddr_type = + btd_device_get_bdaddr_type(data->device); + memcpy(&req->iso_bc_addr.bc_bdaddr, + device_get_address(data->device), sizeof(bdaddr_t)); + req->iso_bc_addr.bc_bis[req->iso_bc_addr.bc_num_bis] = + get_bis_from_stream(setup->stream); + req->iso_bc_addr.bc_num_bis++; queue_push_tail(req->setups, setup); /* Timer could be stopped if all other requests were treated. @@ -3087,12 +3095,8 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) struct bap_bcast_pa_req *req = user_data; /* Only the last setup in the queue will hold the listen io */ struct bap_setup *setup = queue_peek_tail(req->setups); - 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; - int bis_index = get_bis_from_stream(setup->stream); + int i; DBG("PA Sync done"); @@ -3103,23 +3107,16 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) 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 + /* In order to synchronize to multiple BISes from this BIG their + * index will be stored in the bc_bis field of iso_bc_addr. This + * way,the kernel will receive all the required BISes via the + * bt_io_bcast_accept call and will issue the LE_BIG_Create_Sync + * with all the required BISes. */ - DBG("Do BIG Sync with BIS %d", bis_index); - - 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; + DBG("Do BIG Sync with BIS:"); + for (i = 0; i < req->iso_bc_addr.bc_num_bis; i++) + DBG("%d", req->iso_bc_addr.bc_bis[i]); /* Refresh qos stored in setup */ queue_foreach(req->setups, setup_refresh_qos, NULL); @@ -3154,8 +3151,8 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data) iso_bcast_confirm_cb, req, NULL, &err, BT_IO_OPT_ISO_BC_NUM_BIS, - iso_bc_addr.bc_num_bis, BT_IO_OPT_ISO_BC_BIS, - iso_bc_addr.bc_bis, BT_IO_OPT_INVALID)) { + req->iso_bc_addr.bc_num_bis, BT_IO_OPT_ISO_BC_BIS, + req->iso_bc_addr.bc_bis, BT_IO_OPT_INVALID)) { error("bt_io_bcast_accept: %s", err->message); g_error_free(err); } From patchwork Fri Oct 4 12:35:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 832811 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010043.outbound.protection.outlook.com [52.101.69.43]) (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 85C4C1D2B22 for ; Fri, 4 Oct 2024 12:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045352; cv=fail; b=mPp53PGIj2H1nvL/L7+l8+kGLQSkiu1nufmhAhpwO4wKviwEOmZNGT88bCRx0ubXEBORskCSGQ41pWHW75v/QV/Qf63EEaxAk8D2iLeL2Dv6Pu7+/Zwb1HCrOv3CBwUEIGWhJoi5B15MY8PS9L6QtwFoRc5pyoEMCKiFTM00lQU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045352; c=relaxed/simple; bh=7jSc/3FVSBbpsGVGOVD14OVNfVOjko91YLAQKrGAMR4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pr7l31G4/gGKHsl6MmAaJTYGtK3femdYNQuV/zWT1n67MIDXLSbJe7urV6QwCChOZbTouLrBZ5cVQd4NkkXK1xU6O5ITgwVJNFBt/Xbxs3iPzDgcLHbOAkpLYzyy073o+EJrKq3RfOsn3YsIapETj4H8+GaeEHpp/F0mef0DTWA= 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=mthZ5wLO; arc=fail smtp.client-ip=52.101.69.43 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="mthZ5wLO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UrH2sf+pSPjPLKaLwIFmm55/QGzRRp7Be+Yv4DETEswZ8uHKR3eXpPhkeVp1NWgPaceiEo6TQENVMo9OK6juI3spRWoWh51gdAk6kmbJ+cNv1UiHoBmvhZNjgUo8N2Mr7bN8STlHk7/kFI+iF4eOPqE0lNwQX60C2IfBHW33sQL4eLO7qtb3Ry4pxGCuwz5SllM9mQzUzN0xLIB/nd4/0Cm+5lXgzigEO+54CgxB0MRYvRLid7G3+Xaxn7IqT6IOZbh9QUTqbNMfanaQQszhumpkpxjuPPZYAAiwj8y0tExMS4Sa6/zTjma5Iq1CHV0BUIs36ofIIKj+5fGSy20iGA== 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=BIK5Q+hdHIP7pjacgsO5QQJxsXYqOVJjY0tpNDftS1I=; b=rEIbsXXJYpmgaGb6EbdV/sgMczuQoakbzRkkjdImIk3JbWscay06HQgzIuRwEH0ZMfW+eCvbZVjbNAjtbuw7IT9Myc/7aGSjvR1+deSKijGmcM0l8UlF6hK2V7QHSTpVLxuU0ptCHtHl7n6eeoP1t8YU88dVp+A7P/q12zce1phao6NowhwAXLdNkQNBIU1hA/cVtw3upO/+OlBKJ1DVkmLjDEcG83/FKz+Qzjc2dLPZJKKhjJpl5I8EcootLc574R9Jrgn7MtJHcEKhiVR1ho96FqNlNQOgTBDqx2/RqNhdooM0fIB+whqQmecBFdTKhV/yKkJYcP7QQNax7U1JWA== 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=BIK5Q+hdHIP7pjacgsO5QQJxsXYqOVJjY0tpNDftS1I=; b=mthZ5wLOJiVoZCKOchq2wp6nGNUBJvHeQValQAr/GIxci4gb9FcZWHS22o41rbgfpezWFob2ZuvRsaiDxosTWyKzBME0JwtsErOn2gvSXQW4wAK16o06Vk072XjWfv9Un/LWTLWePyVOuI/YXZ9A4ydFwqrZHuXBZTDqVCBxGLDv/l3p2QoVXVb8ivX3WxOG6ow3hOv6xryF6DfLXJlEF7wYbGHlsBneUbajhdah1sR2HOJvpWDa30PUwRY9GwZyXPia0c5frUHky7dkVHtQ/yytef1wNBhIxYkakRQaE4vDsVyaxpDzDuAb3E3x4rIA+Sz/XyCLihLvs3KwXevQXA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by DB9PR04MB9963.eurprd04.prod.outlook.com (2603:10a6:10:4ec::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:46 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:46 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 4/9] transport: Trigger transport release when syncing to multiple BISes Date: Fri, 4 Oct 2024 15:35:18 +0300 Message-Id: <20241004123523.1012743-5-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|DB9PR04MB9963:EE_ X-MS-Office365-Filtering-Correlation-Id: cfb85129-5571-4a7d-30f9-08dce47111d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: BNetteA3KgEOZBtJjkn1QgpteL5n6O9ia/s8UQvHGNibvxuNz3HYH9yuhpAlTNHbFgcACcdf0wXKzWeTo9CNYmdMpQjsodt2fd30VSXVOtiufn0LuZtmseDpyKriuVg+lIj7ETyWBgwYtDBPLV1YKhMcrboE3bbeQtNkvWwLV/YorcWGVGYnEckYllp3dGV7WUw3lD19xYyqu4tKEvwLwz6OGojQ1OPMmO03drUFBkjgr3lFiiBI9GUZYnCC+Hlx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mKixEwj5R+PdyE5yLri76ICjjUPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ls3sHp6e8U/S2ccy5x+TXUbNcGwdkVejIFobquYVRgNjS9FR855qNuWLnIs1WBrH+bohbKPEyjECZuccW9YyhfLhu9iixcDdwOgTi0Jdfca0xYjci4phlwPEK50jeLEoAmPFXluy9eGjix3oTx6LFDMvPr6dBPgPcJOEMCaqRaz21gAeMA4WKaObZX8jMQMhN8UjpXknKBpaMt+VaQfIJLOephC1RKQzpKc4Gy3Nii2x2Ju33YkGttbuRcLPfMdk4ROUemy19WPWTo7b4yqGtCU1qm+C/uy+TZ25KKxMVhUaUyM0fTM++cxciSB9bjFkM9XuJX3acBu12r7FUJ+9exSKFhKiZtf8LSdFpS8/djnwLP8dXYxg437glaAws+18J4hl3AUq/Om6pyMxfWzPiNGv1yFVuH7fSJXFQnFe/dRONR0CiUxlXAb7LTaCo9g3OY99cesV+exdLq2DSx90xa4871LcQ+mkiaQ/gtBQRmaEgjOYpdcYKYjGOl2uQe6Zpy2sIovxb8peZk0I89fR0CQ4g9JULN3inrAR5+7NpydYKkElMBlXt5m+nq2k32RHUn4tTt/tYBEmcWNdYVi9grOz06n+VAdLEbehDEFTmAL+CdTiwYRZqqswymDEEQ9Ak5U1rLltq7LHc+GCAWFofQWgOJ/kM4sZJeRTpkSIgMxk1KAmr1JgECImrHsdQw0zVBitl4QuTpcnUkvqRBVIN2FE4w8oNg7awOmtTMyNWxff6iGxIhLDFDCbkcSwV2btSB45KyUySTmVFBR4NhBvU0/9l+T/Wnio//P77oCs2hgfYDleQu0jjVWReFTVJmSk0G+6/OX2ldm4xnS6ltAh6WmPJa4elnqUOY8zMx12W6kebfWXp21qXE1QZEYxI0tBcZJ0VG+3lfUca69DBHmR0zQL0fz8QI1WTxLTMUShoi47e/lP1TsDyPXQ8VhcMhZML1MROGovdt3xYBe1rjAwTY9vYTk51rz8Am+OiLIcuecjQ1VDIGTSA9TEGmPTDD8+iF6FXaseoW9CmRIVudHiKEmLm7cb/5SLO3vHhUPw+fIBGVxzhiKSNdq5pZTxfUMYWqpOzh+AQlkCixEVfjm1g5FNBZ7U22LChMtDaNDQ0EgIU52EVxbuzAtFvyurYTVEDHFDGWXQC+HWpBrUqQgLim/fbTW5eFDc3RKGhMhpx3VYM+QqmTchO/7DLrRpt7AMbWJRD8w1CQKgmzWQ8CDxLPlUA2pQ3uP94D2oibqn2tLgQVSf+Jtkc+6XNQFjzhxLiNW8KCO7kAfkk8PfZbdwxm6OjudeGL72T+P3b+YJswvvJSLYgyaQ04YDb12swOPT7InJHAk+nd8kbD4+5RBhD440WbuWBKSEK+yTpGdLlZ1l7lTVdsiHXTGX+73zWfPGIbZJRu7TrTy2+9R5d0UQ+spcPyQKuBcMVcOtpqOW/Dxs01IdpA/+31DKzQgrfl2nIBRsnsxWQAR7NgWCii2rt6Rj3g3JWkqHIdxTFcXjTIyZh+ibBLA81BjX8b+yQ2p/3G8Ddrh8zEUoEl7zh7URPX9QJDJ2BGt2qwAU/c8+aFcaJOTnnMngAPCo3sVfwwCS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfb85129-5571-4a7d-30f9-08dce47111d6 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:46.3252 (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: zoHr74sTr0YsGlcsilIWVHa6IdEiDQlePPtswokD7k6plvjiaDouenEXp0ufBjbOyD2t7RVaF/BvkqVUtzIU9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9963 In order to sync to multiple BISes from the same BIG, the existing sync must be destroyed and a new one created. This is accomplished by prompting the audio server to release the existing, active, transports (by moving them to the IDLE state). They will later be identified by the RELEASING state of their streams and the process for reacquirement (along with the new transport) will begin. --- profiles/audio/transport.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index caa7287db..e68695c39 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -1366,6 +1366,7 @@ static DBusMessage *select_transport(DBusConnection *conn, DBusMessage *msg, void *data) { struct media_transport *transport = data; + GSList *l; if (transport->owner != NULL) return btd_error_not_authorized(msg); @@ -1375,6 +1376,29 @@ static DBusMessage *select_transport(DBusConnection *conn, DBusMessage *msg, if (!strcmp(media_endpoint_get_uuid(transport->endpoint), BAA_SERVICE_UUID)) { + /* Check if there are any ACTIVE transports, from the same + * device. If there are, it means that this is a request to add + * a new BIS to the active BIG sync. This is done by releasing + * the ACTIVE transports, and then reaquiring them along with + * the new transport that needs to be added to the sync. To + * release the transports, bt_bap_stream_release is called, + * which will set the stream's state to + * BT_BAP_STREAM_STATE_RELEASING. On bap_state_changed, this + * will be detected and transport_update_playing will be called, + * with playing set to FALSE. This will move the transport to + * IDLE, prompting the audio server to release it. + */ + for (l = transports; l; l = g_slist_next(l)) { + struct media_transport *tr = l->data; + struct bap_transport *bap_temp = tr->data; + + if (tr->device == transport->device && + tr->state == TRANSPORT_STATE_ACTIVE) { + bt_bap_stream_release(bap_temp->stream, + NULL, NULL); + } + } + transport_update_playing(transport, TRUE); } @@ -1385,9 +1409,22 @@ static DBusMessage *unselect_transport(DBusConnection *conn, DBusMessage *msg, void *data) { struct media_transport *transport = data; + GSList *l; if (!strcmp(media_endpoint_get_uuid(transport->endpoint), BAA_SERVICE_UUID)) { + for (l = transports; l; l = g_slist_next(l)) { + struct media_transport *tr = l->data; + struct bap_transport *bap_temp = tr->data; + + if (tr->device == transport->device && + tr->state == TRANSPORT_STATE_ACTIVE && + tr != transport) { + bt_bap_stream_release(bap_temp->stream, + NULL, NULL); + } + } + transport_update_playing(transport, FALSE); } @@ -1768,6 +1805,10 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, bap_update_bcast_qos(transport); break; case BT_BAP_STREAM_STATE_RELEASING: + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) { + transport_update_playing(transport, FALSE); + return; + } if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) return; break; From patchwork Fri Oct 4 12:35:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 832810 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010043.outbound.protection.outlook.com [52.101.69.43]) (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 999961D4157 for ; Fri, 4 Oct 2024 12:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045354; cv=fail; b=Ik52tonOsSARuain+HipiOuGVpLTxsVkrvXfGkk/i3+x1dW6tHf8DOfHQ0QJENuZ924T9tNvdBVBfSc8SlFLytqsPgSNe5x6xOrS3RN4fXEjsCMq0pamiHTWZn4iX/HxevQqm9ov+rxFwXCFRNGqu2HQ0eqk37MZsnRcbSepHnw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045354; c=relaxed/simple; bh=4VgrWy7pvuIvbK77BHveKT7+yzRn3N8/AVv2mZUlAo0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=MYJIuSzRFhIEjhZye9+39gO/Ro4PgToMItGdpGKBHYluFhFJv1ayCfJey6EncGgcm4edFOMBDuNBsxCZAGwthfXv1zDSa5mcrLqqg1b/Bfm4g0tk5PAf9Q4C3O615oLByVPM/nHV3p+767euaPO6d2L45aLrziOzkG08w34ulwo= 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=WAbmGMQE; arc=fail smtp.client-ip=52.101.69.43 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="WAbmGMQE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EgPtefHSd0MwCO8aFVnZec1qYDoWy7A2pgw8CFwOGsmeadZPiHOcQofdoC2e6D1RGGGOMKEQjgYorOMMIQ3IRMg8yf5+q134bp1BBz2eJocim7mrMceANmqjXiRSGjj9/UeD+2gyvcdRQbiKUaWsPUDRcGXEeUsxIM3eUmxFN3N39Q3oS0x0D4zoVNZHnTXOJIl8BHqlWIguIM2o/7w+YyXkm1Aqi4FqdgUoFRE6Zluor9iVne/xvDkcYvIbHVizf1Fi+oGiV0D6DQXfmj6Jvoh1vFk4btd0IJSDtfsJjGJ/qS7z9AgSDFwl1Jzd4oqgtFD/QXH7xm/MbrUSF0J5zQ== 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=QARf4C5FSnhN6Yu9ufV9K64i+dKocMYCWjVeAvq86xs=; b=P8wJCTnKmA2cJa9lGycYaOTpJAG3+VJOe32uZ0YD2VNUm0ZaPIn9OEqlswzh8g+nGxmHysu/bxWHCVcht614ZKWEN7bg+HkaPcdPO0SSEgLxpBsjF4EWHqnOBGXG3Ets5/r4zaqeTcd0AcsLYFSUsLtd2qfQzujTJ04Qrtbqpaj/ykzF1nrebgwpm4k4CWv1GZRM8sKfxGbBP66ZAliKQm9Ojl6tX3G5otMPJO4uxzXuYVwgHWIUxXaNFTOs7uXQi+QKVJEIRWuqduVlHbaXoNgTjEwtIQAv8deA7SumJsjKVKNxIij2Knvezp33VH0HZSjNT1cYm4xcX9RnoNOrZw== 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=QARf4C5FSnhN6Yu9ufV9K64i+dKocMYCWjVeAvq86xs=; b=WAbmGMQEuLc6Fzl+f4KgjM7CQR+SQLA6g/ql0fm1W5Uin0pUdyQLEnq81LK5tmsGmoWMo4FpLQg714LmTEQ63TrCXz05N9DolLhy7Mt065FopsIuAFHNs20E99GEW5E+EOO1vuZNJSlJlNCgoRkXhjXYhiWOsAa3BHj64lTFwdGFd2KkRUZcxXoxbupO7hKSS9jWFcpWlFX/TFFm/+ifCdet9EoAoXknCoqHk4ES2rYcbhXWKDoFjjvlGxVsDc4M5ZwIhBI+7/9flp5modSXzP8d3kpC/ZfV6VFVrBtMEjd5cS/15AYA+VGuzHvuXKHkfQw90DV9nMtncv000J7WqQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by DB9PR04MB9963.eurprd04.prod.outlook.com (2603:10a6:10:4ec::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:48 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:47 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 5/9] shared/bap: Add guard for broadcast sink Date: Fri, 4 Oct 2024 15:35:19 +0300 Message-Id: <20241004123523.1012743-6-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|DB9PR04MB9963:EE_ X-MS-Office365-Filtering-Correlation-Id: 25035b5d-0700-4d19-acf4-08dce47112c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014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HFva+D02VajT1qH9quSk8qsmwbj11f6tArRpTukOy2Wpq+aNOdYBY7dzb/GKSV26KK0fPKd+cqd4aAUOBlk4G73Rrs2JIVzBNU3lCvNytjBnepuRwtocGttHkyPT1B+zFptE3p3rdzvHsbFQTXwMVvDxnSpyx4JwsGgteCCZqt6sj+MstrwaVOR4qkWa27ShpP80midJ5HiqNnYeBtBlj4Z/iMCTJ8UDuolEJDsSEOJI4dvW74VnnWDNvOqWXVyk+6pzr3RnoZL5OYoH+gKpzuii1kpZUmvjCas4ah5g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qFOinskGlbbzUOl2R1cCBYt63hZKhvAVEHZN8kWBR4Iu+ZhuZ7CjP4OgLcI2Q83pVIZzB/oAxwExGQlgVgTD36ids9Kbj+0TXsTKHxPpA6k7oNIkXggME2uE/WruzyJMDDxIp4Ow77nvQClpqbXfBeDjwICgEqiv1XSX7alefsoGtFDdNecPzPVQoxFefXlhDjTB7M6PqbWGoHK+cKs5QaLQMKU7V9rc4v9SXnYGlGZya6de6/c4EHT1Nl1rOuPzNGCahjcEtdOtG0S/TmiI718vioUqY+jQlyx1KZ9b+wLJUokhldDIf7mzhOfxT59HEh7e2lnsDtl4i9aznVZ0xalz0GXpi4/RuVHeFCemQdjyvz2z/YFrCzl3vEr3l2LfOHTc+BobYcpBICfU05c4sfVhpUvOLEXBbkSxY+ho5p6SVOqC+4Fnzto5hJt1Qz4lFMqSN/3B+duKTIn7I96AKxLPHUQ+6zj+0Ly66Tx4QfKzKf9kP3nshZxT1MkkcMnvomwYjAj8qkofxjMYRZBKjfqHB4WpyK6YjdkD+SkG2mOx1c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035b5d-0700-4d19-acf4-08dce47112c9 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:47.9137 (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: sw4mRHOptnA1GDnkcnhpuhixgSf1J3ott4HGDWX+7FCV+bm1zMNU+arf+K1T+4RBAs8vaIbo36BgOf4WgKaXWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9963 BT_ASCS_ASE_STATE_RELEASING has the same value as BT_BAP_STREAM_STATE_RELEASING, so a guard must be placed here. Until now the RELEASING state was not used for broadcast sinks, so this was not an issue. --- src/shared/bap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 72f0f8a03..c69c9bf6c 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2098,8 +2098,10 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) stream->ops->detach(stream); break; case BT_ASCS_ASE_STATE_RELEASING: - bap_stream_io_detach(stream); - stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE); + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) { + bap_stream_io_detach(stream); + stream_set_state(stream, BT_BAP_STREAM_STATE_IDLE); + } break; } } From patchwork Fri Oct 4 12:35:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 833090 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (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 29D521D4142 for ; Fri, 4 Oct 2024 12:35:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045353; cv=fail; b=Su+uGjM4CDKBd8uLuHBFaCh+MiuZyeYgBn8CDl9+RZGuW/ytiyg1ILanb2utdpafoCHNgG7X6pRZSUVR3AqtBTu0EmdG1c96URO5Yn74uOtROGBh7rEBZ4nc+KnVEZKoB32ojliCEGfdAK1RaR+Kg+N1OvOyTUlJ1QBzL6T3WvE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045353; c=relaxed/simple; bh=WVDio6iGCi0OiqsZ9MPP1bJkXBkYa2+eLsFk+B2shcM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=CTAVf7ZllXl+uTxduwyIT5Va5SXUsJsPo6zQls/FXqzuUFDhCretrLoM+epgNffP5I9lEmW9HNk7LwH3XeZa2Fjz4H8dSu0A7mWy0hkWo0cDjUjxilpowrsHsBB+uQjzRI205LaBrhcHaNuTFQogFTblHen9d6uZHCH0RrFTFXM= 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=HlXbPk89; arc=fail smtp.client-ip=40.107.104.81 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="HlXbPk89" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P4uz7Ub4ArWD4yaOB97KXmHj4Q2jyrvYbLXA+waAzYI8RQzYgvpy9qDnBW89YOpTmstUVTAhthTZIpliNw3GqcDFHR/+yxxxWjW1bwPZ3pSZwwlIBUbZ97Jbpmtx9nTw/c1K4hmSsKXNr0TUpN/oKNfFGzqK3WPyTEIfEiXn+1ksdfP8NFo+9e4P32QKUoUk6FMFr7cJKQOqFE9v3vaYEhZg2HuZsEuwkv9sLLSq3MM3Nf3XFJTlTZsp7UaywdxVdT6pYhm04T2uzjiPmeRy5ohkSQXHus1XOwJb3UOLEpPAMCl6+nlF/vcFLGNtCbFKiEUYDh5cQ8NN1i2J1grnNw== 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=V0clqFoTmEpC9f+GG62Hv6DMAh1H5CzoA1IJRXyaQ1g=; b=U+Vk7dB4yO02BkEJnUvglu4fuuZS9LQFfQHOZdWDtfOGv+WbPvtfOw5HqLKCKLVT7kZ2/+2Br76WBzxCwRWyNAlBrEZv60AKLscbSmwSFj5/pn3n4Hlj9nRTeQ1beBAceg+vo2rOzcDR57BibD6jCTTOrCG8KYvoNy5U5xoibmjo/fshreYmbpaev3f63r9Cm2xcpOBwEncYq9zMfMctK/Khznk+NCt1SwE/QaoJgEashwVaTkfbwuw8MqHvHPYw73cj+cSsG2Y2WoOBV0UhvfnesRWvIZhhmA6jVHdjMKmW6tUjsTXquTypdCZXXPPH0DN70hqkpAYv6+A3UHu69A== 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=V0clqFoTmEpC9f+GG62Hv6DMAh1H5CzoA1IJRXyaQ1g=; b=HlXbPk89AbafzRHG9w3+9vmp+Ud5qi03n0jDN4gZYDIY8wLmKXgs+moiEe2RrqZCvc9iGNn4dl1nksCccRCRfPMkDwCD8yd5+YNBvRgGpYDx62n2D9GqhsSN8JNSPCcu+U0s8NXV+WLGaqePdOMUupcPbQjDeqQLnp+qz0Hp1wFMixf3LgH//XsCKHJGtatjkw3YbmaWBa1K3G/c8IOOf8I6kbA6531QmKq1R7B6DD8DrnXZTIf8U79kSCd+68zXS51nh+mrFySr5BJFS34/B6dLqJhqDXJW0Sw/ivEExYSabt29ikg/eF73f6bXxaWGIMyOnybhaNGFAEgPcdu+Fw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by VI2PR04MB11075.eurprd04.prod.outlook.com (2603:10a6:800:27a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:49 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:49 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 6/9] shared/bap: Add PENDING state for streams Date: Fri, 4 Oct 2024 15:35:20 +0300 Message-Id: <20241004123523.1012743-7-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|VI2PR04MB11075:EE_ X-MS-Office365-Filtering-Correlation-Id: b50e79b2-e336-4d5a-190e-08dce47113ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 6V1hRWlOSBbeb1Ekq2ADiOlsyyGNw5ej2fT9L1S0eIatlc0mPghf5FEGqjgp02peqnbosJD1G8oq+59GIaReggO2uaIrkY/bB+VgeJdJnUzT+FPwb1jH7x9TNJL0w3us8WT55ASrAEBbB8m68OWsnUJht7Jj52iJKYd2aVpffO18a9B/+isgStBxsztB3TbxZhNyEyDFSKUkdd4JiE9+8Wyi80B7ioBt9HKaBkyXh35cPm4shCZp/rSwXaj3C/EUQdNEpy26VEVqZWXWcUHnwldxlG+wPlybJcE6QnhQW8A2OEIbdZsJFufCWvzQGvGU6BYF0D5DSzQdgUZJjd3CtCPwADrup6Rs0mB2Amw9Jfm9lmqdb3/OBk0N2fak9JwSj6fdiSoLkpYTME0NluYvOs+llhJaWgQESMiUq3NRYW1UM96AF6XdWzjOeLqX+DU/VG4XPtnrj9TdhKr2GLidJdoU8cG7YUlA48EBIM8d5Ni8wieo1cA2p7luMUHR2IESYfmFRpaY4tzzd/pa200Pru+R+JnziIA+KfTS4+2zBittRAms5C4Bu8jkOxx4s4gMrSpaMVY57XmeQP90dPjohCSz2PvCw43jehJgncq5gu/vuPpeavOuNPgmSeGI9TxTRlG+sQHMvB6btbduomtKFd1ktqtE8XJ3VlSpqXhfjbi3nKPWB5LfIJjxJA3kgk3ysOlqEw6ZcLG87AWtqzgevVNjYfl6RAkw9IUpa0WBu8kQHzNDEbI6mEEjHSsdg83QSrF3QxJosO7pX3DbLifPzTVHlMCJ8CXEktLnwat+l1SAGdNKTVd9alP2yfQLExC/E2lB23epmNaMKIU4puMlFH4FLJTHmh4rHoEVmCCPGknFR+1nErfbSKbq/OLH3to/zL2Fq0IaRacYM96idNnkNWe5Qv6bDt+XqcMvve54KiBte+KUytJArJblSA7FqHiTEzSar69+sCL57fR0zDsIJ08C0vDy4lnDUh9cDJuYpeIV7MXMnfsouK+pcMuoQ7lMG73e18/tEbp8SSJc0Ldh76ynNe5WeEDhD+HPQmDBMSLkaLzzxBhmolNUpWx1M9JkhA8V5U8fNya7FpccmDQac/Fv3CiWPONRuc3wE6U9jf+v3SaCj2EMYplGat+0ZkzXIhkyQKWO3yfKfdXX5n7kw+MY/TfU3oHaMbjtk5nQufP0djcDtwSzt3DlQktHaXF+jIaa0mOxqsGhNRMzow+lN5FeSRmNox6UOVwKUHIn7zhvigPk7F/RZh6GczAcsa6n72cwnR3QXR6mw2oMARkibOJqwJ8QqHr7ilWoVfN9a0ZkON0fzBqyJTQ8FkwYUpy1ZV1kghsuVTYxF0kvAWCwbQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NksZJhMtWWGxSfu9xrCiJoJBw4r5fpluMzPwGs92vQeJcgtj+7PQ/DZRi7IGndlJA294axhUWBNygJFfKEp+Hm/0hCln3mvdhZmporZJFQj77DAE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VOlstJxRwZmSCyMiuhP2TsyX+0CzvWAqKNleSHpaUdY+4BJQu1HdKRPfw5+7suJKJeM0Wu0Q3BZZsTG4aHYlOe8OKlhI01tFlPgUh+Ml5XqqJWQE6TsWXRF6IflcVQxnY9Y749wS+WwjcKl+7rdIWammca37iuOaPhuz7vgv+nyAT+uwPuLwsoo3To6j4duGHh20HrC/5wuuHdq6pVTfL0Xez0CVWbH20L1LmfgV5K/w+NYZP4K7zbXfht6E0B4Hh7YldsoWD0N+57XSoNpqziYvDRd0VyOBvHnWeOSdgwQgbaJQWA/a9MobmxI5VqlUUa1dfbCiwc4CLs2lkI6IkLgHVMVFftODQ7nUHVgsijUJJiUyWRtJd5ME2XwSZWLH67W7vSspeUo58gtuo7hfZc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b50e79b2-e336-4d5a-190e-08dce47113ba X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:49.4700 (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: CgPjnIdhtRR3TxR3Arn4I/IanN6udOca43aKXFvQVw+zem60scjqYZV+5pa9KmssJ5/tYdTnnJKwc9Oo+NFrXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB11075 This adds the PENDING state for streams, which will be used to signal that the stream is part of a multiple BISes sync and that it needs to be reacquired. bap_bcast_sink_enable has also been updated so that the stream ca go from PENDING to ENABLING. --- src/shared/bap-defs.h | 1 + src/shared/bap.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shared/bap-defs.h b/src/shared/bap-defs.h index 27fefa34f..eba98d0e6 100644 --- a/src/shared/bap-defs.h +++ b/src/shared/bap-defs.h @@ -30,6 +30,7 @@ #define BT_BAP_STREAM_STATE_STREAMING 0x04 #define BT_BAP_STREAM_STATE_DISABLING 0x05 #define BT_BAP_STREAM_STATE_RELEASING 0x06 +#define BT_BAP_STREAM_STATE_PENDING 0x07 #define BT_BAP_CONFIG_LATENCY_LOW 0x01 #define BT_BAP_CONFIG_LATENCY_BALANCED 0x02 diff --git a/src/shared/bap.c b/src/shared/bap.c index c69c9bf6c..122f72665 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2146,7 +2146,13 @@ static unsigned int bap_bcast_disable(struct bt_bap_stream *stream, void *user_data) { bap_stream_io_detach(stream); - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + if (bt_bap_stream_get_state(stream) == BT_BAP_STREAM_STATE_RELEASING) + /* Change state to PENDING, signifying that the transport for + * this stream should be reacquired. + */ + stream_set_state(stream, BT_BAP_STREAM_STATE_PENDING); + else + stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); return 1; } @@ -5200,6 +5206,8 @@ const char *bt_bap_stream_statestr(uint8_t state) return "disabling"; case BT_BAP_STREAM_STATE_RELEASING: return "releasing"; + case BT_BAP_STREAM_STATE_PENDING: + return "pending"; } return "unknown"; From patchwork Fri Oct 4 12:35:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 833089 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (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 389041D414F for ; Fri, 4 Oct 2024 12:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045356; cv=fail; b=GrqLhCPANt1MwZKcNed4WvlqFUMs4xPDsIA/DdgWhLyjPC6jncjMBcyz+pLhniQGmDOm9T/WCFgBzDLUn0AVNUMMhG2OC9U8wYFHzX5j7c8MDLaiDlurH6qtufYZQcJhiU98k46hH7QJdTqaIhFTz0EBbQifoWvGoPlQO1TNrfc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045356; c=relaxed/simple; bh=9V5nz0iQvDZHprOomxwcwKQeSktgxhHp7EAc8fC2z60=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ZqRfGWcgzh7QggGaO53mGdKi0yAJYIOAJDw0zIVmbVE0Z5cQ+KdY5c5FD/7J6QU9kZjwFmphDFqbNjz2ny/pUt41u4MNZ8UWaXp010y/xnZhCzRe43tYXBhyaIA99WXQgREPgZ5fOSMJAt1H61hMPH7R0A8XhQdX43U4w3uBo3I= 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=TQZ16d6o; arc=fail smtp.client-ip=40.107.104.81 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="TQZ16d6o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mH5j4sMxr/t9oRMZST/lLi2lGDPpxOgJsezKejklf1f6R+UpaAXbtYM8Z81eEeXiO9re60Pq6B5AuROhHA4tBc+Cba++7+a1QorDS1aCTWLybQZf9WPYJi7ih5eeutw8GdLF/sLappN3bVEsqKBz4tgwnybSdPuyvcaEQrb1WnjHzxvTBcfuMiGCcz7SSgH/zDqqVj+smHqgT30+lS3xIW/YXTADfD0VDndXto+pimZfgnBKXNNQRghNpou2KbiCEkU20pkJ3qggZ8YIBnZKDV9OXwiFh0JZAy5qEtWwE/f96c9A3uE+VqsHzUeygsNixpQO0BxV3wLMtx7520UzXg== 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=uvo1Xh5B8/pATyDShifHKzsSNRJnE6903jqu9TPOF1o=; b=zJ/9CXxsy26T/4JDmRBDFykgok5YHaddDD5uaSHKFtLK2z0t5qyh1Sh9RxgIcdP9z+jxVOhO0O1g8OnUPM4kkZCaBHByjNLjH4XlIHSZRan28mammzU53EJB0UiBHm1q4wB9Hwx41u2u9HNSH/4NMGzV9hZae5ig9H+0DVl9J5zryoQMqLmmyxrYaAs0iMidjPKPeNFilQJV+/APeHvgc2GoPYmzXhc0mu4anXh4zgecDEmGcTet7mcjZoQlG748vmG9bX8mOFSKlkTxxYPrreC69P+RzkFNALupuZCd73ireS1xTeRae7XPAfau1k0s3w25qePtd3/eIAsAuZ6OrA== 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=uvo1Xh5B8/pATyDShifHKzsSNRJnE6903jqu9TPOF1o=; b=TQZ16d6oxmgp0UudMAxlnx3jjGv7Y8voNeAtG2+kk1KGyOBKKbbk4pRs1+N5ROd10SMPNb9ILOwilESr0BSIWT35lZocVIu5qOKsbctLyg7nZS1vT4o7pN4i5h1xPlSiOyGdIezaeRHRRrALhLNuAdM4b6qoPUb0M3FFxIV0QG767uxKpjQbHmfQ2SuS3D2Po+YreedsoAEfhgTLCHN6veAzOyB4sDbPGzI+IjKYYyqORPeIJGDwOryauX+ElX7a1FHCRlqyENgQPJbhXO4HTIgoMSrwBmU3A50VdLjIAQ9Lc4ncBFlZek4kngiksSFkUaF4ejZqH2yCz3WFt5v9ZA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by VI2PR04MB11075.eurprd04.prod.outlook.com (2603:10a6:800:27a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:51 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:51 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 7/9] bap: Handle req to sync to multiple BISes Date: Fri, 4 Oct 2024 15:35:21 +0300 Message-Id: <20241004123523.1012743-8-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|VI2PR04MB11075:EE_ X-MS-Office365-Filtering-Correlation-Id: 07193388-8ec5-4c84-e1d2-08dce47114b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: vTgDSw6w/eGfkyLHnoFtxQk3eH+xFajCAYVQi5EZJosN4o1viumPaT3AY+647SSZV3QVciaqvz1InaWbdi64X6FgRnkLvf5IMGj94OdBOjhBeUIQrwGt1oqc0Ag/nbu2GOPDBSfmBFdHphvOwg11r1LUgDLrvHPTSwnXNZpMvRvlfnqkG+iDYKpl3fVy7dvLrfX4vkpgJENwBdbqx2i4w6is274iAiQNTaaYFJahTN4+u5z6sr0nr9D81/UfefLaAXKr+o4KgYfQKNfLt4c2jS3rgX34WT9Ju8svwHCYl1+jRGlXHoyCaG9zctILbNApdLZKXxJjw8WrlGBO4iIZ0ghhfnA0MOx52dUKNjSSlhUjK012XZDtAloPzI9mmx+hnUKcC1vQxDfwShp3uny21VdXO6GElQg/jLvCWnbKcBqLpAhY0U+o0wE89yl00F9Y1+C9TKmFlFUqUg4HPd6f/j/44U2DLbPvYWgh+2Vu8pprfajXaO4oOI0Yx2p7ibv3YVXaiCvdwd0dNvaAd7mVLHduwgAkgT/Kuo3nh7InYZDb3vpXM5J+Ecjwqpe+rdLGEGvq2TS+5Emiz1P/cFdfpllvMhudDA1c0H8fLaXlAQq5lfL3n5/biZrjIHtMdeb+SUZkl8nH/1Evy1tyiXra3FtrdzTbg6tSXeLY6wawM4cskwEDQ1wi5yQNGqWaOh6aJpvIYkzsIFSYliVyME54ooJs8Jt3P5tvBMvRbg9TJW00hcbu7woTomxk3vFAzU1n4gfsGUHGOiDQf5OjLWWiTcfqmooVQXajLHWfiYq0l5OVX1HjUe8EONUINbAeeUQbV4UDNqmgKmraI+DM8EfRYVGK1nDN/yy/N7w3yukqaau8UGZCO/PwLnKUuWOz7QjxmXb1RIXN8+5AAgbuvDs/xbTdoehXxK94YdWVlZ/qx+/f9ae4Gz+M2+GrS8p4NKCrLqUcKc1suvpg3tAKB7+1NWruxn5jVtJgVeiTa4J2vrJeU5D+j9mOPm6GidkQgVmGeMpjsOKi17fhvQYmJm8ewSbzaBRZ8HWS3mNtGtPInkv13kJDaMpqpI5hBNlgRlOTWTaK17v0e1fk1GDqJBXtWWf9BUJbrBuQbuQUQtSI5XG3/PQA/AiuFif1gKPcGEFCxg9n0iVW/a9zGvBJD42yDRn0FIl3gmQHJgMZY9xfw+71bV67RwtBNQEoJ8dIfW1PCcV0ytrnkqNyTst33cnwm9fQ+8jVF3yFMCI82k9cjLn47C3CRNUF3jFQzQyQ8nZ3kenPkEMmjB5UhC6Wh3lhhkgZKaCyD0bLI3yEAlNw32Whqp/CuksiS5MgvQAjD+DnpXkstrgfjbT0VV7vNFARoA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4gHIqJam4p5OoKIIFV8hWFkF0++kROVvgbmPBuH1DcYq3LB9bV+Tz6W5QGXAge3BeO7Dzi7Btu6eoCT/cQ/3p+1A2if4bE2F4DxFkqp22lBM8iDPLMCYgoykcGmxyYezUYDPJtEFXQoBzdpcU5vYANkOMegSABYogu2LLCo8OCbIMt39k3jUHwNTyMCjDupJafMJqfw/Gd+E01VSz6PxihZUmU+mPpVGyo6TW5/SQ3+caJ0Jp13IwqZv9xq8DdInZujS5GZBGc88k4YSi8afMKcU7tx9SCCnDQuDeKPPC+th/bV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//3XSsjrrbSK1M31Gw4WaCdgEoWE25jJqEuM0p/ToaLzUJPboMR43p60rWELvfNpfkQO3P7zngwS7OXS7Q8uyPfpxlwGMPzrlyc6nfW/+I80EkPybTaAnsb5vlEEv4uIrM0U5NUQYj1t7tLs0lNCS15iuPTzL7GxEQ9yY5Ge+V1LmAxojvs4RTvX4oK1kjJW0Uxynd4WW1z3uIhw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07193388-8ec5-4c84-e1d2-08dce47114b6 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:51.1250 (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: Dsj9t1EipMIoT0E3E1EQL+kFE5yfwa0obC1V58MYX08Nx3rqGavbP2HLWtLpnJaVhBPa4DJS5e2P3DyVpvJl2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB11075 When syncing to multiple BISes from the same BIG, an acquire call will be issued by the Audio Server for each BIS. These need to be merged so that the controller will receive only one req which includes all the BISes. When a call to create a BIG sync request is received, a check is performed to find if any streams are in RELEASING or PENDING state. If there are, they are part of multiple BISes sync and the audio server was not reacquired them yet. Otherwise, the request is allocated and the num_bis and bc_bis are set, based on streams in ENABLING state. --- profiles/audio/bap.c | 101 +++++++++++++++++++++++++++++-------------- 1 file changed, 68 insertions(+), 33 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 666d3324e..7251d8759 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1031,21 +1031,22 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_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; + req->iso_bc_addr.bc_num_bis--; + if (req->iso_bc_addr.bc_num_bis == 0) { + if (setup->io) { + g_io_channel_unref(setup->io); + g_io_channel_shutdown(setup->io, TRUE, NULL); + setup->io = NULL; + } + /* This device is no longer needed */ + btd_service_connecting_complete(bap_data->service, 0); + queue_remove(bap_data->adapter->bcast_pa_requests, req); + queue_destroy(req->setups, NULL); + free(req); } - /* This device is no longer needed */ - btd_service_connecting_complete(bap_data->service, 0); - fd = g_io_channel_unix_get_fd(io); - queue_remove(bap_data->adapter->bcast_pa_requests, req); - queue_destroy(req->setups, NULL); - 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); @@ -2289,38 +2290,72 @@ static gboolean pa_idle_timer(gpointer user_data) return TRUE; } +static void find_pending_req(void *data, void *user_data) +{ + struct bap_setup *setup = data; + bool *pending = user_data; + + if (bt_bap_stream_get_state(setup->stream) == + BT_BAP_STREAM_STATE_PENDING || + bt_bap_stream_get_state(setup->stream) == + BT_BAP_STREAM_STATE_RELEASING) + *pending = TRUE; +} + +static void count_pending(void *data, void *user_data) +{ + struct bap_setup *setup = data; + struct bap_bcast_pa_req *req = user_data; + + if (bt_bap_stream_get_state(setup->stream) == + BT_BAP_STREAM_STATE_ENABLING) { + req->iso_bc_addr.bc_bis[req->iso_bc_addr.bc_num_bis] = + get_bis_from_stream(setup->stream); + req->iso_bc_addr.bc_num_bis++; + DBG("pushing setup for BIS %d", + get_bis_from_stream(setup->stream)); + queue_push_tail(req->setups, setup); + } +} + static void setup_accept_io_broadcast(struct bap_data *data, struct bap_setup *setup) { - struct bap_bcast_pa_req *req = new0(struct bap_bcast_pa_req, 1); + struct bap_bcast_pa_req *req; + bool pending = FALSE; struct bap_adapter *adapter = data->adapter; - req->setups = queue_new(); - req->iso_bc_addr.bc_bdaddr_type = + /* Search for requests to sync to the same BIG. + * If any, merge the current request with it. + */ + queue_foreach(data->bcast_snks, find_pending_req, &pending); + if (!pending) { + req = new0(struct bap_bcast_pa_req, 1); + req->iso_bc_addr.bc_bdaddr_type = btd_device_get_bdaddr_type(data->device); - memcpy(&req->iso_bc_addr.bc_bdaddr, + memcpy(&req->iso_bc_addr.bc_bdaddr, device_get_address(data->device), sizeof(bdaddr_t)); - req->iso_bc_addr.bc_bis[req->iso_bc_addr.bc_num_bis] = - get_bis_from_stream(setup->stream); - req->iso_bc_addr.bc_num_bis++; - queue_push_tail(req->setups, setup); - - /* Timer could be stopped if all other requests were treated. - * Check the state of the timer and turn it on so that this request - * can also be treated. - */ - if (adapter->pa_timer_id == 0) - adapter->pa_timer_id = g_timeout_add_seconds(PA_IDLE_TIMEOUT, + req->setups = queue_new(); + queue_foreach(data->bcast_snks, count_pending, req); + + /* Timer could be stopped if all other requests were treated. + * Check the state of the timer and turn it on so that this + * request can also be treated. + */ + if (adapter->pa_timer_id == 0) + adapter->pa_timer_id = g_timeout_add_seconds( + PA_IDLE_TIMEOUT, pa_idle_timer, adapter); - /* Add this request to the PA queue. - * We don't need to check the queue here, as we cannot have - * BAP_PA_BIG_SYNC_REQ before a short PA (BAP_PA_SHORT_REQ) - */ - req->type = BAP_PA_BIG_SYNC_REQ; - req->in_progress = FALSE; - queue_push_tail(adapter->bcast_pa_requests, req); + /* Add this request to the PA queue. + * We don't need to check the queue here, as we cannot have + * BAP_PA_BIG_SYNC_REQ before a short PA (BAP_PA_SHORT_REQ) + */ + req->type = BAP_PA_BIG_SYNC_REQ; + req->in_progress = FALSE; + queue_push_tail(adapter->bcast_pa_requests, req); + } } static void setup_create_ucast_io(struct bap_data *data, From patchwork Fri Oct 4 12:35:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 832809 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (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 61FBA1D4142 for ; Fri, 4 Oct 2024 12:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045358; cv=fail; b=HmbY44rMl9Bve5hcp2yBjMMuikvd0WOO1LXH4jDSJYJcG6+V80+g/OFLFzcsOVkN9wL6CzD98XizXqs/CH2UVRK2BFGOzDe03+8xN1Y4dH70ld0OBuQvGdla621F12r3UaWJN8cH1wl7vxVWD0I8go7dqbjPTASJ2E0Jn7dczZM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045358; c=relaxed/simple; bh=3LiWh++nUNfozu/xEC8qpB66kBrJTm3+3CNJYz5nMeM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Y8J2HPgbcm3N8qov8/VNv0EkmEKJjzGPIop7nkTTbxpJd7tyA9GXpDgToivQstIB5zByWrkzCOw+mYYCBZIm+mDbgATl/KbJ+Ge15ZL2jyCmM56Dy3Mnf5NW5W1YT2qHZ3j7FXE+cDksLI2etTh8EF5T5gb3Faz6NaDEZ9lWuXo= 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=eUXbYvFz; arc=fail smtp.client-ip=40.107.104.81 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="eUXbYvFz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sb/hRW+/wXt7ZWaegUrMJITCrJ9wOtX7HXgfhTjESjtafwtvgwNGq5EwrKWfw7MWVxJYNGRhMKb2gFEqYDD51EoFGEZNo0lFA0/02p6bq0wlKvk8vuArl9HB8r1NcZce0ewd67akIKPk7M2lggo0bMJBXa1YkoR8bT17VMQ/tIMbuXgWUUbmKwGQmvUs45amaFsUc1wSS+YmEl87V7bC4Q3VIXdTOjylqCipeyT6VzBhIBdcGLeopACDpybXWfIg7i/YjE0vszQayKI8WHaFRwEhsLBsxinROrBUJglp2Dinc593BB9x8ss7vlNWjjOpWCL93nB2qdQe+YSCzKCUdA== 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=Txo2QgUQjI1rbyu+smT5jj3GUgKx9AvL0ARgGXhFRls=; b=Nc/+SWkfhXZR14LQI+x3/HO3//4sSb1rM2GZoPtb/6fP8MOm/joYuBrj8DYEPZgBUTPjVP1oGrDRWSeB/pue8qmbpqlkswOJFvt1hB6/eALeMefyVEb0BA5qZmwk/+vFPd/zQ7iTVWtLeLOrA8fDhdOyfugepIqWVmR7fyzQ+OUwv/qwwD7+5fPYYeVOUTNxfOYD63BsClEMXfaQCIelgS898u+MCt31Qacwh1wv+IIN1KLuHWKk6GuurG8PxoJHKuM8iS8yYClIGBfuHesK/G4RZq/pXw+w4PS6YfKOo1VBmYK+hiCfnQ7EF5z9guerq+7clMBSN2KqetMhPiH3Fw== 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=Txo2QgUQjI1rbyu+smT5jj3GUgKx9AvL0ARgGXhFRls=; b=eUXbYvFz8btDg3707qbyTdpcGw2pwyRJQPdh8J2rimeL4uqtWOL5eu+3eM/oNGuxtLhaDI3w4gfA9fPg4TgIkSDgS98ZVO9cOu37tJt3+K3cvZiz7/C6sF7T3kGqab8bRQFwtAvZwDRwVWxjLLPrCGQm8asS9/WUsO1wVKgqlBcdRDUVdO1Ubs9L9AVU+d83D69i5eLuebFoszaqBSJm9c+byiQWcXs+024yotIrcFm+KLD0IPeB+mUWNuDwlfTWp5XZB4LjEZFzBGBr0xj8ujS5MOk2Hoopvl9/OcvpdHWrysMsqG0C+RzWgyFE5st1E8usIuRjHcJPWOyPR1y+pQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by VI2PR04MB11075.eurprd04.prod.outlook.com (2603:10a6:800:27a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:52 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:52 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 8/9] bap: Update broadcast sink state machine Date: Fri, 4 Oct 2024 15:35:22 +0300 Message-Id: <20241004123523.1012743-9-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|VI2PR04MB11075:EE_ X-MS-Office365-Filtering-Correlation-Id: 309f3709-a19a-47d4-0e99-08dce471159e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: DVtZE89tIdRLUZGpnoneOMa1CXn8Z8BxtpRFMFZCtwEmDFRmLcFu5EfY7Zj3iJf/90Vcp5eqewo8tPVRP7poVRsD660zFngTjwcgb3lc6fz1UnxgnFtC2eXR6lATt9sdnkP/3NEUTvHmWpFXkOJ46PQnwKBZ/F6eI/sw2lSPdI7s6EHxaMym/xb0wH+X9bTYxbbbHyhqoswQg66yEMLuXcloP9avyyp8tRN3tVZRr/rwtTuAAXqPb4W5xUlPbZHN+otWl6HeYu5L5iX7UB5gVgT6/ZsWoHw1gbmQxyJ/dDW4zzp2ZUKTy/jq/cvMhziyS2FUCyGvAFn3DDGgFebUhz45AOc50GSaC/ogQMYEA6mGFW2y90NoelvmQ99Es1Wx3iO83JuOA7YT9abAYGXf2zbEPjPRNSwB/05zaL2wQhWxXlHDXU/AVKS7TXr2Mk+LMWhoK61QHjYPMuHobA9p8Ux5eCMho6pOkew4x7Diw6zwq8eqiLAsCfR6z/dw3KFELAcPYZVvPDK15Jw+qkuL4g6UwaTgK4ZKG5+zeW2X2pouzvooG56Ejn3dc4rtLGEdz7NKq/GG4eCyIUX+TiD23wGiwmDSM8Ig/wh5xyoUvUGhCfXQ/mtDRFhwjNX/waKIOagXSE7RoUpBMA+K/KOpzwvPhTK+AO/9dMjPqV6ZpQna8beT+d7CltAIcjKl/VMVXSrDMWuXTCvFmYNPRAXUWC/YydP4cgpn69B58Jz/FDErQhxVTeW2Yw4sKC8+F359PwpJRABgm0XwAI2Le2etcPc++XOC8wicyJJ90dgpmhqBK3bqQ5J5c92HD0IkX3z9dd/5e+luvYvo8Ls1dCSJRUQR1FDUKKzD7TdclQEYgyMU2/ilF/LNS83mwrQrfr9ZjqFOnlt22o/bVwkbFE84L2g37mQ6OuKFvq74C7NP4ijbhd2vEoAhYJ2h3EDN8u6MaVGuT4ZJpqAWIoxv1R4sjAbofogKfTrRYQUq/pLlQsJp1E7QGLfJCnmbfPjCXMK0kHTFukYXo0wAHc2XwjS2sqNYgTYhq+23KARrL/2bObQr7/hJE0DAYoXnowWsu5kO6+5BQwi2RYEEI3JlXByHH/GX7dqFGZLtAMQ/spJZ2R/9jhjmZor9atx2uC8tr2TUItfXBe+8pwOnyxUM8TcPsI++/aRTBuOF9cIgUR4K//tKj3h6BFhbnc1ugsdAnsg5AeUvq1hsRkBwp1cJc8X4LwC3lkyKdgmSfuGrkClQEvf8+HD5WjTEmViC52NgERm3smMbdmpEHStMdUFkR+IAtsC9zoHx8qCfKpmsqIBFK0y2rs7n7PxEUKkQaHgzfrnI/nu8SvgZPS9XuoRCDcR5Vg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZrimCrp2PjRKD2oWWhGflig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jrdKirMAS9R9wBn7sK7lOw/3wCqEsPc3nJJ5tJLXFq/rYK3ymNgopgTF9586PeArF2lwWNR8Abyd8lObUYLDcjkxL2Kymsji5jj+Vv6RIhePSxGXBchKIXYHifk1omvkRK526WgyKwn1D7O9KaOAVL2rbF/gWxkuRgR0P8yS2spxAkJInstub/dFxosaYlq2TgMFZa0VTtz+sub/PIkrwUL7ZHYASl90ey04MdQcW1pQD8hYBjiDk5XEbfE9pLFi6U5cj5QHiAXN0/SGjPSZ0HhoP36y+kENVGapVJBdNKurOiyPTAwRSNDNoOZG3CD7jhGWTANyALRuGEL55kyR4V/YmlLHMngEj9DdS3Mrehj4LU7lP5x7mSiP5iPn3oUZjVeAfuVqoWYeXHxjnLXAOMnw9BGVPIv1zmX8PTA4QgoUNg4TIgMbp8+M82hI8OEIHdpJnGNkBDwKmyaGKqOXl9nLsrjx6k8AP6MQ7GxrOr5DJa08H7DM0hbpiN X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 309f3709-a19a-47d4-0e99-08dce471159e X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:52.6360 (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: B4b6/rnlFaCCutCNcdXr734WUGIYhYBIj/OySU5Bs3tIa3EoIfCFmM2HwkGbFUGzXpi31fCoyQEoUIbQpcEDrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB11075 This updates the state machine for broadcast sinks such that setup_create_io is now called on the enabling state. This is change is required to support the new, sync to multiple BISes mechanism, which will change the stream's state from PENDING to ENABLING and finally STREAMING. --- profiles/audio/bap.c | 8 +++++--- src/shared/bap.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 7251d8759..75be494af 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -2748,13 +2748,15 @@ 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: + if (!setup) + break; + setup_create_io(data, setup, stream, defer); + break; } } diff --git a/src/shared/bap.c b/src/shared/bap.c index 122f72665..49db341cb 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2116,7 +2116,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; } From patchwork Fri Oct 4 12:35:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Pruteanu X-Patchwork-Id: 833088 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (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 65CD81D417D for ; Fri, 4 Oct 2024 12:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045360; cv=fail; b=onqRoDWka1yYkpTZ5879BrhyCJWN0nYgxgIsz3nU3MTmZsiyhxhlAIChTQb82itZyFPS0P3cNH9zXOWa/oyLISNAVIzgVyOdq694upVnfXioY3MEC9eZy1IxOTqrwG+79wXgU/JbXdXBe+SktfJoErpttvAWLqAKDGHKInLmgDE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728045360; c=relaxed/simple; bh=6wNahkMbVA2UziGnvNJTEsLL6VUUfg/+tluezrQvQKc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gM7nGYsw6oQ4Vi3FpKEdlRK6g6t1TWIkh7SeNCcPfB6UFjfZ6estcq2f2jYqesSkkZXWypTIxFt+oxOm0D368Jb33M+8DKmxnxIsFRaWT6deEIZO2LWHL6k5DiIF7DQVJ0/hEXmwPa0lKIGgLirfRwc2q+yVPhOR+3KD56sy5f8= 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=CdLKRoCg; arc=fail smtp.client-ip=40.107.104.81 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="CdLKRoCg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kXsihAMO8SekLX6UpqO+B84uEpRDjO7Z0D0I9/Pt9IFc8IWgipaWkvDnc1I0JvJz0iokXC8wQOM0ZiJo4hOeGFRJ1hBNOJ7NDyYGqX6yfpsdIVjKkZXFdcnaVTnzOIsjv3+odJO46w6R4SjDKpVrtWX1nHCg4SXhjjDQamYDbsMlWCFoKUdj9sI4Kambto/g7Lf7GD3mu835/aAs/R/fHbrtFNya1ySMWVwJoPrFLOoymgIR6U77yP1dHOFPN+JXv5Dd1sFflAuELScvYgcdoFlS+b0BRzXpraNArW3YuEX57/K1SIntmw/ksJT4vo4yTAbX1REwlk2ijPfKTdNqUA== 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=fUHE+BCh71xxaLeIiI/5JbvF1U5vTxWAMD9djvotLEw=; b=iaSTuhvy3WT1v3QzsqJevmD1EUfLzgVo2PDSvDmtiVKjfwC6D+4tz+WUTiXwzOSn0CkcPSvEtIX/ce9INgos2SCip1ZPXikiIw1rPQwQzRGCyWk8DL1SN8cmr/ZkGiLTcV+hYbgnbziTcjv95LU2gc1ukxdbxnM/G/dUg809vIec/47vmOSQxG17xJHAKeSGK4RgOqesPvA8ZP6w8xFR58IxGNRpGAI9AdwKvnJmOdTNcHyOIhOYG1QUIt6zJPT453vCp2vCzeBbXo2rIrNmNFVVKQvi9d/NHtTmd/05AL3CF5f3qppeOBvT77mt/HqHd3UEN9yxRGsMa5p0FH+wdQ== 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=fUHE+BCh71xxaLeIiI/5JbvF1U5vTxWAMD9djvotLEw=; b=CdLKRoCgyXUl9ZEh2IQRWMQgvifTxKlYAMBs8t0F6/pG5ykLazn8GzARZJDff78A6TxMycFlnbJfETmrBKaA8ymXygKvYoooLVzs7HLlaKyNSAauVeq5f6iqdQjIlABd5JsvKqiAmVb5eMY7j5XdQI6VdiSpTxWolOER0+sHrLAVH93aysQlWrpw7DczW0riwH+c4Lblz29vAkB8ZBzEx0fmAYl3X51UsSL+iehDZlnqwVjPZj7oBd4mGDHLGVOnwKUpflvjRa40TW0NE55jEOaqMkhQ2U/BkBeX39Gjgz3N8n2Aqv4yHfv98N6dTI5/f1P8UaI186w2UH76gW0ZxA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) by VI2PR04MB11075.eurprd04.prod.outlook.com (2603:10a6:800:27a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 12:35:54 +0000 Received: from GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277]) by GV1PR04MB9088.eurprd04.prod.outlook.com ([fe80::8775:dba3:39ac:3277%3]) with mapi id 15.20.8026.017; Fri, 4 Oct 2024 12:35:54 +0000 From: Vlad Pruteanu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, iulia.tanasescu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Vlad Pruteanu Subject: [PATCH BlueZ 9/9] transport: Trigger transport reacquire for multiple BISes sync Date: Fri, 4 Oct 2024 15:35:23 +0300 Message-Id: <20241004123523.1012743-10-vlad.pruteanu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> References: <20241004123523.1012743-1-vlad.pruteanu@nxp.com> X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1PR04MB9088.eurprd04.prod.outlook.com (2603:10a6:150:23::20) 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: GV1PR04MB9088:EE_|VI2PR04MB11075:EE_ X-MS-Office365-Filtering-Correlation-Id: 677f9396-b07b-47ab-9a07-08dce4711684 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 2Mt7pX9nXaeDRDFbcaf+sUd3pZaQV7mzRx59TVG1IOMg55HbtvjT/SD1wymJMPybaqTt97/tHTCPJ3CHDrym+FoyfaD4OFbodP+6IHeuOn8bHqFkHkV/WjsODDi77ue17DfU6/GNkw0VkfFwS/x4YKvdooZJFwQVLA0TbSRxSBiCwabfEwhOULZ5rLZ0xKrpnHr7l/SkPdRYtQyoCzmjf4Qfvp3qgkfwl5PeCWKBnvNLt5cu9y3y7B9X/VH+su3IwbxKxNoj/yFiaK2drKBqkkMdOt5GOMT+29VW2IbZFN0g90eE6Aj2MqXvDfAgQVGUy0O3fYG7VpOo0md2qu18oX3AD87fjSXQtuOM3U2pdvbxPHzS/ySvMr8vXeHiXPXm1zD4IxrTAN0wh5s1bKQBHjxCJ1aYd/ul6eoFDd7atAkvylzEk2znaYaL4JNnjaXncahmNQI6We1c9Bhv79CzoE9T+qOXL6+YSs8segCnvvcxEsqdfbosRnMmJlYBcig+Ms4kmKw+Q/0yXx82ul7TTiFMaMT+1G9VyrTbt6SbJtiSJbBEN3JlGruJuxW8zIR84IVS3laQq6v5wkJ6IvEoQ5Y5xHthhtGHh2orSs8m8PaHFLGZvlWt8ncrGp8gAWDqlwKcqpMUxkUZfUwFdDrtQSfRN4GP9hxpTbKC20uXoMvSuOJBZajx3EWQ5aaHlXjHhqnp+pmWD/5m0rW9Yh60/JAU14ikwA6t4cT1oj7/ce+Ffw1rXKQQLRvjyKP5keejDrrC8iIHh2rkWNdmRu6ufhuKdyAk59838SJCra79FiWOV4CHVbNCxEecJqwkVsCfdYNWF2il/96L65XuO/QZxQl2QRJGTpHTuP/ELsmsw+2fWIWxnHGTdx/0lrQ5bDI/+RIVTRi6wGX4W0pOzEYciacS3tsl9P9b6bxuABnHuDJZQa1t1bpiXIJYLW64RKob9lWTeEJP9WIMbAFOxwf+ZBHmBC6O2yGg8h1sQ0y2z9HIzCAxB4iXkPer0t+dSb2TAGYcIfT4DFkOTHkUgmM7ORFofSm0CaV3qp1aoZW9HPRDI/VCMWzEb6i0W17W7ryL5pBYl2jum1e57KERBoZQEcANR4hYIkG1unlH5wKFFE48isJo9IugU0bGZvgUlM1wvI4otCJNaDOqT5YVBP7FhBJUuitmRCYdMJ/8ozrjv7ty/aFJ+fmcNBgYqL16kVbfmk0c/9Z+xd+lgDK6uoVJn4ML60qpAWX/ongJgPVT752YepCP6Wgz+nqfrKiiSv2HOMPNDQ5ECDQ6+HZPEzCE6BhaQFYumNpWiee1f389SWhL6mjr0HieRKaXrDkENJHxrOa14dD64C4cBBswJ96vrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GV1PR04MB9088.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MKkI+rOjUmM2Npi/yPJrWJ7oG7G+vCi7aVaT6eL29trXoYmfl7aUuGokCa0OiwXlxDplScrbAViTFLxT3TqOvEqsmN/QXoT15JMt8rTRhd4937eQxGucW50BANT9vEQB8rQ6O5FLessZ3MTROIGx7Kk6KOnhhB1I0pnThCCxMp85fCpA0rD2XZLLBYGIljconFmpgWY1sc1mRuRFgVlYzBY17DAYOr2W57IsnUQrqiIHFAQ3j5ecCkXkKG41Q8w/+/ALclZ6Y/4xNOS2s74eL9v8MG5xBiAIWAa4Q2h+4AUZhbjudAKe4YTtmjkBm0St/OUCGfeZxZe6zcZ5ZW0rSF4CHQ1onMUoGqHNsF9RjkFD77BoM8GZd4NG2PqXAu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pKhCIfcnF/49aY9twvZtF3bK7IZ8YsmrKGJyYHuacovTu3r2YxQ/HkMvFeNtNFIpJOl7FejR4EIthzZWc6ywxgwpVeQqpd2udeOKNucbzuCjNNf9FH7fdpcpoJ1r1P0JI0RMRAHDsRw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 677f9396-b07b-47ab-9a07-08dce4711684 X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9088.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 12:35:54.1444 (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: lFChdTvEhbsoOkH6dw6ZroyuLo/FR/rzeUNkkcmwXXTMnBM+ooK90pYXsfPXZtqCgiRdvlB9/wyC5WETtqL9Ig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR04MB11075 Once the transport is release, bap_stop_complete is called. If the transport is part of a sync with multiple BISes, it needs to be reacquired. Such a transport will have it's stream in the BT_BAP_STREAM_STATE_PENDING state. Thus, transport_update_playing with playing set to TRUE must be called. This will set the transport state to BROADCASTING, so that the audio server will automatically acquire it. --- profiles/audio/transport.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index e68695c39..4ea793a27 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -705,13 +705,16 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg, return NULL; } +static void transport_update_playing(struct media_transport *transport, + gboolean playing); + 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; - struct media_transport *transport; + struct media_transport *transport = user_data; + struct media_owner *owner = transport->owner; if (!owner) return; @@ -731,6 +734,11 @@ static void bap_stop_complete(struct bt_bap_stream *stream, transport_set_state(transport, TRANSPORT_STATE_IDLE); media_transport_remove_owner(transport); } + if (bt_bap_stream_get_state(stream) == BT_BAP_STREAM_STATE_PENDING) + /* Transports with streams in this state should be reaquired as + * part of a multiple BIS sync. + */ + transport_update_playing(transport, TRUE); } static void bap_disable_complete(struct bt_bap_stream *stream, @@ -1707,7 +1715,8 @@ static guint transport_bap_suspend(struct media_transport *transport, if (bt_bap_stream_get_type(bap->stream) == BT_BAP_STREAM_TYPE_BCAST) { if (transport->owner == owner) - bap_disable_complete(bap->stream, 0x00, 0x00, owner); + bap_disable_complete(bap->stream, 0x00, 0x00, + transport); return 0; }