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

Commit efe00389 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I83637165,I4af96edd,I8e0ef282,I6bd6f659,I25e6810c, ...

* changes:
  Wrap l2c::IsBonding in API
  Streamline includes stack/l2cap/l2c_link
  Move l2cu_get_next_buffer_to_send
  Move stack/l2cap/::l2cu_get_next_channel_in_rr
  Remove def L2CAP_ROUND_ROBIN_CHANNEL_SERVICE
  Remove def L2CAP_NUM_FIXED_CHNLS Optimization
parents b62b089e 728209a5
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -747,7 +747,6 @@ typedef struct {
      pL2CA_FixedTxComplete_Cb; /* fixed channel tx complete callback */
} tL2CAP_FIXED_CHNL_REG;

#if (L2CAP_NUM_FIXED_CHNLS > 0)
/*******************************************************************************
 *
 *  Function        L2CA_RegisterFixedChannel
@@ -833,8 +832,6 @@ extern bool L2CA_RemoveFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda);
extern bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda,
                                     uint16_t fixed_cid, uint16_t idle_tout);

#endif /* (L2CAP_NUM_FIXED_CHNLS > 0) */

/*******************************************************************************
 *
 *  Function        L2CA_CancelBleConnectReq
+0 −3
Original line number Diff line number Diff line
@@ -1316,7 +1316,6 @@ bool L2CA_GetPeerFeatures(const RawAddress& bd_addr, uint32_t* p_ext_feat,
  return true;
}

#if (L2CAP_NUM_FIXED_CHNLS > 0)
/*******************************************************************************
 *
 *  Function        L2CA_RegisterFixedChannel
@@ -1700,8 +1699,6 @@ bool L2CA_SetFixedChannelTout(const RawAddress& rem_bda, uint16_t fixed_cid,
  return true;
}

#endif /* #if (L2CAP_NUM_FIXED_CHNLS > 0) */

/*******************************************************************************
 *
 * Function         L2CA_DataWrite
+0 −4
Original line number Diff line number Diff line
@@ -918,7 +918,6 @@ static void l2c_csm_config(tL2C_CCB* p_ccb, uint16_t event, void* p_data) {
    case L2CEVT_L2CAP_DATA: /* Peer data packet rcvd    */
      L2CAP_TRACE_API("L2CAP - Calling DataInd_Cb(), CID: 0x%04x",
                      p_ccb->local_cid);
#if (L2CAP_NUM_FIXED_CHNLS > 0)
      if (p_ccb->local_cid >= L2CAP_FIRST_FIXED_CHNL &&
          p_ccb->local_cid <= L2CAP_LAST_FIXED_CHNL) {
        if (p_ccb->local_cid < L2CAP_BASE_APPL_CID) {
@@ -933,7 +932,6 @@ static void l2c_csm_config(tL2C_CCB* p_ccb, uint16_t event, void* p_data) {
          break;
        }
      }
#endif
      (*p_ccb->p_rcb->api.pL2CA_DataInd_Cb)(p_ccb->local_cid, (BT_HDR*)p_data);
      break;

@@ -1358,14 +1356,12 @@ void l2c_enqueue_peer_data(tL2C_CCB* p_ccb, BT_HDR* p_buf) {

  l2cu_check_channel_congestion(p_ccb);

#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
  /* if new packet is higher priority than serving ccb and it is not overrun */
  if ((p_ccb->p_lcb->rr_pri > p_ccb->ccb_priority) &&
      (p_ccb->p_lcb->rr_serv[p_ccb->ccb_priority].quota > 0)) {
    /* send out higher priority packet */
    p_ccb->p_lcb->rr_pri = p_ccb->ccb_priority;
  }
#endif

  /* if we are doing a round robin scheduling, set the flag */
  if (p_ccb->p_lcb->link_xmit_quota == 0) l2cb.check_round_robin = true;
+0 −2
Original line number Diff line number Diff line
@@ -1357,7 +1357,6 @@ static bool do_sar_reassembly(tL2C_CCB* p_ccb, BT_HDR* p_buf,
  if (!packet_ok) {
    osi_free(p_buf);
  } else if (p_buf != NULL) {
#if (L2CAP_NUM_FIXED_CHNLS > 0)
    if (p_ccb->local_cid < L2CAP_BASE_APPL_CID &&
        (p_ccb->local_cid >= L2CAP_FIRST_FIXED_CHNL &&
         p_ccb->local_cid <= L2CAP_LAST_FIXED_CHNL)) {
@@ -1367,7 +1366,6 @@ static bool do_sar_reassembly(tL2C_CCB* p_ccb, BT_HDR* p_buf,
              .pL2CA_FixedData_Cb)(p_ccb->local_cid,
                                   p_ccb->p_lcb->remote_bd_addr, p_buf);
    } else
#endif
      l2c_csm_execute(p_ccb, L2CEVT_L2CAP_DATA, p_buf);
  }

+6 −15
Original line number Diff line number Diff line
@@ -289,9 +289,7 @@ typedef struct t_l2c_ccb {

  bool is_flushable; /* true if channel is flushable */

#if (L2CAP_NUM_FIXED_CHNLS > 0)
  uint16_t fixed_chnl_idle_tout; /* Idle timeout to use for the fixed channel */
#endif
  uint16_t tx_data_len;

  /* Number of LE frames that the remote can send to us (credit count in
@@ -307,8 +305,6 @@ typedef struct {
  tL2C_CCB* p_last_ccb;  /* The last  channel in this queue */
} tL2C_CCB_Q;

#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)

/* Round-Robin service for the same priority channels */
#define L2CAP_NUM_CHNL_PRIORITY \
  3 /* Total number of priority group (high, medium, low)*/
@@ -330,8 +326,6 @@ typedef struct {
  uint8_t quota;         /* burst transmission quota */
} tL2C_RR_SERV;

#endif /* (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) */

/* Define a link control block. There is one link control block between
 * this device and any other device (i.e. BD ADDR).
*/
@@ -352,7 +346,12 @@ typedef struct t_l2c_linkcb {
  uint8_t id;
  uint8_t cur_echo_id;              /* Current id value for echo request */
  uint16_t idle_timeout;            /* Idle timeout */
  bool is_bonding;                  /* True - link active only for bonding */
 private:
  bool is_bonding_{false};          /* True - link active only for bonding */
 public:
  bool IsBonding() const { return is_bonding_; }
  void SetBonding() { is_bonding_ = true; }
  void ResetBonding() { is_bonding_ = false; }

  uint16_t link_flush_tout; /* Flush timeout used */

@@ -373,10 +372,8 @@ typedef struct t_l2c_linkcb {
  uint8_t acl_priority;     /* L2C_PRIORITY_NORMAL or L2C_PRIORITY_HIGH */
  tL2CA_NOCP_CB* p_nocp_cb; /* Num Cmpl pkts callback */

#if (L2CAP_NUM_FIXED_CHNLS > 0)
  tL2C_CCB* p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS];
  uint16_t disc_reason;
#endif

  tBT_TRANSPORT transport;
  uint8_t initiating_phys;  // LE PHY used for connection initiation
@@ -402,12 +399,10 @@ typedef struct t_l2c_linkcb {
  uint16_t min_ce_len;
  uint16_t max_ce_len;

#if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
  /* each priority group is limited burst transmission */
  /* round robin service for the same priority channels */
  tL2C_RR_SERV rr_serv[L2CAP_NUM_CHNL_PRIORITY];
  uint8_t rr_pri; /* current serving priority group */
#endif

} tL2C_LCB;

@@ -449,10 +444,8 @@ typedef struct {
  uint32_t test_info_resp; /* Conformance testing needs a dynamic response */
#endif

#if (L2CAP_NUM_FIXED_CHNLS > 0)
  tL2CAP_FIXED_CHNL_REG
      fixed_reg[L2CAP_NUM_FIXED_CHNLS]; /* Reg info for fixed channels */
#endif

  uint16_t num_ble_links_active; /* Number of LE links active */
  uint16_t controller_le_xmit_window; /* Total ACL window for all links */
@@ -623,8 +616,6 @@ extern void l2cu_create_conn_br_edr(tL2C_LCB* p_lcb);
extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb);
extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys);
extern void l2cu_create_conn_after_switch(tL2C_LCB* p_lcb);
extern BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
                                            tL2C_TX_COMPLETE_CB_INFO* p_cbi);
extern void l2cu_adjust_out_mps(tL2C_CCB* p_ccb);

/* Functions provided by l2c_link.cc
Loading