From patchwork Thu May 16 13:03:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Istodorescu X-Patchwork-Id: 797502 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 CD647146A72 for ; Thu, 16 May 2024 13:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864658; cv=fail; b=W2HR1ssFEQ/JzpUllfLrY33lQRP5Z/O062us5rWCzsli+71Vpz1lFd8TtHU+zsXbsG4fMFWCLXvOvXqg9DVqMUGd4e8PUwm8lbhBdHsXGgMot8HumeD8Zygjduyc+tdPmIzhgi381UQ3fEc/3l52vPMhoxGI7uYEIFBMk/ZkQhg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864658; c=relaxed/simple; bh=AuXAhhZaUgWTaG4OyyPAY6Q5l1tIdVe0fOq7UlBJdIw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jJyuS90sVfKINL52tRKASmOJ5Ta47YcD6VG5VapJHE5sndrHKiEvOjtGKvflVLTOtsiyXErtdnZf/wPTTmRrwgtZbWeyXUbvdkCi2vC1a9FbGsDvUlOCTwqUpzU2lvT0MOXaS7Cdgh6DZd4zEhjXKR/z55qAQ4b0Usvss/B4ePI= 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=Ezo5NooO; arc=fail smtp.client-ip=40.107.20.71 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="Ezo5NooO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VcJZ3YnpSk6OweUYYHPCkicQ+DovzHW5ssYCxus8lzLFoLqTabKSk5ijZEmRGUsFocwF8VzfjOvFnT01U/qe9lNs8UsA6yVQg/3zqxQea1TSAXp+ePSHn/pis0gzBGcv/e6danWkX1lDzIyFZZez0cBSZmfpjZx894oFp9UmtcRbNCOwUb3X5S4VrTvJEvCgZUlhge5fbu50c8u3WOJSgJpkAYHUBi0Z8IJvrn5xbVUbHpUmpkXKJn42GklxsQlRFrM7rzwaw6lus3Cnscgkjz1tJtLcnoQxVF+OugZMU9/6Wwlgg+vF6mp34c7eFTMk98Zhm6EKapzV5rhUDzZDTQ== 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=E3ZkqtllrkAODd7p2UrxVx7FlM4lxG2QgQjtLpurZGI=; b=YFkfrsnr5MNcr8/iGprXiavZ3G6O7JM6GTLUv3oaUvogP/BxtKH5me5f8NKd4ctW7idKYntJukm4ggJWbg8bciA51WVDf1cATICJTr/5rLIkLIXi0ariuC/rSXPR6I3vjcjQP4Itdf7RcSAobzrpAYnwE68s927SNao0R+gBzzP6Ai5NwbW6+tSs30O2IXz3mTTMN9ts5jSwsheekjZxqJIQOdfJItrUCl5Lnr/0Dywra9bSpLXxslKXYy7q6vj3zGjyPacZqstoYRq0E3ymheFItg9BcW3UDoxwdsHGoD2vaoGR3XMJJgX9G129HCT8BQaTwjASEZSGb4JplVbgMQ== 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=E3ZkqtllrkAODd7p2UrxVx7FlM4lxG2QgQjtLpurZGI=; b=Ezo5NooOrRt5AWBQ2e/J88aGiaId1YuePB1yfuiF9BoJoiVyW4tvF98RFeMulj5yy/QdiXPonRQRF71TqwODseBEAYlzItw2iymo8umO6/UsplrvetDg/xVKGWntRFyxdSiMTDixA6/a7gBAUoEjP2Qsb9Zmu0TXJ027ZHW53lk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) by AS8PR04MB8564.eurprd04.prod.outlook.com (2603:10a6:20b:423::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 13:04:09 +0000 Received: from AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd]) by AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd%7]) with mapi id 15.20.7587.028; Thu, 16 May 2024 13:04:05 +0000 From: Andrei Istodorescu To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, iulia.tanasescu@nxp.com, Andrei Istodorescu Subject: [PATCH BlueZ v5 1/6] shared/bap: Update stream management to avoid PACs Date: Thu, 16 May 2024 16:03:55 +0300 Message-Id: <20240516130400.16713-2-andrei.istodorescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240516130400.16713-1-andrei.istodorescu@nxp.com> References: <20240516130400.16713-1-andrei.istodorescu@nxp.com> X-ClientProxiedBy: AS4P189CA0053.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:659::17) To AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::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: AM9PR04MB8938:EE_|AS8PR04MB8564:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a2ed7a6-1f51-4a68-9927-08dc75a8aa7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: oC6oZxJvkrFBlZYyR1PzqNgiSz02BWd7ZSE0RMgQK7mvwh9r4ydAdg8dcbP+Y4aSIOBiK8LfycREySUgIuxLZeOEQIQzlo3VUJeujIIquoAeQADVACXhTEyZt3dD1tBHWBOp7gplaf8S8t+VK2YqTUKkh9roSueSG5c/TmP+JEMo/L6/A3f8+YXJMzmuv8fwHwOlwObEweyQp1HzE9pix+Ack7hnAno2RFWX4S/3t8a8Ldp6HREOJ/U1mTTlmI4+fS7rg1PQ1bOKwl8JK5L9H5vgvcRCAFp45Ih6kSX+Fr+uHH72m1YbDZwy8kfFfGxU80WQxaSo5F67OCYmHrW3bpgVfcS03faI8Z4v/2KZSh63qExL2TLP5vPyksKkNKO7xXzs3LxhkqDG7aafcdtqhLI99jqzaRJyXVD4CzjDWX3lqwOAtqBxuS/MgoRjGjv8p9U/3+fPKoKzdBaMDPcUlzg7V7q3Ve4SZ3UPBaUzwpUFWztYQxJV2R3LCPKYDRcqQTknwfthXhQPDQOftlGv1TIvtgvGa0kL5GVEf0+tvLensmbq2WiCx10fgEGLYDGwFJg3x7pLs64ibYDsT/8CYo5qpOf8APNY04Z/dMg1WEEcErlPKLbaRjRIhMPfTFHqzdb8uUekabSPpnOQg99M6p4O/mwF6o/ygzkJC7aMsTGqAJFVYZMks1SYTYff4x14r8OnoMiqgFj5qZ37gjxuMPpNnlT5DikkaWi++QBIchU+WU5qe4Z2RAX/2t1hTUTbRORc1Vlv/Hp/bPKONkFLvZ8UWrR6KJY+73zx89oPwgBAJOIYrCPH84W4J+klqMZcQ8vYBPxHQkG/RCxms3VzbUVgj790YtsyibwrTaLVxc60VxoZU48JsLxrLbgIpa/N7igI0Srkt5rDfAdqpB9PhUd3i6VKIJzNSikHt5sCSzOL5fAkbI17i1JReL/PzlE0k9cFd+lWMIdR4c7xVniS+aJQz4MBn3NW/UzhkP5Y5lMo6dwRD0JhTR9ATfkpaLeOAexTvKSsEznkivj/i+GJgUjsjt+Rh2iY0TZLER+hJqxom7Q3+8/oDK+kWOuzNWYTFTdijkBuQcm1VWWBDptYYw23JZMHDexHu0HwmUXSUoo/2ixC0SEnhZabrE9j+1kyKEFTjKTTUsT9hOFjQyhESg2uyGeIA3QynEaz0JkF+m3cA9Zys7j+WjbKrcviI8hE5V+iw8HbFdPvV69q1apGdoqOMHUXxF7xGzzgHNQyyuK+kHNKjOIp8xkp8x4SKIqXN0rXEffC0FwgjTUtYt6zOw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8938.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Exx/buMjhxI0G7b/1zkNGiR1yLmXPjt8HGXJhs1DEW1VeFSb+s+ZQJaCalQFpoeziNsNqg2S4NCSuvEs2pQcbukeXn/RvTNDxTSJG8Jiwnsk3M/nsRhHCEgS6RlXWPa2r+4SlTXqdF3T+ZI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cZ4k8tBIdWGoRDZ1mTgZ4hTVFKkP/AxPpQF97QS2CQQkAN2bo+m/j/h+l32enhrJsfMt6YVVMQa/yJQVOaTypV+rbLk+FXY/qgDCx5rxWh2Kxf/+/8e6bEJSxFU3eGJv5bMD0CuFu775OZL8oP/rBDdTJlcjEysFbAOObpbuwNpYnS9/OBdLCQDj2fRsERSBrZqwgSuV4roe9nFeABvF6WnG8vTZsHQz5szA/gW+J1cuvRz9GspUV5cksRL0HsuD2DpT3oMEpTpCxeiYalMvbveMZ9DEVmn7Kv+paYMg8US4UjCpohEjcQCSO5fD7sf6hNxdZ4pNDBfAybNKBjZjA3CQWbTphW7/Ux/v/zkHAaBAsIxwjv1GI+elnHGHwWDp6QTw2FKIeg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a2ed7a6-1f51-4a68-9927-08dc75a8aa7a X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 13:04:05.6077 (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: zP9LwAQfwUUJsh31JwyvX8V01benjstKJ75g1UXZKSFeClODl+cisygxMt9jPJdPstksm7c8bmnhxnxIsJ08ru191CCmjQ7CuW10rjPpusE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8564 Remove PAC logic for BAP Broadcast Sink stream creation. --- src/shared/bap.c | 63 +++++------------------------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 1316d7c73d02..919ecbb6a016 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2005,10 +2005,7 @@ static unsigned int bap_bcast_enable(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data) { - if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) - stream_set_state(stream, BT_BAP_STREAM_STATE_STREAMING); - else - stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); return 1; } @@ -5287,7 +5284,6 @@ void bt_bap_cancel_select(struct bt_bap_pac *lpac, bt_bap_pac_select_t func, static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap, struct bt_bap_pac *lpac, - struct bt_bap_pac *rpac, struct bt_bap_qos *pqos, struct iovec *data) { @@ -5298,71 +5294,24 @@ static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap, if (!bap) return NULL; - if (!rpac && (lpac->type != BT_BAP_BCAST_SOURCE) - && queue_isempty(bap->remote_eps)) - return NULL; - - if (lpac && rpac) { - if ((rpac->type != BT_BAP_BCAST_SOURCE) - && (!bap_codec_equal(&lpac->codec, &rpac->codec))) - return NULL; - } else { - uint8_t type; - + if (lpac->type == BT_BAP_BCAST_SOURCE) { match.lpac = lpac; - match.rpac = rpac; + match.rpac = NULL; memset(&match.codec, 0, sizeof(match.codec)); - if (rpac) - type = rpac->type; - else if (lpac) { - switch (lpac->type) { - case BT_BAP_BCAST_SOURCE: - type = BT_BAP_BCAST_SINK; - break; - case BT_BAP_BCAST_SINK: - type = BT_BAP_BCAST_SOURCE; - break; - default: - return NULL; - } - } else - return NULL; - - bt_bap_foreach_pac(bap, type, match_pac, &match); + bt_bap_foreach_pac(bap, BT_BAP_BCAST_SINK, match_pac, &match); if ((!match.lpac) || (!lpac)) return NULL; - if (!match.rpac && (lpac->type != BT_BAP_BCAST_SOURCE)) - return NULL; lpac = match.lpac; - rpac = match.rpac; - } - match.lpac = lpac; - match.rpac = rpac; - - if (lpac->type != BT_BAP_BCAST_SOURCE) { - /* Check for existing stream */ - ep = queue_find(bap->remote_eps, find_ep_pacs, &match); - if (!ep) { - /* Check for unused ASE */ - ep = queue_find(bap->remote_eps, find_ep_unused, - &match); - if (!ep) { - DBG(bap, "Unable to find unused ASE"); - return NULL; - } - } - stream = ep->stream; - } else { ep = queue_find(bap->remote_eps, find_ep_source, NULL); if (!ep) return NULL; } if (!stream) - stream = bap_stream_new(bap, ep, lpac, rpac, data, true); + stream = bap_stream_new(bap, ep, lpac, NULL, data, true); return stream; } @@ -5415,7 +5364,7 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap, if (bt_bap_get_att(bap)) return bap_ucast_stream_new(bap, lpac, rpac, pqos, data); - return bap_bcast_stream_new(bap, lpac, rpac, pqos, data); + return bap_bcast_stream_new(bap, lpac, pqos, data); } struct bt_bap *bt_bap_stream_get_session(struct bt_bap_stream *stream) From patchwork Thu May 16 13:03:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Istodorescu X-Patchwork-Id: 797503 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 9A562146A81 for ; Thu, 16 May 2024 13:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864656; cv=fail; b=ADtv1pNZrpDTCxIM0wL2R9HLCcxZQFaIzD/LUVtZUNhfN4vJMeAn/nX9XwqBlbz0lzoP5laGp89k5G5LwSV9gE2FbHbQhEIir8CKzJoxAPAiqpfkxOom7UdKBf2JQ2E1HdpQf8V9c4hcqAC8MoXXX6nVA5fTuWuTUUhcX4sMHLY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864656; c=relaxed/simple; bh=Abt0AV6yZHctWwj9bjDwdaDsQn6GcoWNWkQHgQAf97A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VOl6kIfHN20GHnU6B7RQ3gFZvjtojmsMQvQxMmblmApz3DLu8DFe8PjyDEAIofwKa4nrUsHh+qU2uR+J3kktBQUv4QvBjDJcJPYJPbmAB3Eq+tSx0CC8Jt2ermpH8dQ0LuC7uNMPoZjcnO7uuwHjmtzocEQVNULp8wejugs0rL4= 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=oDolIRgK; arc=fail smtp.client-ip=40.107.20.71 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="oDolIRgK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JfIMSa+/ob4bqNmns/r0y+nruyirc6Ls9tpkXq2Kp22ATYVkwN1UwFdBbeea59LV/n277hOFvQce6202SXs11Zghp53MDpjTAzjETD2POnDEp9Ni+cipKTYaZ2LUTIVVtv0OkEtxwLKCnnpHVYkNWPPhAAbhvZyNyvlarnRXpe2bsVLwvJ8OzAVMclIe0Ap4cDe1Uqm3aKmd/pWqlqgoEVKDwExKqsd5xxoZpmxHMHGhECong4mLPuK3QWVD9tNJx2hEpcEHopqx/yBN3RvC1kkUkSFTRiZg517PF0itVjitYv8C8kOMnQz3Fa3ArgAe67O7i1vtD4++HL3UJOW2WQ== 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=OvV9FqfzYmBRmsC+/9tPrpYFvxyh75txfkYrOsxRWVg=; b=hkgBP2pn1DP7TWOgljgkox9wxTUCXglZfs/avgzG6DSh1kXBwIgRmlYIn3efD3CTmLyrH5HXpHM1J9S9VTSr0KQDuSXOAqZj8L9GJhZeHbbc5ni/62el2wWIyJT7xPlhCJXS8UDZwX/4yhzerB//JOQUzgnV2t+K2dgfYDd16maKkUDQaKEo3I5H6k8Dogi3OO8I8VsEaMcP/U/JRXXUUI+O6qpONRcEv3+8XRkVNzVC6jX1PcomyQCfmbazKLd5riWTF7ztFH6qeocXjh1k44v30WUoHubPyu0v9f1lmHFc0JUceq1PF1RPT56k2gzb+e5Jhl5324IMYAfOHjiZ4A== 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=OvV9FqfzYmBRmsC+/9tPrpYFvxyh75txfkYrOsxRWVg=; b=oDolIRgKMH09As/xTjqriJPVwKP36GXEpoETximoOqriylGFm0ROvBhuBiXRQsPyIn5iTb9jJNADns9ZHuFzGK3K3q5wfQXgShIs/HwTh8wTkbPpF9l2uBDljIfdCk5nSPRFZunNm/SOE7fK3iyvfbe/COKH3MFDbkYr7ikM0bg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) by AS8PR04MB8564.eurprd04.prod.outlook.com (2603:10a6:20b:423::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 13:04:10 +0000 Received: from AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd]) by AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd%7]) with mapi id 15.20.7587.028; Thu, 16 May 2024 13:04:09 +0000 From: Andrei Istodorescu To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, iulia.tanasescu@nxp.com, Andrei Istodorescu Subject: [PATCH BlueZ v5 2/6] shared/bap: Add function to check the validity of a BIS Date: Thu, 16 May 2024 16:03:56 +0300 Message-Id: <20240516130400.16713-3-andrei.istodorescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240516130400.16713-1-andrei.istodorescu@nxp.com> References: <20240516130400.16713-1-andrei.istodorescu@nxp.com> X-ClientProxiedBy: AM0PR06CA0108.eurprd06.prod.outlook.com (2603:10a6:208:fa::49) To AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::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: AM9PR04MB8938:EE_|AS8PR04MB8564:EE_ X-MS-Office365-Filtering-Correlation-Id: 9304be61-e365-4c47-c2c7-08dc75a8ab57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: 3aMq1QVdPk1o2SYALG5FTL9kcgvQn98NPoou9ior6i2AyuI4UyFvxiv9SfnfuZagRR8XYHszwk20GzX+WGtjwzDvR7TOCUzVlVdbPyP1ZQVjw5JNaQTZa/nxQEvAuxWl0HH4xMPpqfdAoSGGIw8JgiVsQoHE2lZ3r0EBM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rbjQMJIl31eUlVLnNiD2k+23wQAXXngASYi3+s5pj3GfuL5vMDGjuq8X+d+RBbA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8938.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7XzjieEDy3dZE0SL9mkomJsyOtw5hXLccTrNJOPKEjsEzGfO+AkRWhiWtajaKXGk1903EFdaCHTqt/fasqj518K9IHcTZw9EvPqkhpeGuiImAbH1j898J43HmVTIIAelseejTm21ZOZqNfXke+AVNwUAedmlcNih/ZCRjCXoHJNSX6XMsYRpaZgXnJL1hEFwUTMK7r3lZg8bU1KgKSgIvmtRve9GsQ7NuVfM5hWX2Wt6LsTpVnQtFCt5AuVfVWpfZkcTU7eikluysGinrLXK/qzKvxjVjLyOCTMblVfVnwGYVwsaa/hYd1Ph1+Df2KoFKk7kGVL94sJ6auxCMgL26dglVt1BtcjH2M/au+PsA+V2GQFND3/DftVBhEsGzyj+l+VH8887rH0TUikDGzOLJQlJy6o+bpXCAa7KexluZN87ObMzRsYhuRPGL4J62/ya/w8Shx+MJianDhs2UkthlugRbGC1jjo9B9mzRxc9kTi2r46iVxraVk6uJjSjiTa4VNXCVp/E5MWdW3T6zpfFX3aw87vIpIAGCpF9EB3UYEzFO1Mwt46+Gru6eCI8eTpk8XhuDfGW0OmXpdD81JxcU4zjlaETEuuMMAh2jtp8R5YOm/uZHvAc/0s1eMQ9BIOs1ItfJko08lCHD2dq5OBaBgNFAb+B6OYwLjoTPao0lmDWx4JJPU/kT5iLCk+5O+piRMmNRa7JB4M/abo8XRwHijTeAxjbpMlSKrMWF/HSbukAQUoDwWHK5U7E57WdySC58Wo8X20jHbJ+pNROIXSCD28c3X/6eX+P0VDLaRpXJ1CdkBR4bcMaVwlh9zIReGvyUWd9veKiXsd7uwIAPXBTWhHAIWI5sJB1qYJYC62OSFqokRmL3IYeD59ULtwNGvmSMLrQK3/EKaZXIEphub9yj32XrvnmQc1BJmSgzKJg/9pqsMJS/D0mBGYIzWoEk7n3p2q4fE2xjDC5r2slIa5UPEu40iNNtyuVDFXD5nq2gFaxSec/v21WaBjcIpiCN9zjcYmCSH8j2s9RsXkhq/fh+bCCHzwop6wj5rV4XqjWr/ogSHEsTtay2muDZnRoswby+Va1ESJPGdB2Lj474PSWj8ueLOoHWk8i/ZOa5cwqp4t2TSYZL5V/T3Vpl63RiBybAEGp7HFfPqyD4bDx7XsQuSpUXfTNEIfFZYfMeznMmqSfZZgeHnNwFppgMMuwn96LxN2yPy6noukm6915B+PXsu8bm+N0ZsagrgQlys1bWeWdMJZyNP13zUAlE8ya80KqMa3x3kl9tWX1o4Ii/E9qu+hRoWoyA1oqDYM2bNGkKaiTCdPytWetealxj+LQQIvv+I9Y9Ri9mHu9d8aiqt94P8Sv96pdUmUvbw+kRau1v0nhy5FbO5YHxFT4nugQP3D3fJTaFxe/yvyBb0sIZ/RUVbcNYYlR9MpPHqdzktAkvLPt2isnhd2hy8DCuMQ/xJPTCy6BmyqmeoIek0lUweZBm3U/G8W8C4KTQzhyDTq+Jn+qLWOzrcjn2nG2/UQTHWHerwF9tHOBvjETO84jmNq6Odwp7zHFY8cR9eVeEqGoWSqxZ0GiajBK2vkSi+gV4sOPxHZgJ+6xA76JkRsx8MlDHQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9304be61-e365-4c47-c2c7-08dc75a8ab57 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 13:04:07.0595 (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: ONMOmpA7ln3pe/SfKrporxW/FMpSmhC92CeK+3uStU03qucBBX3rWmQk7I/E6BGe1Rm2CVEinvQpqr0oDmsp/eiAfH/gDPuPKuGqaJD4bVc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8564 Add utilitary function to check if the information from a BIS is matching the capabilities in bt_bap. This utilitary is used when parsing the BASE data so that we can decide if we create a new setup/stream/transport for it, or advance to the next BIS. --- src/shared/bap.c | 21 +++++++++++++++++++++ src/shared/bap.h | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index 919ecbb6a016..c927ddc21572 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6521,3 +6521,24 @@ void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, cleanup: util_iov_free(merge_data.result, 1); } + +void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, + struct bt_bap_codec *codec, + struct iovec *l2_caps, + struct iovec *l3_caps, + struct bt_bap_pac **lpac, + struct iovec **caps) +{ + struct bt_ltv_extract merge_data = {0}; + + merge_data.src = l3_caps; + merge_data.result = new0(struct iovec, 1); + + /* Create a Codec Specific Configuration with LTVs at level 2 (subgroup) + * overwritten by LTVs at level 3 (BIS) + */ + util_ltv_foreach(l2_caps->iov_base, + l2_caps->iov_len, + NULL, + bap_sink_check_level2_ltv, &merge_data); +} diff --git a/src/shared/bap.h b/src/shared/bap.h index 62e2104850c7..c9cc4c3a4db7 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -257,3 +257,10 @@ void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, struct iovec *l3_caps, struct iovec *meta); +void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, + struct bt_bap_codec *codec, + struct iovec *l2_caps, + struct iovec *l3_caps, + struct bt_bap_pac **lpac, + struct iovec **caps); + From patchwork Thu May 16 13:03:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Istodorescu X-Patchwork-Id: 797501 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 60F05146A8A for ; Thu, 16 May 2024 13:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864663; cv=fail; b=if8IWEFqZDPTsYTHXK0xV+txYMI+H9jQu0kSdfZJ1Br/rGJxP2j1+wkylMBQcry7ayUxwsz01ECS3XknsnS+clVLs8Qrdpa+8tshbyI1JpTyMwAJZlN4x3Yk0/69IiUjSh8+CkL1K26Y57zQD5WVzWnPimqyMuLg1PpbZD4Xw4c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864663; c=relaxed/simple; bh=CTv8GsAt74FN3HIMa018Oa+ymmAAxE5pbCASHJVHKQw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=c9O3rMOriKNgivlZSvM48ynoleE44ZOpaZY9/LDFUkUEYb6Bf+7Rrd08rJTU5/OAUck0XFba83M2vbQs7VcFZ9oy0JDC6R6/Bc3T/gk2Upqha78PCQO61vqnaoTrelPMQWlb0Z8SVfA5u/DGQxmIndPUIkUVqGFZRHBTmZMWFLc= 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=ZLMWlZQ6; arc=fail smtp.client-ip=40.107.20.71 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="ZLMWlZQ6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hqRDuLLHcWhpgdJBhVoM3U5suKVJVnLq5L/OFlgnK4IAbAoO4hwaWgnWsv1v7KRcWv+VVObZl16P7y1/tIOjHwenGJ74kTyU4LGCkgfeAOLpxhUOJ50pXgqZFctVGSgbQUy8+EraQDV41BJzcpRhHLKeWr4GfBjY2SoBee44EUkAUGgEiOI5pLAhHJS1dP3BeoUaxI5zGnPNYJrzRUV3iLHPhi4UoZ6hHEg6uUcGMjkg60YwHDGOn8lWXvJHEsJXfMRKlVJHZo7F6fWYrhRUwBBAQc3V3aHCuB9Hyk8pchKuX5c3C0Tzfh4wp4vmaS4QIszLY00obP4lDQCbqoVFIQ== 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=j1MgYxk0EslhOm7iPk+hfb+Z1gDOOF3iRHpDplbUzY8=; b=XhYginb5fVey+LE8dVZ342esKtqa0XAwGOXz1YNrbOF1y+e1To3aoJdPmrQsBNumnbKmcFgBgtlU5t2us6zF4iqWUKWqdQDoAjR5dv4A2zvalVByt5C9ZsOgoI0k05AanMXNIxaqeBvJ0ylm6Mg4avTWARseIjNn0nLBUcpkRrTPRHusoVHpKJ3Bs7XiiBX62SCY3OqZY4YnIcZXc71vnY4uyuxinOueGYN7geAPZPFCv/G6FGj/7YZXfmbdYF4HrhRgSeZDeUOAmTvxlBGhH6MBQt2hG/e4Q+d9GjaY5AWIPjdxqsiWMknwlJ7+gHxRnhTpqu0G/4AtkmYwuTukow== 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=j1MgYxk0EslhOm7iPk+hfb+Z1gDOOF3iRHpDplbUzY8=; b=ZLMWlZQ64k23yIXNyMjn0potAQP7CL9Xv1nMktgbMu+Kw3IoSFbHIgNUeOXedlwlzNLAloSru3NTTtymtDsDG5WQOLTKPqbxTZBljgH7iExTqcouCjOOwHxnnfnWPrA5S+AdCMGtbkB7kZAC7b15J4VCFAdL+rjQgqErK64EGug= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) by AS8PR04MB8564.eurprd04.prod.outlook.com (2603:10a6:20b:423::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 13:04:10 +0000 Received: from AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd]) by AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd%7]) with mapi id 15.20.7587.028; Thu, 16 May 2024 13:04:10 +0000 From: Andrei Istodorescu To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, iulia.tanasescu@nxp.com, Andrei Istodorescu Subject: [PATCH BlueZ v5 3/6] bap: Update BIS management Date: Thu, 16 May 2024 16:03:57 +0300 Message-Id: <20240516130400.16713-4-andrei.istodorescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240516130400.16713-1-andrei.istodorescu@nxp.com> References: <20240516130400.16713-1-andrei.istodorescu@nxp.com> X-ClientProxiedBy: AM0PR04CA0112.eurprd04.prod.outlook.com (2603:10a6:208:55::17) To AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::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: AM9PR04MB8938:EE_|AS8PR04MB8564:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ed90ede-b98c-4d7c-3329-08dc75a8ac30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: 87dHMfaI/gXR0c66oikiyFdFfIvaW6iUg/2H47A1C3u14543Iu4Ri4Y/QpY6VG9oScA89Sgy8v1dpj+p2TADvNIo8i9Ao6t4nr25am8LYB85XoColmISRlWU0uLieelfSzLUL/8R1fwIDVLFbLguo/EXiP4JV4ZCEmG6as44Kq4dX2MIOaMOC6j4IB2IANOVxebjQEZfhGpUllDsQJ8Q5UQo2W5Q5OPeonYAu79qhNoZYsZbft8vsFEoXvcyFaqncXYOhqBYGTU6cURh0TfPJLdBcePzINsbPF3lXF4jP2SktYrQTvWarHWuLDZgHL/KceSyA2235A3zsfJc+KWBw4O6kMUzPR9K7tDPLjgXaw3Xujt4d0iu3ze78khVdMruVDikHPQnrbWg3yBuLkgSgfZdJUIAYfWaFwAHef7YM2UeUKlTsMKGg1xajvuIevCb44FA70hurrw2r35u9ONiYdq5ePwHzKKmsO8fclKtiVsndbkIYVMtNMoU1mcxUtjBAdP6u0gcMnj9j8oZlKg2uVdcVvIVtp5h3h0QG8gTYHXj9cOBa0dvt5WSf6/StBpyL77Jb/FXEsh+wLIcd4cf6ZDLoPKnqkEAUHg1QsrglbzNABo9lvj2IPDzwCflrJzt/Wmv/fvF9qkfdEjpwP6xwY9ToS8rOTVan5YkGwxnd2VX0ZU3x+cAvX/TpsdJcQQJZBIrhqCTQ3ntIIHl0CmVy6VurMJ3O4/RyVfMwfkLiDNQg49MdrRBiiQEkoJkHQOkq7ujCtlQp3IGttwHICQ7m/wsot9G7MBxgt6Jzas9wILOz6BnaJZJEjNkNJJ3SPQDvlSYmq4ZrKFlgstDS88TsR5VIABdNTyyhg9YxGI/8UEmhz+FBm/jKjfgbw8IgPUnrgLYuRi2mbUnuagYwIyl/1TiAA0BKHRWRPVUOl6hogNelgXeLtBm9pyWubtsjwwJwtORGNLlDr65j1a7oCUmzO9NVrCGCeb5fXtSn4j5khShLs/mLrf8nTHWPVdht8GtYRrAqBYaJRnYq4s/40w+rKEhp8oZ19w+esmvClMXnX1z+y6kuACOHQLgy6vVMU4N3oZhKNgmhAgZA2+989VYOdO/xg3AIRa8llHnuY4JDJjExBrlDimfj+wOlS8mWKRM0nEmAFgzJltSfPCrmNSLSXh7UszilWdTVRPfh5MoaedT8PZ5OE3hsVoT/pP8ZaW8e/+YCKgMMdVm7wVlfYvu1/D4HHaNiOIkVX8vWR/zNm4XPhK8tDrWfTgHCYAQhSVbRG7bohTx8WV8Ypg+S2jktg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8938.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pCd/1dOXJOAeJvSkpaPM5sjb0lR4YxdFrwZ29v0aZpZeqx0oxKwRgdkRBmJGSHPyzZJEysC2ucrcjg+rQYEMRgJD2YN7yD9vxgWkKvrIeuK2W5ONuqiQN7q6Q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uJgzzgAwLsfJGHIU+tL5TKFC7jwVE62hNBv6rhNpqT8YdTz59AEQKZawmn2rxn6oXSTCDLholRxHrUAyPXgJ4l9RYt9q1Ez1hMg6OzfLH2KPbO//N6Q2FZx+z59iETbll6IVtrevM2mH9y+t4oS+5dEy1bgGmN4RhPKUUfNP1iyhS4u5eQiwbpwOcKxxM5i6HfrAHBi4G2zemidgC4uYHlUftHE2zC2cATuoHTijKVJdCejNlw5P5q5FBM5kefGlCKbWC6ei4FBqeM8/fi+PNvWASGSSvhnlcDX9M7oUzYjLbxDRAawIPp50NICW+NXmsXg7qh2+vu41CrGNczcUJNkSuDMJhU6lqNI0YJ5z+m569xOT+MSGXDokp5c7y/8XNxf9OA04ru8Em45FhcHPA86PP11xE6DmPKPKDJB5g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ed90ede-b98c-4d7c-3329-08dc75a8ac30 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 13:04:08.5459 (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: PPl3Qj51DjHutjv6WkmT0vV4aAHDcEO+ZDSOoJCpodWxMdanEG3LO9Dm9hJf+TDkle1Tqt3PFOnFHF/HFMTLKO9zzIbMXdVFRhKTzwk3B3U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8564 Use the BIS index received in the BASE to synchronize to the BIG. Allow bt_bap_endpoint to be NULL. Remove the Broadcast Sink code from set_configuration. Update BASE parsing so that it creates streams and transports, without a remote PAC and endpoint. Update bap_find_setup_by_stream to find the setup in case the stream does not contain an endpoint. --- profiles/audio/bap.c | 320 ++++++++++++++++++++++++++++++------------- 1 file changed, 226 insertions(+), 94 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index f09f2ea44109..06dc4e254210 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -115,6 +115,7 @@ struct bap_data { struct queue *srcs; struct queue *snks; struct queue *bcast; + struct queue *bcast_snks; struct queue *streams; GIOChannel *listen_io; int selecting; @@ -202,6 +203,8 @@ static void ep_unregister(void *data) MEDIA_ENDPOINT_INTERFACE); } +static void setup_free(void *data); + static void bap_data_free(struct bap_data *data) { if (data->listen_io) { @@ -218,6 +221,7 @@ static void bap_data_free(struct bap_data *data) queue_destroy(data->srcs, ep_unregister); queue_destroy(data->bcast, ep_unregister); queue_destroy(data->streams, NULL); + queue_destroy(data->bcast_snks, setup_free); bt_bap_ready_unregister(data->bap, data->ready_id); bt_bap_state_unregister(data->bap, data->state_id); bt_bap_pac_unregister(data->bap, data->pac_id); @@ -855,7 +859,11 @@ static struct bap_setup *setup_new(struct bap_ep *ep) setup = new0(struct bap_setup, 1); setup->ep = ep; - if (queue_find(ep->data->bcast, NULL, ep)) { + /* Broadcast Source has endpoints in bcast list, Broadcast Sink + * does not have endpoints + */ + if (((ep != NULL) && queue_find(ep->data->bcast, NULL, ep)) || + (ep == NULL)) { /* Mark BIG and BIS to be auto assigned */ setup->qos.bcast.big = BT_ISO_QOS_BIG_UNSET; setup->qos.bcast.bis = BT_ISO_QOS_BIS_UNSET; @@ -871,12 +879,14 @@ static struct bap_setup *setup_new(struct bap_ep *ep) setup->qos_parser = setup_parse_ucast_qos; } - if (!ep->setups) - ep->setups = queue_new(); + if (ep) { + if (!ep->setups) + ep->setups = queue_new(); - queue_push_tail(ep->setups, setup); + queue_push_tail(ep->setups, setup); - DBG("ep %p setup %p", ep, setup); + DBG("ep %p setup %p", ep, setup); + } return setup; } @@ -947,17 +957,6 @@ static DBusMessage *set_configuration(DBusConnection *conn, DBusMessage *msg, return btd_error_invalid_args(msg); } - /* For BAP Broadcast Sink, the capabilities and metadata are coming - * from the source's BIS, which are present in the remote PAC - */ - if (bt_bap_pac_get_type(ep->lpac) == BT_BAP_BCAST_SINK) { - util_iov_free(setup->caps, 1); - setup->caps = util_iov_dup(bt_bap_pac_get_data(ep->rpac), 1); - util_iov_free(setup->metadata, 1); - setup->metadata = util_iov_dup( - bt_bap_pac_get_metadata(ep->rpac), 1); - } - setup->stream = bt_bap_stream_new(ep->data->bap, ep->lpac, ep->rpac, &setup->qos, setup->caps); bt_bap_stream_set_user_data(setup->stream, ep->path); @@ -995,18 +994,26 @@ 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; int fd; + struct bt_bap *bt_bap = bt_bap_stream_get_session(setup->stream); + struct btd_service *btd_service = bt_bap_get_user_data(bt_bap); + struct bap_data *bap_data = btd_service_get_user_data(btd_service); DBG("BIG Sync completed"); - queue_remove(setup->ep->data->adapter->bcast_pa_requests, req); + 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(setup->ep->data->service, 0); + 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); + free(req); + if (bt_bap_stream_set_io(setup->stream, fd)) { - bt_bap_stream_enable(setup->stream, true, NULL, NULL, NULL); + bt_bap_stream_start(setup->stream, NULL, NULL); g_io_channel_set_close_on_unref(io, FALSE); return; } @@ -1019,8 +1026,54 @@ static void print_ltv(size_t i, uint8_t l, uint8_t t, uint8_t *v, util_hexdump(' ', v, l, user_data, NULL); } -static bool parse_base(struct bt_bap *bap, struct bt_iso_base *base, - util_debug_func_t func) +static void create_stream_for_bis(struct bap_data *bap_data, + struct bt_bap_pac *lpac, struct bt_iso_qos *qos, + struct iovec *caps, struct iovec *meta, char *path) +{ + struct bap_setup *setup; + + setup = setup_new(NULL); + + /* Create BAP QoS structure */ + setup->qos.bcast.big = qos->bcast.big; + setup->qos.bcast.bis = qos->bcast.bis; + setup->qos.bcast.sync_factor = qos->bcast.sync_factor; + setup->qos.bcast.packing = qos->bcast.packing; + setup->qos.bcast.framing = qos->bcast.framing; + setup->qos.bcast.encryption = qos->bcast.encryption; + if (setup->qos.bcast.encryption) + util_iov_append(setup->qos.bcast.bcode, + qos->bcast.bcode, + sizeof(qos->bcast.bcode)); + setup->qos.bcast.options = qos->bcast.options; + setup->qos.bcast.skip = qos->bcast.skip; + setup->qos.bcast.sync_timeout = qos->bcast.sync_timeout; + setup->qos.bcast.sync_cte_type = + qos->bcast.sync_cte_type; + setup->qos.bcast.mse = qos->bcast.mse; + setup->qos.bcast.timeout = qos->bcast.timeout; + setup->qos.bcast.io_qos.interval = + qos->bcast.in.interval; + setup->qos.bcast.io_qos.latency = qos->bcast.in.latency; + setup->qos.bcast.io_qos.phy = qos->bcast.in.phy; + setup->qos.bcast.io_qos.rtn = qos->bcast.in.rtn; + setup->qos.bcast.io_qos.sdu = qos->bcast.in.sdu; + + queue_push_tail(bap_data->bcast_snks, setup); + + /* Create and configure stream */ + setup->stream = bt_bap_stream_new(bap_data->bap, + lpac, NULL, &setup->qos, caps); + + bt_bap_stream_set_user_data(setup->stream, path); + bt_bap_stream_config(setup->stream, &setup->qos, + caps, NULL, NULL); + bt_bap_stream_metadata(setup->stream, meta, + NULL, NULL); +} + +static bool parse_base(struct bap_data *bap_data, struct bt_iso_base *base, + struct bt_iso_qos *qos, util_debug_func_t func) { struct iovec iov = { .iov_base = base->base, @@ -1099,6 +1152,10 @@ static bool parse_base(struct bt_bap *bap, struct bt_iso_base *base, for (; num_bis; num_bis--) { uint8_t bis_index; struct iovec *l3_caps; + struct iovec *merged_caps; + struct bt_bap_pac *matched_lpac; + char *path; + int err; if (!util_iov_pull_u8(&iov, &bis_index)) { ret = false; @@ -1106,6 +1163,11 @@ static bool parse_base(struct bt_bap *bap, struct bt_iso_base *base, } util_debug(func, NULL, "BIS #%d", bis_index); + err = asprintf(&path, "%s/bis%d", + device_get_path(bap_data->device), + bis_index); + if (err < 0) + continue; /* Read Codec Specific Configuration */ l3_caps = new0(struct iovec, 1); @@ -1128,9 +1190,16 @@ static bool parse_base(struct bt_bap *bap, struct bt_iso_base *base, l3_caps->iov_len, NULL, print_ltv, func); - /* Try to create a PAC using this BIS information */ - bt_bap_add_bis(bap, bis_index, &codec, l2_caps, l3_caps, - meta); + /* Check if this BIS matches any local PAC */ + bt_bap_verify_bis(bap_data->bap, bis_index, &codec, + l2_caps, l3_caps, &matched_lpac, + &merged_caps); + + if (matched_lpac == NULL || merged_caps == NULL) + continue; + + create_stream_for_bis(bap_data, matched_lpac, qos, + merged_caps, meta, path); } group_fail: @@ -1175,12 +1244,16 @@ static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data) g_io_channel_unref(data->listen_io); g_io_channel_shutdown(io, TRUE, NULL); data->listen_io = NULL; - queue_remove(data->adapter->bcast_pa_requests, req); - free(req); + /* Analyze received BASE data and create remote media endpoints for each * BIS matching our capabilities */ - parse_base(data->bap, &base, bap_debug); + parse_base(data, &base, &qos, bap_debug); + + service_set_connecting(req->data.service); + + queue_remove(data->adapter->bcast_pa_requests, req); + free(req); } static bool match_data_bap_data(const void *data, const void *match_data) @@ -1583,6 +1656,7 @@ static struct bap_setup *bap_find_setup_by_stream(struct bap_data *data, struct bt_bap_stream *stream) { struct bap_ep *ep = NULL; + struct queue *queue = NULL; switch (bt_bap_stream_get_type(stream)) { case BT_BAP_STREAM_TYPE_UCAST: @@ -1597,9 +1671,11 @@ static struct bap_setup *bap_find_setup_by_stream(struct bap_data *data, } if (ep) - return queue_find(ep->setups, match_setup_stream, stream); + queue = ep->setups; + else + queue = data->bcast_snks; - return NULL; + return queue_find(queue, match_setup_stream, stream); } static void iso_connect_bcast_cb(GIOChannel *chan, GError *err, @@ -2201,7 +2277,7 @@ static void setup_create_bcast_io(struct bap_data *data, memcpy(&iso_qos.bcast.out, &setup->qos.bcast.io_qos, sizeof(struct bt_iso_io_qos)); - if (bt_bap_pac_get_type(setup->ep->lpac) == BT_BAP_BCAST_SOURCE) + if (bt_bap_stream_get_dir(stream) == BT_BAP_BCAST_SINK) setup_connect_io_broadcast(data, setup, stream, &iso_qos, defer); else @@ -2413,7 +2489,7 @@ static uint8_t get_streams_nb_by_state(struct bap_setup *setup) return stream_cnt; } -static void bap_state_bcast(struct bt_bap_stream *stream, uint8_t old_state, +static void bap_state_bcast_src(struct bt_bap_stream *stream, uint8_t old_state, uint8_t new_state, void *user_data) { struct bap_data *data = user_data; @@ -2442,66 +2518,96 @@ static void bap_state_bcast(struct bt_bap_stream *stream, uint8_t old_state, case BT_BAP_STREAM_STATE_CONFIG: if (!setup || setup->id) break; - if (bt_bap_stream_io_dir(stream) == - BT_BAP_BCAST_SOURCE) - /* If the stream is attached to a - * broadcast sink endpoint. - */ - setup_create_io(data, setup, stream, defer); - else { - /* If the stream attached to a broadcast - * source endpoint generate the base. - */ - if (setup->base == NULL) { - setup->base = bt_bap_stream_get_base( - setup->stream); - /* Set the generated BASE on all setups - * from the same BIG. - */ - queue_foreach(setup->ep->setups, - iterate_setup_update_base, setup); - } - /* The kernel has 2 requirements when handling - * multiple BIS connections for the same BIG: - * 1 - setup_create_io for all but the last BIS - * must be with defer true so we can inform the - * kernel when to start the BIG. - * 2 - The order in which the setup_create_io - * are called must be in the order of BIS - * indexes in BASE from first to last. - * To address this requirement we will call - * setup_create_io on all BISes only when all - * transport acquire have been received and will - * send it in the order of the BIS index - * from BASE. + /* If the stream attached to a broadcast + * source endpoint generate the base. + */ + if (setup->base == NULL) { + setup->base = bt_bap_stream_get_base( + setup->stream); + /* Set the generated BASE on all setups + * from the same BIG. */ - nb_bises = get_streams_nb_by_state(setup); - - if (nb_bises == 1) { - setup_create_io(data, setup, - stream, defer); - if (!setup->io) { - error("Unable to create io"); - if (old_state != - BT_BAP_STREAM_STATE_RELEASING) - bt_bap_stream_release(stream, - NULL, NULL); - } - break; - } else if (nb_bises == 0) - break; + queue_foreach(setup->ep->setups, + iterate_setup_update_base, setup); + } + /* The kernel has 2 requirements when handling + * multiple BIS connections for the same BIG: + * 1 - setup_create_io for all but the last BIS + * must be with defer true so we can inform the + * kernel when to start the BIG. + * 2 - The order in which the setup_create_io + * are called must be in the order of BIS + * indexes in BASE from first to last. + * To address this requirement we will call + * setup_create_io on all BISes only when all + * transport acquire have been received and will + * send it in the order of the BIS index + * from BASE. + */ + nb_bises = get_streams_nb_by_state(setup); - if (!create_io_bises(setup, nb_bises, data)) { + if (nb_bises == 1) { + setup_create_io(data, setup, + stream, defer); + if (!setup->io) { + error("Unable to create io"); if (old_state != BT_BAP_STREAM_STATE_RELEASING) bt_bap_stream_release(stream, - NULL, NULL); + NULL, NULL); } + break; + } else if (nb_bises == 0) + break; + + if (!create_io_bises(setup, nb_bises, data)) { + if (old_state != + BT_BAP_STREAM_STATE_RELEASING) + bt_bap_stream_release(stream, + NULL, NULL); } break; } } +static void bap_state_bcast_sink(struct bt_bap_stream *stream, + uint8_t old_state, uint8_t new_state, + void *user_data) +{ + struct bap_data *data = user_data; + struct bap_setup *setup; + bool defer = false; + + DBG("stream %p: %s(%u) -> %s(%u)", stream, + bt_bap_stream_statestr(old_state), old_state, + bt_bap_stream_statestr(new_state), new_state); + + if (new_state == old_state && new_state != BT_BAP_STREAM_STATE_CONFIG) + return; + + setup = bap_find_setup_by_stream(data, stream); + + switch (new_state) { + case BT_BAP_STREAM_STATE_IDLE: + /* Release stream if idle */ + if (setup) + setup_free(setup); + else + queue_remove(data->streams, stream); + break; + 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; + } +} + static void pac_added(struct bt_bap_pac *pac, void *user_data) { struct btd_service *service = user_data; @@ -2848,28 +2954,51 @@ 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; - struct bap_data *data = setup->ep->data; + struct bt_bap *bt_bap = bt_bap_stream_get_session(setup->stream); + struct btd_service *btd_service = bt_bap_get_user_data(bt_bap); + struct bap_data *data = btd_service_get_user_data(btd_service); struct sockaddr_iso_bc iso_bc_addr; struct bt_iso_qos qos; + char *path; + int bis_index = 1; + int s_err; + const char *strbis = NULL; - DBG("PA Sync done, do BIG Sync"); + DBG("PA Sync done"); g_io_channel_unref(setup->io); - setup->io = NULL; - + g_io_channel_shutdown(setup->io, TRUE, NULL); setup->io = io; g_io_channel_ref(setup->io); /* TODO * We can only synchronize with a single BIS to a BIG. * In order to have multiple BISes targeting this BIG we need to have - * all the BISes before doing this request. This request is triggered - * by an endpoint "SetConfiguration" command. For multiple BISes - * we need another way to specify which BISes user is requesting + * all the BISes before doing bt_io_bcast_accept. + * This request comes from a transport "Acquire" call. + * For multiple BISes in the same BIG we need to either wait for all + * transports in the same BIG to be acquired or tell when to do the + * bt_io_bcast_accept by other means */ + path = bt_bap_stream_get_user_data(setup->stream); + + strbis = strstr(path, "/bis"); + if (strbis == NULL) { + 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); + 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] = 1; + iso_bc_addr.bc_bis[0] = bis_index; iso_bc_addr.bc_num_bis = 1; /* Set the user requested QOS */ @@ -2914,7 +3043,9 @@ static void pa_and_big_sync(struct bap_bcast_pa_req *req) { GError *err = NULL; struct bap_setup *setup = req->data.setup; - struct bap_data *data = setup->ep->data; + 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); req->in_progress = TRUE; @@ -2922,11 +3053,11 @@ static void pa_and_big_sync(struct bap_bcast_pa_req *req) setup->io = bt_io_listen(NULL, iso_do_big_sync, req, NULL, &err, BT_IO_OPT_SOURCE_BDADDR, - btd_adapter_get_address(data->adapter->adapter), + btd_adapter_get_address(bap_data->adapter->adapter), BT_IO_OPT_DEST_BDADDR, - device_get_address(data->device), + device_get_address(bap_data->device), BT_IO_OPT_DEST_TYPE, - btd_device_get_bdaddr_type(data->device), + btd_device_get_bdaddr_type(bap_data->device), BT_IO_OPT_MODE, BT_IO_MODE_ISO, BT_IO_OPT_QOS, &bap_sink_pa_qos, BT_IO_OPT_INVALID); @@ -2967,6 +3098,7 @@ static int bap_bcast_probe(struct btd_service *service) free(data); return -EINVAL; } + data->bcast_snks = queue_new(); if (!bt_bap_attach(data->bap, NULL)) { error("BAP unable to attach"); @@ -2977,7 +3109,7 @@ static int bap_bcast_probe(struct btd_service *service) data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service, NULL); - data->state_id = bt_bap_state_register(data->bap, bap_state_bcast, + data->state_id = bt_bap_state_register(data->bap, bap_state_bcast_sink, bap_connecting_bcast, data, NULL); data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast, pac_removed_broadcast, data, NULL); @@ -3160,7 +3292,7 @@ static int bap_adapter_probe(struct btd_profile *p, struct btd_adapter *adapter) return -EINVAL; } - data->state_id = bt_bap_state_register(data->bap, bap_state_bcast, + data->state_id = bt_bap_state_register(data->bap, bap_state_bcast_src, bap_connecting_bcast, data, NULL); data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast, pac_removed_broadcast, data, NULL); From patchwork Thu May 16 13:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Istodorescu X-Patchwork-Id: 797316 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 ED57D146D6B for ; Thu, 16 May 2024 13:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864661; cv=fail; b=aZXJMgkDOC9kb6LpqXUtMwQm+6SMmSfpdJSORUEqI1yFGCxjXBdICnjO2vlnQj6//juQnLx5AaRkeHQMe2E9r88KW7+UlZkYe3f+ILgbGuJ1C71En/hk/vodG8XgZRU8kqMcdEBF+/lbYZ3j5fz8+V7NeHhf21FztUBuPitnlhY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864661; c=relaxed/simple; bh=CTeIYurGRRsqn8V1bBAAeGZS2Y8SYw6HvNBZE78vRtQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=AwQo58Rc230krzqRQeKmk2pPlDzTxIxJAfk6Gm65R2kR3vsUXHIMSOsdjuTNFli1GnUeNiS0jG97F6tc+OiG/MFc7VlMn3mXl/C/WQA94h5D1PiyVuHfMkGfEtwjogXZWfs/IyOggRRRJJbGyeMEwia6FIdwVzJ7XMQ/zkwrMbc= 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=aKPJn4Y0; arc=fail smtp.client-ip=40.107.20.71 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="aKPJn4Y0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l359/Xp+lWbLqQmpj4GeinmzkuAfpAq138MgDKgC/VKOJBgMAqmLGfNh33XohjQXZReGXYxEhPpguWQq0iKIfQDi+Q3CXXkIzHrJ1u1ScoW+wMSjSZDO8E25lsR4Fl9o4p+CnBGL1Ts0KZG0PjAxjea8hqky4C68ZnebBVKnuE/Qp6Xyv9Z5GeVC5qV5AJCwowQGjAWb+kQXlnrW35Cz/U1a7yJZpYDPu9hZlsqW9OPEWoCm6gVqlipY94mGfE7+8+GxbwTQwhHzHAaTYI5VY5WkvPC0FlPJqtDdu2h3qHR0u2zqI75MzMnASBNNLneG6/4c6KUfs9/VtGEjSxW9gw== 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=2nhH4rehtxiXaGpLR3iK/N8jCWBaoutYYggG0kOa/O8=; b=SFu6hW5E+DEN9WvFhjqknkMsYis0/oZaGnNSKl76YyrliGCk21dM6vv0GeluQfHboYmby6zOFk7KFltPUsnUq+fiY9OTVaV+CqOoVt+n+w3yB2ddyaAice0piiMpNLQE8i6ruyc+z0dPbG3PLQhWtWcusJpkppWgPumj/+wEbC/LLoqo/wNds8ZfnavetttHRc+FEYgDwlrT5iu0K1zrYNVQmU6xrE1MlsEXkygNJ4Qmj6jY4hCeSifpRqEbdkmz7Xq0zg7gE6SSiWSvdxxHLHvU0VGS16VNNp2Mn8bL91zqO22WdvLiHxSpdFamyYC+b+Khz8QaOB3m3sd1j+QySQ== 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=2nhH4rehtxiXaGpLR3iK/N8jCWBaoutYYggG0kOa/O8=; b=aKPJn4Y0GehzfHADbwuWMu9EpHq68YaTxmMgwrQQu/irGVv48qmM7HbN7ex6AmF6KKlZi4t+xCU9yItIyy/rbHeuinTEZ9ID97r0ErcZ2/QLiWpQDWQYYKSKGHCBEzjw+uHVwv7ovQXGBUiv7p71lxFQWKXrfT4sVu8YeKO+/ig= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) by AS8PR04MB8564.eurprd04.prod.outlook.com (2603:10a6:20b:423::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 13:04:10 +0000 Received: from AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd]) by AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd%7]) with mapi id 15.20.7587.028; Thu, 16 May 2024 13:04:10 +0000 From: Andrei Istodorescu To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, iulia.tanasescu@nxp.com, Andrei Istodorescu Subject: [PATCH BlueZ v5 4/6] shared/bap: Remove not needed function Date: Thu, 16 May 2024 16:03:58 +0300 Message-Id: <20240516130400.16713-5-andrei.istodorescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240516130400.16713-1-andrei.istodorescu@nxp.com> References: <20240516130400.16713-1-andrei.istodorescu@nxp.com> X-ClientProxiedBy: AM0PR02CA0190.eurprd02.prod.outlook.com (2603:10a6:20b:28e::27) To AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::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: AM9PR04MB8938:EE_|AS8PR04MB8564:EE_ X-MS-Office365-Filtering-Correlation-Id: fd21015a-7b75-4dc4-1293-08dc75a8ad14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: d02ooY/IDMz6slgTiclLa83hUEhydIxVQEd3gKj9ZlIKqCDlszQHJCksqt5kD7cvc0hdnSwdYmNCI5uEbNwjOf0tUrHcN5orCA0TSlVdFd+14x3SHutjZdGs17EF1YPXM1lzgp0DU11fAZna9GnvV68Hh1EDVOAxl7tKjilcmfhUZDD+fZ0+ifcYR9VPG7gKMnc/lzr+4Cj/fmBmCfSVRbbQMT4t5gCt/49MwTLQzQ2GCYlTBxBtyniI8Q1FnA+2ONPcXnHYk6JavnR403DWHTWMefA0ZiOMVqgD3qenrZH2P7E1vAYQ/tsMuKkKw4/mtNnePCSI5tsuHTwwucuXD2dHTo6Jip/yYxWpCdadIn8j57XkfQonC6NjZkVPZuXzx4PMFPjcdbSmX49WUPSsy44b9D/RH/B1Oj/ExVhzoGlgEsUu3FTcymVO6uxMf8PIokyXJTI5SuZ36p/cn0rglLsiEjG3xmy46YejU7eKlfEUF9lFPNDcggpG0+R6ryYCO0EEjUm0xVHbvWkcCUeqbbM0l5S0GwNirVrnXMy/fJVFmigS+QrnW/JjOnWepErmlOziBPiCWB0Gkmt+IT6f6/OTPWZ23sDrlMo03iYtAZhIKjlzmqQmzBSEmJcaBOhZbQP8Y4vP9RkQvasP8i0Ok2h0hZqfVL5v+Z250178elSvMncrd2TIer7fdAVZYPY1CDWkrPhUqgIPgj6vU6lpfEdeGV2zw63cnwfO6GBw2V1VInwzmBX/af95BcY2PZmF8MCo9I1RxtOBBGSUvED1Qht42H8lPdjnRIn6xT3sYZcEIr7EToaZM8NwVz0pPq+L70/v+cKhLonAL5felE3/NiGdj7lanC7MeD3RWtINMaBcICwDNn/rRQZfZ7PU2VjkBuWRyUbMfqapMI9uJSBzZmOs9ynHtoFW9Mpi6WVot9wwcAHhPznr0vyUlRXH+5qxBMBULjJ2G9eWHKGDDmeIfNs0EgQmSUhNy8lojlIq1vKbPNI8645QRqvwCs0z2OwqFY4APiBFx+jrA4sy7FaIbC6CLYOIX03eWjR0fumDuzzTNWgfmnnStqp74TFDzk0/KD+jaZXGgKEgA8V1QihjhGxptnzMgeizc1+1xNelozvoJ9MN3th6JO8hQ8Hm5dVQNUo71j5LokNsv1TDkEjm4NPPJoNn4hc1tYwlODAprtDSRnHhUb1QK/M+Hb0nBDwGnsg44NWtemEKIhi9PuBoFB3+i+acpRiKw0zfeaD0ORlc3XJcJLKZ0SyY7mZWzlmMxUBknHf3znZWJK2AH9TxJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8938.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H+pgx5Zwch/q2x4hePsoYS80F+EBEWa2CMKLLQ1nWJWS7Y1nzaxdc0Eb7Amaz8Ii33KI4pQT6N3Z9XQ5mj5W7Iq31CIyPAP/rt0DkVuIfOIyOfN2oSdkmhw2q90fRzJKcXn+Y5ZUFsMakMb9D28MCK119rmnJqqu1vN7sRRNS/g67PnYz5cuUS088CB1fJGnfe8h3wgbByyc/j3WgjD2ojJ1UTI0g13QED03WNRHycH057+eZyBNlqHJvqRlqSo4s/fd+EfO9Yv29NCM+VjDdr5J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S62Nhb/ick8q/OGGMizQYXfwZUXGjrfjByDWxwHqC+2FsbIxtO+LkyHABwdLC1M/sbt39c6SqME7D7muXxsOht1zFnG/ifGt4EpCP/XYDVAhzJIxrVYybc+eqqpFfxCvw3Q1DsHwF/itlG35F/REkKTFiISf9MC4sH7boN8oBd0hNQ3+cmGLvd1ylC8vSTdS/Tfb+p0MhUHl4suQYTXeNJwcBKKOK6yoPGsDBHAMQ0w3SQNJePhRwLaEu+PsxkDQD7oYeJ/pwxCPQ3n5tg92sstfA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd21015a-7b75-4dc4-1293-08dc75a8ad14 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 13:04:09.9463 (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: 97R+xL8V+mZZxzY0dQQKKDN4Zghszi8nSsNAJhFgVzoh8njlLJOHYR8AeJgHJeB1mtqBvJXBwD/lBEKTJ+c8uP8bIN5Byl+1MywUNw8UVTU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8564 --- src/shared/bap.c | 82 +++++++++--------------------------------------- src/shared/bap.h | 6 ---- 2 files changed, 15 insertions(+), 73 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index c927ddc21572..1d1a6b25d1a9 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6425,7 +6425,8 @@ static void bap_sink_match_allocation(size_t i, uint8_t l, uint8_t t, data->found = false; } -static bool bap_check_bis(struct bt_bap_db *ldb, struct iovec *bis_data) +static struct bt_ltv_match bap_check_bis(struct bt_bap_db *ldb, + struct iovec *bis_data) { struct bt_ltv_match compare_data = {}; @@ -6451,21 +6452,18 @@ static bool bap_check_bis(struct bt_bap_db *ldb, struct iovec *bis_data) &compare_data); } - return compare_data.found; + return compare_data; } -void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, +void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, struct bt_bap_codec *codec, struct iovec *l2_caps, struct iovec *l3_caps, - struct iovec *meta) + struct bt_bap_pac **lpac, + struct iovec **caps) { - struct bt_bap_pac *pac_source_bis; - struct bt_bap_endpoint *ep; - int err = 0; - struct bt_bap_pac_qos bis_qos = {0}; - uint8_t type = 0; struct bt_ltv_extract merge_data = {0}; + struct bt_ltv_match match_data; merge_data.src = l3_caps; merge_data.result = new0(struct iovec, 1); @@ -6481,64 +6479,14 @@ void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, /* Check each BIS Codec Specific Configuration LTVs against our Codec * Specific Capabilities and if the BIS matches create a PAC with it */ - if (bap_check_bis(bap->ldb, merge_data.result) == false) - goto cleanup; - - DBG(bap, "Matching BIS %i", bis_index); - - /* Create a QoS structure based on the received BIS information to - * specify the desired channel for this BIS/PAC - */ - type = BAP_CHANNEL_ALLOCATION_LTV_TYPE; - util_ltv_foreach(merge_data.result->iov_base, - merge_data.result->iov_len, &type, - bap_sink_get_allocation, &bis_qos.location); - - /* Create a remote PAC */ - pac_source_bis = bap_pac_new(bap->rdb, NULL, - BT_BAP_BCAST_SOURCE, codec, &bis_qos, - merge_data.result, meta); - - err = asprintf(&pac_source_bis->name, "%d", bis_index); - - if (err < 0) { - DBG(bap, "error in asprintf"); - goto cleanup; + match_data = bap_check_bis(bap->ldb, merge_data.result); + if (match_data.found == true) { + *caps = merge_data.result; + DBG(bap, "Matching BIS %i", bis_index); + } else { + util_iov_free(merge_data.result, 1); + *caps = NULL; + *lpac = NULL; } - /* Add remote source endpoint */ - if (!bap->rdb->broadcast_sources) - bap->rdb->broadcast_sources = queue_new(); - queue_push_tail(bap->rdb->broadcast_sources, pac_source_bis); - - queue_foreach(bap->pac_cbs, notify_pac_added, pac_source_bis); - /* Push remote endpoint with direction sink */ - ep = bap_endpoint_new_broadcast(bap->rdb, BT_BAP_BCAST_SINK); - - if (ep) - queue_push_tail(bap->remote_eps, ep); - -cleanup: - util_iov_free(merge_data.result, 1); -} - -void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, - struct bt_bap_codec *codec, - struct iovec *l2_caps, - struct iovec *l3_caps, - struct bt_bap_pac **lpac, - struct iovec **caps) -{ - struct bt_ltv_extract merge_data = {0}; - - merge_data.src = l3_caps; - merge_data.result = new0(struct iovec, 1); - - /* Create a Codec Specific Configuration with LTVs at level 2 (subgroup) - * overwritten by LTVs at level 3 (BIS) - */ - util_ltv_foreach(l2_caps->iov_base, - l2_caps->iov_len, - NULL, - bap_sink_check_level2_ltv, &merge_data); } diff --git a/src/shared/bap.h b/src/shared/bap.h index c9cc4c3a4db7..b35b2711edb9 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -251,12 +251,6 @@ bool bt_bap_pac_bcast_is_local(struct bt_bap *bap, struct bt_bap_pac *pac); struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream); -void bt_bap_add_bis(struct bt_bap *bap, uint8_t bis_index, - struct bt_bap_codec *codec, - struct iovec *l2_caps, - struct iovec *l3_caps, - struct iovec *meta); - void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, struct bt_bap_codec *codec, struct iovec *l2_caps, From patchwork Thu May 16 13:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Istodorescu X-Patchwork-Id: 797315 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) (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 09F45146D6B for ; Thu, 16 May 2024 13:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864665; cv=fail; b=OZ1gS7tE3ee8yBf6g9YUBZ51XIyywxR8fmAh3jf5ZIHsmlp22+nhGrfuCFNy+4C4f5Vd1eeTOBsKy/a9SAIawwLFc6BYd/0gFo0pkJFsJx5blJ5xn3oI34rYNXgwlwTZoesqeym2wtsqX/tyblkBf6eYB7+RuZbupAebOf8MOCk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864665; c=relaxed/simple; bh=UiLc1Wd1TWODP3EL8PVlsGmCbucKc4tpmkQYM994M/E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Vi3Eprkrt1SrPKGH6ih3Fmb5snHivXb1xyXJxVHamenwIfMKVKKwaD9pbf99dbHJUrx5gaX1n04MkKA8upDyyU3pkaRk7Rlqx0p23k/veLvR2S7n2qCaWtNskMRtcYJbydwy10wtROeN2HaDVyCn8qB3rMHNTOFqjZyVrd9MPyc= 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=p/ekyK28; arc=fail smtp.client-ip=40.107.20.71 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="p/ekyK28" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y2gLdGenaIn1VFQRIlCMXIgcqov2XeXSlo2p8Y9lfPPYe4+JAqykSF/Qhvljt8rTqCPdKjxDTY3Y3xO3cVhjqftIDaNo+p6TNNdQ5hdMH81FQd8OwRfWea+dAes7OaZ79xCypVYDns8EhDbgHCH3V6K0Kwy7KuyxA5ZUPtkaFGhc3wTuvMm1suhKQtxyMJz+sTP4k18a67/P5NljJx+uqlfA9zbgi7tjWGUr6Lwr6MLu9Yh9T+6btjMnhRXHf7PWg+eDNKVkTEiblJG2JULHW4G4ggokJyHWeGd+wnX3p3858ZLOiykp38H1WrglfvUnw/drSt6ccepZsljSy2WWIw== 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=uJTqhgFmE78NyhyzvCDE+29vlVPvl0KdXNA4D2G9DXQ=; b=PvNIhl1DaMI9EAy9nuhfzX9qxdtBvVwR61th7OxRA7MLvTNocX6tU4qos6Lneis9XP/SQ6JgDHaGVNAdbzC7VbRNEXLDJjzMtEL1m0id+p4AorxH4zhSSliTklQ2imLPcTjg+4BtajWxx1uBDJS6U34fBtFhi+PLDRN2W+3s4XBNw9X4N65WqWHnVfLu1zUTz7/wP6iCweNchyM14tDKHX3L2RQ94i3Myj6fdrRHYlM5IavuCaVwdRPYz8heaRZmsUx8gFl65XTG/N4Z8/lnewtYkl+TU6B38doysi4DFgUN6l43KYXOAh6pNwnXVRMvz8EN3gs6COeIfNhgneRknw== 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=uJTqhgFmE78NyhyzvCDE+29vlVPvl0KdXNA4D2G9DXQ=; b=p/ekyK28dhZdhmUOuj6B/s+g4Dq4MIFJA+OYOXNHrsu5WMcOQ2furSlnIkNiwlqefvpRIP9+a142BKoUALR4vxYr5fAFZc9BGrYD4tf5bxbGZlt9oNOIL5Ef2DvssV5BhZCywWB6+at2XvuUtOX64RzW/lls3mLX3YXiAZCQBsA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) by AS8PR04MB8564.eurprd04.prod.outlook.com (2603:10a6:20b:423::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 13:04:11 +0000 Received: from AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd]) by AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd%7]) with mapi id 15.20.7587.028; Thu, 16 May 2024 13:04:11 +0000 From: Andrei Istodorescu To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, iulia.tanasescu@nxp.com, Andrei Istodorescu Subject: [PATCH BlueZ v5 5/6] shared/bap: Return the local PAC when matching a BIS Date: Thu, 16 May 2024 16:03:59 +0300 Message-Id: <20240516130400.16713-6-andrei.istodorescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240516130400.16713-1-andrei.istodorescu@nxp.com> References: <20240516130400.16713-1-andrei.istodorescu@nxp.com> X-ClientProxiedBy: AM0PR06CA0079.eurprd06.prod.outlook.com (2603:10a6:208:fa::20) To AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::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: AM9PR04MB8938:EE_|AS8PR04MB8564:EE_ X-MS-Office365-Filtering-Correlation-Id: ef062ecd-6ca1-4a51-6def-08dc75a8adee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|1800799015; X-Microsoft-Antispam-Message-Info: w9HV05dvfc2QmeKNug6L6htRCZ9Hkb7tr/Hcyo6ONmoYMBEUqUggCiTfIbGmhrU2Jp2iCtoigDzAfwdCu1TKS/p8cBxJF4DZzZZwTtWCoLBw+x4EcOULyEP3ZS4haRbVHLhZZ6w8Aze5LmPVcR9T7mlc71knv+MVBG9fgjZojc5WfaJoD5nYNZkCIIV4ZvF7uYwhXkjDl8WDQbg1deXUwaNMZDgIqa09qgr3RJXEr+NXZFhZLKrPgrJJr+GG3B6bllGCl2O6o64cvFJQ/dKlKiWql3iMBlpiqq/b2cyzd7bRQWyPEdaJm9PSIBg3lsgq3eFUTDkcGCsiaOJFC5GFbvkE5Y6KRLpIEUpMHKAb4PD2O+C8RBALt/DW0ZWUax6857YiUgRUaOoYAsluWO+ffUm8gsOkVyugqWK9xJkoFb3K7z4hNTC+l2k0eO5QEqm9jmJ3vUr1rAp9EW6/evgO07p8diKKc4lB/naKFP1deckMAmzrTMlHWlH+7i5N121mwjkxjpK6e2of0f9lxIOqGVkVm3Va2L3xnxTh6spOC7h9NKXWcBkj3aMrLh76LuS7zC/CuVt5KMgn4WA0AwFjkbK7xhrt1lpiJZ16STHK0OhLu9i2Rby7SoUuyDoYd6pU/tE6XYTYsRhB1pb+uSjVPipRjJ/ekYOa1m3ifgO0VKt/M+HPCyOmPCuYS0NI5qpRuN4Fk61nIviemqzcCWj+XuD0EJ9HXY6m7QQ3vD9CF0dWKG3OuqTGEL0AQpntCTiUnPbH+HJmWjlGnKCWFrHdoFIxoZxrUvOiB9q1XQn7S55KPf96LIMTu6wk81MBumDdda+RHI5aA6lLQC6EfX7l8dEGJeJYG6bDZJr8loudgjUgpSQJaACzZBfOtQPzzBOnOXqqKhNj7AcuhFj8tOAje74rouwO7uF2eDHxGBIBJRtiUW/FNC6PtpB+KIydLD3gae/3+1ABL0tEUl5wOFmlbmFF1/wuQzgx/OeebuuIUSde4o+8uenJ9bGmOJqbQWmXClzYMFtUyt5BfxCGKnZmOkd/xjXzPMmyAlNGdLBR4rcZc5/Dkjfr8PTChcH94BHOIqdsgP901uxprPTRPNidqObY47HoAccNWGRQ1jybfgAAYe5xR6vwIf3ltuEalFCvaMhKZ2HILop4zNL/eWp6Q5R1CjZT2WUawMCJYN0nHy+VXI7caMYFjT17X2GwpVNVxfVVV9hNvLoL/W3J/BiYqPjFG/7juvdd4GS0jZuvecvfFACPwK4UJM/M063WSGhHLituwn2uKM7zACid4QUDEA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8938.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: baQGtlw7nW9uSL5BaVnyRNuBhMVjNk5jlqGwI7ADC/EpvQVWSXORV4FFI+BS1zUIXbIHYLTTs1bRZ9uyBFSuoj5LGugkMpNtMzI2HfmuTOveGHnf2D4DGhbJaHHapiMGTkk4KUdj3lBaBxUX/cUbNATkSwviBG3PX/1ri6ngPuskYCQCn9VOddAUIOHzagSOEx1U1uu91zZMdmuvht4fAuTKRAyWxV90qP8JUk2eXlD1QlKICzWFeLfD3e5agKggVqkz9iI5tPIheaJsVW/ckrn4PJqoMrcMif2fpAis0Y7cGrm4sTPdMmqzUbhAw5DiayTozVQmzQ/4WQr76jXDh0m6zwvCu6skNK0vX1YEQH4oUa6bwR2Jl0coulPHRc0eis78s/HjZzRUyHIA7QZ0Z+9Yi62nfcYQGGcjtYU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Xgbh1VlsdWvkjCKOOCeTNWd5LbthzVz1uCDRjjCPOLRmY8LySTIXzxtCUoroVdR3N2xZs0JThbglYShSBkbRnMti97eK1H4CviTiMfKx6MtUh4gtfLQKe16zR3f3PCZw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef062ecd-6ca1-4a51-6def-08dc75a8adee X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 13:04:11.3706 (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: ikn9zl33sbl0w8PczJiCCPsxQXQsGUyKk8Z66yAbymYvuLZutHF/ut3FFnpAYYoF065oxmB++V6E/9yUURq3cNntvc6nqtbDhvchTORo9wc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8564 --- src/shared/bap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 1d1a6b25d1a9..802b8a21da73 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6398,9 +6398,11 @@ static void check_local_pac(void *data, void *user_data) /* We have a match if all selected LTVs have a match */ if ((bis_compare_data.data32 & - CODEC_SPECIFIC_CONFIGURATION_MASK) == - CODEC_SPECIFIC_CONFIGURATION_MASK) + CODEC_SPECIFIC_CONFIGURATION_MASK) == + CODEC_SPECIFIC_CONFIGURATION_MASK) { compare_data->found = true; + compare_data->data = data; + } } } @@ -6482,6 +6484,7 @@ void bt_bap_verify_bis(struct bt_bap *bap, uint8_t bis_index, match_data = bap_check_bis(bap->ldb, merge_data.result); if (match_data.found == true) { *caps = merge_data.result; + *lpac = match_data.data; DBG(bap, "Matching BIS %i", bis_index); } else { util_iov_free(merge_data.result, 1); From patchwork Thu May 16 13:04:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Istodorescu X-Patchwork-Id: 797317 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2056.outbound.protection.outlook.com [40.107.6.56]) (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 D2337146D6B for ; Thu, 16 May 2024 13:04:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864658; cv=fail; b=K+eQRZMnE8r7KTfZIcCwbkCPxmLt0/L/Mc7CJKvo/BzsJn9uslX/Hm7hsEGvFDOwH5nYPq5k+G/h9Y3DMatXmXim2eB9+5TeSlqnwSsPePmYkCCCOHO9U7EbON8uP9sCqSG1d09qy02BaMZGUmOarJqU0sqXDdVbyIckbS11o5c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715864658; c=relaxed/simple; bh=GJsWe5zYbNZgn2eD9C2EleJpaDA4zdi3UFO0/dXaD4E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=S0DSdAxk4BmT7fk6G2CYUr04jHQuvyfS/p7KsEx+cbmDW46u29HtR+EoiNtiHljTkBz+DB5qESjqd+AL3F0nPgG/cmHELIYdlLVNCI3BBTY/eDrwXovxqZggwQ/FZyIBGQ2JrlqVXK25oMfMGbmses+etDO8H4lBuJdm8aeAG3c= 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=XRChifyX; arc=fail smtp.client-ip=40.107.6.56 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="XRChifyX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+o1NI2jnfDkl8D1jdvlzS+L0JAoTEwNaXQgl/0ksCJ+Q+Vn9qnlYMhk3YEPUrkxjr0pcsgfjIjNhO4JiX14C9JTMUMvNmT3pOtYrRTmTSTGnXNwmyNP0AxEj1KDgR+01uhUmpGTLzYqgNcAnZgJDJy4SI3gDm2pDgqMirTem5DKtf6Da7Ki9e6vK++q/PJ9pnPkAn1J2R8dcfcw1Yog4kG7ZtVu2sON/2MzTOqgiP8LF2FdPur7EQLdZvA70bwWC8kAftWv/S46wuIsTBufgPo7tzwARyPLYSclTg5zG5CgtGswZ9eqwIYyJK31O7Nl/9Cz7y4fw2aXqL89QXI8eg== 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=ghzBLmSUYKsUmy3Y71Vnn49p/9OtkBaeHIiD0bisQlE=; b=ExnNxjm1o+v5cgg4Y2eibWOe5V2iorP7tugsRF9PGYLdH4a3phKoAehjrF+S+Sc7O0UG0TqeLVCpSoXmv2H0sjJ9iiF4Off6ey3dEP7ob/8LAUqoyNGKjwsMfsW7pJ6FUXD6w2dRh6vUq/zhiDydQBJlTBfHO7GxIMfnR+93p9B+AOj0Bp26Iaem8EeBA4j0X3YM9JA+ul7v7npsUOguQs59ItPc60RjN88bpA9SpFLYautcnePpZbDn3GJKGewOcTIKTSQZntTHxzOT8ZrtP9GK7jjun8+NARsUDnWLqSjw8evXizMnztZHglduN6gGxfFKGL8SPnn6raMT/MxFwg== 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=ghzBLmSUYKsUmy3Y71Vnn49p/9OtkBaeHIiD0bisQlE=; b=XRChifyXoUPmQu4mopCT65J/BNjluSAJHKXP3X0Lgiaq3mxGwOiOU0v0mUrpx/Ia8bKBkGtXAs4SX4JQTsw+DFlYlXULbTE2C33xhp2xKdB2zLS9+00GBRr/mBAbAm/SrwIR3Z12KyzJcAupZg++IFGbeWEG+uR8S7vxfBCLmCo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::20) by DB9PR04MB9332.eurprd04.prod.outlook.com (2603:10a6:10:36c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 13:04:12 +0000 Received: from AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd]) by AM9PR04MB8938.eurprd04.prod.outlook.com ([fe80::b7d3:ac7a:a87b:5fbd%7]) with mapi id 15.20.7587.028; Thu, 16 May 2024 13:04:12 +0000 From: Andrei Istodorescu To: linux-bluetooth@vger.kernel.org Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, iulia.tanasescu@nxp.com, Andrei Istodorescu Subject: [PATCH BlueZ v5 6/6] shared/bap: Add stream ops for get_location, get_dir and get_state Date: Thu, 16 May 2024 16:04:00 +0300 Message-Id: <20240516130400.16713-7-andrei.istodorescu@nxp.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240516130400.16713-1-andrei.istodorescu@nxp.com> References: <20240516130400.16713-1-andrei.istodorescu@nxp.com> X-ClientProxiedBy: AM0PR04CA0007.eurprd04.prod.outlook.com (2603:10a6:208:122::20) To AM9PR04MB8938.eurprd04.prod.outlook.com (2603:10a6:20b:409::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: AM9PR04MB8938:EE_|DB9PR04MB9332:EE_ X-MS-Office365-Filtering-Correlation-Id: 317eb268-d049-494f-103d-08dc75a8aec7 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: xNqpDnpIAUE0u+AoYjwac1nAUtLU+qrsTbGGWCgCt/GoaDV+NTbcJRxa+TmC31BcSXSCk4m6oZCGCaJWhm7YFCuWxgmsR9q2pqI4Lc57ht6JaVHtalGbjZoj4j9lf876+43V42bvZd5UtBjrRzxk5yWh+iuYqaZ8RP1tw0DgEAm9r075wjhJs2Wvpz8hc1hqQiDl1/41s7DKA9Gi3AB7Iv36IV8K/YiRImZf7r/olnCR0Rdt/40rKvIB86ffA4C2mOYrdSoFLDBdF2jrvy0CBNNRI9yp0o42YzSQIrJsyjHFSYL2JVs6sHE6Nvei4JOnV9dGWawQAJ0+XwWYSTlwwiktIhWaR5ljwEBMeU2Ni8R4vGddtwRUos8H5qBrV7ETGEqwYVaKlwSbHmlI2OthloQEAn5UO0gPD0sPZINvo+w7pOK46C5oPNlQRqlYBhjRywNOO3XUGXrw14KG/Q9W3Q8269MZRI91mdygoYYiz1wg7tXVlnL/ozKgxSvg80P1Hr1AAtVgwYUhPJdUdUdtp4O5lR25D5NSg5h7xmQslzuxchGq1otmfmmqIHtjUHK1I/DC8mQ9fQtsqjRmnEz3vnnH6Sax6PTMrxH7iwRvOLdsxI27vH5oa9zs3k63ifwgpioGkg1hsaoI2QGpktL+uh/39aBRJ0kF2LKa9nvQ3W3wYwT+2zIn83U5zAhKxvAVYxUagGoKcmAyRbA1qvRgg1/JKiI78InC7fDaTXczTnpOZWVxSmWahYrjEb1IGr8ltqgF/KHuPUPSCZnzBI/TFaFQHEU+P9gOiXlVyy4jQcr9HLCpLwS/ZaOsOoUUqN/J1V8PPh98AqIprxtFCuTc5aCMEs7BkM8E2323pFTj8Xx+3kledMsytDIUOpLmgCSgitGTtE9d0Yf7y96kB7NtHIZuzGNITeu/SgN9oOralxSQgBNGQ/NYiask+kChfoRzYUkQBpKTFAu60BCGEfZ/Dw8P2E8usCCQHxHzelDek9cQe8iQR4tJ6MXgjod2C3OlCk14ReM7VIqtqh7iLC62QPx6jGaHm4ue/6IqRcG7gsxAQNi+PIbMc7LGJmMfk7f15UN3869pDW8MQWPEhKJqGw3FuBBFvhSiPqiaH5puhKQBM/jnghwcujm3+H27ghCxB/vmUOXriwo9iJceMhJ8qjaEG++6M8kbb6mXkSwPtJuxO14Gw2WJ4bVRGHeB/Zmipqpm+Z2ULf20olP8VISvkml0QA140Vhqi2SxnUWQvzrz9SLt3Zd6+Z3RQfsA1OqMfnRyOUH0MjsY5kdfRzDhXw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8938.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: LhOimFqxdUfyEtwbHNCmiV7lp00T7gajOLPqYbtb+Ix52NjuZY5zbr819xt46PbsYtbeft/l81gEz+KEs8rkjW+TD0mrBhse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f+hGOUBD6X93opsdm3yvDoStrVd+EZc/kNTMPUEFr6aoGFwVbfIlQR/6qdpTHrDr2UC7WNyXlP45HQVBcF1+uXypnnrLM8jLzkkwSPzdN7d2r7LXp4V/yutiU0t8rces6xKDwnEaeO9s68VJKOogPKRoPtsncJFlToMrzPRAPenaBuo//p+x3RQWhwslIQAnbdMWq2u5M65pzR4RmwPy36eKIvTAzZoG5gknVoXrdjztQ1Jvq4zsuzrh5AkD7vB5GFgPQukZf+axEkSVTcOuDznnvo8/E97wUZGJ8hv8Ugs0eebxzGl0U/+q1ueYoXE9ktPH3dIJnNk5a4xXqfPTyzzbvfZFrms1YxvzyiA0pnJUIBls+s4Ijn1wSmBXn+wzSrO6S5FcGT5eUoil2/pEU1KZu5u1JqJE1bx/WDfCakq+bcxE7ZQg4WZ6NQ1b43TtA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 317eb268-d049-494f-103d-08dc75a8aec7 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8938.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 13:04:12.7979 (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: dUzrSyqVr8ciO8gANuWrg5YiMeLN672fx5Q3bZ4f4cCBbTqtzUwcUVtHXs0YcPj2s9PTB388Dvh2T9TtXELUV9hLuqP6ekftl7p7ugImAr8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9332 --- src/shared/bap.c | 159 +++++++++++++++++++++++++++++++---------------- 1 file changed, 107 insertions(+), 52 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 802b8a21da73..fe91cd67f491 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -226,6 +226,7 @@ struct bt_bap_stream_io { struct bt_bap_stream_ops { uint8_t type; void (*set_state)(struct bt_bap_stream *stream, uint8_t state); + unsigned int (*get_state)(struct bt_bap_stream *stream); unsigned int (*config)(struct bt_bap_stream *stream, struct bt_bap_qos *qos, struct iovec *data, bt_bap_stream_func_t func, void *user_data); @@ -245,6 +246,8 @@ struct bt_bap_stream_ops { unsigned int (*metadata)(struct bt_bap_stream *stream, struct iovec *data, bt_bap_stream_func_t func, void *user_data); + unsigned int (*get_dir)(struct bt_bap_stream *stream); + unsigned int (*get_loc)(struct bt_bap_stream *stream); unsigned int (*release)(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data); }; @@ -1578,6 +1581,11 @@ done: bap_stream_state_changed(stream); } +static unsigned int bap_ucast_get_state(struct bt_bap_stream *stream) +{ + return stream->ep->state; +} + static unsigned int bap_ucast_config(struct bt_bap_stream *stream, struct bt_bap_qos *qos, struct iovec *data, @@ -1923,6 +1931,27 @@ static bool bap_stream_valid(struct bt_bap_stream *stream) return queue_find(stream->bap->streams, NULL, stream); } +static unsigned int bap_ucast_get_dir(struct bt_bap_stream *stream) +{ + return stream->ep->dir; +} + +static unsigned int bap_ucast_get_location(struct bt_bap_stream *stream) +{ + struct bt_pacs *pacs; + + if (!stream) + return 0x00000000; + + pacs = stream->client ? stream->bap->rdb->pacs : stream->bap->ldb->pacs; + + if (stream->ep->dir == BT_BAP_SOURCE) + return pacs->source_loc_value; + else if (stream->ep->dir == BT_BAP_SINK) + return pacs->sink_loc_value; + return 0x00000000; +} + static unsigned int bap_ucast_release(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data) @@ -2000,6 +2029,11 @@ static void bap_bcast_set_state(struct bt_bap_stream *stream, uint8_t state) } } +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, bool enable_links, struct iovec *data, bt_bap_stream_func_t func, @@ -2019,6 +2053,17 @@ static unsigned int bap_bcast_start(struct bt_bap_stream *stream, return 1; } +static unsigned int bap_bcast_sink_disable(struct bt_bap_stream *stream, + bool disable_links, + bt_bap_stream_func_t func, + void *user_data) +{ + bap_stream_io_detach(stream); + stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG); + + return 1; +} + static unsigned int bap_bcast_disable(struct bt_bap_stream *stream, bool disable_links, bt_bap_stream_func_t func, @@ -2040,6 +2085,43 @@ static unsigned int bap_bcast_metadata(struct bt_bap_stream *stream, return 1; } +static unsigned int bap_bcast_src_get_dir(struct bt_bap_stream *stream) +{ + return BT_BAP_BCAST_SINK; +} + +static unsigned int bap_bcast_sink_get_dir(struct bt_bap_stream *stream) +{ + return BT_BAP_BCAST_SOURCE; +} + +static void bap_sink_get_allocation(size_t i, uint8_t l, uint8_t t, + uint8_t *v, void *user_data) +{ + uint32_t location32; + + if (!v) + return; + + memcpy(&location32, v, l); + *((uint32_t *)user_data) = le32_to_cpu(location32); +} + +static unsigned int bap_bcast_get_location(struct bt_bap_stream *stream) +{ + uint8_t type = BAP_CHANNEL_ALLOCATION_LTV_TYPE; + uint32_t allocation = 0; + struct iovec *caps; + + caps = bt_bap_stream_get_config(stream); + + /* Get stream allocation from capabilities */ + util_ltv_foreach(caps->iov_base, caps->iov_len, &type, + bap_sink_get_allocation, &allocation); + + return allocation; +} + static unsigned int bap_bcast_release(struct bt_bap_stream *stream, bt_bap_stream_func_t func, void *user_data) @@ -2049,11 +2131,12 @@ static unsigned int bap_bcast_release(struct bt_bap_stream *stream, return 1; } -#define STREAM_OPS(_type, _set_state, _config, _qos, _enable, _start, \ - _disable, _stop, _metadata, _release) \ +#define STREAM_OPS(_type, _set_state, _get_state, _config, _qos, _enable, \ + _start, _disable, _stop, _metadata, _get_dir, _get_loc, _release) \ { \ .type = _type, \ .set_state = _set_state, \ + .get_state = _get_state, \ .config = _config, \ .qos = _qos, \ .enable = _enable, \ @@ -2061,26 +2144,40 @@ static unsigned int bap_bcast_release(struct bt_bap_stream *stream, .disable = _disable, \ .stop = _stop, \ .metadata = _metadata, \ + .get_dir = _get_dir,\ + .get_loc = _get_loc, \ .release = _release, \ } static const struct bt_bap_stream_ops stream_ops[] = { STREAM_OPS(BT_BAP_SINK, bap_ucast_set_state, + bap_ucast_get_state, bap_ucast_config, bap_ucast_qos, bap_ucast_enable, bap_ucast_start, bap_ucast_disable, bap_ucast_stop, - bap_ucast_metadata, bap_ucast_release), + bap_ucast_metadata, bap_ucast_get_dir, + bap_ucast_get_location, + bap_ucast_release), STREAM_OPS(BT_BAP_SOURCE, bap_ucast_set_state, + bap_ucast_get_state, bap_ucast_config, bap_ucast_qos, bap_ucast_enable, bap_ucast_start, bap_ucast_disable, bap_ucast_stop, - bap_ucast_metadata, bap_ucast_release), + bap_ucast_metadata, bap_ucast_get_dir, + bap_ucast_get_location, + bap_ucast_release), 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_disable, NULL, - bap_bcast_metadata, bap_bcast_release), + bap_bcast_start, bap_bcast_sink_disable, NULL, + bap_bcast_metadata, bap_bcast_sink_get_dir, + bap_bcast_get_location, + bap_bcast_release), STREAM_OPS(BT_BAP_BCAST_SOURCE, bap_bcast_set_state, + bap_bcast_get_state, bap_bcast_config, NULL, bap_bcast_enable, bap_bcast_start, bap_bcast_disable, NULL, - bap_bcast_metadata, bap_bcast_release), + bap_bcast_metadata, bap_bcast_src_get_dir, + bap_bcast_get_location, + bap_bcast_release), }; static const struct bt_bap_stream_ops * @@ -5380,11 +5477,7 @@ uint8_t bt_bap_stream_get_state(struct bt_bap_stream *stream) if (!stream) return BT_BAP_STREAM_STATE_IDLE; - if (stream->lpac->type != BT_BAP_BCAST_SOURCE && - stream->lpac->type != BT_BAP_BCAST_SINK) - return stream->ep->state; - else - return stream->state; + return stream->ops->get_state(stream); } bool bt_bap_stream_set_user_data(struct bt_bap_stream *stream, void *user_data) @@ -5568,53 +5661,15 @@ uint8_t bt_bap_stream_get_dir(struct bt_bap_stream *stream) if (!stream) return 0x00; - if (stream->ep) - return stream->ep->dir; - - if (bt_bap_pac_get_type(stream->lpac) == BT_BAP_BCAST_SINK) - return BT_BAP_BCAST_SOURCE; - else - return BT_BAP_BCAST_SINK; -} - -static void bap_sink_get_allocation(size_t i, uint8_t l, uint8_t t, - uint8_t *v, void *user_data) -{ - uint32_t location32; - - if (!v) - return; - - memcpy(&location32, v, l); - *((uint32_t *)user_data) = le32_to_cpu(location32); + return stream->ops->get_dir(stream); } uint32_t bt_bap_stream_get_location(struct bt_bap_stream *stream) { - struct bt_pacs *pacs; - uint8_t type = BAP_CHANNEL_ALLOCATION_LTV_TYPE; - uint32_t allocation = 0; - struct iovec *caps; - if (!stream) return 0x00000000; - pacs = stream->client ? stream->bap->rdb->pacs : stream->bap->ldb->pacs; - - if (stream->ep) { - if (stream->ep->dir == BT_BAP_SOURCE) - return pacs->source_loc_value; - else if (stream->ep->dir == BT_BAP_SINK) - return pacs->sink_loc_value; - } - - caps = bt_bap_stream_get_config(stream); - - /* Get stream allocation from capabilities */ - util_ltv_foreach(caps->iov_base, caps->iov_len, &type, - bap_sink_get_allocation, &allocation); - - return allocation; + return stream->ops->get_loc(stream); } struct iovec *bt_bap_stream_get_config(struct bt_bap_stream *stream)