wifi: update wifi libs to support wifi6 features and fix build error

pull/10469/head
lvshisheng 2022-12-29 12:58:02 +08:00
rodzic 6e14adcb44
commit bba409eec1
19 zmienionych plików z 69 dodań i 79 usunięć

Wyświetl plik

@ -172,7 +172,9 @@ static sleep_config_t s_config = {
/* Internal variable used to track if light sleep wakeup sources are to be
expected when determining wakeup cause. */
#if !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static bool s_light_sleep_wakeup = false;
#endif
/* Updating RTC_MEMORY_CRC_REG register via set_rtc_memory_crc()
is not thread-safe, so we need to disable interrupts before going to deep sleep. */
@ -195,11 +197,13 @@ static uint32_t get_power_down_flags(void);
static void ext0_wakeup_prepare(void);
static void ext1_wakeup_prepare(void);
#endif
#if !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static void timer_wakeup_prepare(void);
#endif
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
static void touch_wakeup_prepare(void);
#endif
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP && !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static void gpio_deep_sleep_wakeup_prepare(void);
#endif
@ -283,6 +287,7 @@ void esp_deep_sleep(uint64_t time_in_us)
}
// [refactor-todo] provide target logic for body of uart functions below
#if !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static void IRAM_ATTR flush_uarts(void)
{
for (int i = 0; i < SOC_UART_NUM; ++i) {
@ -327,6 +332,7 @@ static void IRAM_ATTR resume_uarts(void)
uart_ll_force_xon(i);
}
}
#endif
/**
* These save-restore workaround should be moved to lower layer
@ -613,6 +619,7 @@ void IRAM_ATTR esp_deep_sleep_start(void)
* Helper function which handles entry to and exit from light sleep
* Placed into IRAM as flash may need some time to be powered on.
*/
#if !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static esp_err_t esp_light_sleep_inner(uint32_t pd_flags,
uint32_t flash_enable_time_us,
rtc_vddsdio_config_t vddsdio_config) IRAM_ATTR __attribute__((noinline));
@ -642,6 +649,7 @@ static esp_err_t esp_light_sleep_inner(uint32_t pd_flags,
return reject ? ESP_ERR_SLEEP_REJECT : ESP_OK;
#endif
}
#endif
/**
* vddsdio is used for power supply of spi flash
@ -932,6 +940,7 @@ esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us)
return ESP_OK;
}
#if !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static void timer_wakeup_prepare(void)
{
int64_t sleep_duration = (int64_t) s_config.sleep_duration - (int64_t) s_config.sleep_time_adjustment;
@ -942,6 +951,7 @@ static void timer_wakeup_prepare(void)
int64_t ticks = rtc_time_us_to_slowclk(sleep_duration, s_config.rtc_clk_cal_period);
rtc_hal_set_wakeup_timer(s_config.rtc_ticks_at_sleep_start + ticks);
}
#endif
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
/* In deep sleep mode, only the sleep channel is supported, and other touch channels should be turned off. */
@ -1131,6 +1141,7 @@ uint64_t esp_sleep_get_gpio_wakeup_status(void)
return rtc_hal_gpio_get_wakeup_status();
}
#if !CONFIG_IDF_TARGET_ESP32C6 // TODO: WIFI-5150
static void gpio_deep_sleep_wakeup_prepare(void)
{
for (gpio_num_t gpio_idx = GPIO_NUM_0; gpio_idx < GPIO_NUM_MAX; gpio_idx++) {
@ -1149,6 +1160,7 @@ static void gpio_deep_sleep_wakeup_prepare(void)
// Clear state from previous wakeup
rtc_hal_gpio_clear_wakeup_status();
}
#endif
esp_err_t esp_deep_sleep_enable_gpio_wakeup(uint64_t gpio_pin_mask, esp_deepsleep_gpio_wake_up_mode_t mode)
{

Wyświetl plik

@ -402,26 +402,27 @@ menu "Wi-Fi"
When using ESP mesh, this value should be set to a maximum of 6.
config ENABLE_WIFI_TX_STATS
config ESP_WIFI_ENABLE_WIFI_TX_STATS
bool "Enable Wi-Fi transmission statistics"
depends on SOC_WIFI_HE_SUPPORT
default "y"
help
Enable Wi-Fi transmission statistics. Total support 4 access category. Each access category will use 346 bytes memory.
Enable Wi-Fi transmission statistics. Total support 4 access category. Each access category
will use 346 bytes memory.
config ENABLE_WIFI_RX_STATS
config ESP_WIFI_ENABLE_WIFI_RX_STATS
bool "Enable Wi-Fi reception statistics"
depends on SOC_WIFI_HE_SUPPORT
default "y"
help
Enable Wi-Fi reception statistics. Total support 2 access category. Each access category will use 190 bytes memory.
Enable Wi-Fi reception statistics. Total support 2 access category. Each access category
will use 190 bytes memory.
config ENABLE_WIFI_RX_MU_STATS
config ESP_WIFI_ENABLE_WIFI_RX_MU_STATS
bool "Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics"
depends on SOC_WIFI_HE_SUPPORT
depends on ENABLE_WIFI_RX_STATS
depends on ESP_WIFI_ENABLE_WIFI_RX_STATS
default "y"
help
Enable Wi-Fi DL MU-MIMO and DL OFDMA reception statistics. Will use 10932 bytes memory.
endmenu # Wi-Fi
endmenu # Wi-Fi

Wyświetl plik

@ -189,4 +189,3 @@ esp_err_t esp_wifi_sta_reset_muedca_timer(uint8_t aci_bitmap);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -10,7 +10,6 @@
#include <stdbool.h>
#include "sys/queue.h"
#include "esp_err.h"
#include "esp_interface.h"
#include "esp_event_base.h"
#ifdef __cplusplus
@ -315,4 +314,3 @@ typedef struct {
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -143,33 +143,6 @@ void esp_wifi_internal_free_rx_buffer(void* buffer);
*/
int esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, uint16_t len);
#if CONFIG_SOC_WIFI_HE_SUPPORT
/**
* @brief transmit eapol frames via wifi driver
*
* This API makes a copy of the input buffer and then forwards the buffer
* copy to WiFi driver.
*
* @param wifi_interface_t wifi_if : wifi interface id
* @param void *buffer : the buffer to be transmit
* @param uint16_t len : the length of buffer
* @param uint8_t msg_id : eapol message id
*
* @return
* - ESP_OK : Successfully transmit the buffer to wifi driver
* - ESP_ERR_NO_MEM: out of memory
* - ESP_ERR_WIFI_ARG: invalid argument
* - ESP_ERR_WIFI_IF : WiFi interface is invalid
* - ESP_ERR_WIFI_CONN : WiFi interface is not created, e.g. send the data to STA while WiFi mode is AP mode
* - ESP_ERR_WIFI_NOT_STARTED : WiFi is not started
* - ESP_ERR_WIFI_STATE : WiFi internal state is not ready, e.g. WiFi is not started
* - ESP_ERR_WIFI_NOT_ASSOC : WiFi is not associated
* - ESP_ERR_WIFI_TX_DISALLOW : WiFi TX is disallowed, e.g. WiFi hasn't pass the authentication
* - ESP_ERR_WIFI_POST : caller fails to post event to WiFi task
*/
int esp_wifi_eapol_tx(wifi_interface_t wifi_if, void *buffer, uint16_t len, uint8_t msg_id);
#endif
/**
* @brief The net stack buffer reference counter callback function
*

Wyświetl plik

@ -8,6 +8,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
@ -112,8 +113,8 @@ typedef enum {
} wifi_rx_bb_format_t;
/**
* @brief RxControl Info
*/
* @brief RxControl Info
*/
typedef struct {
signed rssi : 8; /**< the RSSI of the reception frame */
unsigned rate : 5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */
@ -222,4 +223,3 @@ typedef struct {
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -187,6 +187,7 @@ typedef enum {
WIFI_ANT_MAX, /**< Invalid WiFi antenna */
} wifi_ant_t;
/** @brief Description of a WiFi AP HE Info */
typedef struct {
uint8_t bss_color:6; /**< an unsigned integer whose value is the BSS Color of the BSS corresponding to the AP */
uint8_t partial_bss_color:1; /**< indicate if an AID assignment rule based on the BSS color */

@ -1 +1 @@
Subproject commit c0deded2742ef619403eb3bda0c61e87fe5bcdf7
Subproject commit 1eb9c86d74b7a0ea258e60bec5cec1cca2f6d248

Wyświetl plik

@ -10,4 +10,4 @@ target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
if(CONFIG_SOC_WIFI_HE_SUPPORT)
idf_component_optional_requires(PRIVATE esp_wifi console)
endif()
endif()

Wyświetl plik

@ -11,7 +11,7 @@ extern "C" {
#endif
#if CONFIG_ENABLE_WIFI_TX_STATS || CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS || CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
int wifi_cmd_get_tx_statistics(int argc, char **argv);
int wifi_cmd_clr_tx_statistics(int argc, char **argv);

Wyświetl plik

@ -279,17 +279,17 @@ static esp_err_t IRAM_ATTR iperf_run_tcp_server(void)
timeout.tv_sec = IPERF_SOCKET_RX_TIMEOUT;
setsockopt(client_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
wifi_cmd_clr_tx_statistics(0, NULL);
#endif
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
wifi_cmd_clr_rx_statistics(0, NULL);
#endif
socket_recv(client_socket, listen_addr, IPERF_TRANS_TYPE_TCP);
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
wifi_cmd_get_rx_statistics(0, NULL);
#endif
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
wifi_cmd_get_tx_statistics(0, NULL);
#endif
@ -344,17 +344,17 @@ static esp_err_t iperf_run_tcp_client(void)
}
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
wifi_cmd_clr_rx_statistics(0, NULL);
#endif
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
wifi_cmd_clr_tx_statistics(0, NULL);
#endif
socket_send(client_socket, dest_addr, IPERF_TRANS_TYPE_TCP, s_iperf_ctrl.cfg.bw_lim);
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
wifi_cmd_get_tx_statistics(0, NULL);
#endif
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
wifi_cmd_get_rx_statistics(0, NULL);
#endif
@ -417,11 +417,11 @@ static esp_err_t IRAM_ATTR iperf_run_udp_server(void)
timeout.tv_sec = IPERF_SOCKET_RX_TIMEOUT;
setsockopt(listen_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
wifi_cmd_clr_rx_statistics(0, NULL);
#endif
socket_recv(listen_socket, listen_addr, IPERF_TRANS_TYPE_UDP);
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
wifi_cmd_get_rx_statistics(0, NULL);
#endif
exit:
@ -468,11 +468,11 @@ static esp_err_t iperf_run_udp_client(void)
setsockopt(client_socket, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
memcpy(&dest_addr, &dest_addr4, sizeof(dest_addr4));
}
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
wifi_cmd_clr_tx_statistics(0, NULL);
#endif
socket_send(client_socket, dest_addr, IPERF_TRANS_TYPE_UDP, s_iperf_ctrl.cfg.bw_lim);
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
wifi_cmd_get_tx_statistics(0, NULL);
#endif
exit:

Wyświetl plik

@ -465,9 +465,9 @@ static int do_ping_cmd(int argc, char **argv)
return 0;
}
extern bool pm_is_waked();
extern bool pm_is_sleeping();
extern bool pm_is_dream();
extern bool pm_is_waked(void);
extern bool pm_is_sleeping(void);
extern bool pm_is_dream(void);
static int wifi_cmd_get_ps_state(int argc, char **argv)
{
ESP_LOGW(TAG, "ps: awake:%d, sleep:%d, dream:%d", pm_is_waked(), pm_is_sleeping(), pm_is_dream());
@ -1076,4 +1076,3 @@ void register_wifi_cmd(void)
}
#endif /* CONFIG_SOC_WIFI_HE_SUPPORT */

Wyświetl plik

@ -8,7 +8,7 @@
#include <string.h>
#include "esp_log.h"
#if CONFIG_ENABLE_WIFI_TX_STATS || CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS || CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
#include "esp_console.h"
#include "argtable3/argtable3.h"
@ -39,7 +39,7 @@ static const char *TAG = "stats";
/*******************************************************
* Variable Definitions
*******************************************************/
#if CONFIG_ENABLE_WIFI_RX_MU_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_MU_STATS
esp_test_rx_mu_statistics_t rx_mu_stats = { 0, }; //10932 bytes
#endif
@ -466,7 +466,7 @@ int wifi_cmd_clr_rx_statistics(int argc, char **argv)
ESP_LOGW(TAG, "Clear rx statistics");
esp_wifi_clr_rx_statistics(0);
esp_wifi_clr_rx_statistics(7);
#if CONFIG_ENABLE_WIFI_RX_MU_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_MU_STATS
esp_test_clr_rx_error_occurs();
esp_wifi_clr_rx_mu_statistics();
#endif
@ -521,7 +521,7 @@ int wifi_cmd_get_rx_statistics(int argc, char **argv)
ESP_LOGW(TAG, "(hw)isr:%d, nblks:%d", rx_stats.rx_isr, rx_stats.rx_nblks);
/* hw rx statistics */
print_hw_rx_statistics();
#if CONFIG_ENABLE_WIFI_RX_MU_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_MU_STATS
print_rx_mu_statistics();
#endif
esp_test_get_rx_error_occurs(&rx_error_occurs);
@ -541,11 +541,11 @@ int wifi_cmd_get_rx_statistics(int argc, char **argv)
return 0;
}
#endif /* CONFIG_ENABLE_WIFI_TX_STATS || CONFIG_ENABLE_WIFI_RX_STATS */
#endif /* CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS || CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS */
void register_wifi_stats(void)
{
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
/* get tx statistics */
const esp_console_cmd_t tx_stats_cmd = {
.command = "tx",
@ -564,7 +564,7 @@ void register_wifi_stats(void)
ESP_ERROR_CHECK(esp_console_cmd_register(&clr_cmd));
#endif
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
/* get rx statistics */
const esp_console_cmd_t rx_stats_cmd = {
.command = "rx",

Wyświetl plik

@ -31,3 +31,9 @@ examples/wifi/iperf:
- if: IDF_TARGET != "esp32"
temporary: true
reason: lack of runners
examples/wifi/itwt:
enable:
- if: IDF_TARGET == "esp32c6"
temporary: true
reason: the other targets are not supported yet

Wyświetl plik

@ -85,7 +85,7 @@ static void scan_done_handler(void *arg, esp_event_base_t event_base,
if (esp_wifi_scan_get_ap_records(&sta_number, (wifi_ap_record_t *)ap_list_buffer) == ESP_OK) {
for (i = 0; i < sta_number; i++) {
#if CONFIG_SOC_WIFI_HE_SUPPORT
char ssid_rssi[45] = { 0, };
char ssid_rssi[46] = { 0, };
sprintf(ssid_rssi, "[%s][rssi=%d]", ap_list_buffer[i].ssid, ap_list_buffer[i].rssi);
if (ap_list_buffer[i].phy_11ax) {
ESP_LOGW(TAG,
@ -186,9 +186,8 @@ void initialise_wifi(void)
#endif
#endif
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ENABLE_WIFI_RX_MU_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_MU_STATS
esp_wifi_enable_rx_statistics(true, true);
#else
esp_wifi_enable_rx_statistics(true, false);

Wyświetl plik

@ -1,2 +1,2 @@
idf_component_register(SRCS "itwt.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS ".")

Wyświetl plik

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* itwt Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
@ -215,14 +220,14 @@ static void wifi_itwt(void)
ESP_ERROR_CHECK(esp_wifi_start());
#if CONFIG_ENABLE_WIFI_RX_STATS
#if CONFIG_ENABLE_WIFI_RX_MU_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_RX_MU_STATS
esp_wifi_enable_rx_statistics(true, true);
#else
esp_wifi_enable_rx_statistics(true, false);
#endif
#endif
#if CONFIG_ENABLE_WIFI_TX_STATS
#if CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS
esp_wifi_enable_tx_statistics(ESP_WIFI_ACI_VO, true); //VO, mgmt
esp_wifi_enable_tx_statistics(ESP_WIFI_ACI_BE, true); //BE, data
#endif

Wyświetl plik

@ -18,4 +18,3 @@ CONFIG_LWIP_ESP_GRATUITOUS_ARP=n
# CONFIG_LWIP_ESP_GRATUITOUS_ARP is not set
# CONFIG_ESP_GRATUITOUS_ARP is not set

Wyświetl plik

@ -15,5 +15,3 @@ CONFIG_LWIP_TCP_WND_DEFAULT=34000
CONFIG_LWIP_TCP_RECVMBOX_SIZE=64
CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64