From 7cecedd25fa5b8a152259dc6b9d2f2eb126c986c Mon Sep 17 00:00:00 2001 From: Timothy Keys Date: Mon, 20 May 2024 15:58:20 +0100 Subject: [PATCH 1/2] Bluetooth: Controller: Enable Connection Subrating support in the SDC This enables experimental support for Connection Subrating. Signed-off-by: Timothy Keys --- subsys/bluetooth/controller/Kconfig | 5 +++++ subsys/bluetooth/controller/hci_driver.c | 15 +++++++++++++++ subsys/bluetooth/controller/hci_internal.c | 21 +++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index fde34cdfa2b2..c532174b2fc9 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -38,6 +38,7 @@ config BT_LL_SOFTDEVICE select BT_HAS_HCI_VS select BT_CTLR_DF_SUPPORT if HAS_HW_NRF_RADIO_DFE select BT_CTLR_LE_POWER_CONTROL_SUPPORT + select BT_CTLR_SUBRATING_SUPPORT depends on (SOC_SERIES_BSIM_NRFXX || SOC_SERIES_NRF52X || SOC_COMPATIBLE_NRF5340_CPUNET ||\ SOC_NRF54H20_CPURAD || SOC_SERIES_NRF54LX) help @@ -563,5 +564,9 @@ config BT_CTLR_SDC_CIS_SUBEVENT_LENGTH_US If this parameter is set to zero, the subevent length is chosen by the controller. +config BT_CTLR_SUBRATING + bool "LE Connection Subrating [EXPERIMENTAL]" + select EXPERIMENTAL + endmenu endif # BT_LL_SOFTDEVICE diff --git a/subsys/bluetooth/controller/hci_driver.c b/subsys/bluetooth/controller/hci_driver.c index 570f05e53ecf..25f7a3b8a61d 100644 --- a/subsys/bluetooth/controller/hci_driver.c +++ b/subsys/bluetooth/controller/hci_driver.c @@ -860,6 +860,21 @@ static int configure_supported_features(void) } #endif + if (IS_ENABLED(CONFIG_BT_CTLR_SUBRATING)) { + if (IS_ENABLED(CONFIG_BT_CENTRAL)) { + err = sdc_support_connection_subrating_central(); + if (err) { + return -ENOTSUP; + } + } + if (IS_ENABLED(CONFIG_BT_PERIPHERAL)) { + err = sdc_support_connection_subrating_peripheral(); + if (err) { + return -ENOTSUP; + } + } + } + return 0; } diff --git a/subsys/bluetooth/controller/hci_internal.c b/subsys/bluetooth/controller/hci_internal.c index bfefa55b8945..b37764a64cb0 100644 --- a/subsys/bluetooth/controller/hci_internal.c +++ b/subsys/bluetooth/controller/hci_internal.c @@ -65,6 +65,7 @@ static bool command_generates_command_complete_event(uint16_t hci_opcode) case SDC_HCI_OPCODE_CMD_LE_CREATE_BIG: case SDC_HCI_OPCODE_CMD_LE_CREATE_BIG_TEST: case SDC_HCI_OPCODE_CMD_LE_TERMINATE_BIG: + case SDC_HCI_OPCODE_CMD_LE_SUBRATE_REQUEST: return false; default: return true; @@ -611,6 +612,13 @@ void hci_internal_supported_commands(sdc_hci_ip_supported_commands_t *cmds) #if defined(CONFIG_BT_CTLR_ISO_RX_BUFFERS) cmds->hci_le_iso_receive_test = 1; #endif + +#if defined(CONFIG_BT_CTLR_SUBRATING) +#if defined(CONFIG_BT_CENTRAL) + cmds->hci_le_set_default_subrate_command = 1; +#endif + cmds->hci_le_subrate_request_command = 1; +#endif /* CONFIG_BT_CTLR_SUBRATING */ } #if defined(CONFIG_BT_HCI_VS) @@ -785,6 +793,10 @@ void hci_internal_le_supported_features( #if defined(CONFIG_BT_CTLR_SDC_PAWR_SYNC) features->params.periodic_advertising_with_responses_scanner = 1; #endif + +#if defined(CONFIG_BT_CTLR_SUBRATING) + features->params.connection_subrating = 1; +#endif } static void le_read_supported_states(uint8_t *buf) @@ -1534,6 +1546,15 @@ static uint8_t le_controller_cmd_put(uint8_t const * const cmd, (void *)event_out_params); #endif +#if defined(CONFIG_BT_CTLR_SUBRATING) +#if defined(CONFIG_BT_CENTRAL) + case SDC_HCI_OPCODE_CMD_LE_SET_DEFAULT_SUBRATE: + return sdc_hci_cmd_le_set_default_subrate((void *)cmd_params); +#endif + case SDC_HCI_OPCODE_CMD_LE_SUBRATE_REQUEST: + return sdc_hci_cmd_le_subrate_request((void *)cmd_params); +#endif /* CONFIG_BT_CTLR_SUBRATING */ + default: return BT_HCI_ERR_UNKNOWN_CMD; } From aa9ab97fe883cede6b00d7af306addf2e105db7f Mon Sep 17 00:00:00 2001 From: Adam Cavender Date: Wed, 10 Jul 2024 11:21:12 +0100 Subject: [PATCH 2/2] Bluetooth: Controller: Add memory macro for subrating This includes memory used for subrating in the MEMPOOL_SIZE macro. Signed-off-by: Adam Cavender --- subsys/bluetooth/controller/hci_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/bluetooth/controller/hci_driver.c b/subsys/bluetooth/controller/hci_driver.c index 25f7a3b8a61d..38e0c4d150c6 100644 --- a/subsys/bluetooth/controller/hci_driver.c +++ b/subsys/bluetooth/controller/hci_driver.c @@ -175,6 +175,12 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_BT_PERIPHERAL) || #define SDC_LE_POWER_CONTROL_MEM_SIZE 0 #endif +#if defined(CONFIG_BT_CTLR_SUBRATING) +#define SDC_SUBRATING_MEM_SIZE SDC_MEM_SUBRATING(SDC_CENTRAL_COUNT + PERIPHERAL_COUNT) +#else +#define SDC_SUBRATING_MEM_SIZE 0 +#endif + #if defined(CONFIG_BT_CTLR_CONN_ISO) #define SDC_MEM_CIG SDC_MEM_PER_CIG(CONFIG_BT_CTLR_CONN_ISO_GROUPS) #define SDC_MEM_CIS \ @@ -242,6 +248,7 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_BT_PERIPHERAL) || (SDC_CENTRAL_COUNT * CENTRAL_MEM_SIZE) + \ (SDC_ADV_SET_MEM_SIZE) + \ (SDC_LE_POWER_CONTROL_MEM_SIZE) + \ + (SDC_SUBRATING_MEM_SIZE) + \ (SDC_PERIODIC_ADV_MEM_SIZE) + \ (SDC_PERIODIC_ADV_RSP_MEM_SIZE) + \ (SDC_PERIODIC_SYNC_MEM_SIZE) + \