From patchwork Fri Nov 1 11:51:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13859276 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.79]) (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 E2B8119B3E3 for ; Fri, 1 Nov 2024 11:51:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461908; cv=fail; b=CGT7uLpBrLWIcuA2NKMCYWCIwRG2/1DQPDciAejlu3X+KG3xBPdW1P4gkDtiBfEo/+6mqKVIBZxn6azxCZSPrvCvUzRkt/laGnTdNkZMj6c5jYFxkWaTkR2PyU9DUtyYUzHC1XAW2eR4qadUgap7EymvmlOaisQiBLzi82ceysQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461908; c=relaxed/simple; bh=PTmDwFE3ICceuHkmBYO56NuKGvRblDl5n9Dqf3xT72c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ojgwi6x4qsAk5vTaOKj6B7wDM3Y+EYbWyBR1zD/77q13UnX95PEGWbimPlDHgodWkVLGnoWg9tfhM3Vd/FYwjI/f2UuEyOVC8mwStUB+mH6MR4TnqAdifYnupZHfKzmg2y62CftMHF7LNRzu5qar8vBt/5OVFSEbaVbTBkbM7DI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=VVjukn3A; arc=fail smtp.client-ip=40.107.105.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="VVjukn3A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZmIcwYz1qo46COBkYmSVwAl1KWi9mmSU80xXcCxetOnEH9DE+NyAf6c341Q421RTVc+c0FRBJ9LCaE5/tdJuxEqzAtbxM8IAtoe6NvBI6DEVyW0kBciE9VhV/hHCY9VHoXxkefwYQZL3Iu//libXOidVYs8+2RgI7ahIRy6VwxcXdPrBM2ULPVO7Jtzpdhx/6IcWROv4KQwudD5bwtT8fVVBDq+Z9YqmfMKNB9sAPjrxLBq6CRCPbVj4IQ2Aq0Cq6rij3gTub0cz3GV5e6rWnzRFh2NniTdOZggazNEWHCOzyOx4VE77bQuFhghbwoAaeTMGGs2l0Y9g7vHfFPPsyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sm3IAImrKBksr+dVb83BH9sw7i6XR44SLhq615ongeA=; b=n/kJLfus2vO6uhitS2kpPjEqmsFHphBGhIuQaEgpsq+lV0mpsK8bToWF0+wfTb9uHkvXmgV4VBKKjsd2EYH1mrXbJj6I92ywc0aM0ZzMqG93wnh6U1K6NdWRL5arhleOgzKWuISbyVtWY9H/N/Y0XikFva/MClNpJAKiDfLQFzShUSTpmaOK/9jvZQ3J/AdQrJ1SHsOcar3XYksyeF8A4WclZWYtt1RaqNuPtFvzKJWjHI8eQ2MXUpousJNx5Kc/Um4G9N+9RMjRRcb7235WS1yd1JjsvTpNz1XIyrLZ4oAc4TPPw/CcyuiVn9dE0sn0iV/yyDIVpl+vGM6RMsqgjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sm3IAImrKBksr+dVb83BH9sw7i6XR44SLhq615ongeA=; b=VVjukn3AVGQbgosKgZGtmSL8U6sRrpcrtvPTOxCKO2Javr6ADjGEnpagJYEEOuR+qh5V4w//tHdD/8LRXictfrbQUBvTWrJzN+p9v7Ig5UU8tNlcQyO4oAQxH1pahxjfU3wxguC4ppAB5sSwvs3FW/NDbxWhK4oeZtPcgsV7C254FQ185W9bqj/AfH9yW5vBsOAGKDHhPuGRTOXmDP5ncb6ZmKqrK4swH7Miq5Ip/bumBR7RsgZ2Wm9MoZeMyMRLb/YIfy5mKWFu/Rf5AowxYJomjFPmCfJolkCgWK/tL/veNiIj62nLc/Pgf//+gQJi0CSw6j5kvTDI6JbMSjL4pQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM0PR04MB6979.eurprd04.prod.outlook.com (2603:10a6:208:18b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 11:51:42 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:51:42 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ v2 1/5] btdev: Add support for syncing to multiple PA trains Date: Fri, 1 Nov 2024 13:51:14 +0200 Message-ID: <20241101115118.43891-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101115118.43891-1-iulia.tanasescu@nxp.com> References: <20241101115118.43891-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR01CA0089.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::30) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM0PR04MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: 148ec311-bdfc-4c46-c8ec-08dcfa6b8d9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: NaE+BjH95xGlbKKmy9Zfr5sZH3sB+OdHL9+M1YOB8UZ0tf/YZJevofK33AYAmDqXVqjYcm0JtNNWzemQ9mb62qUH3ICQ6dElG9o9pCrzEiZs4qofCyIUvJncMn8eIbWJ/VkwGFdmMq0D76LcGJf5sKrmuyxFwHtAiBl6z19nQlD5sKW4epdww+nAeI2k3R5EhbJ03r/Pu8ELlPz3tgSf2vr0Gu6dhFbYKVOSWOdkOYeeO3jBwH1S6HOrMw4mmmLMl9yMH6Ns1MoPRvZCOIPvOuyMG3mIeXgf4AsRdyi6e3moTJwZrDbn/hXlGpmgw+6FUCXG9509qG2fdy4V1WNhtma+IfpiuTQETdvodeay3eWLf9dhpUaU6hTfxR7E5qtaqPWdYPZv8ovoIKyAQMvQS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PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T9fkCDEh4TkOPuF4O/3Jz0raJKkliCpiHFOuEeYaoFirJn9qbOwOj3St7wFIyJT+PhkyQ2/w56EZSTAw39QKTeAQoyafnnHP6nHAw1SIIEexUAN6ETCYpOJccvNlbJf2zIug9oqcadbfsusmYV9Tt6A0BMOW6jYe073Ld5oXMZCmSxox8eX6bSIVAIq5wY3BV1tPCyBdCGuromVfmYGWSlIvd8ZcvXwLlKg3Mp7OAJvaElkVaqK3cRinUNjbY1JYM8vdO9ZFX3HeN4F/Xi3+Tr8WHm10PSlg7dOdnJEqB73MV2xgARai5CHvZkluf1wjzM5o7eyyvgcJQQWtCjWZFaJ1CVsowcguzAAoL2C9I4up/zy0vbg9c0jr4KUtrxqibi7bx4aXyVfFqd/oW3TPzTks1xr9MeNxuvafK4C4GsKNg22+XgyMTwPQ8DmNvvrDeSpLj8qtlTSM6uOrw73rv5gneCy1ESJyTArI5AKFRBiWXC9yuyw/SQoMd0friwHFRpyL/O/kVkUzeDIzrnBG3Wvkh9WcCA40eDfbW+z37wYOycofLTYTLltmsI1B7cxq6cKYA3rQGR59/964HURmJlFsuZI9NJGwZS9PASgJg1No2FfyvN9WHONSLQ69btrN4JE2nD//iqGsHz7g8l8W6nrsOIPG7d6CvTMpwBa+ZmOg2UhbQZ87i7zzb0w1RfKmI68GlAY20ezn+3jft5QU7am73eVQZrR5uYcL6PyQIuJjhMKRz/XTMJNFT2658aeOgjXjgbG03Mny8nNAaypSNfPWVwxXyFdRkep3nXwTtB0djA/vEMXsjQBTBocKacyBQRvoT8mOSJnERUzGRXvNvUlny7EVZR2EoY2cdqEI6mdGvIQSI9Sn3XszUwFdiKWOaqCm3+TKqGhxgrex95CjuAFztnKLVHqnG14C+NIJBqoKNwDYoI2qzEV3nWFTNySNt67l88sAmI7NSKTru7F8uS5mkR3kRuzsP8yCFY4wa2Zy3UE5vSYmSEHPkMlZjOChN4LhGN4Vr6w4cIgcyFTz41GqU0wDAHjHmwFw6el5wx/fVm5MJMtjrzfl9vrQR5IIVx6FzQyHegsv7Vkxr061nTHVZYfVLRa5UaTqkKycKmHuX/X0K/6Qt29X9PHLZx5UXRaYraOPBt2gETCQMJ4fWbBNqXLOEAzfR+YwIEqaWSClHrEBWeKrCgUpABmykH4eN/gtmTetNfIuqQnuRGD8ZUkUW59XuSs5Zg3AEWstARpmUpJCyEssxKLXFJJt+U2JF/4NTi1LzJhvL/Dk//PkFgt9sE7w9qaOD8SxGqvpvKRjdCqm9hpj7q1DDtPMFH5Kel05xqDew4Jk2hue6mp0aA1nicFAhicxbXhTnbuuStW9xqTXiMTZOn2SdbDj2P30VmjFEAQkDXFLBwMSFi8sHTVxGvL5lPk431N3UlEmYbji+j10L0fE30pVKfCt1drHDrO9VzoeZIt0BBNl42gyoYyxh9NW7xj32Jpkwur8F2qgl8UUgKv0wbDzG/D365bSKbEiNNI5mEzrw/NYga5UeI0dJC20miSu86CsuHgH5DLBi0u29E2T8ZzXI3aSzAo+e6Rpn/Fr+PFNAdwSAuregA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 148ec311-bdfc-4c46-c8ec-08dcfa6b8d9b X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:51:42.6157 (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: hXJR4bwkYc5A2p9fSfPrV7/yFKLhsj1DmBrE6tIRjKepScTVzBspAFMWr6UMqj19OQPEK0k+EtRoN4zTCM0reA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6979 This adds support for synchronizing to multiple PA trains. --- emulator/btdev.c | 145 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 111 insertions(+), 34 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index 5752a2fb0..ca70ad076 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -52,7 +52,7 @@ #define ACL_HANDLE 42 #define ISO_HANDLE 257 #define SCO_HANDLE 257 -#define SYC_HANDLE 1 +#define SYNC_HANDLE 1 #define INV_HANDLE 0xffff struct hook { @@ -105,6 +105,13 @@ struct le_ext_adv { unsigned int id; }; +struct le_per_adv { + struct btdev *dev; + uint8_t addr_type; + uint8_t addr[6]; + uint16_t sync_handle; +}; + struct le_cig { struct bt_hci_cmd_le_set_cig_params params; struct bt_hci_cis_params cis[CIS_SIZE]; @@ -212,8 +219,6 @@ struct btdev { uint16_t le_pa_max_interval; uint8_t le_pa_data_len; uint8_t le_pa_data[MAX_PA_DATA_LEN]; - struct bt_hci_cmd_le_pa_create_sync pa_sync_cmd; - uint16_t le_pa_sync_handle; uint8_t big_handle; uint8_t le_ltk[16]; struct le_cig le_cig[CIG_SIZE]; @@ -239,6 +244,7 @@ struct btdev { uint16_t le_ext_adv_type; struct queue *le_ext_adv; + struct queue *le_per_adv; btdev_debug_func_t debug_callback; btdev_destroy_func_t debug_destroy; @@ -578,7 +584,6 @@ static void btdev_reset(struct btdev *btdev) btdev->le_scan_enable = 0x00; btdev->le_adv_enable = 0x00; btdev->le_pa_enable = 0x00; - btdev->le_pa_sync_handle = 0x0000; btdev->big_handle = 0xff; al_clear(btdev); @@ -589,6 +594,7 @@ static void btdev_reset(struct btdev *btdev) queue_remove_all(btdev->conns, NULL, NULL, conn_remove); queue_remove_all(btdev->le_ext_adv, NULL, NULL, le_ext_adv_free); + queue_remove_all(btdev->le_per_adv, NULL, NULL, free); } static int cmd_reset(struct btdev *dev, const void *data, uint8_t len) @@ -5246,7 +5252,8 @@ static int cmd_set_pa_data(struct btdev *dev, const void *data, return 0; } -static void send_biginfo(struct btdev *dev, const struct btdev *remote) +static void send_biginfo(struct btdev *dev, const struct btdev *remote, + uint16_t sync_handle) { struct bt_hci_evt_le_big_info_adv_report ev; const struct btdev_conn *conn; @@ -5259,7 +5266,7 @@ static void send_biginfo(struct btdev *dev, const struct btdev *remote) bis = conn->data; memset(&ev, 0, sizeof(ev)); - ev.sync_handle = cpu_to_le16(dev->le_pa_sync_handle); + ev.sync_handle = cpu_to_le16(sync_handle); ev.num_bis = 1; while (find_bis_index(remote, ev.num_bis)) @@ -5281,7 +5288,7 @@ static void send_biginfo(struct btdev *dev, const struct btdev *remote) } static void send_pa(struct btdev *dev, const struct btdev *remote, - uint8_t offset) + uint8_t offset, uint16_t sync_handle) { struct __packed { struct bt_hci_le_pa_report ev; @@ -5289,7 +5296,7 @@ static void send_pa(struct btdev *dev, const struct btdev *remote, } pdu; memset(&pdu.ev, 0, sizeof(pdu.ev)); - pdu.ev.handle = cpu_to_le16(dev->le_pa_sync_handle); + pdu.ev.handle = cpu_to_le16(sync_handle); pdu.ev.tx_power = 127; pdu.ev.rssi = 127; pdu.ev.cte_type = 0x0ff; @@ -5309,41 +5316,67 @@ static void send_pa(struct btdev *dev, const struct btdev *remote, if (pdu.ev.data_status == 0x01) { offset += pdu.ev.data_len; - send_pa(dev, remote, offset); + send_pa(dev, remote, offset, sync_handle); return; } - send_biginfo(dev, remote); + send_biginfo(dev, remote, sync_handle); +} + +static bool match_sync_handle(const void *data, const void *match_data) +{ + const struct le_per_adv *per_adv = data; + uint16_t sync_handle = PTR_TO_UINT(match_data); + + return per_adv->sync_handle == sync_handle; +} + +static bool match_dev(const void *data, const void *match_data) +{ + const struct le_per_adv *per_adv = data; + const struct btdev *dev = match_data; + + return dev == find_btdev_by_bdaddr_type(per_adv->addr, + per_adv->addr_type); } static void le_pa_sync_estabilished(struct btdev *dev, struct btdev *remote, uint8_t status) { struct bt_hci_evt_le_per_sync_established ev; - struct bt_hci_cmd_le_pa_create_sync *cmd = &dev->pa_sync_cmd; + struct le_per_adv *per_adv; + uint16_t sync_handle = SYNC_HANDLE; + + per_adv = queue_find(dev->le_per_adv, match_dev, remote); + if (!per_adv) + return; memset(&ev, 0, sizeof(ev)); ev.status = status; if (status) { - memset(&dev->pa_sync_cmd, 0, sizeof(dev->pa_sync_cmd)); - dev->le_pa_sync_handle = 0x0000; + queue_remove(dev->le_per_adv, per_adv); + free(per_adv); le_meta_event(dev, BT_HCI_EVT_LE_PA_SYNC_ESTABLISHED, &ev, sizeof(ev)); return; } - dev->le_pa_sync_handle = SYC_HANDLE; + while (queue_find(dev->le_per_adv, match_sync_handle, + UINT_TO_PTR(sync_handle))) + sync_handle++; - ev.handle = cpu_to_le16(dev->le_pa_sync_handle); - ev.addr_type = cmd->addr_type; - memcpy(ev.addr, cmd->addr, sizeof(ev.addr)); + per_adv->sync_handle = sync_handle; + + ev.handle = cpu_to_le16(per_adv->sync_handle); + ev.addr_type = per_adv->addr_type; + memcpy(ev.addr, per_adv->addr, sizeof(ev.addr)); ev.phy = 0x01; ev.interval = remote->le_pa_min_interval; ev.clock_accuracy = 0x07; le_meta_event(dev, BT_HCI_EVT_LE_PA_SYNC_ESTABLISHED, &ev, sizeof(ev)); - send_pa(dev, remote, 0); + send_pa(dev, remote, 0, per_adv->sync_handle); } static int cmd_set_pa_enable(struct btdev *dev, const void *data, uint8_t len) @@ -5369,7 +5402,8 @@ static int cmd_set_pa_enable(struct btdev *dev, const void *data, uint8_t len) continue; if (remote->le_scan_enable && - remote->le_pa_sync_handle == INV_HANDLE) + queue_find(remote->le_per_adv, match_sync_handle, + UINT_TO_PTR(INV_HANDLE))) le_pa_sync_estabilished(remote, dev, BT_HCI_ERR_SUCCESS); } @@ -5477,11 +5511,14 @@ static void scan_ext_adv(struct btdev *dev, struct btdev *remote) static void scan_pa(struct btdev *dev, struct btdev *remote) { - if (dev->le_pa_sync_handle != INV_HANDLE || !remote->le_pa_enable) + struct le_per_adv *per_adv = queue_find(dev->le_per_adv, + match_sync_handle, UINT_TO_PTR(INV_HANDLE)); + + if (!per_adv || !remote->le_pa_enable) return; - if (remote != find_btdev_by_bdaddr_type(dev->pa_sync_cmd.addr, - dev->pa_sync_cmd.addr_type)) + if (remote != find_btdev_by_bdaddr_type(per_adv->addr, + per_adv->addr_type)) return; le_pa_sync_estabilished(dev, remote, BT_HCI_ERR_SUCCESS); @@ -5622,16 +5659,37 @@ static int cmd_ext_create_conn_complete(struct btdev *dev, const void *data, return 0; } +static struct le_per_adv *le_per_adv_new(struct btdev *btdev, + uint8_t addr_type, const uint8_t *addr) +{ + struct le_per_adv *per_adv; + + per_adv = new0(struct le_per_adv, 1); + + per_adv->dev = btdev; + per_adv->addr_type = addr_type; + memcpy(per_adv->addr, addr, 6); + per_adv->sync_handle = INV_HANDLE; + + /* Add to queue */ + if (!queue_push_tail(btdev->le_per_adv, per_adv)) { + free(per_adv); + return NULL; + } + + return per_adv; +} + static int cmd_pa_create_sync(struct btdev *dev, const void *data, uint8_t len) { + const struct bt_hci_cmd_le_pa_create_sync *cmd = data; uint8_t status = BT_HCI_ERR_SUCCESS; + struct le_per_adv *per_adv; - if (dev->le_pa_sync_handle) + /* Create new train */ + per_adv = le_per_adv_new(dev, cmd->addr_type, cmd->addr); + if (!per_adv) status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; - else { - dev->le_pa_sync_handle = INV_HANDLE; - memcpy(&dev->pa_sync_cmd, data, len); - } cmd_status(dev, status, BT_HCI_CMD_LE_PA_CREATE_SYNC); @@ -5671,7 +5729,8 @@ static int cmd_pa_create_sync_cancel(struct btdev *dev, const void *data, * HCI_LE_Periodic_Advertising_Create_Sync command is pending, the * Controller shall return the error code Command Disallowed (0x0C). */ - if (dev->le_pa_sync_handle != INV_HANDLE) + if (!queue_find(dev->le_per_adv, match_sync_handle, + UINT_TO_PTR(INV_HANDLE))) status = BT_HCI_ERR_COMMAND_DISALLOWED; cmd_complete(dev, BT_HCI_CMD_LE_PA_CREATE_SYNC_CANCEL, @@ -5690,16 +5749,24 @@ static int cmd_pa_create_sync_cancel(struct btdev *dev, const void *data, static int cmd_pa_term_sync(struct btdev *dev, const void *data, uint8_t len) { + const struct bt_hci_cmd_le_pa_term_sync *cmd = data; + struct le_per_adv *per_adv; + uint16_t sync_handle = le16_to_cpu(cmd->sync_handle); uint8_t status = BT_HCI_ERR_SUCCESS; + per_adv = queue_find(dev->le_per_adv, match_sync_handle, + UINT_TO_PTR(sync_handle)); + /* If the periodic advertising train corresponding to the Sync_Handle * parameter does not exist, then the Controller shall return the error * code Unknown Advertising Identifier (0x42). */ - if (dev->le_pa_sync_handle != SYC_HANDLE) + if (!per_adv) { status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; - else - dev->le_pa_sync_handle = 0x0000; + } else { + queue_remove(dev->le_per_adv, per_adv); + free(per_adv); + } cmd_complete(dev, BT_HCI_CMD_LE_PA_TERM_SYNC, &status, sizeof(status)); @@ -6359,11 +6426,13 @@ static int cmd_big_create_sync(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_big_create_sync *cmd = data; uint8_t status = BT_HCI_ERR_SUCCESS; + uint16_t sync_handle = le16_to_cpu(cmd->sync_handle); /* If the Sync_Handle does not exist, the Controller shall return the * error code Unknown Advertising Identifier (0x42). */ - if (dev->le_pa_sync_handle != le16_to_cpu(cmd->sync_handle)) { + if (!queue_find(dev->le_per_adv, match_sync_handle, + UINT_TO_PTR(sync_handle))) { status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; goto done; } @@ -6402,9 +6471,15 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, struct btdev_conn *conn = NULL; struct bt_hci_bis *bis; int i; + uint16_t sync_handle = le16_to_cpu(cmd->sync_handle); + struct le_per_adv *per_adv = queue_find(dev->le_per_adv, + match_sync_handle, UINT_TO_PTR(sync_handle)); + + if (!per_adv) + return 0; - remote = find_btdev_by_bdaddr_type(dev->pa_sync_cmd.addr, - dev->pa_sync_cmd.addr_type); + remote = find_btdev_by_bdaddr_type(per_adv->addr, + per_adv->addr_type); if (!remote) return 0; @@ -7200,6 +7275,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) btdev->conns = queue_new(); btdev->le_ext_adv = queue_new(); + btdev->le_per_adv = queue_new(); btdev->le_al_len = AL_SIZE; btdev->le_rl_len = RL_SIZE; @@ -7219,6 +7295,7 @@ void btdev_destroy(struct btdev *btdev) queue_destroy(btdev->conns, conn_remove); queue_destroy(btdev->le_ext_adv, le_ext_adv_free); + queue_destroy(btdev->le_per_adv, free); free(btdev); } From patchwork Fri Nov 1 11:51:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13859277 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.79]) (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 1A7931990A8 for ; Fri, 1 Nov 2024 11:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461911; cv=fail; b=Z4xxlzbmRMAs4hk6qGYf4D09/j8L5EYiTyzUBWexfWJVEFDJYGDsmvIa9ry3vCW9I8mQycqoZXxEm/2stIJ9evho+Fxi9RCzplfI7NpH3wxbjSx+sU0Eg26dosNRKBtmG9tR3jFM0VaiCS+l3k7Lpw/l8qbbKwO7d2tvaeedOXQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461911; c=relaxed/simple; bh=/PGFYvps+2gvh43o5CvWezdr90tWsEFQbiI43TUUdBk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=P0Oz9CmINKHSzWMETmJn9cIbTcwDm11pIDZOTKABj8rvQoW/8SAIBVRZ0ticiIhUyIzAlkrZ13T8m/hPWLdG45Nu/kRkiPq5TVc8Z7+hTwZE/zmU5Vm0WJ4ATp8JlWNKIeppRZBc9+RWknjbtIMXCcGXJHiRFAEDtDggmYJW5qo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ds0U6MRv; arc=fail smtp.client-ip=40.107.105.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ds0U6MRv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A3uCuvAUGXX3WafuocWlHgNyBa31b0aRsZ63MCZiNoOMHaSUbm2+drsaSmC4Wv4kZPb8ybAiHouaz5rptCXmrFl6nvG7WHeVvNe24W5kgYpw+QJXCkbTxeemp3HcDdoGCdSVWSdEo9SDwtEDAuS8saTt6QzVrMslY+KG0KppNheFRj1PHr6IkKToIf+U+pfUzj63wMKg4hsbm/t2cuVxfIkYLk4zK4moF8+ek1vxPn8p/w0zRSxOj7LH5x54M1ThO89/2St+/E8t/6Vb08lZY7uxlymMmyLXabxBunFK0LAtECra/o7gBcB+UYHqTdSd/pG0hOL+HqCdDAVNWtHZ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0YP74ZssFdL0wrkBg40Eq6oYGc6ol62JUsFkqWfFUEA=; b=rzDtrn4L4TU3n/bmxgOd9G2IRKHOYJTASTyiUJLQvE+ru+zYGaD9YnYKntVNC+6RnWm2Ly+4yxv6hUiN1AyVCuEVvXEP7+6czEJGtpO5QhX4Y2kbBCGKU392PcJ50UvnTOi82anyHcyn3ven7xWS/L3YcDf1Nt8+hMN0Gwop+mdXRzwJlshf8pv9pE/lOMde/Iodfqq8xCFlUG7LNMPwUvyAMlX+nZjDIoBffCGVA87AzoVBMh2YoG1FFRORmP9WK87TdC2aeVszhXwEh+H3Jm3oFVI7lM4PD9kAF6WhQUBawge/z1yOyPGh7NFFrXaaryPtSaG/NGLTCdmuNImr9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0YP74ZssFdL0wrkBg40Eq6oYGc6ol62JUsFkqWfFUEA=; b=ds0U6MRvYh44rkX0NTgCVV1O7KwP/ruxAwJBfeulcSNLCnc9n0yaF3H9rhyKaGT2pdGwAWIIuHXQI3QlQhtEeFs3z1WC3EZhd9BUsuz0FPpIImUSXpyWOq24mzzuZxlUF5xpEePWecuEFbxZ6fU6FVzfnOz6wFY/pyLvTkbYmf61KCRqXl0HYRTPtlHyLNOu8rQRRJ8BRjCP+K2Wb+0C4tPbFrVhSHvzj7eyv6wsD0CScomh+OF8P/l2qTOZXQAbj1AOh1GzNmaJtuxjBZdvqdwynmzu0r6ZJqUxoxP0Ykk/FIjcp5C9rgFc6VFvBZzDDjEPk2GbxGkniOw5E7C1OQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM0PR04MB6979.eurprd04.prod.outlook.com (2603:10a6:208:18b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 11:51:44 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:51:44 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ v2 2/5] btdev: Add support for syncing to multiple BIGs Date: Fri, 1 Nov 2024 13:51:15 +0200 Message-ID: <20241101115118.43891-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101115118.43891-1-iulia.tanasescu@nxp.com> References: <20241101115118.43891-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR01CA0089.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::30) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM0PR04MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: 54202f34-3051-4531-4911-08dcfa6b8ec7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: QlaGgaOEc4fOXSBBU+oMBs/S8buLX5nR1YqSKqmKc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19QJbrV7B9PjiF7xSlkK/eKlcnShBZgBic8bJkKIyWTZWTpD5acG+6NsTMVF7qyKl/GZj7WAJOiDUR5+26bwxgaMBo3JQ8+XfdkzqfWlYOCynXz8XadV/YmBYulEd15KtBaEJ2dtFeFtbMoYz1llZ1D/18zin3LCJMa1Ut28wJC8Gm4sdfrkahhwT07Evw6IASI/sYcwxB6pYJoTc9/6jUR60i6sPOxmul3EYXLWuQoxirF4sgMg96P6x40NRbw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Es/W8nBhptinBZvZwlsPUL6/pIOKuHHAaEaLhX24KJWty/UwCKVi0gB1WsTbIojdU8R8LiSToQVKNEFUZsnuRM8V7kInR7xKcdy2Bv74T9cssiE9UIdg2Zzu7RdPPzS6UbA/dIFVQGsjGQe9XOQH+0wtIaKjD9uArakWruSExQBT/LEp9P7DjmU/t9I64AdCTl3r3muCP/AuSnsad/7TdZJtnLSJrcxOWUq0SazZlISMBbmof5jG/Eisl1TwS03B0q3rBTOVlxu5O8KzhsJqMutgTjsYN3hgjcuA/uU9//5inJrf8Se8mbD4ETbzbRPKIsv9Lq5TPoh0oRfcx/B6GeDmLTeR+ZCEbN659mQ3ejCQ+eJioCWWYYBs9A4X0spqyuJDYFDzUoR2M1mDxbyBHpQdvKKZa5zSVtGcyPA5dsd0uEN3RithdvRuOUE7E5qEcDRLKmBLO/eMFehADeE7tBU+n7s+UYyYdglcW3cEJ3T8ILzBzRb70fCBNT+4gnG748AwBkfM4Vw8GRP19ZFu1v2gRZABn2oycTO+3Oz/iFLNoHH/skWHqye/Imxco4WTFXD0hviLFftoMk6lA8p62HpjQcBSN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f34-3051-4531-4911-08dcfa6b8ec7 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:51:44.5648 (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: xhwmSX6WfuYgC+nKlnRNK/EViAVt7IRiqsYgoppeqQuIrIewVujGhMxtzmHv1ZNsBEWHa0uwomwuMHBAefA3yQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6979 This adds support for synchronizing to multiple BIGs. --- emulator/btdev.c | 88 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 20 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index ca70ad076..08af873a2 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -112,6 +112,12 @@ struct le_per_adv { uint16_t sync_handle; }; +struct le_big { + struct btdev *dev; + uint8_t handle; + struct queue *bis; +}; + struct le_cig { struct bt_hci_cmd_le_set_cig_params params; struct bt_hci_cis_params cis[CIS_SIZE]; @@ -219,7 +225,6 @@ struct btdev { uint16_t le_pa_max_interval; uint8_t le_pa_data_len; uint8_t le_pa_data[MAX_PA_DATA_LEN]; - uint8_t big_handle; uint8_t le_ltk[16]; struct le_cig le_cig[CIG_SIZE]; uint8_t le_iso_path[2]; @@ -245,6 +250,7 @@ struct btdev { struct queue *le_ext_adv; struct queue *le_per_adv; + struct queue *le_big; btdev_debug_func_t debug_callback; btdev_destroy_func_t debug_destroy; @@ -575,6 +581,15 @@ static void le_ext_adv_free(void *data) free(ext_adv); } +static void le_big_free(void *data) +{ + struct le_big *big = data; + + queue_destroy(big->bis, NULL); + + free(big); +} + static void btdev_reset(struct btdev *btdev) { /* FIXME: include here clearing of all states that should be @@ -584,7 +599,6 @@ static void btdev_reset(struct btdev *btdev) btdev->le_scan_enable = 0x00; btdev->le_adv_enable = 0x00; btdev->le_pa_enable = 0x00; - btdev->big_handle = 0xff; al_clear(btdev); rl_clear(btdev); @@ -595,6 +609,7 @@ static void btdev_reset(struct btdev *btdev) queue_remove_all(btdev->conns, NULL, NULL, conn_remove); queue_remove_all(btdev->le_ext_adv, NULL, NULL, le_ext_adv_free); queue_remove_all(btdev->le_per_adv, NULL, NULL, free); + queue_remove_all(btdev->le_big, NULL, NULL, le_big_free); } static int cmd_reset(struct btdev *dev, const void *data, uint8_t len) @@ -5331,6 +5346,14 @@ static bool match_sync_handle(const void *data, const void *match_data) return per_adv->sync_handle == sync_handle; } +static bool match_big_handle(const void *data, const void *match_data) +{ + const struct le_big *big = data; + uint8_t handle = PTR_TO_UINT(match_data); + + return big->handle == handle; +} + static bool match_dev(const void *data, const void *match_data) { const struct le_per_adv *per_adv = data; @@ -6441,7 +6464,8 @@ static int cmd_big_create_sync(struct btdev *dev, const void *data, uint8_t len) * allocated, the Controller shall return the error code Command * Disallowed (0x0C). */ - if (dev->big_handle == cmd->handle) { + if (queue_find(dev->le_big, match_big_handle, + UINT_TO_PTR(cmd->handle))) { status = BT_HCI_ERR_COMMAND_DISALLOWED; goto done; } @@ -6459,6 +6483,25 @@ done: return 0; } +static struct le_big *le_big_new(struct btdev *btdev, uint8_t handle) +{ + struct le_big *big; + + big = new0(struct le_big, 1); + + big->dev = btdev; + big->handle = handle; + big->bis = queue_new(); + + /* Add to queue */ + if (!queue_push_tail(btdev->le_big, big)) { + le_big_free(big); + return NULL; + } + + return big; +} + static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, uint8_t len) { @@ -6474,6 +6517,7 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, uint16_t sync_handle = le16_to_cpu(cmd->sync_handle); struct le_per_adv *per_adv = queue_find(dev->le_per_adv, match_sync_handle, UINT_TO_PTR(sync_handle)); + struct le_big *big; if (!per_adv) return 0; @@ -6483,6 +6527,14 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, if (!remote) return 0; + big = le_big_new(dev, cmd->handle); + if (!big) { + pdu.ev.status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED; + le_meta_event(dev, BT_HCI_EVT_LE_BIG_SYNC_ESTABILISHED, &pdu, + sizeof(pdu.ev)); + return 0; + } + memset(&pdu.ev, 0, sizeof(pdu.ev)); for (i = 0; i < cmd->num_bis; i++) { @@ -6491,6 +6543,8 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, break; pdu.bis[i] = cpu_to_le16(conn->handle); + + queue_push_tail(big->bis, conn); } if (i != cmd->num_bis || !conn) { @@ -6500,7 +6554,6 @@ static int cmd_big_create_sync_complete(struct btdev *dev, const void *data, return 0; } - dev->big_handle = cmd->handle; bis = conn->data; if (bis->encryption != cmd->encryption) { @@ -6530,7 +6583,9 @@ static int cmd_big_term_sync(struct btdev *dev, const void *data, uint8_t len) { const struct bt_hci_cmd_le_big_term_sync *cmd = data; struct bt_hci_rsp_le_big_term_sync rsp; - const struct queue_entry *entry; + struct btdev_conn *conn; + struct le_big *big = queue_find(dev->le_big, match_big_handle, + UINT_TO_PTR(cmd->handle)); memset(&rsp, 0, sizeof(rsp)); @@ -6538,7 +6593,7 @@ static int cmd_big_term_sync(struct btdev *dev, const void *data, uint8_t len) * exist, the Controller shall return the error code Unknown * Advertising Identifier (0x42). */ - if (dev->big_handle != cmd->handle) { + if (!big) { rsp.status = BT_HCI_ERR_UNKNOWN_ADVERTISING_ID; goto done; } @@ -6547,24 +6602,16 @@ static int cmd_big_term_sync(struct btdev *dev, const void *data, uint8_t len) rsp.handle = cmd->handle; /* Cleanup existing connections */ - for (entry = queue_get_entries(dev->conns); entry; - entry = entry->next) { - struct btdev_conn *conn = entry->data; - - if (!conn->data) - continue; - + while ((conn = queue_pop_head(big->bis))) { rsp.status = BT_HCI_ERR_SUCCESS; - disconnect_complete(dev, conn->handle, BT_HCI_ERR_SUCCESS, - 0x16); - conn_remove(conn); - break; } done: - if (rsp.status == BT_HCI_ERR_SUCCESS) - dev->big_handle = 0xff; + if (rsp.status == BT_HCI_ERR_SUCCESS) { + queue_remove(dev->le_big, big); + le_big_free(big); + } cmd_complete(dev, BT_HCI_CMD_LE_BIG_TERM_SYNC, &rsp, sizeof(rsp)); @@ -7257,7 +7304,6 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) btdev->iso_mtu = 251; btdev->iso_max_pkt = 1; - btdev->big_handle = 0xff; for (i = 0; i < ARRAY_SIZE(btdev->le_cig); ++i) btdev->le_cig[i].params.cig_id = 0xff; @@ -7276,6 +7322,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) btdev->conns = queue_new(); btdev->le_ext_adv = queue_new(); btdev->le_per_adv = queue_new(); + btdev->le_big = queue_new(); btdev->le_al_len = AL_SIZE; btdev->le_rl_len = RL_SIZE; @@ -7296,6 +7343,7 @@ void btdev_destroy(struct btdev *btdev) queue_destroy(btdev->conns, conn_remove); queue_destroy(btdev->le_ext_adv, le_ext_adv_free); queue_destroy(btdev->le_per_adv, free); + queue_destroy(btdev->le_big, le_big_free); free(btdev); } From patchwork Fri Nov 1 11:51:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13859278 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.79]) (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 1C0C219C54A for ; Fri, 1 Nov 2024 11:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461914; cv=fail; b=ADoz5YGoAVrOi1Rkl2SgE71SojkxBG/yd9S5Oq1Qx0WNnQMD44RXHfCZPAIXSwovgwFNJXr9UZlIQgNJcFDgyK9tSYS2vJnaiAYDk+pLv6KjGT0e8+MsITMoHN2E89j+qQw6Qv77H1iNjn/Cg76uIbRt7uRSM0Lgpr0mQ8zWByc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461914; c=relaxed/simple; bh=fmVg7XgrkQ0RmGn5WMTBWeDUIbvmWAl0cnmR5SkTtnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=dUL8aZdwXYULraKV14lCJhGVFvMt3c9NXvRH/Lx93Vp165GzFTslpKszpfdb4crhfvOumA5y3dG8Zoc/96AsaEMcm+iKTzDSWCtxLCiEW4YDLg9OkKBXZFU3Xx193rXsoGSK9AHTeeNu3Jr0uQIdSIaYHqFwkGqDeTO5vi276go= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=K/TSki+H; arc=fail smtp.client-ip=40.107.105.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="K/TSki+H" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B/w4BdpXUrITaPq3UztImhPRO1laPP39rI5C70dLjdfpjMSfTUTAuK3SiSbyScerWs742EEzdpHBWvIZJ/ZTVpJtPBRql9cHKO86Nnf4F9/gUd7ZqA9ImMnD0txQwBlh2g4neqAHe4TAbiUmSZp4ie10MAhZ3ujHeh5387Y98ukSjrJnCSQ6AqiH7uf8EV8mBtfxjbe+wxRSfDpe9FoiOppnXO9T0R+41w4x3BGtcgqIW0dTZ46ppKsh7uYPG5li67CtNffCskfkm2EhGntFRHegxcsIV3s/xpdjVd4rO3v5imJgvJhidZtj3ipbjCL7iu6jCWOtWqYihSJBq5n9bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IscxfkjRIQH4lZLX4mtCT8uvJCa/qmHE+7gNHnkd61Y=; b=MGDMKAzHI72tOjxIflbOs4c1+CHpJKRfdmfVxfjLkFNVGMQ5MTS76qkVrk9XdsSb3g9cIJSA/zFxf1WbJ5Vi0OPlU6mFLIk1irrhpx7OXvgtFh+inY7DRKSNE0+M4T5wdDw6ubls9/756hNUcmp5UX9HXTh8Enms7XAoREe6TyoxK+Jsi673poFzsEb+t7CZ7ZXR7pliW5WHtd7wewVwrXzKXLv2x/FcH4uDrEp6EQNBlM5mLhMSDKMxH+DreBKC6LMLLG+RNmQBfMzIHX+ymCW0oBBSaEJhB9ifUlC1n+RTkzyVoGr53Lv/kRJOtcvuC5z4zXDtwYkXOmgt9MWeAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IscxfkjRIQH4lZLX4mtCT8uvJCa/qmHE+7gNHnkd61Y=; b=K/TSki+HycxQk9eNxYBWx4BS4EJrMNJCIxWyMSTDFESTmJq2k3o0KwBxTKQmHpcwhShdNMFSu1uvVPo2vrOVEBXQ5TGiYpfMjBgsBdc0syHLXk45sszfGYI7JfWma82fthWAKSf9lv/B2MaDQjemtQ/rGv1AtM5tW1pcWeR3od8xOdKXZ09xLURv+c1wPQqZr6DY0Q2iFdVawzNfBKKXkZv9ZsY/YWfjlRXsvinIx8Myh9sVhLUikv+lmUSG+7pmdfzhCPYfvtqDsywfJwfu0OJnRCIXEu3gZ0IMHArhh9LW1j7Yf+0LqJaojo+JJmRLdo65SRWsTJpkskNptkzVwQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM0PR04MB6979.eurprd04.prod.outlook.com (2603:10a6:208:18b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 11:51:46 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:51:46 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ v2 3/5] iso-tester: Fix memory leaks in iso_accept_cb Date: Fri, 1 Nov 2024 13:51:16 +0200 Message-ID: <20241101115118.43891-4-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101115118.43891-1-iulia.tanasescu@nxp.com> References: <20241101115118.43891-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR01CA0089.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::30) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM0PR04MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: 93a40b3f-6cc0-46d2-160f-08dcfa6b8ff1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: cl/hE5inU+cCvv4APJOBrsepGKxLDyH8jqe/LSI4trqGYIlRYaIJCXJarY3VbYL0UgGM9PANGn1I0hbPChQ4IldfhazBImhXzY0cf4yZo+ktx8uH8T6qlCLViZe2vdXUbsijQ2WyJkaSxUMt0DDElshOaJV4JevJCs1CAujgimDSRWhyKQ+WQODPFkcqNNCGqV0z6kiL4Oh4zQcmVEzCKIhKErfPq5rAYAbTaAdCTKIHYv9z2Hk3O6uOcjI4wcAE/q3ORPHvFGKeUeJOngYrOFgl4QinHHYTsQHO3Ncq23IZcf0Y814gFA6ZKqhCbft2Poe6FXUV0pi7QJZcNJTtt70cDZbFT3rYk2mWpEGOICjt/+QxJ7PVEWfqXZUlCia7RQeP46Q0LggeyUDMe2UlqWb9ow2FM+lTGpwQpXJhDsiJHFdw9drLyb9BPUmxcEr48ApXXkPQoDH8N/bI/OSOWTXio8eZ8Mshyqrlj6Vdd3ZKaFZrRP4pIGWtl5IrvIk+nO5TuqX4AvE5BACzffOSPWl5+YJDTO66XepedX7NvMHCKSiJ4sICe/jwLtPAjnSfegCCVwg9Fs6CqfyCpvfGLrNuL8hfnMkSz7g7paS1xoHNYUOyxOV86jcZnumd/mC4Kpdgo6pgz07Mygtcp6SG3c5l+f9x9StNEIKmXnhIRclvJx4n1dI4pLmrb/aZmLGEi7sPQIzHOzgvoSNNklJMqmoIIzjCzYQoE9zvLwaQT3PUIW5qLnTvYxslk+w5NRI/shY1thN1fWt5pOl/03FsWuObm0uLP7kT8hTErVq0gNNL89qOg/1f3chZOhyrl3VOWZPAclVLkRnnqyLIOKU3Clr9FBd1az7i27xO3LgLZiw0bLsy4B56zrW818KXjY/IKQPxWnzkxqtv9vNqUIdyhCAmOPUJSFIya4xosmXmLmD5EyavdGb02eO1rGUYuNdXpuUkwvpcvHvaSOKrDBxt20CKY+xALqCwsctGKbfOTJ1hz07ZQSeEMLkZxJ71jWZy5knv3qydGB9CzmkYxHg6MCvkpvIMDCqGFZZwtq0fCV2zAILfP4y1V92OyB4H2+paR7eQBaaMkzRDpq0P/hH7LD45MBUE/A4wgaHENLwoq0lwAXztorqGsgy/DQbfM25BRqSHcbbhAOIIqGZXUoeQl+IMOpbdrCRa4C4icIJVSEjwQbin+CdywB8LhXzF7+T1W/BVbgYl9w0vmyTVS/Y0fvbvh/BhOeuTM2JKhV1jPfoMGQXX3OZIht9e/+tKr6Eje/kSORJE7JwJGWZiT75IEHljivTz9iKCL6PHjaaml9qZLUzwFT4YNbS9/4xAqV3Xw+sqNhWoz88+MG8mVDb6QPiVSDrxL1JMrJTjN33xeds= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RVJK+cEI9r/wQuw7gflJOuRjm9bjFm0Or5mGGfnsJcBrjM1V1K+5gc0AplzcZC3CH+/eKWdfrxDaRd5bbJBdJpj2XVGTiLGqULXiRiLf5udjoKV+ZfdlvGDIO+asz0+4anSxONCYe3bXeSv+HXC9JBeNy3bo6bZ1jxCtTWNmRrqIx6OZ6LTe4JNDoK6FdBJcNHIfJnURn/zH85MuUXFZFO5og1m1nNACV1kL8LymQ2m14UZ9qghpSlw61qc/IS54Q7Ih/bKD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XfRVI6Ceqb4mEC7VWLCRtramgInqxWOSTP+s2gpffNoCZUPndZwyQwlvq8uwALoxFzlLpqDmsXOfS15srlVBMc1EJRzVHf51BAf+EChptvyUCOEmBJwQSA+d6LLyltkQIccnBVCy6kf2E8qOz7XrUrQYTgv7952XpoDVbIZP+Cd35gTvqWas8ziOFVckiVEWH1RPqea6fM1sqwzSGjEewQYjS2USksomVlczU5+F4UROJ/1FrCnxA+Wfl9HSUg5olTsPFVfhxWyO7BIVK0z7L2ei80ACOMUyQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93a40b3f-6cc0-46d2-160f-08dcfa6b8ff1 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:51:46.4537 (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: 2/U25XE/0O7EMlVeC8tQr0H0+jB1NpeqsNdPHpOMbsmrbTHRAD3DeY+cvTfFleK8aNQO3OfYjskoZhZu0uzAqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6979 This fixes memory leaks that appear in iso_accept_cb because a new io channel is allocated but never unreferenced at the end of the test. ================================================================= ==20460==ERROR: LeakSanitizer: detected memory leaks Direct leak of 120 byte(s) in 1 object(s) allocated from: #0 0x7dcddc8fbb37 in malloc ../../../../src/libsanitizer/asan/ asan_malloc_linux.cpp:69 #1 0x7dcddc719af9 in g_malloc (/lib/x86_64-linux-gnu/ libglib-2.0.so.0+0x62af9) #2 0x7dcddc7722bd in g_io_channel_unix_new (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xbb2bd #3 0x5d3fdfe28262 in iso_accept_cb tools/iso-tester.c:3004 Indirect leak of 6 byte(s) in 1 object(s) allocated from: #0 0x7dcddc8fbb37 in malloc ../../../../src/libsanitizer/asan/ asan_malloc_linux.cpp:69 #1 0x7dcddc719af9 in g_malloc (/lib/x86_64-linux-gnu/ libglib-2.0.so.0+0x62af9) #2 0x7dcddc70016f in g_io_channel_init (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4916f) #3 0x7dcddc7722c8 in g_io_channel_unix_new (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0xbb2c8) #4 0x5d3fdfe28262 in iso_accept_cb tools/iso-tester.c:3004 SUMMARY: AddressSanitizer: 126 byte(s) leaked in 2 allocation(s). --- tools/iso-tester.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index e80c2159c..41d46f554 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -2987,6 +2987,7 @@ static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, struct test_data *data = tester_get_data(); const struct iso_client_data *isodata = data->test_data; int sk, new_sk; + gboolean ret; iso_defer_accept_t iso_accept = isodata->bcast ? iso_defer_accept_bcast : iso_defer_accept_ucast; @@ -3014,8 +3015,10 @@ static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, if (isodata->bcast) { iso_connect(io, cond, user_data); - if (!data->step) + if (!data->step) { + g_io_channel_unref(io); return false; + } } if (!iso_accept(data, io)) { @@ -3037,7 +3040,10 @@ static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, } } - return iso_connect(io, cond, user_data); + ret = iso_connect(io, cond, user_data); + + g_io_channel_unref(io); + return ret; } static void test_listen(const void *test_data) From patchwork Fri Nov 1 11:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13859279 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.79]) (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 955D119CC04 for ; Fri, 1 Nov 2024 11:51:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461917; cv=fail; b=tZBmdYfFw/pheSDb2194tMSuc6Gjw+tMlt5Y4Yw5hDY1Iio0FvNca0hESrqnBftFxFzXNgLkXQLgSOuT+RIXzKpPTAfozXyNYbQ0yfxS84WJb880kYMCadDHGZm0EyaD4jopfRYbSJ1mAxaInLJiPPk0gd7C7tb/VqjcysSMvds= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461917; c=relaxed/simple; bh=Mivx3tE/T6A9yMetkRWxn4wNhG+d1M2d14zNXjJbin4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=GerRPmYDe1ZDJUL7KYF9EEZoprRcn2f8PLleIAhpatcaNPFjb8awjGVeHs6eGZxPtnHvziiN7r80jSNgqZk+vF8I3FGYPWbBPp2/u8iXmcWYkMlsNhh0Njw4VKiZcSlhuitE5s4Cs26h9vH/oH09hpMvTW1CCXx8seh090oVe3Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=HUTqNqAG; arc=fail smtp.client-ip=40.107.105.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="HUTqNqAG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f2oA2sl1/hx//XeknLQjEGOqVvmhXUeO4R8K11WJJy+gkq9OV81CGhVxD+5t+zCrMIJdQpdjvT4drHIfH+q+T2O4Th2nD0RgQT8pqKn+k5qjfSsk+E+tGoYIic2h6yZPCPTc+R48k0yJfjn749Ky2s2Kx2NWMvsXNKVX2h4kNdjHZhmaAmYcrs/aybg8V8g5Vo/Mu5Nri+udtDG3zMlUlhxfMLwNUjqLw6IOHOD9HjEuR+eYoanW+qd+ZP0kF5Q2GoeCGSCl9/fKoDOf+CdAWRfNY+5elq9TeOGAhNijZH+JwVbY7lEp3K7WnP5f401co72hFHwxSwWTQ7S6ldc4vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+vxT3KMTxmxuODIbDPnn4ZshYittW77Ud6qZrCdfZQ4=; b=ma9ETTllWwRuB+jtCTrrTbIUfFmvMG+gCQW9x/9z8gDS9W4xLT5RXUd65xhE3tEoDjRM1XqO2otgFHlEOOps7oBMT0k/WyIRnltFnbD3+fReubUhjwBEhNdHGrx4Fx6V3uiAjqvZr7R8HktKACArCapRIginEl+uygK1pQwXFo0JGVi2T10IWzv67MWhbvCf1Q6D3LJ9xjqIaSp4EQ+IbrRa0G9WmPzs+MuBQ3izBuR6tKxZayTmI1gImzqaZVjhfMQsoFIthAsuEY0dcdf7CizXo3xX7GnhxkUiDiGfqcYFipN+FVfii1iO/TGagyhSExXb3opHt/gx+CIBM6daAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+vxT3KMTxmxuODIbDPnn4ZshYittW77Ud6qZrCdfZQ4=; b=HUTqNqAGj7BcFoztyb6QM6vCRSJNloizX72CJZSQAXdaHNrxTrcBaqtMSYEPi2tcPoNaIW3OtBdYGgiJb8k6vutzrbkahO3PZu3Wm//aPEXT5OqSmItOewwYDOTIPGCLBBMDGKq2ps0keTnSoDiYzbhYWSkst6FbM5p8JWJk5qzAY4gipcOk4vaMKGFzf5mmujCfS4JnUvCEgNb7WpKfikpSbetlAddFqMn60c8oXfNLTu0cAWBvJL04IMCycuGnNbQ+ke6jRgbraW75kTkM6S786AHV8sEKKJdxdvCKIv2bkwJDJszPyHOgTimxpmk2Gt/7AYxcN6WsEKz6gRMKWg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM0PR04MB6979.eurprd04.prod.outlook.com (2603:10a6:208:18b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 11:51:48 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:51:48 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ v2 4/5] iso-tester: Add test for Broadcast Receiver sync to 2 BIGs Date: Fri, 1 Nov 2024 13:51:17 +0200 Message-ID: <20241101115118.43891-5-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101115118.43891-1-iulia.tanasescu@nxp.com> References: <20241101115118.43891-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR01CA0089.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::30) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM0PR04MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: 4657cc68-efdc-43dd-724c-08dcfa6b9120 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: YMv+qy6QcvzHXmJ4XFmOSaRfRFDcz/+HMe5Q74hQUfJvjO1XEsh0qwydT/yaUsBEvV5p/LJrevLG2syGRZsz3hFpD7UyyNWTMRHxBjiNi6TgXUDvytpOT/k9wO0MXbbKCInM+qZoWzbaLYoEIUHHkko+YmynuiPCF4UojyiT3Y/QvkJLIIu4OaXuUWxH9fLMJCiT7Iig9HjP1jmVdg3yFzSssauJiCsGwN5Q6fhZr2gBbDJHCU3BS9ri0CV1I9NpEFPK4JXojey4ZazHfZi7jF419rW1tzy3EaNIM+Vsek0+S8yigpZdA7v5EN0y4DxzwwxOCEBWDc4BEnac3j8KlJ+BWf7Za5Hycv3kOKTs6zVw8/K/10qy6CoqhvhpHigCD0vyaDVQSoHl+vQpQBjOztsTpotkhybVkV+sGFeVvhei/bmAXEBW2h9OT4IsJRNn3Op8pydCj1kOy/n8aRqE1yG/Duuw2KkhJaOP6pbp+VhxCXq3SwaFDziYT8t1qCzD3/28akLx5GocqKrm7vMEnQz09vFiuE09sexqjnPgivVwD4gU+oyECbMtYlVfg1djKpd9uvXLC/hIqS1XYgaF0OtiPOLpNJVg/gR1pfijpidDoyAaEc2g36tJwF1bp5DjGSMH3yuuLM3TJqOgaMnXFjiwqHBtPS4kSq3hCARPROkO8xHuKG/0itFfihySH2yBtXPssJYqmn8sbw/Dsswh86RysHgcULdO1ar9tJ5Aer5IQndCNa2L5Vtv1zYDa/3u/x/53ltV46KejEOGfzSbbgphCgrS0cjyzLhdEPK01kds8c5MCaTzUnYmtJD0g+hMZUbcHzZD4JK1mfdKwHhByuk4ni8EcYHbO5exrRBmatnTaE+C4sUpFrTth6plTSnc8OGWKsGJxdSHBvz053bowA3Juzt/M3m1LI3mskO5geZ0VACWov4xXhDbZFY4rIeS5IM/NyvLnr444LvlXXF2rXi4+rWeb6WS7WC674LcfPdfdXmmaudrUgl4/3FHisFPmcJUtLo2O0WBhKPkogGY578SIhxTDSMou0zBb7jwzO/u1SoYJFz5PJ7mfhDGiPdNn1cAe0SYxKhhwTgC6tgoeaXip0jV48MVjzuUpK0jR8u49ksh1J6EEetWLAFgr2sGUT5xRWeGtd9jOJkxPKXBn1oi3PtNG4xJqdVNHaRMGdD19LprYIkNsMmB6OQeh8Poy3QXUQw1ZitXO9W3tmMETZuSAW1oFQArK+aD1oYr/geKNUxpuh6dgzYnIZApqp4u5YiIqLO4FygvYwSqMT+zi+B1ngO1yKXiC6XV2p4GcV32vSpzyWNaVYKSY35s7XVFc3+ACqbNcFhFPH5wdg+Y6R+0eehohaiP3IyZ3/XEg1E= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6JTcdt8xMoUf5BDYC6VNwbvrZQngW9AKkmoh0OvpvHBkLu1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yIbndKimJP7R5V5Bp3m3KlOnVcWRfO6MCS/mU/GKQ3YbkqJeQC8ufkmT1FxaehW/dKLe5d/9vx2A/e8Fo8IQ/2uvGohEF9EPGpKTLuAjSfTTDc2sjzByLCxOw5oTWjC0zXq5YpyqiUGaTK7yC1S+vYCyQKysPP5BrYaK8FRuJSEjon+BM0Lp8aC5trN9/zYeQ3PIsgGA3nJYsOHoPx0JRV3hxUKROOzeNyhegttQ38raNuQz8+93d6eiOAZTjlL+WKmNCvruZ5fljdAbg8QWDK+IFNAqvf3hBp9+p4/zF9ttiJ9Lk9Yqi+0OPqof306S0e+YT6FR3pQr1iD70Z/7PILMMQwGnvb/+V6r4pQCLwzHptjFr9XUPIGIEBlrniGVObvLuQ5hlVS/0xJbiUtjv6RBfZiEVgpqbOSDYurK/uEpkZfKLQTVP2AynJty9DK92M2SKcaDluJMopzoXHtuGVim/RhUM4JswawxuCg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4657cc68-efdc-43dd-724c-08dcfa6b9120 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:51:48.4160 (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: sGnCHMdwGJqqdOMhEl05I0501SfJbiPaIg5AFp7WAvlIJrWJQE+uSGvxElrVdvLJC5BqUTEW6jompf64DUByIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6979 This adds a new Broadcast Receiver test, for a Broadcast Sink synchronizing to 2 Broadcasters. ISO Broadcaster Receiver2 - Success --- tools/iso-tester.c | 101 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 24 deletions(-) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index 41d46f554..6215fd456 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -1418,6 +1418,14 @@ static const struct iso_client_data bcast_16_2_1_recv = { .big = true, }; +static const struct iso_client_data bcast_16_2_1_recv2 = { + .qos = QOS_IN_16_2_1, + .expect_err = 0, + .bcast = true, + .server = true, + .big = true, +}; + static const struct iso_client_data bcast_enc_16_2_1_recv = { .qos = QOS_IN_ENC_16_2_1, .expect_err = 0, @@ -2763,7 +2771,7 @@ static void test_defer(const void *test_data) tester_test_failed(); } -static int listen_iso_sock(struct test_data *data) +static int listen_iso_sock(struct test_data *data, uint8_t num) { const struct iso_client_data *isodata = data->test_data; const uint8_t *src, *dst; @@ -2793,8 +2801,12 @@ static int listen_iso_sock(struct test_data *data) addr->iso_bdaddr_type = BDADDR_LE_PUBLIC; if (isodata->bcast) { + struct hciemu_client *client; + + client = hciemu_get_client(data->hciemu, num); + /* Bind to destination address in case of broadcast */ - dst = hciemu_get_client_bdaddr(data->hciemu); + dst = hciemu_client_bdaddr(client); if (!dst) { tester_warn("No source bdaddr"); err = -ENODEV; @@ -2857,31 +2869,36 @@ fail: return err; } -static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func) +static void setup_listen_many(struct test_data *data, uint8_t n, uint8_t *num, + GIOFunc *func) { const struct iso_client_data *isodata = data->test_data; + int sk[256]; GIOChannel *io; - int sk; + unsigned int i; - sk = listen_iso_sock(data); - if (sk < 0) { - if (sk == -EPROTONOSUPPORT) - tester_test_abort(); - else - tester_test_failed(); - return; - } + for (i = 0; i < n; ++i) { + sk[i] = listen_iso_sock(data, num[i]); + if (sk[i] < 0) { + if (sk[i] == -EPROTONOSUPPORT) + tester_test_abort(); + else + tester_test_failed(); + return; + } - io = g_io_channel_unix_new(sk); - g_io_channel_set_close_on_unref(io, TRUE); + io = g_io_channel_unix_new(sk[i]); + g_io_channel_set_close_on_unref(io, TRUE); - data->io_id[num] = g_io_add_watch(io, G_IO_IN, func, NULL); + data->io_id[num[i]] = g_io_add_watch(io, G_IO_IN, + func[i], NULL); - g_io_channel_unref(io); + g_io_channel_unref(io); - tester_print("Listen in progress"); + tester_print("Listen %d in progress", num[i]); - data->step++; + data->step++; + } if (!isodata->bcast) { struct hciemu_client *client; @@ -2901,6 +2918,11 @@ static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func) } } +static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func) +{ + return setup_listen_many(data, 1, &num, &func); +} + static bool iso_defer_accept_bcast(struct test_data *data, GIOChannel *io) { int sk; @@ -2981,19 +3003,17 @@ static bool iso_defer_accept_ucast(struct test_data *data, GIOChannel *io) return true; } -static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, - gpointer user_data) +static gboolean iso_accept(GIOChannel *io, GIOCondition cond, + gpointer user_data) { struct test_data *data = tester_get_data(); const struct iso_client_data *isodata = data->test_data; int sk, new_sk; gboolean ret; - iso_defer_accept_t iso_accept = isodata->bcast ? + iso_defer_accept_t iso_defer_accept = isodata->bcast ? iso_defer_accept_bcast : iso_defer_accept_ucast; - data->io_id[0] = 0; - sk = g_io_channel_unix_get_fd(io); new_sk = accept(sk, NULL, NULL); @@ -3021,7 +3041,7 @@ static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, } } - if (!iso_accept(data, io)) { + if (!iso_defer_accept(data, io)) { tester_warn("Unable to accept deferred setup"); tester_test_failed(); } @@ -3046,6 +3066,26 @@ static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, return ret; } +static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, + gpointer user_data) +{ + struct test_data *data = tester_get_data(); + + data->io_id[0] = 0; + + return iso_accept(io, cond, user_data); +} + +static gboolean iso_accept2_cb(GIOChannel *io, GIOCondition cond, + gpointer user_data) +{ + struct test_data *data = tester_get_data(); + + data->io_id[1] = 0; + + return iso_accept(io, cond, user_data); +} + static void test_listen(const void *test_data) { struct test_data *data = tester_get_data(); @@ -3321,6 +3361,15 @@ static void test_bcast_recv(const void *test_data) setup_listen(data, 0, iso_accept_cb); } +static void test_bcast_recv2(const void *test_data) +{ + struct test_data *data = tester_get_data(); + uint8_t num[2] = {0, 1}; + GIOFunc funcs[2] = {iso_accept_cb, iso_accept2_cb}; + + setup_listen_many(data, 2, num, funcs); +} + static void test_bcast_recv_defer(const void *test_data) { struct test_data *data = tester_get_data(); @@ -3709,6 +3758,10 @@ int main(int argc, char *argv[]) test_iso("ISO Broadcaster Receiver - Success", &bcast_16_2_1_recv, setup_powered, test_bcast_recv); + test_iso2("ISO Broadcaster Receiver2 - Success", &bcast_16_2_1_recv2, + setup_powered, + test_bcast_recv2); + test_iso("ISO Broadcaster Receiver Encrypted - Success", &bcast_enc_16_2_1_recv, setup_powered, From patchwork Fri Nov 1 11:51:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13859280 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2079.outbound.protection.outlook.com [40.107.105.79]) (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 7B8F319C54A for ; Fri, 1 Nov 2024 11:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461920; cv=fail; b=K3zVCd/eEsbWnuv/eyPWXSnOH4aV4Tq5xK1pjUOoviz/cUcIWLqwVFnR7a4RQDRuYelI57Xm/2Xw+qlL29CUtHHS+49SMIvbU87n8eIQmx7k6Ze6rVrJEp3hzcBleW+mipuGmW/AWol50cdqJrpee8bgDWY40Rg705VC+CUR0ZU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730461920; c=relaxed/simple; bh=YVy5MLuLVhUzKTXU36Bp+w106pOsgzGfjnGsUxRCq08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=I96mjEe/rGz/Knhnx1Akz10vMLYLlYcnXAvIaI4sR/6c3jH9/CSBgJQIZ1jPY3lZrZG5o5cWKbkFvYGXcZiM8uq0YB9ORbuN/OauZSPDnYhG0aqEVhUgW7fvxRMT6qhcZFOmyhqxn2OsLC/WTL51emhr2Xru60DL32gEb+oiLjA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=g4CPTWHj; arc=fail smtp.client-ip=40.107.105.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="g4CPTWHj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ilt38vLezFoRwjyf2GYomoXEvVh3n8zsVwzqa5Nm21fWPeY7CF8JOwkiZiZU6naU9BJXhuJ+ljzVT6rp4p0hVPVSPEi58j0Pq4Lr1tGLif5y6Dzn6+GHtpbD8Sxb/Vlxgwi/kxBOXESErIk7+bfMvlnK6gFUi1ZvCrFDxwJ+yfJcNYhR4zZKZ7/YgGcOcEZEDe2ySEC8kGIo6SlPRRrNLNTGb/JZbc0Ov3RHKhja8BRv7UGVjw8KZHU0nTHj701JZ4Jww8ProCRJzWz8NP1uvSaT2igaTZRBx1pZ8KLDxtYuu8Ze/9MFIEKKJ3HXbZJENcrfqO/bUqeJKZjg99Xxmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OaXdf2MK3De/CLGuNA+GLdZV47xQG9oFCIuWa9HQhJA=; b=QL/tP5NgpY049YaR02XNZjezXrcUJAzkDVXVTNm7yojUuHyOg9N++b/Qw7RsOFzY/kwJ8Rl6oSUMO7lj5dMW7i62i37rGXHNlt9iPrZjpay5+iLrH26dCSiwJvhQZz3ape7jqJiDY8BVICr8LTCRoWOMqEl7U7b2mM9Dwv3wV2+roOWHCTa9eIeqc9ZhB59pBVnY766y/8ozJceHMNqzVpoFTx+MjHTFT/uqTuF8xc+q/Z56tm72sxZInxPk76WCvL6QfDBWKaKLLJ9Nmgh2RV2mmbnAG96nnOAo5Wd0al50ys234cl8fNbw4siK8+t8xpFZCngm2R1qciH0zWrtMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OaXdf2MK3De/CLGuNA+GLdZV47xQG9oFCIuWa9HQhJA=; b=g4CPTWHjb+0JCHNFA+SWCCOqrNVd398ElfRevmGxXvVh+XUMLWwR95MShYOgM9/IpRkJ/u0E/GVnFVXkgImjOci8vko8UeKK9r7ch/Au6YIyBGeuZDMzF48g6sNnMr0ZENdzFTuSzs9heQZBPjm6jFNeti734lZegakxKOjF59v3kKN7ZCkBgiWM8tZZVBANcviOSCI6HWoJcKOLZZb01TkSsAXflmTWgKvSOyw4MLiNHdWThGybnkbPiSbl79GmNtOR0xpQmXveY64OQQ1U7v6Glnx1CSF27o1chy3aaVdflxZfA4mCYVjeVwhNIIVCpGGN42x4Bq4ih47BQhPqaw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AM0PR04MB6979.eurprd04.prod.outlook.com (2603:10a6:208:18b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 11:51:50 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%4]) with mapi id 15.20.8093.027; Fri, 1 Nov 2024 11:51:50 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ v2 5/5] iso-tester: Add test for Broadcast Receiver Defer sync to 2 BIGs Date: Fri, 1 Nov 2024 13:51:18 +0200 Message-ID: <20241101115118.43891-6-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101115118.43891-1-iulia.tanasescu@nxp.com> References: <20241101115118.43891-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM0PR01CA0089.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::30) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM0PR04MB6979:EE_ X-MS-Office365-Filtering-Correlation-Id: 186c267b-8f8a-4aba-fd7d-08dcfa6b9262 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040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/ofyYTEPbgzdOgr8XElkekqCdfNVAMjXS31qh4R9Lc1eKru6arpB0JwLRh1S7Z3sE4xZz2rVtR1MSojTWe4O2tnfZM+QCRLyU5nYnb/f7A+xd/djLVSwYz9UmaILT2V1MVQlVjQY6O8WGuaKDpFxXmcqM0pALrAuqZ98mjdrayRqHdpZZ2SqBlPNjIa/Lspuj9qg6nkeue3HHUar5KFFHc2B2GFxgD+NM0XAFQUZ8RWp/xqiG5PMW9Jxa8ZzLCXFu3zFbu/2ks5L2+tKTB8DWsyknaYTPdkS2/kZpzjR5MpXLDff5y3dtOpeEkYZemcaJMBh9ErT+0fDoDVmdtS/EuOHzmeIjc3QQ2vSOP0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tiqfF+e2HTkWrum5I05M+nF6nIX4ebqRBcWASlOINoCCCRtPalNenYdp97awL9eYppz6dMJR7qwfN190Oo2TH7R2kiBM6xb4aHxpswxEbofBkK/8lTgUr/Lfd0fA/pi7T5Rouh53y8jUAbPiPowcfBJx2egmunTlG0F6KzfR7Bg7NUIjy5DekD8cXDgNCIo+Cty5gX/UNZLe7VRUFEsM3sytPMPvHhwKpSgru2nSfcKp8kwH1EWjRSJjgLXNLZmMrZx2hw88J197aSVCWLyQ15Xdc0Tf5Z9q5jy2dWzu9wUFbrKX8b4Op4rLt/tGq3LrMho+ayGqk3698M3BNzewkuHp2korhIa7C4O2C/sQx0DibzzrivQYMkG0p1hsV3aQAcRNkJT25p0El+HnC0/FIyA2iGsSnPV7Ku0RcOjUWwl7v0zqSgx6hjA0/f/p6XlM8kihLcFKUK95bBYExmGDlkPsaji8Rb8O/F7MEP5J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PjyIqOQnvZ+m2GSN+gJuKgPFgGbS9+jskDkuf8A2qew== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 186c267b-8f8a-4aba-fd7d-08dcfa6b9262 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 11:51:50.5777 (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: /FZE2+J+ES9u+2WxdUN0D2D6SSmqpgWZmBaABZQvxHOf9z7DF3cFcDDdSVUCAos+eykOZ3Tuf10JlbDIcnqRhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6979 This adds a new Broadcast Receiver test, for a Broadcast Sink synchronizing to 2 Broadcasters, using defer setup. ISO Broadcaster Receiver2 Defer - Success --- tools/iso-tester.c | 80 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index 6215fd456..5ec8634ac 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -518,7 +518,8 @@ struct iso_client_data { bool no_poll_errqueue; }; -typedef bool (*iso_defer_accept_t)(struct test_data *data, GIOChannel *io); +typedef bool (*iso_defer_accept_t)(struct test_data *data, GIOChannel *io, + uint8_t num, GIOFunc func); static void mgmt_debug(const char *str, void *user_data) { @@ -1446,6 +1447,16 @@ static const struct iso_client_data bcast_16_2_1_recv_defer = { .big = true, }; +static const struct iso_client_data bcast_16_2_1_recv2_defer = { + .qos = QOS_IN_16_2_1, + .expect_err = 0, + .defer = true, + .bcast = true, + .server = true, + .listen_bind = true, + .big = true, +}; + static const struct iso_client_data bcast_16_2_1_recv_defer_no_bis = { .qos = QOS_IN_16_2_1, .expect_err = 0, @@ -2923,7 +2934,8 @@ static void setup_listen(struct test_data *data, uint8_t num, GIOFunc func) return setup_listen_many(data, 1, &num, &func); } -static bool iso_defer_accept_bcast(struct test_data *data, GIOChannel *io) +static bool iso_defer_accept_bcast(struct test_data *data, GIOChannel *io, + uint8_t num, GIOFunc func) { int sk; char c; @@ -2957,17 +2969,20 @@ static bool iso_defer_accept_bcast(struct test_data *data, GIOChannel *io) tester_print("Accept deferred setup"); - data->io_queue = queue_new(); + if (!data->io_queue) + data->io_queue = queue_new(); + if (data->io_queue) queue_push_tail(data->io_queue, io); - data->io_id[0] = g_io_add_watch(io, G_IO_IN, - iso_accept_cb, NULL); + data->io_id[num] = g_io_add_watch(io, G_IO_IN, + func, NULL); return true; } -static bool iso_defer_accept_ucast(struct test_data *data, GIOChannel *io) +static bool iso_defer_accept_ucast(struct test_data *data, GIOChannel *io, + uint8_t num, GIOFunc func) { int sk; char c; @@ -2997,19 +3012,20 @@ static bool iso_defer_accept_ucast(struct test_data *data, GIOChannel *io) if (data->io_queue) queue_push_tail(data->io_queue, io); - data->io_id[0] = g_io_add_watch(io, G_IO_OUT, - iso_connect_cb, NULL); + data->io_id[num] = g_io_add_watch(io, G_IO_OUT, + func, NULL); return true; } static gboolean iso_accept(GIOChannel *io, GIOCondition cond, - gpointer user_data) + gpointer user_data, uint8_t num, GIOFunc func) { struct test_data *data = tester_get_data(); const struct iso_client_data *isodata = data->test_data; int sk, new_sk; gboolean ret; + GIOChannel *new_io; iso_defer_accept_t iso_defer_accept = isodata->bcast ? iso_defer_accept_bcast : iso_defer_accept_ucast; @@ -3022,26 +3038,32 @@ static gboolean iso_accept(GIOChannel *io, GIOCondition cond, return false; } - io = g_io_channel_unix_new(new_sk); - g_io_channel_set_close_on_unref(io, TRUE); + new_io = g_io_channel_unix_new(new_sk); + g_io_channel_set_close_on_unref(new_io, TRUE); if (isodata->defer) { if (isodata->expect_err < 0) { - g_io_channel_unref(io); + g_io_channel_unref(new_io); tester_test_passed(); return false; } if (isodata->bcast) { - iso_connect(io, cond, user_data); + iso_connect(new_io, cond, user_data); if (!data->step) { - g_io_channel_unref(io); + g_io_channel_unref(new_io); + return false; + } + + /* Return if connection has already been accepted */ + if (queue_find(data->io_queue, NULL, io)) { + g_io_channel_unref(new_io); return false; } } - if (!iso_defer_accept(data, io)) { + if (!iso_defer_accept(data, new_io, num, func)) { tester_warn("Unable to accept deferred setup"); tester_test_failed(); } @@ -3060,9 +3082,9 @@ static gboolean iso_accept(GIOChannel *io, GIOCondition cond, } } - ret = iso_connect(io, cond, user_data); + ret = iso_connect(new_io, cond, user_data); - g_io_channel_unref(io); + g_io_channel_unref(new_io); return ret; } @@ -3070,10 +3092,14 @@ static gboolean iso_accept_cb(GIOChannel *io, GIOCondition cond, gpointer user_data) { struct test_data *data = tester_get_data(); + const struct iso_client_data *isodata = data->test_data; data->io_id[0] = 0; - return iso_accept(io, cond, user_data); + if (isodata->bcast) + return iso_accept(io, cond, user_data, 0, iso_accept_cb); + else + return iso_accept(io, cond, user_data, 0, iso_connect_cb); } static gboolean iso_accept2_cb(GIOChannel *io, GIOCondition cond, @@ -3083,7 +3109,7 @@ static gboolean iso_accept2_cb(GIOChannel *io, GIOCondition cond, data->io_id[1] = 0; - return iso_accept(io, cond, user_data); + return iso_accept(io, cond, user_data, 1, iso_accept2_cb); } static void test_listen(const void *test_data) @@ -3379,6 +3405,17 @@ static void test_bcast_recv_defer(const void *test_data) setup_listen(data, 0, iso_accept_cb); } +static void test_bcast_recv2_defer(const void *test_data) +{ + struct test_data *data = tester_get_data(); + uint8_t num[2] = {0, 1}; + GIOFunc funcs[2] = {iso_accept_cb, iso_accept2_cb}; + + data->step = 2; + + setup_listen_many(data, 2, num, funcs); +} + static void test_connect2_suspend(const void *test_data) { test_connect2(test_data); @@ -3770,6 +3807,11 @@ int main(int argc, char *argv[]) &bcast_16_2_1_recv_defer, setup_powered, test_bcast_recv_defer); + test_iso2("ISO Broadcaster Receiver2 Defer - Success", + &bcast_16_2_1_recv2_defer, + setup_powered, + test_bcast_recv2_defer); + test_iso("ISO Broadcaster Receiver Defer No BIS - Success", &bcast_16_2_1_recv_defer_no_bis, setup_powered,