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

Commit dd6f4737 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge changes I7eb7571a,I9c54d9ea into main

* changes:
  Use GD for BLE ACL buffer sizes
  Use GD Controller for ACL sizes
parents d02a9b96 80c156fc
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -36,16 +36,7 @@ typedef struct controller_t {

  const uint8_t* (*get_ble_supported_states)(void);

  // Get the cached acl data sizes for the controller.
  uint16_t (*get_acl_data_size_classic)(void);
  uint16_t (*get_acl_data_size_ble)(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_classic)(void);
  uint16_t (*get_acl_packet_size_ble)(void);
  uint16_t (*get_iso_packet_size)(void);

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

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

static uint16_t get_acl_packet_size_classic(void) {
  return get_acl_buffer_length() + kHciDataPreambleSize;
}

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

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

    .get_ble_supported_states = get_ble_supported_states,

    .get_acl_data_size_classic = get_acl_buffer_length,
    .get_acl_data_size_ble = get_le_buffer_length,
    .get_iso_data_size = get_iso_buffer_length,

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

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

  btm_pm_reset();

  l2c_link_init(controller->get_acl_buffer_count_classic());
  l2c_link_init(bluetooth::shim::GetController()->GetNumAclPacketBuffers());

  // setup the random number generator
  std::srand(std::time(nullptr));
@@ -216,7 +216,9 @@ void BTM_reset_complete() {
  }

  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,
+6 −3
Original line number Diff line number Diff line
@@ -22,11 +22,12 @@
#include <vector>

#include "bind_helpers.h"
#include "device/include/controller.h"
#include "eatt.h"
#include "hci/controller_interface.h"
#include "internal_include/bt_trace.h"
#include "internal_include/stack_config.h"
#include "l2c_api.h"
#include "main/shim/entry.h"
#include "os/log.h"
#include "osi/include/alarm.h"
#include "osi/include/allocator.h"
@@ -150,7 +151,8 @@ struct eatt_impl {
      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 = {
        .mtu = eatt_dev->rx_mtu_,
@@ -564,7 +566,8 @@ struct eatt_impl {
                    uint8_t num_of_channels = L2CAP_CREDIT_BASED_MAX_CIDS) {
    /* Let us use maximum possible 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 = {
        .mtu = eatt_dev->rx_mtu_,
Loading