Skip to content

Commit

Permalink
fixup! Bluetooth: Controller: Fix ISO Tx PDU buffer counts for fragme…
Browse files Browse the repository at this point in the history
…ntation

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 a306d9d commit d3b8065
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions subsys/bluetooth/controller/ll_sw/ull_iso_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,30 @@
*/

/* Calculate ISO PDU buffers required considering SDU fragmentation */
#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((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE - 4U), \
MIN(CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX, \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX)) * \
#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_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((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE - 4U), \
CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX) * \
#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_HDR_SIZE), \
CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX)) * \
CONFIG_BT_CTLR_ISO_TX_BUFFERS)
#elif defined(CONFIG_BT_CTLR_CONN_ISO)
#define BT_CTLR_ISO_TX_BUFFERS (DIV_ROUND_UP((CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE - 4U), \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX) * \
#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_HDR_SIZE), \
CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX)) * \
CONFIG_BT_CTLR_ISO_TX_BUFFERS)
#endif /* CONFIG_BT_CTLR_CONN_ISO */

Check notice on line 31 in subsys/bluetooth/controller/ll_sw/ull_iso_internal.h

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/controller/ll_sw/ull_iso_internal.h:31 -#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) +#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_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) +#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_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_HDR_SIZE), \ - CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX)) * \ - CONFIG_BT_CTLR_ISO_TX_BUFFERS) +#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_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_HDR_SIZE), \ - CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX)) * \ - CONFIG_BT_CTLR_ISO_TX_BUFFERS) +#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_HDR_SIZE), \ + CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX)) * \ + CONFIG_BT_CTLR_ISO_TX_BUFFERS)
#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 d3b8065

Please sign in to comment.