From patchwork Thu May 23 15:47:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Silviu Florian Barbulescu X-Patchwork-Id: 13671991 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2060.outbound.protection.outlook.com [40.107.21.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62D3B12E78 for ; Thu, 23 May 2024 15:48:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479284; cv=fail; b=km9F334wTVLSFaYvWX4r6oxx/VNeIcnBZEO/y6pssv9qCWtF0Yucnx6XO8A6q7LOP/wnouOcE9+kMDigcRGfoKQ25Ar/e10xIl6Hhdek8UMim8AospUNHoAAdV3sJXO4r9pSdF2Twv43PJCy7e4csF3E23vRHzOmVw3w/ea6DhA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479284; c=relaxed/simple; bh=tXGfaxszquYsjcPSu2fnpfU8sMHmp/ddILS8J36PFkc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jewia82RUEbMBbz4pdTin1lY/C39G+0U92T3CknqH2Yg14dUSonWM7+YIVuXIeJRMpRWKw9ZWI136ujBz2TXdt2uA5TOpW8l753NxVlsdoV8XLwg3cRdBeY3cPCW7XWIhLCqsdhbsDnWpw152nbhnci0tka9JiXzFzUejoDznBI= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=DdjQcaDC; arc=fail smtp.client-ip=40.107.21.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="DdjQcaDC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfLZm7VTqYllfTTGnHrZA7t0MCez5W0cQpVNPvJ9sNU6DnvHPVxGKzaVd/EoJq1vyK6DjdHMeVBGGfxzliQF0xq52g1CMCcOEqm2icd3djvKqXhsCZmNgN/Zy+2wE9ahqQoC+WBaeIRytYkOL95BaH0de31xCv1bZANygbEYfejHztgEOt9uiYAaChU5W4UnlHAp8Hw/2kgDPpFX99Qi7rKeG4KPlhxP4usU9CtelmP4D3BqAnfQ+aPuWwdJm8+1ZVzbTqJFyTkmK3boNXmAzivrKY9jcZ5ycE3p4q64n5RwSt2onRGx5083jqfcyKpLJ1gsLA6uRC9TOoRG20khXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NZLUm9oZ1RqADjuc8vP7Tv9f1PjBaP+t4CJF0kx0e8E=; b=i5lYNn4oW+q7EbY6T3JNtQWs8sW0NQa8zbPhQDgLXGf9hJ9MEZNBHHjtWlNlC552k4t46jIBnaMSpKXnSNrI4tcyrsDF9xcA62/1/LFibOXcvbVXTJn0NIm7jRs70BcEvG1+WXTdLJjDvrUZtUL5k7aWEJMqGmMAQVJZD0h4H+C7FahLVK3yFLD+/njOb1pyvsijAEoy7dz7NMDwT2MTRAmOCslugrUhRaYnKRpOSBn6NUuwH7+tr8yVaRujg1bvewqhIVgmkQFxeXiLiUVzJ0EonK5QteVOz7aqYo8lk3XNLQQmW0L3fX8327GIMkvqliMGxDgbXk4OKLP3vLzZ9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NZLUm9oZ1RqADjuc8vP7Tv9f1PjBaP+t4CJF0kx0e8E=; b=DdjQcaDCSpv9zOMEjBEhkbrHQZ0fwwSAIeGAIMMkiUaRtEx9Z+l9Mk3vP+rBS/qOdX4lzRlRFX0nN/nWQQCo6/3IK6rpZc64bUr2QSguknRJ8nQ2kwzZ8m60vmzBphNLKT/wLrsiGMQoyannP6axRyffxZBAFkKMrXWgoL7HyPE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB10073.eurprd04.prod.outlook.com (2603:10a6:800:1dd::8) by GVXPR04MB10658.eurprd04.prod.outlook.com (2603:10a6:150:21a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.19; Thu, 23 May 2024 15:47:59 +0000 Received: from VI1PR04MB10073.eurprd04.prod.outlook.com ([fe80::5d49:58b0:19c5:a38]) by VI1PR04MB10073.eurprd04.prod.outlook.com ([fe80::5d49:58b0:19c5:a38%5]) with mapi id 15.20.7611.016; Thu, 23 May 2024 15:47:59 +0000 From: Silviu Florian Barbulescu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, iulia.tanasescu@nxp.com Subject: [PATCH BlueZ v2 1/2] shared/bap: Update BAP Broadcast Source state machine Date: Thu, 23 May 2024 18:47:53 +0300 Message-Id: <20240523154754.39451-2-silviu.barbulescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240523154754.39451-1-silviu.barbulescu@nxp.com> References: <20240523154754.39451-1-silviu.barbulescu@nxp.com> X-ClientProxiedBy: AM8P191CA0002.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::7) To VI1PR04MB10073.eurprd04.prod.outlook.com (2603:10a6:800:1dd::8) 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: VI1PR04MB10073:EE_|GVXPR04MB10658:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ca53a24-d7c8-4f87-bec1-08dc7b3fb883 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: hxVLqz0EObIIprdV+jd7N3C8MKqgmdBzU2LapMvXzp+UcWTAZnCj7Xe+8n86/XuQYthlPI4YKJbt1KkDHxyIqxxBBKOFIiqXkCmNYA0MvPQtECoDciPwxQcgsdqC/TOXZ3w+J4NQBQ9/XtT5gSC+9id2nW0dboyw8sDaIs9CyHJKl1DwHl9uKCzf8kM0Nm8muVwJtge9OSnrPGFhW9cXgWYqcXzCiCzqB6GUMjuFyfmSlh6fOHjNVEPx9f/USltheW8tarRIrXr7rUGy/lR++6/inV3fzpQWWYyRg0V2i21b7IIqQiP/Vb11FT+zOOd+4oiF4RFuQ5qNvn9OIQnlSHqmGm0UG3Hr7shFKDxsQNShNpEnsmGmqkwVus4lfMHn9IZBkXNJSENV9FDdXTvInd9XuW9faOIMSotsFX+QCbZsqgyYnsuqyPBQclXHLW8ZvFoOz2E/ExG5V+GnTMiOS4y/j/vLhwUQE2jmglVmWpevYii0itF01pXTRrovssVdn8FZqJlVPm5xFL3Lan/7v/iSOIFaj21jnRHrdF6l0FDO/kDeU5ZdJsZYuwelrmtsDGrHCnp/MCh9eyjOzxuxxdSbjoSZ8dx8rm6zJ8WspaW7N9F3AUsdsm49M3jQtqB9y1RZeemWwaloSP3EtaSLbA1iW2x6t15eUHZ7WdsLFa4fqmWlpWY1la6uGttRlA+mCdMXNTkXMUj3zj7cdaVbYYKCgPPUnQ07Vd8/C2BSqokaxVBGLewWsLpZUvtOleROjc4j7/HuUJGSmObFLuIfRsi4tpkhQGh6UUUZWodQuBX9H6TtMbvoswLC1bPcr/vvJlx5FaFJSXzUwTQr7rw+r3j2L19THy+JLnTqdfsV3bBP5umDlEZkSut8Q6htDSv3WELIGZ/KcQsR8KuGT2NBjss3F14ybGm5K10NLy2K8cWteQPYKRj7YP9kj1qLe4601+VY+CQMJAO8Qr1FtqkNCkymdQI8D4gBHJZzkYdeke8udd/MIQFA2Sh997hxKK0r84+g25OoiF6NsfyHRkLcUWplh5RGl8cO42k85j3DvjvQ/bx67jhrsPh4BsLUZQdolwLiV1L1CuPUcDGu1Jq1gApwLqEqwWzkgfYyjARDkxAojhSghRdO5C+AY3NBpCSdmI9NT6huX/UFa5k4NR7pU2dKBJsX2WX7OM4z7j70cqSA/hIlqTIyXmYOpYpEAZN3Wl/dkUs+lMvsWvtMgqnfNtL2mCa2q5Xy9npgEAHWqIettPeIG22WEV0FD3qqFzXRTEYfL3iBl8YCecvpWtd+fw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB10073.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AF4CGfbeZnOODrqViV8ZxRxZFQBDehLzK46QPftMqVBmaZ+jCsuv5Lte6ZtVNobv8AjhMsk+19zTrNzBndifHVf485vkNfdix4Dv8ZYaApBqEw1AtfDuT8enhonQhDj6ZZcL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/rcHV3DLHX96UAmoLJJMQstXZUzh/9c9cXU79yAa7QiGVfpLWQdfLEISfAsUzsIJA5tGQd2gfyFEomkXMMk2v7c71fVILVHaaD5dPMBuPPoZXzqXGHj2TDy94MEjchfaCOIKhZlICx1dpvvdt8OQoxajfdalri+uqBUZ155PcMz+7TDowXVDE7m3+X27gK27Q/CgVpP4kJpRkpJyPB8sbW5b2u2M6p0jP2SkgTjS1e58JcOhiex2Bea7JEknmtdqyM1fs4NX6WZlRWWHJKVV2vA+zCt/hPZ6tmFRYpgy5KDif1HxT5MvLvD/yYlX+UXxwI2Sm4bi/kjT/ChJbBufmUlkEy7aE+DaLJznDYMuKW+mt2UqT7KpjTypETfbwuFZdlEYlHSLpItw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ca53a24-d7c8-4f87-bec1-08dc7b3fb883 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB10073.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2024 15:47:58.9560 (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: PgfbZdioaAQdbYANPDqhiCWH4WpktLt/R0w2yjjasdYrR2JpDAezznOrS01kkrni+J2v8v0+j6sSVpXSGvr2npzMnXUZqYFwNsW2Tr1WFjY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10658 Update BAP Broadcast Source state machine states to use BAP define states for source Idle, Config, Streaming, and an intermediary state enabling. Updated test-bap too. --- src/shared/bap.c | 39 ++++++++++++++++++++------------------- unit/test-bap.c | 4 ++-- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 6572ef1d1..639149520 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1361,14 +1361,6 @@ static void ep_config_cb(struct bt_bap_stream *stream, int err) if (err) return; - if (bt_bap_stream_get_type(stream) == BT_BAP_STREAM_TYPE_BCAST) { - if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) - stream_set_state(stream, BT_BAP_STREAM_STATE_QOS); - else if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); - return; - } - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); } @@ -1759,6 +1751,15 @@ static unsigned int bap_stream_metadata(struct bt_bap_stream *stream, return req->id; } +static unsigned int bap_bcast_qos(struct bt_bap_stream *stream, + struct bt_bap_qos *data, + bt_bap_stream_func_t func, + void *user_data) +{ + stream->qos = *data; + return 1; +} + static unsigned int bap_bcast_config(struct bt_bap_stream *stream, struct bt_bap_qos *qos, struct iovec *data, bt_bap_stream_func_t func, void *user_data) @@ -2071,7 +2072,7 @@ static unsigned int bap_bcast_get_state(struct bt_bap_stream *stream) return stream->state; } -static unsigned int bap_bcast_enable(struct bt_bap_stream *stream, +static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream, bool enable_links, struct iovec *data, bt_bap_stream_func_t func, void *user_data) @@ -2081,22 +2082,21 @@ static unsigned int bap_bcast_enable(struct bt_bap_stream *stream, return 1; } -static unsigned int bap_bcast_start(struct bt_bap_stream *stream, +static unsigned int bap_bcast_src_enable(struct bt_bap_stream *stream, + bool enable_links, struct iovec *data, bt_bap_stream_func_t func, void *user_data) { - stream_set_state(stream, BT_BAP_STREAM_STATE_STREAMING); + stream_set_state(stream, BT_BAP_STREAM_STATE_ENABLING); return 1; } -static unsigned int bap_bcast_sink_disable(struct bt_bap_stream *stream, - bool disable_links, +static unsigned int bap_bcast_start(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data) { - bap_stream_io_detach(stream); - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + stream_set_state(stream, BT_BAP_STREAM_STATE_STREAMING); return 1; } @@ -2106,7 +2106,8 @@ static unsigned int bap_bcast_disable(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data) { - stream_set_state(stream, BT_BAP_STREAM_STATE_DISABLING); + bap_stream_io_detach(stream); + stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); return 1; } @@ -2205,14 +2206,14 @@ static const struct bt_bap_stream_ops stream_ops[] = { bap_ucast_release, bap_ucast_detach), STREAM_OPS(BT_BAP_BCAST_SINK, bap_bcast_set_state, bap_bcast_get_state, - bap_bcast_config, NULL, bap_bcast_enable, - bap_bcast_start, bap_bcast_sink_disable, NULL, + bap_bcast_config, NULL, bap_bcast_sink_enable, + bap_bcast_start, bap_bcast_disable, NULL, bap_bcast_metadata, bap_bcast_sink_get_dir, bap_bcast_get_location, bap_bcast_release, bap_bcast_sink_detach), STREAM_OPS(BT_BAP_BCAST_SOURCE, bap_bcast_set_state, bap_bcast_get_state, - bap_bcast_config, NULL, bap_bcast_enable, + bap_bcast_config, bap_bcast_qos, bap_bcast_src_enable, bap_bcast_start, bap_bcast_disable, NULL, bap_bcast_metadata, bap_bcast_src_get_dir, bap_bcast_get_location, diff --git a/unit/test-bap.c b/unit/test-bap.c index ad2bbfb16..b59f642ca 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -555,10 +555,10 @@ static void bsrc_state(struct bt_bap_stream *stream, uint8_t old_state, struct test_data *data = user_data; switch (new_state) { - case BT_BAP_STREAM_STATE_QOS: + case BT_BAP_STREAM_STATE_CONFIG: bt_bap_stream_enable(stream, true, NULL, NULL, NULL); break; - case BT_BAP_STREAM_STATE_CONFIG: + case BT_BAP_STREAM_STATE_ENABLING: data->base = bt_bap_stream_get_base(stream); g_assert(data->base); From patchwork Thu May 23 15:47:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Silviu Florian Barbulescu X-Patchwork-Id: 13671992 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2060.outbound.protection.outlook.com [40.107.21.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD289171C2 for ; Thu, 23 May 2024 15:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479286; cv=fail; b=l47j0z5Bhq6T7kbOfDAxLp8l2iBmD7YSkRhN3m1c2YDjs48gwK94xvZMroCtzKd2v+PkYpiOmc2yKPPmnmhyUVyhHyUfUedsEuK/ASAdGZOa26e33mBn1gfa6tRg6BSSMYN1mdDEJXqkJT9jTfS7xKXEvpnRr7avPlqurkc+bgU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479286; c=relaxed/simple; bh=TreIvJmyRqECPnHV3uU4VxTJz+tFbTbJ3EJ41rWU5MU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YGsbPZhqDUIwtN50r03ppNH9RpcHtlgMRbhgUuVyaB+m8RCzMvMR8wixnQv79fElgqLKMt7/e/A3RmAmYmb3UsBS5acJTqej9dlG6DYcygCW3enN/ZlkKIaGz3L2KTMtuN0A/YYzksfbq9ZXADYnpV3/fv36zYbn7bmrYFe+tIY= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=m/vXuWxE; arc=fail smtp.client-ip=40.107.21.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="m/vXuWxE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J9SdrcFJeaREkx8XOP9RQhmKjG1ZRYrOOnYLmmMTsnAYTRlMPKxsXIXGeu3AoJ1xCOW9CWkH5Hf8Fapunql1sJDgwSF/XrgY8Oles4bzrUuSv78diN5TN7mYIi4lfLS6M7i4/36ywXGJv3ZlgjlF16fCs322W/NDSG7I7/C8dnR+80rGpAg0lGk99wYuhvzv9PEMmc8bZBQcWMHEuA/7Y9Ckr+Y8Dx/K8vjS1eZBZjOY3SCqvljrzx7Lik2VKP2cOygehovkJvoKJFLVt6T5aI4R+NcfrcCgJePW5UCTQSjwZDP7uMdWesQFcNzSjLO3nXs289d/w3y0sfVyzAOobQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gB6tQGfZLGCv4UAvDOJhSFDvyJqB2PP6R9zEPGRJIEg=; b=YylQtDEpzkBKmIV3fSJQIlHx15KbwMHQyb049SBEphPgsuJ3qGQGrKBx5NX76HziaqeBrOh0jsvN4JB+fK8nCo3C4M69Mop7nNVwghVuhAUGeDpYed/8bDWAYv2qTslqjtoGoB6r1IXx7PfhnNqvLZcKr6ONt07yPs6q5VQaBadD+y6FR1gudo6bmRD1Ou9Tf8T5rd4xu6C9s2ukIWIc9Gh8RB/kGJRyAgo20HBqF5kJPhlOQczIZaiz4OFMeL3yCH7l8b2UVWU7lTK9lav9Po86+Us+RcxRkWb0jrR/MNzASJmlGpg5hAMcTZ/uMMrCaOTuZWYWUiHxh9SqI4ImCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gB6tQGfZLGCv4UAvDOJhSFDvyJqB2PP6R9zEPGRJIEg=; b=m/vXuWxEwoHpu1XiomxOL3iC23ODalYtuM5s8rsv+g7b7/NrSaKtbEYYUdT83pFwlEXRhXX5PuaZ04rRxI0uUpfq1u+LTNKMqPsbpnoAMX7a75jSIwMlcdGQc9UR1Zx7fx2ir3dSJn4yiIoj3vRy4UWsLx9j0sBHzGrvREFMkww= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB10073.eurprd04.prod.outlook.com (2603:10a6:800:1dd::8) by GVXPR04MB10658.eurprd04.prod.outlook.com (2603:10a6:150:21a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.19; Thu, 23 May 2024 15:48:01 +0000 Received: from VI1PR04MB10073.eurprd04.prod.outlook.com ([fe80::5d49:58b0:19c5:a38]) by VI1PR04MB10073.eurprd04.prod.outlook.com ([fe80::5d49:58b0:19c5:a38%5]) with mapi id 15.20.7611.016; Thu, 23 May 2024 15:48:01 +0000 From: Silviu Florian Barbulescu To: linux-bluetooth@vger.kernel.org Cc: mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, iulia.tanasescu@nxp.com Subject: [PATCH BlueZ v2 2/2] bap: Update BAP Broadcast Source state machine states Date: Thu, 23 May 2024 18:47:54 +0300 Message-Id: <20240523154754.39451-3-silviu.barbulescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240523154754.39451-1-silviu.barbulescu@nxp.com> References: <20240523154754.39451-1-silviu.barbulescu@nxp.com> X-ClientProxiedBy: AM0PR02CA0144.eurprd02.prod.outlook.com (2603:10a6:20b:28d::11) To VI1PR04MB10073.eurprd04.prod.outlook.com (2603:10a6:800:1dd::8) 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: VI1PR04MB10073:EE_|GVXPR04MB10658:EE_ X-MS-Office365-Filtering-Correlation-Id: 294bd601-6f6e-445f-99b2-08dc7b3fba01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: J+7ppO4sO5GvSzfR1GNW+5TaVi3Wd0V9Us/6eaaSGtO4rBNenhZij66IJWY38Pg3UJCDIoaCcup8tcaCfT9mtVe6H4h3+ezP9owZi7IFdXsONiVy7Cvt7WFB5+u8uaa9KRPhae1rKViQwbd0gNbVIiv7EgqkAwvpPr54TfBgBBEnquOTONM8K2j8rhTvc0vuDOZGm8cpXjFAt9YEttZ+JTVrKEAl8EkAV4m86bFIXcdkbZGaUy/H5eFpW840aEP6Xn5cLZxX/4JzkidlhLrN+39T531vhVh2gzc3VSU3xUfHesJ91z8nEu1FXApTJVmDjA+N5dtRQ5iXWnLOOcSs4DxhyZ7SAWbgZXfLIDt4qKigPqiOLpmX/RhSHkWCRswktfAxiTIYUPtCOTjfHXqocvIba6+DMe+oUwhxs0iNcnl/Bw42kFtHIsGdpbNzBJDrE2EwZUVIBlx7+W+rbI/nnZGhKJk0XMaGT9fnMsjD7W+ML0byWym5MhFsHDDi5KOeXQdjfvwSQI6CCZixeCfASOgpSFaiT4ymbvdfdcxwBZREBClI2+Yg7+j0ULVTEjggrgqMY0lS1BMmeHHiXx401nMb84x7wqxYtcyJDH8014nDCdB815iVEUab7Ix3gM+LabQIZo0ZNYyVp2evQJ3WNPS4Lkn+zQt+ABIH1NDnTZ1Pvm1/J6pWImq3Dbxo+Av66cr3ADuMLlDRTaL74UhcJVuzTDoQnmK4uqPWP/y3Nsto3vWp1+YwYWHWNr0Nwn1Iy9c54Jte2t26FLlWnfXcPIrQSy/yqL1UNjvqekyn75WCFmPHhIdBHkXyO7U1S7ff1HzpFRcfiWC0KrcjVisG81LTwJoQEW7LKMQKocYXmUvJEzIaWzE4XVVQZ4fjEz9Gfj3dSLA5tOsDJw4aflSKGlPW9lWc50wPIwRuT0O8Suhx+fYQbTUu9ru3qT7pRhCimfs1nzhO5fWkNtjzgeWuQcmkhDeoUsLSLnW6RRU4VPUQxRV0XY6qi+QdYGG7Ofg7caAPJYDk7E491xj1XNz61+iGCwfvbZZxdWw9MaRIU1trizfLe4s+uPaeHO12Fs+DX6AIin4CLLAKGVXhnoku/rMvpmRfq3MypMfZZyRNB3+qWNM7NI6gJI8rLWaWDbGb3gqGCQbINickD9+ePUanen2oZ31bm8f8umxLQWH7rH2Zi9fcEs9PXT0pV/bRjOqWzQI8HrIvu5a7g4wMNKCLovgoQqPbjkG9Su7OUAQxhnL1eaZt2mapGV7jF4xsQCKtCjNJHFt5qXBQB/YSiKz65w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB10073.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r1UF3bLtE1Wboubd7eUgrezHWxZHwVh7sctxD/m18WJfGCzDRx0YKQOCpm3U2sYmj2Hq6SIRJ8EIzHW+WXSvLuI4RJmfkH7XB+A7mB568el17ShQitWGFTrsstKt1efS0mB2NIAzMy2wD1Hu2og9rmWQ2OZPPUBs/lES32I3uiGXEZZRiyojVwhtj/sRZTUyy72zXRkqMw8Kv10Pzb2fYnQMOsf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h2WW7XS82J/T+ya6g0gQ/LQjdtiNBe7mddhftexeg/AFx0wvmOX0rIp74oPsUS++2Pn3XjT1E8Hd+PvwI1PEK5rVaPa6K74qWt8TgQUbPBCRLejhcvCAK5EVTL4kzxGqTlBqYvyB3reos4XG5gaUKbVMHgHoj+Zq8xmaXEgg5m7+fWYDAIHYpw7HLuabdti9F5Zw2QCnMyiE9Al/nENV0b397GajdXpNZO99R/3/cZWf0wS7hyNv0u4OCOpIOJ6Gb6dMDGKU/bC+oeOVOj86drBbBdmXaFDw57vYkrHr9CNgdC8AGs0wCzKDaUpZuRWkoCAwgvg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 294bd601-6f6e-445f-99b2-08dc7b3fba01 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB10073.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2024 15:48:01.4609 (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: Ikpms+XEFWjXbbboahZ9K9X/qS2Ssvg56K8BPZbIjFfwX7lWYnaKXEzJtLPAfhetOjQZCqYQBfF0o0L/kA+7wDGvbmta37iIVkECkX+qJUg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10658 Update BAP Broadcast Source state machine states --- profiles/audio/bap.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index 06dc4e254..3fcf21df5 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -2474,7 +2474,7 @@ static uint8_t get_streams_nb_by_state(struct bap_setup *setup) */ return 1; else if (bt_bap_stream_get_state(ent_setup->stream) != - BT_BAP_STREAM_STATE_CONFIG) + BT_BAP_STREAM_STATE_ENABLING) /* Not all streams form a BIG have received transport * acquire, so wait for the other streams to. */ @@ -2516,8 +2516,21 @@ static void bap_state_bcast_src(struct bt_bap_stream *stream, uint8_t old_state, queue_remove(data->streams, stream); break; case BT_BAP_STREAM_STATE_CONFIG: - if (!setup || setup->id) - break; + // TO DO Reconfiguration + break; + /* Use the ENABLING state to know when a transport + * linked to a stream has been acquired by a process + * and in the case of a BIG with one BIS stream goes + * in the ENABLING state waiting for the response + * from the kernel that the BIG has been created + * so it can go to the streaming state. + * For the case of a BIG with multiple BISes, + * the BIG is created when all BISes are acquired. + * So we use the ENABLING state to verify that all + * transports attached to that streams form BIG have + * been acquired so we can create the BIG. + */ + case BT_BAP_STREAM_STATE_ENABLING: /* If the stream attached to a broadcast * source endpoint generate the base. */ @@ -2855,8 +2868,7 @@ static void bap_connecting_bcast(struct bt_bap_stream *stream, bool state, setup->qos.bcast.big = iso_qos.bcast.big; setup->qos.bcast.bis = iso_qos.bcast.bis; - bt_bap_stream_config(setup->stream, &setup->qos, setup->caps, - NULL, NULL); + bt_bap_stream_qos(setup->stream, &setup->qos, NULL, NULL); } DBG("stream %p fd %d: BIG 0x%02x BIS 0x%02x", stream, fd,