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

Commit 09d1ba66 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

L2cap: our cfg option never uses flush timeout

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I1fe3a1192bf70d590926e7702aadb57722835a85
parent c48bea85
Loading
Loading
Loading
Loading
+0 −31
Original line number Diff line number Diff line
@@ -1886,9 +1886,6 @@ void l2cu_process_peer_cfg_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) {
 *
 ******************************************************************************/
void l2cu_process_our_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) {
  tL2C_LCB* p_lcb;
  uint16_t hci_flush_to;

  /* Save the QOS settings we are using for transmit */
  if (p_cfg->qos_present) {
    p_ccb->our_cfg.qos_present = true;
@@ -1921,34 +1918,6 @@ void l2cu_process_our_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) {

  p_ccb->our_cfg.fcr.mode = p_cfg->fcr.mode;
  p_ccb->our_cfg.fcr_present = p_cfg->fcr_present;

  /* Check the flush timeout. If it is lower than the current one used */
  /* then we need to adjust the flush timeout sent to the controller   */
  if (p_cfg->flush_to_present) {
    if ((p_cfg->flush_to == 0) ||
        (p_cfg->flush_to == L2CAP_NO_AUTOMATIC_FLUSH)) {
      /* don't send invalid flush timeout */
      /* SPEC: The sender of the Request shall specify its flush timeout value
       */
      /*       if it differs from the default value of 0xFFFF */
      p_cfg->flush_to_present = false;
    } else {
      p_ccb->our_cfg.flush_to = p_cfg->flush_to;
      p_lcb = p_ccb->p_lcb;

      if (p_cfg->flush_to < p_lcb->LinkFlushTimeout()) {
        p_lcb->SetLinkFlushTimeout(p_cfg->flush_to);

        /* If the timeout is within range of HCI, set the flush timeout */
        if (p_cfg->flush_to <= ((HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT * 5) / 8)) {
          /* Convert flush timeout to 0.625 ms units, with round */
          hci_flush_to = ((p_cfg->flush_to * 8) + 3) / 5;
          acl_write_automatic_flush_timeout(p_lcb->remote_bd_addr,
                                            hci_flush_to);
        }
      }
    }
  }
}

/*******************************************************************************