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 4aa1f44c93e6..75fbcd3c54e8 100644 --- a/umac/p2p/core/src/wlan_p2p_off_chan_tx.c +++ b/umac/p2p/core/src/wlan_p2p_off_chan_tx.c @@ -1034,22 +1034,17 @@ static struct tx_action_context *p2p_find_tx_ctx( * p2p_find_tx_ctx_by_roc() - find tx context by roc * @p2p_soc_obj: p2p soc object * @cookie: cookie to roc context - * @is_roc_q: it is in waiting for roc queue - * @is_ack_q: it is in waiting for ack queue * * This function finds out tx context by roc context. * * Return: pointer to tx context */ static struct tx_action_context *p2p_find_tx_ctx_by_roc( - struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie, - bool *is_roc_q, bool *is_ack_q) + struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie) { struct tx_action_context *cur_tx_ctx; qdf_list_node_t *p_node; QDF_STATUS status; - *is_roc_q = false; - *is_ack_q = false; p2p_debug("Start to find tx ctx, p2p soc_obj:%pK, cookie:%llx", p2p_soc_obj, cookie); @@ -1059,7 +1054,6 @@ static struct tx_action_context *p2p_find_tx_ctx_by_roc( cur_tx_ctx = qdf_container_of(p_node, struct tx_action_context, node); if (cur_tx_ctx->roc_cookie == cookie) { - *is_roc_q = true; p2p_debug("find tx ctx, cookie:%llx", cookie); return cur_tx_ctx; } @@ -1067,19 +1061,6 @@ static struct tx_action_context *p2p_find_tx_ctx_by_roc( p_node, &p_node); } - status = qdf_list_peek_front(&p2p_soc_obj->tx_q_ack, &p_node); - while (QDF_IS_STATUS_SUCCESS(status)) { - cur_tx_ctx = qdf_container_of(p_node, - struct tx_action_context, node); - if (cur_tx_ctx->roc_cookie == cookie) { - *is_ack_q = true; - p2p_debug("find tx ctx, cookie:%llx", cookie); - return cur_tx_ctx; - } - status = qdf_list_peek_next(&p2p_soc_obj->tx_q_ack, - p_node, &p_node); - } - return NULL; } @@ -1639,31 +1620,19 @@ void p2p_dump_tx_queue(struct p2p_soc_priv_obj *p2p_soc_obj) QDF_STATUS p2p_ready_to_tx_frame(struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie) { - bool is_roc_q = false; - bool is_ack_q = false; struct tx_action_context *cur_tx_ctx; - QDF_STATUS status = QDF_STATUS_E_FAILURE; + QDF_STATUS status = QDF_STATUS_SUCCESS; - cur_tx_ctx = p2p_find_tx_ctx_by_roc(p2p_soc_obj, cookie, - &is_roc_q, &is_ack_q); - p2p_debug("tx_ctx:%pK, is_roc_q:%d, is_ack_q:%d", cur_tx_ctx, - is_roc_q, is_ack_q); - if (cur_tx_ctx) { - if (is_roc_q) { - status = p2p_execute_tx_action_frame(cur_tx_ctx); - if (status != QDF_STATUS_SUCCESS) { - p2p_send_tx_conf(cur_tx_ctx, false); - p2p_remove_tx_context(cur_tx_ctx); - } + cur_tx_ctx = p2p_find_tx_ctx_by_roc(p2p_soc_obj, cookie); + + while (cur_tx_ctx) { + p2p_debug("tx_ctx:%pK", cur_tx_ctx); + status = p2p_execute_tx_action_frame(cur_tx_ctx); + if (status != QDF_STATUS_SUCCESS) { + p2p_send_tx_conf(cur_tx_ctx, false); + p2p_remove_tx_context(cur_tx_ctx); } - if (is_ack_q) { - p2p_debug("Already sent and waiting for ack"); - status = QDF_STATUS_SUCCESS; - } - } else { - p2p_debug("Failed to find tx ctx by cookie, cookie %llx", - cookie); - status = QDF_STATUS_E_INVAL; + cur_tx_ctx = p2p_find_tx_ctx_by_roc(p2p_soc_obj, cookie); } return status; @@ -1768,8 +1737,18 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx) /* For off channel tx case */ curr_roc_ctx = p2p_find_current_roc_ctx(p2p_soc_obj); if (curr_roc_ctx && (curr_roc_ctx->chan == tx_ctx->chan)) { - if (curr_roc_ctx->roc_state != - ROC_STATE_CANCEL_IN_PROG) { + if ((curr_roc_ctx->roc_state == ROC_STATE_REQUESTED) || + (curr_roc_ctx->roc_state == ROC_STATE_STARTED)) { + 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; + } else if (curr_roc_ctx->roc_state == ROC_STATE_ON_CHAN) { p2p_adjust_tx_wait(tx_ctx); status = p2p_restart_roc_timer(curr_roc_ctx); curr_roc_ctx->tx_ctx = tx_ctx; diff --git a/umac/p2p/core/src/wlan_p2p_roc.c b/umac/p2p/core/src/wlan_p2p_roc.c index 979f92ec3260..12893878bb68 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.c +++ b/umac/p2p/core/src/wlan_p2p_roc.c @@ -479,13 +479,12 @@ static QDF_STATUS p2p_process_ready_on_channel_evt( p2p_debug("user required roc, send roc event"); status = p2p_send_roc_event(roc_ctx, ROC_EVENT_READY_ON_CHAN); - } else { - p2p_debug("roc for off chan tx, ready to send frame"); - cookie = (uintptr_t)roc_ctx; - /* ready to tx frame */ - p2p_ready_to_tx_frame(p2p_soc_obj, cookie); } + cookie = (uintptr_t)roc_ctx; + /* ready to tx frame */ + p2p_ready_to_tx_frame(p2p_soc_obj, cookie); + return status; }