Merge branch 'bugfix/backport_some_wifi_fixes_v5.4' into 'release/v5.4'

fix(wifi): backport some wifi fixes to v5.4

See merge request espressif/esp-idf!34690
This commit is contained in:
Jiang Jiang Jian 2024-11-09 00:33:43 +08:00
commit 3b0cf1a2ea
19 changed files with 130 additions and 39 deletions

@ -1 +1 @@
Subproject commit 8fd02ff780e977e76e7ed78619629c8344f0fc50
Subproject commit f5f852b53c90c2a23bfbd6b9c4897c25f0ae6155

View File

@ -284,10 +284,14 @@ phy_wifi_set_tx_gain = 0x400014f4;
phy_bt_get_tx_tab_ = 0x400014f8;
phy_bt_set_tx_gain = 0x400014fc;
phy_bt_tx_gain_init = 0x40001500;
phy_pbus_xpd_rx_off = 0x40002518;
phy_i2c_writeReg_Mask = 0x4000787e;
phy_pbus_xpd_rx_on = 0x40002628;
phy_pbus_xpd_tx_on = 0x4000274c;
phy_pbus_xpd_rx_off = 0x40001528;
phy_i2c_writeReg_Mask = 0x4000152c;
phy_pbus_xpd_rx_on = 0x40001530;
phy_pbus_xpd_tx_on = 0x40001534;
phy_get_romfuncs = 0x40001538;
phy_chip_set_chan_ana_ = 0x4000153c;
phy_pbus_xpd_tx_off = 0x40001540;
/* Data (.data, .bss, .rodata) */
phy_rom_phyFuns = 0x4085fb80;
phy_param_rom = 0x4085fc70;
phy_rom_phyFuns_eco1 = 0x4085fc6c;

View File

@ -32,7 +32,7 @@ hal_mac_tx_clr_mplen = 0x40000c10;
hal_mac_get_txq_state = 0x40000c14;
hal_mac_clr_txq_state = 0x40000c18;
hal_mac_get_txq_complete = 0x40000c1c;
/*hal_mac_deinit_twt_tx = 0x40000c20;*/
hal_mac_deinit_twt_tx = 0x40000c20;
hal_mac_is_dma_enable = 0x40000c24;
/*hal_he_get_bss_color = 0x40000c28;*/
hal_he_set_ersu = 0x40000c2c;
@ -62,7 +62,7 @@ ic_get_he_rts_threshold_bytes = 0x40000c88;
lmacAdjustTimestamp = 0x40000c8c;
lmacDiscardAgedMSDU = 0x40000c90;
lmacDiscardMSDU = 0x40000c94;
/*lmacEndFrameExchangeSequence = 0x40000c98;*/
lmacEndFrameExchangeSequence = 0x40000c98;
lmacIsIdle = 0x40000c9c;
lmacIsLongFrame = 0x40000ca0;
lmacMSDUAged = 0x40000ca4;
@ -74,19 +74,19 @@ lmacReachLongLimit = 0x40000cb8;
lmacReachShortLimit = 0x40000cbc;
lmacRecycleMPDU = 0x40000cc0;
lmacRxDone = 0x40000cc4;
/*lmacSetTxFrame = 0x40000cc8;*/
lmacSetTxFrame = 0x40000cc8;
lmacTxDone = 0x40000ccc;
lmacTxFrame = 0x40000cd0;
lmacDisableTransmit = 0x40000cd4;
lmacDiscardFrameExchangeSequence = 0x40000cd8;
lmacProcessCollision = 0x40000cdc;
lmacProcessAckTimeout = 0x40000ce0;
/*lmacProcessShortRetryFail = 0x40000ce4;*/
lmacProcessShortRetryFail = 0x40000ce4;
lmacProcessCollisions_task = 0x40000ce8;
lmacProcessTxRtsError = 0x40000cec;
lmacProcessTxError = 0x40000cf0;
lmacProcessCtsTimeout = 0x40000cf4;
/*lmacProcessLongRetryFail = 0x40000cf8;*/
lmacProcessLongRetryFail = 0x40000cf8;
lmacRetryTxFrame = 0x40000cfc;
lmacEndRetryAMPDUFail = 0x40000d00;
lmacProcessTxSuccess = 0x40000d04;
@ -112,7 +112,7 @@ pm_disable_sleep_delay_timer = 0x40000d50;
/*pm_dream = 0x40000d54;*/
pm_mac_wakeup = 0x40000d58;
pm_mac_sleep = 0x40000d5c;
pm_enable_active_timer = 0x40000d60;
/*pm_enable_active_timer = 0x40000d60;*/
pm_enable_sleep_delay_timer = 0x40000d64;
pm_local_tsf_process = 0x40000d68;
pm_set_beacon_filter = 0x40000d6c;
@ -145,13 +145,13 @@ pm_disconnected_wake = 0x40000dd4;
/*pm_tx_data_process = 0x40000dd8;*/
pm_is_twt_awake = 0x40000ddc;
pm_enable_twt_keep_alive = 0x40000de0;
/*pm_twt_on_tsf_timer = 0x40000de4;*/
pm_twt_on_tsf_timer = 0x40000de4;
pm_twt_process = 0x40000de8;
pm_is_twt_start = 0x40000dec;
pm_twt_set_target_wdev_time = 0x40000df0;
pm_twt_set_target_tsf = 0x40000df4;
pm_enable_twt_keep_alive_timer = 0x40000df8;
/*pm_mac_try_enable_modem_state = 0x40000dfc;*/
pm_mac_try_enable_modem_state = 0x40000dfc;
pm_beacon_monitor_tbtt_timeout_process = 0x40000e00;
/*pm_update_next_tbtt = 0x40000e04;*/
pm_twt_disallow_tx = 0x40000e08;
@ -209,11 +209,11 @@ ppDisableQueue = 0x40000ed4;
ppCalVHTDeliNum = 0x40000ed8;
ppCalTxVHTSMPDULength = 0x40000edc;
ppCheckTxRTS = 0x40000ee0;
/*ppProcessLifeTime = 0x40000ee4;*/
ppProcessLifeTime = 0x40000ee4;
ppProcTxCallback = 0x40000ee8;
ppCalPreFecPaddingFactor = 0x40000eec;
ppCalDeliNum = 0x40000ef0;
/*ppRemoveHTC = 0x40000ef4;*/
ppRemoveHTC = 0x40000ef4;
ppCheckTxHEAMPDUlength = 0x40000ef8;
ppCertSetRate = 0x40000efc;
ppSelectTxFormat = 0x40000f00;
@ -260,7 +260,7 @@ trcAmpduSetState = 0x40000fa0;
trc_set_bf_report_rate = 0x40000fa4;
trc_onPPTxDone = 0x40000fa8;
wDevCheckBlockError = 0x40000fac;
/*wDev_AppendRxBlocks = 0x40000fb0;*/
wDev_AppendRxBlocks = 0x40000fb0;
wDev_DiscardFrame = 0x40000fb4;
wDev_GetNoiseFloor = 0x40000fb8;
wDev_IndicateAmpdu = 0x40000fbc;
@ -335,6 +335,12 @@ is_use_muedca = 0x400010cc;
pwr_hal_clear_mac_modem_state_wakeup_protect_signal = 0x400010d0;
get_estimated_batime = 0x400010d4;
get_sublen_offset = 0x400010d8;
pm_coex_schm_overall_period_get = 0x40001504;
ppRemoveHEAMPDUflags = 0x4000150c;
tsf_hal_get_tbtt_interval = 0x40001510;
pm_get_tbtt_count = 0x4000151c;
tsf_hal_get_time = 0x40001520;
tsf_hal_get_counter_value = 0x40001524;
/* Data (.data, .bss, .rodata) */
our_instances_ptr = 0x4004ffe0;
pTxRx = 0x4085ff74;

View File

@ -113,7 +113,7 @@ pm_disable_sleep_delay_timer = 0x40000cbc;
pm_dream = 0x40000cc0;
pm_mac_wakeup = 0x40000cc4;
pm_mac_sleep = 0x40000cc8;
pm_enable_active_timer = 0x40000ccc;
/*pm_enable_active_timer = 0x40000ccc;*/
pm_enable_sleep_delay_timer = 0x40000cd0;
pm_local_tsf_process = 0x40000cd4;
pm_set_beacon_filter = 0x40000cd8;

View File

@ -224,10 +224,10 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
#define WIFI_ENABLE_WPA3_SAE 0
#endif
#if CONFIG_SPIRAM
#define WIFI_ENABLE_SPIRAM (1<<1)
#if WIFI_CACHE_TX_BUFFER_NUM > 0
#define WIFI_ENABLE_CACHE_TX_BUFFER (1<<1)
#else
#define WIFI_ENABLE_SPIRAM 0
#define WIFI_ENABLE_CACHE_TX_BUFFER 0
#endif
#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT
@ -289,7 +289,7 @@ extern wifi_osi_funcs_t g_wifi_osi_funcs;
/* Set additional WiFi features and capabilities */
#define WIFI_FEATURE_CAPS (WIFI_ENABLE_WPA3_SAE | \
WIFI_ENABLE_SPIRAM | \
WIFI_ENABLE_CACHE_TX_BUFFER | \
WIFI_FTM_INITIATOR | \
WIFI_FTM_RESPONDER | \
WIFI_ENABLE_GCMP | \

View File

@ -406,6 +406,7 @@ typedef enum {
/** Argument structure for twt configuration */
typedef struct {
bool post_wakeup_event; /**< post twt wakeup event */
bool twt_enable_keep_alive; /**< twt enable send qos null to keep alive */
} wifi_twt_config_t;
/** Argument structure for WIFI_EVENT_TWT_WAKEUP event */

View File

@ -269,6 +269,19 @@ typedef enum {
WIFI_CIPHER_TYPE_UNKNOWN, /**< The cipher type is unknown */
} wifi_cipher_type_t;
/**
* @brief Wi-Fi bandwidth type
*/
typedef enum {
WIFI_BW_HT20 = 1, /**< Bandwidth is HT20 */
WIFI_BW20 = WIFI_BW_HT20, /**< Bandwidth is 20 MHz */
WIFI_BW_HT40 = 2, /**< Bandwidth is HT40 */
WIFI_BW40 = WIFI_BW_HT40, /**< Bandwidth is 40 MHz */
WIFI_BW80 = 3, /**< Bandwidth is 80 MHz */
WIFI_BW160 = 4, /**< Bandwidth is 160 MHz */
WIFI_BW80_BW80 = 5, /**< Bandwidth is 80 + 80 MHz */
} wifi_bandwidth_t;
/**
* @brief Wi-Fi antenna
*/
@ -314,9 +327,7 @@ typedef struct {
uint32_t reserved: 22; /**< Bit: 10..31 reserved */
wifi_country_t country; /**< Country information of AP */
wifi_he_ap_info_t he_ap; /**< HE AP info */
uint8_t bandwidth; /**< For either 20 MHz or 40 MHz operation, the channel width field is set to 0.
For AP 80 MHz, this value is set to 1. For AP 160 MHz, this value is set to 2.
For AP 80 + 80 MHz, this value is set to 3.*/
wifi_bandwidth_t bandwidth; /**< Bandwidth of AP */
uint8_t vht_ch_freq1; /**< This fields are used only AP bandwidth is 80 and 160 MHz, to transmit the center channel
frequency of the BSS. For AP bandwidth is 80 + 80 MHz, it is the center channel frequency
of the lower frequency segment.*/
@ -458,19 +469,6 @@ typedef struct {
uint16_t ghz_5g; /**< Represents 5 GHz protocol, support 802.11a or 802.11n or 802.11ac or 802.11ax */
} wifi_protocols_t;
/**
* @brief Wi-Fi bandwidth type
*/
typedef enum {
WIFI_BW_HT20 = 1, /**< Bandwidth is HT20 */
WIFI_BW20 = WIFI_BW_HT20, /**< Bandwidth is 20 MHz */
WIFI_BW_HT40 = 2, /**< Bandwidth is HT40 */
WIFI_BW40 = WIFI_BW_HT40, /**< Bandwidth is 40 MHz */
WIFI_BW80 = 3, /**< Bandwidth is 80 MHz */
WIFI_BW160 = 4, /**< Bandwidth is 160 MHz */
WIFI_BW80_BW80 = 5, /**< Bandwidth is 80 + 80 MHz */
} wifi_bandwidth_t;
/**
* @brief Description of a Wi-Fi band bandwidths
*/

@ -1 +1 @@
Subproject commit 952d21c8d1b5de2d966e3a0010317c41b060baad
Subproject commit 9d69ec4c3a5784a769f20ba2c5014ec04d58ba1b

View File

@ -144,6 +144,7 @@ struct wpa_funcs {
void (*wpa_config_done)(void);
uint8_t *(*owe_build_dhie)(uint16_t group);
int (*owe_process_assoc_resp)(const u8 *rsn_ie, size_t rsn_len, const uint8_t *dh_ie, size_t dh_len);
void (*wpa_sta_clear_curr_pmksa)(void);
};
struct wpa2_funcs {

View File

@ -476,6 +476,7 @@ int esp_supplicant_init(void)
wpa_cb->wpa_config_bss = NULL;//wpa_config_bss;
wpa_cb->wpa_michael_mic_failure = wpa_michael_mic_failure;
wpa_cb->wpa_config_done = wpa_config_done;
wpa_cb->wpa_sta_clear_curr_pmksa = wpa_sta_clear_curr_pmksa;
esp_wifi_register_wpa3_ap_cb(wpa_cb);
esp_wifi_register_wpa3_cb(wpa_cb);

View File

@ -3,10 +3,17 @@ SmartConfig
:link_to_translation:`zh_CN:[中文]`
Introduction
------------
The SmartConfig\ :sup:`TM` is a provisioning technology developed by TI to connect a new Wi-Fi device to a Wi-Fi network. It uses a mobile application to broadcast the network credentials from a smartphone, or a tablet, to an un-provisioned Wi-Fi device.
The advantage of this technology is that the device does not need to directly know SSID or password of an Access Point (AP). This information is provided using the smartphone. This is particularly important to headless device and systems, due to their lack of a user interface.
Currently, {IDF_TARGET_NAME} support three types of SmartConfig: Airkiss, ESPTouch, and ESPTouch v2. ESPTouch v2 has been supported since SmartConfig v3.0 (the version of SmartConfig can be get from :cpp:func:`esp_smartconfig_get_version()`), and it employs a completely different algorithm compared to ESPTouch, resulting in faster setup times. Additionally, ESPTouch v2 introduces AES encryption and custom data fields.
Starting from SmartConfig v3.0.2, ESPTouch v2 introduces support for random IV in AES encryption. On the application side, when the option for random IV is disabled, the default IV is set to 0, maintaining consistency with previous versions. When the random IV option is enabled, the IV will be a random value. It is important to note that when AES encryption is enabled with a random IV, the provision time will be extended due to the need of transmitting the IV to the provisioning device. On the provisioning device side, the device will identify whether the random IV for AES is enabled based on the flag in the provisioning packet.
If you are looking for other options to provision your {IDF_TARGET_NAME} devices, check :doc:`../provisioning/index`.

View File

@ -10,3 +10,4 @@ Migration from 5.3 to 5.4
system
bluetooth-classic
storage
wifi

View File

@ -0,0 +1,22 @@
Wi-Fi
======
:link_to_translation:`zh_CN:[中文]`
Wi-Fi Scan and Connect
------------------------
The following types have been modified:
- :component_file:`esp_wifi/include/esp_wifi_he_types.h`
- :cpp:struct:`esp_wifi_htc_omc_t`:
- ``uph_id``, ``ul_pw_headroom``, ``min_tx_pw_flag`` are deprecated.
- :component_file:`esp_wifi/include/esp_wifi_types_generic.h`
- :cpp:struct:`wifi_ap_record_t`:
- The type of ``bandwidth`` has been changed from ``uint8_t`` to ``wifi_bandwidth_t``

View File

@ -3,10 +3,17 @@ SmartConfig
:link_to_translation:`en:[English]`
概述
-----
SmartConfig\ :sup:`TM` 是由 TI 开发的配网技术,用于将新的 Wi-Fi 设备连接到 Wi-Fi 网络。它使用移动应用程序将无线网凭据从智能手机或平板电脑端广播给未配网的 Wi-Fi 设备。
这项技术的优势在于,设备无需直接获知 AP 的 SSID 或密码,而是通过智能手机获取。这对于没有用户界面的无头设备和系统而言十分重要。
目前, {IDF_TARGET_NAME} 支持三种类型的 SmartConfig 配网: Airkiss、ESPTouch 和 ESPTouch v2。ESPTouch v2 自 SmartConfig v3.0 SmartConfig 的版本可以从 :cpp:func:`esp_smartconfig_get_version()` 获取起开始支持ESPTouch v2 和 vESPTouch 采用完全不同的配网算法因此配网速度更快。此外ESPTouch v2 还增加了 AES 加密功能和自定义数据字段。
从 SmartConfig v3.0.2 开始ESPTouch v2 的 AES 加密支持随机 IV。在应用程序端当随机 IV 的选项关闭的时候,默认的 IV 为 0与旧版本保持一致当随机 IV 的选项打开的时候IV 为随机值。需要注意的是,当启用 AES 加密且 IV 为随机值时,配网时间会延长,因为需要将 IV 传输到配网设备。在配网设备端,设备会根据配网包中的 flag 来识别 AES 的随机 IV 是否开启。
如需通过其他方式为 {IDF_TARGET_NAME} 设备配网,请参阅 :doc:`../provisioning/index`

View File

@ -10,3 +10,4 @@
system
bluetooth-classic
storage
wifi

View File

@ -0,0 +1,24 @@
Wi-Fi
=====
:link_to_translation:`en:[English]`
Wi-Fi 扫描和连接
------------------------
以下类型已被更改:
- :component_file:`esp_wifi/include/esp_wifi_he_types.h`
- :cpp:struct:`esp_wifi_htc_omc_t` 中:
- ``uph_id`` ``ul_pw_headroom`` ``min_tx_pw_flag`` 字段被弃用
- :component_file:`esp_wifi/include/esp_wifi_types_generic.h`
- :cpp:struct:`wifi_ap_record_t` 中:
- ``bandwidth`` 的类型从 ``uint8_t`` 更改为 ``wifi_bandwidth_t``

View File

@ -12,7 +12,7 @@ CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y
CONFIG_ESP_WIFI_RX_BA_WIN=22
CONFIG_ESP_WIFI_NVS_ENABLED=n
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=57600
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=50400
CONFIG_LWIP_TCP_WND_DEFAULT=65535
CONFIG_LWIP_TCP_RECVMBOX_SIZE=48
CONFIG_LWIP_UDP_RECVMBOX_SIZE=64

View File

@ -38,6 +38,12 @@ menu "Example Configuration"
help
Set static gateway address.
config EXAMPLE_TWT_ENABLE_KEEP_ALIVE_QOS_NULL
bool "enable keep alive qos null"
default n
help
Enable send QOS NULL to keep alive during TWT.
menu "iTWT Configuration"
config EXAMPLE_ITWT_TRIGGER_ENABLE
bool "trigger-enabled"

View File

@ -49,6 +49,12 @@ static const char *TAG = "itwt";
#define DEFAULT_PWD CONFIG_EXAMPLE_WIFI_PASSWORD
#define ITWT_SETUP_SUCCESS 1
#if CONFIG_EXAMPLE_TWT_ENABLE_KEEP_ALIVE_QOS_NULL
bool keep_alive_enabled = true;
#else
bool keep_alive_enabled = false;
#endif
#if CONFIG_EXAMPLE_ITWT_TRIGGER_ENABLE
uint8_t trigger_enabled = 1;
#else
@ -264,6 +270,12 @@ static void wifi_itwt(void)
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
wifi_twt_config_t wifi_twt_config = {
.post_wakeup_event = false,
.twt_enable_keep_alive = keep_alive_enabled,
};
ESP_ERROR_CHECK(esp_wifi_sta_twt_config(&wifi_twt_config));
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20);
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11AX);
esp_wifi_set_ps(WIFI_PS_MIN_MODEM);