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

Commit 150f8166 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Remove unused code system/stack/l2cap/l2c_link am: 5e73dfe7 am: bee2bc15...

Remove unused code system/stack/l2cap/l2c_link am: 5e73dfe7 am: bee2bc15 am: d8c928c1 am: c78c448c am: ca3ff8c0

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2084123



Change-Id: Ia2ae5322246c0553aafc084e0cc9f900f0e5ca5c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 148d18da ca3ff8c0
Loading
Loading
Loading
Loading
+12 −72
Original line number Original line Diff line number Diff line
@@ -1053,45 +1053,15 @@ void l2c_OnHciModeChangeSendPendingPackets(RawAddress remote) {
 *
 *
 ******************************************************************************/
 ******************************************************************************/
static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
  const uint16_t acl_data_size_classic =
      controller_get_interface()->get_acl_data_size_classic();
  const uint16_t link_xmit_quota = p_lcb->link_xmit_quota;
  const uint16_t link_xmit_quota = p_lcb->link_xmit_quota;
  const bool is_bdr_and_fits_in_buffer = true;


  if (is_bdr_and_fits_in_buffer) {
  if (link_xmit_quota == 0) {
  if (link_xmit_quota == 0) {
    l2cb.round_robin_unacked++;
    l2cb.round_robin_unacked++;
  }
  }
  p_lcb->sent_not_acked++;
  p_lcb->sent_not_acked++;
  p_buf->layer_specific = 0;
  p_buf->layer_specific = 0;
  l2cb.controller_xmit_window--;
  l2cb.controller_xmit_window--;
  } else {
    uint16_t num_segs =
        (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size_classic - 1) /
        acl_data_size_classic;

    /* If doing round-robin, then only 1 segment each time */
    if (p_lcb->link_xmit_quota == 0) {
      num_segs = 1;
      p_lcb->partial_segment_being_sent = true;
    } else {
      /* Multi-segment packet. Make sure it can fit */
      if (num_segs > l2cb.controller_xmit_window) {
        num_segs = l2cb.controller_xmit_window;
        p_lcb->partial_segment_being_sent = true;
      }


      if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) {
        num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked);
        p_lcb->partial_segment_being_sent = true;
      }
    }

    p_lcb->sent_not_acked += num_segs;
    p_buf->layer_specific = num_segs;
    l2cb.controller_xmit_window -= num_segs;
    if (p_lcb->link_xmit_quota == 0) l2cb.round_robin_unacked += num_segs;
  }
  acl_send_data_packet_br_edr(p_lcb->remote_bd_addr, p_buf);
  acl_send_data_packet_br_edr(p_lcb->remote_bd_addr, p_buf);
  LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",
  LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",
            l2cb.controller_xmit_window, p_lcb->Handle(),
            l2cb.controller_xmit_window, p_lcb->Handle(),
@@ -1100,45 +1070,15 @@ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
}
}


static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
  const uint16_t acl_data_size_ble =
      controller_get_interface()->get_acl_data_size_ble();
  const uint16_t link_xmit_quota = p_lcb->link_xmit_quota;
  const uint16_t link_xmit_quota = p_lcb->link_xmit_quota;
  const bool is_ble_and_fits_in_buffer = true;


  if (is_ble_and_fits_in_buffer) {
  if (link_xmit_quota == 0) {
  if (link_xmit_quota == 0) {
    l2cb.ble_round_robin_unacked++;
    l2cb.ble_round_robin_unacked++;
  }
  }
  p_lcb->sent_not_acked++;
  p_lcb->sent_not_acked++;
  p_buf->layer_specific = 0;
  p_buf->layer_specific = 0;
  l2cb.controller_le_xmit_window--;
  l2cb.controller_le_xmit_window--;
  } else {
    uint16_t num_segs =
        (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size_ble - 1) /
        acl_data_size_ble;

    /* If doing round-robin, then only 1 segment each time */
    if (p_lcb->link_xmit_quota == 0) {
      num_segs = 1;
      p_lcb->partial_segment_being_sent = true;
    } else {
      /* Multi-segment packet. Make sure it can fit */
      if (num_segs > l2cb.controller_le_xmit_window) {
        num_segs = l2cb.controller_le_xmit_window;
        p_lcb->partial_segment_being_sent = true;
      }


      if (num_segs > (p_lcb->link_xmit_quota - p_lcb->sent_not_acked)) {
        num_segs = (p_lcb->link_xmit_quota - p_lcb->sent_not_acked);
        p_lcb->partial_segment_being_sent = true;
      }
    }

    p_lcb->sent_not_acked += num_segs;
    p_buf->layer_specific = num_segs;
    l2cb.controller_le_xmit_window -= num_segs;
    if (p_lcb->link_xmit_quota == 0) l2cb.ble_round_robin_unacked += num_segs;
  }
  acl_send_data_packet_ble(p_lcb->remote_bd_addr, p_buf);
  acl_send_data_packet_ble(p_lcb->remote_bd_addr, p_buf);
  LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",
  LOG_DEBUG("TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",
            l2cb.controller_le_xmit_window, p_lcb->Handle(),
            l2cb.controller_le_xmit_window, p_lcb->Handle(),