esp32c6: add md5check, txop limit and sync header, update esp32c6 sdkconfig and itwt example

This commit is contained in:
lvshisheng
2023-01-17 20:51:51 +08:00
parent 3df87a91a3
commit d1230c7d9e
12 changed files with 152 additions and 100 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -185,6 +185,18 @@ esp_err_t esp_wifi_softap_set_bss_max_idle(bool bss_max_idle_enable, uint16_t bs
*/
esp_err_t esp_wifi_sta_reset_muedca_timer(uint8_t aci_bitmap);
/**
* @brief Set bss color collision detection duration and frame threshold.
*
* @param[in] threshold the number of HE frames with the same BSS color as STA but in different BSSs.
* @param[in] duration duration of the detection. If the number of frames that STA detects reaches threshold,
* STA will report BSS Color Collision to the associated AP. Unit seconds.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_sta_set_bss_color_collision_detection(int threshold, int duration);
#ifdef __cplusplus
}

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -24,16 +24,16 @@ typedef enum {
} sig_mode_t;
typedef struct {
unsigned mcs : 7;
unsigned cwb : 1;
unsigned ht_length : 16;
unsigned smoothing : 1;
unsigned not_sounding : 1;
unsigned : 1;
unsigned aggregation : 1;
unsigned stbc : 2;
unsigned fec_coding : 1;
unsigned sgi : 1;
uint32_t mcs : 7;
uint32_t cwb : 1;
uint32_t ht_length : 16;
uint32_t smoothing : 1;
uint32_t not_sounding : 1;
uint32_t : 1;
uint32_t aggregation : 1;
uint32_t stbc : 2;
uint32_t fec_coding : 1;
uint32_t sgi : 1;
} esp_wifi_htsig_t;
typedef struct {
@@ -109,8 +109,8 @@ typedef struct {
typedef struct {
uint16_t aid;
/* MIMO */
int mimo_rx;
int mimo_sigb_mcs[6]; //MCS[0, 5]
uint32_t mimo_rx;
uint32_t mimo_sigb_mcs[6]; //MCS[0, 5]
/*
* count sigb info, max: 8 users
*
@@ -119,57 +119,57 @@ typedef struct {
* ......
* mimo_user_num_occu[6] = the number of occurrences of user_num=8 within a period of rx
*/
int mimo_user_num_occu[7]; //UserNum[2, 8]
uint32_t mimo_user_num_occu[7]; //UserNum[2, 8]
struct {
uint16_t aid;
int occu_mcs[12];
uint32_t occu_mcs[12];
/*
* occu_ss[0] = the number of occurrences of SS0 within a period of rx
* occu_ss[1] = the number of occurrences of SS1 within a period of rx
* ......
* occu_ss[7] = the number of occurrences of SS7 within a period of rx
*/
int occu_ss[8];
uint32_t occu_ss[8];
} mimo[ESP_TEST_RX_MU_USER_NUM];
/* Non-MIMO */
int nonmimo_rx;
int nonmimo_sigb_mcs[6]; //MCS[0, 5]
int nonmimo_ru_alloc[256][9]; //size: 9216 bytes
int nonmimo_user_num_occu[9]; //UserNum[1, 9]
uint32_t nonmimo_rx;
uint32_t nonmimo_sigb_mcs[6]; //MCS[0, 5]
uint32_t nonmimo_ru_alloc[256][9]; // size: 9216 bytes
uint32_t nonmimo_user_num_occu[9]; // UserNum[1, 9]
struct {
uint16_t aid;
int occu_nsts[8];
int occu_mcs[12];
int txbf;
int dcm;
uint32_t occu_nsts[8];
uint32_t occu_mcs[12];
uint32_t txbf;
uint32_t dcm;
} nonmimo[ESP_TEST_RX_MU_USER_NUM];
int ru_alloc_96_num_2046; //106+106
int ru_alloc_112_num_2046; //52+52+52+52
uint32_t ru_alloc_96_num_2046; // 106+106
uint32_t ru_alloc_112_num_2046; // 52+52+52+52
} esp_test_rx_mu_statistics_t; //10932 bytes
typedef struct {
int legacy;
int legacy_noeb;
int ht;
int ht_noeb;
int ht_retry;
int ersu;
int ersu_noeb;
int ersu_dcm;
int su;
int su_noeb;
int su_stbc;
int su_txbf;
int su_retry;
int mu;
int mu_noeb;
int mu_stbc;
int mu_mimo;
int mu_ofdma;
int mu_txbf;
int mu_retry;
int rx_isr;
int rx_nblks;
uint32_t legacy;
uint32_t legacy_noeb;
uint32_t ht;
uint32_t ht_noeb;
uint32_t ht_retry;
uint32_t ersu;
uint32_t ersu_noeb;
uint32_t ersu_dcm;
uint32_t su;
uint32_t su_noeb;
uint32_t su_stbc;
uint32_t su_txbf;
uint32_t su_retry;
uint32_t mu;
uint32_t mu_noeb;
uint32_t mu_stbc;
uint32_t mu_mimo;
uint32_t mu_ofdma;
uint32_t mu_txbf;
uint32_t mu_retry;
uint32_t rx_isr;
uint32_t rx_nblks;
} esp_test_rx_statistics_t; //88 bytes
typedef enum {
@@ -207,52 +207,52 @@ typedef enum {
} esp_test_tx_fail_error_t;
typedef struct {
int match[TEST_TX_WAIT_MAX][TEST_TX_FAIL_ERROR_MAX];
int count;
uint32_t match[TEST_TX_WAIT_MAX][TEST_TX_FAIL_ERROR_MAX];
uint32_t count;
} esp_test_tx_fail_statistics_t; //164 bytes
typedef struct {
int tb_last; /* count times of the last TX through TB */
int tb_times; /* count total TX times through TB */
int tb_rx_ba; /* can't know the exact packets number of BA or ACK*/
int retry_edca;
int retry_tb;
int rx_ack; /* count ACKs response to TX through EDCA */
int rx_ba; /* count BAs response to TX through EDCA */
int rx_dump_ba;
uint32_t tb_last; /* count times of the last TX through TB */
uint32_t tb_times; /* count total TX times through TB */
uint32_t tb_rx_ba; /* can't know the exact packets number of BA or ACK*/
uint32_t retry_edca;
uint32_t retry_tb;
uint32_t rx_ack; /* count ACKs response to TX through EDCA */
uint32_t rx_ba; /* count BAs response to TX through EDCA */
uint32_t rx_dump_ba;
uint8_t rx_max_bitmap;
uint8_t rx_min_bitmap;
int rx_tot_bitmap;
int tx_enable;
int tx_complete;
int tx_succ;
int tx_no_mem;
int tx_max_rtt;
int tx_min_rtt;
int tx_tot_rtt;
int tx_seq_max_rtt; /* rtt of a sequence number containing the time of retries */
int tx_seq_min_rtt;
uint32_t rx_tot_bitmap;
uint32_t tx_enable;
uint32_t tx_complete;
uint32_t tx_succ;
uint32_t tx_no_mem;
uint32_t tx_max_rtt;
uint32_t tx_min_rtt;
uint32_t tx_tot_rtt;
uint32_t tx_seq_max_rtt; /* rtt of a sequence number containing the time of retries */
uint32_t tx_seq_min_rtt;
int64_t tx_start_time;
int64_t tx_seqno_time;
int64_t tx_muedca_time;
int tx_max_muedca_time;
int tx_min_muedca_time;
int tx_tot_muedca_time;
int muedca_times;
int tx_muedca_enable; /* count TX times within mu-timer working */
int collision;
int timeout;
int64_t tx_max_muedca_time;
int64_t tx_min_muedca_time;
int64_t tx_tot_muedca_time;
int64_t muedca_times;
uint32_t tx_muedca_enable; /* count TX times within mu-timer working */
uint32_t collision;
uint32_t timeout;
} esp_test_tx_statistics_t; //136 bytes
typedef struct {
int complete_suc_tb;
int complete_ack_tb;
int complete_err_tb;
int complete_tb_suc_count;
int complete_tb_ack_count;
int complete_tb_err_count;
int complete_tb_tot_count;
int complete_tb_pack_sent;
uint32_t complete_suc_tb;
uint32_t complete_ack_tb;
uint32_t complete_err_tb;
uint32_t complete_tb_suc_count;
uint32_t complete_tb_ack_count;
uint32_t complete_tb_err_count;
uint32_t complete_tb_tot_count;
uint32_t complete_tb_pack_sent;
} esp_test_tx_tb_statistics_t; //32 bytes
typedef struct {
@@ -302,12 +302,12 @@ typedef struct {
uint16_t nrx_hesiga_crc;
uint16_t rxhung_statis;
uint16_t txhung_statis;
int rxtxhung;
uint32_t rxtxhung;
} esp_test_hw_rx_statistics_t; //76 bytes
typedef struct {
int tot;
int occurs[2]; //0: 0xc6 same bitmap; 1: 0xf5 tkip error
uint32_t tot;
uint32_t occurs[2]; // 0: 0xc6 same bitmap; 1: 0xf5 tkip error
} esp_test_rx_error_occurs_t; //12 bytes

View File

@@ -328,6 +328,17 @@ esp_err_t esp_wifi_internal_crypto_funcs_md5_check(const char *md5);
*/
esp_err_t esp_wifi_internal_wifi_type_md5_check(const char *md5);
/**
* @brief Check the MD5 values of the esp_wifi_he_types.h in IDF and WiFi library
*
* @attention 1. It is used for internal CI version check
*
* @return
* - ESP_OK : succeed
* - ESP_WIFI_INVALID_ARG : MD5 check fail
*/
esp_err_t esp_wifi_internal_wifi_he_type_md5_check(const char *md5);
/**
* @brief Check the MD5 values of the esp_wifi.h in IDF and WiFi library
*
@@ -339,6 +350,17 @@ esp_err_t esp_wifi_internal_wifi_type_md5_check(const char *md5);
*/
esp_err_t esp_wifi_internal_esp_wifi_md5_check(const char *md5);
/**
* @brief Check the MD5 values of the esp_wifi_he.h in IDF and WiFi library
*
* @attention 1. It is used for internal CI version check
*
* @return
* - ESP_OK : succeed
* - ESP_WIFI_INVALID_ARG : MD5 check fail
*/
esp_err_t esp_wifi_internal_esp_wifi_he_md5_check(const char *md5);
/**
* @brief Allocate a chunk of memory for WiFi driver
*

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -49,7 +49,8 @@ esp_err_t esp_wifi_sta_itwt_setup(wifi_twt_setup_cmds_t setup_cmd, bool trigger,
/**
* @brief Tear down individual TWT agreements
*
* @param[in] flow_id The value range is [0, 8]. 8 indicates tear down all individual TWT agreements.
* @param[in] flow_id The value range is [0, 7].
* FLOW_ID_ALL indicates tear down all individual TWT agreements.
*
* @return
* - ESP_OK: succeed
@@ -64,7 +65,8 @@ esp_err_t esp_wifi_sta_itwt_teardown(int flow_id);
/**
* @brief Send a TWT Information frame to AP for suspending/resuming established iTWT agreements.
*
* @param[in] flow_id The value range is [0, 8]. 8 indicates suspend all individual TWT agreements
* @param[in] flow_id The value range is [0, 7].
* FLOW_ID_ALL indicates suspend all individual TWT agreements
* @param[in] suspend_time_ms If the value is 0, indicates the specified flow_id or all established agreements will be suspended until resume by users.
* If the value is greater than 0, indicates the specified flow_id or all established agreements will be suspended until suspend_time_ms timeout, unit: ms.
*

View File

@@ -192,6 +192,7 @@ typedef struct {
uint16_t wake_invl_mant; /**< the value of the mantissa of the TWT wake interval value in microseconds, base 2 */
bool trigger; /**< true: indicates a trigger-enabled TWT, false: indicates a non-trigger-enabled TWT */
uint8_t flow_type; /**< 0: indicate an announced TWT, 1: indicates an unannounced TWT */
esp_err_t status; /**< 1: indicate tx success, others : indicate tx fail */
} wifi_event_sta_itwt_setup_t;
/** Argument structure for WIFI_EVENT_TWT_TEARDOWN event */

View File

@@ -25,6 +25,9 @@ case $IDF_TARGET in
esp32c3)
PREFIX=riscv32-esp-elf-
;;
esp32c6)
PREFIX=riscv32-esp-elf-
;;
*)
echo "Invalid IDF_TARGET value: \"${IDF_TARGET}\""
exit 1
@@ -36,8 +39,10 @@ ELF_FILE=test.elf
${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \
-u g_esp_wifi_md5 \
-u g_esp_wifi_he_md5 \
-u g_wifi_crypto_funcs_md5 \
-u g_wifi_type_md5 \
-u g_wifi_he_type_md5 \
-u g_wifi_osi_funcs_md5 \
-u g_coex_adapter_funcs_md5 \
-u g_wifi_supplicant_funcs_md5 \
@@ -65,9 +70,11 @@ function check_md5()
echo "Checking libraries for target ${IDF_TARGET}..."
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi.h g_esp_wifi_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_he.h g_esp_wifi_he_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_private/wifi_os_adapter.h g_wifi_osi_funcs_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_crypto_types.h g_wifi_crypto_funcs_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_types.h g_wifi_type_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_wifi_he_types.h g_wifi_he_type_md5
check_md5 ${IDF_PATH}/components/esp_wifi/include/esp_coexist_adapter.h g_coex_adapter_funcs_md5
check_md5 ${IDF_PATH}/components/wpa_supplicant/esp_supplicant/src/esp_wifi_driver.h g_wifi_supplicant_funcs_md5

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -86,7 +86,7 @@ static int wifi_cmd_itwt(int argc, char **argv)
// teardown a given flow id, all_twt has a high priority
int flow_id = itwt_args.flowid->count ? itwt_args.flowid->ival[0] : (-1);
bool all_twt = itwt_args.all_twt->count ? ((itwt_args.all_twt->ival[0] == 1) ? true : false) : false;
flow_id = (all_twt == true) ? 8 : flow_id;
flow_id = (all_twt == true) ? FLOW_ID_ALL : flow_id;
if (flow_id >= 0) {
err = esp_wifi_sta_itwt_teardown(flow_id);
ESP_LOGI(TAG, "(itwt)teardown, flow_id:%d, all_twt:%d, err:0x%x", flow_id, all_twt, err);
@@ -98,7 +98,7 @@ static int wifi_cmd_itwt(int argc, char **argv)
// suspend a given flow id
int flow_id = itwt_args.flowid->count ? itwt_args.flowid->ival[0] : (-1);
bool all_twt = itwt_args.all_twt->count ? (itwt_args.all_twt->ival[0] ? true : false) : false;
flow_id = (all_twt == true) ? 8 : flow_id;
flow_id = (all_twt == true) ? FLOW_ID_ALL : flow_id;
int suspend_time_ms = itwt_args.suspend_time_ms->count ? itwt_args.suspend_time_ms->ival[0] : 0;
if (flow_id > 0) {
err = esp_wifi_sta_itwt_suspend(flow_id, suspend_time_ms);

View File

@@ -193,7 +193,7 @@ void initialise_wifi(void)
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_BE, true);
#endif
initialized = true;

View File

@@ -17,3 +17,6 @@ CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
CONFIG_LWIP_IP_REASS_MAX_PBUFS=15
CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS=n
CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS=n

View File

@@ -8,18 +8,20 @@ This example shows how to use itwt of wifi.
Itwt only works in station mode. And AP needs to support the capability of itwt.
This example support command "itwt, itwt_probe, itwt_info" to config itwt.
Itwt can works under differnet power save mode.
* itwt: this command is for itwt setup/teardown.
### Modem sleep (supported)
This is default mode. Under this mode, can support console command "itwt, probe" to config itwt.
* itwt_probe: this command will send a probe request to update tsf time with ap
* itwt: this command is for itwt setup/teardown/suspend.
* probe: this command will send a probe request to update tsf time with ap
* itwt_info: this command will send a TWT Information frame to AP for suspending/resuming extablished iTWT agreements.
### Light Sleep (will support)
Need system suport light sleep. Console command will not support in this mode.
### Typical current consumption with Itwt enabled
### Typical current consumption with Itwt disabled

View File

@@ -15,3 +15,6 @@ CONFIG_LWIP_TCP_WND_DEFAULT=34000
CONFIG_LWIP_TCP_RECVMBOX_SIZE=64
CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
CONFIG_ESP_WIFI_ENABLE_WIFI_RX_STATS=n
CONFIG_ESP_WIFI_ENABLE_WIFI_TX_STATS=n