Bluetooth: Controller: Fix Advertising PDU memory allocation

Fix Advertising PDU memory allocation for redundant Periodic
Advertising related PDU allocations. The buffer count
related to Periodic Advertising was included twice.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2024-07-17 03:02:14 +02:00 committed by Anas Nashif
commit 04e3d0081b
3 changed files with 11 additions and 13 deletions

View file

@ -459,6 +459,7 @@ config BT_CTLR_ADV_DATA_BUF_MAX
depends on BT_BROADCASTER
range 1 64 if BT_CTLR_ADV_EXT
range 1 1 if !BT_CTLR_ADV_EXT
default 2 if BT_CTLR_ADV_PERIODIC
default 1
help
Maximum number of buffered Advertising Data payload across enabled

View file

@ -116,32 +116,29 @@ static inline bool isr_rx_ci_adva_check(uint8_t tx_addr, uint8_t *addr,
*/
#define PDU_MEM_COUNT_MIN (((BT_CTLR_ADV_SET) * 3) + \
((BT_CTLR_ADV_AUX_SET) * \
PAYLOAD_BASED_FRAG_COUNT) + \
((BT_CTLR_ADV_SYNC_SET) * \
PAYLOAD_FRAG_COUNT))
PAYLOAD_BASED_FRAG_COUNT))
/* Maximum advertising PDU buffers to allocate, which is the sum of minimum
* plus configured additional count in CONFIG_BT_CTLR_ADV_DATA_BUF_MAX.
*/
#if defined(CONFIG_BT_CTLR_ADV_EXT)
#if defined(CONFIG_BT_CTLR_ADV_PERIODIC)
/* NOTE: When Periodic Advertising is supported then one additional PDU buffer
* plus the additional CONFIG_BT_CTLR_ADV_DATA_BUF_MAX amount of buffers
* is allocated.
/* NOTE: When Periodic Advertising is supported then one chain of PDU buffers
* plus the additional CONFIG_BT_CTLR_ADV_DATA_BUF_MAX amount of chain
* buffers is allocated.
* Set CONFIG_BT_CTLR_ADV_DATA_BUF_MAX to (BT_CTLR_ADV_AUX_SET +
* BT_CTLR_ADV_SYNC_SET) if
* PDU data is updated more frequently compare to the advertising
* interval with random delay included.
* BT_CTLR_ADV_SYNC_SET) if PDU data is updated more frequently compare to
* the advertising interval with random delay included.
*/
#define PDU_MEM_COUNT_MAX ((PDU_MEM_COUNT_MIN) + \
((BT_CTLR_ADV_SYNC_SET) * \
PAYLOAD_FRAG_COUNT) + \
(CONFIG_BT_CTLR_ADV_DATA_BUF_MAX * \
PAYLOAD_BASED_FRAG_COUNT))
PAYLOAD_FRAG_COUNT))
#else /* !CONFIG_BT_CTLR_ADV_PERIODIC */
/* NOTE: When Extended Advertising is supported but no Periodic Advertising
* then additional CONFIG_BT_CTLR_ADV_DATA_BUF_MAX amount of buffers is
* allocated.
* then additional CONFIG_BT_CTLR_ADV_DATA_BUF_MAX amount of chain buffers
* is allocated.
* Set CONFIG_BT_CTLR_ADV_DATA_BUF_MAX to BT_CTLR_ADV_AUX_SET if
* PDU data is updated more frequently compare to the advertising
* interval with random delay included.

View file

@ -9,6 +9,6 @@ CONFIG_BT_EXT_ADV=y
CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_CTLR_ADVANCED_FEATURES=y
CONFIG_BT_CTLR_ADV_AUX_SET=2
CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=2
CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=3
CONFIG_BT_PER_ADV=y
CONFIG_BT_PER_ADV_SYNC=y