Skip to content

Commit a43b893

Browse files
PavelVPVkartben
authored andcommitted
tests: bsim: bluetooth: host: add hci driver stress test
This commit adds a stress test to verify that the HCI driver does not drop any data. Specifically, it tests whether the HCI IPC driver can reliably pass data between the Host and Controller. Due to the current HCI IPC driver implementation, this test is guaranteed to fail if Controller-to-Host HCI ACL data flow control is disabled. Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent bab10c0 commit a43b893

File tree

11 files changed

+735
-0
lines changed

11 files changed

+735
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
5+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6+
project(bsim_test_gatt)
7+
8+
add_subdirectory(${ZEPHYR_BASE}/tests/bsim/babblekit babblekit)
9+
target_link_libraries(app PRIVATE babblekit)
10+
11+
FILE(GLOB app_sources src/*.c)
12+
target_sources(app PRIVATE ${app_sources} )
13+
14+
zephyr_include_directories(
15+
${BSIM_COMPONENTS_PATH}/libUtilv1/src/
16+
${BSIM_COMPONENTS_PATH}/libPhyComv1/src/
17+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
source "share/sysbuild/Kconfig"
5+
6+
config NET_CORE_BOARD
7+
string
8+
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP"
9+
10+
config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX
11+
int
12+
# Let's pass the test arguments to the application MCU test
13+
# otherwise by default they would have gone to the net core.
14+
default 0 if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CONFIG_IPC_SERVICE=y
2+
CONFIG_MBOX=y
3+
CONFIG_ISR_STACK_SIZE=1024
4+
CONFIG_IDLE_STACK_SIZE=256
5+
CONFIG_MAIN_STACK_SIZE=512
6+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
7+
CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512
8+
CONFIG_HEAP_MEM_POOL_SIZE=4096
9+
CONFIG_CBPRINTF_REDUCED_INTEGRAL=y
10+
CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
11+
12+
CONFIG_BT=y
13+
CONFIG_BT_HCI_RAW=y
14+
CONFIG_BT_MAX_CONN=1
15+
16+
# Controller
17+
CONFIG_BT_LL_SW_SPLIT=y
18+
CONFIG_BT_CTLR_ASSERT_HANDLER=y
19+
20+
CONFIG_BT_CTLR_DATA_LENGTH_MAX=70
21+
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191
22+
CONFIG_BT_CTLR_RX_BUFFERS=10
23+
24+
CONFIG_BT_BUF_CMD_TX_SIZE=65
25+
CONFIG_BT_BUF_EVT_RX_SIZE=68
26+
CONFIG_BT_BUF_EVT_RX_COUNT=17
27+
CONFIG_BT_BUF_ACL_TX_COUNT=16
28+
CONFIG_BT_BUF_ACL_TX_SIZE=70
29+
CONFIG_BT_BUF_ACL_RX_SIZE=70
30+
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=1
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
CONFIG_BT=y
2+
CONFIG_BT_DEVICE_NAME="GATT tester"
3+
CONFIG_BT_PERIPHERAL=y
4+
CONFIG_BT_CENTRAL=y
5+
CONFIG_BT_GATT_CLIENT=y
6+
7+
CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y
8+
9+
CONFIG_BT_SMP=y
10+
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
11+
CONFIG_BT_L2CAP_ECRED=y
12+
CONFIG_BT_EATT=y
13+
14+
CONFIG_BT_AUTO_PHY_UPDATE=n
15+
CONFIG_BT_AUTO_DATA_LEN_UPDATE=n
16+
17+
CONFIG_ASSERT=y
18+
CONFIG_BT_TESTING=y
19+
CONFIG_LOG=y
20+
21+
# Maximum possible EATT channels are used to parallelize notifications as much as possible,
22+
# increasing traffic towards Central.
23+
CONFIG_BT_EATT_MAX=16
24+
25+
# This is aligned with CONFIG_BT_EATT_MAX to utilize all EATT channels
26+
CONFIG_BT_BUF_ACL_TX_COUNT=16
27+
28+
# Aligned with characteristic size
29+
CONFIG_BT_BUF_ACL_RX_SIZE=70
30+
CONFIG_BT_BUF_ACL_TX_SIZE=70
31+
32+
CONFIG_BT_BUF_EVT_RX_COUNT=17
33+
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=1
34+
35+
CONFIG_BT_BUF_CMD_TX_COUNT=2
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Common macros used by both sides of the test
3+
*
4+
* Copyright (c) 2025 Nordic Semiconductor ASA
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
#include <zephyr/toolchain.h>
10+
11+
#define CHRC_SIZE 60
12+
13+
#define TEST_SERVICE_UUID \
14+
BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, \
15+
0x07, 0x08, 0x09, 0x00, 0x00)
16+
17+
#define TEST_CHRC_UUID \
18+
BT_UUID_DECLARE_128(0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, \
19+
0x07, 0x08, 0x09, 0xFF, 0x11)
20+
21+
#define NOTIFICATION_COUNT 30

0 commit comments

Comments
 (0)