Merge branch 'bugfix/fix_tbtt_interval_update_fail_v5.3' into 'release/v5.3'

fix(wifi): Optimization for wifi components (v5.3)

See merge request espressif/esp-idf!34896
This commit is contained in:
Jiang Jiang Jian 2024-11-15 20:09:00 +08:00
commit 34b31d4c2e
12 changed files with 575 additions and 412 deletions

View File

@ -171,6 +171,7 @@ build_docs_pdf:
- job: fast_template_app
artifacts: false
optional: true
allow_failure: true # TODO IDFCI-2216
artifacts:
paths:
- docs/_build/*/*/latex/*
@ -182,6 +183,7 @@ build_docs_pdf_prod:
- .build_docs_template
- .doc-rules:build:docs-full-prod
dependencies: [] # Stop build_docs jobs from downloading all previous job's artifacts
allow_failure: true # TODO IDFCI-2216
artifacts:
paths:
- docs/_build/*/*/latex/*

View File

@ -637,7 +637,8 @@ esp_err_t esp_mesh_stop(void);
* @param[in] to the address of the final destination of the packet
* - If the packet is to the root, set this parameter to NULL.
* - If the packet is to an external IP network, set this parameter to the IPv4:PORT combination.
* This packet will be delivered to the root firstly, then the root will forward this packet to the final IP server address.
* This packet will be delivered to the root firstly, then users need to call esp_mesh_recv_toDS() on the root node to forward this
* packet to the final IP server address.
* @param[in] data pointer to a sending mesh packet
* - Field size should not exceed MESH_MPS. Note that the size of one mesh packet should not exceed MESH_MTU.
* - Field proto should be set to data protocol in use (default is MESH_PROTO_BIN for binary).

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -49,7 +49,8 @@ extern "C" {
#define ESP_NOW_MAX_TOTAL_PEER_NUM 20 /*!< Maximum number of ESPNOW total peers */
#define ESP_NOW_MAX_ENCRYPT_PEER_NUM 6 /*!< Maximum number of ESPNOW encrypted peers */
#define ESP_NOW_MAX_DATA_LEN 250 /*!< Maximum length of ESPNOW data which is sent very time */
#define ESP_NOW_MAX_IE_DATA_LEN 250 /**< Maximum data length in a vendor-specific element */
#define ESP_NOW_MAX_DATA_LEN ESP_NOW_MAX_IE_DATA_LEN /**< Maximum length of data sent in each ESPNOW transmission for v1.0 */
/**
* @brief Status of sending ESPNOW data .
@ -96,9 +97,10 @@ typedef struct esp_now_recv_info {
*/
typedef struct esp_now_rate_config {
wifi_phy_mode_t phymode; /**< ESPNOW phymode of specified interface */
wifi_phy_rate_t rate; /**< ESPNOW rate of specified interface*/
bool ersu; /**< ESPNOW using ersu send frame*/
bool dcm; /**< ESPNOW using dcm rate to send frame*/
wifi_phy_rate_t rate; /**< ESPNOW rate of specified interface */
bool ersu; /**< ESPNOW using ERSU to send frame, ERSU is a transmission mode related to 802.11 ax.
ERSU is always used in long distance transmission, and its frame has lower rate compared with SU mode */
bool dcm; /**< ESPNOW using dcm rate to send frame */
} esp_now_rate_config_t;
/**
@ -135,7 +137,10 @@ esp_err_t esp_now_init(void);
esp_err_t esp_now_deinit(void);
/**
* @brief Get the version of ESPNOW
* @brief Get the version of ESPNOW. Currently, ESPNOW supports one version: v1.0.
*
* The v1.0 devices can receive packets if the packet length is less than or equal to ESP_NOW_MAX_IE_DATA_LEN.
* For packets exceeding this length, the v1.0 devices will discard the packet entirely.
*
* @param version ESPNOW version
*

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit 564eb0c3a90c40852360181e96e9cf53b7d818ff
Subproject commit 75710820e86e573220002b3aab4f5e43ad10d4ec

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

@ -475,6 +475,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

@ -212,10 +212,12 @@ INPUT = \
$(PROJECT_PATH)/components/esp_wifi/include/esp_mesh.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_now.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_smartconfig.h \
$(PROJECT_PATH)/components/esp_wifi/include/local/esp_wifi_types_native.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi_ap_get_sta_list.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi_crypto_types.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi_default.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi_netif.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi_types_generic.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi_types.h \
$(PROJECT_PATH)/components/esp_wifi/include/esp_wifi.h \
$(PROJECT_PATH)/components/wpa_supplicant/esp_supplicant/include/esp_mbo.h \

View File

@ -13,7 +13,12 @@ CTR with CBC-MAC Protocol (CCMP) is used to protect the action frame for securit
Frame Format
------------
ESP-NOW uses a vendor-specific action frame to transmit ESP-NOW data. The default ESP-NOW bit rate is 1 Mbps. The format of the vendor-specific action frame is as follows:
ESP-NOW uses a vendor-specific action frame to transmit ESP-NOW data. The default ESP-NOW bit rate is 1 Mbps.
Currently, ESP-NOW supports one version: v1.0. The maximum packet length supported by v1.0 devices is ESP_NOW_MAX_DATA_LEN bytes.
The v1.0 devices can receive packets if the packet length is less than or equal to ESP_NOW_MAX_IE_DATA_LEN. For packets exceeding this length, the v1.0 devices will discard the packet entirely.
The format of the vendor-specific action frame is as follows:
.. highlight:: none
@ -22,28 +27,32 @@ ESP-NOW uses a vendor-specific action frame to transmit ESP-NOW data. The defaul
------------------------------------------------------------------------------------------------------------
| MAC Header | Category Code | Organization Identifier | Random Values | Vendor Specific Content | FCS |
------------------------------------------------------------------------------------------------------------
24 bytes 1 byte 3 bytes 4 bytes 7-257 bytes 4 bytes
24 bytes 1 byte 3 bytes 4 bytes 7-x bytes 4 bytes
- Category Code: The Category Code field is set to the value (127) indicating the vendor-specific category.
- Organization Identifier: The Organization Identifier contains a unique identifier (0x18fe34), which is the first three bytes of MAC address applied by Espressif.
- Random Value: The Random Value filed is used to prevents relay attacks.
- Vendor Specific Content: The Vendor Specific Content contains vendor-specific fields as follows:
- Vendor Specific Content: The Vendor Specific Content contains one vendor-specific element field, x = 257(250 + 7).
The format of the vendor-specific element frame is as follows:
.. highlight:: none
::
-------------------------------------------------------------------------------
| Element ID | Length | Organization Identifier | Type | Version | Body |
-------------------------------------------------------------------------------
1 byte 1 byte 3 bytes 1 byte 1 byte 0-250 bytes
------------------------------------------------------------------------------------------
| Element ID | Length | Organization Identifier | Type | Reserved | Version | Body |
------------------------------------------------------------------------------------------
7~4 bits | 3~0 bits
1 byte 1 byte 3 bytes 1 byte 1 byte 0-250 bytes
- Element ID: The Element ID field is set to the value (221), indicating the vendor-specific element.
- Length: The length is the total length of Organization Identifier, Type, Version and Body.
- Length: The length is the total length of Organization Identifier, Type, Version and Body, the maximum value is 255.
- Organization Identifier: The Organization Identifier contains a unique identifier (0x18fe34), which is the first three bytes of MAC address applied by Espressif.
- Type: The Type field is set to the value (4) indicating ESP-NOW.
- Version: The Version field is set to the version of ESP-NOW.
- Body: The Body contains the ESP-NOW data.
- Body: The Body contains the actual ESP-NOW data to be transmitted.
As ESP-NOW is connectionless, the MAC header is a little different from that of standard frames. The FromDS and ToDS bits of FrameControl field are both 0. The first address field is set to the destination address. The second address field is set to the source address. The third address field is set to broadcast address (0xff:0xff:0xff:0xff:0xff:0xff).

View File

@ -28,6 +28,7 @@ API Reference
.. include-build-file:: inc/esp_wifi.inc
.. include-build-file:: inc/esp_wifi_types.inc
.. include-build-file:: inc/esp_wifi_types_generic.inc
.. include-build-file:: inc/esp_eap_client.inc
.. include-build-file:: inc/esp_wps.inc
.. include-build-file:: inc/esp_rrm.inc

View File

@ -13,37 +13,43 @@ CTR 与 CBC-MAC 协议 (CCMP) 可用来保护动作帧的安全。ESP-NOW 广泛
帧格式
------------
ESP-NOW 使用各个供应商的动作帧传输数据,默认比特率为 1 Mbps。各个供应商的动作帧格式为
ESP-NOW 使用供应商的动作帧传输数据,默认比特率为 1 Mbps。目前 ESP-NOW 支持一个版本: v1.0。v1.0 的设备支持的最大数据包长度为 ESP_NOW_MAX_DATA_LEN bytes。
v1.0 设备可以接收长度不超过 ESP_NOW_MAX_IE_DATA_LEN 的数据包,而对于长度超过 ESP_NOW_MAX_IE_DATA_LEN 的数据包,会丢弃数据包。
供应商的动作帧格式为:
.. highlight:: none
::
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------
| MAC 报头 | 分类代码 | 组织标识符 | 随机值 | 供应商特定内容 | FCS |
-----------------------------------------------------------------------------------------
24 字节 1 字节 3 字节 4 字节 7-257 字节 4 字节
-----------------------------------------------------------------------------
24 字节 1 字节 3 字节 4 字节 7-x 字节 4 字节
- 分类代码:分类代码字段可用于指示各个供应商的类别(比如 127
- 组织标识符:组织标识符包含一个唯一标识符(比如 0x18fe34为乐鑫指定的 MAC 地址的前三个字节。
- 随机值:防止重放攻击。
- 供应商特定内容:供应商特定内容包含供应商特定字段,如下所示:
- 供应商特定内容供应商特定内容包含一个特定供应商元素字段x = 257(250+7)。
特定供应商元素的帧格式为:
.. highlight:: none
::
----------------------------------------------------------------------------------------
| 元素 ID | 长度 | 组织标识符 | 类型 | 版本 | 正文 |
----------------------------------------------------------------------------------------
1 字节 1 字节 3 字节 1 字节 1 字节 0-250 字节
---------------------------------------------------------------------------
| 元素 ID | 长度 | 组织标识符 | 类型 | 保留 | 版本 | 正文 |
---------------------------------------------------------------------------
7~4 比特| 3~0 比特
1 字节 1 字节 3 字节 1 字节 1 字节 0-250 字节
- 元素 ID元素 ID 字段可用于指示特定于供应商的元素。
- 长度:长度是组织标识符、类型、版本和正文的总长度。
- 长度:长度是组织标识符、类型、版本和正文的总长度,最大值为 255
- 组织标识符:组织标识符包含一个唯一标识符(比如 0x18fe34为乐鑫指定的 MAC 地址的前三个字节。
- 类型:类型字段设置为 4代表 ESP-NOW。
- 版本:版本字段设置为 ESP-NOW 的版本。
- 正文:正文包含 ESP-NOW 数据。
- 正文:正文包含实际要发送的 ESP-NOW 数据。
由于 ESP-NOW 是无连接的,因此 MAC 报头与标准帧略有不同。FrameControl 字段的 FromDS 和 ToDS 位均为 0。第一个地址字段用于配置目标地址。第二个地址字段用于配置源地址。第三个地址字段用于配置广播地址 (0xff:0xff:0xff:0xff:0xff:0xff)。

View File

@ -28,6 +28,7 @@ API 参考
.. include-build-file:: inc/esp_wifi.inc
.. include-build-file:: inc/esp_wifi_types.inc
.. include-build-file:: inc/esp_wifi_types_generic.inc
.. include-build-file:: inc/esp_eap_client.inc
.. include-build-file:: inc/esp_wps.inc
.. include-build-file:: inc/esp_rrm.inc