:add congest direct callback and modify congest evt triger threshold
This commit is contained in:
parent
1ef2b2d32a
commit
b08aee46de
6 changed files with 24 additions and 15 deletions
|
@ -974,22 +974,14 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||||
** Returns none.
|
** Returns none.
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
extern void btc_congest_callback(tBTA_GATTS *param);
|
||||||
static void bta_gatts_cong_cback (UINT16 conn_id, BOOLEAN congested)
|
static void bta_gatts_cong_cback (UINT16 conn_id, BOOLEAN congested)
|
||||||
{
|
{
|
||||||
tBTA_GATTS_RCB *p_rcb;
|
|
||||||
tGATT_IF gatt_if;
|
|
||||||
tBTA_GATT_TRANSPORT transport;
|
|
||||||
tBTA_GATTS cb_data;
|
tBTA_GATTS cb_data;
|
||||||
|
|
||||||
if (GATT_GetConnectionInfor(conn_id, &gatt_if, cb_data.req_data.remote_bda, &transport)) {
|
|
||||||
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
|
||||||
|
|
||||||
if (p_rcb && p_rcb->p_cback) {
|
|
||||||
cb_data.congest.conn_id = conn_id;
|
cb_data.congest.conn_id = conn_id;
|
||||||
cb_data.congest.congested = congested;
|
cb_data.congest.congested = congested;
|
||||||
|
|
||||||
(*p_rcb->p_cback)(BTA_GATTS_CONGEST_EVT, &cb_data);
|
btc_congest_callback(&cb_data);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* GATTS_INCLUDED */
|
#endif /* GATTS_INCLUDED */
|
||||||
|
|
|
@ -931,4 +931,13 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
|
||||||
btc_gatts_cb_param_copy_free(msg, p_data);
|
btc_gatts_cb_param_copy_free(msg, p_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void btc_congest_callback(tBTA_GATTS *param)
|
||||||
|
{
|
||||||
|
esp_ble_gatts_cb_param_t esp_param;
|
||||||
|
esp_gatt_if_t gatts_if = BTC_GATT_GET_GATT_IF(param->congest.conn_id);
|
||||||
|
esp_param.congest.conn_id = BTC_GATT_GET_CONN_ID(param->congest.conn_id);
|
||||||
|
esp_param.congest.congested = param->congest.congested;
|
||||||
|
btc_gatts_cb_to_app(ESP_GATTS_CONGEST_EVT, gatts_if, &esp_param);
|
||||||
|
|
||||||
|
}
|
||||||
#endif ///GATTS_INCLUDED
|
#endif ///GATTS_INCLUDED
|
||||||
|
|
|
@ -90,6 +90,13 @@ static void fragment_and_dispatch(BT_HDR *packet)
|
||||||
controller->get_acl_data_size_ble();
|
controller->get_acl_data_size_ble();
|
||||||
|
|
||||||
max_packet_size = max_data_size + HCI_ACL_PREAMBLE_SIZE;
|
max_packet_size = max_data_size + HCI_ACL_PREAMBLE_SIZE;
|
||||||
|
if((packet->len > max_packet_size) && (packet->layer_specific == 0) && (event == MSG_STACK_TO_HC_HCI_ACL)) {
|
||||||
|
packet->event = MSG_HC_TO_STACK_L2C_SEG_XMIT;
|
||||||
|
current_fragment_packet = NULL;
|
||||||
|
callbacks->transmit_finished(packet, false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
remaining_length = packet->len;
|
remaining_length = packet->len;
|
||||||
STREAM_TO_UINT16(continuation_handle, stream);
|
STREAM_TO_UINT16(continuation_handle, stream);
|
||||||
continuation_handle = APPLY_CONTINUATION_FLAG(continuation_handle);
|
continuation_handle = APPLY_CONTINUATION_FLAG(continuation_handle);
|
||||||
|
|
|
@ -264,7 +264,7 @@ typedef struct
|
||||||
}tL2CAP_SEC_DATA;
|
}tL2CAP_SEC_DATA;
|
||||||
|
|
||||||
#ifndef L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA
|
#ifndef L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA
|
||||||
#define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 100
|
#define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 10
|
||||||
#endif
|
#endif
|
||||||
/* Define a channel control block (CCB). There may be many channel control blocks
|
/* Define a channel control block (CCB). There may be many channel control blocks
|
||||||
** between the same two Bluetooth devices (i.e. on the same link).
|
** between the same two Bluetooth devices (i.e. on the same link).
|
||||||
|
|
|
@ -1836,7 +1836,7 @@ UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)
|
||||||
|
|
||||||
// If already congested, do not accept any more packets
|
// If already congested, do not accept any more packets
|
||||||
if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->cong_sent) {
|
if (p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->cong_sent) {
|
||||||
L2CAP_TRACE_DEBUG ("L2CAP - CID: 0x%04x cannot send, already congested\
|
L2CAP_TRACE_ERROR ("L2CAP - CID: 0x%04x cannot send, already congested\
|
||||||
xmit_hold_q.count: %u buff_quota: %u", fixed_cid,
|
xmit_hold_q.count: %u buff_quota: %u", fixed_cid,
|
||||||
fixed_queue_length(p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->xmit_hold_q),
|
fixed_queue_length(p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->xmit_hold_q),
|
||||||
p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->buff_quota);
|
p_lcb->p_fixed_ccbs[fixed_cid - L2CAP_FIRST_FIXED_CHNL]->buff_quota);
|
||||||
|
|
|
@ -3651,8 +3651,9 @@ void l2cu_check_channel_congestion (tL2C_CCB *p_ccb)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
tL2C_LCB *p_lcb = p_ccb->p_lcb;
|
||||||
/* If this channel was not congested but it is congested now, tell the app */
|
/* If this channel was not congested but it is congested now, tell the app */
|
||||||
if (q_count > p_ccb->buff_quota) {
|
if ((q_count > p_ccb->buff_quota) || (p_lcb && (p_ccb->local_cid == L2CAP_ATT_CID) && (p_lcb->link_xmit_quota > 0) && (p_lcb->link_xmit_quota <= p_lcb->sent_not_acked))) {
|
||||||
p_ccb->cong_sent = TRUE;
|
p_ccb->cong_sent = TRUE;
|
||||||
if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb) {
|
if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb) {
|
||||||
L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (TRUE),CID:0x%04x,XmitQ:%u,Quota:%u",
|
L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (TRUE),CID:0x%04x,XmitQ:%u,Quota:%u",
|
||||||
|
|
Loading…
Reference in a new issue