Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: Controller: Enable Connection Subrating support in the SDC #15500

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions subsys/bluetooth/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
weeTike marked this conversation as resolved.
Show resolved Hide resolved
depends on (SOC_SERIES_BSIM_NRFXX || SOC_SERIES_NRF52X || SOC_COMPATIBLE_NRF5340_CPUNET ||\
SOC_NRF54H20_CPURAD || SOC_SERIES_NRF54LX)
help
Expand Down Expand Up @@ -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
22 changes: 22 additions & 0 deletions subsys/bluetooth/controller/hci_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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) + \
Expand Down Expand Up @@ -860,6 +867,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;
}

Expand Down
21 changes: 21 additions & 0 deletions subsys/bluetooth/controller/hci_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
weeTike marked this conversation as resolved.
Show resolved Hide resolved
#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;
}
Expand Down
Loading