From 6fe1299c33994329ebfba5c4c94caae57f43b79f Mon Sep 17 00:00:00 2001 From: Andries Kruithof Date: Thu, 9 Jun 2022 14:05:20 +0200 Subject: [PATCH] Bluetooth: controller: llcp: fix CI tests for new LLCP Setting the new LLCP as default exposed errors in CI tests, which are fixed here Note that advanced scheduling needs to be disabled. Work is in progress for implementing this for the new LLCP Signed-off-by: Andries Kruithof --- subsys/bluetooth/controller/CMakeLists.txt | 2 +- subsys/bluetooth/controller/Kconfig.ll_sw_split | 2 +- subsys/bluetooth/controller/ll_sw/ull_adv_iso.c | 5 +++++ subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c | 4 ++-- subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c | 7 +++++++ subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c | 2 +- subsys/bluetooth/controller/ll_sw/ull_sched.c | 6 ++++-- tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf | 2 +- 8 files changed, 22 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/controller/CMakeLists.txt b/subsys/bluetooth/controller/CMakeLists.txt index a5ecdf07d34..bb22196fba2 100644 --- a/subsys/bluetooth/controller/CMakeLists.txt +++ b/subsys/bluetooth/controller/CMakeLists.txt @@ -71,7 +71,7 @@ if(CONFIG_BT_LL_SW_SPLIT) if(CONFIG_BT_LL_SW_LLCP_LEGACY) else() zephyr_library_sources_ifdef( - CONFIG_BT_PHY_UPDATE + CONFIG_BT_CTLR_PHY ll_sw/ull_llcp_phy.c ) zephyr_library_sources_ifdef( diff --git a/subsys/bluetooth/controller/Kconfig.ll_sw_split b/subsys/bluetooth/controller/Kconfig.ll_sw_split index c087c344875..ee877e5b5f6 100644 --- a/subsys/bluetooth/controller/Kconfig.ll_sw_split +++ b/subsys/bluetooth/controller/Kconfig.ll_sw_split @@ -91,7 +91,6 @@ config BT_LL_SW_LLCP help Use the new Bluetooth Low Energy Software Link Layer Control Procedure implementation. - endchoice @@ -557,6 +556,7 @@ config BT_CTLR_LLCP_COMMON_TX_CTRL_BUF_NUM config BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM int "Number of local control procedure contexts to be available across all connections" + default 4 if (BT_AUTO_PHY_UPDATE=y || BT_AUTO_DATA_LEN_UPDATE=y) && BT_CTLR_LLCP_CONN < 4 default 2 if BT_CTLR_LLCP_CONN = 1 default BT_CTLR_LLCP_CONN if BT_CTLR_LLCP_CONN > 1 range 2 255 diff --git a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c index f61deeef34a..1d1a73ab4f3 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_adv_iso.c @@ -804,9 +804,14 @@ static uint32_t adv_iso_start(struct ll_adv_iso_set *adv_iso, } ticks_slot = adv_iso->ull.ticks_slot + ticks_slot_overhead; +#if defined(BT_CTLR_SCHED_ADVANCED) /* Find the slot after Periodic Advertisings events */ err = ull_sched_adv_aux_sync_free_slot_get(TICKER_USER_ID_THREAD, ticks_slot, &ticks_anchor); +#else + /* advanced scheduling not enabled */ + err = -1; +#endif if (err) { ticks_anchor = ticker_ticks_now_get(); } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c index c56d6988dff..d3ccbff008d 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_cc.c @@ -51,6 +51,7 @@ #include #include "hal/debug.h" +#if defined(CONFIG_BT_PERIPHERAL) static uint16_t cc_event_counter(struct ll_conn *conn) { struct lll_conn *lll; @@ -67,7 +68,6 @@ static uint16_t cc_event_counter(struct ll_conn *conn) return event_counter; } -#if defined(CONFIG_BT_PERIPHERAL) /* LLCP Remote Procedure FSM states */ enum { /* Establish Procedure */ @@ -291,7 +291,7 @@ static uint8_t rp_cc_check_phy(struct ll_conn *conn, struct proc_ctx *ctx, /* Unsupported phy selected */ return BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL; } -#endif +#endif /* CONFIG_BT_CTLR_PHY */ return BT_HCI_ERR_SUCCESS; } diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c index d6f93675c23..4d63678c259 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_conn_upd.c @@ -38,6 +38,11 @@ #include "ull_conn_internal.h" #include "ull_conn_types.h" + +#if defined(CONFIG_BT_CTLR_USER_EXT) +#include "ull_vendor.h" +#endif /* CONFIG_BT_CTLR_USER_EXT */ + #include "ull_internal.h" #include "ull_llcp.h" #include "ull_llcp_features.h" @@ -203,6 +208,7 @@ static bool cu_should_notify_host(struct proc_ctx *ctx) (ctx->data.cu.params_changed != 0U)); } +#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_CTLR_CONN_PARAM_REQ) static void lp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) { struct node_tx *tx; @@ -248,6 +254,7 @@ static void lp_cu_tx(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t opcode) } #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ } +#endif /* CONFIG_BT_CENTRAL || CONFIG_BT_CTLR_CONN_PARAM_REQ */ static void lp_cu_ntf(struct ll_conn *conn, struct proc_ctx *ctx) { diff --git a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c index 1770d752026..c073fc81f71 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_peripheral_iso.c @@ -113,7 +113,7 @@ uint8_t ll_cis_reject(uint16_t handle, uint8_t reason) #if defined(CONFIG_BT_LL_SW_LLCP_LEGACY) status = BT_HCI_ERR_CMD_DISALLOWED; #else - struct ll_conn *acl_conn = ll_cis_reply_ok(handle, &status); + struct ll_conn *acl_conn = ll_cis_get_acl_awaiting_reply(handle, &status); if (acl_conn) { /* Accept request */ diff --git a/subsys/bluetooth/controller/ll_sw/ull_sched.c b/subsys/bluetooth/controller/ll_sw/ull_sched.c index bd7479ed1f8..8998628bccf 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sched.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sched.c @@ -58,11 +58,11 @@ static void win_offset_calc(struct ll_conn *conn_curr, uint8_t is_select, #endif #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ -#if defined(CONFIG_BT_CONN) +#if defined(CONFIG_BT_CONN) && (defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_LL_SW_LLCP_LEGACY)) static void after_cen_offset_get(uint16_t conn_interval, uint32_t ticks_slot, uint32_t ticks_anchor, uint32_t *win_offset_us); -#endif /* CONFIG_BT_CONN */ +#endif /* CONFIG_BT_CONN && (CONFIG_BT_CENTRAL || CONFIG_BT_LL_SW_LLCP_LEGACY) */ typedef struct ull_hdr *(*ull_hdr_get_func)(uint8_t ticker_id, uint32_t *ticks_slot); @@ -595,6 +595,7 @@ static void win_offset_calc(struct ll_conn *conn_curr, uint8_t is_select, #endif /* CONFIG_BT_LL_SW_LLCP_LEGACY */ #endif /* CONFIG_BT_CTLR_CONN_PARAM_REQ */ +#if defined(CONFIG_BT_CENTRAL) || defined(CONFIG_BT_LL_SW_LLCP_LEGACY) static void after_cen_offset_get(uint16_t conn_interval, uint32_t ticks_slot, uint32_t ticks_anchor, uint32_t *win_offset_us) @@ -633,6 +634,7 @@ static void after_cen_offset_get(uint16_t conn_interval, uint32_t ticks_slot, } } } +#endif /* CONFIG_BT_CENTRAL || CONFIG_BT_LL_SW_LLCP_LEGACY */ #endif /* CONFIG_BT_CONN */ static uint8_t after_match_slot_get(uint8_t user_id, uint32_t ticks_slot_abs, diff --git a/tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf b/tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf index 72b069d473a..7a1f6dbca5d 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf +++ b/tests/bluetooth/bsim_bt/bsim_test_multiple/prj.conf @@ -10,7 +10,7 @@ CONFIG_BT_AUTO_PHY_UPDATE=y CONFIG_BT_USER_DATA_LEN_UPDATE=y CONFIG_BT_AUTO_DATA_LEN_UPDATE=y -CONFIG_BT_MAX_CONN=250 +CONFIG_BT_MAX_CONN=150 CONFIG_BT_ID_MAX=250 # L2CAP, ATT and SMP usage cause data transmission deadlock due to shortage