]> granicus.if.org Git - esp-idf/commitdiff
Coexist: fix some coexist bugs
authorXia Xiaotian <xiaxiaotian@espressif.com>
Thu, 12 Sep 2019 06:12:13 +0000 (14:12 +0800)
committerXia Xiaotian <xiaxiaotian@espressif.com>
Mon, 30 Sep 2019 03:49:16 +0000 (11:49 +0800)
1. Fix high beacon and broadcast packets loss ratio of WiFi to make
   MDNS test pass.
2. Improve stability of WiFi performance with a little
   sacrifice of throughput.
3. Improve BLE advertising and connection performance with dynamic
   priority. It sacrifices a little WiFi throughput, but achieves balance
   between WiFi and Bluetooth.

components/bt/Kconfig
components/bt/controller/bt.c
components/bt/controller/lib
components/esp32/esp_adapter.c
components/esp_wifi/include/esp_coexist_internal.h
components/esp_wifi/include/esp_private/wifi_os_adapter.h
components/esp_wifi/lib_esp32

index a1ab51c7496b470dbc6381f25b786168280d853f..6d340656b2f150f5bc8aa96a2608257dd34c251f 100644 (file)
@@ -358,6 +358,21 @@ menu "Bluetooth"
                 If you set `BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
                 may cause adv packets lost more.
 
+        menuconfig BTDM_COEX_BT_OPTIONS
+            bool "Coexistence Bluetooth Side Options"
+            depends on ESP32_WIFI_SW_COEXIST_ENABLE
+            default n
+            help
+                Options of Bluetooth Side of WiFi and bluetooth coexistence.
+
+        config BTDM_COEX_BLE_ADV_HIGH_PRIORITY
+            bool "Improve BLE ADV priority for WiFi & BLE coexistence"
+            depends on BTDM_COEX_BT_OPTIONS
+            default n
+            help
+                Improve BLE ADV coexistence priority to make it better performance.
+                For example, BLE mesh need to enable this option to improve BLE adv performance.
+
     endmenu
 
     choice BT_HOST
index 0b29e506e49f41096b222777498dcf017d65d847..81442d22738ba4dbe0f5bae36c3c2e5aae8a02bd 100644 (file)
@@ -226,6 +226,7 @@ extern int coex_bt_release_wrapper(uint32_t event);
 extern int coex_register_bt_cb_wrapper(coex_func_cb_t cb);
 extern uint32_t coex_bb_reset_lock_wrapper(void);
 extern void coex_bb_reset_unlock_wrapper(uint32_t restore);
+extern void coex_ble_adv_priority_high_set(bool high);
 
 extern char _bss_start_btdm;
 extern char _bss_end_btdm;
@@ -1195,6 +1196,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
         goto error;
     }
 
+    #ifdef CONFIG_BTDM_COEX_BLE_ADV_HIGH_PRIORITY
+        coex_ble_adv_priority_high_set(true);
+    #else
+        coex_ble_adv_priority_high_set(false);
+    #endif
+
     btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
 
     return ESP_OK;
index 484307604fad19b82afca4ff2e57fda63158c2b4..aaadbf2c26002ae85c175cb0e469a3b0bf57bf02 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 484307604fad19b82afca4ff2e57fda63158c2b4
+Subproject commit aaadbf2c26002ae85c175cb0e469a3b0bf57bf02
index 4fdd5ce65eb9cdcfdb666f5df2f2e93d69586c95..0e8ec3be7bfa1b739469a0c5a32c7aeda175f5dc 100644 (file)
@@ -440,6 +440,13 @@ static uint32_t coex_status_get_wrapper(void)
 #endif
 }
 
+static void coex_condition_set_wrapper(uint32_t type, bool dissatisfy)
+{
+#if CONFIG_SW_COEXIST_ENABLE
+    coex_condition_set(type, dissatisfy);
+#endif
+}
+
 static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration)
 {
 #if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE
@@ -591,6 +598,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
     ._modem_sleep_register = esp_modem_sleep_register,
     ._modem_sleep_deregister = esp_modem_sleep_deregister,
     ._coex_status_get = coex_status_get_wrapper,
+    ._coex_condition_set = coex_condition_set_wrapper,
     ._coex_wifi_request = coex_wifi_request_wrapper,
     ._coex_wifi_release = coex_wifi_release_wrapper,
     ._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
index 1d94d6db79606d63d1db4a9a3fbc195c92ef3039..63f35666d3139cb262e1df3623e6a1fc9ce718b9 100644 (file)
@@ -79,6 +79,12 @@ esp_err_t coex_preference_set(coex_prefer_t prefer);
  */
 uint32_t coex_status_get(void);
 
+/**
+ * @brief Set software coexist condition.
+ * @return : software coexist condition
+ */
+void coex_condition_set(uint32_t type, bool dissatisfy);
+
 /**
  * @brief WiFi requests coexistence.
  *
index 912ec3a5377b318504bd0104e6e066b2b9b61fbc..89422c51c610a0091ad3865ee2a3b0bdbd48f6fd 100644 (file)
@@ -21,7 +21,7 @@
 extern "C" {
 #endif
 
-#define ESP_WIFI_OS_ADAPTER_VERSION  0x00000003
+#define ESP_WIFI_OS_ADAPTER_VERSION  0x00000004
 #define ESP_WIFI_OS_ADAPTER_MAGIC    0xDEADBEAF
 
 #define OSI_FUNCS_TIME_BLOCKING      0xffffffff
@@ -120,6 +120,7 @@ typedef struct {
     int32_t (* _modem_sleep_register)(uint32_t module);
     int32_t (* _modem_sleep_deregister)(uint32_t module);
     uint32_t (* _coex_status_get)(void);
+    void (* _coex_condition_set)(uint32_t type, bool dissatisfy);
     int32_t (* _coex_wifi_request)(uint32_t event, uint32_t latency, uint32_t duration);
     int32_t (* _coex_wifi_release)(uint32_t event);
     int32_t _magic;
index 555fb8b49d1f86da767353ec800e65c6148eae78..1266a879ba57e17c3d55a247b2a95bb9c4217505 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 555fb8b49d1f86da767353ec800e65c6148eae78
+Subproject commit 1266a879ba57e17c3d55a247b2a95bb9c4217505