Skip to content

Commit 39b81b8

Browse files
alexstanoev-nordicrugeGerritsen
authored andcommitted
bluetooth: controller: Configurable maximum page for Extended Feature Set
This configurations allows decreasing the memory requirements of the LE Extended Feature Set controller feature by limiting the number of feature pages stored in the controller. Signed-off-by: Aleksandar Stanoev <[email protected]>
1 parent ed81662 commit 39b81b8

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

subsys/bluetooth/controller/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,18 @@ config BT_CTLR_SDC_CIS_SUBEVENT_LENGTH_US
538538
config BT_CTLR_EXTENDED_FEAT_SET
539539
select EXPERIMENTAL
540540

541+
config BT_CTLR_SDC_EXTENDED_FEAT_MAX_REMOTE_PAGE
542+
int "Number of supported remote feature pages"
543+
depends on BT_CTLR_EXTENDED_FEAT_SET
544+
range 1 10
545+
default BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE if BT_LE_LOCAL_MINIMUM_REQUIRED_FEATURE_PAGE > 0
546+
default 1
547+
help
548+
Configures the maximum number of remote Extended Feature Set feature pages
549+
that can be stored inside the controller. This value also sets the maximum
550+
page that will be requested by the HCI_LE_Read_All_Remote_Features command.
551+
Each feature page requires approximately 24 bytes of RAM per link.
552+
541553
config BT_CTLR_FRAME_SPACE_UPDATE
542554
select EXPERIMENTAL
543555

subsys/bluetooth/controller/hci_driver.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,15 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_BT_PERIPHERAL) ||
206206
#endif
207207

208208
#if defined(CONFIG_BT_CTLR_EXTENDED_FEAT_SET)
209-
#define SDC_EXTENDED_FEAT_SET_MEM_SIZE \
210-
SDC_MEM_EXTENDED_FEATURE_SET(SDC_CENTRAL_COUNT + PERIPHERAL_COUNT)
209+
#if defined(SDC_MEM_EXTENDED_FEATURE_SET_NEW)
210+
#define SDC_EXTENDED_FEAT_SET_MEM_SIZE \
211+
SDC_MEM_EXTENDED_FEATURE_SET_NEW(SDC_CENTRAL_COUNT + PERIPHERAL_COUNT, \
212+
CONFIG_BT_CTLR_SDC_EXTENDED_FEAT_MAX_REMOTE_PAGE)
213+
#else
214+
#define SDC_EXTENDED_FEAT_SET_MEM_SIZE \
215+
SDC_MEM_EXTENDED_FEATURE_SET(SDC_CENTRAL_COUNT + PERIPHERAL_COUNT, \
216+
CONFIG_BT_CTLR_SDC_EXTENDED_FEAT_MAX_REMOTE_PAGE)
217+
#endif
211218
#else
212219
#define SDC_EXTENDED_FEAT_SET_MEM_SIZE 0
213220
#endif
@@ -1365,8 +1372,16 @@ static int configure_memory_usage(void)
13651372
}
13661373
#endif
13671374

1368-
LOG_DBG("BT mempool size: %zu, required: %u",
1369-
sizeof(sdc_mempool), required_memory);
1375+
#if defined(CONFIG_BT_CTLR_SDC_EXTENDED_FEAT_MAX_REMOTE_PAGE)
1376+
cfg.extended_feature_page_count = CONFIG_BT_CTLR_SDC_EXTENDED_FEAT_MAX_REMOTE_PAGE;
1377+
required_memory = sdc_cfg_set(SDC_DEFAULT_RESOURCE_CFG_TAG,
1378+
SDC_CFG_TYPE_EXTENDED_FEATURE_PAGE_COUNT, &cfg);
1379+
if (required_memory < 0) {
1380+
return required_memory;
1381+
}
1382+
#endif
1383+
1384+
LOG_DBG("BT mempool size: %zu, required: %u", sizeof(sdc_mempool), required_memory);
13701385

13711386
if (required_memory > sizeof(sdc_mempool)) {
13721387
LOG_ERR("Allocated memory too low: %zu < %u",

0 commit comments

Comments
 (0)