Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80c156fc authored by Myles Watson's avatar Myles Watson
Browse files

Use GD for BLE ACL buffer sizes

Bug: 321273521
Test: mma -j32
Flag: EXEMPT, no logical change
Change-Id: I7eb7571afa97ae75c4d14ce4466b91148057d291
parent 74e42acc
Loading
Loading
Loading
Loading
+0 −7
Original line number Original line Diff line number Diff line
@@ -36,14 +36,7 @@ typedef struct controller_t {


  const uint8_t* (*get_ble_supported_states)(void);
  const uint8_t* (*get_ble_supported_states)(void);


  // Get the cached acl data sizes for the controller.
  uint16_t (*get_acl_data_size_ble)(void);
  uint16_t (*get_iso_data_size)(void);
  uint16_t (*get_iso_data_size)(void);

  // Get the cached acl packet sizes for the controller.
  // This is a convenience function for the respective
  // acl data size + size of the acl header.
  uint16_t (*get_acl_packet_size_ble)(void);
  uint16_t (*get_iso_packet_size)(void);
  uint16_t (*get_iso_packet_size)(void);


  uint16_t (*get_ble_default_data_packet_length)(void);
  uint16_t (*get_ble_default_data_packet_length)(void);
+0 −8
Original line number Original line Diff line number Diff line
@@ -117,16 +117,10 @@ static const uint8_t* get_ble_supported_states(void) {
#define FORWARD_GETTER(type, legacy, gd) \
#define FORWARD_GETTER(type, legacy, gd) \
  static type legacy(void) { return gd; }
  static type legacy(void) { return gd; }


FORWARD_GETTER(uint16_t, get_le_buffer_length,
               GetController()->GetLeBufferSize().le_data_packet_length_)
FORWARD_GETTER(
FORWARD_GETTER(
    uint16_t, get_iso_buffer_length,
    uint16_t, get_iso_buffer_length,
    GetController()->GetControllerIsoBufferSize().le_data_packet_length_)
    GetController()->GetControllerIsoBufferSize().le_data_packet_length_)


static uint16_t get_acl_packet_size_ble(void) {
  return get_le_buffer_length() + kHciDataPreambleSize;
}

static uint16_t get_iso_packet_size(void) {
static uint16_t get_iso_packet_size(void) {
  return get_iso_buffer_length() + kHciDataPreambleSize;
  return get_iso_buffer_length() + kHciDataPreambleSize;
}
}
@@ -232,10 +226,8 @@ static const controller_t interface = {


    .get_ble_supported_states = get_ble_supported_states,
    .get_ble_supported_states = get_ble_supported_states,


    .get_acl_data_size_ble = get_le_buffer_length,
    .get_iso_data_size = get_iso_buffer_length,
    .get_iso_data_size = get_iso_buffer_length,


    .get_acl_packet_size_ble = get_acl_packet_size_ble,
    .get_iso_packet_size = get_iso_packet_size,
    .get_iso_packet_size = get_iso_packet_size,


    .get_ble_default_data_packet_length = get_le_suggested_default_data_length,
    .get_ble_default_data_packet_length = get_le_suggested_default_data_length,
+9 −1
Original line number Original line Diff line number Diff line
@@ -1434,7 +1434,6 @@ cc_test {
        "libbt-platform-protos-lite",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_bridge",
        "libchrome",
        "libchrome",
        "libflatbuffers-cpp",
        "libgmock",
        "libgmock",
        "liblog",
        "liblog",
        "libosi",
        "libosi",
@@ -1462,6 +1461,7 @@ cc_test {
        unit_test: true,
        unit_test: true,
    },
    },
    defaults: [
    defaults: [
        "bluetooth_flatbuffer_bundler_defaults",
        "fluoride_defaults",
        "fluoride_defaults",
        "mts_defaults",
        "mts_defaults",
    ],
    ],
@@ -1477,9 +1477,15 @@ cc_test {
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/gd",
    ],
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
    ],
    srcs: [
    srcs: [
        ":TestCommonMainHandler",
        ":TestCommonMainHandler",
        ":TestCommonMockFunctions",
        ":TestCommonStackConfig",
        ":TestCommonStackConfig",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        "eatt/eatt.cc",
        "eatt/eatt.cc",
        "test/common/mock_btif_storage.cc",
        "test/common/mock_btif_storage.cc",
        "test/common/mock_btm_api_layer.cc",
        "test/common/mock_btm_api_layer.cc",
@@ -1497,8 +1503,10 @@ cc_test {
        "libbase",
        "libbase",
        "libbluetooth-types",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
        "libbluetooth_log",
        "libbluetooth_log",
        "libbt-common",
        "libbt-common",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libbt_shim_ffi",
        "libchrome",
        "libchrome",
+3 −1
Original line number Original line Diff line number Diff line
@@ -216,7 +216,9 @@ void BTM_reset_complete() {
  }
  }


  if (bluetooth::shim::GetController()->SupportsBle()) {
  if (bluetooth::shim::GetController()->SupportsBle()) {
    l2c_link_processs_ble_num_bufs(controller->get_acl_buffer_count_ble());
    l2c_link_processs_ble_num_bufs(bluetooth::shim::GetController()
                                       ->GetLeBufferSize()
                                       .total_num_le_packets_);
  }
  }


  BTM_SetPinType(btm_sec_cb.cfg.pin_type, btm_sec_cb.cfg.pin_code,
  BTM_SetPinType(btm_sec_cb.cfg.pin_type, btm_sec_cb.cfg.pin_code,
+6 −3
Original line number Original line Diff line number Diff line
@@ -22,11 +22,12 @@
#include <vector>
#include <vector>


#include "bind_helpers.h"
#include "bind_helpers.h"
#include "device/include/controller.h"
#include "eatt.h"
#include "eatt.h"
#include "hci/controller_interface.h"
#include "internal_include/bt_trace.h"
#include "internal_include/bt_trace.h"
#include "internal_include/stack_config.h"
#include "internal_include/stack_config.h"
#include "l2c_api.h"
#include "l2c_api.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "os/log.h"
#include "osi/include/alarm.h"
#include "osi/include/alarm.h"
#include "osi/include/allocator.h"
#include "osi/include/allocator.h"
@@ -150,7 +151,8 @@ struct eatt_impl {
      eatt_dev = add_eatt_device(bda);
      eatt_dev = add_eatt_device(bda);
    }
    }


    uint16_t max_mps = controller_get_interface()->get_acl_data_size_ble();
    uint16_t max_mps =
        shim::GetController()->GetLeBufferSize().le_data_packet_length_;


    tL2CAP_LE_CFG_INFO local_coc_cfg = {
    tL2CAP_LE_CFG_INFO local_coc_cfg = {
        .mtu = eatt_dev->rx_mtu_,
        .mtu = eatt_dev->rx_mtu_,
@@ -564,7 +566,8 @@ struct eatt_impl {
                    uint8_t num_of_channels = L2CAP_CREDIT_BASED_MAX_CIDS) {
                    uint8_t num_of_channels = L2CAP_CREDIT_BASED_MAX_CIDS) {
    /* Let us use maximum possible mps */
    /* Let us use maximum possible mps */
    if (eatt_dev->rx_mps_ == EATT_MIN_MTU_MPS)
    if (eatt_dev->rx_mps_ == EATT_MIN_MTU_MPS)
      eatt_dev->rx_mps_ = controller_get_interface()->get_acl_data_size_ble();
      eatt_dev->rx_mps_ =
          shim::GetController()->GetLeBufferSize().le_data_packet_length_;


    tL2CAP_LE_CFG_INFO local_coc_cfg = {
    tL2CAP_LE_CFG_INFO local_coc_cfg = {
        .mtu = eatt_dev->rx_mtu_,
        .mtu = eatt_dev->rx_mtu_,
Loading