bluetooth: host: Deprecated BT_CONN_TX_MAX

After https://github.com/zephyrproject-rtos/zephyr/pull/72090,
`conn_tx_alloc` no longer blocks, and each buffer always has a
corresponding `bt_conn_tx` object. This eliminates the need to configure
the number of `bt_conn_tx` objects via `CONFIG_BT_CONN_TX_MAX`, since
every buffer now carries its own context even when no callback is used.

This commit deprecates `CONFIG_BT_CONN_TX_MAX` as it is no longer
necessary. Instead, `CONFIG_BT_BUF_ACL_TX_COUNT` is used to allocate
`bt_conn_tx` objects for outgoing ACL data. ZLL already uses
`CONFIG_BT_BUF_ACL_TX_COUNT` to configure the number of outgoing ACL
packets. With this change, modifying the packet count will automatically
adjust the number of corresponding contexts, preventing both context
starvatoin and underutilization.

This approach also aligns with ISO, where the number of `bt_conn_tx`
objects for outgoing ISOdata matches `CONFIG_BT_ISO_TX_BUF_COUNT`.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
Pavel Vasilyev 2025-04-29 13:41:03 +02:00 committed by Henrik Brix Andersen
parent ddeeecd0b4
commit 14b4e30cdf
8 changed files with 9 additions and 14 deletions

View File

@ -103,6 +103,10 @@ Deprecated APIs and options
deprecated, because support for anonymous authentication had been removed from the
hawkBit server in version 0.8.0.
* The :kconfig:option:`CONFIG_BT_CONN_TX_MAX` Kconfig option has been deprecated. The number of
pending TX buffers is now aligned with the :kconfig:option:`CONFIG_BT_BUF_ACL_TX_COUNT` Kconfig
option.
New APIs and options
====================

View File

@ -1383,8 +1383,6 @@ struct bt_gatt_notify_params {
* The callback is run from System Workqueue context.
* When called from the System Workqueue context this API will not wait for
* resources for the callback but instead return an error.
* The number of pending callbacks can be increased with the
* @kconfig{CONFIG_BT_CONN_TX_MAX} option.
*
* Alternatively it is possible to notify by UUID by setting it on the
* parameters, when using this method the attribute if provided is used as the
@ -2078,8 +2076,6 @@ int bt_gatt_write(struct bt_conn *conn, struct bt_gatt_write_params *params);
* The callback is run from System Workqueue context.
* When called from the System Workqueue context this API will not wait for
* resources for the callback but instead return an error.
* The number of pending callbacks can be increased with the
* @kconfig{CONFIG_BT_CONN_TX_MAX} option.
*
* @param conn Connection object.
* @param handle Attribute handle.

View File

@ -325,7 +325,7 @@ config BT_CONN_FRAG_COUNT
if BT_CONN
config BT_CONN_TX_MAX
int "Maximum number of pending TX buffers with a callback"
int "Maximum number of pending TX buffers with a callback [DEPRECATED]"
default BT_BUF_ACL_TX_COUNT
range BT_BUF_ACL_TX_COUNT $(UINT8_MAX)
help

View File

@ -140,8 +140,8 @@ config BT_RFCOMM_L2CAP_MTU
config BT_RFCOMM_TX_MAX
int "Maximum number of pending TX buffers for RFCOMM"
default BT_CONN_TX_MAX
range BT_CONN_TX_MAX $(UINT8_MAX)
default BT_BUF_ACL_TX_COUNT
range BT_BUF_ACL_TX_COUNT $(UINT8_MAX)
help
Maximum number of pending TX buffers that have an associated
sending buf. Normally this can be left to the default value, which

View File

@ -120,7 +120,7 @@ sys_slist_t bt_auth_info_cbs = SYS_SLIST_STATIC_INIT(&bt_auth_info_cbs);
static sys_slist_t conn_cbs = SYS_SLIST_STATIC_INIT(&conn_cbs);
static struct bt_conn_tx conn_tx[CONFIG_BT_CONN_TX_MAX];
static struct bt_conn_tx conn_tx[CONFIG_BT_BUF_ACL_TX_COUNT];
#if defined(CONFIG_BT_CLASSIC)
static struct bt_conn sco_conns[CONFIG_BT_MAX_SCO_CONN];

View File

@ -12,7 +12,6 @@ CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_MAX_CONN=1
CONFIG_BT_L2CAP_TX_MTU=23
CONFIG_BT_CONN_TX_MAX=3
CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=5000
CONFIG_BT_L2CAP_TX_BUF_COUNT=3
CONFIG_BT_ID_MAX=1

View File

@ -32,7 +32,7 @@ CONFIG_BT_BUF_ACL_TX_COUNT=4
# L2AP MPS + L2CAP header (4)
CONFIG_BT_BUF_ACL_RX_SIZE=81
# Governs BT_CONN_TX_MAX, and so must be >= than the max number of
# Governs CONFIG_BT_BUF_ACL_TX_COUNT, and so must be >= than the max number of
# peers, since we attempt to send one SDU per peer. The test execution
# is a bit slowed down by having this at the very minimum, but we want
# to keep it that way as to stress the stack as much as possible.

View File

@ -26,10 +26,6 @@ CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_MAX_CONN=1
# We don't want to be constrained on the number of TX
# contexts, rather on the number of LL TX buffers.
CONFIG_BT_CONN_TX_MAX=10
# Outgoing ATT buffers
CONFIG_BT_ATT_TX_COUNT=1