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

Commit 49c64f63 authored by Archie Pusaka's avatar Archie Pusaka Committed by Automerger Merge Worker
Browse files

Merge changes I8d2f5472,I8c13902f,I53e20893,I8460822b into main am: b7db3bb3 am: d8225b83

parents 8e313175 d8225b83
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ cc_library_static {
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libcom.android.sysprop.bluetooth.wrapped",
        "server_configurable_flags",
    ],
    shared_libs: [
        "libPlatformProperties",
@@ -489,7 +490,11 @@ cc_fuzz {
        "fuzzers/smp_fuzzer.cc",
        "smp/*.cc", // add other sources files  (p256 related) under smp into this test
    ],
    shared_libs: [
        "server_configurable_flags",
    ],
    static_libs: [
        "bluetooth_flags_c_lib",
        "libbluetooth-types",
        "libbluetooth_crypto_toolbox",
        "libbluetooth_hci_pdl",
@@ -856,6 +861,7 @@ cc_test {
    shared_libs: [
        "libcrypto",
        "libcutils",
        "server_configurable_flags",
    ],
    static_libs: [
        "libbluetooth-types",
+2 −0
Original line number Diff line number Diff line
@@ -735,6 +735,8 @@ typedef struct {
  tL2CA_FIXED_CONGESTION_STATUS_CB* pL2CA_FixedCong_Cb;

  uint16_t default_idle_tout;
  tL2CA_TX_COMPLETE_CB*
      pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
} tL2CAP_FIXED_CHNL_REG;

/*******************************************************************************
+10 −0
Original line number Diff line number Diff line
@@ -668,6 +668,14 @@ typedef struct {

typedef void(tL2C_FCR_MGMT_EVT_HDLR)(uint8_t, tL2C_CCB*);

/* Necessary info for postponed TX completion callback
 */
typedef struct {
  uint16_t local_cid;
  uint16_t num_sdu;
  tL2CA_TX_COMPLETE_CB* cb;
} tL2C_TX_COMPLETE_CB_INFO;

/* The offset in a buffer that L2CAP will use when building commands.
*/
#define L2CAP_SEND_CMD_OFFSET 0
@@ -735,6 +743,8 @@ void l2cu_set_acl_hci_header(BT_HDR* p_buf, tL2C_CCB* p_ccb);
void l2cu_check_channel_congestion(tL2C_CCB* p_ccb);
void l2cu_disconnect_chnl(tL2C_CCB* p_ccb);

void l2cu_tx_complete(tL2C_TX_COMPLETE_CB_INFO* p_cbi);

void l2cu_send_peer_ble_par_req(tL2C_LCB* p_lcb, uint16_t min_int,
                                uint16_t max_int, uint16_t latency,
                                uint16_t timeout);
+24 −10
Original line number Diff line number Diff line
@@ -56,8 +56,10 @@ void btm_acl_removed(uint16_t handle);
void btm_ble_decrement_link_topology_mask(uint8_t link_role);
void btm_sco_acl_removed(const RawAddress* bda);

static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf);
static BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb);
static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
                                   tL2C_TX_COMPLETE_CB_INFO* p_cbi);
static BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
                                            tL2C_TX_COMPLETE_CB_INFO* p_cbi);

void l2c_link_hci_conn_comp(tHCI_STATUS status, uint16_t handle,
                            const RawAddress& p_bda) {
@@ -866,7 +868,7 @@ void l2c_link_check_send_pkts(tL2C_LCB* p_lcb, uint16_t local_cid,
        LOG_VERBOSE("Sending to lower layer");
        p_buf = (BT_HDR*)list_front(p_lcb->link_xmit_data_q);
        list_remove(p_lcb->link_xmit_data_q, p_buf);
        l2c_link_send_to_lower(p_lcb, p_buf);
        l2c_link_send_to_lower(p_lcb, p_buf, NULL);
      } else if (single_write) {
        /* If only doing one write, break out */
        LOG_DEBUG("single_write is true, skipping");
@@ -874,11 +876,12 @@ void l2c_link_check_send_pkts(tL2C_LCB* p_lcb, uint16_t local_cid,
      }
      /* If nothing on the link queue, check the channel queue */
      else {
        tL2C_TX_COMPLETE_CB_INFO cbi = {};
        LOG_DEBUG("Check next buffer");
        p_buf = l2cu_get_next_buffer_to_send(p_lcb);
        p_buf = l2cu_get_next_buffer_to_send(p_lcb, &cbi);
        if (p_buf != NULL) {
          LOG_DEBUG("Sending next buffer");
          l2c_link_send_to_lower(p_lcb, p_buf);
          l2c_link_send_to_lower(p_lcb, p_buf, &cbi);
        }
      }
    }
@@ -921,7 +924,7 @@ void l2c_link_check_send_pkts(tL2C_LCB* p_lcb, uint16_t local_cid,
      LOG_VERBOSE("Sending to lower layer");
      p_buf = (BT_HDR*)list_front(p_lcb->link_xmit_data_q);
      list_remove(p_lcb->link_xmit_data_q, p_buf);
      l2c_link_send_to_lower(p_lcb, p_buf);
      l2c_link_send_to_lower(p_lcb, p_buf, NULL);
    }

    if (!single_write) {
@@ -932,13 +935,14 @@ void l2c_link_check_send_pkts(tL2C_LCB* p_lcb, uint16_t local_cid,
              (l2cb.controller_le_xmit_window != 0 &&
               (p_lcb->transport == BT_TRANSPORT_LE))) &&
             (p_lcb->sent_not_acked < p_lcb->link_xmit_quota)) {
        p_buf = l2cu_get_next_buffer_to_send(p_lcb);
        tL2C_TX_COMPLETE_CB_INFO cbi = {};
        p_buf = l2cu_get_next_buffer_to_send(p_lcb, &cbi);
        if (p_buf == NULL) {
          LOG_VERBOSE("No next buffer, skipping");
          break;
        }
        LOG_VERBOSE("Sending to lower layer");
        l2c_link_send_to_lower(p_lcb, p_buf);
        l2c_link_send_to_lower(p_lcb, p_buf, &cbi);
      }
    }

@@ -1006,12 +1010,14 @@ static void l2c_link_send_to_lower_ble(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
            l2cb.ble_round_robin_quota, l2cb.ble_round_robin_unacked);
}

static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf) {
static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf,
                                   tL2C_TX_COMPLETE_CB_INFO* p_cbi) {
  if (p_lcb->transport == BT_TRANSPORT_BR_EDR) {
    l2c_link_send_to_lower_br_edr(p_lcb, p_buf);
  } else {
    l2c_link_send_to_lower_ble(p_lcb, p_buf);
  }
  if (p_cbi) l2cu_tx_complete(p_cbi);
}

void l2c_packets_completed(uint16_t handle, uint16_t num_sent) {
@@ -1230,13 +1236,16 @@ tL2C_CCB* l2cu_get_next_channel_in_rr(tL2C_LCB* p_lcb) {
 * Returns          pointer to buffer or NULL
 *
 ******************************************************************************/
BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb) {
BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
                                     tL2C_TX_COMPLETE_CB_INFO* p_cbi) {
  tL2C_CCB* p_ccb;
  BT_HDR* p_buf;

  /* Highest priority are fixed channels */
  int xx;

  p_cbi->cb = NULL;

  for (xx = 0; xx < L2CAP_NUM_FIXED_CHNLS; xx++) {
    p_ccb = p_lcb->p_fixed_ccbs[xx];
    if (p_ccb == NULL) continue;
@@ -1269,6 +1278,11 @@ BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb) {
          return (NULL);
        }

        /* Prepare callback info for TX completion */
        p_cbi->cb = l2cb.fixed_reg[xx].pL2CA_FixedTxComplete_Cb;
        p_cbi->local_cid = p_ccb->local_cid;
        p_cbi->num_sdu = 1;

        l2cu_check_channel_congestion(p_ccb);
        l2cu_set_acl_hci_header(p_buf, p_ccb);
        return (p_buf);
+4 −0
Original line number Diff line number Diff line
@@ -3435,6 +3435,10 @@ tL2C_CCB* l2cu_find_ccb_by_cid(tL2C_LCB* p_lcb, uint16_t local_cid) {
  return (p_ccb);
}

void l2cu_tx_complete(tL2C_TX_COMPLETE_CB_INFO* p_cbi) {
  if (p_cbi->cb != NULL) p_cbi->cb(p_cbi->local_cid, p_cbi->num_sdu);
}

/******************************************************************************
 *
 * Function         l2cu_set_acl_hci_header
Loading