Skip to content

Commit

Permalink
Bluetooth: Controller: Fix ISO Tx PDU buffer counts for fragmentation
Browse files Browse the repository at this point in the history
Fix ISO Tx PDU buffer count required when SDUs fragmentation
is used.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak committed Nov 26, 2024
1 parent 6d87bd6 commit f8b00f6
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions subsys/bluetooth/controller/ll_sw/ull_iso_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,31 @@
* SPDX-License-Identifier: Apache-2.0
*/

#if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
/* Calculate ISO PDU buffers required considering SDU fragmentation */
/* FIXME: Calculation considering both Connected and Broadcast ISO PDU
* fragmentation.
*/
#if defined(CONFIG_BT_CTLR_CONN_ISO)
#define BT_CTLR_ISO_TX_BUFFERS (((CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX + \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX - 1U) / \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX) * \
#if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
#define BT_CTLR_ISO_SDU_LEN_MAX ((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE * \
CONFIG_BT_CTLR_ISO_TX_BUFFERS) - \
BT_HCI_ISO_SDU_HDR_SIZE)
#if defined(CONFIG_BT_CTLR_ADV_ISO) && defined(CONFIG_BT_CTLR_CONN_ISO)
#define BT_CTLR_ISO_TX_BUFFERS (DIV_ROUND_UP(BT_CTLR_ISO_SDU_LEN_MAX, \
MIN((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE - \
BT_HCI_ISO_SDU_TS_HDR_SIZE), \
MIN(CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX, \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX))) * \
CONFIG_BT_CTLR_ISO_TX_BUFFERS)
#elif defined(CONFIG_BT_CTLR_ADV_ISO)
#define BT_CTLR_ISO_TX_BUFFERS (DIV_ROUND_UP(BT_CTLR_ISO_SDU_LEN_MAX, \
MIN((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE - \
BT_HCI_ISO_SDU_TS_HDR_SIZE), \
CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX)) * \
CONFIG_BT_CTLR_ISO_TX_BUFFERS)
#else /* CONFIG_BT_CTLR_CONN_ISO */
#define BT_CTLR_ISO_TX_BUFFERS (DIV_ROUND_UP(BT_CTLR_ISO_SDU_LEN_MAX, \
MIN((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE - \
BT_HCI_ISO_SDU_TS_HDR_SIZE), \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX)) * \
CONFIG_BT_CTLR_ISO_TX_BUFFERS)
#else /* !CONFIG_BT_CTLR_CONN_ISO */
#define BT_CTLR_ISO_TX_BUFFERS CONFIG_BT_CTLR_ISO_TX_BUFFERS
#endif /* !CONFIG_BT_CTLR_CONN_ISO */
#endif /* CONFIG_BT_CTLR_CONN_ISO */
#else /* !CONFIG_BT_CTLR_ADV_ISO && !CONFIG_BT_CTLR_CONN_ISO */
#define BT_CTLR_ISO_TX_BUFFERS 0
#endif /* !CONFIG_BT_CTLR_ADV_ISO && !CONFIG_BT_CTLR_CONN_ISO */
Expand Down

0 comments on commit f8b00f6

Please sign in to comment.