From 2c6306d09954de13f993ebc28e173246b9b6ef39 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 6 May 2024 12:54:28 +0200 Subject: [PATCH] Bluetooth: Controller: BT_CTLR_ISO_TX_BUFFER_SIZE from BT_ISO_TX_MTU Derive BT_CTLR_ISO_TX_BUFFER_SIZE from BT_ISO_TX_MTU to have optimal Controller memory allocations. BT_CTLR_ISO_TX_BUFFER_SIZE can be set lower than BT_ISO_TX_MTU in which case upper layer can send fragmented SDU to the Controller. Signed-off-by: Vinayak Kariappa Chettimada --- .../overlay-bt_ll_sw_split.conf | 10 ++---- .../central_iso/overlay-bt_ll_sw_split.conf | 33 +++++++++++++++++++ samples/bluetooth/central_iso/sample.yaml | 11 +++++++ .../nrf5340_cpunet_bis-bt_ll_sw_split.conf | 4 +-- .../nrf5340_cpunet_cis-bt_ll_sw_split.conf | 4 +-- .../nrf5340_cpunet_iso-bt_ll_sw_split.conf | 6 ++-- ...0_cpunet_iso_broadcast-bt_ll_sw_split.conf | 4 +-- ...340_cpunet_iso_central-bt_ll_sw_split.conf | 4 +-- ..._cpunet_iso_peripheral-bt_ll_sw_split.conf | 4 +-- .../hci_uart/overlay-all-bt_ll_sw_split.conf | 6 ++-- .../iso_broadcast/overlay-bt_ll_sw_split.conf | 21 ++++++++---- samples/bluetooth/iso_broadcast/sample.yaml | 4 +-- .../overlay-bt_ll_sw_split.conf | 10 ++---- .../tmap_bmr/boards/nrf52840dk_nrf52840.conf | 4 --- .../tmap_bms/boards/nrf52840dk_nrf52840.conf | 4 --- .../boards/nrf52840dk_nrf52840.conf | 4 --- .../boards/nrf52840dk_nrf52840.conf | 4 --- .../boards/nrf52840dk_nrf52840.conf | 4 --- .../overlay-bt_ll_sw_split.conf | 7 +++- .../boards/nrf52840dk_nrf52840.conf | 4 --- .../overlay-bt_ll_sw_split.conf | 6 +++- subsys/bluetooth/Kconfig.iso | 5 +-- subsys/bluetooth/controller/Kconfig | 15 ++++++--- subsys/bluetooth/controller/hci/hci.c | 2 +- subsys/bluetooth/controller/include/ll_feat.h | 18 ++++++++-- tests/bsim/bluetooth/audio/prj.conf | 2 +- tests/bsim/bluetooth/host/iso/cis/prj.conf | 4 +-- tests/bsim/bluetooth/ll/bis/prj.conf | 6 ++-- tests/bsim/bluetooth/ll/bis/prj_vs_dp.conf | 2 +- tests/bsim/bluetooth/ll/cis/prj.conf | 4 +-- ...0_cpunet_iso_acl_group-bt_ll_sw_split.conf | 6 ++-- 31 files changed, 136 insertions(+), 86 deletions(-) create mode 100644 samples/bluetooth/central_iso/overlay-bt_ll_sw_split.conf delete mode 100644 samples/bluetooth/tmap_bmr/boards/nrf52840dk_nrf52840.conf delete mode 100644 samples/bluetooth/tmap_bms/boards/nrf52840dk_nrf52840.conf delete mode 100644 samples/bluetooth/tmap_central/boards/nrf52840dk_nrf52840.conf delete mode 100644 samples/bluetooth/tmap_peripheral/boards/nrf52840dk_nrf52840.conf delete mode 100644 samples/bluetooth/unicast_audio_client/boards/nrf52840dk_nrf52840.conf delete mode 100644 samples/bluetooth/unicast_audio_server/boards/nrf52840dk_nrf52840.conf diff --git a/samples/bluetooth/broadcast_audio_source/overlay-bt_ll_sw_split.conf b/samples/bluetooth/broadcast_audio_source/overlay-bt_ll_sw_split.conf index c73ff9c3ea9b..3711a3492136 100644 --- a/samples/bluetooth/broadcast_audio_source/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/broadcast_audio_source/overlay-bt_ll_sw_split.conf @@ -14,11 +14,7 @@ CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=155 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 CONFIG_BT_CTLR_ISOAL_SOURCES=2 -# FIXME: Host needs CONFIG_BT_ISO_TX_MTU + 4 bytes for sequence number, and optionally -# additional + 4 bytes for timestamp when not using BT_ISO_TIMESTAMP_NONE in bt_iso_chan_send(), -# otherwise Host tries to fragment ISO data. -# When Host is fixed, CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE can inherit the -# CONFIG_BT_ISO_TX_MTU value. -# -# Supports the highest SDU size required by any BAP LC3 presets (155) +# Support the highest SDU size required by any BAP LC3 presets (155) + 8 bytes of HCI ISO Data +# packet overhead (the Packet_Sequence_Number, ISO_SDU_Length, Packet_Status_Flag fields; and +# the optional Time_Stamp field, if supplied) CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=163 diff --git a/samples/bluetooth/central_iso/overlay-bt_ll_sw_split.conf b/samples/bluetooth/central_iso/overlay-bt_ll_sw_split.conf new file mode 100644 index 000000000000..320c5c352b11 --- /dev/null +++ b/samples/bluetooth/central_iso/overlay-bt_ll_sw_split.conf @@ -0,0 +1,33 @@ +# Zephyr Bluetooth Controller +CONFIG_BT_LL_SW_SPLIT=y + +# Zephyr Bluetooth LE Controller needs 16 event buffers to generate Extended +# Advertising Report for receiving the complete 1650 bytes of data +CONFIG_BT_BUF_EVT_RX_COUNT=16 + +# Set maximum scan data length for Extended Scanning in Bluetooth LE Controller +CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650 + +# Increase Zephyr Bluetooth LE Controller Rx buffer to receive complete chain +# of PDUs +CONFIG_BT_CTLR_RX_BUFFERS=9 + +# Sufficient ISO SDU and PDU length for this sample with ISO_TX_MTU of 247 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 +CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 + +# Number of supported streami sources and sinks +CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISOAL_SINKS=1 + +# Support the highest SDU size required by this sample 247 + 8 bytes of HCI ISO Data +# packet overhead (timestamp and HCI ISO Data packet header) +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=4 + +# Use Low Latency Connected ISO policy +CONFIG_BT_CTLR_ADVANCED_FEATURES=y +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y + +# Use the below if the sample is sending stale packet sequence number +# CONFIG_BT_CTLR_ISOAL_SN_STRICT=n diff --git a/samples/bluetooth/central_iso/sample.yaml b/samples/bluetooth/central_iso/sample.yaml index 0cdbb7a501cd..455ff8fcb000 100644 --- a/samples/bluetooth/central_iso/sample.yaml +++ b/samples/bluetooth/central_iso/sample.yaml @@ -8,3 +8,14 @@ tests: integration_platforms: - qemu_x86 tags: bluetooth + sample.bluetooth.central_iso.bt_ll_sw_split: + harness: bluetooth + platform_allow: + - qemu_cortex_m3 + - qemu_x86 + - nrf52_bsim + - nrf52833dk/nrf52833 + integration_platforms: + - nrf52833dk/nrf52833 + extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf + tags: bluetooth diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 7fd4d377b1d7..27f7b9b80ea2 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -77,7 +77,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller @@ -89,7 +89,7 @@ CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index 18606ee3a67f..040e1db6b4f1 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -77,12 +77,12 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 823343bc3f65..3377273dd9ab 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -82,7 +82,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller @@ -95,12 +95,12 @@ CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf index 22d7f2e726db..05645663bc44 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf @@ -31,8 +31,8 @@ CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 CONFIG_BT_CTLR_ISOAL_SOURCES=2 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf index c6e0172b6946..56e80860f326 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf @@ -44,12 +44,12 @@ CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=n -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf index 3272d896ca62..b72aaa624f1a 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf @@ -44,12 +44,12 @@ CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=n CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 3774532c4241..8d6dbdd87b01 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -80,7 +80,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller @@ -93,12 +93,12 @@ CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions diff --git a/samples/bluetooth/iso_broadcast/overlay-bt_ll_sw_split.conf b/samples/bluetooth/iso_broadcast/overlay-bt_ll_sw_split.conf index a5f8b3cc1c5b..19264a9d041a 100644 --- a/samples/bluetooth/iso_broadcast/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/iso_broadcast/overlay-bt_ll_sw_split.conf @@ -1,13 +1,20 @@ +# Zephyr Bluetooth Controller +CONFIG_BT_LL_SW_SPLIT=y + +# Zephyr Controller tested maximum advertising data that can be set in a single HCI command +CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 + +# Enable support for Broadcast ISO in Zephyr Bluetooth Controller CONFIG_BT_CTLR_ADV_ISO=y + +# Sufficient ISO PDU length for this sample CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=4 -CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +# Number of supported streams +CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 CONFIG_BT_CTLR_ISOAL_SOURCES=2 -# FIXME: Host needs CONFIG_BT_ISO_TX_MTU + 4 bytes for sequence number, and -# optionally additional + 4 bytes for timestamp when not using -# BT_ISO_TIMESTAMP_NONE in bt_iso_chan_send(), otherwise Host tries to fragment -# ISO data. -# When Host is fixed, CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE can inherit the -# CONFIG_BT_ISO_TX_MTU value. +# Support the highest SDU size required by any BAP LC3 presets (155) + 8 bytes of HCI ISO Data +# packet overhead (the Packet_Sequence_Number, ISO_SDU_Length, Packet_Status_Flag fields; and +# the optional Time_Stamp field, if supplied) CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=12 diff --git a/samples/bluetooth/iso_broadcast/sample.yaml b/samples/bluetooth/iso_broadcast/sample.yaml index 10fb481688c6..92bde54d7a0c 100644 --- a/samples/bluetooth/iso_broadcast/sample.yaml +++ b/samples/bluetooth/iso_broadcast/sample.yaml @@ -17,8 +17,8 @@ tests: - qemu_cortex_m3 - qemu_x86 - nrf52_bsim - - nrf52dk/nrf52832 + - nrf52833dk/nrf52833 integration_platforms: - - nrf52dk/nrf52832 + - nrf52833dk/nrf52833 extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf tags: bluetooth diff --git a/samples/bluetooth/public_broadcast_source/overlay-bt_ll_sw_split.conf b/samples/bluetooth/public_broadcast_source/overlay-bt_ll_sw_split.conf index c73ff9c3ea9b..3711a3492136 100644 --- a/samples/bluetooth/public_broadcast_source/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/public_broadcast_source/overlay-bt_ll_sw_split.conf @@ -14,11 +14,7 @@ CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=155 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 CONFIG_BT_CTLR_ISOAL_SOURCES=2 -# FIXME: Host needs CONFIG_BT_ISO_TX_MTU + 4 bytes for sequence number, and optionally -# additional + 4 bytes for timestamp when not using BT_ISO_TIMESTAMP_NONE in bt_iso_chan_send(), -# otherwise Host tries to fragment ISO data. -# When Host is fixed, CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE can inherit the -# CONFIG_BT_ISO_TX_MTU value. -# -# Supports the highest SDU size required by any BAP LC3 presets (155) +# Support the highest SDU size required by any BAP LC3 presets (155) + 8 bytes of HCI ISO Data +# packet overhead (the Packet_Sequence_Number, ISO_SDU_Length, Packet_Status_Flag fields; and +# the optional Time_Stamp field, if supplied) CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=163 diff --git a/samples/bluetooth/tmap_bmr/boards/nrf52840dk_nrf52840.conf b/samples/bluetooth/tmap_bmr/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 3c7c698c48b8..000000000000 --- a/samples/bluetooth/tmap_bmr/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_BT_CTLR_PERIPHERAL_ISO=y - -# Supports the highest SDU size required by any BAP LC3 presets (155) -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 diff --git a/samples/bluetooth/tmap_bms/boards/nrf52840dk_nrf52840.conf b/samples/bluetooth/tmap_bms/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 57d674179ff9..000000000000 --- a/samples/bluetooth/tmap_bms/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_BT_CTLR_CENTRAL_ISO=y - -# Supports the highest SDU size required by any BAP LC3 presets (155) -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 diff --git a/samples/bluetooth/tmap_central/boards/nrf52840dk_nrf52840.conf b/samples/bluetooth/tmap_central/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 57d674179ff9..000000000000 --- a/samples/bluetooth/tmap_central/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_BT_CTLR_CENTRAL_ISO=y - -# Supports the highest SDU size required by any BAP LC3 presets (155) -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 diff --git a/samples/bluetooth/tmap_peripheral/boards/nrf52840dk_nrf52840.conf b/samples/bluetooth/tmap_peripheral/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 3c7c698c48b8..000000000000 --- a/samples/bluetooth/tmap_peripheral/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_BT_CTLR_PERIPHERAL_ISO=y - -# Supports the highest SDU size required by any BAP LC3 presets (155) -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 diff --git a/samples/bluetooth/unicast_audio_client/boards/nrf52840dk_nrf52840.conf b/samples/bluetooth/unicast_audio_client/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 57d674179ff9..000000000000 --- a/samples/bluetooth/unicast_audio_client/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_BT_CTLR_CENTRAL_ISO=y - -# Supports the highest SDU size required by any BAP LC3 presets (155) -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 diff --git a/samples/bluetooth/unicast_audio_client/overlay-bt_ll_sw_split.conf b/samples/bluetooth/unicast_audio_client/overlay-bt_ll_sw_split.conf index 1c29b28e2dda..755e7fafa786 100644 --- a/samples/bluetooth/unicast_audio_client/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/unicast_audio_client/overlay-bt_ll_sw_split.conf @@ -1,9 +1,14 @@ CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=1650 CONFIG_BT_CTLR_ISO_TX_BUFFERS=4 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 CONFIG_BT_CTLR_ISOAL_SOURCES=2 CONFIG_BT_CTLR_ISOAL_SINKS=1 + +# Support the highest SDU size required by any BAP LC3 presets (155) + 8 bytes of HCI ISO Data +# packet overhead (the Packet_Sequence_Number, ISO_SDU_Length, Packet_Status_Flag fields; and +# the optional Time_Stamp field, if supplied) +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=163 + CONFIG_BT_CTLR_ADVANCED_FEATURES=y CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y diff --git a/samples/bluetooth/unicast_audio_server/boards/nrf52840dk_nrf52840.conf b/samples/bluetooth/unicast_audio_server/boards/nrf52840dk_nrf52840.conf deleted file mode 100644 index 3c7c698c48b8..000000000000 --- a/samples/bluetooth/unicast_audio_server/boards/nrf52840dk_nrf52840.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_BT_CTLR_PERIPHERAL_ISO=y - -# Supports the highest SDU size required by any BAP LC3 presets (155) -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 diff --git a/samples/bluetooth/unicast_audio_server/overlay-bt_ll_sw_split.conf b/samples/bluetooth/unicast_audio_server/overlay-bt_ll_sw_split.conf index 1499e379d4e2..8c6d99253a6b 100644 --- a/samples/bluetooth/unicast_audio_server/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/unicast_audio_server/overlay-bt_ll_sw_split.conf @@ -1,10 +1,14 @@ CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 CONFIG_BT_CTLR_ISO_TX_BUFFERS=2 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=155 CONFIG_BT_CTLR_ISOAL_SOURCES=1 CONFIG_BT_CTLR_ISOAL_SINKS=2 +# Support the highest SDU size required by any BAP LC3 presets (155) + 8 bytes of HCI ISO Data +# packet overhead (the Packet_Sequence_Number, ISO_SDU_Length, Packet_Status_Flag fields; and +# the optional Time_Stamp field, if supplied) +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=163 + # Use the below if the sample is sending stale packet sequence number # CONFIG_BT_CTLR_ADVANCED_FEATURES=y # CONFIG_BT_CTLR_ISOAL_SN_STRICT=n diff --git a/subsys/bluetooth/Kconfig.iso b/subsys/bluetooth/Kconfig.iso index 68119724f189..cce7208b48cf 100644 --- a/subsys/bluetooth/Kconfig.iso +++ b/subsys/bluetooth/Kconfig.iso @@ -105,14 +105,15 @@ config BT_ISO_TX_FRAG_COUNT config BT_ISO_TX_MTU int "Maximum supported MTU for Isochronous TX buffers" - default 251 range 1 4095 + default 247 help Maximum MTU for Isochronous channels TX buffers. This is the actual data payload. It doesn't include the optional HCI ISO Data packet fields (e.g. `struct bt_hci_iso_sdu_ts_hdr`). Set this value to 247 to fit 247 bytes of data within a single - HCI ISO Data packet with a size of 255, without utilizing timestamps. + HCI ISO Data packet with Data_Total_Length of 255, utilizing + timestamps. config BT_ISO_RX_BUF_COUNT int "Number of Isochronous RX buffers" diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 4a966987bd1b..6d031c446224 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -202,12 +202,19 @@ config BT_CTLR_ISO_TX_BUFFERS config BT_CTLR_ISO_TX_BUFFER_SIZE int "Isochronous Tx buffer size" depends on BT_CTLR_ADV_ISO || BT_CTLR_CONN_ISO - range 1 4095 - default BT_ISO_TX_MTU if BT_ISO + range 9 4103 if BT_LL_SW_SPLIT + range 1 65535 + default 9 if BT_LL_SW_SPLIT default 1 help Size of the Isochronous Tx buffers and the value returned in HCI LE - Read Buffer Size V2 command response. + Read Buffer Size V2 command response. This is the data portion of the + HCI ISO Data packet, corresponding to the Data_Total_Length field. + + Currently the maximum SDU length is 4095 bytes, hence add HCI ISO + Data packet overhead (the Packet_Sequence_Number, ISO_SDU_Length, + Packet_Status_Flag fields; and the optional Time_Stamp field, if + supplied) of 8 bytes. config BT_CTLR_ISOAL_SOURCES int "Number of Isochronous Adaptation Layer sources" @@ -929,7 +936,7 @@ config BT_CTLR_CONN_ISO_PDU_LEN_MAX config BT_CTLR_CONN_ISO_SDU_LEN_MAX int "Maximum Connected Isochronous Channel SDU Length" depends on BT_CTLR_CONN_ISO - range BT_CTLR_CONN_ISO_PDU_LEN_MAX 4095 + range 1 4095 default 251 help Maximum Connected Isochronous Channel SDU Length. diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 4fecb50de1a0..d051150a26b6 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -1398,7 +1398,7 @@ static void le_read_buffer_size_v2(struct net_buf *buf, struct net_buf **evt) rp->acl_max_len = sys_cpu_to_le16(LL_LENGTH_OCTETS_TX_MAX); rp->acl_max_num = CONFIG_BT_BUF_ACL_TX_COUNT; - rp->iso_max_len = sys_cpu_to_le16(CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE); + rp->iso_max_len = sys_cpu_to_le16(BT_CTLR_ISO_TX_BUFFER_SIZE); rp->iso_max_num = CONFIG_BT_CTLR_ISO_TX_BUFFERS; } #endif /* CONFIG_BT_CTLR_ADV_ISO || CONFIG_BT_CTLR_CONN_ISO */ diff --git a/subsys/bluetooth/controller/include/ll_feat.h b/subsys/bluetooth/controller/include/ll_feat.h index 1eb2d86a1c3d..15e4eacd966d 100644 --- a/subsys/bluetooth/controller/include/ll_feat.h +++ b/subsys/bluetooth/controller/include/ll_feat.h @@ -189,10 +189,23 @@ #define LL_FEAT_BIT_CIS_PERIPHERAL 0 #endif /* !CONFIG_BT_CTLR_PERIPHERAL_ISO */ +#if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO) +#if defined(CONFIG_BT_ISO_TX_MTU) +#define BT_CTLR_ISO_TX_BUFFER_SIZE MIN((CONFIG_BT_ISO_TX_MTU + \ + BT_HCI_ISO_SDU_TS_HDR_SIZE), \ + MAX(CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE, \ + (BT_HCI_ISO_SDU_TS_HDR_SIZE + 1U))) +#else +#define BT_CTLR_ISO_TX_BUFFER_SIZE MAX(CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE, \ + (BT_HCI_ISO_SDU_TS_HDR_SIZE + 1U)) +#endif /* CONFIG_BT_ISO_TX_MTU */ +#endif /* CONFIG_BT_CTLR_ADV_ISO || CONFIG_BT_CTLR_CONN_ISO */ + #if defined(CONFIG_BT_CTLR_CENTRAL_ISO) || \ defined(CONFIG_BT_CTLR_PERIPHERAL_ISO) #define LL_CIS_OCTETS_TX_MAX MIN(CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX, \ - CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE) + (BT_CTLR_ISO_TX_BUFFER_SIZE - \ + BT_HCI_ISO_SDU_TS_HDR_SIZE)) #define LL_CIS_OCTETS_RX_MAX CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX #else /* !CONFIG_BT_CTLR_CENTRAL_ISO && !CONFIG_BT_CTLR_PERIPHERAL_ISO */ #define LL_CIS_OCTETS_TX_MAX 0 @@ -202,7 +215,8 @@ #if defined(CONFIG_BT_CTLR_ADV_ISO) #define LL_FEAT_BIT_ISO_BROADCASTER BIT64(BT_LE_FEAT_BIT_ISO_BROADCASTER) #define LL_BIS_OCTETS_TX_MAX MIN(CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX, \ - CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE) + (BT_CTLR_ISO_TX_BUFFER_SIZE - \ + BT_HCI_ISO_SDU_TS_HDR_SIZE)) #else /* !CONFIG_BT_CTLR_ADV_ISO */ #define LL_FEAT_BIT_ISO_BROADCASTER 0 #define LL_BIS_OCTETS_TX_MAX 0 diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 1afbca08502e..90e5924bf6cb 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -206,7 +206,7 @@ CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=255 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 # Controller ISO Broadcast Settings diff --git a/tests/bsim/bluetooth/host/iso/cis/prj.conf b/tests/bsim/bluetooth/host/iso/cis/prj.conf index d1a1b8cd1611..78ef925ce07c 100644 --- a/tests/bsim/bluetooth/host/iso/cis/prj.conf +++ b/tests/bsim/bluetooth/host/iso/cis/prj.conf @@ -17,7 +17,7 @@ CONFIG_BT_ISO_LOG_LEVEL_DBG=y # Controller Connected ISO configs CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=208 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=4 CONFIG_BT_CTLR_ISOAL_SOURCES=2 CONFIG_BT_CTLR_ISOAL_SINKS=2 - -CONFIG_BT_CTLR_ISO_TX_BUFFERS=4 diff --git a/tests/bsim/bluetooth/ll/bis/prj.conf b/tests/bsim/bluetooth/ll/bis/prj.conf index 02e2f3168db9..afa1f5958614 100644 --- a/tests/bsim/bluetooth/ll/bis/prj.conf +++ b/tests/bsim/bluetooth/ll/bis/prj.conf @@ -8,7 +8,7 @@ CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_ISO_SYNC_RECEIVER=y -CONFIG_BT_ISO_TX_MTU=251 +CONFIG_BT_ISO_TX_MTU=247 CONFIG_BT_ISO_RX_MTU=251 CONFIG_BT_CTLR_ADV_EXT=y @@ -16,8 +16,8 @@ CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_ISO_TX_BUFFERS=2 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_TEST=y diff --git a/tests/bsim/bluetooth/ll/bis/prj_vs_dp.conf b/tests/bsim/bluetooth/ll/bis/prj_vs_dp.conf index 9cf785bc9259..2f0f9ccc86d3 100644 --- a/tests/bsim/bluetooth/ll/bis/prj_vs_dp.conf +++ b/tests/bsim/bluetooth/ll/bis/prj_vs_dp.conf @@ -15,7 +15,7 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 diff --git a/tests/bsim/bluetooth/ll/cis/prj.conf b/tests/bsim/bluetooth/ll/cis/prj.conf index a4d3c3e8c5f8..c124cbd223eb 100644 --- a/tests/bsim/bluetooth/ll/cis/prj.conf +++ b/tests/bsim/bluetooth/ll/cis/prj.conf @@ -28,7 +28,7 @@ CONFIG_LOG=y CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_CONN_ISO_STREAMS=9 CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=9 @@ -36,7 +36,7 @@ CONFIG_BT_CTLR_ISOAL_SOURCES=9 CONFIG_BT_CTLR_ISOAL_SINKS=9 CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISO_RX_BUFFERS=1 CONFIG_BT_CTLR_PHY_CODED=n diff --git a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf index d410216659ac..5119ac0d3edd 100644 --- a/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf +++ b/tests/bsim/bluetooth/ll/cis/sysbuild/hci_ipc/nrf5340_cpunet_iso_acl_group-bt_ll_sw_split.conf @@ -84,7 +84,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=9 CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller @@ -97,14 +97,14 @@ CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_CONN_ISO_STREAMS=4 CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=4 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=4 # ISO Receptions