Skip to contentSkip to conversation

iso-tester: Add BAP Broadcast AC tests

PATCH In review Iulia Tanasescu 3 participants 5 messages May 29, 2023 – May 30, 2023 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

cover iso-tester: Add BAP Broadcast AC tests

This patch series adds 3 additional iso-tester tests, based on the BAP Broadcast Audio Configurations.

Since Audio configuration 13 requires a Broadcast Source to create a BIG with 2 BISes, this support has been added in btdev. This implementation also depends on the kernel support for multiple BISes, introduced by the following patch:

https://patchwork.kernel.org/project/bluetooth/patch/[email protected]/

Iulia Tanasescu (2):
btdev: Support multiple BIS
iso-tester: Add BAP Broadcast AC tests

 emulator/btdev.c   |  52 +++++++-----
 tools/iso-tester.c | 193 ++++++++++++++++++++++++++++++++++++---------
 2 files changed, 190 insertions(+), 55 deletions(-)

base-commit: 7002ecc8914ab1f22e36bd98c4d46eb760edf767

Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 btdev: Support multiple BIS

This adds support for creating a BIG with multiple BISes.

---
 emulator/btdev.c | 52 ++++++++++++++++++++++++++++++------------------
 1 file changed, 33 insertions(+), 19 deletions(-)
emulator/btdev.c +33 -19
index f9260511a..2e15d5af2 100644
@@ -6101,35 +6101,49 @@ static int cmd_create_big_complete(struct btdev *dev, const void *data,
 	const struct bt_hci_cmd_le_create_big *cmd = data;
 	const struct bt_hci_bis *bis = &cmd->bis;
 	int i;
+	struct bt_hci_evt_le_big_complete evt;
+	uint16_t *bis_handle;
+	uint8_t *pdu;
+	uint8_t pdu_len;
+
+	pdu_len = sizeof(evt) + cmd->num_bis * sizeof(*bis_handle);
+
+	pdu = malloc(pdu_len);
+	if (!pdu)
+		return -ENOMEM;
+
+	bis_handle = (uint16_t *)(pdu + sizeof(evt));
+
+	memset(&evt, 0, sizeof(evt));
 
 	for (i = 0; i < cmd->num_bis; i++) {
 		struct btdev_conn *conn;
-		struct {
-			struct bt_hci_evt_le_big_complete evt;
-			uint16_t handle;
-		} pdu;
-
-		memset(&pdu, 0, sizeof(pdu));
 
-		conn = conn_add_bis(dev, ISO_HANDLE, bis);
+		conn = conn_add_bis(dev, ISO_HANDLE + i, bis);
 		if (!conn) {
-			pdu.evt.status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
+			evt.status = BT_HCI_ERR_MEM_CAPACITY_EXCEEDED;
 			goto done;
 		}
 
-		pdu.evt.handle = cmd->handle;
-		pdu.evt.num_bis++;
-		pdu.evt.phy = bis->phy;
-		pdu.evt.max_pdu = bis->sdu;
-		memcpy(pdu.evt.sync_delay, bis->sdu_interval, 3);
-		memcpy(pdu.evt.latency, bis->sdu_interval, 3);
-		pdu.evt.interval = bis->latency / 1.25;
-		pdu.handle = cpu_to_le16(conn->handle);
+		*bis_handle = cpu_to_le16(conn->handle);
+		bis_handle++;
+	}
+
+	evt.handle = cmd->handle;
+	evt.phy = bis->phy;
+	evt.max_pdu = bis->sdu;
+	memcpy(evt.sync_delay, bis->sdu_interval, 3);
+	memcpy(evt.latency, bis->sdu_interval, 3);
+	evt.interval = bis->latency / 1.25;
+	evt.num_bis = cmd->num_bis;
 
 done:
-		le_meta_event(dev, BT_HCI_EVT_LE_BIG_COMPLETE, &pdu,
-					sizeof(pdu));
-	}
+	memcpy(pdu, &evt, sizeof(evt));
+
+	le_meta_event(dev, BT_HCI_EVT_LE_BIG_COMPLETE, pdu,
+						pdu_len);
+
+	free(pdu);
 
 	return 0;
 }
Signature · 1 line
2.34.1
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=751751

---Test result---

Test Summary:

CheckPatch                    PASS      1.19 seconds
GitLint                       PASS      0.70 seconds
BuildEll                      PASS      27.73 seconds
BluezMake                     PASS      1133.60 seconds
MakeCheck                     PASS      11.93 seconds
MakeDistcheck                 PASS      165.18 seconds
CheckValgrind                 PASS      267.18 seconds
CheckSmatch                   WARNING   362.33 seconds
bluezmakeextell               PASS      109.58 seconds
IncrementalBuild              PASS      1875.52 seconds
ScanBuild                     PASS      1087.08 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:416:29: warning: Variable length array is used.

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH 2/2 iso-tester: Add BAP Broadcast AC tests

In reply to Iulia Tanasescu

This adds the following tests based on BAP Broadcast Audio Configurations:

ISO Broadcaster AC 12 - Success
ISO Broadcaster AC 13 - Success
ISO Broadcaster AC 14 - Success

---
 tools/iso-tester.c | 193 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 157 insertions(+), 36 deletions(-)
tools/iso-tester.c +157 -36
index 63c37bd52..ae6ddb2da 100644
@@ -288,6 +288,90 @@
 #define QOS_IN_16_2_1 BCAST_QOS_IN(10000, 10, 40, 0x02, 2)
 #define QOS_IN_ENC_16_2_1 BCAST_QOS_IN_ENC(10000, 10, 40, 0x02, 2)
 
+static const uint8_t base_lc3_16_2_1[] = {
+	0x28, 0x00, 0x00, /* Presentation Delay */
+	0x01, /* Number of Subgroups */
+	0x01, /* Number of BIS */
+	0x06, 0x00, 0x00, 0x00, 0x00, /* Code ID = LC3 (0x06) */
+	0x11, /* Codec Specific Configuration */
+	0x02, 0x01, 0x03, /* 16 KHZ */
+	0x02, 0x02, 0x01, /* 10 ms */
+	0x05, 0x03, 0x01, 0x00, 0x00, 0x00,  /* Front Left */
+	0x03, 0x04, 0x28, 0x00, /* Frame Length 40 bytes */
+	0x04, /* Metadata */
+	0x03, 0x02, 0x02, 0x00, /* Audio Context: Convertional */
+	0x01, /* BIS */
+	0x00, /* Codec Specific Configuration */
+};
+
+/* Single Audio Channel. One BIS. */
+#define BCAST_AC_12 BCAST_QOS_OUT_1_1(10000, 10, 40, 0x02, 2)
+
+static const uint8_t base_lc3_ac_12[] = {
+	0x28, 0x00, 0x00, /* Presentation Delay */
+	0x01, /* Number of Subgroups */
+	0x01, /* Number of BIS */
+	0x06, 0x00, 0x00, 0x00, 0x00, /* Code ID = LC3 (0x06) */
+	0x11, /* Codec Specific Configuration */
+	0x02, 0x01, 0x03, /* 16 KHZ */
+	0x02, 0x02, 0x01, /* 10 ms */
+	0x05, 0x03, 0x01, 0x00, 0x00, 0x00,  /* Front Left */
+	0x03, 0x04, 0x28, 0x00, /* Frame Length 40 bytes */
+	0x04, /* Metadata */
+	0x03, 0x02, 0x02, 0x00, /* Audio Context: Convertional */
+	0x01, /* BIS */
+	0x00, /* Codec Specific Configuration */
+};
+
+/* Multiple Audio Channels. Two BISes. */
+#define BCAST_AC_13 BCAST_QOS_OUT_1_1(10000, 10, 40, 0x02, 2)
+
+static const uint8_t base_lc3_ac_13[] = {
+	0x28, 0x00, 0x00, /* Presentation Delay */
+	0x01, /* Number of Subgroups */
+	0x02, /* Number of BIS */
+	0x06, 0x00, 0x00, 0x00, 0x00, /* Code ID = LC3 (0x06) */
+	0x11, /* Codec Specific Configuration */
+	0x02, 0x01, 0x03, /* 16 KHZ */
+	0x02, 0x02, 0x01, /* 10 ms */
+	0x05, 0x03, 0x01, 0x00, 0x00, 0x00,  /* Front Left */
+	0x03, 0x04, 0x28, 0x00, /* Frame Length 40 bytes */
+	0x04, /* Metadata */
+	0x03, 0x02, 0x02, 0x00, /* Audio Context: Convertional */
+	0x01, /* BIS 1 */
+	0x06, /* Codec Specific Configuration */
+	0x05, 0x03, 0x01, 0x00, 0x00, 0x00, /* Audio_Channel_Allocation:
+					     * Front left
+					     */
+	0x01, /* BIS 2 */
+	0x06, /* Codec Specific Configuration */
+	0x05, 0x03, 0x02, 0x00, 0x00, 0x00, /* Audio_Channel_Allocation:
+					     * Front right
+					     */
+};
+
+/* Multiple Audio Channels. One BIS. */
+#define BCAST_AC_14 BCAST_QOS_OUT_1_1(10000, 10, 40, 0x02, 2)
+
+static const uint8_t base_lc3_ac_14[] = {
+	0x28, 0x00, 0x00, /* Presentation Delay */
+	0x01, /* Number of Subgroups */
+	0x01, /* Number of BIS */
+	0x06, 0x00, 0x00, 0x00, 0x00, /* Code ID = LC3 (0x06) */
+	0x11, /* Codec Specific Configuration */
+	0x02, 0x01, 0x03, /* 16 KHZ */
+	0x02, 0x02, 0x01, /* 10 ms */
+	0x05, 0x03, 0x01, 0x00, 0x00, 0x00,  /* Front Left */
+	0x03, 0x04, 0x28, 0x00, /* Frame Length 40 bytes */
+	0x04, /* Metadata */
+	0x03, 0x02, 0x02, 0x00, /* Audio Context: Convertional */
+	0x01, /* BIS */
+	0x06, /* Codec Specific Configuration */
+	0x05, 0x03, 0x03, 0x00, 0x00, 0x00, /* Audio_Channel_Allocation:
+					     * Front left, Front right
+					     */
+};
+
 struct test_data {
 	const void *test_data;
 	struct mgmt *mgmt;
@@ -315,7 +399,9 @@ struct iso_client_data {
 	bool defer;
 	bool disconnect;
 	bool ts;
-	bool mcis;
+	bool mconn;
+	const uint8_t *base;
+	size_t base_len;
 };
 
 static void mgmt_debug(const char *str, void *user_data)
@@ -835,7 +921,7 @@ static const struct iso_client_data connect_ac_6i = {
 	.qos = AC_6i_1,
 	.qos_2 = AC_6i_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -843,7 +929,7 @@ static const struct iso_client_data connect_ac_6ii = {
 	.qos = AC_6ii_1,
 	.qos_2 = AC_6ii_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -851,7 +937,7 @@ static const struct iso_client_data connect_ac_7i = {
 	.qos = AC_7i_1,
 	.qos_2 = AC_7i_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -859,7 +945,7 @@ static const struct iso_client_data connect_ac_7ii = {
 	.qos = AC_7ii_1,
 	.qos_2 = AC_7ii_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -867,7 +953,7 @@ static const struct iso_client_data connect_ac_8i = {
 	.qos = AC_8i_1,
 	.qos_2 = AC_8i_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -875,7 +961,7 @@ static const struct iso_client_data connect_ac_8ii = {
 	.qos = AC_8ii_1,
 	.qos_2 = AC_8ii_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -883,7 +969,7 @@ static const struct iso_client_data connect_ac_9i = {
 	.qos = AC_9i_1,
 	.qos_2 = AC_9i_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -891,7 +977,7 @@ static const struct iso_client_data connect_ac_9ii = {
 	.qos = AC_9ii_1,
 	.qos_2 = AC_9ii_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -899,7 +985,7 @@ static const struct iso_client_data connect_ac_11i = {
 	.qos = AC_11i_1,
 	.qos_2 = AC_11i_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -907,7 +993,7 @@ static const struct iso_client_data connect_ac_11ii = {
 	.qos = AC_11ii_1,
 	.qos_2 = AC_11ii_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 	.defer = true,
 };
 
@@ -915,14 +1001,14 @@ static const struct iso_client_data connect_ac_1_2 = {
 	.qos = AC_1_4,
 	.qos_2 = AC_2_10,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 };
 
 static const struct iso_client_data connect_ac_1_2_cig_1_2 = {
 	.qos = AC_1_4_1,
 	.qos_2 = AC_2_10_2,
 	.expect_err = 0,
-	.mcis = true,
+	.mconn = true,
 };
 
 static const struct iso_client_data bcast_16_2_1_send = {
@@ -930,6 +1016,8 @@ static const struct iso_client_data bcast_16_2_1_send = {
 	.expect_err = 0,
 	.send = &send_16_2_1,
 	.bcast = true,
+	.base = base_lc3_16_2_1,
+	.base_len = sizeof(base_lc3_16_2_1),
 };
 
 static const struct iso_client_data bcast_enc_16_2_1_send = {
@@ -937,6 +1025,8 @@ static const struct iso_client_data bcast_enc_16_2_1_send = {
 	.expect_err = 0,
 	.send = &send_16_2_1,
 	.bcast = true,
+	.base = base_lc3_16_2_1,
+	.base_len = sizeof(base_lc3_16_2_1),
 };
 
 static const struct iso_client_data bcast_1_16_2_1_send = {
@@ -944,6 +1034,8 @@ static const struct iso_client_data bcast_1_16_2_1_send = {
 	.expect_err = 0,
 	.send = &send_16_2_1,
 	.bcast = true,
+	.base = base_lc3_16_2_1,
+	.base_len = sizeof(base_lc3_16_2_1),
 };
 
 static const struct iso_client_data bcast_1_1_16_2_1_send = {
@@ -951,6 +1043,8 @@ static const struct iso_client_data bcast_1_1_16_2_1_send = {
 	.expect_err = 0,
 	.send = &send_16_2_1,
 	.bcast = true,
+	.base = base_lc3_16_2_1,
+	.base_len = sizeof(base_lc3_16_2_1),
 };
 
 static const struct iso_client_data bcast_16_2_1_recv = {
@@ -969,6 +1063,31 @@ static const struct iso_client_data bcast_enc_16_2_1_recv = {
 	.server = true,
 };
 
+static const struct iso_client_data bcast_ac_12 = {
+	.qos = BCAST_AC_12,
+	.expect_err = 0,
+	.bcast = true,
+	.base = base_lc3_ac_12,
+	.base_len = sizeof(base_lc3_ac_12),
+};
+
+static const struct iso_client_data bcast_ac_13 = {
+	.qos = BCAST_AC_13,
+	.expect_err = 0,
+	.bcast = true,
+	.mconn = true,
+	.base = base_lc3_ac_13,
+	.base_len = sizeof(base_lc3_ac_13),
+};
+
+static const struct iso_client_data bcast_ac_14 = {
+	.qos = BCAST_AC_14,
+	.expect_err = 0,
+	.bcast = true,
+	.base = base_lc3_ac_14,
+	.base_len = sizeof(base_lc3_ac_14),
+};
+
 static void client_connectable_complete(uint16_t opcode, uint8_t status,
 					const void *param, uint8_t len,
 					void *user_data)
@@ -1255,22 +1374,6 @@ static int create_iso_sock(struct test_data *data)
 	return sk;
 }
 
-static const uint8_t base_lc3_16_2_1[] = {
-	0x28, 0x00, 0x00, /* Presentation Delay */
-	0x01, /* Number of Subgroups */
-	0x01, /* Number of BIS */
-	0x06, 0x00, 0x00, 0x00, 0x00, /* Code ID = LC3 (0x06) */
-	0x11, /* Codec Specific Configuration */
-	0x02, 0x01, 0x03, /* 16 KHZ */
-	0x02, 0x02, 0x01, /* 10 ms */
-	0x05, 0x03, 0x01, 0x00, 0x00, 0x00,  /* Front Left */
-	0x03, 0x04, 0x28, 0x00, /* Frame Length 40 bytes */
-	0x04, /* Metadata */
-	0x03, 0x02, 0x02, 0x00, /* Audio Context: Convertional */
-	0x01, /* BIS */
-	0x00, /* Codec Specific Configuration */
-};
-
 static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
 {
 	const struct iso_client_data *isodata = data->test_data;
@@ -1283,7 +1386,7 @@ static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
 
 	client = hciemu_get_client(data->hciemu, num);
 	if (!client) {
-		if (!isodata->mcis) {
+		if (!isodata->mconn) {
 			tester_warn("No client");
 			return -ENODEV;
 		}
@@ -1295,7 +1398,7 @@ static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
 		}
 	}
 
-	if (num && isodata->mcis)
+	if (!isodata->bcast && num && isodata->mconn)
 		qos = &isodata->qos_2;
 
 	if (!isodata->bcast) {
@@ -1304,9 +1407,9 @@ static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
 			tester_warn("No client bdaddr");
 			return -ENODEV;
 		}
-	} else {
+	} else if (!isodata->server) {
 		err = setsockopt(sk, SOL_BLUETOOTH, BT_ISO_BASE,
-				base_lc3_16_2_1, sizeof(base_lc3_16_2_1));
+				isodata->base, isodata->base_len);
 		if (err < 0) {
 			tester_warn("Can't set socket BT_ISO_BASE option: "
 					"%s (%d)", strerror(errno), errno);
@@ -1323,7 +1426,7 @@ static int connect_iso_sock(struct test_data *data, uint8_t num, int sk)
 		return -EINVAL;
 	}
 
-	if (isodata->defer) {
+	if (isodata->defer || (isodata->bcast && isodata->mconn && !num)) {
 		int opt = 1;
 
 		if (setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP, &opt,
@@ -1694,7 +1797,7 @@ static gboolean iso_connect(GIOChannel *io, GIOCondition cond,
 
 	if (!isodata->bcast) {
 		ret = check_ucast_qos(&qos, &isodata->qos,
-				      isodata->mcis ? &isodata->qos_2 : NULL);
+				      isodata->mconn ? &isodata->qos_2 : NULL);
 	} else if (!isodata->server)
 		ret = check_bcast_qos(&qos, &isodata->qos);
 
@@ -1879,7 +1982,7 @@ static void test_connect(const void *test_data)
 	func[n++] = iso_connect_cb;
 
 	/* Check if configuration requires multiple CIS setup */
-	if (!isodata->bcast && isodata->mcis)
+	if (!isodata->bcast && isodata->mconn)
 		func[n++] = iso_connect2_cb;
 
 	setup_connect_many(data, n, num, func);
@@ -2179,6 +2282,15 @@ static void test_bcast(const void *test_data)
 	setup_connect(data, 0, iso_connect_cb);
 }
 
+static void test_bcast2(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	uint8_t num[2] = {0, 1};
+	GIOFunc funcs[2] = {iso_connect_cb, iso_connect2_cb};
+
+	setup_connect_many(data, 2, num, funcs);
+}
+
 static void test_bcast_recv(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -2431,5 +2543,14 @@ int main(int argc, char *argv[])
 							setup_powered,
 							test_bcast_recv);
 
+	test_iso("ISO Broadcaster AC 12 - Success", &bcast_ac_12, setup_powered,
+							test_bcast);
+
+	test_iso("ISO Broadcaster AC 13 - Success", &bcast_ac_13, setup_powered,
+							test_bcast2);
+
+	test_iso("ISO Broadcaster AC 14 - Success", &bcast_ac_14, setup_powered,
+							test_bcast);
+
 	return tester_run();
 }
Signature · 1 line
2.34.1
#4 lore raw
In reply to Iulia Tanasescu
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Mon, 29 May 2023 09:24:56 +0300 you wrote:

This patch series adds 3 additional iso-tester tests, based on the BAP Broadcast Audio Configurations.

Since Audio configuration 13 requires a Broadcast Source to create a BIG with 2 BISes, this support has been added in btdev. This implementation also depends on the kernel support for multiple BISes, introduced by the following patch:

[...]

Here is the summary with links:
- [BlueZ,1/2] btdev: Support multiple BIS

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=97edc78bd81f

- [BlueZ,2/2] iso-tester: Add BAP Broadcast AC tests (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html