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

Commit 56a7ca51 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Group controller acccess stack/l2cap/l2c_link::l2c_link_send_to_lower am: 9facde4c

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1407388

Change-Id: Iad28310f46f52e943d83407778d2879ae4834a95
parents b4c242ba 9facde4c
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -1013,14 +1013,18 @@ void l2c_OnHciModeChangeSendPendingPackets(RawAddress remote) {
 ******************************************************************************/
static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
                                   tL2C_TX_COMPLETE_CB_INFO* p_cbi) {
  const controller_t* controller = controller_get_interface();

  if ((p_buf->len <= controller->get_acl_packet_size_classic() &&
       (p_lcb->transport == BT_TRANSPORT_BR_EDR)) ||
      ((p_lcb->transport == BT_TRANSPORT_LE) &&
       (p_buf->len <= controller->get_acl_packet_size_ble()))) {
    if (p_lcb->link_xmit_quota == 0) {
      if (p_lcb->transport == BT_TRANSPORT_LE)
  const uint16_t acl_packet_size_classic =
      controller_get_interface()->get_acl_packet_size_classic();
  const uint16_t acl_packet_size_ble =
      controller_get_interface()->get_acl_packet_size_ble();
  const uint16_t link_xmit_quota = p_lcb->link_xmit_quota;
  const tBT_TRANSPORT transport = p_lcb->transport;

  if ((p_buf->len <= acl_packet_size_classic &&
       (transport == BT_TRANSPORT_BR_EDR)) ||
      ((transport == BT_TRANSPORT_LE) && (p_buf->len <= acl_packet_size_ble))) {
    if (link_xmit_quota == 0) {
      if (transport == BT_TRANSPORT_LE)
        l2cb.ble_round_robin_unacked++;
      else
        l2cb.round_robin_unacked++;
@@ -1028,7 +1032,7 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
    p_lcb->sent_not_acked++;
    p_buf->layer_specific = 0;

    if (p_lcb->transport == BT_TRANSPORT_LE) {
    if (transport == BT_TRANSPORT_LE) {
      l2cb.controller_le_xmit_window--;
      bte_main_hci_send(
          p_buf, (uint16_t)(BT_EVT_TO_LM_HCI_ACL | LOCAL_BLE_CONTROLLER_ID));
@@ -1039,12 +1043,12 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
  } else {
    uint16_t xmit_window{0};
    uint16_t acl_data_size{0};
    if (p_lcb->transport == BT_TRANSPORT_LE) {
      acl_data_size = controller->get_acl_data_size_ble();
    if (transport == BT_TRANSPORT_LE) {
      acl_data_size = acl_packet_size_ble;
      xmit_window = l2cb.controller_le_xmit_window;

    } else {
      acl_data_size = controller->get_acl_data_size_classic();
      acl_data_size = acl_packet_size_classic;
      xmit_window = l2cb.controller_xmit_window;
    }
    uint16_t num_segs =
@@ -1069,7 +1073,7 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
    }

    p_buf->layer_specific = num_segs;
    if (p_lcb->transport == BT_TRANSPORT_LE) {
    if (transport == BT_TRANSPORT_LE) {
      l2cb.controller_le_xmit_window -= num_segs;
      if (p_lcb->link_xmit_quota == 0) l2cb.ble_round_robin_unacked += num_segs;
    } else {
@@ -1079,7 +1083,7 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
    }

    p_lcb->sent_not_acked += num_segs;
    if (p_lcb->transport == BT_TRANSPORT_LE) {
    if (transport == BT_TRANSPORT_LE) {
      bte_main_hci_send(
          p_buf, (uint16_t)(BT_EVT_TO_LM_HCI_ACL | LOCAL_BLE_CONTROLLER_ID));
    } else {
@@ -1088,7 +1092,7 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
  }

#if (L2CAP_HCI_FLOW_CONTROL_DEBUG == TRUE)
  if (p_lcb->transport == BT_TRANSPORT_LE) {
  if (transport == BT_TRANSPORT_LE) {
    L2CAP_TRACE_DEBUG(
        "TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",
        l2cb.controller_le_xmit_window, p_lcb->handle, p_lcb->link_xmit_quota,