Skip to content

Commit 6285e8e

Browse files
committed
bluetooth: host: Deprecated BT_CONN_TX_MAX
After #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>
1 parent bb22fc1 commit 6285e8e

File tree

8 files changed

+9
-14
lines changed

8 files changed

+9
-14
lines changed

doc/releases/release-notes-4.2.rst

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ Deprecated APIs and options
103103
deprecated, because support for anonymous authentication had been removed from the
104104
hawkBit server in version 0.8.0.
105105

106+
* The :kconfig:option:`CONFIG_BT_CONN_TX_MAX` Kconfig option has been deprecated. The number of
107+
pending TX buffers is now aligned with the :kconfig:option:`CONFIG_BT_BUF_ACL_TX_COUNT` Kconfig
108+
option.
109+
106110
New APIs and options
107111
====================
108112

include/zephyr/bluetooth/gatt.h

-4
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,6 @@ struct bt_gatt_notify_params {
13831383
* The callback is run from System Workqueue context.
13841384
* When called from the System Workqueue context this API will not wait for
13851385
* resources for the callback but instead return an error.
1386-
* The number of pending callbacks can be increased with the
1387-
* @kconfig{CONFIG_BT_CONN_TX_MAX} option.
13881386
*
13891387
* Alternatively it is possible to notify by UUID by setting it on the
13901388
* 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);
20782076
* The callback is run from System Workqueue context.
20792077
* When called from the System Workqueue context this API will not wait for
20802078
* resources for the callback but instead return an error.
2081-
* The number of pending callbacks can be increased with the
2082-
* @kconfig{CONFIG_BT_CONN_TX_MAX} option.
20832079
*
20842080
* @param conn Connection object.
20852081
* @param handle Attribute handle.

subsys/bluetooth/host/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ config BT_CONN_FRAG_COUNT
329329
if BT_CONN
330330

331331
config BT_CONN_TX_MAX
332-
int "Maximum number of pending TX buffers with a callback"
332+
int "Maximum number of pending TX buffers with a callback [DEPRECATED]"
333333
default BT_BUF_ACL_TX_COUNT
334334
range BT_BUF_ACL_TX_COUNT $(UINT8_MAX)
335335
help

subsys/bluetooth/host/classic/Kconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ config BT_RFCOMM_L2CAP_MTU
140140

141141
config BT_RFCOMM_TX_MAX
142142
int "Maximum number of pending TX buffers for RFCOMM"
143-
default BT_CONN_TX_MAX
144-
range BT_CONN_TX_MAX $(UINT8_MAX)
143+
default BT_BUF_ACL_TX_COUNT
144+
range BT_BUF_ACL_TX_COUNT $(UINT8_MAX)
145145
help
146146
Maximum number of pending TX buffers that have an associated
147147
sending buf. Normally this can be left to the default value, which

subsys/bluetooth/host/conn.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ sys_slist_t bt_auth_info_cbs = SYS_SLIST_STATIC_INIT(&bt_auth_info_cbs);
120120

121121
static sys_slist_t conn_cbs = SYS_SLIST_STATIC_INIT(&conn_cbs);
122122

123-
static struct bt_conn_tx conn_tx[CONFIG_BT_CONN_TX_MAX];
123+
static struct bt_conn_tx conn_tx[CONFIG_BT_BUF_ACL_TX_COUNT];
124124

125125
#if defined(CONFIG_BT_CLASSIC)
126126
static struct bt_conn sco_conns[CONFIG_BT_MAX_SCO_CONN];

tests/bluetooth/host/conn/prj.conf

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ CONFIG_BT_PER_ADV_SYNC=y
1212

1313
CONFIG_BT_MAX_CONN=1
1414
CONFIG_BT_L2CAP_TX_MTU=23
15-
CONFIG_BT_CONN_TX_MAX=3
1615
CONFIG_BT_CONN_PARAM_UPDATE_TIMEOUT=5000
1716
CONFIG_BT_L2CAP_TX_BUF_COUNT=3
1817
CONFIG_BT_ID_MAX=1

tests/bsim/bluetooth/host/l2cap/stress/prj.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ CONFIG_BT_BUF_ACL_TX_COUNT=4
3232
# L2AP MPS + L2CAP header (4)
3333
CONFIG_BT_BUF_ACL_RX_SIZE=81
3434

35-
# Governs BT_CONN_TX_MAX, and so must be >= than the max number of
35+
# Governs CONFIG_BT_BUF_ACL_TX_COUNT, and so must be >= than the max number of
3636
# peers, since we attempt to send one SDU per peer. The test execution
3737
# is a bit slowed down by having this at the very minimum, but we want
3838
# to keep it that way as to stress the stack as much as possible.

tests/bsim/bluetooth/host/misc/acl_tx_frag/prj.conf

-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
2626

2727
CONFIG_BT_MAX_CONN=1
2828

29-
# We don't want to be constrained on the number of TX
30-
# contexts, rather on the number of LL TX buffers.
31-
CONFIG_BT_CONN_TX_MAX=10
32-
3329
# Outgoing ATT buffers
3430
CONFIG_BT_ATT_TX_COUNT=1
3531

0 commit comments

Comments
 (0)