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

Commit 2f281b88 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

LegacyL2cap: Remove local_busy am: fa6cb4a7

Change-Id: Ieced5bfdda7b87163abf16ecc181cdb9c1abb196
parents 8c4692f7 fa6cb4a7
Loading
Loading
Loading
Loading
+8 −33
Original line number Original line Diff line number Diff line
@@ -698,8 +698,6 @@ void l2c_fcr_proc_pdu(tL2C_CCB* p_ccb, BT_HDR* p_buf) {
          (ctrl_word & L2CAP_FCR_S_FRAME_BIT)) {
          (ctrl_word & L2CAP_FCR_S_FRAME_BIT)) {
        if (p_ccb->fcrb.srej_sent)
        if (p_ccb->fcrb.srej_sent)
          l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT);
          l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT);
        else if (p_ccb->fcrb.local_busy)
          l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_F_BIT);
        else
        else
          l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT);
          l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT);


@@ -750,7 +748,7 @@ void l2c_fcr_proc_pdu(tL2C_CCB* p_ccb, BT_HDR* p_buf) {


  /* If we have some buffers held while doing SREJ, and SREJ has cleared,
  /* If we have some buffers held while doing SREJ, and SREJ has cleared,
   * process them now */
   * process them now */
  if ((!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.srej_sent) &&
  if ((!p_ccb->fcrb.srej_sent) &&
      (!fixed_queue_is_empty(p_ccb->fcrb.srej_rcv_hold_q))) {
      (!fixed_queue_is_empty(p_ccb->fcrb.srej_rcv_hold_q))) {
    fixed_queue_t* temp_q = p_ccb->fcrb.srej_rcv_hold_q;
    fixed_queue_t* temp_q = p_ccb->fcrb.srej_rcv_hold_q;
    p_ccb->fcrb.srej_rcv_hold_q = fixed_queue_new(SIZE_MAX);
    p_ccb->fcrb.srej_rcv_hold_q = fixed_queue_new(SIZE_MAX);
@@ -786,17 +784,15 @@ void l2c_fcr_proc_pdu(tL2C_CCB* p_ccb, BT_HDR* p_buf) {
    fixed_queue_free(temp_q, NULL);
    fixed_queue_free(temp_q, NULL);


    /* Now, if needed, send one RR for the whole held queue */
    /* Now, if needed, send one RR for the whole held queue */
    if ((!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.rej_sent) &&
    if ((!p_ccb->fcrb.rej_sent) && (!p_ccb->fcrb.srej_sent) &&
        (!p_ccb->fcrb.srej_sent) &&
        (p_ccb->fcrb.next_seq_expected != p_ccb->fcrb.last_ack_sent))
        (p_ccb->fcrb.next_seq_expected != p_ccb->fcrb.last_ack_sent))
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, 0);
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, 0);
    else {
    else {
      L2CAP_TRACE_DEBUG(
      L2CAP_TRACE_DEBUG(
          "l2c_fcr_proc_pdu() not sending RR CID: 0x%04x  local_busy:%d "
          "l2c_fcr_proc_pdu() not sending RR CID: 0x%04x  local_busy:%d "
          "rej_sent:%d srej_sent:%d Expected_Seq:%u Last_Ack:%u",
          "rej_sent:%d srej_sent:%d Expected_Seq:%u Last_Ack:%u",
          p_ccb->local_cid, p_ccb->fcrb.local_busy, p_ccb->fcrb.rej_sent,
          p_ccb->local_cid, 0, p_ccb->fcrb.rej_sent, p_ccb->fcrb.srej_sent,
          p_ccb->fcrb.srej_sent, p_ccb->fcrb.next_seq_expected,
          p_ccb->fcrb.next_seq_expected, p_ccb->fcrb.last_ack_sent);
          p_ccb->fcrb.last_ack_sent);
    }
    }
  }
  }


@@ -935,9 +931,6 @@ void l2c_fcr_proc_tout(tL2C_CCB* p_ccb) {
    l2cu_disconnect_chnl(p_ccb);
    l2cu_disconnect_chnl(p_ccb);
  } else {
  } else {
    if (!p_ccb->fcrb.srej_sent && !p_ccb->fcrb.rej_sent) {
    if (!p_ccb->fcrb.srej_sent && !p_ccb->fcrb.rej_sent) {
      if (p_ccb->fcrb.local_busy)
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_P_BIT);
      else
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_P_BIT);
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_P_BIT);
    }
    }
  }
  }
@@ -964,9 +957,6 @@ void l2c_fcr_proc_ack_tout(tL2C_CCB* p_ccb) {
#if (L2CAP_ERTM_STATS == TRUE)
#if (L2CAP_ERTM_STATS == TRUE)
    p_ccb->fcrb.xmit_ack_touts++;
    p_ccb->fcrb.xmit_ack_touts++;
#endif
#endif
    if (p_ccb->fcrb.local_busy)
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RNR, 0);
    else
    l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, 0);
    l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, 0);
  }
  }
}
}
@@ -1134,8 +1124,6 @@ static void process_s_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf,
    if (p_fcrb->send_f_rsp) {
    if (p_fcrb->send_f_rsp) {
      if (p_fcrb->srej_sent)
      if (p_fcrb->srej_sent)
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT);
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT);
      else if (p_fcrb->local_busy)
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_F_BIT);
      else
      else
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT);
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT);


@@ -1182,15 +1170,6 @@ static void process_i_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, uint16_t ctrl_word,
  /* Extract the sequence number */
  /* Extract the sequence number */
  tx_seq = (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT;
  tx_seq = (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT;


  /* If we have flow controlled the peer, ignore any bad I-frames from him */
  if ((tx_seq != p_fcrb->next_seq_expected) && (p_fcrb->local_busy)) {
    L2CAP_TRACE_WARNING("Dropping bad I-Frame since we flowed off, tx_seq:%u",
                        tx_seq);
    l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RNR, 0);
    osi_free(p_buf);
    return;
  }

  /* Check if tx-sequence is the expected one */
  /* Check if tx-sequence is the expected one */
  if (tx_seq != p_fcrb->next_seq_expected) {
  if (tx_seq != p_fcrb->next_seq_expected) {
    num_lost = (tx_seq - p_fcrb->next_seq_expected) & L2CAP_FCR_SEQ_MODULO;
    num_lost = (tx_seq - p_fcrb->next_seq_expected) & L2CAP_FCR_SEQ_MODULO;
@@ -1319,8 +1298,7 @@ static void process_i_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, uint16_t ctrl_word,
  num_to_ack = (p_fcrb->next_seq_expected - p_fcrb->last_ack_sent) &
  num_to_ack = (p_fcrb->next_seq_expected - p_fcrb->last_ack_sent) &
               L2CAP_FCR_SEQ_MODULO;
               L2CAP_FCR_SEQ_MODULO;


  if ((num_to_ack < p_ccb->fcrb.max_held_acks) && (!p_fcrb->local_busy))
  if (num_to_ack < p_ccb->fcrb.max_held_acks) delay_ack = true;
    delay_ack = true;


  /* We should neve never ack frame if we are not in OPEN state */
  /* We should neve never ack frame if we are not in OPEN state */
  if ((num_to_ack != 0) && p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) {
  if ((num_to_ack != 0) && p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) {
@@ -1335,9 +1313,6 @@ static void process_i_frame(tL2C_CCB* p_ccb, BT_HDR* p_buf, uint16_t ctrl_word,
    } else if ((fixed_queue_is_empty(p_ccb->xmit_hold_q) ||
    } else if ((fixed_queue_is_empty(p_ccb->xmit_hold_q) ||
                l2c_fcr_is_flow_controlled(p_ccb)) &&
                l2c_fcr_is_flow_controlled(p_ccb)) &&
               fixed_queue_is_empty(p_ccb->fcrb.srej_rcv_hold_q)) {
               fixed_queue_is_empty(p_ccb->fcrb.srej_rcv_hold_q)) {
      if (p_fcrb->local_busy)
        l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RNR, 0);
      else
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, 0);
      l2c_fcr_send_S_frame(p_ccb, L2CAP_FCR_SUP_RR, 0);
    }
    }
  }
  }
+0 −1
Original line number Original line Diff line number Diff line
@@ -192,7 +192,6 @@ typedef struct {
  uint8_t max_held_acks;     /* Max acks we can hold before sending */
  uint8_t max_held_acks;     /* Max acks we can hold before sending */


  bool remote_busy; /* true if peer has flowed us off */
  bool remote_busy; /* true if peer has flowed us off */
  bool local_busy;  /* true if we have flowed off the peer */


  bool rej_sent;       /* Reject was sent */
  bool rej_sent;       /* Reject was sent */
  bool srej_sent;      /* Selective Reject was sent */
  bool srej_sent;      /* Selective Reject was sent */