From 31f37a5c291a55579c58ef51ee969a70e721aa2c Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Sun, 3 Nov 2024 05:00:26 +0100 Subject: [PATCH] tests: bsim: Bluetooth: Enable some high reliability CAP tests Enable some high reliability CAP tests by increasing ISO Tx buffer counts in the Controller to sufficiently generate number of complete when multiple SDUs are transmitted in single ISO interval with use of pre-transmissions. Signed-off-by: Vinayak Kariappa Chettimada --- .../audio/overlay-bt_ll_sw_split.conf | 2 +- ...lay-nrf5340_cpunet_iso-bt_ll_sw_split.conf | 7 ++++ tests/bsim/bluetooth/audio/prj.conf | 2 +- .../bluetooth/audio/src/cap_acceptor_test.c | 13 ++++++- .../bluetooth/audio/src/cap_commander_test.c | 2 +- .../audio/src/cap_initiator_broadcast_test.c | 10 +++--- tests/bsim/bluetooth/audio/sysbuild.cmake | 5 +++ .../audio/test_scripts/cap_broadcast_ac_12.sh | 32 ++++++++--------- .../audio/test_scripts/cap_broadcast_ac_14.sh | 34 +++++++++---------- 9 files changed, 64 insertions(+), 43 deletions(-) create mode 100644 tests/bsim/bluetooth/audio/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf diff --git a/tests/bsim/bluetooth/audio/overlay-bt_ll_sw_split.conf b/tests/bsim/bluetooth/audio/overlay-bt_ll_sw_split.conf index ea37e1be3ed..cf40449c4cc 100644 --- a/tests/bsim/bluetooth/audio/overlay-bt_ll_sw_split.conf +++ b/tests/bsim/bluetooth/audio/overlay-bt_ll_sw_split.conf @@ -77,7 +77,7 @@ CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions CONFIG_BT_CTLR_ISOAL_SOURCES=2 -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions diff --git a/tests/bsim/bluetooth/audio/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf b/tests/bsim/bluetooth/audio/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf new file mode 100644 index 00000000000..4e61f830892 --- /dev/null +++ b/tests/bsim/bluetooth/audio/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -0,0 +1,7 @@ +# In theory, CONFIG_BT_ISO_TX_BUF_COUNT=1, should be sufficient but this count +# is used in the context of IPC which falls into a "Newton's Cradle" effect +# where probably (CONFIG_BT_CTLR_ISO_TX_BUFFERS - CONFIG_BT_ISO_TX_BUF_COUNT) +# buffers get throttled. Hence, always have the value equal or greater. +CONFIG_BT_ISO_TX_BUF_COUNT=18 + +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 4879749ef78..16d251e7e8b 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -51,7 +51,7 @@ CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2 CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_MAX_CHAN=4 CONFIG_BT_ISO_TX_MTU=310 -CONFIG_BT_ISO_TX_BUF_COUNT=4 +CONFIG_BT_ISO_TX_BUF_COUNT=36 CONFIG_BT_ISO_RX_MTU=310 CONFIG_BT_ISO_RX_BUF_COUNT=4 diff --git a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c index a90e090789c..4a4cc6a22c1 100644 --- a/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_acceptor_test.c @@ -39,6 +39,17 @@ #include "bap_common.h" #if defined(CONFIG_BT_CAP_ACCEPTOR) +/* Zephyr Controller works best while Extended Advertising interval to be a multiple + * of the ISO Interval minus 10 ms (max. advertising random delay). This is + * required to place the AUX_ADV_IND PDUs in a non-overlapping interval with the + * Broadcast ISO radio events. + */ +#define BT_LE_EXT_ADV_CONN_CUSTOM \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN, \ + BT_GAP_MS_TO_ADV_INTERVAL(140), \ + BT_GAP_MS_TO_ADV_INTERVAL(140), \ + NULL) + extern enum bst_result_t bst_result; #define SINK_CONTEXT \ @@ -608,7 +619,7 @@ void test_start_adv(void) struct bt_le_ext_adv *ext_adv; /* Create a connectable non-scannable advertising set */ - err = bt_le_ext_adv_create(BT_LE_ADV_CONN_FAST_1, NULL, &ext_adv); + err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN_CUSTOM, NULL, &ext_adv); if (err != 0) { FAIL("Failed to create advertising set (err %d)\n", err); diff --git a/tests/bsim/bluetooth/audio/src/cap_commander_test.c b/tests/bsim/bluetooth/audio/src/cap_commander_test.c index 0b2c1f48ab6..cbd91fe265d 100644 --- a/tests/bsim/bluetooth/audio/src/cap_commander_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_commander_test.c @@ -311,7 +311,7 @@ static bool scan_check_and_sync_broadcast(struct bt_data *data, void *user_data) printk("Found broadcaster with ID 0x%06X and addr %s and sid 0x%02X\n", broadcast_id, le_addr, info->sid); - printk("Adv type %02X interval %u", info->adv_type, info->interval); + printk("Adv type %02X interval %u\n", info->adv_type, info->interval); SET_FLAG(flag_broadcaster_found); diff --git a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c index 98896e40766..ea6eacef4fb 100644 --- a/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c +++ b/tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c @@ -39,15 +39,15 @@ * Broadcast ISO radio events. */ #define BT_LE_EXT_ADV_CUSTOM \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(80), \ - BT_GAP_MS_TO_ADV_INTERVAL(80), NULL) + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(140), \ + BT_GAP_MS_TO_ADV_INTERVAL(140), NULL) #define BT_LE_PER_ADV_CUSTOM \ - BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(90), BT_GAP_MS_TO_PER_ADV_INTERVAL(90), \ - BT_LE_PER_ADV_OPT_NONE) + BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(150), \ + BT_GAP_MS_TO_PER_ADV_INTERVAL(150), BT_LE_PER_ADV_OPT_NONE) #define BROADCAST_STREMT_CNT CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT -#define BROADCAST_ENQUEUE_COUNT 2U +#define BROADCAST_ENQUEUE_COUNT 18U #define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * BROADCAST_STREMT_CNT) #define CAP_AC_MAX_STREAM 2 #define LOCATION (BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT) diff --git a/tests/bsim/bluetooth/audio/sysbuild.cmake b/tests/bsim/bluetooth/audio/sysbuild.cmake index 1b8d10c8db3..5dfd594349c 100644 --- a/tests/bsim/bluetooth/audio/sysbuild.cmake +++ b/tests/bsim/bluetooth/audio/sysbuild.cmake @@ -18,6 +18,11 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC) CACHE INTERNAL "" ) + set(${NET_APP}_EXTRA_CONF_FILE + ${APP_DIR}/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf + CACHE INTERNAL "" + ) + native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP}) endif() diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_12.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_12.sh index 607d6837699..b7fc2721d62 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_12.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_12.sh @@ -51,19 +51,19 @@ Execute_AC_12 48_5_1 Execute_AC_12 48_6_1 # High reliability -# Execute_AC_12 8_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 8_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 16_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 16_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 24_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 24_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 32_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 32_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 441_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 441_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 48_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 48_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 48_3_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 48_4_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 48_5_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_12 48_6_2 # BT_ISO_FLAGS_ERROR +Execute_AC_12 8_1_2 +Execute_AC_12 8_2_2 +Execute_AC_12 16_1_2 +Execute_AC_12 16_2_2 +Execute_AC_12 24_1_2 +Execute_AC_12 24_2_2 +Execute_AC_12 32_1_2 +Execute_AC_12 32_2_2 +# Execute_AC_12 441_1_2 # BT_ISO_FLAGS_LOST +# Execute_AC_12 441_2_2 # BT_ISO_FLAGS_LOST +Execute_AC_12 48_1_2 +Execute_AC_12 48_2_2 +Execute_AC_12 48_3_2 +Execute_AC_12 48_4_2 +Execute_AC_12 48_5_2 +Execute_AC_12 48_6_2 diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_14.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_14.sh index 0ac6ed685fb..1b5484a42ac 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_14.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_broadcast_ac_14.sh @@ -41,9 +41,7 @@ Execute_AC_14 24_1_1 Execute_AC_14 24_2_1 Execute_AC_14 32_1_1 Execute_AC_14 32_2_1 -# ASSERTION FAIL [err == ((isoal_status_t) 0x00) || err == ((isoal_status_t) 0x04)] -# @ WEST_TOPDIR/zephyr/subsys/bluetooth/controller/hci/hci_driver.c:513 -# Execute_AC_14 441_1_1 +Execute_AC_14 441_1_1 # ASSERTION FAIL [err == ((isoal_status_t) 0x00) || err == ((isoal_status_t) 0x04)] # @ WEST_TOPDIR/zephyr/subsys/bluetooth/controller/hci/hci_driver.c:513 # Execute_AC_14 441_2_1 @@ -55,19 +53,19 @@ Execute_AC_14 48_5_1 Execute_AC_14 48_6_1 # High reliability -# Execute_AC_14 8_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 8_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 16_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 16_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 24_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 24_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 32_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 32_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 441_1_2 # BT_ISO_FLAGS_ERROR +Execute_AC_14 8_1_2 +Execute_AC_14 8_2_2 +Execute_AC_14 16_1_2 +Execute_AC_14 16_2_2 +Execute_AC_14 24_1_2 +Execute_AC_14 24_2_2 +Execute_AC_14 32_1_2 +Execute_AC_14 32_2_2 +# Execute_AC_14 441_1_2 # BT_ISO_FLAGS_LOST # Execute_AC_14 441_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 48_1_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 48_2_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 48_3_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 48_4_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 48_5_2 # BT_ISO_FLAGS_ERROR -# Execute_AC_14 48_6_2 # BT_ISO_FLAGS_ERROR +Execute_AC_14 48_1_2 +Execute_AC_14 48_2_2 +Execute_AC_14 48_3_2 +Execute_AC_14 48_4_2 +# Execute_AC_14 48_5_2 # BT_ISO_FLAGS_ERROR +# Execute_AC_14 48_6_2 # BT_ISO_FLAGS_ERROR