Skip to content

Conversation

PavelVPV
Copy link
Contributor

Upstream PR #: 89258

Task: NCSDK-31338

@PavelVPV PavelVPV changed the title [downstream] Bluetooth: Host: ACL/ISO buffers and bt_conn_tx objects mismatch Bluetooth: Host: ACL/ISO buffers and bt_conn_tx objects mismatch May 14, 2025
@PavelVPV PavelVPV force-pushed the deprecated_config_bt_conn_tx_max branch from 04b5845 to c705fdc Compare May 14, 2025 13:38
@PavelVPV PavelVPV force-pushed the deprecated_config_bt_conn_tx_max branch 2 times, most recently from ced1ec6 to 996cc1b Compare May 22, 2025 09:35
PavelVPV added 2 commits June 3, 2025 12:36
… ACL/ISO bufs

After zephyrproject-rtos/zephyr#72090, each
packet to be sent (wether ACL or ISO data) has a corresponding
`bt_conn_tx` object, regardless of whether a callback is used.

This means that number of packets Host can send to Controller is limited
by the smaller of two values: ACL/ISO packets Controller can receive,
and the number of `bt_conn_tx` objects allocated by Host.

A mismatch between these numbers may lead to inefficient resource usage
on either Host or Controller side. If Host allocates fewer `bt_conn_tx`
objects than the number of buffers available on Controller for a given
data type, some Controller buffers may go unused. Conversely, if Host
allocates more `bt_conn_tx` objects than Controller can consume, the
excess objects remain unused.

This commit adds a check and issues a warning if the number of
`bt_conn_tx` objects is not aligned with the number of ACL/ISO buffers
reported by Controller via the LE Read Buffer Size v1 or v2 command.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit ddeeecd)
After zephyrproject-rtos/zephyr#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 <[email protected]>
(cherry picked from commit 14b4e30)
@PavelVPV PavelVPV force-pushed the deprecated_config_bt_conn_tx_max branch from 996cc1b to 8b3ea78 Compare June 3, 2025 10:36
Copy link

sonarqubecloud bot commented Jun 3, 2025

@PavelVPV
Copy link
Contributor Author

PavelVPV commented Jun 5, 2025

Will be downstreamed with upmerge

@PavelVPV PavelVPV closed this Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant