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

Commit f2adc6ad authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix GATT data loss due to segmentation error" am: ac5ee163 am: 741b1610 am: 29d7114f

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

Change-Id: I47e554f9ece0148e10f88b7a4f644d11fd7fd0c8
parents f7264dea 29d7114f
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1048,6 +1048,8 @@ void l2c_OnHciModeChangeSendPendingPackets(RawAddress remote) {
static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
  const uint16_t acl_packet_size_classic =
      controller_get_interface()->get_acl_packet_size_classic();
  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 bool is_bdr_and_fits_in_buffer =
      bluetooth::shim::is_gd_acl_enabled()
@@ -1063,8 +1065,8 @@ static void l2c_link_send_to_lower_br_edr(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
    l2cb.controller_xmit_window--;
  } else {
    uint16_t num_segs =
        (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_packet_size_classic - 1) /
        acl_packet_size_classic;
        (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) {
@@ -1098,6 +1100,8 @@ 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) {
  const uint16_t acl_packet_size_ble =
      controller_get_interface()->get_acl_packet_size_ble();
  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 bool is_ble_and_fits_in_buffer = (p_buf->len <= acl_packet_size_ble);

@@ -1110,8 +1114,8 @@ static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
    l2cb.controller_le_xmit_window--;
  } else {
    uint16_t num_segs =
        (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_packet_size_ble - 1) /
        acl_packet_size_ble;
        (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) {