diff --git a/CODEOWNERS b/CODEOWNERS index c181b9375684..a3484da4b2dd 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -13,6 +13,7 @@ /Jenkinsfile @thst-nordic /west.yml @carlescufi @tejlmand /west-test.yml @thst-nordic +/ncs-2.6.4-branch-cherry-picks.txt @cvinayak # CI specific west /test-manifests/99-default-test-nrf.yml @thst-nordic @@ -311,6 +312,7 @@ Kconfig* @tejlmand /tests/modules/mcuboot/external_flash/ @hakonfam @sigvartmh /tests/nrf5340_audio/ @koffes @alexsven @erikrobstad @rick1082 @nordic-auko /tests/subsys/audio_module/ @koffes @alexsven @erikrobstad @rick1082 @gWacey +/tests/subsys/bluetooth/controller/ @nrfconnect/ncs-dragoon /tests/subsys/bluetooth/gatt_dm/ @doki-nordic /tests/subsys/bluetooth/mesh/ @ludvigsj /tests/subsys/bluetooth/fast_pair/ @alstrzebonski @MarekPieta @kapi-no diff --git a/Kconfig.nrf b/Kconfig.nrf index 335cad1bd51f..d8e781d65300 100644 --- a/Kconfig.nrf +++ b/Kconfig.nrf @@ -86,6 +86,7 @@ config MCUMGR_TRANSPORT_NETBUF_SIZE # When using HCI on the nRF5340 we need a larger command buffer. config BT_BUF_CMD_TX_COUNT + depends on !BT_LL_SW_SPLIT default 10 if SOC_COMPATIBLE_NRF5340_CPUAPP || SOC_COMPATIBLE_NRF5340_CPUNET config INIT_ARCH_HW_AT_BOOT diff --git a/applications/connectivity_bridge/boards/thingy91_nrf52840.conf b/applications/connectivity_bridge/boards/thingy91_nrf52840.conf index 2407c48f6fb8..bc8ca6fd432e 100644 --- a/applications/connectivity_bridge/boards/thingy91_nrf52840.conf +++ b/applications/connectivity_bridge/boards/thingy91_nrf52840.conf @@ -19,6 +19,7 @@ CONFIG_BT_GATT_CLIENT=y CONFIG_BT_SMP=y CONFIG_BT_CTLR=y CONFIG_BT_CTLR_RX_BUFFERS=10 +CONFIG_BT_BUF_EVT_RX_COUNT=11 CONFIG_BT_BUF_ACL_TX_COUNT=10 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf b/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf index 2105087bdc19..6a402c5a801c 100644 --- a/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf +++ b/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf @@ -17,6 +17,7 @@ CONFIG_BT_BUF_ACL_RX_SIZE=251 CONFIG_BT_NUS=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_SMP=y +CONFIG_BT_BUF_EVT_RX_COUNT=11 CONFIG_BT_BUF_ACL_TX_COUNT=10 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_CTLR_DATA_LENGTH_MAX=251 diff --git a/applications/nrf_desktop/configuration/nrf52810dmouse_nrf52810/prj.conf b/applications/nrf_desktop/configuration/nrf52810dmouse_nrf52810/prj.conf index 8d8a6a921e46..62a0757259b7 100644 --- a/applications/nrf_desktop/configuration/nrf52810dmouse_nrf52810/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52810dmouse_nrf52810/prj.conf @@ -96,7 +96,9 @@ CONFIG_BT_MAX_PAIRED=2 CONFIG_BT_ID_MAX=3 CONFIG_BT_LL_SW_SPLIT=y -CONFIG_BT_CONN_TX_MAX=4 +CONFIG_BT_BUF_EVT_RX_COUNT=4 +CONFIG_BT_BUF_ACL_TX_COUNT=3 +CONFIG_BT_CONN_TX_MAX=3 CONFIG_BT_CTLR_FAL_SIZE=1 CONFIG_BT_CTLR_RL_SIZE=2 diff --git a/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/prj.conf b/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/prj.conf index 5997f5cc6913..18bd7074181a 100644 --- a/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/prj.conf @@ -63,11 +63,13 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_LED=y CONFIG_LED_GPIO=y -CONFIG_USB_NRFX_EVT_QUEUE_SIZE=16 +CONFIG_USB_NRFX_EVT_QUEUE_SIZE=10 CONFIG_BT_PRIVACY=y CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_BUF_EVT_RX_COUNT=4 +CONFIG_BT_BUF_ACL_TX_COUNT=3 CONFIG_BT_BUF_ACL_TX_SIZE=35 CONFIG_BT_CTLR_DATA_LENGTH_MAX=35 CONFIG_BT_L2CAP_TX_BUF_COUNT=6 diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/prj.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/prj.conf index d83bacc06201..035fb9802e0f 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/prj.conf @@ -64,11 +64,13 @@ CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_LED=y CONFIG_LED_GPIO=y -CONFIG_USB_NRFX_EVT_QUEUE_SIZE=16 +CONFIG_USB_NRFX_EVT_QUEUE_SIZE=10 CONFIG_BT_PRIVACY=y CONFIG_BT_LL_SW_SPLIT=y +CONFIG_BT_BUF_EVT_RX_COUNT=4 +CONFIG_BT_BUF_ACL_TX_COUNT=3 CONFIG_BT_BUF_ACL_TX_SIZE=35 CONFIG_BT_CTLR_DATA_LENGTH_MAX=35 CONFIG_BT_L2CAP_TX_BUF_COUNT=6 diff --git a/boards/arm/thingy91_nrf52840/thingy91_nrf52840_defconfig b/boards/arm/thingy91_nrf52840/thingy91_nrf52840_defconfig index 3eca8278eebe..faadfb1f3165 100644 --- a/boards/arm/thingy91_nrf52840/thingy91_nrf52840_defconfig +++ b/boards/arm/thingy91_nrf52840/thingy91_nrf52840_defconfig @@ -15,3 +15,6 @@ CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_BOOTLOADER_MCUBOOT=y + +# BT +CONFIG_BT_BUF_CMD_TX_COUNT=3 diff --git a/ncs-2.6.4-branch-cherry-picks.txt b/ncs-2.6.4-branch-cherry-picks.txt new file mode 100644 index 000000000000..b25e6ce55e36 --- /dev/null +++ b/ncs-2.6.4-branch-cherry-picks.txt @@ -0,0 +1,323 @@ +# git log --oneline --reverse v3.1.1...HEAD subsys/bluetooth > ncs-2.6.4-branch-cherry-picks.txt + +# ae5db09900 Bluetooth: controller: Fix memory config for channel survey +# bd7fdbc71f Bluetooth: Remove dep on ZLI for BSIM platform +# 561b85e071 bluetooth: controller: update hci_driver to use new scanner memory macro +# 9b002d87d2 treewide: Fix float to double promotion error +# 1ebf62b939 tests: bluetooth: fast_pair: Fix strnlen() warnings +# 8c73911a65 samples: Replace nRF54H20 PDK with DK +# 2b136fee92 bluetooth: controller: Put ECDH driver in the MPSL work queue by default +# 386272cb0f Bluetooth: Mesh: Remove unneeded dependency from metadata extraction +# e2ef01ab15 bluetooth: controller: Add kconfig for scanning/initiating in parallel +# 26c0203d0f bluetooth: fast_pair: Disallow MbedTLS crypto for _ns and new targets +# a223da0578 bluetooth: controller: set bits 22 and 23 in LE Read Supported States +# b820233ab6 bluetooth: controller: increase default tx buffers for PAwR adv +# dd811c8868 bluetooth: controller: hci_driver: memset iso buffer config +# 375009f222 Bluetooth: Fix EnOcean module parsing sensor data as commissioning +# 1fd1259b8c bluetooth: controller: Prepare for changing RX SDU Pool size change +# 51fdb70bca bluetooth: fast_pair: Add PSA crypto backend +# 447f728a4a bluetooth: controller: Add HCI commands for LE Path Loss Monitoring +# e51875cfd7 samples: Change PSA WANT ECC key pair +# b5f3301901 Bluetooth: Controller: Use new APIs to configure ISO buffer use +# 51c7c7e992 Bluetooth: Controller: Configurable RX and TX ISO MTU +# fd87be083a bluetooth: Move bt_rpc.h include from subsys to include +# e988c624ec bluetooth: controller: remove usage of sdc_soc.h in crypto.c +# 04843ac9c6 Bluetooth: Controller: Reuse implementation in bt_read_static_addr +# 8fdd623ecd Bluetooth: Controller: Add support for vendor specific commands +# 589dbc03a5 Bluetooth: Mesh: Fix handling of uninitialized values in Sensor +# 35059d322c bt: kconfig: Support BT_CTLR_ECDH_LIB_OBERON with TFM +# 8834e8a232 bluetooth: services: wifi_prov: fix address access +# 8737aeac90 kconfig: bluetooth: rename BT_BREDR to BT_CLASSIC +# 74420ca4da bluetooth: kconfig: remove BT_RECV_BLOCKING dependency +# f8565ee406 Bluetooth: Mesh: avoid double conversion precision losing +# 4a4815a8d4 Bluetooth: Host: allow reducing initiator priority +# 620f21a693 bluetooth: controller: hci_driver: Add power control memory +# 74cefe0765 Bluetooth: Host: Add missing include +# dd1b2387d2 bluetooth: fast_pair: storage: add storage module for beacon clock +# 17fe32a264 Bluetooth: Mesh: Fix status pub for move set in gen_lvl_srv +# 354d68abf4 bluetooth: fast_pair: fp_storage: Add AK storage minimal implementation +# 2bd5dc7dd5 bluetooth: fast_pair: add crypto API for the FMDN extension +# 776e6f59cb bluetooth: fast_pair: implement FMDN crypto for Oberon backend +# 37cffb612d bluetooth: fast_pair: storage: add storage module for eik +# ab2e9d076c Bluetooth: Mesh: Reduce gen_lvl_srv set publication +# f7f59e4467 bluetooth: fast_pair: introduce kconfig and cmake for FMDN extension +# 9fdf86387a bluetooth: fast_pair: fmdn: add callbacks module +# f1b48d3a8f bluetooth: fast_pair: fmdn: add clock module +# 8869ab8657 bluetooth: fast_pair: fmdn: add DULT integration module +# ba83e927fb bluetooth: fast_pair: fmdn: add battery module +# 9a425fa14c bluetooth: fast_pair: fmdn: add ring module +# aae0dd49c0 bluetooth: fast_pair: fmdn: add state module +# 06c8f7d68b bluetooth: fast_pair: fmdn: add auth module +# d66bdad405 bluetooth: fast_pair: fmdn: add read mode module +# 87691813af bluetooth: fast_pair: fmdn: add beacon actions module +# 596d919337 bluetooth: fast_pair: reject factory reset in ready state for FMDN +# 7e9565edd9 bluetooth: fast_pair: support procedure without bluetooth pairing +# 21b36949eb sysbuild: Add bluetooth mesh DFU metadata support +# f399a1fb9d bluetooth: fast_pair: uuid: add beacon actions uuid to the api header +# b5b2524cd9 bluetooth: Don't reference removed Kconfig symbols +# f33a6c4af9 bluetooth: Remove bt_read_static_addr() "hack" +# a4dd5ea580 bluetooth: controller: Merge BT_HCI_VS_EXT into BT_HCI_VS +# 28055db254 Bluetooth: Mesh: Coverity warning fixed +# ca4f64c4a3 Bluetooth: rpc: Change handling of remote settings initialization +# 438c48431b bluetooth: controller: Move LE Path Loss Monitoring to separate KConfig +# 927dfc6460 Bluetooth: enocean: Add unit test +# 5872e4185a bluetooth: fast_pair: make model ID characteristic configurable +# 27b496d1a5 bluetooth: fast_pair: apply dis overrides when fmdn is disabled +# 6d59580931 bluetooth: fast_pair: use personalized name when fmdn is disabled +# bb9f21fab9 bluetooth: fast_pair: mark personalized name extension as experimental +# f92549677c bluetooth: Fix potential nullptr dereference in mds +# 18a4fd9438 Bluetooth: Mesh: Don't start LC regulator on powerup +# c42007ba5d Bluetooth: Mesh: Fix scene recall for LLC server +# df5fed17b6 bluetooth: fast_pair: remove the experimental tag from the main Kconfig +# 9607ca018e bluetooth: fast_pair: remove the experimental tag from fmdn extension +# 79f748473b Bluetooth: Mesh: Correct typo in LLC server +# bfa09a3681 Bluetooth: Mesh: Improve LLC light property update +# 635fa76ef9 Bluetooth: Add hci_vs_sdc.h which expose wrappers VS HCI commands +# 4afbc3f79d Bluetooth: Remove VS HCI wrappers for coex +# dd6c463747 Bluetooth: _cb_register functions to return int +# 33ce349e57 adv_prov: fast_pair: Fix uninitialized structure +# c7d84c4463 services: hids: Fix possible out-of-bound access +# 27d1272577 bluetooth: rpc: fix gatt client without smp +# 8a5fa875b9 bluetooth: rpc: add static to local functions +# 1f0de181ee Bluetooth: Controller: Enable Connection Subrating support in the SDC +# 046cca6d94 Bluetooth: Controller: Add memory macro for subrating +# b32d531513 bluetooth: fast_pair: separate subsequent pairing feature into Kconfig +# 257c99a252 bluetooth: rpc: add cb unregistration +# 3913864abd nrf: rpc: move serializer and callback proxy to nrf rpc +# aba980b411 Bluetooth: Add "Radio Notification callback" feature +# a406621114 bluetooth: fast_pair: add use case layer and Kconfig selection +# 96fe789cec sdc: handle opcode for VS Set Event Start Task +# 4db7d6a019 bluetooth: Correct dependencies for BT_LL_SOFTDEVICE_HEADERS_INCLUDE +# 945caf70a3 bluetooth: Build hci_vs_sdc if SDC headers are available +# 6d006a8420 bluetooth: controller: use new PLM kconfigs +# 9f37978df6 bluetooth: controller: kconfig: remove old sdc plm kconfig +# 77479e2d04 bluetooth: controller: Select multirole library if using MPSL CX +# 87b48efb36 fast_pair: fp_auth: Fix misspelling in API doc +# 0e7cc47ff9 bluetooth: fast_pair: fp_storage: Fix storage reset +# 0f177a82bc Bluetooth: Controller: Add Connection event anchor point reports +# 4f9ba07303 Bluetooth: Add HCI wrapper for Set Event Start Task +# e8c40ae3d5 Bluetooth: Remove core spec version number from refs +# af9bd1cf2f Bluetooth: Controller: Allow overriding SDC HCI include path +# 6c6d0ff161 bluetooth: controller: Remove call to deprecated SDC coex method +# 57e4140d12 Bluetooth: Controller: Fix reading uninitialized memory +# cf3b9c8fc4 Bluetooth: Host: Utilize hci_vs_sdc.h to simplify code +# 6ff71db587 bluetooth: adv_prov: Add adv_handle parameter +# c22da4b0ad samples: bluetooth: Restore support for BT RPC in HIDS mouse and c. UART +# 49deec1aa9 Bluetooth: Controller: Use multirole lib for any 54L series device +# e950ac12fa bluetooth: controller: Add SDC feature enabler for Path Loss Monitoring +# 8bd9196973 nrf_rpc: UART transport implementation. +# 8dd5d5d1f9 bluetooth: rpc: include shell Kconfig +# d558eadc23 bluetooth: fast_pair: use_case: add use case options for HID devices +# 5751b7332a bluetooth: Use VS Set Event Start Task in radio_notification_conn_cb.c +# 6e9ae016ad bluetooth: fast_pair: fmdn: improve fmdn adv set lifetime management +# 05987151e1 Bluetooth: Controller Update to use the new driver API +# 441982ed86 fast_pair: Drop MbedTLS cryptographic backend support +# 2678a8233c Bluetooth: Host: Remove useless internal include +# 9539f0a1a5 bluetooth: controller: free DPPI channel 13 +# f6f5b32f97 Bluetooth: Host: Use public API to obtain conn handle +# 8e9c3a29f0 Bluetooth: Mesh: fix model id in time shell client +# 4742b26f55 bluetooth: controller: free DPPI 12 on 54L & 54H +# 219f6a4836 manifest: update Zephyr to remove deprecated Kconfig +# 277935f4c3 bluetooth: controller: Select SDC multirole variant if subrating +# bc7ba5100e bluetooth: fast_pair: Fix PSA crypto backend dependencies +# 8e64dd028c bluetooth: controller: Remove experimental flag from subrating +# 30086f3419 bluetooth: fast_pair: fp_gatt_service: Allow to opt-out not used code +# 2e5e36f0c4 bluetooth: fast_pair: Kconfig defaults cleanup +# 5e45476977 bluetooth: fast_pair: use_case: locator_tag: add restrictions +# b97558b386 dts: Bluetooth: Add new DTS binding for the SoftDevice Controller +# 3940f0e728 bluetooth: fast_pair: add kconfig for battery notification extension +# fef20ce1d8 Revert "dts: Bluetooth: Add new DTS binding for the SoftDevice Controller" +# f781fd5801 susbsys: bluetooth: controller: Use new sync transfer mem define +# ec0b9966b4 Bluetooth: radio_notification_conn_cb for 54 series +# 79c0c3c3d2 dts: Bluetooth: Add new DTS binding for the SoftDevice Controller (2) +# 51537ac87c bluetooth: fast_pair: fmdn: Integrate DULT motion detector module +88b468e452 bluetooth: controller: add k_panic() if the hci packet is too big + +# 871eab84cf Bluetooth: Controller: Add device tree dependency to selection +# 503549979f Bluetooth: hci_driver: Mark Anchor point update report as discardable +# 8e944f1efe Bluetooth: radio_notification_callback: Refactor to not use EGUs +# c2300bada6 Bluetooth: radio_notification_callback: Remove experimental label +# d54c2c19af bluetooth: crypto: Adding missing key-types for ECC +# 2541ba2b58 libraries: Update all includes to +# 58f18dc5cd bluetooth: controller: align softdevice with BT_CTLR_CRYPTO_SUPPORT +# b15c1d7ce0 bluetooth: controller: ecdh: enable security backend for tf-m builds +# b2422dc77b Bluetooth: Controller: Kconfig: select BT_CTLR_CRYPTO_SUPPORT for sdc +# 97726616b8 Bluetooth: Mesh: align rpl with subnet bridge changes +# 3a2b093831 bluetooth: fast_pair: crypto: enable security backend for tf-m builds +# 9179359c20 bluetooth: rpc: include Kconfig for logging from Zephyr Bluetooth stack +# 94c905e17f bluetooth: rpc: add nrf53 cpunet enable code +# 9c155e4e33 bluetooth: rpc: Align with the new Zephyr Bluetooth GATT API +# 8c7ee2fea0 bluetooth: fast_pair: Remove the factory reset prepare user action +# 4089f8ec49 bluetooth: mesh: remove deprecated legacy sensor API +# af4286ed6b bluetooth: rpc: fix assert condition +# d66c59bc6d Bluetooth: Controller: Enable Channel Sounding support +# 1deb009b3c bluetooth: fast_pair: Add bond management +# 958275302d fast_pair: Add bond management documentation +# b288e79d02 ble: crypto: Remove NORDIC_SECURITY_BACKEND for ECDH with nrf_oberon +# 6f5194b6ca ble: fast_pair: crypto: Allow for nrf_oberon when TF-M is enabled +# 8e8f3a3b43 Bluetooth: Mesh: Add empty func to rpl.c +# ffbfaa4614 Bluetooth: GATT DM: Schedule host cbs in work q +# f3f9c04fcf bluetooth: mark CS as experimental in Kconfig +# d68032e31f kconfig: Use SOC_NRF54H20_ENGB +# adf1d0fccc Bluetooth: Controller: Add Missing CS HCI cmd Handler +d8f5a506a6 bluetooth: controller: hci_driver: Add option to enable power class 1 + +# a07804cccb Bluetooth: Mesh: Fix recall in light_ctrl_srv +# 86f195311c bluetooth: Initialize conn to NULL for bt_conn_le_create() +# 771d5ce292 bluetooth: services: lbs: button_state only used if poll is enabled +# d5e1da742e bluetooth: services: ras: Add initial folder structure for ranging service +# 27bf3581eb bluetooth: services: ras: Implement Ranging Responder role of RAS +# d0cdd9babd bluetooth: services: ras: Add RREQ implementation to RAS +# 0d227d82bb bluetooth: services: hogp: Pass GATT read's error code +# 992213e5f8 cmake: sysbuild: fast_pair: add support for nRF54H20 non-PM +# 1ac36e15fe treewide: Remove references to SOC_NRF54H20_ENGB_CPURAD +# 3c94a8a267 bluetooth: services: RAS: Add rreq parse function +# 8fdc675d02 samples: bluetooth: Add Channel Sounding Initiator with RREQ sample +# ee2d84ad14 softdevice_controller: Use always-on mram on 54h +# 3872e96db1 Bluetooth: Controller: Remove experimental from parallel scan+init +# c3f89ebef0 bluetooth: remove hci_vs_sdc_set_conn_event_trigger() +# 02f9716596 bluetooth: add Kconfig options to enable optional CS capabilities +# 638711ef0d bluetooth: controller: Allow enabling SDC LLPM on BabbleSim +# 2c45deb3f5 bluetooth: controller: Return an error if LLPM is not supported +# 10edacd3ed all: Remove CONFIG_SOC_NRF54H20_NO_MRAM_LATENCY=n +# 2c47cf7a52 bluetooth: fast_pair: fmdn: callbacks: migrate to slist find API +# 568a7d4cde bluetooth: fast_pair: allow multiple instances of info callbacks +# 49acaa05c6 fast_pair: Remove MRAM1x dependency for targets without Partition Manager +# e70c928eb8 bluetooth: services: ras: rrsp: Fix bug with multiple subevents +# 619d8c1cf9 bluetooth: services: ras: rreq: Allow calling already subscribed err +# 14e6e7b444 bluetooth: services: ras: rreq: Check for aborted subevent +# 1f092fb664 bluetooth: controller: fix MIN_VAL_OF_MAX_ACL_TX_PAYLOAD_DEFAULT +# 29e8546912 bluetooth: services: ras: Fix unaligned memory access in RAS +# dee077dd8a Bluetooth: Controller: Set Extended Advertising Parameters v2 command +# 5241ce0e56 bluetooth: services: ras: rreq: Add feature read functionality +# 5a083ee0b9 Bluetooth: mesh: Fix scene recall for Light Ctrl server +# 59be6ede09 bluetooth: fast_pair: allow the callback registration in SYS_INIT +# f39663d47b bluetooth: services: User data in HID service callback +# 3bf7d40e19 Bluetooth: Mesh: fix uptime to tai conversion inaccuracy +52b63957ad bluetooth: hci_driver: Fix deadlock in MPSL workq +aec6383d2d bluetooth: hci_driver: Process recvd msgs directly from SDC callback + +# 33bdc5fa3a bluetooth: controller: remove vs supported commands implementation +# 12223d7199 Bluetooth: Mesh: fix defaults for generic location srv +# f25ade654e bluetooth: services: report id in out/feature report data callback +# 87bd56e139 bluetooth: services: report id in input report notification callback +# 11284f3b11 bluetooth: Add required heap to the gatt_dm +# fcbe2bb365 bluetooth: controller: Add dependencies to Kconfig symbols +# a2f01a97bd Bluetooth: Mesh: light_temp_srv added publication +# 82d3d2677a treewide: Remove child/parent image support +# d9462735dd Bluetooth: Mesh: Fix idx in dtt_srv_get +# d10da56ffe Bluetooth: Controller: Update to memory allocation for CS +# 87dfbdb86f Bluetooth: Controller: Remove use of SDC_MEM_CS_DEPRECATED +# 2b05cc3b0d Bluetooth: Mesh: fix NO_ACTIONS scheduling +# cf7594ee83 bluetooth: host_extension: RTCx time diff may be negative +# c8c315ab0d bluetooth: rpc: remove unnecessary source +# 4b22fc763c bluetooth: rpc: Remove dependency on BT_DRIVERS +# 45bb11c4a0 bluetooth: controller: Kconfig: Adapt to upstream Zephyr changes +# 635d71dae3 treewide: Adapt to upstream Zephyr changes related to BT_CTLR +# 2c121828f7 samples: bluetooth: Update to no longer use deprecated adv resume +# 5c37d82e85 treewide: Remove redefinitions of SEC_PER_HOUR and SEC_PER_DAY +# d3148c6849 treewide: Synchronize wifi_credentials and wifi_mgmt_ext with upstream +# 3dc26aa7b2 Bluetooth: Mesh: adapting configuration parameters +# 948bc5c66e bluetooth: mesh: PSA requires RNG enabled +# 1e840b035e bluetooth: Remove references to BT_TINYCRYPT_ECC +# 0ad47f18dd mesh: Add link to mbedTLS for simulator tests to find psa/crypto.h +# fcc36a2237 bluetooth: rpc: Remove deprecated bt_le_set_auto_conn +# 9047a00bdd bluetooth: controller: Adjust stack sizes due to PSA change +# ebc79e09fd bluetooth: services: wifi_prov: Fix setting of nanopb_BUILD_RUNTIME +# f3d45ca3b5 mpsl: clock_ctrl: Integration layer with nRF clock control +# c223901da7 driver: creating a cs multiantenna callback +# 5481bb27a3 Bluetooth: Controller: Use SOC_COMPATIBLE for setting SDC lib variant +# 7738cefb2c Bluetooth: Mesh: enable HUK init in driver +# db14165d79 bluetooth: fast_pair: fmdn: extend api with a callback for conn auth +# 6c574e3779 samples: nrf_rpc: ps_client: fix BLE snippet after upmerge +# 560e88d8c4 Bluetooth: Mesh: make bsim mesh with mbedtls workable +77661839cf Bluetooth: Controller: Ensure controller can handle flow control buffers + +# 42cd2d1da1 mpsl: pm: Add MRAM low latency request and response handling +# 007584f392 bluetooth: controller: Return code from sdc_init was overwirtten +# 1883f06ef4 Bluetooth: Mesh: disable HUK for nrf52 ble mesh +# 34740f13c7 bluetooth: mesh: Overwrite secure storage backend config +# 374673e77e bluetooth: controller: use DIRSET mask for antenna switch gpios +# 7669bb8121 bluetooth: fast_pair: fmdn: add restriction for fmdn tx power +# f79bb54aa2 driver: switch to new sdc_support_channel_sounding function +# dc3dcfd6f1 Bluetooth: Mesh: Fixed reported coverity issues +# 23efa5b583 Bluetooth: Controller: Add support for Advertising Coding Selection +# 7c2ec0dfc2 bluetooth: controller: Use GPIO driver for CS antenna switching +# 4b7980286e bluetooth: controller: Fix compilation error in cs_antenna_switch.c +# fdd05c60af bluetooth: controller: fix single-pin multiplexed antenna switch +# 029bc8024e bluetooth: mesh: Correct CMakeLists.txt formatting +# 3db08122ae bluetooth: services: Fix discarding valid steps in RAS RREQ parser +# d7272535eb bluetooth: services: prefer ind over notif in RAS when relevant +# 509cb57490 sysbuild: fast_pair: add Model ID and Anti-Spoofing Key Kconfig options +# 9ad5d51f6d bluetooth: controller: Reset ECDH command on deinitialization +# f3b5d2747d bluetooth: services: Fix RAS ring buffer alloc overflow issue +# 8db30da07e bluetooth: services: Support aborted procedures/subevents in RAS +# d3f4cedfc1 Bluetooth: Mesh: add tc to psa key convertor +# 7525bf5382 Bluetooth: controller: Don't select ECDH support +# 190839b44b bluetooth: fast_pair: fmdn: add uptime workaround to the clock module +# b820eaf478 bluetooth: fast_pair: fmdn: add API for checking the provisioning state +# 86638730d9 Bluetooth: Mesh: remove bt long wq customization +# 6082787b4f Bluetooth: decrease bt long wq size +# 9eeb85faf9 bluetooth: services: ras: Fix RAS RRSP after GATT API changes +# b4b0ece65e applications: nrf5340_audio: Added BT_PRIVATE_SHELL +# eaa31b396e bluetooth: services: ras: Add callback for ranging header in parser. +# 4ac10c6e31 bluetooth: Add channel sounding distance estimation library +# 6f8e19f1b0 doc: Update documentation for Channel Sounding Kconfig options +# fa895eff2d doc: Update docs for Channel Sounding Ranging Service Kconfig options +# a52948108d Bluetooth: Mesh: Increase default MBEDTLS_HEAP_SIZE for NLC profile +# c167d918f9 bluetooth: samples: Apply callback changes of CS complete events +# 261d002e60 Bluetooth: controller: Remove ECDH implementation +# a939310a7a doc: Remove [EXPERIMENTAL] tag from Channel Sounding Kconfigs +# 81bb2ad59a bluetooth: controller: Use new SDC variants for nRF54L +# 4e15fed7e3 bluetooth: services: Set RTT estimate to NAN if negative +# 30b1946844 bluetooth: fast_pair: fmdn: Fix Kconfig dependency misalignment +# 5bb0759d0c bluetooth: services: Implement real-time ranging data service +# bc5b776f39 bluetooth: samples: Use real-time ranging data in RAS samples +# 68eeb4eee8 bluetooth: services: Redefine the CS RAS reassembly buffer kconfig +beadde7490 Bluetooth: Controller: Port HCI Command buffer allocation + +# d869608228 Bluetooth: Host: Rename _bt_gatt_ccc to bt_gatt_ccc_managed_user_data +# 65ccff6ce0 Bluetooth: rpc: Change signature of bt_conn_get_remote_info +# 4ca3691a9d Bluetooth: rpc: cast conn to not const +# 374687627c Bluetooth: Services: Rename BT_GATT_CCC_INITIALIZER +# 73be2dddbc bluetooth: mesh: add more mbedtls heap for dfu distributor +# 64c7bf3d2a bluetooth: samples: Save and restore local steps in RAS server callback +# 408e58f475 bluetooth|mpsl: Prepare to support nRF71 series in SDC and MPSL +# f89ca53984 bluetooth: services: Use BT_GATT_CCC_WITH_WRITE_CB in RRSP +# 7167fc695d bluetooth: fast_pair: fmdn: improve conn state handling and logging +# dc69d93d67 bluetooth: improving linking for channel sounding +# 1d6ebb4427 bluetooth: controller: add command handler for new VS HCI command +# 79addd913e bluetooth: improving linking for channel sounding +399a846eb4 bluetooth: controller: add missing feature bit for power class 1 + +# e7153cd716 softdevice_controller: Remove BT_CTRL_SDC_BSIM_BUILD Kconfig +# 963abf85f2 bluetooth: rpc: Rename nrf53_cpunet_init() +# 85d05d5217 bluetooth: controller: move HCI packet types to net_buf payload +8d38c08481 bluetooth: Add support for LE Power Class 1 Feature + +# 35a7c6743e bluetooth: fast_pair: introduce Fast Pair advertising manager +# 00e622635a bluetooth: Make it possible to use radio notification cb with bt_disable +# 16275c5a70 bluetooth: improving linking for channel sounding +# 7a4fa45bf0 bluetooth: Fix radio notification callback with GRTC +# 901e00f341 Revert "bluetooth: fast_pair: fmdn: add uptime workaround to the clock module" +# e5ee3ed5f6 bluetooth: rpc: move serialization SYS_INIT to APPLICATION level +# 4bbfb4ff79 Bluetooth: Controller: Fix KConfig comment typo +# c34231ef1b nrf_rpc: Remove build assert for undefined CONFIG_BT_BREDR +# db745e9969 bluetooth: hci: Replace bt_hci_cmd_create() with bt_hci_cmd_alloc() +# c390622264 samples: bluetooth: mesh: Clear all bonds on Node-Reset +# 92664d3536 bluetooth: rpc: fix enable, disable, enable scenario +# 3c221e6bbc bluetooth: hci: remove mention of bt_hci_cmd_create in some docs +# 931e1fa3e4 bluetooth: rpc: reclaim GATT buffer on bt_disable +# 22bbbf7d7f bluetooth: services: ras: fix ranging buffer value bug +# 3aba835355 bluetooth: fast_pair: adv_manager: fix module dependency on FMDN +# 93ce046618 bluetooth: fast_pair: adv_manager: add missing Kconfig dependency +# f4123c1d7f bluetooth: controller: Set default ACL spacing when CS is used +# 465de1b4a6 bluetooth: hci_driver: Add missing mpsl.h include +# ab6af6e8c2 bluetooth: mesh: clear bonds for all ids on node reset +# b0e7a445a2 bluetooth: controller: stop using deprecated mode3 support config +# 263c182c4b provisioning: wifi: Add enterprise security support +# f65b94e932 bluetooth: wifi_prov: Update auth mode to match Zephyr enumerations +# 373b1f75ec bluetooth: wifi_prov: Add tools to generate encoded string +# 749b3f4b08 wifi_prov: Rejig the library to use for multiple transports +# 1fab212cb9 bluetooth: make host and sdc tx numbers aligned +# 10db0ac0d3 bluetooth: mesh: increase mesh work queue stack size diff --git a/samples/bluetooth/peripheral_lbs/prj_minimal.conf b/samples/bluetooth/peripheral_lbs/prj_minimal.conf index 08aede05b608..7ba3ed93d309 100644 --- a/samples/bluetooth/peripheral_lbs/prj_minimal.conf +++ b/samples/bluetooth/peripheral_lbs/prj_minimal.conf @@ -102,9 +102,9 @@ CONFIG_BT_CTLR_PHY_2M=n # Reduce Bluetooth buffers CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1 CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=43 -CONFIG_BT_BUF_EVT_RX_COUNT=2 CONFIG_BT_CONN_TX_MAX=2 CONFIG_BT_L2CAP_TX_BUF_COUNT=2 +CONFIG_BT_BUF_EVT_RX_COUNT=4 CONFIG_BT_BUF_ACL_TX_COUNT=3 CONFIG_BT_BUF_ACL_TX_SIZE=27 diff --git a/samples/bluetooth/peripheral_uart/prj_minimal.conf b/samples/bluetooth/peripheral_uart/prj_minimal.conf index 806d22cc813e..01a412aa0711 100644 --- a/samples/bluetooth/peripheral_uart/prj_minimal.conf +++ b/samples/bluetooth/peripheral_uart/prj_minimal.conf @@ -122,9 +122,9 @@ CONFIG_BT_CTLR_PHY_2M=n # Reduce Bluetooth buffers CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1 CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=43 -CONFIG_BT_BUF_EVT_RX_COUNT=2 CONFIG_BT_CONN_TX_MAX=2 CONFIG_BT_L2CAP_TX_BUF_COUNT=2 +CONFIG_BT_BUF_EVT_RX_COUNT=4 CONFIG_BT_BUF_ACL_TX_COUNT=3 CONFIG_BT_BUF_ACL_TX_SIZE=27 diff --git a/samples/bluetooth/throughput/prj.conf b/samples/bluetooth/throughput/prj.conf index 3ceafd626176..3a1b04c4a752 100644 --- a/samples/bluetooth/throughput/prj.conf +++ b/samples/bluetooth/throughput/prj.conf @@ -36,6 +36,7 @@ CONFIG_BT_L2CAP_TX_BUF_COUNT=10 CONFIG_BT_L2CAP_TX_MTU=498 CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y CONFIG_BT_CONN_TX_MAX=10 +CONFIG_BT_BUF_EVT_RX_COUNT=11 CONFIG_BT_BUF_ACL_TX_COUNT=10 CONFIG_BT_BUF_ACL_TX_SIZE=502 diff --git a/subsys/bluetooth/controller/CMakeLists.txt b/subsys/bluetooth/controller/CMakeLists.txt index 6f8d09b6a906..b4b9f6670f41 100644 --- a/subsys/bluetooth/controller/CMakeLists.txt +++ b/subsys/bluetooth/controller/CMakeLists.txt @@ -9,6 +9,7 @@ zephyr_library() zephyr_library_sources( hci_driver.c hci_internal.c + hci_internal_wrappers.c ) zephyr_library_sources_ifdef( diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 7deec4fcf012..cc766b9c6bbf 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -550,5 +550,13 @@ config BT_CTLR_SDC_CIS_SUBEVENT_LENGTH_US If this parameter is set to zero, the subevent length is chosen by the controller. +config BT_CTLR_SDC_LE_POWER_CLASS_1 + bool "Device supports transmitting at LE Power Class 1 level" + default y if BT_CTLR_TX_PWR_ANTENNA >= 10 + help + This should be set if the device supports transmitting above +10dBm. + See Bluetooth Core Specification, Vol 6, Part A, Section 3 + Transmitter Characteristics for more information. + endmenu endif # BT_LL_SOFTDEVICE diff --git a/subsys/bluetooth/controller/hci_driver.c b/subsys/bluetooth/controller/hci_driver.c index 65bdb2d3d852..e8151b5fbdef 100644 --- a/subsys/bluetooth/controller/hci_driver.c +++ b/subsys/bluetooth/controller/hci_driver.c @@ -36,6 +36,14 @@ #include "zephyr/logging/log.h" LOG_MODULE_REGISTER(bt_sdc_hci_driver); + +#if defined(CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT) +#define HCI_RX_BUF_SIZE MAX(BT_BUF_RX_SIZE, \ + BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE)) +#else +#define HCI_RX_BUF_SIZE BT_BUF_RX_SIZE +#endif + #if defined(CONFIG_BT_CONN) && defined(CONFIG_BT_CENTRAL) #if CONFIG_BT_MAX_CONN > 1 @@ -270,6 +278,23 @@ static inline void receive_signal_raise(void) mpsl_work_submit(&receive_work); } +/** Storage for HCI packets from controller to host */ +static struct { + /* Buffer for the HCI packet. */ + uint8_t buf[HCI_RX_BUF_SIZE]; + /* Type of the HCI packet the buffer contains. */ + sdc_hci_msg_type_t type; +} rx_hci_msg; + +static void bt_buf_rx_freed_cb(enum bt_buf_type type_mask) +{ + if (((rx_hci_msg.type == SDC_HCI_MSG_TYPE_EVT && (type_mask & BT_BUF_EVT) != 0u) || + (rx_hci_msg.type == SDC_HCI_MSG_TYPE_DATA && (type_mask & BT_BUF_ACL_IN) != 0u) || + (rx_hci_msg.type == SDC_HCI_MSG_TYPE_ISO && (type_mask & BT_BUF_ISO_IN) != 0u))) { + receive_signal_raise(); + } +} + static int cmd_handle(struct net_buf *cmd) { LOG_DBG(""); @@ -371,16 +396,16 @@ static int hci_driver_send(struct net_buf *buf) return err; } -static void data_packet_process(uint8_t *hci_buf) +static int data_packet_process(uint8_t *hci_buf) { - struct net_buf *data_buf = bt_buf_get_rx(BT_BUF_ACL_IN, K_FOREVER); + struct net_buf *data_buf = bt_buf_get_rx(BT_BUF_ACL_IN, K_NO_WAIT); struct bt_hci_acl_hdr *hdr = (void *)hci_buf; uint16_t hf, handle, len; uint8_t flags, pb, bc; if (!data_buf) { - LOG_ERR("No data buffer available"); - return; + LOG_DBG("No data buffer available"); + return -ENOBUFS; } len = sys_le16_to_cpu(hdr->len); @@ -390,23 +415,47 @@ static void data_packet_process(uint8_t *hci_buf) pb = bt_acl_flags_pb(flags); bc = bt_acl_flags_bc(flags); + if (len + sizeof(*hdr) > HCI_RX_BUF_SIZE) { + LOG_ERR("Event buffer too small. %u > %u", + len + sizeof(*hdr), + HCI_RX_BUF_SIZE); + return -ENOMEM; + } + LOG_DBG("Data: handle (0x%02x), PB(%01d), BC(%01d), len(%u)", handle, pb, bc, len); net_buf_add_mem(data_buf, &hci_buf[0], len + sizeof(*hdr)); + bt_recv(data_buf); + + return 0; } -static void iso_data_packet_process(uint8_t *hci_buf) +static int iso_data_packet_process(uint8_t *hci_buf) { - struct net_buf *data_buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER); + struct net_buf *data_buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_NO_WAIT); struct bt_hci_iso_hdr *hdr = (void *)hci_buf; uint16_t len = sys_le16_to_cpu(hdr->len); + if (!data_buf) { + LOG_DBG("No data buffer available"); + return -ENOBUFS; + } + + if (len + sizeof(*hdr) > HCI_RX_BUF_SIZE) { + LOG_ERR("Event buffer too small. %u > %u", + len + sizeof(*hdr), + HCI_RX_BUF_SIZE); + return -ENOMEM; + } + net_buf_add_mem(data_buf, &hci_buf[0], len + sizeof(*hdr)); bt_recv(data_buf); + + return 0; } static bool event_packet_is_discardable(const uint8_t *hci_buf) @@ -451,12 +500,19 @@ static bool event_packet_is_discardable(const uint8_t *hci_buf) } } -static void event_packet_process(uint8_t *hci_buf) +static int event_packet_process(uint8_t *hci_buf) { bool discardable = event_packet_is_discardable(hci_buf); struct bt_hci_evt_hdr *hdr = (void *)hci_buf; struct net_buf *evt_buf; + if (hdr->len + sizeof(*hdr) > HCI_RX_BUF_SIZE) { + LOG_ERR("Event buffer too small. %u > %u", + hdr->len + sizeof(*hdr), + HCI_RX_BUF_SIZE); + return -ENOMEM; + } + if (hdr->evt == BT_HCI_EVT_LE_META_EVENT) { struct bt_hci_evt_le_meta_event *me = (void *)&hci_buf[2]; @@ -480,67 +536,81 @@ static void event_packet_process(uint8_t *hci_buf) LOG_DBG("Event (0x%02x) len %u", hdr->evt, hdr->len); } - evt_buf = bt_buf_get_evt(hdr->evt, discardable, - discardable ? K_NO_WAIT : K_FOREVER); + evt_buf = bt_buf_get_evt(hdr->evt, discardable, K_NO_WAIT); if (!evt_buf) { if (discardable) { LOG_DBG("Discarding event"); - return; + return 0; } - LOG_ERR("No event buffer available"); - return; + LOG_DBG("No event buffer available"); + return -ENOBUFS; } net_buf_add_mem(evt_buf, &hci_buf[0], hdr->len + sizeof(*hdr)); + bt_recv(evt_buf); + + return 0; } -static bool fetch_and_process_hci_msg(uint8_t *p_hci_buffer) +static int fetch_hci_msg(uint8_t *p_hci_buffer, sdc_hci_msg_type_t *msg_type) { int errcode; - sdc_hci_msg_type_t msg_type; errcode = MULTITHREADING_LOCK_ACQUIRE(); if (!errcode) { - errcode = hci_internal_msg_get(p_hci_buffer, &msg_type); + errcode = hci_internal_msg_get(p_hci_buffer, msg_type); MULTITHREADING_LOCK_RELEASE(); } - if (errcode) { - return false; - } + return errcode; +} + +static int process_hci_msg(uint8_t *p_hci_buffer, sdc_hci_msg_type_t msg_type) +{ + int err; if (msg_type == SDC_HCI_MSG_TYPE_EVT) { - event_packet_process(p_hci_buffer); + err = event_packet_process(p_hci_buffer); } else if (msg_type == SDC_HCI_MSG_TYPE_DATA) { - data_packet_process(p_hci_buffer); + err = data_packet_process(p_hci_buffer); } else if (msg_type == SDC_HCI_MSG_TYPE_ISO) { - iso_data_packet_process(p_hci_buffer); + err = iso_data_packet_process(p_hci_buffer); } else { if (!IS_ENABLED(CONFIG_BT_CTLR_SDC_SILENCE_UNEXPECTED_MSG_TYPE)) { LOG_ERR("Unexpected msg_type: %u. This if-else needs a new branch", msg_type); } + err = 0; } - return true; + return err; } void hci_driver_receive_process(void) { -#if defined(CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT) - static uint8_t hci_buf[MAX(BT_BUF_RX_SIZE, - BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE))]; -#else - static uint8_t hci_buf[BT_BUF_RX_SIZE]; -#endif + int err; - if (fetch_and_process_hci_msg(&hci_buf[0])) { - /* Let other threads of same priority run in between. */ - receive_signal_raise(); + if (rx_hci_msg.type == SDC_HCI_MSG_TYPE_NONE && + fetch_hci_msg(&rx_hci_msg.buf[0], &rx_hci_msg.type) != 0) { + return; + } + + err = process_hci_msg(&rx_hci_msg.buf[0], rx_hci_msg.type); + if (err == -ENOBUFS) { + /* If we got -ENOBUFS, wait for the signal from the host. */ + return; + } else if (err) { + LOG_ERR("Unknown error when processing hci message %d", err); + k_panic(); } + + rx_hci_msg.type = SDC_HCI_MSG_TYPE_NONE; + + /* Let other threads of same priority run in between. */ + receive_signal_raise(); } static void receive_work_handler(struct k_work *work) @@ -828,6 +898,13 @@ static int configure_supported_features(void) } } + if (IS_ENABLED(CONFIG_BT_CTLR_SDC_LE_POWER_CLASS_1)) { + err = sdc_support_le_power_class_1(); + if (err) { + return -ENOTSUP; + } + } + return 0; } @@ -1165,7 +1242,7 @@ static int hci_driver_open(void) } #endif - err = sdc_enable(receive_signal_raise, sdc_mempool); + err = sdc_enable(hci_driver_receive_process, sdc_mempool); if (err) { MULTITHREADING_LOCK_RELEASE(); return err; @@ -1263,6 +1340,8 @@ static int hci_driver_open(void) MULTITHREADING_LOCK_RELEASE(); + bt_buf_rx_freed_cb_set(bt_buf_rx_freed_cb); + return 0; } @@ -1295,6 +1374,8 @@ static int hci_driver_close(void) MULTITHREADING_LOCK_RELEASE(); + bt_buf_rx_freed_cb_set(NULL); + return err; } diff --git a/subsys/bluetooth/controller/hci_internal.c b/subsys/bluetooth/controller/hci_internal.c index cda77e81a7fd..533daa0f5ead 100644 --- a/subsys/bluetooth/controller/hci_internal.c +++ b/subsys/bluetooth/controller/hci_internal.c @@ -16,6 +16,7 @@ #include #include "hci_internal.h" +#include "hci_internal_wrappers.h" #include "ecdh.h" #define CMD_COMPLETE_MIN_SIZE (BT_HCI_EVT_HDR_SIZE \ @@ -773,6 +774,10 @@ void hci_internal_le_supported_features( #if defined(CONFIG_BT_CTLR_SDC_PAWR_SYNC) features->params.periodic_advertising_with_responses_scanner = 1; #endif + +#if defined(CONFIG_BT_CTLR_SDC_LE_POWER_CLASS_1) + features->params.le_Power_class_1 = 1; +#endif /* CONFIG_BT_CTLR_SDC_LE_POWER_CLASS_1 */ } static void le_read_supported_states(uint8_t *buf) @@ -891,7 +896,7 @@ static uint8_t controller_and_baseband_cmd_put(uint8_t const * const cmd, case SDC_HCI_OPCODE_CMD_CB_SET_CONTROLLER_TO_HOST_FLOW_CONTROL: return sdc_hci_cmd_cb_set_controller_to_host_flow_control((void *)cmd_params); case SDC_HCI_OPCODE_CMD_CB_HOST_BUFFER_SIZE: - return sdc_hci_cmd_cb_host_buffer_size((void *)cmd_params); + return sdc_hci_cmd_cb_host_buffer_size_wrapper((void *)cmd_params); case SDC_HCI_OPCODE_CMD_CB_HOST_NUMBER_OF_COMPLETED_PACKETS: return sdc_hci_cmd_cb_host_number_of_completed_packets((void *)cmd_params); #endif diff --git a/subsys/bluetooth/controller/hci_internal_wrappers.c b/subsys/bluetooth/controller/hci_internal_wrappers.c new file mode 100644 index 000000000000..7b04b763a671 --- /dev/null +++ b/subsys/bluetooth/controller/hci_internal_wrappers.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include "hci_internal_wrappers.h" +#include +#include + +#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) +/* + * The Host will generate up to acl_pkts number of Host Number of Completed Packets command plus a + * number of normal HCI commands, as such we need to ensure the tx command buffer count is big + * enough to not block incoming ACKs from the host. + * + * When Controller to Host data flow control is supported, ensure that `CONFIG_BT_BUF_CMD_TX_COUNT` + * is greater than or equal to `BT_BUF_ACL_RX_COUNT + Ncmd`, where Ncmd is the supported maximum + * Num_HCI_Command_Packets. + * + * The SDC controller (currently) does not support Num_HCI_Command_Packets > 1, which means Ncmd + * is always 1. + * + * `CONFIG_BT_BUF_CMD_TX_COUNT` is used differently depending on whether `CONFIG_BT_HCI_HOST` or + * `BT_HCI_RAW` is defined. And as ACL packet pools are only used in connections, + * we need to limit the build assert as such. See the comments above the asserts for more + * information on the specific scenario. + */ +#if defined(CONFIG_BT_HCI_HOST) && (BT_BUF_ACL_RX_COUNT > 0) +/* + * When `CONFIG_BT_HCI_HOST`, `CONFIG_BT_BUF_CMD_TX_COUNT` controls the capacity of + * `bt_hci_cmd_create`. Which is used for all BT HCI Commands, and can be called concurrently from + * many different application contexts, initiating various processes. + * + * Currently `bt_hci_cmd_create` is generally `K_FOREVER`, as such this build assert only guarantees + * to avoid deadlocks due to missing CMD buffers, if the host is only allocating the next command + * once the previous is completed. + */ +#define BT_BUF_CMD_TX_COUNT CONFIG_BT_BUF_CMD_TX_COUNT + +BUILD_ASSERT(BT_BUF_ACL_RX_COUNT < BT_BUF_CMD_TX_COUNT, + "Too low HCI command buffers compared to ACL Rx buffers."); +#else /* controller-only build */ +/* + * On a controller-only build (`BT_HCI_RAW`) `CONFIG_BT_BUF_CMD_TX_COUNT` controls the capacity of + * `bt_buf_get_tx(BT_BUF_CMD)`. Which is only used to receive commands from the Host at the rate the + * command flow control dictates. Considering one buffer is needed to the Num_HCI_Command_Packet, to + * do flow control, at least one more buffer is needed. + * + */ +#define BT_BUF_CMD_TX_COUNT (BT_BUF_RX_COUNT + 1) + +BUILD_ASSERT((BT_BUF_CMD_TX_COUNT - 1) > 0, + "We need at least two HCI command buffers to avoid deadlocks."); +#endif /* CONFIG_BT_CONN && CONFIG_BT_HCI_HOST */ + +/* + * This wrapper addresses a limitation in some Zephyr HCI samples such as Zephyr hci_ipc, namely the + * dropping of Host Number of Completed Packets (HNCP) messages when buffers are full. Dropping + * these messages causes a resource leak. + * + * The buffers are full when CONFIG_BT_BUF_CMD_TX_COUNT is exhausted. This wrapper implements a + * workaround that ensures the buffers are never exhausted, by limiting the + * Host_Total_Num_ACL_Data_Packets value. Limiting this value naturally limits the number of HNCP to + * one the sample buffers can handle. + * + * Considering the sample uses the same buffer pool for normal commands, which take up one buffer at + * most (look up `HCI_Command_Complete` for more details), this wrapper artifically limits the + * Host_Total_Num_ACL_Data_Packets to at most one less than the CONFIG_BT_BUF_CMD_TX_COUNT pool + * capacity. + * . + */ +int sdc_hci_cmd_cb_host_buffer_size_wrapper(const sdc_hci_cmd_cb_host_buffer_size_t *cmd_params) +{ + sdc_hci_cmd_cb_host_buffer_size_t ctrl_cmd_params = *cmd_params; + + ctrl_cmd_params.host_total_num_acl_data_packets = MIN( + ctrl_cmd_params.host_total_num_acl_data_packets, (BT_BUF_CMD_TX_COUNT - 1)); + + return sdc_hci_cmd_cb_host_buffer_size(&ctrl_cmd_params); +} +#endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */ diff --git a/subsys/bluetooth/controller/hci_internal_wrappers.h b/subsys/bluetooth/controller/hci_internal_wrappers.h new file mode 100644 index 000000000000..1bfa772a9943 --- /dev/null +++ b/subsys/bluetooth/controller/hci_internal_wrappers.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +/** @file + * @brief Internal HCI interface Wrappers + */ + +#include +#include +#include + +#ifndef HCI_INTERNAL_WRAPPERS_H__ +#define HCI_INTERNAL_WRAPPERS_H__ + +#if defined(__DOXYGEN__) || defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) +int sdc_hci_cmd_cb_host_buffer_size_wrapper(const sdc_hci_cmd_cb_host_buffer_size_t *cmd_params); +#endif + +#endif diff --git a/test-manifests/99-default-test-nrf.yml b/test-manifests/99-default-test-nrf.yml index 232e51ff0413..2249dedfc180 100644 --- a/test-manifests/99-default-test-nrf.yml +++ b/test-manifests/99-default-test-nrf.yml @@ -11,7 +11,7 @@ manifest: - name: test_nrf remote: ncs-test repo-path: test-fw-nrfconnect-nrf - revision: v2.6-branch + revision: release/ncs-v2.6-branch-NCSIDB-1718 import: name-blocklist: [sdk-nrf] userdata: diff --git a/tests/bluetooth/iso/prj.conf b/tests/bluetooth/iso/prj.conf index 062a80cae2b5..a85b689c8892 100644 --- a/tests/bluetooth/iso/prj.conf +++ b/tests/bluetooth/iso/prj.conf @@ -24,6 +24,7 @@ CONFIG_BT_NUS=y CONFIG_BT_NUS_CLIENT=y CONFIG_BT_GATT_DM=y CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_BUF_EVT_RX_COUNT=11 CONFIG_BT_BUF_ACL_TX_COUNT=10 CONFIG_BT_ATT_PREPARE_COUNT=2 CONFIG_BT_L2CAP_TX_BUF_COUNT=10 diff --git a/tests/subsys/bluetooth/controller/CMakeLists.txt b/tests/subsys/bluetooth/controller/CMakeLists.txt new file mode 100644 index 000000000000..68f2a9255e72 --- /dev/null +++ b/tests/subsys/bluetooth/controller/CMakeLists.txt @@ -0,0 +1,26 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(hci_cmd_cb_host_buffer_size_test) + +# Generate runner for the test +test_runner_generate(src/hci_cmd_cb_host_buffer_size_test.c) + +# Add Unit Under Test source files +target_sources(app PRIVATE ${ZEPHYR_NRF_MODULE_DIR}/subsys/bluetooth/controller/hci_internal_wrappers.c) + +# Add test source file +target_sources(app PRIVATE src/hci_cmd_cb_host_buffer_size_test.c) + +# Create mocks +cmock_handle(${ZEPHYR_NRFXLIB_MODULE_DIR}/softdevice_controller/include/sdc_hci_cmd_controller_baseband.h) + +# Include paths +include_directories(${ZEPHYR_HAL_NORDIC_MODULE_DIR}/nrfx) +include_directories(${ZEPHYR_NRF_MODULE_DIR}/subsys/bluetooth/controller) diff --git a/tests/subsys/bluetooth/controller/_testcase.yaml b/tests/subsys/bluetooth/controller/_testcase.yaml new file mode 100644 index 000000000000..72ad74b6f9f1 --- /dev/null +++ b/tests/subsys/bluetooth/controller/_testcase.yaml @@ -0,0 +1,9 @@ +tests: + bluetooth.controller: + platform_allow: + - native_sim + integration_platforms: + - native_sim + tags: + - unittest + - ci_tests_subsys_bluetooth_controller diff --git a/tests/subsys/bluetooth/controller/prj.conf b/tests/subsys/bluetooth/controller/prj.conf new file mode 100644 index 000000000000..8c317c5c4c56 --- /dev/null +++ b/tests/subsys/bluetooth/controller/prj.conf @@ -0,0 +1,13 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# +CONFIG_BT_CENTRAL=y +CONFIG_BT_HCI=y +CONFIG_BT=y + +CONFIG_BT_HCI_ACL_FLOW_CONTROL=y +CONFIG_BT_BUF_CMD_TX_COUNT=10 + +CONFIG_UNITY=y diff --git a/tests/subsys/bluetooth/controller/src/hci_cmd_cb_host_buffer_size_test.c b/tests/subsys/bluetooth/controller/src/hci_cmd_cb_host_buffer_size_test.c new file mode 100644 index 000000000000..4f3353989546 --- /dev/null +++ b/tests/subsys/bluetooth/controller/src/hci_cmd_cb_host_buffer_size_test.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +#include +#include +#include +#include +#include + +#include "hci_internal_wrappers.h" +#include "cmock_sdc_hci_cmd_controller_baseband.h" + +#define TEST_HOST_ACL_DATA_PCKT_LNGTH 55 +#define TEST_HOST_SYNC_DATA_PCKT_LNGTH 55 +#define TEST_HOST_NUM_SYNC_DATA_PCKTS 5555 + +/* The unity_main is not declared in any header file. It is only defined in the generated test + * runner because of ncs' unity configuration. It is therefore declared here to avoid a compiler + * warning. + */ +extern int unity_main(void); + +typedef struct { + uint16_t acl_input_pckts; + uint16_t exp_acl_pckts; +} test_vector_t; + +static const test_vector_t test_vectors[] = { + {5, 5}, /* Input within range, no adjustment needed */ + {15, (CONFIG_BT_BUF_CMD_TX_COUNT - 1)}, /* Input exceeds TX buffer count - 1 limit */ + {0xFF, (CONFIG_BT_BUF_CMD_TX_COUNT - 1)}, /* Maximum input value, corner case */ +}; + +void test_sdc_hci_cmd_cb_host_buffer_size_wrapper(void) +{ + sdc_hci_cmd_cb_host_buffer_size_t cmd_params; + + cmd_params.host_acl_data_packet_length = TEST_HOST_ACL_DATA_PCKT_LNGTH; + cmd_params.host_sync_data_packet_length = TEST_HOST_SYNC_DATA_PCKT_LNGTH; + cmd_params.host_total_num_sync_data_packets = TEST_HOST_NUM_SYNC_DATA_PCKTS; + + for (size_t i = 0; i < ARRAY_SIZE(test_vectors); i++) { + const test_vector_t *v = &test_vectors[i]; + + sdc_hci_cmd_cb_host_buffer_size_t exp_cmd_params = cmd_params; + + exp_cmd_params.host_total_num_acl_data_packets = v->exp_acl_pckts; + __cmock_sdc_hci_cmd_cb_host_buffer_size_ExpectAndReturn(&exp_cmd_params, 0); + + cmd_params.host_total_num_acl_data_packets = v->acl_input_pckts; + sdc_hci_cmd_cb_host_buffer_size_wrapper(&cmd_params); + } +} + +int main(void) +{ + (void)unity_main(); + + return 0; +} diff --git a/west.yml b/west.yml index db5ca6af4ccb..ff3a9a5026ba 100644 --- a/west.yml +++ b/west.yml @@ -61,7 +61,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: v3.5.99-ncs1-4 + revision: pull/3331/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above @@ -142,7 +142,7 @@ manifest: - name: nrfxlib repo-path: sdk-nrfxlib path: nrfxlib - revision: v2.6.4 + revision: pull/1870/head - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m @@ -181,7 +181,7 @@ manifest: # Only for internal Nordic development repo-path: dragoon.git remote: dragoon - revision: 18e58188d12088a3f1e6bcf7964d5368889b377e + revision: 7cd46b89b916004a903d7c5bd83bfe65bffe85d4 submodules: true groups: - dragoon @@ -196,7 +196,7 @@ manifest: compare-by-default: false - name: sidewalk repo-path: sdk-sidewalk - revision: v2.6.4 + revision: pull/734/head groups: - sidewalk - name: find-my