Skip to content

Commit 2935d3b

Browse files
cvinayakcarlescufi
authored andcommitted
tests: bsim: Bluetooth: Test RTN=2, FT=2, Per skip 2 SE in Controller
Test RTN=2, FT=2 in Controller with 2 subevents dropped by peripheral. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 61d0046 commit 2935d3b

File tree

7 files changed

+83
-8
lines changed

7 files changed

+83
-8
lines changed

subsys/bluetooth/controller/ll_sw/nordic/lll/lll_peripheral_iso.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,14 @@ static void isr_rx(void *param)
472472
cis_lll = param;
473473

474474
/* No Rx */
475-
if (!trx_done) {
475+
if (!trx_done ||
476+
#if defined(CONFIG_TEST_FT_PER_SKIP_SUBEVENTS)
477+
((((cis_lll->event_count % 3U) < CONFIG_TEST_FT_PER_SKIP_EVENTS_COUNT) &&
478+
((se_curr > cis_lll->nse) || (se_curr <= 2U))) ||
479+
(((cis_lll->event_count % 3U) < (CONFIG_TEST_FT_PER_SKIP_EVENTS_COUNT + 1U)) &&
480+
((se_curr > cis_lll->nse) || (se_curr <= 1U)))) ||
481+
#endif
482+
false) {
476483
payload_count_flush(cis_lll);
477484

478485
/* Next subevent or next CIS */

tests/bsim/bluetooth/ll/cis/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ config TEST_MULTIPLE_PERIPERAL_CIS
1616
help
1717
Multiple Peripheral CIS establishment.
1818

19+
config TEST_FT_SKIP_SUBEVENTS
20+
bool
21+
help
22+
Skip central and/or peripheral subevent reception to test flush
23+
timeout implementation.
24+
25+
config TEST_FT_PER_SKIP_SUBEVENTS
26+
bool "Skip peripheral role subevents to test Flush Timeout"
27+
select TEST_FT_SKIP_SUBEVENTS
28+
help
29+
Skip peripheral role subevent reception to test flush timeout
30+
implementation.
31+
32+
config TEST_FT_PER_SKIP_EVENTS_COUNT
33+
int "Skip peripheral ISO events count, all subevents in them"
34+
depends on TEST_FT_PER_SKIP_SUBEVENTS
35+
help
36+
Skip peripheral ISO events count where all subevents are skipped.
37+
1938
config BT_CTLR_SCAN_UNRESERVED
2039
default y if TEST_CONNECT_ACL_FIRST
2140
help
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CONFIG_TEST_USE_LEGACY_ADVERTISING=n
2+
CONFIG_TEST_CONNECT_ACL_FIRST=y
3+
CONFIG_TEST_FT_PER_SKIP_SUBEVENTS=y
4+
CONFIG_TEST_FT_PER_SKIP_EVENTS_COUNT=1
5+
CONFIG_BT_MAX_CONN=1
6+
CONFIG_BT_ISO_MAX_CHAN=1
7+
CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=9
8+
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
9+
CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y

tests/bsim/bluetooth/ll/cis/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CONFIG_BT_MAX_CONN=9
1313
CONFIG_BT_ISO_MAX_CHAN=9
1414
CONFIG_BT_ISO_TX_BUF_COUNT=18
1515
CONFIG_BT_ISO_TX_MTU=120
16+
CONFIG_BT_ISO_RX_MTU=120
1617

1718
CONFIG_BT_BUF_CMD_TX_SIZE=255
1819
CONFIG_BT_BUF_EVT_RX_SIZE=255

tests/bsim/bluetooth/ll/cis/src/main.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static bt_addr_le_t peer_addr;
5353

5454
#define ISO_INTERVAL_US 10000U
5555
#define ISO_LATENCY_MS DIV_ROUND_UP(ISO_INTERVAL_US, USEC_PER_MSEC)
56+
#define ISO_LATENCY_FT_MS 20U
5657

5758
#define BT_CONN_US_TO_INTERVAL(t) ((uint16_t)((t) * 4U / 5U / USEC_PER_MSEC))
5859

@@ -103,7 +104,7 @@ static bt_addr_le_t peer_addr;
103104

104105
#define NAME_LEN 30
105106

106-
#define BUF_ALLOC_TIMEOUT (30) /* milliseconds */
107+
#define BUF_ALLOC_TIMEOUT (40) /* milliseconds */
107108
NET_BUF_POOL_FIXED_DEFINE(tx_pool, CONFIG_BT_ISO_TX_BUF_COUNT,
108109
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), 8, NULL);
109110

@@ -300,8 +301,11 @@ static void iso_recv(struct bt_iso_chan *chan, const struct bt_iso_recv_info *in
300301
expected_seq_num[index] = seq_num;
301302
}
302303

303-
expected_seq_num[index]++;
304+
expected_seq_num[index] += 1U;
304305

306+
#if defined(CONFIG_TEST_FT_SKIP_SUBEVENTS)
307+
expected_seq_num[index] += ((CONFIG_TEST_FT_PER_SKIP_EVENTS_COUNT - 1U) * 2U);
308+
#endif
305309
} else if (expected_seq_num[index] &&
306310
expected_seq_num[index] < SEQ_NUM_MAX) {
307311
FAIL("%s: Invalid ISO data after valid ISO data reception.\n"
@@ -361,7 +365,11 @@ static void test_cis_central(void)
361365
for (int i = 0; i < CONFIG_BT_ISO_MAX_CHAN; i++) {
362366
iso_tx[i].sdu = CONFIG_BT_ISO_TX_MTU;
363367
iso_tx[i].phy = BT_GAP_LE_PHY_2M;
364-
iso_tx[i].rtn = 0U;
368+
if (IS_ENABLED(CONFIG_TEST_FT_SKIP_SUBEVENTS)) {
369+
iso_tx[i].rtn = 2U;
370+
} else {
371+
iso_tx[i].rtn = 0U;
372+
}
365373
iso_tx[i].path = NULL;
366374

367375
iso_qos[i].tx = &iso_tx[i];
@@ -381,7 +389,11 @@ static void test_cis_central(void)
381389
cig_param.sca = BT_GAP_SCA_UNKNOWN;
382390
cig_param.packing = 0U;
383391
cig_param.framing = 0U;
384-
cig_param.latency = ISO_LATENCY_MS;
392+
if (IS_ENABLED(CONFIG_TEST_FT_SKIP_SUBEVENTS)) {
393+
cig_param.latency = ISO_LATENCY_FT_MS;
394+
} else {
395+
cig_param.latency = ISO_LATENCY_MS;
396+
}
385397
cig_param.interval = ISO_INTERVAL_US;
386398

387399
printk("Create CIG...");
@@ -404,7 +416,7 @@ static void test_cis_central(void)
404416
uint8_t conn_index;
405417
uint8_t chan;
406418

407-
printk("Start scanning...");
419+
printk("Start scanning (%d)...", i);
408420
err = bt_le_scan_start(BT_LE_SCAN_CUSTOM, NULL);
409421
if (err) {
410422
FAIL("Could not start scan: %d\n", err);
@@ -510,7 +522,7 @@ static void test_cis_central(void)
510522
ret = bt_iso_chan_send(&iso_chan[chan], buf,
511523
seq_num, BT_ISO_TIMESTAMP_NONE);
512524
if (ret < 0) {
513-
FAIL("Unable to broadcast data on channel %u"
525+
FAIL("Unable to send data on channel %u"
514526
" : %d\n", chan, ret);
515527
net_buf_unref(buf);
516528
return;
@@ -522,7 +534,7 @@ static void test_cis_central(void)
522534
}
523535
}
524536

525-
k_sleep(K_MSEC(100));
537+
k_sleep(K_MSEC(1000));
526538

527539
for (uint8_t chan = 0U; chan < CONFIG_BT_ISO_MAX_CHAN; chan++) {
528540
printk("ISO disconnect channel %u...", chan);
@@ -587,6 +599,8 @@ static int iso_accept(const struct bt_iso_accept_info *info,
587599
*chan = &iso_chan_p[chan_count];
588600
chan_count++;
589601

602+
printk("Accepted on channel %p\n", *chan);
603+
590604
return 0;
591605
}
592606

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2020 Nordic Semiconductor ASA
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
6+
7+
# Basic Connected ISO test: a Central connects to 1 Peripheral and tests RTN=2,
8+
# FT=2, skips 2 subevents in the peripheral
9+
simulation_id="connected_iso_acl_first_ft_per_skip_2_se"
10+
verbosity_level=2
11+
EXECUTE_TIMEOUT=60
12+
13+
cd ${BSIM_OUT_PATH}/bin
14+
15+
Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_cis_prj_conf_overlay-acl_first_ft_per_skip_2_se_conf \
16+
-v=${verbosity_level} -s=${simulation_id} -d=0 -testid=central
17+
18+
Execute ./bs_${BOARD}_tests_bsim_bluetooth_ll_cis_prj_conf_overlay-acl_first_ft_per_skip_2_se_conf \
19+
-v=${verbosity_level} -s=${simulation_id} -d=1 -testid=peripheral
20+
21+
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
22+
-D=2 -sim_length=30e6 $@
23+
24+
wait_for_background_jobs

tests/bsim/bluetooth/ll/compile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-legacy_adv_acl_first.conf c
3939
app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-acl_group.conf compile
4040
app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-acl_group_acl_first.conf compile
4141
app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-peripheral_cis.conf compile
42+
app=tests/bsim/bluetooth/ll/cis conf_overlay=overlay-acl_first_ft_per_skip_2_se.conf compile
4243

4344
app=tests/bsim/bluetooth/ll/edtt/hci_test_app \
4445
conf_file=prj_dut_llcp.conf compile

0 commit comments

Comments
 (0)