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

Commit 4531c4a1 authored by Chris Manton's avatar Chris Manton
Browse files

Smooth l2c_link_send_to_lower/br_edr and ble

stack/l2cap/l2c_link::l2c_link_send_to_lower

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ia464ddf48f403d542f361b872c7c8a68c5de50af
parent 14f2f340
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -1030,13 +1030,9 @@ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
    p_buf->layer_specific = 0;

    l2cb.controller_xmit_window--;
    bte_main_hci_send(p_buf, kDataPacketEventBrEdr);
  } else {
    uint16_t xmit_window{0};
    uint16_t acl_data_size{0};
    acl_data_size = acl_packet_size_classic;
    xmit_window = l2cb.controller_xmit_window;

    uint16_t xmit_window = l2cb.controller_xmit_window;
    uint16_t acl_data_size = acl_packet_size_classic;
    uint16_t num_segs =
        (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size - 1) /
        acl_data_size;
@@ -1063,8 +1059,8 @@ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
    if (p_lcb->link_xmit_quota == 0) l2cb.round_robin_unacked += num_segs;

    p_lcb->sent_not_acked += num_segs;
    bte_main_hci_send(p_buf, kDataPacketEventBrEdr);
  }
  bte_main_hci_send(p_buf, kDataPacketEventBrEdr);
  L2CAP_TRACE_DEBUG(
      "TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",
      l2cb.controller_xmit_window, p_lcb->handle, p_lcb->link_xmit_quota,
@@ -1085,12 +1081,9 @@ static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
    p_buf->layer_specific = 0;

    l2cb.controller_le_xmit_window--;
    bte_main_hci_send(p_buf, kDataPacketEventBle);
  } else {
    uint16_t xmit_window{0};
    uint16_t acl_data_size{0};
    acl_data_size = acl_packet_size_ble;
    xmit_window = l2cb.controller_le_xmit_window;
    uint16_t xmit_window = l2cb.controller_le_xmit_window;
    uint16_t acl_data_size = acl_packet_size_ble;

    uint16_t num_segs =
        (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size - 1) /
@@ -1118,8 +1111,8 @@ static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
    if (p_lcb->link_xmit_quota == 0) l2cb.ble_round_robin_unacked += num_segs;

    p_lcb->sent_not_acked += num_segs;
    bte_main_hci_send(p_buf, kDataPacketEventBle);
  }
  bte_main_hci_send(p_buf, kDataPacketEventBle);

  L2CAP_TRACE_DEBUG(
      "TotalWin=%d,Hndl=0x%x,Quota=%d,Unack=%d,RRQuota=%d,RRUnack=%d",