Bluetooth: controller: Add remote proc ctx pool

Add a separate procedure context pool for remote initiated procedures.
Make it configurable in size by BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM.
Fix all unit tests referring to the amount of free context buffers.

Fixes #41823

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
This commit is contained in:
Thomas Ebert Hansen 2022-02-10 15:38:58 +01:00 committed by Carles Cufí
commit 33cb9e3433
20 changed files with 165 additions and 121 deletions

View file

@ -533,15 +533,25 @@ config BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM
Configure between 0 and (4 - BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM) * BT_CTLR_LLCP_CONN Configure between 0 and (4 - BT_CTLR_LLCP_PER_CONN_TX_CTRL_BUF_NUM) * BT_CTLR_LLCP_CONN
config BT_CTLR_LLCP_PROC_CTX_BUF_NUM config BT_CTLR_LLCP_PROC_CTX_BUF_NUM
int "Number of control procedure contexts to be available across all connections" int "Number of local control procedure contexts to be available across all connections"
default 2 if BT_CTLR_LLCP_CONN = 1 default 2 if BT_CTLR_LLCP_CONN = 1
default BT_CTLR_LLCP_CONN if BT_CTLR_LLCP_CONN > 1 default BT_CTLR_LLCP_CONN if BT_CTLR_LLCP_CONN > 1
range 2 255 range 2 255
help help
Set the number control procedure contexts that is to be available. Set the number control procedure contexts that is to be available.
This defines the size of the pool of control procedure contexts available This defines the size of the pool of control procedure contexts available
for handlign control procedures. This pool is shared across all for handling local initiated control procedures.
connections (local vs remote initiate), with allocation through a queue This pool is shared across all connections, with allocation through a queue.
config BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM
int "Number of remote control procedure contexts to be available across all connections"
default BT_CTLR_LLCP_CONN
range 1 255
help
Set the number control procedure contexts that is to be available.
This defines the size of the pool of control procedure contexts available
for handling remote initiated control procedures.
This pool is shared across all connections, with allocation through a queue.
endif #!BT_LL_SW_LLCP_LEGACY endif #!BT_LL_SW_LLCP_LEGACY

View file

@ -59,8 +59,13 @@ static uint8_t buffer_mem_tx[TX_CTRL_BUF_SIZE * LLCP_TX_CTRL_BUF_COUNT];
static struct llcp_mem_pool mem_tx = { .pool = buffer_mem_tx }; static struct llcp_mem_pool mem_tx = { .pool = buffer_mem_tx };
/* TODO: Determine 'correct' number of ctx */ /* TODO: Determine 'correct' number of ctx */
static uint8_t buffer_mem_ctx[PROC_CTX_BUF_SIZE * CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM]; static uint8_t buffer_mem_local_ctx[PROC_CTX_BUF_SIZE * CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM];
static struct llcp_mem_pool mem_ctx = { .pool = buffer_mem_ctx }; static struct llcp_mem_pool mem_local_ctx = { .pool = buffer_mem_local_ctx };
/* TODO(thoh-ot): Determine 'correct' number of ctx */
static uint8_t buffer_mem_remote_ctx[PROC_CTX_BUF_SIZE *
CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM];
static struct llcp_mem_pool mem_remote_ctx = { .pool = buffer_mem_remote_ctx };
/* /*
* LLCP Resource Management * LLCP Resource Management
@ -282,7 +287,7 @@ struct proc_ctx *llcp_create_local_procedure(enum llcp_proc proc)
{ {
struct proc_ctx *ctx; struct proc_ctx *ctx;
ctx = create_procedure(proc, &mem_ctx); ctx = create_procedure(proc, &mem_local_ctx);
if (!ctx) { if (!ctx) {
return NULL; return NULL;
} }
@ -350,7 +355,7 @@ struct proc_ctx *llcp_create_remote_procedure(enum llcp_proc proc)
{ {
struct proc_ctx *ctx; struct proc_ctx *ctx;
ctx = create_procedure(proc, &mem_ctx); ctx = create_procedure(proc, &mem_remote_ctx);
if (!ctx) { if (!ctx) {
return NULL; return NULL;
} }
@ -423,8 +428,11 @@ struct proc_ctx *llcp_create_remote_procedure(enum llcp_proc proc)
void ull_cp_init(void) void ull_cp_init(void)
{ {
mem_init(mem_ctx.pool, PROC_CTX_BUF_SIZE, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, mem_init(mem_local_ctx.pool, PROC_CTX_BUF_SIZE, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM,
&mem_ctx.free); &mem_local_ctx.free);
mem_init(mem_remote_ctx.pool, PROC_CTX_BUF_SIZE,
CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM,
&mem_remote_ctx.free);
mem_init(mem_tx.pool, TX_CTRL_BUF_SIZE, LLCP_TX_CTRL_BUF_COUNT, &mem_tx.free); mem_init(mem_tx.pool, TX_CTRL_BUF_SIZE, LLCP_TX_CTRL_BUF_COUNT, &mem_tx.free);
#if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE) #if defined(LLCP_TX_CTRL_BUF_QUEUE_ENABLE)
@ -1025,13 +1033,19 @@ void ull_cp_rx(struct ll_conn *conn, struct node_rx_pdu *rx)
#ifdef ZTEST_UNITTEST #ifdef ZTEST_UNITTEST
int ctx_buffers_free(void) static uint16_t local_ctx_buffers_free(void)
{ {
int nr_of_free_ctx; return mem_free_count_get(mem_local_ctx.free);
}
nr_of_free_ctx = mem_free_count_get(mem_ctx.free); static uint16_t remote_ctx_buffers_free(void)
{
return mem_free_count_get(mem_remote_ctx.free);
}
return nr_of_free_ctx; uint16_t ctx_buffers_free(void)
{
return local_ctx_buffers_free() + remote_ctx_buffers_free();
} }
void test_int_mem_proc_ctx(void) void test_int_mem_proc_ctx(void)
@ -1043,28 +1057,29 @@ void test_int_mem_proc_ctx(void)
ull_cp_init(); ull_cp_init();
nr_of_free_ctx = ctx_buffers_free(); nr_of_free_ctx = ctx_buffers_free();
zassert_equal(nr_of_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_of_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM +
CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM, NULL);
for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM; i++) { for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM; i++) {
ctx1 = proc_ctx_acquire(&mem_ctx); ctx1 = proc_ctx_acquire(&mem_local_ctx);
/* The previous acquire should be valid */ /* The previous acquire should be valid */
zassert_not_null(ctx1, NULL); zassert_not_null(ctx1, NULL);
} }
nr_of_free_ctx = ctx_buffers_free(); nr_of_free_ctx = local_ctx_buffers_free();
zassert_equal(nr_of_free_ctx, 0, NULL); zassert_equal(nr_of_free_ctx, 0, NULL);
ctx2 = proc_ctx_acquire(&mem_ctx); ctx2 = proc_ctx_acquire(&mem_local_ctx);
/* The last acquire should fail */ /* The last acquire should fail */
zassert_is_null(ctx2, NULL); zassert_is_null(ctx2, NULL);
llcp_proc_ctx_release(ctx1); llcp_proc_ctx_release(ctx1);
nr_of_free_ctx = ctx_buffers_free(); nr_of_free_ctx = local_ctx_buffers_free();
zassert_equal(nr_of_free_ctx, 1, NULL); zassert_equal(nr_of_free_ctx, 1, NULL);
ctx1 = proc_ctx_acquire(&mem_ctx); ctx1 = proc_ctx_acquire(&mem_local_ctx);
/* Releasing returns the context to the avilable pool */ /* Releasing returns the context to the avilable pool */
zassert_not_null(ctx1, NULL); zassert_not_null(ctx1, NULL);
@ -1141,7 +1156,7 @@ void test_int_create_proc(void)
ull_cp_init(); ull_cp_init();
ctx = create_procedure(PROC_VERSION_EXCHANGE, &mem_ctx); ctx = create_procedure(PROC_VERSION_EXCHANGE, &mem_local_ctx);
zassert_not_null(ctx, NULL); zassert_not_null(ctx, NULL);
zassert_equal(ctx->proc, PROC_VERSION_EXCHANGE, NULL); zassert_equal(ctx->proc, PROC_VERSION_EXCHANGE, NULL);
@ -1150,7 +1165,7 @@ void test_int_create_proc(void)
for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM; i++) { for (int i = 0U; i < CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM; i++) {
zassert_not_null(ctx, NULL); zassert_not_null(ctx, NULL);
ctx = create_procedure(PROC_VERSION_EXCHANGE, &mem_ctx); ctx = create_procedure(PROC_VERSION_EXCHANGE, &mem_local_ctx);
} }
zassert_is_null(ctx, NULL); zassert_is_null(ctx, NULL);

View file

@ -626,5 +626,5 @@ bool lr_is_disconnected(struct ll_conn *conn);
bool lr_is_idle(struct ll_conn *conn); bool lr_is_idle(struct ll_conn *conn);
bool rr_is_disconnected(struct ll_conn *conn); bool rr_is_disconnected(struct ll_conn *conn);
bool rr_is_idle(struct ll_conn *conn); bool rr_is_idle(struct ll_conn *conn);
int ctx_buffers_free(void); uint16_t ctx_buffers_free(void);
#endif #endif

View file

@ -6,9 +6,10 @@
*/ */
void test_print_conn(struct ll_conn *conn); void test_print_conn(struct ll_conn *conn);
uint16_t test_ctx_buffers_cnt(void);
void test_set_role(struct ll_conn *conn, uint8_t role); void test_set_role(struct ll_conn *conn, uint8_t role);
void test_setup(struct ll_conn *conn); void test_setup(struct ll_conn *conn);
void event_prepare(struct ll_conn *conn); void event_prepare(struct ll_conn *conn);
void event_tx_ack(struct ll_conn *conn, struct node_tx *tx); void event_tx_ack(struct ll_conn *conn, struct node_tx *tx);
void event_done(struct ll_conn *conn); void event_done(struct ll_conn *conn);

View file

@ -42,6 +42,7 @@ static uint32_t event_active;
static uint16_t lazy; static uint16_t lazy;
sys_slist_t ut_rx_q; sys_slist_t ut_rx_q;
static sys_slist_t lt_tx_q; static sys_slist_t lt_tx_q;
static uint32_t no_of_ctx_buffers_at_test_setup;
#define PDU_DC_LL_HEADER_SIZE (offsetof(struct pdu_data, lldata)) #define PDU_DC_LL_HEADER_SIZE (offsetof(struct pdu_data, lldata))
#define NODE_RX_HEADER_SIZE (offsetof(struct node_rx_pdu, pdu)) #define NODE_RX_HEADER_SIZE (offsetof(struct node_rx_pdu, pdu))
@ -192,6 +193,11 @@ void test_print_conn(struct ll_conn *conn)
printf("--------------------->\n"); printf("--------------------->\n");
} }
uint16_t test_ctx_buffers_cnt(void)
{
return no_of_ctx_buffers_at_test_setup;
}
void test_setup(struct ll_conn *conn) void test_setup(struct ll_conn *conn)
{ {
ull_conn_init(); ull_conn_init();
@ -218,6 +224,8 @@ void test_setup(struct ll_conn *conn)
conn->lll.event_counter = 0; conn->lll.event_counter = 0;
event_active = 0; event_active = 0;
lazy = 0; lazy = 0;
no_of_ctx_buffers_at_test_setup = ctx_buffers_free();
} }

View file

@ -107,13 +107,13 @@ void test_int_disconnect_loc(void)
ull_cp_state_set(&conn, ULL_CP_CONNECTED); ull_cp_state_set(&conn, ULL_CP_CONNECTED);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt(), NULL);
err = ull_cp_version_exchange(&conn); err = ull_cp_version_exchange(&conn);
zassert_equal(err, BT_HCI_ERR_SUCCESS, NULL); zassert_equal(err, BT_HCI_ERR_SUCCESS, NULL);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt() - 1, NULL);
event_prepare(&conn); event_prepare(&conn);
lt_rx(LL_VERSION_IND, &conn, &tx, &local_version_ind); lt_rx(LL_VERSION_IND, &conn, &tx, &local_version_ind);
@ -126,7 +126,7 @@ void test_int_disconnect_loc(void)
ull_cp_state_set(&conn, ULL_CP_DISCONNECTED); ull_cp_state_set(&conn, ULL_CP_DISCONNECTED);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt(), NULL);
ut_rx_q_is_empty(); ut_rx_q_is_empty();
@ -137,7 +137,7 @@ void test_int_disconnect_loc(void)
event_done(&conn); event_done(&conn);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt(), NULL);
/* /*
* all buffers should still be empty * all buffers should still be empty
@ -165,7 +165,7 @@ void test_int_disconnect_rem(void)
ull_cp_state_set(&conn, ULL_CP_CONNECTED); ull_cp_state_set(&conn, ULL_CP_CONNECTED);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt(), NULL);
/* Prepare */ /* Prepare */
event_prepare(&conn); event_prepare(&conn);
@ -173,7 +173,7 @@ void test_int_disconnect_rem(void)
lt_tx(LL_VERSION_IND, &conn, &remote_version_ind); lt_tx(LL_VERSION_IND, &conn, &remote_version_ind);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt(), NULL);
/* Disconnect before we reply */ /* Disconnect before we reply */
@ -189,7 +189,7 @@ void test_int_disconnect_rem(void)
event_done(&conn); event_done(&conn);
nr_free_ctx = ctx_buffers_free(); nr_free_ctx = ctx_buffers_free();
zassert_equal(nr_free_ctx, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, NULL); zassert_equal(nr_free_ctx, test_ctx_buffers_cnt(), NULL);
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();

View file

@ -125,7 +125,7 @@ void test_channel_map_update_central_loc(void)
zassert_mem_equal(conn.lll.data_chan_map, chm, sizeof(conn.lll.data_chan_map), zassert_mem_equal(conn.lll.data_chan_map, chm, sizeof(conn.lll.data_chan_map),
"Channel map invalid"); "Channel map invalid");
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -193,7 +193,7 @@ void test_channel_map_update_periph_rem(void)
zassert_mem_equal(conn.lll.data_chan_map, chm, sizeof(conn.lll.data_chan_map), zassert_mem_equal(conn.lll.data_chan_map, chm, sizeof(conn.lll.data_chan_map),
"Channel map invalid"); "Channel map invalid");
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -211,7 +211,7 @@ void test_channel_map_update_periph_loc(void)
err = ull_cp_chan_map_update(&conn, chm); err = ull_cp_chan_map_update(&conn, chm);
zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, NULL); zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, NULL);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -274,7 +274,7 @@ void test_conn_update_central_loc_accept(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -344,7 +344,7 @@ void test_conn_update_central_loc_reject(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -467,7 +467,7 @@ void test_conn_update_central_loc_remote_legacy(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -590,7 +590,7 @@ void test_conn_update_central_loc_unsupp_wo_feat_exch(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -689,7 +689,7 @@ void test_conn_update_central_loc_unsupp_w_feat_exch(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -854,7 +854,7 @@ void test_conn_update_central_loc_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -974,7 +974,7 @@ void test_conn_update_central_rem_accept(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1051,7 +1051,7 @@ void test_conn_update_central_rem_reject(void)
/* Done */ /* Done */
event_done(&conn); event_done(&conn);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1314,7 +1314,7 @@ void test_conn_update_central_rem_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1416,7 +1416,7 @@ void test_conn_update_periph_loc_accept(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1495,7 +1495,7 @@ void test_conn_update_periph_loc_reject(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1574,7 +1574,7 @@ void test_conn_update_periph_loc_unsupp_feat_wo_feat_exch(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1622,7 +1622,7 @@ void test_conn_update_periph_loc_unsupp_feat_w_feat_exch(void)
/* There should be no host notification */ /* There should be no host notification */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1800,7 +1800,7 @@ void test_conn_update_periph_loc_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1930,7 +1930,7 @@ void test_conn_update_periph_rem_accept(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -2010,7 +2010,7 @@ void test_conn_update_periph_rem_reject(void)
/* Done */ /* Done */
event_done(&conn); event_done(&conn);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -2261,7 +2261,7 @@ void test_conn_update_periph_rem_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
#endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */
@ -2373,7 +2373,7 @@ void test_conn_update_central_loc_accept_no_param_req(void)
} }
} while (parameters_changed-- > 0U); } while (parameters_changed-- > 0U);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -2430,7 +2430,7 @@ void test_conn_update_central_rem_accept_no_param_req(void)
/* There should NOT be a host notification */ /* There should NOT be a host notification */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -2521,7 +2521,7 @@ void test_conn_update_periph_rem_accept_no_param_req(void)
} }
} while (parameters_changed-- > 0U); } while (parameters_changed-- > 0U);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -2566,7 +2566,7 @@ void test_conn_update_periph_loc_disallowed_no_param_req(void)
/* There should be no host notification */ /* There should be no host notification */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -110,7 +110,7 @@ void test_cte_req_central_local(void)
/* Release tx node */ /* Release tx node */
ull_cp_release_tx(&conn, tx); ull_cp_release_tx(&conn, tx);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -180,7 +180,7 @@ void test_cte_req_peripheral_local(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -249,7 +249,7 @@ void test_cte_req_central_remote(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -318,7 +318,7 @@ void test_cte_req_peripheral_remote(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -394,7 +394,7 @@ void test_cte_req_rejected_inv_ll_param_central_local(void)
/* Release tx node */ /* Release tx node */
ull_cp_release_tx(&conn, tx); ull_cp_release_tx(&conn, tx);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -468,7 +468,7 @@ void test_cte_req_rejected_inv_ll_param_peripheral_local(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -540,7 +540,7 @@ void test_cte_req_reject_inv_ll_param_central_remote(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -612,7 +612,7 @@ void test_cte_req_reject_inv_ll_param_peripheral_remote(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1023,10 +1023,10 @@ static void test_local_cte_req_wait_for_phy_update_complete_and_disable(uint8_t
if (role == BT_HCI_ROLE_CENTRAL) { if (role == BT_HCI_ROLE_CENTRAL) {
run_phy_update_central(true, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_central(true, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1); test_ctx_buffers_cnt() - 1);
} else { } else {
run_phy_update_peripheral(true, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_peripheral(true, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1); test_ctx_buffers_cnt() - 1);
} }
/* In this test CTE request is local procedure. Local procedures are handled after remote /* In this test CTE request is local procedure. Local procedures are handled after remote
@ -1045,7 +1045,7 @@ static void test_local_cte_req_wait_for_phy_update_complete_and_disable(uint8_t
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1088,16 +1088,16 @@ static void test_local_cte_req_wait_for_phy_update_complete(uint8_t role)
if (role == BT_HCI_ROLE_CENTRAL) { if (role == BT_HCI_ROLE_CENTRAL) {
run_phy_update_central(true, &local_cte_req, &phy_req, pu_event_counter(&conn), run_phy_update_central(true, &local_cte_req, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1); test_ctx_buffers_cnt() - 1);
} else { } else {
run_phy_update_peripheral(true, &local_cte_req, &phy_req, pu_event_counter(&conn), run_phy_update_peripheral(true, &local_cte_req, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1); test_ctx_buffers_cnt() - 1);
} }
/* PHY update was completed. Handle CTE request */ /* PHY update was completed. Handle CTE request */
run_local_cte_req(&local_cte_req); run_local_cte_req(&local_cte_req);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1139,15 +1139,15 @@ static void test_local_phy_update_wait_for_cte_req_complete(uint8_t role)
/* Handle CTE request */ /* Handle CTE request */
run_local_cte_req(&local_cte_req); run_local_cte_req(&local_cte_req);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt() - 1,
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
if (role == BT_HCI_ROLE_CENTRAL) { if (role == BT_HCI_ROLE_CENTRAL) {
run_phy_update_central(true, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_central(true, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} else { } else {
run_phy_update_peripheral(true, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_peripheral(true, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} }
} }
@ -1229,15 +1229,15 @@ static void test_phy_update_wait_for_remote_cte_req_complete(uint8_t role)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt() - 1,
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
if (role == BT_HCI_ROLE_CENTRAL) { if (role == BT_HCI_ROLE_CENTRAL) {
run_phy_update_central(true, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_central(true, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} else { } else {
run_phy_update_peripheral(true, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_peripheral(true, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} }
} }
@ -1284,10 +1284,10 @@ static void test_cte_req_wait_for_remote_phy_update_complete_and_disable(uint8_t
if (role == BT_HCI_ROLE_CENTRAL) { if (role == BT_HCI_ROLE_CENTRAL) {
run_phy_update_central(false, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_central(false, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} else { } else {
run_phy_update_peripheral(false, NULL, &phy_req, pu_event_counter(&conn), run_phy_update_peripheral(false, NULL, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} }
/* There is no special handling of CTE REQ completion. It is done when instant happens just /* There is no special handling of CTE REQ completion. It is done when instant happens just
@ -1338,10 +1338,10 @@ static void test_cte_req_wait_for_remote_phy_update_complete(uint8_t role)
if (role == BT_HCI_ROLE_CENTRAL) { if (role == BT_HCI_ROLE_CENTRAL) {
run_phy_update_central(false, &local_cte_req, &phy_req, pu_event_counter(&conn), run_phy_update_central(false, &local_cte_req, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} else { } else {
run_phy_update_peripheral(false, &local_cte_req, &phy_req, pu_event_counter(&conn), run_phy_update_peripheral(false, &local_cte_req, &phy_req, pu_event_counter(&conn),
CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM); test_ctx_buffers_cnt());
} }
/* There is no special handling of CTE REQ completion here. It is done when instant happens /* There is no special handling of CTE REQ completion here. It is done when instant happens

View file

@ -286,7 +286,7 @@ void test_encryption_start_central_loc(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -520,7 +520,7 @@ void test_encryption_start_central_loc_limited_memory(void)
/* Release dummy procedure */ /* Release dummy procedure */
llcp_proc_ctx_release(ctx); llcp_proc_ctx_release(ctx);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -636,7 +636,7 @@ void test_encryption_start_central_loc_no_ltk(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -747,7 +747,7 @@ void test_encryption_start_central_loc_no_ltk_2(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -964,7 +964,7 @@ void test_encryption_start_periph_rem(void)
/* CCM Tx Direction should be S->M */ /* CCM Tx Direction should be S->M */
CHECK_TX_CCM_STATE(conn, sk_be, iv, 0U, CCM_DIR_S_TO_M); CHECK_TX_CCM_STATE(conn, sk_be, iv, 0U, CCM_DIR_S_TO_M);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1268,7 +1268,7 @@ void test_encryption_start_periph_rem_limited_memory(void)
/* Release dummy procedure */ /* Release dummy procedure */
llcp_proc_ctx_release(ctx); llcp_proc_ctx_release(ctx);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1415,7 +1415,7 @@ void test_encryption_start_periph_rem_no_ltk(void)
ut_rx_q_is_empty(); ut_rx_q_is_empty();
/* Note that for this test the context is not released */ /* Note that for this test the context is not released */
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt() - 1,
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1566,7 +1566,7 @@ void test_encryption_pause_central_loc(void)
/* Rx Decryption should be enabled */ /* Rx Decryption should be enabled */
zassert_equal(conn.lll.enc_rx, 1U, NULL); zassert_equal(conn.lll.enc_rx, 1U, NULL);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1742,7 +1742,7 @@ void test_encryption_pause_periph_rem(void)
/* Tx Encryption should be enabled */ /* Tx Encryption should be enabled */
zassert_equal(conn.lll.enc_tx, 1U, NULL); zassert_equal(conn.lll.enc_tx, 1U, NULL);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -128,7 +128,7 @@ void test_feat_exchange_central_loc(void)
} }
zassert_equal(conn.lll.event_counter, feat_to_test, "Wrong event-count %d\n", zassert_equal(conn.lll.event_counter, feat_to_test, "Wrong event-count %d\n",
conn.lll.event_counter); conn.lll.event_counter);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -146,7 +146,9 @@ void test_feat_exchange_central_loc_2(void)
} }
zassert_not_equal(err, BT_HCI_ERR_SUCCESS, NULL); zassert_not_equal(err, BT_HCI_ERR_SUCCESS, NULL);
zassert_equal(ctx_buffers_free(), 0, "Free CTX buffers %d", ctx_buffers_free()); zassert_equal(ctx_buffers_free(),
test_ctx_buffers_cnt() - CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM,
"Free CTX buffers %d", ctx_buffers_free());
} }
/* /*
@ -209,7 +211,7 @@ void test_feat_exchange_central_rem(void)
} }
zassert_equal(conn.lll.event_counter, CENTRAL_NR_OF_EVENTS * (feat_to_test), zassert_equal(conn.lll.event_counter, CENTRAL_NR_OF_EVENTS * (feat_to_test),
"Wrong event-count %d\n", conn.lll.event_counter); "Wrong event-count %d\n", conn.lll.event_counter);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -297,7 +299,7 @@ void test_feat_exchange_central_rem_2(void)
zassert_equal(conn.lll.event_counter, CENTRAL_NR_OF_EVENTS * (feat_to_test), zassert_equal(conn.lll.event_counter, CENTRAL_NR_OF_EVENTS * (feat_to_test),
"Wrong event-count %d\n", conn.lll.event_counter); "Wrong event-count %d\n", conn.lll.event_counter);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -355,7 +357,7 @@ void test_peripheral_feat_exchange_periph_loc(void)
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(conn.lll.event_counter, 2, "Wrong event-count %d\n", zassert_equal(conn.lll.event_counter, 2, "Wrong event-count %d\n",
conn.lll.event_counter); conn.lll.event_counter);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -417,7 +419,7 @@ void test_feat_exchange_periph_loc_unknown_rsp(void)
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(conn.lll.event_counter, 3, "Wrong event-count %d\n", zassert_equal(conn.lll.event_counter, 3, "Wrong event-count %d\n",
conn.lll.event_counter); conn.lll.event_counter);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -133,7 +133,7 @@ void test_hci_feat_exchange_central_loc(void)
ll_conn_release(conn_from_pool); ll_conn_release(conn_from_pool);
} }
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -155,13 +155,15 @@ void test_hci_feat_exchange_wrong_handle(void)
ctx = llcp_create_local_procedure(PROC_FEATURE_EXCHANGE); ctx = llcp_create_local_procedure(PROC_FEATURE_EXCHANGE);
ctx_counter++; ctx_counter++;
} while (ctx != NULL); } while (ctx != NULL);
zassert_equal(ctx_counter, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM + 1, zassert_equal(ctx_counter, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM + 1,
"Error in setup of test\n"); "Error in setup of test\n");
err = ll_feature_req_send(conn_handle); err = ll_feature_req_send(conn_handle);
zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, "Wrong reply for wrong handle\n"); zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, "Wrong reply for wrong handle\n");
zassert_equal(ctx_buffers_free(), 0, "Free CTX buffers %d", ctx_buffers_free()); zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt() - (ctx_counter - 1),
"Free CTX buffers %d", ctx_buffers_free());
} }
void test_hci_main(void) void test_hci_main(void)

View file

@ -136,7 +136,7 @@ void test_hci_feature_exchange_wrong_handle(void)
ctx = llcp_create_local_procedure(PROC_FEATURE_EXCHANGE); ctx = llcp_create_local_procedure(PROC_FEATURE_EXCHANGE);
ctx_counter++; ctx_counter++;
} while (ctx != NULL); } while (ctx != NULL);
zassert_equal(ctx_counter, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM + 1, zassert_equal(ctx_counter, test_ctx_buffers_cnt() + 1,
"Error in setup of test\n"); "Error in setup of test\n");
err = ll_feature_req_send(conn_handle); err = ll_feature_req_send(conn_handle);
@ -203,7 +203,7 @@ void test_hci_version_ind_wrong_handle(void)
ctx = llcp_create_local_procedure(PROC_VERSION_EXCHANGE); ctx = llcp_create_local_procedure(PROC_VERSION_EXCHANGE);
ctx_counter++; ctx_counter++;
} while (ctx != NULL); } while (ctx != NULL);
zassert_equal(ctx_counter, CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM + 1, zassert_equal(ctx_counter, test_ctx_buffers_cnt() + 1,
"Error in setup of test\n"); "Error in setup of test\n");
err = ll_version_ind_send(conn_handle); err = ll_version_ind_send(conn_handle);

View file

@ -97,7 +97,7 @@ void test_ping_central_loc(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -155,7 +155,7 @@ void test_ping_periph_loc(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -209,7 +209,7 @@ void test_ping_central_rem(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -263,7 +263,7 @@ void test_ping_periph_rem(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -100,7 +100,7 @@ void test_min_used_chans_periph_loc(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -118,7 +118,7 @@ void test_min_used_chans_central_loc(void)
err = ull_cp_min_used_chans(&conn, 1, 2); err = ull_cp_min_used_chans(&conn, 1, 2);
zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, NULL); zassert_equal(err, BT_HCI_ERR_CMD_DISALLOWED, NULL);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -162,7 +162,7 @@ void test_min_used_chans_central_rem(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM - 1, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt() - 1,
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -215,7 +215,7 @@ void test_phy_update_central_loc(void)
CHECK_CURRENT_PHY_STATE(conn, PHY_2M, PREFER_S8_CODING, PHY_2M); CHECK_CURRENT_PHY_STATE(conn, PHY_2M, PREFER_S8_CODING, PHY_2M);
CHECK_PREF_PHY_STATE(conn, PHY_2M, PHY_2M); CHECK_PREF_PHY_STATE(conn, PHY_2M, PHY_2M);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -266,7 +266,7 @@ void test_phy_update_central_loc_unsupp_feat(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -365,7 +365,7 @@ void test_phy_update_central_rem(void)
CHECK_CURRENT_PHY_STATE(conn, PHY_1M, PREFER_S8_CODING, PHY_2M); CHECK_CURRENT_PHY_STATE(conn, PHY_1M, PREFER_S8_CODING, PHY_2M);
CHECK_PREF_PHY_STATE(conn, PHY_1M | PHY_2M | PHY_CODED, PHY_1M | PHY_2M | PHY_CODED); CHECK_PREF_PHY_STATE(conn, PHY_1M | PHY_2M | PHY_CODED, PHY_1M | PHY_2M | PHY_CODED);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -459,7 +459,7 @@ void test_phy_update_periph_loc(void)
CHECK_CURRENT_PHY_STATE(conn, PHY_2M, PREFER_S8_CODING, PHY_2M); CHECK_CURRENT_PHY_STATE(conn, PHY_2M, PREFER_S8_CODING, PHY_2M);
CHECK_PREF_PHY_STATE(conn, PHY_2M, PHY_2M); CHECK_PREF_PHY_STATE(conn, PHY_2M, PHY_2M);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -563,7 +563,7 @@ void test_phy_update_periph_rem(void)
CHECK_CURRENT_PHY_STATE(conn, PHY_2M, PREFER_S8_CODING, PHY_1M); CHECK_CURRENT_PHY_STATE(conn, PHY_2M, PREFER_S8_CODING, PHY_1M);
CHECK_PREF_PHY_STATE(conn, PHY_1M | PHY_2M | PHY_CODED, PHY_1M | PHY_2M | PHY_CODED); CHECK_PREF_PHY_STATE(conn, PHY_1M | PHY_2M | PHY_CODED, PHY_1M | PHY_2M | PHY_CODED);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -734,7 +734,7 @@ void test_phy_update_central_loc_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -907,7 +907,7 @@ void test_phy_update_central_rem_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -1036,7 +1036,7 @@ void test_phy_update_periph_loc_collision(void)
/* Release Ntf */ /* Release Ntf */
ull_cp_release_ntf(ntf); ull_cp_release_ntf(ntf);
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -69,7 +69,7 @@ static void test_terminate_rem(uint8_t role)
/* There should be no host notification */ /* There should be no host notification */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -121,7 +121,7 @@ void test_terminate_loc(uint8_t role)
/* There should be no host notification */ /* There should be no host notification */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -98,7 +98,7 @@ static void lt_tx_pdu_and_rx_unknown_rsp(enum helper_pdu_opcode opcode)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -148,7 +148,7 @@ static void lt_tx_undef_opcode_and_rx_unknown_rsp(uint8_t opcode)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -107,7 +107,7 @@ void test_version_exchange_central_loc(void)
ut_rx_pdu(LL_VERSION_IND, &ntf, &remote_version_ind); ut_rx_pdu(LL_VERSION_IND, &ntf, &remote_version_ind);
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -128,7 +128,9 @@ void test_version_exchange_central_loc_2(void)
zassert_not_equal(err, BT_HCI_ERR_SUCCESS, NULL); zassert_not_equal(err, BT_HCI_ERR_SUCCESS, NULL);
zassert_equal(ctx_buffers_free(), 0, "Free CTX buffers %d", ctx_buffers_free()); zassert_equal(ctx_buffers_free(),
test_ctx_buffers_cnt() - CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM,
"Free CTX buffers %d", ctx_buffers_free());
} }
/* +-----+ +-------+ +-----+ /* +-----+ +-------+ +-----+
@ -186,7 +188,7 @@ void test_version_exchange_central_rem(void)
/* There should not be a host notifications */ /* There should not be a host notifications */
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -254,7 +256,7 @@ void test_version_exchange_central_rem_2(void)
ut_rx_pdu(LL_VERSION_IND, &ntf, &remote_version_ind); ut_rx_pdu(LL_VERSION_IND, &ntf, &remote_version_ind);
ut_rx_q_is_empty(); ut_rx_q_is_empty();
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }
@ -349,7 +351,7 @@ void test_version_exchange_central_loc_twice(void)
/* Second attempt to run the version exchange completes immediately in idle state. /* Second attempt to run the version exchange completes immediately in idle state.
* The context is released just after that. * The context is released just after that.
*/ */
zassert_equal(ctx_buffers_free(), CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM, zassert_equal(ctx_buffers_free(), test_ctx_buffers_cnt(),
"Free CTX buffers %d", ctx_buffers_free()); "Free CTX buffers %d", ctx_buffers_free());
} }

View file

@ -89,6 +89,10 @@
#define CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM CONFIG_BT_CTLR_LLCP_CONN #define CONFIG_BT_CTLR_LLCP_PROC_CTX_BUF_NUM CONFIG_BT_CTLR_LLCP_CONN
#endif #endif
#ifndef CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM CONFIG_BT_CTLR_LLCP_CONN
#endif
#ifndef CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM #ifndef CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM
#define CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM 2 #define CONFIG_BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM 2
#endif #endif