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

Commit a6fd438c authored by Himanshu Rawat's avatar Himanshu Rawat
Browse files

Make local ATT MTU configurable

Bug: 289153281
Test: atest GattTest
Test: CtsVerifier > Bluetooth Test

Change-Id: I476eb84d1392eec0913937aecc85e6ded57a5520
parent 88d00ae8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2056,7 +2056,7 @@ class LeAudioClientImpl : public LeAudioClient {
    if (leAudioDevice->mtu_ == GATT_DEF_BLE_MTU_SIZE) {
      LOG(INFO) << __func__ << ", Configure MTU";
      /* Use here kBapMinimumAttMtu, because we know that GATT will request
       * GATT_MAX_MTU_SIZE on ATT anyways. We also know that GATT will use this
       * default ATT MTU anyways. We also know that GATT will use this
       * kBapMinimumAttMtu as an input for Data Length Update procedure in the controller.
       */
      BtaGattQueue::ConfigureMtu(leAudioDevice->conn_id_, kBapMinimumAttMtu);
+1 −0
Original line number Diff line number Diff line
@@ -403,6 +403,7 @@ init_flags!(
        use_unified_connection_manager,
        sdp_return_classic_services_when_le_discovery_fails = true,
        use_rsi_from_cached_inqiry_results = false,
        att_mtu_default: i32 = 517,
    }
    // dynamic flags can be updated at runtime and should be accessed directly
    // to check.
+1 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ mod ffi {
        fn use_unified_connection_manager_is_enabled() -> bool;
        fn sdp_return_classic_services_when_le_discovery_fails_is_enabled() -> bool;
        fn use_rsi_from_cached_inqiry_results_is_enabled() -> bool;
        fn get_att_mtu_default() -> i32;
    }
}

+2 −2
Original line number Diff line number Diff line
@@ -723,8 +723,8 @@ tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) {

  /* Since GATT MTU Exchange can be done only once, and it is impossible to
   * predict what MTU will be requested by other applications, let's use
   * max possible MTU in the request. */
  gatt_cl_msg.mtu = GATT_MAX_MTU_SIZE;
   * default MTU in the request. */
  gatt_cl_msg.mtu = gatt_get_local_mtu();

  LOG_INFO("Configuring ATT mtu size conn_id:%hu mtu:%hu user mtu %hu", conn_id,
           gatt_cl_msg.mtu, mtu);
+2 −2
Original line number Diff line number Diff line
@@ -1103,11 +1103,11 @@ void gatt_process_mtu_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, uint16_t len,
             tcb.pending_user_mtu_exchange_value,
             tcb.peer_bda.ToString().c_str(), mtu);

    /* Aim for MAX as we did in the request */
    /* Aim for default as we did in the request */
    if (mtu < GATT_DEF_BLE_MTU_SIZE) {
      tcb.payload_size = GATT_DEF_BLE_MTU_SIZE;
    } else {
      tcb.payload_size = std::min(mtu, (uint16_t)(GATT_MAX_MTU_SIZE));
      tcb.payload_size = std::min(mtu, (uint16_t)(gatt_get_local_mtu()));
    }

    bluetooth::shim::arbiter::GetArbiter().OnIncomingMtuResp(tcb.tcb_idx,
Loading