From 2cd0e2a57004c5ac1d6c6bfac3d30d502c36416b Mon Sep 17 00:00:00 2001 From: Rubin Gerritsen Date: Tue, 21 Nov 2023 15:11:43 +0100 Subject: [PATCH] Bluetooth: Controller: Kconfig: Allow limiting max tx octets below 27 Define BT_CTLR_MIN_VAL_OF_MAX_ACL_TX_PAYLOAD_DEFAULT to allow setting the maximum number of tx octets to a value lower than 27 bytes. We only allow using this with devices supporting ISO as there is a risk of not being interoperable with older devices. Signed-off-by: Rubin Gerritsen --- subsys/bluetooth/controller/Kconfig | 20 ++++++++++++++++++++ subsys/bluetooth/controller/hci_driver.c | 14 ++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index 6ecc0a866ee..f714628dfea 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -154,6 +154,26 @@ config BT_CTLR_SDC_CENTRAL_ACL_EVENT_SPACING_DEFAULT timeline if the connection interval is longer than the ACL event spacing. This gap can be used for other scheduling activites like isochronous streams. +config BT_CTLR_MIN_VAL_OF_MAX_ACL_TX_PAYLOAD_DEFAULT + int "Default minimum value that will be used as maximum Tx octets for ACL connections" + default 27 + range 10 27 + depends on BT_ISO && BT_CONN + help + This configuration sets the minimum value of maximum ACL payload length that can be sent + in each packet. If the configured event length is shorter than what is required to + send a packet pair of 27 bytes in each direction, the controller will use this value to + determine how much it can reduce the payload size to satisfy the event length requirements. + LL Control PDUs are not affected by this API. + Together with BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT this allows the controller to schedule + ACLs events closer together with other activities. + Setting this parameter to a lower value will result in more link layer fragmentation, + reducing the maximum throughput. + Setting this parameter to a value lower than 27 bytes may result in interoperability + issues with older Bluetooth products. It is therefore not recommended to use this API + for applications interacting with devices qualified for Bluetooth Specification 5.1 or + older. + config BT_CTLR_SDC_PERIODIC_ADV_EVENT_LEN_DEFAULT_OVERRIDE bool "Override periodic adv event length default" diff --git a/subsys/bluetooth/controller/hci_driver.c b/subsys/bluetooth/controller/hci_driver.c index 17b50deae45..125356dc8b7 100644 --- a/subsys/bluetooth/controller/hci_driver.c +++ b/subsys/bluetooth/controller/hci_driver.c @@ -1238,6 +1238,20 @@ static int hci_driver_open(void) } } +#if defined(BT_CTLR_MIN_VAL_OF_MAX_ACL_TX_PAYLOAD_DEFAULT) + if (CONFIG_BT_CTLR_MIN_VAL_OF_MAX_ACL_TX_PAYLOAD_DEFAULT != 27) { + sdc_hci_cmd_vs_min_val_of_max_acl_tx_payload_set_t params = { + .min_val_of_max_acl_tx_payload = + CONFIG_config BT_CTLR_MIN_VAL_OF_MAX_ACL_TX_PAYLOAD_DEFAULT + }; + err = sdc_hci_cmd_vs_min_val_of_max_acl_tx_payload_set(¶ms); + if (err) { + MULTITHREADING_LOCK_RELEASE(); + return -ENOTSUP; + } + } +#endif + MULTITHREADING_LOCK_RELEASE(); return 0;