diff --git a/core/src/wlan_p2p_off_chan_tx.c b/core/src/wlan_p2p_off_chan_tx.c index 0b6b6d249f9a..51c57f796ed7 100644 --- a/core/src/wlan_p2p_off_chan_tx.c +++ b/core/src/wlan_p2p_off_chan_tx.c @@ -972,6 +972,7 @@ static QDF_STATUS p2p_roc_req_for_tx_action( roc_ctx->duration = tx_ctx->duration; roc_ctx->roc_state = ROC_STATE_IDLE; roc_ctx->roc_type = OFF_CHANNEL_TX; + roc_ctx->tx_ctx = tx_ctx; tx_ctx->roc_cookie = (uintptr_t)roc_ctx; p2p_debug("create roc request for off channel tx, tx ctx:%pK, roc ctx:%pK", @@ -1667,6 +1668,7 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx) ROC_STATE_CANCEL_IN_PROG) { p2p_adjust_tx_wait(tx_ctx); status = p2p_restart_roc_timer(curr_roc_ctx); + curr_roc_ctx->tx_ctx = tx_ctx; if (status != QDF_STATUS_SUCCESS) { p2p_err("restart roc timer fail"); goto fail; @@ -1702,6 +1704,7 @@ QDF_STATUS p2p_process_mgmt_tx_cancel( bool is_roc_q = false; bool is_ack_q = false; struct tx_action_context *cur_tx_ctx; + struct p2p_roc_context *cur_roc_ctx; struct cancel_roc_context cancel_roc; p2p_debug("cookie:0x%llx", cancel_tx->cookie); @@ -1724,6 +1727,19 @@ QDF_STATUS p2p_process_mgmt_tx_cancel( } else { p2p_debug("Failed to find tx ctx by cookie, cookie %llx", cancel_tx->cookie); + + cur_roc_ctx = p2p_find_roc_by_tx_ctx(cancel_tx->p2p_soc_obj, + cancel_tx->cookie); + if (cur_roc_ctx) { + p2p_debug("tx ctx:%llx, roc:%pK", + cancel_tx->cookie, cur_roc_ctx); + cancel_roc.p2p_soc_obj = + cancel_tx->p2p_soc_obj; + cancel_roc.cookie = (uintptr_t) cur_roc_ctx; + return p2p_process_cancel_roc_req(&cancel_roc); + } + + p2p_debug("Failed to find roc by tx ctx"); return QDF_STATUS_E_INVAL; } diff --git a/core/src/wlan_p2p_roc.c b/core/src/wlan_p2p_roc.c index a6eff6ed87cf..44ea9dac8953 100644 --- a/core/src/wlan_p2p_roc.c +++ b/core/src/wlan_p2p_roc.c @@ -184,9 +184,9 @@ static QDF_STATUS p2p_execute_cancel_roc_req( QDF_STATUS status; struct p2p_soc_priv_obj *p2p_soc_obj = roc_ctx->p2p_soc_obj; - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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", p2p_soc_obj, roc_ctx, roc_ctx->vdev_id, - roc_ctx->scan_id, roc_ctx->cookie, roc_ctx->chan, + 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); @@ -231,9 +231,9 @@ static void p2p_roc_timeout(void *pdata) return; } - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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->cookie, roc_ctx->chan, + 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); @@ -338,9 +338,9 @@ static QDF_STATUS p2p_execute_roc_req(struct p2p_roc_context *roc_ctx) uint32_t go_num; struct p2p_soc_priv_obj *p2p_soc_obj = roc_ctx->p2p_soc_obj; - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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", p2p_soc_obj, roc_ctx, roc_ctx->vdev_id, - roc_ctx->scan_id, roc_ctx->cookie, roc_ctx->chan, + 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); @@ -458,9 +458,9 @@ static QDF_STATUS p2p_process_ready_on_channel_evt( p2p_soc_obj = roc_ctx->p2p_soc_obj; roc_ctx->roc_state = ROC_STATE_ON_CHAN; - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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", p2p_soc_obj, roc_ctx, roc_ctx->vdev_id, - roc_ctx->scan_id, roc_ctx->cookie, roc_ctx->chan, + 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); @@ -498,9 +498,9 @@ static QDF_STATUS p2p_process_scan_complete_evt( uint32_t size; struct p2p_soc_priv_obj *p2p_soc_obj = roc_ctx->p2p_soc_obj; - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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", p2p_soc_obj, roc_ctx, roc_ctx->vdev_id, - roc_ctx->scan_id, roc_ctx->cookie, roc_ctx->chan, + 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); @@ -582,12 +582,12 @@ struct p2p_roc_context *p2p_find_current_roc_ctx( struct p2p_roc_context, node); if (roc_ctx->roc_state != ROC_STATE_IDLE) { p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id" - ":%d, scan_id:%d, cookie:%llx, chan:" + ":%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->cookie, roc_ctx->chan, + roc_ctx->tx_ctx, roc_ctx->chan, roc_ctx->phy_mode, roc_ctx->duration, roc_ctx->roc_type, roc_ctx->roc_state); @@ -600,6 +600,28 @@ struct p2p_roc_context *p2p_find_current_roc_ctx( return NULL; } +struct p2p_roc_context *p2p_find_roc_by_tx_ctx( + struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie) +{ + struct p2p_roc_context *curr_roc_ctx; + qdf_list_node_t *p_node; + QDF_STATUS status; + + p2p_debug("p2p soc obj:%pK, cookie:%llx", p2p_soc_obj, cookie); + + status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node); + while (QDF_IS_STATUS_SUCCESS(status)) { + curr_roc_ctx = qdf_container_of(p_node, + struct p2p_roc_context, node); + if ((uintptr_t) curr_roc_ctx->tx_ctx == cookie) + return curr_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; @@ -636,10 +658,10 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj) roc_ctx = qdf_container_of(p_node, struct p2p_roc_context, node); - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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->cookie, roc_ctx->chan, + roc_ctx->tx_ctx, roc_ctx->chan, roc_ctx->phy_mode, roc_ctx->duration, roc_ctx->roc_type, roc_ctx->roc_state); status = qdf_list_peek_next(&p2p_soc_obj->roc_q, @@ -663,9 +685,9 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj) roc_ctx = qdf_container_of(p_node, struct p2p_roc_context, node); - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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->cookie, roc_ctx->chan, + 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); @@ -700,10 +722,10 @@ QDF_STATUS p2p_cleanup_roc_by_vdev( roc_ctx = qdf_container_of(p_node, struct p2p_roc_context, node); - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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->cookie, roc_ctx->chan, + roc_ctx->tx_ctx, roc_ctx->chan, roc_ctx->phy_mode, roc_ctx->duration, roc_ctx->roc_type, roc_ctx->roc_state); status = qdf_list_peek_next(&p2p_soc_obj->roc_q, @@ -727,9 +749,9 @@ QDF_STATUS p2p_cleanup_roc_by_vdev( roc_ctx = qdf_container_of(p_node, struct p2p_roc_context, node); - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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->cookie, roc_ctx->chan, + 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); @@ -760,9 +782,9 @@ QDF_STATUS p2p_process_roc_req(struct p2p_roc_context *roc_ctx) p2p_soc_obj = roc_ctx->p2p_soc_obj; - p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d", + 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", p2p_soc_obj, roc_ctx, roc_ctx->vdev_id, - roc_ctx->scan_id, roc_ctx->cookie, roc_ctx->chan, + 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); diff --git a/core/src/wlan_p2p_roc.h b/core/src/wlan_p2p_roc.h index 2e8d14a18be7..21863e996ae9 100644 --- a/core/src/wlan_p2p_roc.h +++ b/core/src/wlan_p2p_roc.h @@ -77,7 +77,7 @@ enum roc_state { * @p2p_soc_obj: Pointer to SoC global p2p private object * @vdev_id: Vdev id on which this request has come * @scan_id: Scan id given by scan component for this roc req - * @cookie: Cookie which is given to supplicant for this roc req + * @tx_ctx: TX context if this ROC is for tx MGMT * @chan: Chan for which this RoC has been requested * @phy_mode: PHY mode * @duration: Duration for the RoC @@ -90,7 +90,7 @@ struct p2p_roc_context { struct p2p_soc_priv_obj *p2p_soc_obj; uint32_t vdev_id; uint32_t scan_id; - uint64_t cookie; + void *tx_ctx; uint8_t chan; uint8_t phy_mode; uint32_t duration; @@ -135,6 +135,20 @@ QDF_STATUS p2p_mgmt_rx_action_ops(struct wlan_objmgr_psoc *psoc, struct p2p_roc_context *p2p_find_current_roc_ctx( struct p2p_soc_priv_obj *p2p_soc_obj); +/** + * p2p_find_roc_by_tx_ctx() - Find out roc context by tx context + * @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 + * private object + * + * Return: Pointer to roc context - success + * NULL - failure + */ +struct p2p_roc_context *p2p_find_roc_by_tx_ctx( + struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie); + /** * p2p_restart_roc_timer() - Restarts roc timer * @roc_ctx: remain on channel context