diff --git a/components/p2p/core/src/wlan_p2p_main.c b/components/p2p/core/src/wlan_p2p_main.c index 5841ff35b3..dcf2a5f3b3 100644 --- a/components/p2p/core/src/wlan_p2p_main.c +++ b/components/p2p/core/src/wlan_p2p_main.c @@ -889,7 +889,7 @@ QDF_STATUS p2p_psoc_stop(struct wlan_objmgr_psoc *soc) /* clean up queue of p2p psoc private object */ p2p_cleanup_tx_sync(p2p_soc_obj, NULL); - p2p_cleanup_roc_sync(p2p_soc_obj, NULL); + p2p_cleanup_roc(p2p_soc_obj, NULL, true); /* unrgister scan request id*/ wlan_scan_unregister_requester(soc, p2p_soc_obj->scan_req_id); diff --git a/components/p2p/core/src/wlan_p2p_roc.c b/components/p2p/core/src/wlan_p2p_roc.c index d5a33dcdec..9a4f03b1c8 100644 --- a/components/p2p/core/src/wlan_p2p_roc.c +++ b/components/p2p/core/src/wlan_p2p_roc.c @@ -744,9 +744,9 @@ QDF_STATUS p2p_restart_roc_timer(struct p2p_roc_context *roc_ctx) return status; } -QDF_STATUS p2p_cleanup_roc_sync( - struct p2p_soc_priv_obj *p2p_soc_obj, - struct wlan_objmgr_vdev *vdev) +QDF_STATUS p2p_cleanup_roc(struct p2p_soc_priv_obj *p2p_soc_obj, + struct wlan_objmgr_vdev *vdev, + bool sync) { struct scheduler_msg msg = {0}; struct p2p_cleanup_param *param; @@ -758,7 +758,8 @@ QDF_STATUS p2p_cleanup_roc_sync( return QDF_STATUS_E_FAILURE; } - p2p_debug("p2p_soc_obj:%pK, vdev:%pK", p2p_soc_obj, vdev); + p2p_debug("p2p_soc_obj:%pK, vdev:%pK, sync:%d", p2p_soc_obj, vdev, + sync); param = qdf_mem_malloc(sizeof(*param)); if (!param) return QDF_STATUS_E_NOMEM; @@ -781,6 +782,9 @@ QDF_STATUS p2p_cleanup_roc_sync( return status; } + if (!sync) + return status; + status = qdf_wait_single_event( &p2p_soc_obj->cleanup_roc_done, P2P_WAIT_CLEANUP_ROC); diff --git a/components/p2p/core/src/wlan_p2p_roc.h b/components/p2p/core/src/wlan_p2p_roc.h index 37af2bd450..5b75b29169 100644 --- a/components/p2p/core/src/wlan_p2p_roc.h +++ b/components/p2p/core/src/wlan_p2p_roc.h @@ -189,9 +189,10 @@ struct p2p_roc_context *p2p_find_roc_by_chan_freq( QDF_STATUS p2p_restart_roc_timer(struct p2p_roc_context *roc_ctx); /** - * p2p_cleanup_roc_sync() - Cleanup roc context in queue + * p2p_cleanup_roc() - Cleanup roc context in queue * @p2p_soc_obj: p2p psoc private object * @vdev: vdev object + * @sync: whether to wait for complete event * * This function cleanup roc context in queue, include the roc * context in progressing until cancellation done. To avoid deadlock, @@ -199,9 +200,9 @@ QDF_STATUS p2p_restart_roc_timer(struct p2p_roc_context *roc_ctx); * * Return: QDF_STATUS_SUCCESS - in case of success */ -QDF_STATUS p2p_cleanup_roc_sync( - struct p2p_soc_priv_obj *p2p_soc_obj, - struct wlan_objmgr_vdev *vdev); +QDF_STATUS p2p_cleanup_roc(struct p2p_soc_priv_obj *p2p_soc_obj, + struct wlan_objmgr_vdev *vdev, + bool sync); /** * p2p_process_cleanup_roc_queue() - process the message to cleanup roc diff --git a/components/p2p/dispatcher/inc/wlan_p2p_api.h b/components/p2p/dispatcher/inc/wlan_p2p_api.h index 3c7a85da04..d90d533d39 100644 --- a/components/p2p/dispatcher/inc/wlan_p2p_api.h +++ b/components/p2p/dispatcher/inc/wlan_p2p_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -44,12 +44,14 @@ bool wlan_p2p_check_oui_and_force_1x1(uint8_t *assoc_ie, uint32_t ie_len); /** * wlan_p2p_cleanup_roc_by_vdev() - Cleanup roc request by vdev * @vdev: pointer to vdev object + * @sync: whether to wait for complete event * * This function call P2P API to cleanup roc request by vdev * * Return: QDF_STATUS_SUCCESS - in case of success */ -QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev); +QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev, + bool sync); /** * wlan_p2p_status_connect() - Update P2P connection status diff --git a/components/p2p/dispatcher/src/wlan_p2p_api.c b/components/p2p/dispatcher/src/wlan_p2p_api.c index 286a75dea9..1ae8b2194d 100644 --- a/components/p2p/dispatcher/src/wlan_p2p_api.c +++ b/components/p2p/dispatcher/src/wlan_p2p_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -37,7 +37,8 @@ bool wlan_p2p_check_oui_and_force_1x1(uint8_t *assoc_ie, uint32_t assoc_ie_len) return p2p_check_oui_and_force_1x1(assoc_ie, assoc_ie_len); } -QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev) +QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev, + bool sync) { struct p2p_soc_priv_obj *p2p_soc_obj; struct wlan_objmgr_psoc *psoc; @@ -62,7 +63,7 @@ QDF_STATUS wlan_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev) return QDF_STATUS_E_FAILURE; } - return p2p_cleanup_roc_sync(p2p_soc_obj, vdev); + return p2p_cleanup_roc(p2p_soc_obj, vdev, sync); } QDF_STATUS wlan_p2p_status_connect(struct wlan_objmgr_vdev *vdev) diff --git a/components/p2p/dispatcher/src/wlan_p2p_ucfg_api.c b/components/p2p/dispatcher/src/wlan_p2p_ucfg_api.c index f1f53a5998..4fb07ac7fa 100644 --- a/components/p2p/dispatcher/src/wlan_p2p_ucfg_api.c +++ b/components/p2p/dispatcher/src/wlan_p2p_ucfg_api.c @@ -228,7 +228,7 @@ QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc, QDF_STATUS ucfg_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev) { - return wlan_p2p_cleanup_roc_by_vdev(vdev); + return wlan_p2p_cleanup_roc_by_vdev(vdev, true); } QDF_STATUS ucfg_p2p_cleanup_roc_by_psoc(struct wlan_objmgr_psoc *psoc) @@ -246,7 +246,7 @@ QDF_STATUS ucfg_p2p_cleanup_roc_by_psoc(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_FAILURE; } - return p2p_cleanup_roc_sync(obj, NULL); + return p2p_cleanup_roc(obj, NULL, true); } QDF_STATUS ucfg_p2p_cleanup_tx_by_vdev(struct wlan_objmgr_vdev *vdev) diff --git a/components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_disconnect.c b/components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_disconnect.c index a274ef3d77..c8cd419f12 100644 --- a/components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_disconnect.c +++ b/components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_disconnect.c @@ -80,7 +80,7 @@ QDF_STATUS cm_disconnect_start_ind(struct wlan_objmgr_vdev *vdev, user_disconnect = req->source == CM_OSIF_DISCONNECT ? true : false; if (user_disconnect) { - wlan_p2p_cleanup_roc_by_vdev(vdev); + wlan_p2p_cleanup_roc_by_vdev(vdev, false); wlan_tdls_notify_sta_disconnect(req->vdev_id, false, user_disconnect, vdev); }