Component/bt: fix hci_hal_env.rx_q and xHciH4Queue blocking when scanning

This commit is contained in:
zhiweijian
2018-07-02 10:59:51 +08:00
parent bba047fb3e
commit 658668b386
30 changed files with 241 additions and 45 deletions

View File

@@ -313,7 +313,7 @@ tAVCT_LCB *avct_lcb_alloc(BD_ADDR bd_addr)
p_lcb->allocated = (UINT8)(i + 1);
memcpy(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN);
AVCT_TRACE_DEBUG("avct_lcb_alloc %d", p_lcb->allocated);
p_lcb->tx_q = fixed_queue_new(SIZE_MAX);
p_lcb->tx_q = fixed_queue_new(QUEUE_SIZE_MAX);
break;
}
}

View File

@@ -376,8 +376,8 @@ tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr)
if (!p_ccb->allocated) {
p_ccb->allocated = TRUE;
memcpy(p_ccb->peer_addr, bd_addr, BD_ADDR_LEN);
p_ccb->cmd_q = fixed_queue_new(SIZE_MAX);
p_ccb->rsp_q = fixed_queue_new(SIZE_MAX);
p_ccb->cmd_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_ccb->rsp_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_ccb->timer_entry.param = (UINT32) p_ccb;
AVDT_TRACE_DEBUG("avdt_ccb_alloc %d\n", i);
break;

View File

@@ -603,7 +603,7 @@ tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs)
memcpy(&p_scb->cs, p_cs, sizeof(tAVDT_CS));
#if AVDT_MULTIPLEXING == TRUE
/* initialize fragments gueue */
p_scb->frag_q = fixed_queue_new(SIZE_MAX);
p_scb->frag_q = fixed_queue_new(QUEUE_SIZE_MAX);
if (p_cs->cfg.psc_mask & AVDT_PSC_MUX) {
p_scb->cs.cfg.mux_tcid_media = avdt_ad_type_to_tcid(AVDT_CHAN_MEDIA, p_scb);

View File

@@ -3867,7 +3867,7 @@ void btm_ble_init (void)
btm_cb.cmn_ble_vsc_cb.values_read = FALSE;
p_cb->cur_states = 0;
p_cb->conn_pending_q = fixed_queue_new(SIZE_MAX);
p_cb->conn_pending_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_cb->inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
p_cb->inq_var.scan_type = BTM_BLE_SCAN_MODE_NONE;

View File

@@ -56,8 +56,8 @@ void btm_init (void)
#endif /* #if BTM_DYNAMIC_MEMORY */
/* All fields are cleared; nonzero fields are reinitialized in appropriate function */
memset(&btm_cb, 0, sizeof(tBTM_CB));
btm_cb.page_queue = fixed_queue_new(SIZE_MAX);
btm_cb.sec_pending_q = fixed_queue_new(SIZE_MAX);
btm_cb.page_queue = fixed_queue_new(QUEUE_SIZE_MAX);
btm_cb.sec_pending_q = fixed_queue_new(QUEUE_SIZE_MAX);
#if defined(BTM_INITIAL_TRACE_LEVEL)
btm_cb.trace_level = BTM_INITIAL_TRACE_LEVEL;

View File

@@ -113,7 +113,7 @@ void btm_sco_init (void)
#endif
#if (BTM_SCO_HCI_INCLUDED == TRUE)
for (int i = 0; i < BTM_MAX_SCO_LINKS; i++) {
btm_cb.sco_cb.sco_db[i].xmit_data_q = fixed_queue_new(SIZE_MAX);
btm_cb.sco_cb.sco_db[i].xmit_data_q = fixed_queue_new(QUEUE_SIZE_MAX);
}
#endif
/* Initialize nonzero defaults */

View File

@@ -2762,7 +2762,7 @@ void btm_sec_check_pending_reqs (void)
/* Now, re-submit anything in the mux queue */
bq = btm_cb.sec_pending_q;
if (!btm_cb.sec_pending_q) {
btm_cb.sec_pending_q = fixed_queue_new(SIZE_MAX);
btm_cb.sec_pending_q = fixed_queue_new(QUEUE_SIZE_MAX);
}
while ((p_e = (tBTM_SEC_QUEUE_ENTRY *)fixed_queue_try_dequeue(bq)) != NULL) {

View File

@@ -236,3 +236,13 @@ UINT16 BTU_BleAclPktSize(void)
return 0;
#endif
}
#if SCAN_QUEUE_CONGEST_CHECK
bool BTU_check_queue_is_congest(void)
{
UBaseType_t wait_size = uxQueueMessagesWaiting(xBtuQueue);
if(wait_size >= QUEUE_CONGEST_SIZE ) {
return true;
}
return false;
}
#endif

View File

@@ -1120,8 +1120,8 @@ static tGAP_CCB *gap_allocate_ccb (void)
for (xx = 0, p_ccb = gap_cb.conn.ccb_pool; xx < GAP_MAX_CONNECTIONS; xx++, p_ccb++) {
if (p_ccb->con_state == GAP_CCB_STATE_IDLE) {
memset (p_ccb, 0, sizeof (tGAP_CCB));
p_ccb->tx_queue = fixed_queue_new(SIZE_MAX);
p_ccb->rx_queue = fixed_queue_new(SIZE_MAX);
p_ccb->tx_queue = fixed_queue_new(QUEUE_SIZE_MAX);
p_ccb->rx_queue = fixed_queue_new(QUEUE_SIZE_MAX);
p_ccb->gap_handle = xx;
p_ccb->rem_mtu_size = L2CAP_MTU_SIZE;

View File

@@ -64,7 +64,7 @@ BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN
UINT16 s_hdl, UINT16 num_handle)
{
if (p_db->svc_buffer == NULL) { //in case already alloc
p_db->svc_buffer = fixed_queue_new(SIZE_MAX);
p_db->svc_buffer = fixed_queue_new(QUEUE_SIZE_MAX);
}
if (!allocate_svc_db_buf(p_db)) {

View File

@@ -108,9 +108,9 @@ void gatt_init (void)
gatt_cb.trace_level = BT_TRACE_LEVEL_NONE; /* No traces */
#endif
gatt_cb.def_mtu_size = GATT_DEF_BLE_MTU_SIZE;
gatt_cb.sign_op_queue = fixed_queue_new(SIZE_MAX);
gatt_cb.srv_chg_clt_q = fixed_queue_new(SIZE_MAX);
gatt_cb.pending_new_srv_start_q = fixed_queue_new(SIZE_MAX);
gatt_cb.sign_op_queue = fixed_queue_new(QUEUE_SIZE_MAX);
gatt_cb.srv_chg_clt_q = fixed_queue_new(QUEUE_SIZE_MAX);
gatt_cb.pending_new_srv_start_q = fixed_queue_new(QUEUE_SIZE_MAX);
/* First, register fixed L2CAP channel for ATT over BLE */
fixed_reg.fixed_chnl_opts.mode = L2CAP_FCR_BASIC_MODE;
fixed_reg.fixed_chnl_opts.max_transmit = 0xFF;

View File

@@ -167,7 +167,7 @@ static BOOLEAN process_read_multi_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS status,
GATT_TRACE_DEBUG ("process_read_multi_rsp status=%d mtu=%d", status, mtu);
if (p_cmd->multi_rsp_q == NULL) {
p_cmd->multi_rsp_q = fixed_queue_new(SIZE_MAX);
p_cmd->multi_rsp_q = fixed_queue_new(QUEUE_SIZE_MAX);
}
/* Enqueue the response */
@@ -1290,7 +1290,7 @@ void gatt_attr_process_prepare_write (tGATT_TCB *p_tcb, UINT8 i_rcb, UINT16 hand
queue_data->offset = offset;
memcpy(queue_data->value, p, len);
if (prepare_record->queue == NULL) {
prepare_record->queue = fixed_queue_new(SIZE_MAX);
prepare_record->queue = fixed_queue_new(QUEUE_SIZE_MAX);
}
fixed_queue_enqueue(prepare_record->queue, queue_data);
}

View File

@@ -337,7 +337,7 @@ tGATT_HDL_LIST_ELEM *gatt_alloc_hdl_buffer(void)
if (!p_cb->hdl_list[i].in_use) {
memset(p_elem, 0, sizeof(tGATT_HDL_LIST_ELEM));
p_elem->in_use = TRUE;
p_elem->svc_db.svc_buffer = fixed_queue_new(SIZE_MAX);
p_elem->svc_db.svc_buffer = fixed_queue_new(QUEUE_SIZE_MAX);
return p_elem;
}
}
@@ -1007,8 +1007,8 @@ tGATT_TCB *gatt_allocate_tcb_by_bdaddr(BD_ADDR bda, tBT_TRANSPORT transport)
if (allocated) {
memset(p_tcb, 0, sizeof(tGATT_TCB));
p_tcb->pending_enc_clcb = fixed_queue_new(SIZE_MAX);
p_tcb->pending_ind_q = fixed_queue_new(SIZE_MAX);
p_tcb->pending_enc_clcb = fixed_queue_new(QUEUE_SIZE_MAX);
p_tcb->pending_ind_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_tcb->in_use = TRUE;
p_tcb->tcb_idx = i;
p_tcb->transport = transport;

View File

@@ -750,7 +750,7 @@ void l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf)
if ( (!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.srej_sent) &&
(!fixed_queue_is_empty(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(QUEUE_SIZE_MAX);
while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(temp_q)) != NULL) {
if (p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) {

View File

@@ -74,7 +74,7 @@ tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, BOOLEAN is_bonding, tBT_TRANSPOR
#if (BLE_INCLUDED == TRUE)
p_lcb->transport = transport;
p_lcb->tx_data_len = controller_get_interface()->get_ble_default_data_packet_length();
p_lcb->le_sec_pending_q = fixed_queue_new(SIZE_MAX);
p_lcb->le_sec_pending_q = fixed_queue_new(QUEUE_SIZE_MAX);
if (transport == BT_TRANSPORT_LE) {
l2cb.num_ble_links_active++;
@@ -1519,11 +1519,11 @@ tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid)
p_ccb->max_rx_mtu = L2CAP_MTU_SIZE;
p_ccb->tx_mps = L2CAP_FCR_TX_BUF_SIZE - 32;
p_ccb->xmit_hold_q = fixed_queue_new(SIZE_MAX);
p_ccb->xmit_hold_q = fixed_queue_new(QUEUE_SIZE_MAX);
#if (CLASSIC_BT_INCLUDED == TRUE)
p_ccb->fcrb.srej_rcv_hold_q = fixed_queue_new(SIZE_MAX);
p_ccb->fcrb.retrans_q = fixed_queue_new(SIZE_MAX);
p_ccb->fcrb.waiting_for_ack_q = fixed_queue_new(SIZE_MAX);
p_ccb->fcrb.srej_rcv_hold_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_ccb->fcrb.retrans_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_ccb->fcrb.waiting_for_ack_q = fixed_queue_new(QUEUE_SIZE_MAX);
#endif ///CLASSIC_BT_INCLUDED == TRUE
p_ccb->cong_sent = FALSE;

View File

@@ -128,8 +128,8 @@ void port_set_defaults (tPORT *p_port)
memset (&p_port->rx, 0, sizeof (p_port->rx));
memset (&p_port->tx, 0, sizeof (p_port->tx));
p_port->tx.queue = fixed_queue_new(SIZE_MAX);
p_port->rx.queue = fixed_queue_new(SIZE_MAX);
p_port->tx.queue = fixed_queue_new(QUEUE_SIZE_MAX);
p_port->rx.queue = fixed_queue_new(QUEUE_SIZE_MAX);
}
/*******************************************************************************

View File

@@ -175,7 +175,7 @@ tRFC_MCB *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, BOOLEAN is_initiator)
RFCOMM_TRACE_DEBUG("rfc_alloc_multiplexer_channel:is_initiator:%d, create new p_mcb:%p, index:%d",
is_initiator, &rfc_cb.port.rfc_mcb[j], j);
p_mcb->cmd_q = fixed_queue_new(SIZE_MAX);
p_mcb->cmd_q = fixed_queue_new(QUEUE_SIZE_MAX);
p_mcb->is_initiator = is_initiator;