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

Commit 1ea363d9 authored by Chris Manton's avatar Chris Manton Committed by Gerrit Code Review
Browse files

Merge "Delete unused l2c_link_process_num_completed_pkts"

parents c19c59f6 5a92e9ee
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -46,6 +46,4 @@ extern void l2c_link_hci_conn_req(const RawAddress& bd_addr);

extern void l2cu_resubmit_pending_sec_req(const RawAddress* p_bda);

extern void l2c_link_process_num_completed_pkts(uint8_t* p, uint8_t evt_len);

extern void l2c_packets_completed(uint16_t handle, uint16_t num_sent);
+0 −106
Original line number Diff line number Diff line
@@ -1092,112 +1092,6 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
  }
}

/*******************************************************************************
 *
 * Function         l2c_link_process_num_completed_pkts
 *
 * Description      This function is called when a "number-of-completed-packets"
 *                  event is received from the controller. It updates all the
 *                  LCB transmit counts.
 *
 * Returns          void
 *
 ******************************************************************************/
void l2c_link_process_num_completed_pkts(uint8_t* p, uint8_t evt_len) {
  if (bluetooth::shim::is_gd_l2cap_enabled()) {
    return;
  }
  uint8_t num_handles, xx;
  uint16_t handle;
  uint16_t num_sent;
  tL2C_LCB* p_lcb;

  if (evt_len > 0) {
    STREAM_TO_UINT8(num_handles, p);
  } else {
    num_handles = 0;
  }

  if (num_handles > evt_len / (2 * sizeof(uint16_t))) {
    android_errorWriteLog(0x534e4554, "141617601");
    num_handles = evt_len / (2 * sizeof(uint16_t));
  }

  for (xx = 0; xx < num_handles; xx++) {
    STREAM_TO_UINT16(handle, p);
    /* Extract the handle */
    handle = HCID_GET_HANDLE(handle);
    STREAM_TO_UINT16(num_sent, p);

    p_lcb = l2cu_find_lcb_by_handle(handle);

    if (p_lcb) {
      if (p_lcb && (p_lcb->transport == BT_TRANSPORT_LE))
        l2cb.controller_le_xmit_window += num_sent;
      else {
        /* Maintain the total window to the controller */
        l2cb.controller_xmit_window += num_sent;
      }
      /* If doing round-robin, adjust communal counts */
      if (p_lcb->link_xmit_quota == 0) {
        if (p_lcb->transport == BT_TRANSPORT_LE) {
          /* Don't go negative */
          if (l2cb.ble_round_robin_unacked > num_sent)
            l2cb.ble_round_robin_unacked -= num_sent;
          else
            l2cb.ble_round_robin_unacked = 0;
        } else {
          /* Don't go negative */
          if (l2cb.round_robin_unacked > num_sent)
            l2cb.round_robin_unacked -= num_sent;
          else
            l2cb.round_robin_unacked = 0;
        }
      }

      /* Don't go negative */
      if (p_lcb->sent_not_acked > num_sent)
        p_lcb->sent_not_acked -= num_sent;
      else
        p_lcb->sent_not_acked = 0;

      l2c_link_check_send_pkts(p_lcb, 0, NULL);

      /* If we were doing round-robin for low priority links, check 'em */
      if ((p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) &&
          (l2cb.check_round_robin) &&
          (l2cb.round_robin_unacked < l2cb.round_robin_quota)) {
        l2c_link_check_send_pkts(NULL, 0, NULL);
      }
      if ((p_lcb->transport == BT_TRANSPORT_LE) &&
          (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH) &&
          ((l2cb.ble_check_round_robin) &&
           (l2cb.ble_round_robin_unacked < l2cb.ble_round_robin_quota))) {
        l2c_link_check_send_pkts(NULL, 0, NULL);
      }
    }

    if (p_lcb) {
      if (p_lcb->transport == BT_TRANSPORT_LE) {
        LOG_DEBUG("TotalWin=%d,LinkUnack(0x%x)=%d,RRCheck=%d,RRUnack=%d",
                  l2cb.controller_le_xmit_window, p_lcb->Handle(),
                  p_lcb->sent_not_acked, l2cb.ble_check_round_robin,
                  l2cb.ble_round_robin_unacked);
      } else {
        LOG_DEBUG("TotalWin=%d,LinkUnack(0x%x)=%d,RRCheck=%d,RRUnack=%d",
                  l2cb.controller_xmit_window, p_lcb->Handle(),
                  p_lcb->sent_not_acked, l2cb.check_round_robin,
                  l2cb.round_robin_unacked);
      }
    } else {
      LOG_DEBUG("TotalWin=%d  LE_Win: %d, Handle=0x%x, RRCheck=%d, RRUnack=%d",
                l2cb.controller_xmit_window, l2cb.controller_le_xmit_window,
                handle, l2cb.ble_check_round_robin,
                l2cb.ble_round_robin_unacked);
    }
  }
}

void l2c_packets_completed(uint16_t handle, uint16_t num_sent) {
  tL2C_LCB* p_lcb = l2cu_find_lcb_by_handle(handle);
  if (p_lcb == nullptr) {
+0 −3
Original line number Diff line number Diff line
@@ -67,9 +67,6 @@ void l2c_link_hci_conn_req(const RawAddress& bd_addr) {
  mock_function_count_map[__func__]++;
}
void l2c_link_init() { mock_function_count_map[__func__]++; }
void l2c_link_process_num_completed_pkts(uint8_t* p, uint8_t evt_len) {
  mock_function_count_map[__func__]++;
}
void l2c_link_role_changed(const RawAddress* bd_addr, uint8_t new_role,
                           uint8_t hci_status) {
  mock_function_count_map[__func__]++;