Skip to content

Commit 7127c2a

Browse files
jori-nordicaescolar
authored andcommitted
tests: Bluetooth: Add debug options to host/l2cap/stress
Enable quality-of-life kconfig options. Add destroy callbacks to track lifetime of app buffers. Signed-off-by: Jonathan Rico <[email protected]>
1 parent 8aaf40a commit 7127c2a

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

tests/bsim/bluetooth/host/l2cap/stress/prj.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@ CONFIG_BT_MAX_CONN=10
4646
CONFIG_LOG=y
4747
CONFIG_ASSERT=y
4848
CONFIG_NET_BUF_POOL_USAGE=y
49+
50+
CONFIG_BT_L2CAP_LOG_LEVEL_DBG=y
51+
# CONFIG_BT_CONN_LOG_LEVEL_DBG=y
52+
CONFIG_LOG_THREAD_ID_PREFIX=y
53+
CONFIG_THREAD_NAME=y
54+
55+
CONFIG_ARCH_POSIX_TRAP_ON_FATAL=y

tests/bsim/bluetooth/host/l2cap/stress/src/main.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,41 @@ CREATE_FLAG(flag_l2cap_connected);
2323
#define NUM_SEGMENTS 10
2424
#define RESCHEDULE_DELAY K_MSEC(100)
2525

26+
static void sdu_destroy(struct net_buf *buf)
27+
{
28+
LOG_DBG("%p", buf);
29+
30+
net_buf_destroy(buf);
31+
}
32+
33+
static void segment_destroy(struct net_buf *buf)
34+
{
35+
LOG_DBG("%p", buf);
36+
37+
net_buf_destroy(buf);
38+
}
39+
40+
static void rx_destroy(struct net_buf *buf)
41+
{
42+
LOG_DBG("%p", buf);
43+
44+
net_buf_destroy(buf);
45+
}
46+
2647
/* Only one SDU per link will be transmitted at a time */
2748
NET_BUF_POOL_DEFINE(sdu_tx_pool,
2849
CONFIG_BT_MAX_CONN, BT_L2CAP_SDU_BUF_SIZE(SDU_LEN),
29-
CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL);
50+
CONFIG_BT_CONN_TX_USER_DATA_SIZE, sdu_destroy);
3051

3152
NET_BUF_POOL_DEFINE(segment_pool,
3253
/* MTU + 4 l2cap hdr + 4 ACL hdr */
3354
NUM_SEGMENTS, BT_L2CAP_BUF_SIZE(CONFIG_BT_L2CAP_TX_MTU),
34-
CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL);
55+
CONFIG_BT_CONN_TX_USER_DATA_SIZE, segment_destroy);
3556

3657
/* Only one SDU per link will be received at a time */
3758
NET_BUF_POOL_DEFINE(sdu_rx_pool,
3859
CONFIG_BT_MAX_CONN, BT_L2CAP_SDU_BUF_SIZE(SDU_LEN),
39-
8, NULL);
60+
8, rx_destroy);
4061

4162
static uint8_t tx_data[SDU_LEN];
4263
static uint16_t rx_cnt;

0 commit comments

Comments
 (0)