mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
feat(bt/bluedroid): delete unused host congest check
This commit is contained in:
parent
79bf6acddb
commit
386f94a807
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -524,9 +524,6 @@ bt_status_t btc_init(void)
|
||||
btc_gap_ble_init();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_init();
|
||||
#endif
|
||||
/* TODO: initial the profile_tab */
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
@ -542,18 +539,6 @@ void btc_deinit(void)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
btc_gap_ble_deinit();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_deinit();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool btc_check_queue_is_congest(void)
|
||||
{
|
||||
if (osi_thread_queue_wait_size(btc_thread, 0) >= BT_QUEUE_CONGEST_SIZE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int get_btc_work_queue_size(void)
|
||||
|
@ -143,7 +143,6 @@ bt_status_t btc_inter_profile_call(btc_msg_t *msg);
|
||||
|
||||
bt_status_t btc_init(void);
|
||||
void btc_deinit(void);
|
||||
bool btc_check_queue_is_congest(void);
|
||||
int get_btc_work_queue_size(void);
|
||||
|
||||
/**
|
||||
|
@ -203,8 +203,9 @@ config BT_GATTS_PPCP_CHAR_GAP
|
||||
depends on BT_GATTS_ENABLE
|
||||
default n
|
||||
help
|
||||
This enables "Peripheral Preferred Connection Parameters" characteristic (UUID: 0x2A04) in GAP service that has
|
||||
connection parameters like min/max connection interval, slave latency and supervision timeout multiplier
|
||||
This enables "Peripheral Preferred Connection Parameters" characteristic (UUID: 0x2A04)
|
||||
in GAP service that has connection parameters like min/max connection interval, slave
|
||||
latency and supervision timeout multiplier
|
||||
|
||||
config BT_BLE_BLUFI_ENABLE
|
||||
bool "Include blufi function"
|
||||
@ -1131,15 +1132,6 @@ config BT_BLE_DYNAMIC_ENV_MEMORY
|
||||
help
|
||||
This select can make the allocation of memory will become more flexible
|
||||
|
||||
config BT_BLE_HOST_QUEUE_CONG_CHECK
|
||||
bool "BLE queue congestion check"
|
||||
depends on BT_BLE_ENABLED
|
||||
default n
|
||||
help
|
||||
When scanning and scan duplicate is not enabled, if there are a lot of adv packets around
|
||||
or application layer handling adv packets is slow, it will cause the controller memory
|
||||
to run out. if enabled, adv packets will be lost when host queue is congested.
|
||||
|
||||
config BT_SMP_ENABLE
|
||||
bool
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
@ -1218,16 +1210,6 @@ config BT_BLE_50_FEATURES_SUPPORTED
|
||||
This option is universally supported in chips that support BLE, except for ESP32.
|
||||
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
|
||||
|
||||
|
||||
config BT_BLE_42_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 4.2 features(please disable BLE 5.0 if enable BLE 4.2)"
|
||||
depends on (BT_BLE_ENABLED && ((BT_CONTROLLER_ENABLED && SOC_BLE_50_SUPPORTED) || BT_CONTROLLER_DISABLED))
|
||||
default n
|
||||
help
|
||||
This enables BLE 4.2 features.
|
||||
This option is universally supported by all ESP chips with BLE capabilities.
|
||||
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
|
||||
|
||||
config BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER
|
||||
bool "Enable BLE periodic advertising sync transfer feature"
|
||||
depends on (BT_BLUEDROID_ENABLED && BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_ESP_NIMBLE_CONTROLLER) || BT_CONTROLLER_DISABLED)) # NOERROR
|
||||
@ -1249,6 +1231,15 @@ config BT_BLE_FEAT_CREATE_SYNC_ENH
|
||||
help
|
||||
Enable the create sync enhancements
|
||||
|
||||
config BT_BLE_42_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 4.2 features(please disable BLE 5.0 if enable BLE 4.2)"
|
||||
depends on (BT_BLE_ENABLED && ((BT_CONTROLLER_ENABLED && SOC_BLE_50_SUPPORTED) || BT_CONTROLLER_DISABLED))
|
||||
default n
|
||||
help
|
||||
This enables BLE 4.2 features.
|
||||
This option is universally supported by all ESP chips with BLE capabilities.
|
||||
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
|
||||
|
||||
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
||||
bool "Enable BLE high duty advertising interval feature"
|
||||
depends on BT_BLE_ENABLED
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -39,20 +39,6 @@ tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
|
||||
#endif
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
static list_t *adv_filter_list;
|
||||
static osi_mutex_t adv_list_lock;
|
||||
bool btc_check_adv_list(uint8_t * addr, uint8_t addr_type);
|
||||
uint32_t btc_get_adv_list_length(void);
|
||||
void btc_adv_list_refresh(void);
|
||||
void btc_adv_list_lock(void);
|
||||
void btc_adv_list_unlock(void);
|
||||
static uint16_t btc_adv_list_count = 0;
|
||||
|
||||
#define BTC_ADV_LIST_MAX_LENGTH 50
|
||||
#define BTC_ADV_LIST_MAX_COUNT 200
|
||||
#endif
|
||||
|
||||
#define BTC_GAP_BLE_ADV_RPT_QUEUE_IDX (1)
|
||||
#define BTC_GAP_BLE_ADV_RPT_BATCH_SIZE (10)
|
||||
#define BTC_GAP_BLE_ADV_RPT_QUEUE_LEN_MAX (200)
|
||||
@ -641,20 +627,6 @@ static void btc_gap_ble_adv_pkt_handler(void *arg)
|
||||
|
||||
static void btc_process_adv_rpt_pkt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data)
|
||||
{
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
if(btc_check_queue_is_congest()) {
|
||||
BTC_TRACE_DEBUG("BtcQueue is congested");
|
||||
if(btc_get_adv_list_length() > BTC_ADV_LIST_MAX_LENGTH || btc_adv_list_count > BTC_ADV_LIST_MAX_COUNT) {
|
||||
btc_adv_list_refresh();
|
||||
btc_adv_list_count = 0;
|
||||
}
|
||||
if(btc_check_adv_list(p_data->inq_res.bd_addr, p_data->inq_res.ble_addr_type)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
btc_adv_list_count ++;
|
||||
#endif
|
||||
|
||||
// drop ADV packets if data queue length goes above threshold
|
||||
btc_gap_ble_env_t *p_env = &btc_gap_ble_env;
|
||||
if (pkt_queue_length(p_env->adv_rpt_queue) >= BTC_GAP_BLE_ADV_RPT_QUEUE_LEN_MAX) {
|
||||
@ -770,9 +742,6 @@ static void btc_stop_scan_callback(tBTA_STATUS status)
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_refresh();
|
||||
#endif
|
||||
}
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
void btc_update_conn_param_callback (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params)
|
||||
@ -1393,9 +1362,6 @@ static void btc_ble_start_scanning(uint32_t duration,
|
||||
tBTA_START_STOP_SCAN_CMPL_CBACK *start_scan_cb)
|
||||
{
|
||||
if ((results_cb != NULL) && (start_scan_cb != NULL)) {
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_refresh();
|
||||
#endif
|
||||
//Start scan the device
|
||||
BTA_DmBleScan(true, duration, results_cb, start_scan_cb);
|
||||
} else {
|
||||
@ -2470,100 +2436,4 @@ void btc_gap_ble_deinit(void)
|
||||
btc_cleanup_adv_data(&gl_bta_scan_rsp_data);
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
}
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
void btc_adv_list_free(void *data)
|
||||
{
|
||||
osi_free(data);
|
||||
}
|
||||
|
||||
void btc_adv_list_init(void)
|
||||
{
|
||||
osi_mutex_new(&adv_list_lock);
|
||||
adv_filter_list = list_new(btc_adv_list_free);
|
||||
}
|
||||
|
||||
void btc_adv_list_deinit(void)
|
||||
{
|
||||
osi_mutex_free(&adv_list_lock);
|
||||
if(adv_filter_list) {
|
||||
list_free(adv_filter_list);
|
||||
adv_filter_list = NULL;
|
||||
}
|
||||
}
|
||||
void btc_adv_list_add_packet(void * data)
|
||||
{
|
||||
if(!data) {
|
||||
BTC_TRACE_ERROR("%s data is NULL", __func__);
|
||||
return;
|
||||
}
|
||||
btc_adv_list_lock();
|
||||
list_prepend(adv_filter_list, data);
|
||||
btc_adv_list_unlock();
|
||||
}
|
||||
|
||||
uint32_t btc_get_adv_list_length(void)
|
||||
{
|
||||
if(!adv_filter_list) {
|
||||
BTC_TRACE_ERROR("%s adv_filter_list is NULL", __func__);
|
||||
return 0;
|
||||
}
|
||||
btc_adv_list_lock();
|
||||
size_t length = list_length(adv_filter_list);
|
||||
btc_adv_list_unlock();
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
void btc_adv_list_refresh(void)
|
||||
{
|
||||
if(!adv_filter_list) {
|
||||
BTC_TRACE_ERROR("%s adv_filter_list is NULL", __func__);
|
||||
return ;
|
||||
}
|
||||
btc_adv_list_lock();
|
||||
list_clear(adv_filter_list);
|
||||
btc_adv_list_unlock();
|
||||
}
|
||||
|
||||
bool btc_check_adv_list(uint8_t * addr, uint8_t addr_type)
|
||||
{
|
||||
bool found = false;
|
||||
if(!adv_filter_list || !addr) {
|
||||
BTC_TRACE_ERROR("%s adv_filter_list is NULL", __func__);
|
||||
return found;
|
||||
}
|
||||
|
||||
btc_adv_list_lock();
|
||||
for (const list_node_t *node = list_begin(adv_filter_list); node != list_end(adv_filter_list); node = list_next(node)) {
|
||||
btc_adv_packet_t *packet = (btc_adv_packet_t *)list_node(node);
|
||||
if(!bdcmp(addr, packet->addr) && packet->addr_type == addr_type) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
btc_adv_list_unlock();
|
||||
if(!found) {
|
||||
btc_adv_packet_t *adv_packet = osi_malloc(sizeof(btc_adv_packet_t));
|
||||
if(adv_packet) {
|
||||
adv_packet->addr_type = addr_type;
|
||||
bdcpy(adv_packet->addr, addr);
|
||||
btc_adv_list_add_packet(adv_packet);
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s adv_packet malloc failed", __func__);
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
void btc_adv_list_lock(void)
|
||||
{
|
||||
osi_mutex_lock(&adv_list_lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||
}
|
||||
|
||||
void btc_adv_list_unlock(void)
|
||||
{
|
||||
osi_mutex_unlock(&adv_list_lock);
|
||||
}
|
||||
#endif
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
@ -320,14 +320,6 @@
|
||||
#define UC_BT_BLE_ESTAB_LINK_CONN_TOUT 30
|
||||
#endif
|
||||
|
||||
|
||||
//HOST QUEUE CONGEST CHECK
|
||||
#ifdef CONFIG_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
|
||||
#define UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK CONFIG_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
|
||||
#else
|
||||
#define UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_GATTS_PPCP_CHAR_GAP
|
||||
#define UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP CONFIG_BT_GATTS_PPCP_CHAR_GAP
|
||||
#else
|
||||
|
@ -540,12 +540,6 @@
|
||||
#define BTA_AV_CO_CP_SCMS_T FALSE
|
||||
#endif
|
||||
|
||||
#if UC_BT_BLE_HOST_QUEUE_CONGESTION_CHECK
|
||||
#define SCAN_QUEUE_CONGEST_CHECK TRUE
|
||||
#else
|
||||
#define SCAN_QUEUE_CONGEST_CHECK FALSE
|
||||
#endif
|
||||
|
||||
#ifdef UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
|
||||
#define BTM_PERIPHERAL_ENABLED UC_CONFIG_BT_GATTS_PPCP_CHAR_GAP
|
||||
#endif
|
||||
|
@ -52,9 +52,6 @@
|
||||
#define HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX (200)
|
||||
#endif
|
||||
|
||||
extern bool BTU_check_queue_is_congest(void);
|
||||
|
||||
|
||||
static const uint8_t preamble_sizes[] = {
|
||||
HCI_COMMAND_PREAMBLE_SIZE,
|
||||
HCI_ACL_PREAMBLE_SIZE,
|
||||
@ -511,13 +508,6 @@ static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt)
|
||||
goto _discard_packet;
|
||||
}
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
if(BTU_check_queue_is_congest()) {
|
||||
HCI_TRACE_DEBUG("BtuQueue is congested");
|
||||
goto _discard_packet;
|
||||
}
|
||||
#endif
|
||||
|
||||
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
|
||||
hci_hal_env.callbacks->adv_rpt_ready(linked_pkt);
|
||||
|
||||
|
@ -254,17 +254,6 @@ UINT16 BTU_BleAclPktSize(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
bool BTU_check_queue_is_congest(void)
|
||||
{
|
||||
if (osi_thread_queue_wait_size(btu_thread, 0) >= BT_QUEUE_CONGEST_SIZE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
int get_btu_work_queue_size(void)
|
||||
{
|
||||
return osi_thread_queue_wait_size(btu_thread, 0);
|
||||
|
@ -220,7 +220,6 @@ CONFIG_BLUFI_TRACE_LEVEL_EVENT CONFIG_BT_LOG_BLUFI_
|
||||
CONFIG_BLUFI_TRACE_LEVEL_DEBUG CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_DEBUG
|
||||
CONFIG_BLUFI_TRACE_LEVEL_VERBOSE CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_VERBOSE
|
||||
|
||||
CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK CONFIG_BT_BLE_HOST_QUEUE_CONG_CHECK
|
||||
CONFIG_SMP_ENABLE CONFIG_BT_SMP_ENABLE
|
||||
CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY CONFIG_BT_BLE_ACT_SCAN_REP_ADV_SCAN
|
||||
CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT CONFIG_BT_BLE_ESTAB_LINK_CONN_TOUT
|
||||
|
Loading…
x
Reference in New Issue
Block a user