From faf1e02815541d28a4504b33fbb053d1fa2c6b24 Mon Sep 17 00:00:00 2001 From: Nirav Agrawal Date: Mon, 14 Jul 2025 16:53:52 +0530 Subject: [PATCH 1/2] bluetooth: host: add kconfig for synchronous buffer count - adding kconfig for HCI synchronous cmds, or events responsble to manage host-controller credits to avoid discard complete event due to unavailability of synchronous buffer. - Issue was present while working with usecases like Broadcast-BAP where more than 1 stream (SDU per BIS) sent to controller over HCI and controller sends NOCP events for both streams at the end of BIG sync anchor. The gap between two consecutive events in same BIG is within few usec range causes HCI driver to drop successive event while processing current and if not freed. Signed-off-by: Nirav Agrawal --- subsys/bluetooth/common/Kconfig | 13 +++++++++++++ subsys/bluetooth/host/buf.c | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/common/Kconfig b/subsys/bluetooth/common/Kconfig index 2b7b698d8f8e4..70ea204dbc261 100644 --- a/subsys/bluetooth/common/Kconfig +++ b/subsys/bluetooth/common/Kconfig @@ -172,6 +172,19 @@ config BT_BUF_EVT_DISCARDABLE_COUNT it will not cause the allocation for other critical events to block and may even eliminate deadlocks in some cases. +config BT_BUF_EVT_SYNCHRONOUS_COUNT + int "Number of synchronous HCI Event buffers" + range 1 $(UINT8_MAX) + # number of buffer require for bap-broadcast BIS counts + default BT_BAP_BROADCAST_SRC_STREAM_COUNT if BT_BAP_BROADCAST_SOURCE + default 1 + help + Number of buffers in a separate pool for events which the HCI + stack depedent to manage it's command buffer queue, host to + controller buffer credits etc. The events command_complete, + number of command processed(nocp) etc considered under this + event pool and processed on priority. + config BT_BUF_CMD_TX_SIZE int "Maximum support HCI Command buffer length" default $(UINT8_MAX) if (BT_EXT_ADV || BT_CLASSIC || BT_ISO_CENTRAL || BT_CHANNEL_SOUNDING) diff --git a/subsys/bluetooth/host/buf.c b/subsys/bluetooth/host/buf.c index 6e05b3efd5137..13a94728ee62f 100644 --- a/subsys/bluetooth/host/buf.c +++ b/subsys/bluetooth/host/buf.c @@ -64,7 +64,8 @@ static void iso_rx_freed_cb(void) * the HCI transport to fill buffers in parallel with `bt_recv` * consuming them. */ -NET_BUF_POOL_FIXED_DEFINE(sync_evt_pool, 1, SYNC_EVT_SIZE, 0, NULL); +NET_BUF_POOL_FIXED_DEFINE(sync_evt_pool, CONFIG_BT_BUF_EVT_SYNCHRONOUS_COUNT, SYNC_EVT_SIZE, 0, + NULL); NET_BUF_POOL_FIXED_DEFINE(discardable_pool, CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT, BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE), From 7913763eed08c0817d2b1d66a553fc49b3f9a31e Mon Sep 17 00:00:00 2001 From: Nirav Agrawal Date: Mon, 14 Jul 2025 16:59:17 +0530 Subject: [PATCH 2/2] samples: bluetooth: bap_broadcast: enable LIBLC3 for NXP iMXRT Family - Added i.MXRT1062 MCU to enable LC3 Codec as it supports FPU and used to evaluate BLE Audio applications using LC3 based payload. Signed-off-by: Nirav Agrawal --- samples/bluetooth/bap_broadcast_sink/Kconfig | 2 +- samples/bluetooth/bap_broadcast_source/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/bap_broadcast_sink/Kconfig b/samples/bluetooth/bap_broadcast_sink/Kconfig index 2d483082fd474..7b6c225289bad 100644 --- a/samples/bluetooth/bap_broadcast_sink/Kconfig +++ b/samples/bluetooth/bap_broadcast_sink/Kconfig @@ -48,7 +48,7 @@ config ENABLE_LC3 # By default let's enable it in the platforms we know are capable of supporting it default y depends on CPU_HAS_FPU && \ - (ARCH_POSIX || SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF5340_CPUAPP) + (ARCH_POSIX || SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF5340_CPUAPP || SOC_MIMXRT1062) select LIBLC3 select FPU diff --git a/samples/bluetooth/bap_broadcast_source/Kconfig b/samples/bluetooth/bap_broadcast_source/Kconfig index 27e0fcf384c85..8f368344afab1 100644 --- a/samples/bluetooth/bap_broadcast_source/Kconfig +++ b/samples/bluetooth/bap_broadcast_source/Kconfig @@ -25,7 +25,7 @@ config ENABLE_LC3 # By default let's enable it in the platforms we know are capable of supporting it default y depends on CPU_HAS_FPU && \ - (ARCH_POSIX || SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF5340_CPUAPP) + (ARCH_POSIX || SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF5340_CPUAPP || SOC_MIMXRT1062) select LIBLC3 select FPU