diff --git a/umac/p2p/core/src/wlan_p2p_roc.c b/umac/p2p/core/src/wlan_p2p_roc.c index 0f7dc7871100..cff85f4e2a38 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.c +++ b/umac/p2p/core/src/wlan_p2p_roc.c @@ -663,7 +663,67 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj) status = qdf_wait_single_event( &p2p_soc_obj->cancel_roc_done, P2P_WAIT_CANCEL_ROC); - p2p_err("roc cancellation done, status:%d", status); + p2p_debug("roc cancellation done, status:%d", status); + } + } + + return status; +} + +QDF_STATUS p2p_cleanup_roc_by_vdev( + struct p2p_soc_priv_obj *p2p_soc_obj, uint32_t vdev_id) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct p2p_roc_context *roc_ctx; + qdf_list_node_t *tmp, *pos; + + p2p_debug("clean up idle roc request, roc queue size:%d, vdev id:%d", + qdf_list_size(&p2p_soc_obj->roc_q), vdev_id); + list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) { + roc_ctx = list_entry(pos, struct p2p_roc_context, + node); + + p2p_debug("p2p soc obj:%p, roc ctx:%p, vdev_id:%d, scan_id:%d, cookie:%llx, 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->phy_mode, roc_ctx->duration, + roc_ctx->roc_type, roc_ctx->roc_state); + + if (roc_ctx->roc_state == ROC_STATE_IDLE && + roc_ctx->vdev_id == vdev_id) { + status = qdf_list_remove_node( + &p2p_soc_obj->roc_q, + (qdf_list_node_t *)roc_ctx); + if (status == QDF_STATUS_SUCCESS) + qdf_mem_free(roc_ctx); + else + p2p_err("Failed to remove roc ctx from queue"); + } + } + + p2p_debug("clean up started roc request, roc queue size:%d", + qdf_list_size(&p2p_soc_obj->roc_q)); + list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) { + roc_ctx = list_entry(pos, struct p2p_roc_context, + node); + + p2p_debug("p2p soc obj:%p, roc ctx:%p, vdev_id:%d, scan_id:%d, cookie:%llx, 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->phy_mode, roc_ctx->duration, + roc_ctx->roc_type, roc_ctx->roc_state); + + if (roc_ctx->roc_state != ROC_STATE_IDLE && + roc_ctx->vdev_id == vdev_id) { + if (roc_ctx->roc_state != + ROC_STATE_CANCEL_IN_PROG) + p2p_execute_cancel_roc_req(roc_ctx); + + status = qdf_wait_single_event( + &p2p_soc_obj->cancel_roc_done, + P2P_WAIT_CANCEL_ROC); + p2p_debug("RoC cancellation done, status:%d", status); } } @@ -719,7 +779,7 @@ QDF_STATUS p2p_process_cancel_roc_req( p2p_soc_obj, cancel_roc_ctx->cookie, curr_roc_ctx); if (!curr_roc_ctx) { - p2p_err("Failed to find roc req by cookie, cookie %llx", + p2p_debug("Failed to find roc req by cookie, cookie %llx", cancel_roc_ctx->cookie); return QDF_STATUS_E_INVAL; } diff --git a/umac/p2p/core/src/wlan_p2p_roc.h b/umac/p2p/core/src/wlan_p2p_roc.h index 3eb8b5114fc3..2e8d14a18be7 100644 --- a/umac/p2p/core/src/wlan_p2p_roc.h +++ b/umac/p2p/core/src/wlan_p2p_roc.h @@ -157,6 +157,19 @@ QDF_STATUS p2p_restart_roc_timer(struct p2p_roc_context *roc_ctx); QDF_STATUS p2p_cleanup_roc_queue( struct p2p_soc_priv_obj *p2p_soc_obj); +/** + * p2p_cleanup_roc_by_vdev() - Cleanup roc context by vdev id + * @p2p_soc_obj: p2p psoc private object + * @vdev_id: vdev id + * + * This function cleanup roc context by vdev id, include the roc + * context in progressing. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS p2p_cleanup_roc_by_vdev( + struct p2p_soc_priv_obj *p2p_soc_obj, uint32_t vdev_id); + /** * p2p_process_roc_req() - Process roc request * @roc_ctx: roc request context diff --git a/umac/p2p/dispatcher/inc/wlan_p2p_ucfg_api.h b/umac/p2p/dispatcher/inc/wlan_p2p_ucfg_api.h index 6e861307f89c..228da46ccb50 100644 --- a/umac/p2p/dispatcher/inc/wlan_p2p_ucfg_api.h +++ b/umac/p2p/dispatcher/inc/wlan_p2p_ucfg_api.h @@ -199,6 +199,16 @@ QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc, QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc, uint64_t cookie); +/** + * ucfg_p2p_cleanup_roc() - Cleanup roc request by vdev + * @vdev: pointer to vdev object + * + * This function call P2P API to cleanup roc request by vdev. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS ucfg_p2p_cleanup_roc(struct wlan_objmgr_vdev *vdev); + /** * ucfg_p2p_mgmt_tx() - Mgmt frame tx request * @soc: soc context diff --git a/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c b/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c index 4278d8cb783e..2ab8046b0c94 100644 --- a/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c +++ b/umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c @@ -190,6 +190,38 @@ QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc, return QDF_STATUS_SUCCESS; } +QDF_STATUS ucfg_p2p_cleanup_roc(struct wlan_objmgr_vdev *vdev) +{ + struct wlan_objmgr_psoc *psoc; + struct p2p_soc_priv_obj *p2p_soc_obj; + uint32_t vdev_id; + + p2p_debug("vdev:%p", vdev); + + if (!vdev) { + p2p_err("null vdev"); + return QDF_STATUS_E_INVAL; + } + + wlan_vdev_obj_lock(vdev); + vdev_id = (uint32_t)wlan_vdev_get_id(vdev); + psoc = wlan_vdev_get_psoc(vdev); + wlan_vdev_obj_unlock(vdev); + if (!psoc) { + p2p_err("null psoc"); + return QDF_STATUS_E_INVAL; + } + + p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_UMAC_COMP_P2P); + if (!p2p_soc_obj) { + p2p_err("p2p soc context is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return p2p_cleanup_roc_by_vdev(p2p_soc_obj, vdev_id); +} + QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc, struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie) {