diff --git a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c index c50a32b07124..6f02665f1a29 100644 --- a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c +++ b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c @@ -1843,6 +1843,20 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx) } } + curr_roc_ctx = p2p_find_roc_by_chan(p2p_soc_obj, tx_ctx->chan); + if (curr_roc_ctx && (curr_roc_ctx->roc_state == ROC_STATE_IDLE)) { + tx_ctx->roc_cookie = (uintptr_t)curr_roc_ctx; + status = qdf_list_insert_back( + &p2p_soc_obj->tx_q_roc, + &tx_ctx->node); + if (status != QDF_STATUS_SUCCESS) { + p2p_err("Failed to insert off chan tx context to wait roc req queue"); + goto fail; + } else { + return QDF_STATUS_SUCCESS; + } + } + status = p2p_roc_req_for_tx_action(tx_ctx); if (status != QDF_STATUS_SUCCESS) { p2p_err("Failed to request roc before off chan tx"); diff --git a/umac/p2p/core/src/wlan_p2p_roc.c b/umac/p2p/core/src/wlan_p2p_roc.c index 2e171a9244b2..c75bfdd28eab 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.c +++ b/umac/p2p/core/src/wlan_p2p_roc.c @@ -631,6 +631,35 @@ struct p2p_roc_context *p2p_find_roc_by_tx_ctx( return NULL; } +struct p2p_roc_context *p2p_find_roc_by_chan( + struct p2p_soc_priv_obj *p2p_soc_obj, uint8_t chan) +{ + struct p2p_roc_context *roc_ctx; + qdf_list_node_t *p_node; + QDF_STATUS status; + + status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node); + while (QDF_IS_STATUS_SUCCESS(status)) { + roc_ctx = qdf_container_of(p_node, + struct p2p_roc_context, + node); + if (roc_ctx->chan == chan) { + p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, tx ctx:%pK, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + roc_ctx->p2p_soc_obj, roc_ctx, + roc_ctx->vdev_id, roc_ctx->scan_id, + roc_ctx->tx_ctx, roc_ctx->chan, + roc_ctx->phy_mode, roc_ctx->duration, + roc_ctx->roc_type, roc_ctx->roc_state); + + return roc_ctx; + } + status = qdf_list_peek_next(&p2p_soc_obj->roc_q, + p_node, &p_node); + } + + return NULL; +} + QDF_STATUS p2p_restart_roc_timer(struct p2p_roc_context *roc_ctx) { QDF_STATUS status = QDF_STATUS_E_FAILURE; diff --git a/umac/p2p/core/src/wlan_p2p_roc.h b/umac/p2p/core/src/wlan_p2p_roc.h index 3ccff8c17297..2bce9a4b68b5 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.h +++ b/umac/p2p/core/src/wlan_p2p_roc.h @@ -139,7 +139,7 @@ QDF_STATUS p2p_mgmt_rx_action_ops(struct wlan_objmgr_psoc *psoc, * p2p_find_current_roc_ctx() - Find out roc context in progressing * @p2p_soc_obj: p2p psoc private object * - * This function find out roc context in progressing from p2p psoc + * This function finds out roc context in progressing from p2p psoc * private object * * Return: Pointer to roc context - success @@ -153,7 +153,7 @@ struct p2p_roc_context *p2p_find_current_roc_ctx( * @p2p_soc_obj: p2p psoc private object * @cookie: cookie is the key to find out roc context * - * This function find out roc context by tx context from p2p psoc + * This function finds out roc context by tx context from p2p psoc * private object * * Return: Pointer to roc context - success @@ -162,6 +162,20 @@ struct p2p_roc_context *p2p_find_current_roc_ctx( struct p2p_roc_context *p2p_find_roc_by_tx_ctx( struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie); +/** + * p2p_find_roc_by_chan() - Find out roc context by channel + * @p2p_soc_obj: p2p psoc private object + * @chan: channel of the ROC + * + * This function finds out roc context by channel from p2p psoc + * private object + * + * Return: Pointer to roc context - success + * NULL - failure + */ +struct p2p_roc_context *p2p_find_roc_by_chan( + struct p2p_soc_priv_obj *p2p_soc_obj, uint8_t chan); + /** * p2p_restart_roc_timer() - Restarts roc timer * @roc_ctx: remain on channel context