Bluetooth: Host: Deprecate BT_BUF_ACL_RX_COUNT symbol

Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.

To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.

Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.

The configurations of tests and samples have been updated to reflect
these changes.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
Théo Battrel 2024-11-21 15:04:30 +01:00 committed by Benjamin Cabé
commit 66ff97e69b
26 changed files with 68 additions and 53 deletions

View file

@ -1,5 +1,4 @@
CONFIG_BT_MAX_CONN=16
CONFIG_BT_BUF_ACL_RX_COUNT=17
# debug options
# CONFIG_UART_CONSOLE=y

View file

@ -1,5 +1,4 @@
CONFIG_BT_MAX_CONN=16
CONFIG_BT_BUF_ACL_RX_COUNT=17
# debug options
# CONFIG_UART_CONSOLE=y

View file

@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(dut, LOG_LEVEL_INF);
* application. This allows us to notice if the stack has freed
* references that were ours.
*/
static atomic_t acl_pool_refs_held[CONFIG_BT_BUF_ACL_RX_COUNT];
static atomic_t acl_pool_refs_held[BT_BUF_ACL_RX_COUNT];
BUILD_ASSERT(IS_ENABLED(CONFIG_BT_TESTING));
BUILD_ASSERT(IS_ENABLED(CONFIG_BT_HCI_ACL_FLOW_CONTROL));
@ -46,7 +46,7 @@ static void acl_pool_refs_held_add(struct net_buf *buf)
{
int buf_id = net_buf_id(buf);
__ASSERT_NO_MSG(0 <= buf_id && buf_id < CONFIG_BT_BUF_ACL_RX_COUNT);
__ASSERT_NO_MSG(0 <= buf_id && buf_id < BT_BUF_ACL_RX_COUNT);
atomic_inc(&acl_pool_refs_held[buf_id]);
}

View file

@ -28,5 +28,5 @@ CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# RX buffer pool, it is a good idea to constrain said buffer
# pool.
CONFIG_BT_MAX_CONN=1
CONFIG_BT_BUF_ACL_RX_COUNT=6
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=4
CONFIG_BT_BUF_EVT_RX_COUNT=6

View file

@ -42,7 +42,6 @@ CONFIG_BT_CTLR_DATA_LENGTH_MAX=27
CONFIG_BT_CTLR_RX_BUFFERS=10
CONFIG_BT_MAX_CONN=10
CONFIG_BT_BUF_ACL_RX_COUNT=11
CONFIG_LOG=y
CONFIG_ASSERT=y

View file

@ -34,7 +34,6 @@ CONFIG_BT_CTLR_DATA_LENGTH_MAX=81
CONFIG_BT_CTLR_RX_BUFFERS=10
CONFIG_BT_MAX_CONN=10
CONFIG_BT_BUF_ACL_RX_COUNT=11
CONFIG_LOG=y
CONFIG_ASSERT=y

View file

@ -42,7 +42,6 @@ CONFIG_BT_CTLR_DATA_LENGTH_MAX=27
CONFIG_BT_CTLR_RX_BUFFERS=10
CONFIG_BT_MAX_CONN=10
CONFIG_BT_BUF_ACL_RX_COUNT=11
CONFIG_LOG=y
CONFIG_ASSERT=y

View file

@ -2,7 +2,6 @@ CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_MAX_CONN=12
CONFIG_BT_BUF_ACL_RX_COUNT=13
CONFIG_BT_MAX_PAIRED=12
CONFIG_BT_SMP=y
CONFIG_BT_PRIVACY=y

View file

@ -27,9 +27,5 @@ CONFIG_BT_AUTO_DATA_LEN_UPDATE=n
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_MAX_CONN=3
CONFIG_BT_BUF_ACL_RX_COUNT=4
# This test will fail when CONFIG_BT_MAX_CONN == CONFIG_BT_BUF_ACL_RX_COUNT
# CONFIG_BT_BUF_ACL_RX_COUNT=3
CONFIG_BT_HCI_ACL_FLOW_CONTROL=y

View file

@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(dut, CONFIG_APP_LOG_LEVEL);
#define NUM_TESTERS CONFIG_BT_MAX_CONN
/* Build with the minimum possible amount of RX buffers */
BUILD_ASSERT(CONFIG_BT_BUF_ACL_RX_COUNT == (CONFIG_BT_MAX_CONN + 1));
BUILD_ASSERT(BT_BUF_ACL_RX_COUNT >= (CONFIG_BT_MAX_CONN + 1));
struct tester {
size_t sdu_count;

View file

@ -12,7 +12,6 @@ CONFIG_BT_AUTO_DATA_LEN_UPDATE=y
CONFIG_BT_MAX_CONN=250
CONFIG_BT_ID_MAX=250
CONFIG_BT_BUF_ACL_RX_COUNT=251
# L2CAP, ATT and SMP usage cause data transmission deadlock due to shortage
# of buffers when transactions crossover amongst the connections in the same