From d590bcb5e00b410d5a8631b17d837bc0027d4841 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 25 Apr 2024 09:50:10 +0300 Subject: [PATCH] Bluetooth: Remove BT_HCI_RESERVE and BT_HCI_RAW_RESERVE In most cases these were defined as 1. Saving one byte for the rest doesn't really justify the added complexity that comes with these options. Removing them also simplifies the interface between HCI transports/drivers and the host stack, which in turn helps pave the way for having HCI as a proper Zephyr driver API. Fixes #71907 Signed-off-by: Johan Hedberg --- doc/releases/migration-guide-3.6.rst | 3 +++ include/zephyr/bluetooth/buf.h | 7 ++----- .../nrf5340_cpunet_bis-bt_ll_sw_split.conf | 1 - ...nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf | 1 - .../nrf5340_cpunet_cis-bt_ll_sw_split.conf | 1 - .../nrf5340_cpunet_df-bt_ll_sw_split.conf | 1 - .../nrf5340_cpunet_iso-bt_ll_sw_split.conf | 1 - ...0_cpunet_iso_broadcast-bt_ll_sw_split.conf | 1 - ...340_cpunet_iso_central-bt_ll_sw_split.conf | 1 - ..._cpunet_iso_peripheral-bt_ll_sw_split.conf | 1 - ...340_cpunet_iso_receive-bt_ll_sw_split.conf | 1 - samples/bluetooth/hci_ipc/prj.conf | 1 - samples/bluetooth/hci_spi/prj.conf | 1 - subsys/bluetooth/Kconfig | 9 -------- subsys/bluetooth/host/Kconfig | 21 ------------------- .../host/att/pipeline/tester/prj.conf | 1 - .../host/att/sequential/tester/prj.conf | 1 - .../host/l2cap/split/tester/prj.conf | 1 - .../host/misc/disconnect/tester/prj.conf | 1 - ...0_cpunet_iso_acl_group-bt_ll_sw_split.conf | 1 - 20 files changed, 5 insertions(+), 51 deletions(-) diff --git a/doc/releases/migration-guide-3.6.rst b/doc/releases/migration-guide-3.6.rst index ffe93262cff..d230eb6b508 100644 --- a/doc/releases/migration-guide-3.6.rst +++ b/doc/releases/migration-guide-3.6.rst @@ -476,6 +476,9 @@ Bluetooth * `BT_ISO_TIMESTAMP_NONE` has been removed and the `ts` parameter of :c:func:`bt_iso_chan_send` has as well. :c:func:`bt_iso_chan_send` now always sends without timestamp. To send with a timestamp, :c:func:`bt_iso_chan_send_ts` can be used. +* The ``CONFIG_BT_HCI_RESERVE`` and ``CONFIG_BT_HCI_RAW_RESERVE`` Kconfig options were removed. All + buffers get by default one byte of headroom now, which HCI transport implementations can rely on + (whether they need it or not). Bluetooth Mesh ============== diff --git a/include/zephyr/bluetooth/buf.h b/include/zephyr/bluetooth/buf.h index 6415b987257..7429547ee41 100644 --- a/include/zephyr/bluetooth/buf.h +++ b/include/zephyr/bluetooth/buf.h @@ -51,11 +51,8 @@ struct bt_buf_data { uint8_t type; }; -#if defined(CONFIG_BT_HCI_RAW) -#define BT_BUF_RESERVE MAX(CONFIG_BT_HCI_RESERVE, CONFIG_BT_HCI_RAW_RESERVE) -#else -#define BT_BUF_RESERVE CONFIG_BT_HCI_RESERVE -#endif +/* Headroom reserved in buffers, primarily for HCI transport encoding purposes */ +#define BT_BUF_RESERVE 1 /** Helper to include reserved HCI data in buffer calculations */ #define BT_BUF_SIZE(size) (BT_BUF_RESERVE + (size)) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 6b407a208f7..7fd4d377b1d 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf index 37e29435d49..0d78cf862ee 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf @@ -8,7 +8,6 @@ CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=16 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index 6dd49214caa..18606ee3a67 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf index ab87866b19a..403501a5810 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 0bb34dfa790..823343bc3f6 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -11,7 +11,6 @@ CONFIG_CBPRINTF_REDUCED_INTEGRAL=y CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf index 12f3b8a1147..22d7f2e726d 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf index e7ec0c140d6..c6e0172b694 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf index fa3d303604e..3272d896ca6 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf index d139e83996a..cc3b5adecdd 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf @@ -10,7 +10,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. diff --git a/samples/bluetooth/hci_ipc/prj.conf b/samples/bluetooth/hci_ipc/prj.conf index 755a1f4ac1e..39c20b23cab 100644 --- a/samples/bluetooth/hci_ipc/prj.conf +++ b/samples/bluetooth/hci_ipc/prj.conf @@ -8,7 +8,6 @@ CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=16 diff --git a/samples/bluetooth/hci_spi/prj.conf b/samples/bluetooth/hci_spi/prj.conf index 33ceb26eb77..65ce21c799c 100644 --- a/samples/bluetooth/hci_spi/prj.conf +++ b/samples/bluetooth/hci_spi/prj.conf @@ -6,7 +6,6 @@ CONFIG_BT=y CONFIG_BT_HCI_RAW=y CONFIG_BT_MAX_CONN=16 CONFIG_BT_TINYCRYPT_ECC=n -CONFIG_BT_HCI_RAW_RESERVE=1 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index 2bd29855e55..43b8c654e85 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -61,15 +61,6 @@ config BT_HCI_RAW_H4_ENABLE This option enables use of H:4 transport for HCI RAW access at build time. -config BT_HCI_RAW_RESERVE - int "Buffer headroom needed for HCI transport" - depends on BT_HCI_RAW - default 1 if BT_HCI_RAW_H4 - default 0 - help - This option is used by the HCI raw transport implementation to - declare how much headroom it needs for any HCI transport headers. - config BT_HCI_RAW_CMD_EXT bool "RAW HCI Command Extension" help diff --git a/subsys/bluetooth/host/Kconfig b/subsys/bluetooth/host/Kconfig index 1753c7a2d6a..91e17c11fcb 100644 --- a/subsys/bluetooth/host/Kconfig +++ b/subsys/bluetooth/host/Kconfig @@ -72,27 +72,6 @@ config BT_HCI_TX_PRIO int default 7 -config BT_HCI_RESERVE - int - default 0 if BT_H4 - default 1 if BT_H5 - default 1 if BT_HCI_IPC - default 1 if BT_SPI - default 1 if BT_STM32_IPM - default 1 if BT_STM32WBA - default 1 if BT_USERCHAN - default 1 if BT_ESP32 - default 0 if BT_B91 - default 1 if BT_AMBIQ_HCI - default 1 if BT_SILABS_HCI - # Even if no driver is selected the following default is still - # needed e.g. for unit tests. - default 0 - help - Headroom that the driver needs for sending and receiving buffers. Add a - new 'default' entry for each new driver. - - choice BT_RECV_CONTEXT prompt "BT RX Thread Selection" default BT_RECV_WORKQ_SYS if SOC_SERIES_NRF51X diff --git a/tests/bsim/bluetooth/host/att/pipeline/tester/prj.conf b/tests/bsim/bluetooth/host/att/pipeline/tester/prj.conf index c05fc3aa163..a5ca6cf0f62 100644 --- a/tests/bsim/bluetooth/host/att/pipeline/tester/prj.conf +++ b/tests/bsim/bluetooth/host/att/pipeline/tester/prj.conf @@ -3,7 +3,6 @@ CONFIG_ASSERT=y CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=1 CONFIG_BT_BUF_CMD_TX_COUNT=10 diff --git a/tests/bsim/bluetooth/host/att/sequential/tester/prj.conf b/tests/bsim/bluetooth/host/att/sequential/tester/prj.conf index 461c7dd5029..5217040a117 100644 --- a/tests/bsim/bluetooth/host/att/sequential/tester/prj.conf +++ b/tests/bsim/bluetooth/host/att/sequential/tester/prj.conf @@ -3,7 +3,6 @@ CONFIG_ASSERT=y CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=1 CONFIG_BT_BUF_CMD_TX_COUNT=10 diff --git a/tests/bsim/bluetooth/host/l2cap/split/tester/prj.conf b/tests/bsim/bluetooth/host/l2cap/split/tester/prj.conf index 82dfa9686ee..dc9a8373fb0 100644 --- a/tests/bsim/bluetooth/host/l2cap/split/tester/prj.conf +++ b/tests/bsim/bluetooth/host/l2cap/split/tester/prj.conf @@ -3,7 +3,6 @@ CONFIG_ASSERT=y CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=16 CONFIG_BT_BUF_CMD_TX_COUNT=10 diff --git a/tests/bsim/bluetooth/host/misc/disconnect/tester/prj.conf b/tests/bsim/bluetooth/host/misc/disconnect/tester/prj.conf index 461c7dd5029..5217040a117 100644 --- a/tests/bsim/bluetooth/host/misc/disconnect/tester/prj.conf +++ b/tests/bsim/bluetooth/host/misc/disconnect/tester/prj.conf @@ -3,7 +3,6 @@ CONFIG_ASSERT=y CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=1 CONFIG_BT_BUF_CMD_TX_COUNT=10 diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf index 4a53b153a5c..d410216659a 100644 --- a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf +++ b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf @@ -11,7 +11,6 @@ CONFIG_CBPRINTF_REDUCED_INTEGRAL=y CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_HCI_RAW_RESERVE=1 CONFIG_BT_MAX_CONN=4 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since