mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/esp_wifi: improve coexistence performance according to specific WiFi/BT/BLE scienario
1. Improve WiFi throughput in some Classic BT scienarios(idle, inquire scan, connected, sniff, a2dp pause, etc). 2. Support WiFi + Classic BT + BLE mesh coexistence scienario. 3. Improve WiFi scan and connect succeed ratio in coexistence scienario. 4. Do not support to choose software coexistence preference anymore for it is determined according to coexistence scienario automatically. components/lwip: increase TCP send buffer and receive window limitation when TCP window scale is enabled components/ble_mesh: Fix some bugs about ble mesh 1. fix send acl pkt after ble have sent terminate ind modify min adv interval to 10ms.
This commit is contained in:
parent
c7738f24fc
commit
a2398f0dcc
@ -333,8 +333,8 @@ menu "Bluetooth"
|
|||||||
|
|
||||||
config BTDM_CTRL_FULL_SCAN_SUPPORTED
|
config BTDM_CTRL_FULL_SCAN_SUPPORTED
|
||||||
bool "BLE full scan feature supported"
|
bool "BLE full scan feature supported"
|
||||||
depends on BTDM_CTRL_MODE_BLE_ONLY
|
depends on BTDM_CONTROLLER_MODE_BLE_ONLY || BTDM_CONTROLLER_MODE_BTDM
|
||||||
default n
|
default y
|
||||||
help
|
help
|
||||||
The full scan function is mainly used to provide BLE scan performance.
|
The full scan function is mainly used to provide BLE scan performance.
|
||||||
This is required for scenes with high scan performance requirements, such as BLE Mesh scenes.
|
This is required for scenes with high scan performance requirements, such as BLE Mesh scenes.
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 0a707c811ee824c9777b8712d2edf979fa8d2a2e
|
Subproject commit e9b76dc715a2ab326633517c368ab0776c9a18e9
|
@ -41,6 +41,7 @@
|
|||||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||||
#include "bta/bta_ar_api.h"
|
#include "bta/bta_ar_api.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "bta/bta_api.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** Constants
|
** Constants
|
||||||
@ -508,8 +509,21 @@ static void bta_av_proc_stream_evt(UINT8 handle, BD_ADDR bd_addr, UINT8 event, t
|
|||||||
/* look up application event */
|
/* look up application event */
|
||||||
if ((p_data == NULL) || (p_data->hdr.err_code == 0)) {
|
if ((p_data == NULL) || (p_data->hdr.err_code == 0)) {
|
||||||
p_msg->hdr.event = bta_av_stream_evt_ok[event];
|
p_msg->hdr.event = bta_av_stream_evt_ok[event];
|
||||||
|
if (p_msg->hdr.event == BTA_AV_STR_START_OK_EVT) {
|
||||||
|
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STARTED);
|
||||||
|
} else if (p_msg->hdr.event == BTA_AV_STR_START_FAIL_EVT ||
|
||||||
|
p_msg->hdr.event == BTA_AV_STR_SUSPEND_CFM_EVT ||
|
||||||
|
p_msg->hdr.event == BTA_AV_STR_CLOSE_EVT) {
|
||||||
|
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STOPPED);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
p_msg->hdr.event = bta_av_stream_evt_fail[event];
|
p_msg->hdr.event = bta_av_stream_evt_fail[event];
|
||||||
|
if (p_msg->hdr.event == BTA_AV_STR_START_FAIL_EVT ||
|
||||||
|
p_msg->hdr.event == BTA_AV_STR_START_OK_EVT ||
|
||||||
|
p_msg->hdr.event == BTA_AV_STR_SUSPEND_CFM_EVT ||
|
||||||
|
p_msg->hdr.event == BTA_AV_STR_CLOSE_EVT) {
|
||||||
|
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STOPPED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p_msg->initiator = FALSE;
|
p_msg->initiator = FALSE;
|
||||||
|
@ -3290,6 +3290,7 @@ static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data)
|
|||||||
p_msg->transport = p_data->conn.transport;
|
p_msg->transport = p_data->conn.transport;
|
||||||
p_msg->handle = p_data->conn.handle;
|
p_msg->handle = p_data->conn.handle;
|
||||||
#endif
|
#endif
|
||||||
|
BTA_DmCoexEventTrigger(BTA_COEX_EVT_ACL_CONNECTED);
|
||||||
break;
|
break;
|
||||||
case BTM_BL_DISCN_EVT:
|
case BTM_BL_DISCN_EVT:
|
||||||
bdcpy(p_msg->bd_addr, p_data->discn.p_bda);
|
bdcpy(p_msg->bd_addr, p_data->discn.p_bda);
|
||||||
@ -3297,6 +3298,7 @@ static void bta_dm_bl_change_cback (tBTM_BL_EVENT_DATA *p_data)
|
|||||||
p_msg->transport = p_data->discn.transport;
|
p_msg->transport = p_data->discn.transport;
|
||||||
p_msg->handle = p_data->discn.handle;
|
p_msg->handle = p_data->discn.handle;
|
||||||
#endif
|
#endif
|
||||||
|
BTA_DmCoexEventTrigger(BTA_COEX_EVT_ACL_DISCONNECTED);
|
||||||
break;
|
break;
|
||||||
case BTM_BL_UPDATE_EVT:
|
case BTM_BL_UPDATE_EVT:
|
||||||
p_msg->busy_level = p_data->update.busy_level;
|
p_msg->busy_level = p_data->update.busy_level;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "osi/allocator.h"
|
#include "osi/allocator.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "esp_coexist.h"
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** Constants and types
|
** Constants and types
|
||||||
@ -407,6 +408,37 @@ BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BTA_DmCoexEventTrigger(uint32_t event)
|
||||||
|
{
|
||||||
|
switch(event) {
|
||||||
|
case BTA_COEX_EVT_SCAN_STARTED:
|
||||||
|
case BTA_COEX_EVT_SCAN_STOPPED:
|
||||||
|
case BTA_COEX_EVT_SNIFF_ENTER:
|
||||||
|
case BTA_COEX_EVT_SNIFF_EXIT:
|
||||||
|
case BTA_COEX_EVT_A2DP_PAUSED_ENTER:
|
||||||
|
case BTA_COEX_EVT_A2DP_PAUSED_EXIT:
|
||||||
|
break;
|
||||||
|
case BTA_COEX_EVT_ACL_CONNECTED:
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
|
||||||
|
break;
|
||||||
|
case BTA_COEX_EVT_ACL_DISCONNECTED:
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
|
||||||
|
break;
|
||||||
|
case BTA_COEX_EVT_STREAMING_STARTED:
|
||||||
|
esp_coex_status_bit_set(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
|
||||||
|
break;
|
||||||
|
case BTA_COEX_EVT_STREAMING_STOPPED:
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
|
||||||
|
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function bta_dm_sm_search_disable
|
** Function bta_dm_sm_search_disable
|
||||||
|
@ -2683,9 +2683,23 @@ extern void BTA_VendorInit (void);
|
|||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
extern void BTA_VendorCleanup (void);
|
extern void BTA_VendorCleanup (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum {
|
||||||
|
BTA_COEX_EVT_SCAN_STARTED = 1,
|
||||||
|
BTA_COEX_EVT_SCAN_STOPPED,
|
||||||
|
BTA_COEX_EVT_ACL_CONNECTED,
|
||||||
|
BTA_COEX_EVT_ACL_DISCONNECTED,
|
||||||
|
BTA_COEX_EVT_STREAMING_STARTED,
|
||||||
|
BTA_COEX_EVT_STREAMING_STOPPED,
|
||||||
|
BTA_COEX_EVT_SNIFF_ENTER,
|
||||||
|
BTA_COEX_EVT_SNIFF_EXIT,
|
||||||
|
BTA_COEX_EVT_A2DP_PAUSED_ENTER,
|
||||||
|
BTA_COEX_EVT_A2DP_PAUSED_EXIT,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void BTA_DmCoexEventTrigger(uint32_t event);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "osi/fixed_queue.h"
|
#include "osi/fixed_queue.h"
|
||||||
|
|
||||||
#define HCI_HOST_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
#define HCI_HOST_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
|
||||||
#define HCI_HOST_TASK_STACK_SIZE (2048 + BT_TASK_EXTRA_STACK_SIZE)
|
#define HCI_HOST_TASK_STACK_SIZE (4096 + BT_TASK_EXTRA_STACK_SIZE)
|
||||||
#define HCI_HOST_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 3)
|
#define HCI_HOST_TASK_PRIO (BT_TASK_MAX_PRIORITIES - 3)
|
||||||
#define HCI_HOST_TASK_NAME "hciT"
|
#define HCI_HOST_TASK_NAME "hciT"
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ typedef UINT8 tBTM_BLE_SFP;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* adv parameter boundary values */
|
/* adv parameter boundary values */
|
||||||
#define BTM_BLE_ADV_INT_MIN 0x0020
|
#define BTM_BLE_ADV_INT_MIN 0x0010
|
||||||
#define BTM_BLE_ADV_INT_MAX 0x4000
|
#define BTM_BLE_ADV_INT_MAX 0x4000
|
||||||
|
|
||||||
/* Full scan boundary values */
|
/* Full scan boundary values */
|
||||||
|
@ -12,37 +12,6 @@ menu "Wi-Fi"
|
|||||||
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
|
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
|
||||||
size.
|
size.
|
||||||
|
|
||||||
choice ESP32_WIFI_SW_COEXIST_PREFERENCE
|
|
||||||
prompt "WiFi/Bluetooth coexistence performance preference"
|
|
||||||
depends on ESP32_WIFI_SW_COEXIST_ENABLE
|
|
||||||
default ESP32_WIFI_SW_COEXIST_PREFERENCE_BALANCE
|
|
||||||
help
|
|
||||||
Choose Bluetooth/WiFi/Balance for different preference.
|
|
||||||
If choose WiFi, it will make WiFi performance better. Such, keep WiFi Audio more fluent.
|
|
||||||
If choose Bluetooth, it will make Bluetooth performance better. Such, keep Bluetooth(A2DP) Audio more
|
|
||||||
fluent.
|
|
||||||
If choose Balance, the performance of WiFi and bluetooth will be balance. It's default. Normally, just
|
|
||||||
choose balance, the A2DP audio can play fluently, too.
|
|
||||||
Except config preference in menuconfig, you can also call esp_coex_preference_set() dynamically.
|
|
||||||
|
|
||||||
config ESP32_WIFI_SW_COEXIST_PREFERENCE_WIFI
|
|
||||||
bool "WiFi"
|
|
||||||
|
|
||||||
config ESP32_WIFI_SW_COEXIST_PREFERENCE_BT
|
|
||||||
bool "Bluetooth(include BR/EDR and BLE)"
|
|
||||||
|
|
||||||
config ESP32_WIFI_SW_COEXIST_PREFERENCE_BALANCE
|
|
||||||
bool "Balance"
|
|
||||||
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
config ESP32_WIFI_SW_COEXIST_PREFERENCE_VALUE
|
|
||||||
int
|
|
||||||
depends on ESP32_WIFI_SW_COEXIST_ENABLE
|
|
||||||
default 0 if ESP32_WIFI_SW_COEXIST_PREFERENCE_WIFI
|
|
||||||
default 1 if ESP32_WIFI_SW_COEXIST_PREFERENCE_BT
|
|
||||||
default 2 if ESP32_WIFI_SW_COEXIST_PREFERENCE_BALANCE
|
|
||||||
|
|
||||||
config ESP32_WIFI_STATIC_RX_BUFFER_NUM
|
config ESP32_WIFI_STATIC_RX_BUFFER_NUM
|
||||||
int "Max number of WiFi static RX buffers"
|
int "Max number of WiFi static RX buffers"
|
||||||
range 2 25 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
range 2 25 if !SPIRAM_TRY_ALLOCATE_WIFI_LWIP
|
||||||
|
@ -32,6 +32,22 @@ typedef enum {
|
|||||||
ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */
|
ESP_COEX_PREFER_NUM, /*!< Prefer value numbers */
|
||||||
} esp_coex_prefer_t;
|
} esp_coex_prefer_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief coex status type
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
ESP_COEX_ST_TYPE_WIFI = 0,
|
||||||
|
ESP_COEX_ST_TYPE_BLE,
|
||||||
|
ESP_COEX_ST_TYPE_BT,
|
||||||
|
} esp_coex_status_type_t;
|
||||||
|
|
||||||
|
#define ESP_COEX_BLE_ST_MESH_CONFIG 0x08
|
||||||
|
#define ESP_COEX_BLE_ST_MESH_TRAFFIC 0x10
|
||||||
|
#define ESP_COEX_BLE_ST_MESH_STANDBY 0x20
|
||||||
|
|
||||||
|
#define ESP_COEX_BT_ST_A2DP_STREAMING 0x10
|
||||||
|
#define ESP_COEX_BT_ST_A2DP_PAUSED 0x20
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get software coexist version string
|
* @brief Get software coexist version string
|
||||||
*
|
*
|
||||||
@ -40,7 +56,8 @@ typedef enum {
|
|||||||
const char *esp_coex_version_get(void);
|
const char *esp_coex_version_get(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set coexist preference of performance
|
* @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead.
|
||||||
|
* Set coexist preference of performance
|
||||||
* For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt)
|
* For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt)
|
||||||
* more smooth while wifi is runnning something.
|
* more smooth while wifi is runnning something.
|
||||||
* If prefer to wifi, it will do similar things as prefer to bluetooth.
|
* If prefer to wifi, it will do similar things as prefer to bluetooth.
|
||||||
@ -51,6 +68,23 @@ const char *esp_coex_version_get(void);
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer);
|
esp_err_t esp_coex_preference_set(esp_coex_prefer_t prefer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set coex schm status
|
||||||
|
* @param type : WIFI/BLE/BT
|
||||||
|
* @param status : WIFI/BLE/BT STATUS
|
||||||
|
* @return : ESP_OK - success, other - failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_coex_status_bit_set(esp_coex_status_type_t type, uint32_t status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear coex schm status
|
||||||
|
* @param type : WIFI/BLE/BT
|
||||||
|
* @param status : WIFI/BLE/BT STATUS
|
||||||
|
* @return : ESP_OK - success, other - failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_coex_status_bit_clear(esp_coex_status_type_t type, uint32_t status);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 8944eec56a5337e62a08b8f5001f2df9d92704b6
|
Subproject commit 8e75d9c8e4ac78dab8efecbdf4e6104f66bb75b9
|
@ -2,8 +2,3 @@
|
|||||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||||
|
|
||||||
CONFIG_SW_COEXIST_ENABLE CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE
|
CONFIG_SW_COEXIST_ENABLE CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE
|
||||||
CONFIG_SW_COEXIST_PREFERENCE CONFIG_ESP32_WIFI_SW_COEXIST_PREFERENCE
|
|
||||||
CONFIG_SW_COEXIST_PREFERENCE_WIFI CONFIG_ESP32_WIFI_SW_COEXIST_PREFERENCE_WIFI
|
|
||||||
CONFIG_SW_COEXIST_PREFERENCE_BT CONFIG_ESP32_WIFI_SW_COEXIST_PREFERENCE_BT
|
|
||||||
CONFIG_SW_COEXIST_PREFERENCE_BALANCE CONFIG_ESP32_WIFI_SW_COEXIST_PREFERENCE_BALANCE
|
|
||||||
CONFIG_SW_COEXIST_PREFERENCE_VALUE CONFIG_ESP32_WIFI_SW_COEXIST_PREFERENCE_VALUE
|
|
||||||
|
@ -267,7 +267,6 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat
|
|||||||
uint32_t phy_bt_wifi_mask = BIT(PHY_BT_MODULE) | BIT(PHY_WIFI_MODULE);
|
uint32_t phy_bt_wifi_mask = BIT(PHY_BT_MODULE) | BIT(PHY_WIFI_MODULE);
|
||||||
if ((s_module_phy_rf_init & phy_bt_wifi_mask) == phy_bt_wifi_mask) { //both wifi & bt enabled
|
if ((s_module_phy_rf_init & phy_bt_wifi_mask) == phy_bt_wifi_mask) { //both wifi & bt enabled
|
||||||
coex_init();
|
coex_init();
|
||||||
coex_preference_set(CONFIG_ESP32_WIFI_SW_COEXIST_PREFERENCE_VALUE);
|
|
||||||
coex_resume();
|
coex_resume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,8 @@ menu "LWIP"
|
|||||||
config LWIP_TCP_SND_BUF_DEFAULT
|
config LWIP_TCP_SND_BUF_DEFAULT
|
||||||
int "Default send buffer size"
|
int "Default send buffer size"
|
||||||
default 5744 # 4 * default MSS
|
default 5744 # 4 * default MSS
|
||||||
range 2440 65535
|
range 2440 65535 if !LWIP_WND_SCALE
|
||||||
|
range 2440 1024000 if LWIP_WND_SCALE
|
||||||
help
|
help
|
||||||
Set default send buffer size for new TCP sockets.
|
Set default send buffer size for new TCP sockets.
|
||||||
|
|
||||||
@ -360,7 +361,8 @@ menu "LWIP"
|
|||||||
config LWIP_TCP_WND_DEFAULT
|
config LWIP_TCP_WND_DEFAULT
|
||||||
int "Default receive window size"
|
int "Default receive window size"
|
||||||
default 5744 # 4 * default MSS
|
default 5744 # 4 * default MSS
|
||||||
range 2440 65535
|
range 2440 65535 if !LWIP_WND_SCALE
|
||||||
|
range 2440 1024000 if LWIP_WND_SCALE
|
||||||
help
|
help
|
||||||
Set default TCP receive window size for new TCP sockets.
|
Set default TCP receive window size for new TCP sockets.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user