fix(esp_wifi): Making action tx and roc API's public

This commit is contained in:
tarun.kumar
2025-02-05 17:08:05 +05:30
committed by BOT
parent 2ea5e8afa3
commit 895e897ee7
7 changed files with 52 additions and 22 deletions

View File

@@ -513,7 +513,7 @@ lmacRecycleMPDU = 0x40001b44;
lmacRxDone = 0x40001b48;
/*lmacSetTxFrame = 0x40001b4c;*/
lmacTxDone = 0x40001b50;
lmacTxFrame = 0x40001b54;
/*lmacTxFrame = 0x40001b54;*/
mac_tx_set_duration = 0x40001b58;
mac_tx_set_htsig = 0x40001b5c;
mac_tx_set_plcp0 = 0x40001b60;

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -1788,6 +1788,29 @@ esp_err_t esp_wifi_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t* bw);
*/
esp_err_t esp_wifi_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw);
/**
* @brief Send action frame on target channel
*
* @param req action tx request structure containing relevant fields
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_NO_MEM: failed to allocate memory
* - ESP_FAIL: failed to send frame
*/
esp_err_t esp_wifi_action_tx_req(wifi_action_tx_req_t *req);
/**
* @brief Remain on the target channel for required duration
*
* @param req roc request structure containing relevant fields
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_NO_MEM: failed to allocate memory
* - ESP_FAIL: failed to perform roc operation
*/
esp_err_t esp_wifi_remain_on_channel(wifi_roc_req_t * req);
#ifdef __cplusplus
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -41,15 +41,15 @@ typedef enum {
WIFI_IF_MAX /**< Maximum number of interfaces */
} wifi_interface_t;
enum {
typedef enum {
WIFI_OFFCHAN_TX_CANCEL, /**< Cancel off-channel transmission */
WIFI_OFFCHAN_TX_REQ, /**< Request off-channel transmission */
};
} wifi_action_tx_t;
enum {
typedef enum {
WIFI_ROC_CANCEL, /**< Cancel remain on channel */
WIFI_ROC_REQ, /**< Request remain on channel */
};
} wifi_roc_t;
/**
* @brief Wi-Fi country policy
*/
@@ -774,8 +774,11 @@ typedef int (* wifi_action_rx_cb_t)(uint8_t *hdr, uint8_t *payload,
typedef struct {
wifi_interface_t ifx; /**< Wi-Fi interface to send request to */
uint8_t dest_mac[6]; /**< Destination MAC address */
wifi_action_tx_t type; /**< ACTION TX operation type */
uint8_t channel; /**< Channel on which to perform ACTION TX Operation */
uint32_t wait_time_ms; /**< Duration to wait for on target channel */
bool no_ack; /**< Indicates no ack required */
wifi_action_rx_cb_t rx_cb; /**< Rx Callback to receive any response */
wifi_action_rx_cb_t rx_cb; /**< Rx Callback to receive action frames */
uint8_t op_id; /**< Unique Identifier for operation provided by wifi driver */
uint32_t data_len; /**< Length of the appended Data */
uint8_t data[0]; /**< Appended Data payload */
@@ -805,7 +808,7 @@ typedef void (* wifi_action_roc_done_cb_t)(uint32_t context, uint8_t op_id,
*/
typedef struct {
wifi_interface_t ifx; /**< WiFi interface to send request to */
uint8_t type; /**< ROC operation type */
wifi_roc_t type; /**< ROC operation type */
uint8_t channel; /**< Channel on which to perform ROC Operation */
wifi_second_chan_t sec_channel; /**< Secondary channel */
uint32_t wait_time_ms; /**< Duration to wait for on target channel */
@@ -1236,6 +1239,7 @@ typedef struct {
#define WIFI_STATIS_ALL (-1) /**< All status */
/** Status codes for WIFI_EVENT_ACTION_TX_STATUS evt */
/** There will be back to back events in success case TX_DONE and TX_DURATION_COMPLETED */
typedef enum {
WIFI_ACTION_TX_DONE = 0, /**< ACTION_TX operation was completed successfully */
WIFI_ACTION_TX_FAILED, /**< ACTION_TX operation failed during tx */

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -101,7 +101,7 @@ static void esp_dpp_auth_conf_wait_timeout(void *eloop_ctx, void *timeout_ctx)
esp_err_t esp_dpp_send_action_frame(uint8_t *dest_mac, const uint8_t *buf, uint32_t len,
uint8_t channel, uint32_t wait_time_ms)
{
wifi_action_tx_req_t *req = os_zalloc(sizeof(*req) + len);;
wifi_action_tx_req_t *req = os_zalloc(sizeof(*req) + len);
if (!req) {
return ESP_FAIL;
}
@@ -111,13 +111,15 @@ esp_err_t esp_dpp_send_action_frame(uint8_t *dest_mac, const uint8_t *buf, uint3
req->no_ack = false;
req->data_len = len;
req->rx_cb = s_action_rx_cb;
req->channel = channel;
req->wait_time_ms = wait_time_ms;
req->type = WIFI_OFFCHAN_TX_REQ;
memcpy(req->data, buf, req->data_len);
wpa_printf(MSG_DEBUG, "DPP: Mgmt Tx - MAC:" MACSTR ", Channel-%d, WaitT-%d",
MAC2STR(dest_mac), channel, wait_time_ms);
if (ESP_OK != esp_wifi_action_tx_req(WIFI_OFFCHAN_TX_REQ, channel,
wait_time_ms, req)) {
if (ESP_OK != esp_wifi_action_tx_req(req)) {
wpa_printf(MSG_ERROR, "DPP: Failed to perform offchannel operation");
esp_dpp_call_cb(ESP_SUPP_DPP_FAIL, (void *)ESP_ERR_DPP_TX_FAILURE);
os_free(req);
@@ -665,8 +667,8 @@ static void offchan_event_handler(void *arg, esp_event_base_t event_base,
wifi_event_action_tx_status_t *evt =
(wifi_event_action_tx_status_t *)event_data;
if (evt->op_id == s_current_tx_op_id) {
wpa_printf(MSG_DEBUG, "Mgmt Tx Status - %d, Context - 0x%x Operation ID : %d",
evt->status, (uint32_t)evt->context, evt->op_id);
wpa_printf(MSG_DEBUG,
"Mgmt Tx Status - %d, Context - 0x%x Operation ID : %d", evt->status, (uint32_t)evt->context, evt->op_id);
if (evt->status == WIFI_ACTION_TX_FAILED) {
eloop_cancel_timeout(esp_dpp_auth_conf_wait_timeout, NULL, NULL);

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -284,9 +284,6 @@ bool esp_wifi_is_btm_enabled_internal(uint8_t if_index);
esp_err_t esp_wifi_register_mgmt_frame_internal(uint32_t type, uint32_t subtype);
esp_err_t esp_wifi_send_mgmt_frm_internal(const wifi_mgmt_frm_req_t *req);
uint8_t esp_wifi_ap_get_prof_pairwise_cipher_internal(void);
esp_err_t esp_wifi_action_tx_req(uint8_t type, uint8_t channel,
uint32_t wait_time_ms, wifi_action_tx_req_t *req);
esp_err_t esp_wifi_remain_on_channel(wifi_roc_req_t * req);
bool esp_wifi_is_mbo_enabled_internal(uint8_t if_index);
void esp_wifi_get_pmf_config_internal(wifi_pmf_config_t *pmf_cfg, uint8_t ifx);
bool esp_wifi_is_ft_enabled_internal(uint8_t if_index);

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*
@@ -137,12 +137,16 @@ void esp_send_action_frame(uint8_t *dest_mac, const uint8_t *buf, uint32_t len,
req->no_ack = false;
req->data_len = len;
req->rx_cb = dummy_rx_action;
req->channel = channel;
req->wait_time_ms = wait_time_ms;
req->type = WIFI_OFFCHAN_TX_REQ;
memcpy(req->data, buf, req->data_len);
ESP_LOGI(TAG, "Action Tx - MAC:" MACSTR ", Channel-%d, WaitT-%" PRId32 "",
MAC2STR(dest_mac), channel, wait_time_ms);
TEST_ESP_OK(esp_wifi_action_tx_req(WIFI_OFFCHAN_TX_REQ, channel, wait_time_ms, req));
TEST_ESP_OK(esp_wifi_action_tx_req(req));
os_free(req);
}