From f890bbe6162f2dc083a683df33e73fb15c358cfb Mon Sep 17 00:00:00 2001 From: yinqingzhao Date: Tue, 3 Dec 2024 17:15:00 +0800 Subject: [PATCH] feat(wifi): wifi support 80211tx using 11ax and 11ac rate --- components/esp_wifi/include/esp_now.h | 9 +-------- components/esp_wifi/include/esp_wifi.h | 16 ++++++++++++++++ .../esp_wifi/include/esp_wifi_types_generic.h | 11 +++++++++++ components/esp_wifi/lib | 2 +- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/components/esp_wifi/include/esp_now.h b/components/esp_wifi/include/esp_now.h index af7695e258..1fcffa4a0e 100644 --- a/components/esp_wifi/include/esp_now.h +++ b/components/esp_wifi/include/esp_now.h @@ -94,15 +94,8 @@ typedef struct esp_now_recv_info { /** * @brief ESPNOW rate config - * */ -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 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; +typedef wifi_tx_rate_config_t esp_now_rate_config_t; /** * @brief Callback function of receiving ESPNOW data diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index fc321d2036..cce6afaa9c 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -1544,6 +1544,7 @@ esp_err_t esp_wifi_get_country_code(char *country); * @brief Config 80211 tx rate of specified interface * * @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start(). + * @attention 2. Can not set 80211 tx rate under 11A/11AC/11AX protocol, you can use esp_wifi_config_80211_tx instead. * * @param ifx Interface to be configured. * @param rate Phy rate to be configured. @@ -1554,6 +1555,21 @@ esp_err_t esp_wifi_get_country_code(char *country); */ esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); +/** + * @brief Config 80211 tx rate and phymode of specified interface + * + * @attention 1. This API should be called after esp_wifi_init() and before esp_wifi_start(). + + * + * @param ifx Interface to be configured. + * @param config rate_config to be configured. + * + * @return + * - ESP_OK: succeed + * - others: failed + */ +esp_err_t esp_wifi_config_80211_tx(wifi_interface_t ifx, wifi_tx_rate_config_t *config); + /** * @brief Disable PMF configuration for specified interface * diff --git a/components/esp_wifi/include/esp_wifi_types_generic.h b/components/esp_wifi/include/esp_wifi_types_generic.h index a232069fa4..5a12424c1c 100644 --- a/components/esp_wifi/include/esp_wifi_types_generic.h +++ b/components/esp_wifi/include/esp_wifi_types_generic.h @@ -1313,6 +1313,17 @@ typedef struct { uint16_t report_len; /**< Length of the report*/ } wifi_event_neighbor_report_t; +/** + * @brief Argument structure for wifi_tx_rate_config + */ +typedef struct { + wifi_phy_mode_t phymode; /**< Phymode of specified interface */ + wifi_phy_rate_t rate; /**< Rate of specified interface */ + bool ersu; /**< 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; /**< Using dcm rate to send frame */ +} wifi_tx_rate_config_t; + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index f709d89ad9..5c7ffad5b0 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit f709d89ad90f70c93c57b6de3152246d0614f959 +Subproject commit 5c7ffad5b09d600e6677512de45a4db107cf7142