From 22d2deb4ab13ecc5409aba4cf3916bea2f5f7438 Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Fri, 9 Apr 2021 14:57:28 -0700 Subject: [PATCH] qcacld-3.0: Enhance mlme_twt_is_command_in_progress() to return active_cmd Currently, mlme_twt_is_command_in_progress() function checks if the given command is in progress or not. For inputs like WLAN_TWT_ANY, if this function returns true then from the current logs, its not known which active command in progress. Hence for better debugging, enhance this function to return active command. Change-Id: Ibc5c5babb042408b0e8988fe229d344ed98bfff3 CRs-Fixed: 2920494 --- components/mlme/core/inc/wlan_mlme_twt_api.h | 6 ++- components/mlme/core/src/wlan_mlme_twt_api.c | 7 ++- .../dispatcher/inc/wlan_mlme_twt_ucfg_api.h | 13 +++-- core/hdd/src/wlan_hdd_twt.c | 10 ++-- core/sme/src/common/sme_api.c | 54 +++++++++++-------- 5 files changed, 57 insertions(+), 33 deletions(-) diff --git a/components/mlme/core/inc/wlan_mlme_twt_api.h b/components/mlme/core/inc/wlan_mlme_twt_api.h index dca945a96c55..c35ef9f7e651 100644 --- a/components/mlme/core/inc/wlan_mlme_twt_api.h +++ b/components/mlme/core/inc/wlan_mlme_twt_api.h @@ -189,18 +189,20 @@ QDF_STATUS mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc, enum wlan_twt_commands cmd); /** - * mlme_twt_is_command_in_progress() - Get TWT command in progress. + * mlme_twt_is_command_in_progress() - Check if given command is in progress * @psoc: Pointer to psoc object * @peer_mac: Pointer to peer mac address * @dialog_id: Dialog id * @cmd: TWT command + * @active_cmd: Fill the active command in this output parameter * * Return: True if given command is in progress. */ bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc, struct qdf_mac_addr *peer_mac, uint8_t dialog_id, - enum wlan_twt_commands cmd); + enum wlan_twt_commands cmd, + enum wlan_twt_commands *active_cmd); /** * mlme_is_24ghz_twt_enabled() - Get if TWT is enabled on 2.4Ghz diff --git a/components/mlme/core/src/wlan_mlme_twt_api.c b/components/mlme/core/src/wlan_mlme_twt_api.c index 5661e07e0b7a..586b9985dc73 100644 --- a/components/mlme/core/src/wlan_mlme_twt_api.c +++ b/components/mlme/core/src/wlan_mlme_twt_api.c @@ -476,7 +476,8 @@ bool mlme_is_twt_notify_in_progress(struct wlan_objmgr_psoc *psoc, bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc, struct qdf_mac_addr *peer_mac, uint8_t dialog_id, - enum wlan_twt_commands cmd) + enum wlan_twt_commands cmd, + enum wlan_twt_commands *pactive_cmd) { struct wlan_objmgr_peer *peer; struct peer_mlme_priv_obj *peer_priv; @@ -501,6 +502,10 @@ bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc, for (i = 0; i < peer_priv->twt_ctx.num_twt_sessions; i++) { active_cmd = peer_priv->twt_ctx.session_info[i].active_cmd; + + if (pactive_cmd) + *pactive_cmd = active_cmd; + if (peer_priv->twt_ctx.session_info[i].dialog_id == dialog_id || dialog_id == WLAN_ALL_SESSIONS_DIALOG_ID) { if (cmd == WLAN_TWT_ANY) { diff --git a/components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h index d96c46334cf9..6c776f2e5034 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h @@ -217,11 +217,13 @@ ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc, } /** - * ucfg_mlme_twt_is_command_in_progress() - Get TWT command in progress + * ucfg_mlme_twt_is_command_in_progress() - Check if given command is in + * progress * @psoc: Pointer to global PSOC object * @peer_mac: Global peer mac address * @dialog_id: TWT session dialog id * @cmd: TWT command + * @active_cmd: Fill active command in this output parameter * * Return: True if given command is in progress */ @@ -230,9 +232,11 @@ static inline bool ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc, struct qdf_mac_addr *peer_mac, uint8_t dialog_id, - enum wlan_twt_commands cmd) + enum wlan_twt_commands cmd, + enum wlan_twt_commands *active_cmd) { - return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id, cmd); + return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id, + cmd, active_cmd); } static inline QDF_STATUS @@ -520,7 +524,8 @@ static inline bool ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc, struct qdf_mac_addr *peer_mac, uint8_t dialog_id, - enum wlan_twt_commands cmd) + enum wlan_twt_commands cmd, + enum wlan_twt_commands *active_cmd) { return false; } diff --git a/core/hdd/src/wlan_hdd_twt.c b/core/hdd/src/wlan_hdd_twt.c index 45d2cacbe1e1..589d7dfb502f 100644 --- a/core/hdd/src/wlan_hdd_twt.c +++ b/core/hdd/src/wlan_hdd_twt.c @@ -2769,11 +2769,12 @@ static int hdd_twt_clear_session_traffic_stats(struct hdd_adapter *adapter, if (ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc, &hdd_sta_ctx->conn_info.bssid, WLAN_ALL_SESSIONS_DIALOG_ID, - WLAN_TWT_STATISTICS) || + WLAN_TWT_STATISTICS, NULL) || ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc, &hdd_sta_ctx->conn_info.bssid, WLAN_ALL_SESSIONS_DIALOG_ID, - WLAN_TWT_CLEAR_STATISTICS)) { + WLAN_TWT_CLEAR_STATISTICS, + NULL)) { hdd_warn("Already TWT statistics or clear statistics exists"); return -EALREADY; } @@ -2884,11 +2885,12 @@ static int hdd_twt_get_session_traffic_stats(struct hdd_adapter *adapter, if (ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc, &hdd_sta_ctx->conn_info.bssid, WLAN_ALL_SESSIONS_DIALOG_ID, - WLAN_TWT_STATISTICS) || + WLAN_TWT_STATISTICS, NULL) || ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc, &hdd_sta_ctx->conn_info.bssid, WLAN_ALL_SESSIONS_DIALOG_ID, - WLAN_TWT_CLEAR_STATISTICS)) { + WLAN_TWT_CLEAR_STATISTICS, + NULL)) { hdd_warn("Already TWT statistics or clear statistics exists"); return -EALREADY; } diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index ec10f762dc87..6498a1daca72 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -2134,23 +2134,24 @@ sme_process_twt_add_dialog_event(struct mac_context *mac, { bool is_evt_allowed; bool setup_done; - enum WMI_HOST_ADD_TWT_STATUS status; + enum WMI_HOST_ADD_TWT_STATUS status = add_dialog_event->params.status; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; is_evt_allowed = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, - add_dialog_event->params.dialog_id, WLAN_TWT_SETUP); + add_dialog_event->params.dialog_id, WLAN_TWT_SETUP, + &active_cmd); if (!is_evt_allowed) { - sme_debug("add dialog event dropped for id:%d", - add_dialog_event->params.dialog_id); + sme_debug("Drop TWT add dialog event for dialog_id:%d status:%d active_cmd:%d", + add_dialog_event->params.dialog_id, status, active_cmd); return; } setup_done = ucfg_mlme_is_twt_setup_done(mac->psoc, (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, add_dialog_event->params.dialog_id); - status = add_dialog_event->params.status; - sme_debug("setup_done: %d status: %d", setup_done, status); + sme_debug("setup_done:%d status:%d", setup_done, status); if (setup_done && status) { /* This is re-negotiation failure case */ @@ -2192,17 +2193,18 @@ sme_process_twt_del_dialog_event(struct mac_context *mac, { twt_del_dialog_cb callback; bool is_evt_allowed; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; is_evt_allowed = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr, - param->dialog_id, WLAN_TWT_TERMINATE); + param->dialog_id, WLAN_TWT_TERMINATE, &active_cmd); if (!is_evt_allowed && param->dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID && param->status != WMI_HOST_DEL_TWT_STATUS_ROAMING && param->status != WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN && param->status != WMI_HOST_DEL_TWT_STATUS_CONCURRENCY) { - sme_debug("Del dialog event dropped for id:%d status:%d", - param->dialog_id, param->status); + sme_debug("Drop TWT Del dialog event for dialog_id:%d status:%d active_cmd:%d", + param->dialog_id, param->status, active_cmd); return; } @@ -2278,13 +2280,14 @@ sme_process_twt_nudge_dialog_event(struct mac_context *mac, { twt_nudge_dialog_cb callback; bool is_evt_allowed; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; is_evt_allowed = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr, - param->dialog_id, WLAN_TWT_NUDGE); + param->dialog_id, WLAN_TWT_NUDGE, &active_cmd); if (!is_evt_allowed && param->dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID) { - sme_debug("Nudge event dropped"); + sme_debug("Nudge event dropped active_cmd:%d", active_cmd); return; } @@ -14504,6 +14507,7 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle, QDF_STATUS status; void *wma_handle; struct wmi_twt_add_dialog_param *cmd_params; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; SME_ENTER(); @@ -14518,9 +14522,9 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle, is_twt_cmd_in_progress = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)twt_params->peer_macaddr, - twt_params->dialog_id, WLAN_TWT_ANY); + twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd); if (is_twt_cmd_in_progress) { - sme_debug("Already TWT command is in progress"); + sme_debug("Already TWT command:%d is in progress", active_cmd); return QDF_STATUS_E_PENDING; } @@ -14592,6 +14596,7 @@ QDF_STATUS sme_del_dialog_cmd(mac_handle_t mac_handle, QDF_STATUS status; void *wma_handle; struct wmi_twt_del_dialog_param *cmd_params; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; SME_ENTER(); @@ -14599,13 +14604,14 @@ QDF_STATUS sme_del_dialog_cmd(mac_handle_t mac_handle, mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)twt_params->peer_macaddr, - twt_params->dialog_id, WLAN_TWT_SETUP) || + twt_params->dialog_id, WLAN_TWT_SETUP, &active_cmd) || mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)twt_params->peer_macaddr, - twt_params->dialog_id, WLAN_TWT_TERMINATE); + twt_params->dialog_id, WLAN_TWT_TERMINATE, + &active_cmd); if (is_twt_cmd_in_progress) { - sme_debug("Already TWT command is in progress"); + sme_debug("Already TWT command:%d is in progress", active_cmd); return QDF_STATUS_E_PENDING; } @@ -14667,15 +14673,16 @@ sme_pause_dialog_cmd(mac_handle_t mac_handle, bool is_twt_cmd_in_progress; QDF_STATUS status; void *wma_handle; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; SME_ENTER(); is_twt_cmd_in_progress = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)twt_params->peer_macaddr, - twt_params->dialog_id, WLAN_TWT_ANY); + twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd); if (is_twt_cmd_in_progress) { - sme_debug("Already TWT command is in progress"); + sme_debug("Already TWT command:%d is in progress", active_cmd); return QDF_STATUS_E_PENDING; } @@ -14736,17 +14743,19 @@ sme_nudge_dialog_cmd(mac_handle_t mac_handle, bool is_twt_cmd_in_progress; QDF_STATUS status; void *wma_handle; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; SME_ENTER(); is_twt_cmd_in_progress = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)twt_params->peer_macaddr, - twt_params->dialog_id, WLAN_TWT_ANY); + twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd); if (is_twt_cmd_in_progress) { - sme_debug("Already TWT command is in progress"); + sme_debug("Already TWT command:%d is in progress", active_cmd); return QDF_STATUS_E_PENDING; } + wma_handle = cds_get_context(QDF_MODULE_ID_WMA); if (!wma_handle) { sme_err("wma_handle is NULL"); @@ -14804,15 +14813,16 @@ sme_resume_dialog_cmd(mac_handle_t mac_handle, bool is_twt_cmd_in_progress; QDF_STATUS status; void *wma_handle; + enum wlan_twt_commands active_cmd = WLAN_TWT_NONE; SME_ENTER(); is_twt_cmd_in_progress = mlme_twt_is_command_in_progress( mac->psoc, (struct qdf_mac_addr *)twt_params->peer_macaddr, - twt_params->dialog_id, WLAN_TWT_ANY); + twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd); if (is_twt_cmd_in_progress) { - sme_debug("Already TWT command is in progress"); + sme_debug("Already TWT command:%d is in progress", active_cmd); return QDF_STATUS_E_PENDING; }