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

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

Merge "Remove unused echo response reporting" am: e2384912 am: 88b3a6a9

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

Change-Id: Iabaad8545e683529b4a262c6c9f47532d68cfe3d
parents 29251dbd 88b3a6a9
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -238,13 +238,6 @@ typedef void(tL2CA_QOS_VIOLATION_IND_CB)(const RawAddress&);
 */
typedef void(tL2CA_DATA_IND_CB)(uint16_t, BT_HDR*);

/* Echo response callback prototype. Note that this is not included in the
 * registration information, but is passed to L2CAP as part of the API to
 * actually send an echo request. Parameters are
 *              Result
 */
typedef void(tL2CA_ECHO_RSP_CB)(uint16_t);

/* Callback function prototype to pass broadcom specific echo response  */
/* to the upper layer                                                   */
typedef void(tL2CA_ECHO_DATA_CB)(const RawAddress&, uint16_t, uint8_t*);
+0 −4
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@
#define L2CAP_LINK_ROLE_SWITCH_TIMEOUT_MS (10 * 1000)  /* 10 seconds */
#define L2CAP_LINK_CONNECT_TIMEOUT_MS (60 * 1000)      /* 30 seconds */
#define L2CAP_LINK_CONNECT_EXT_TIMEOUT_MS (120 * 1000) /* 120 seconds */
#define L2CAP_ECHO_RSP_TIMEOUT_MS (30 * 1000)          /* 30 seconds */
#define L2CAP_LINK_FLOW_CONTROL_TIMEOUT_MS (2 * 1000)  /* 2 seconds */
#define L2CAP_LINK_DISCONNECT_TIMEOUT_MS (30 * 1000)   /* 30 seconds */
#define L2CAP_CHNL_CONNECT_TIMEOUT_MS (60 * 1000)      /* 60 seconds */
@@ -352,7 +351,6 @@ typedef struct t_l2c_linkcb {
  uint8_t link_role; /* Master or slave */
  uint8_t id;
  uint8_t cur_echo_id;              /* Current id value for echo request */
  tL2CA_ECHO_RSP_CB* p_echo_rsp_cb; /* Echo response callback */
  uint16_t idle_timeout;            /* Idle timeout */
  bool is_bonding;                  /* True - link active only for bonding */

@@ -567,8 +565,6 @@ extern void l2cu_send_peer_config_rej(tL2C_CCB* p_ccb, uint8_t* p_data,
extern void l2cu_send_peer_disc_req(tL2C_CCB* p_ccb);
extern void l2cu_send_peer_disc_rsp(tL2C_LCB* p_lcb, uint8_t remote_id,
                                    uint16_t local_cid, uint16_t remote_cid);
extern void l2cu_send_peer_echo_req(tL2C_LCB* p_lcb, uint8_t* p_data,
                                    uint16_t data_len);
extern void l2cu_send_peer_echo_rsp(tL2C_LCB* p_lcb, uint8_t id,
                                    uint8_t* p_data, uint16_t data_len);
extern void l2cu_send_peer_info_rsp(tL2C_LCB* p_lcb, uint8_t id,
+1 −27
Original line number Diff line number Diff line
@@ -216,11 +216,7 @@ void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
      l2c_csm_execute(p_ccb, L2CEVT_LP_CONNECT_CFM, &ci);
    }

    if (p_lcb->p_echo_rsp_cb) {
      l2cu_send_peer_echo_req(p_lcb, NULL, 0);
      alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_ECHO_RSP_TIMEOUT_MS,
                         l2c_lcb_timer_timeout, p_lcb);
    } else if (!p_lcb->ccb_queue.p_first_ccb) {
    if (!p_lcb->ccb_queue.p_first_ccb) {
      uint64_t timeout_ms = L2CAP_LINK_STARTUP_TOUT * 1000;
      alarm_set_on_mloop(p_lcb->l2c_lcb_timer, timeout_ms,
                         l2c_lcb_timer_timeout, p_lcb);
@@ -508,28 +504,6 @@ void l2c_link_timeout(tL2C_LCB* p_lcb) {

  /* If link is connected, check for inactivity timeout */
  if (p_lcb->link_state == LST_CONNECTED) {
    /* Check for ping outstanding */
    if (p_lcb->p_echo_rsp_cb) {
      tL2CA_ECHO_RSP_CB* p_cb = p_lcb->p_echo_rsp_cb;

      /* Zero out the callback in case app immediately calls us again */
      p_lcb->p_echo_rsp_cb = NULL;

      (*p_cb)(L2CAP_PING_RESULT_NO_RESP);

      L2CAP_TRACE_WARNING("L2CAP - ping timeout");

      /* For all channels, send a disconnect indication event through */
      /* their FSMs. The CCBs should remove themselves from the LCB   */
      for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;) {
        tL2C_CCB* pn = p_ccb->p_next_ccb;

        l2c_csm_execute(p_ccb, L2CEVT_LP_DISCONNECT_IND, NULL);

        p_ccb = pn;
      }
    }

    /* If no channels in use, drop the link. */
    if (!p_lcb->ccb_queue.p_first_ccb) {
      uint64_t timeout_ms;
+0 −11
Original line number Diff line number Diff line
@@ -728,17 +728,6 @@ static void process_l2cap_cmd(tL2C_LCB* p_lcb, uint8_t* p, uint16_t pkt_len) {
        l2cu_send_peer_echo_rsp(p_lcb, id, p, cmd_len);
        break;

      case L2CAP_CMD_ECHO_RSP:
        if (p_lcb->p_echo_rsp_cb) {
          tL2CA_ECHO_RSP_CB* p_cb = p_lcb->p_echo_rsp_cb;

          /* Zero out the callback in case app immediately calls us again */
          p_lcb->p_echo_rsp_cb = NULL;

          (*p_cb)(L2CAP_PING_RESULT_OK);
        }
        break;

      case L2CAP_CMD_INFO_REQ: {
        uint16_t info_type;
        if (p + 2 > p_next_cmd) return;
+0 −46
Original line number Diff line number Diff line
@@ -189,16 +189,6 @@ void l2cu_release_lcb(tL2C_LCB* p_lcb) {
    l2c_link_adjust_allocation();
  }

  /* Check for ping outstanding */
  if (p_lcb->p_echo_rsp_cb) {
    tL2CA_ECHO_RSP_CB* p_cb = p_lcb->p_echo_rsp_cb;

    /* Zero out the callback in case app immediately calls us again */
    p_lcb->p_echo_rsp_cb = NULL;

    (*p_cb)(L2CAP_PING_RESULT_NO_LINK);
  }

  /* Check and release all the LE COC connections waiting for security */
  if (p_lcb->le_sec_pending_q) {
    while (!fixed_queue_is_empty(p_lcb->le_sec_pending_q)) {
@@ -896,42 +886,6 @@ void l2cu_send_peer_disc_rsp(tL2C_LCB* p_lcb, uint8_t remote_id,
  l2c_link_check_send_pkts(p_lcb, NULL, p_buf);
}

/*******************************************************************************
 *
 * Function         l2cu_send_peer_echo_req
 *
 * Description      Build and send an L2CAP "echo request" message
 *                  to the peer. Note that we do not currently allow
 *                  data in the echo request.
 *
 * Returns          void
 *
 ******************************************************************************/
void l2cu_send_peer_echo_req(tL2C_LCB* p_lcb, uint8_t* p_data,
                             uint16_t data_len) {
  BT_HDR* p_buf;
  uint8_t* p;

  p_lcb->id++;
  l2cu_adj_id(p_lcb, L2CAP_ADJ_ZERO_ID); /* check for wrap to '0' */

  p_buf = l2cu_build_header(p_lcb, (uint16_t)(L2CAP_ECHO_REQ_LEN + data_len),
                            L2CAP_CMD_ECHO_REQ, p_lcb->id);
  if (p_buf == NULL) {
    L2CAP_TRACE_WARNING("L2CAP - no buffer for echo_req");
    return;
  }

  p = (uint8_t*)(p_buf + 1) + L2CAP_SEND_CMD_OFFSET + HCI_DATA_PREAMBLE_SIZE +
      L2CAP_PKT_OVERHEAD + L2CAP_CMD_OVERHEAD;

  if (data_len) {
    ARRAY_TO_STREAM(p, p_data, data_len);
  }

  l2c_link_check_send_pkts(p_lcb, NULL, p_buf);
}

/*******************************************************************************
 *
 * Function         l2cu_send_peer_echo_rsp