Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/releases/release-notes-4.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
====================

Expand Down
4 changes: 0 additions & 4 deletions include/zephyr/bluetooth/gatt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,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
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/host/classic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
26 changes: 26 additions & 0 deletions subsys/bluetooth/host/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@
#define BT_HCI_QUIRKS 0
#endif

/* These checks are added to warn if the number of ACL or ISO packets in Controller is not equal to
* the number of bt_conn_tx contexts allocated by Host. The inequality of these two values can lead
* to inefficient resources usage either on Host's or Controller's side.
*/
#define CHECK_NUM_OF_ACL_PKTS(_num) \
do { \
if (CONFIG_BT_BUF_ACL_TX_COUNT != (_num)) { \
LOG_WRN("Num of Controller's ACL packets != ACL bt_conn_tx contexts" \
" (%u != %u)", (_num), CONFIG_BT_BUF_ACL_TX_COUNT); \
} \
} while (0)

#define CHECK_NUM_OF_ISO_PKTS(_num) \
do { \
if (CONFIG_BT_ISO_TX_BUF_COUNT != (_num)) { \
LOG_WRN("Num of Controller's ISO packets != ISO bt_conn_tx contexts" \
"(%u != %u)", (_num), CONFIG_BT_ISO_TX_BUF_COUNT); \
} \
} while (0)

Check notice on line 113 in subsys/bluetooth/host/hci_core.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/host/hci_core.c:113 -#define CHECK_NUM_OF_ACL_PKTS(_num) \ - do { \ - if (CONFIG_BT_BUF_ACL_TX_COUNT != (_num)) { \ - LOG_WRN("Num of Controller's ACL packets != ACL bt_conn_tx contexts" \ - " (%u != %u)", (_num), CONFIG_BT_BUF_ACL_TX_COUNT); \ - } \ +#define CHECK_NUM_OF_ACL_PKTS(_num) \ + do { \ + if (CONFIG_BT_BUF_ACL_TX_COUNT != (_num)) { \ + LOG_WRN("Num of Controller's ACL packets != ACL bt_conn_tx contexts" \ + " (%u != %u)", \ + (_num), CONFIG_BT_BUF_ACL_TX_COUNT); \ + } \ } while (0) -#define CHECK_NUM_OF_ISO_PKTS(_num) \ - do { \ - if (CONFIG_BT_ISO_TX_BUF_COUNT != (_num)) { \ - LOG_WRN("Num of Controller's ISO packets != ISO bt_conn_tx contexts" \ - "(%u != %u)", (_num), CONFIG_BT_ISO_TX_BUF_COUNT); \ - } \ +#define CHECK_NUM_OF_ISO_PKTS(_num) \ + do { \ + if (CONFIG_BT_ISO_TX_BUF_COUNT != (_num)) { \ + LOG_WRN("Num of Controller's ISO packets != ISO bt_conn_tx contexts" \ + "(%u != %u)", \ + (_num), CONFIG_BT_ISO_TX_BUF_COUNT); \ + } \

void bt_tx_irq_raise(void);

#define HCI_CMD_TIMEOUT K_SECONDS(10)
Expand Down Expand Up @@ -3159,6 +3179,8 @@

LOG_DBG("ACL LE buffers: pkts %u mtu %u", rp->le_max_num, bt_dev.le.acl_mtu);

CHECK_NUM_OF_ACL_PKTS(rp->le_max_num);

k_sem_init(&bt_dev.le.acl_pkts, rp->le_max_num, rp->le_max_num);
#endif /* CONFIG_BT_CONN */
}
Expand All @@ -3178,6 +3200,8 @@
LOG_DBG("ACL LE buffers: pkts %u mtu %u", rp->acl_max_num, bt_dev.le.acl_mtu);

k_sem_init(&bt_dev.le.acl_pkts, rp->acl_max_num, rp->acl_max_num);

CHECK_NUM_OF_ACL_PKTS(rp->acl_max_num);
}
#endif /* CONFIG_BT_CONN */

Expand All @@ -3194,6 +3218,8 @@

k_sem_init(&bt_dev.le.iso_pkts, rp->iso_max_num, rp->iso_max_num);
bt_dev.le.iso_limit = rp->iso_max_num;

CHECK_NUM_OF_ISO_PKTS(rp->iso_max_num);
#endif /* CONFIG_BT_ISO */
}

Expand Down
1 change: 0 additions & 1 deletion tests/bluetooth/host/conn/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/host/l2cap/stress/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 0 additions & 4 deletions tests/bsim/bluetooth/host/misc/acl_tx_frag/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading