diff --git a/core/hdd/src/wlan_hdd_twt.c b/core/hdd/src/wlan_hdd_twt.c index 8604670b7cb4..b0aee95553a5 100644 --- a/core/hdd/src/wlan_hdd_twt.c +++ b/core/hdd/src/wlan_hdd_twt.c @@ -1086,8 +1086,10 @@ hdd_twt_setup_pack_resp_nlmsg(struct sk_buff *reply_skb, return QDF_STATUS_E_FAILURE; } - if (event->params.num_additional_twt_params == 0) + if (event->params.num_additional_twt_params == 0) { + nla_nest_end(reply_skb, config_attr); return QDF_STATUS_SUCCESS; + } response_type = wmi_twt_add_cmd_to_vendor_twt_resp_type(event->additional_params.twt_cmd); if (response_type == -EINVAL) { @@ -1255,14 +1257,6 @@ hdd_twt_add_dialog_comp_cb(struct wlan_objmgr_psoc *psoc, add_dialog_event->params.status, vdev_id, QDF_MAC_ADDR_REF(add_dialog_event->params.peer_macaddr)); hdd_send_twt_setup_response(adapter, add_dialog_event); - - if (add_dialog_event->params.status) - return; - - ucfg_mlme_set_twt_setup_done( - adapter->hdd_ctx->psoc, - (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, - add_dialog_event->params.dialog_id, true); } /** diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 24fdc8a5bd7c..e852c6adb6e5 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -2074,7 +2074,8 @@ sme_process_twt_add_dialog_event(struct mac_context *mac, (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, add_dialog_event->params.dialog_id, WLAN_TWT_SETUP); if (!is_evt_allowed) { - sme_debug("add dialog event dropped"); + sme_debug("add dialog event dropped for id:%d", + add_dialog_event->params.dialog_id); return; } @@ -2082,17 +2083,29 @@ sme_process_twt_add_dialog_event(struct mac_context *mac, if (callback) callback(mac->psoc, add_dialog_event); - ucfg_mlme_set_twt_session_state( - mac->psoc, - (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, - add_dialog_event->params.dialog_id, - WLAN_TWT_SETUP_STATE_ACTIVE); - /* Reset the active TWT command to none */ mlme_set_twt_command_in_progress( mac->psoc, (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, add_dialog_event->params.dialog_id, WLAN_TWT_NONE); + + if (add_dialog_event->params.status) { + /* Clear the stored TWT dialog ID as TWT setup failed */ + ucfg_mlme_init_twt_context(mac->psoc, (struct qdf_mac_addr *) + add_dialog_event->params.peer_macaddr, + add_dialog_event->params.dialog_id); + return; + } + + ucfg_mlme_set_twt_setup_done(mac->psoc, (struct qdf_mac_addr *) + add_dialog_event->params.peer_macaddr, + add_dialog_event->params.dialog_id, true); + + ucfg_mlme_set_twt_session_state( + mac->psoc, + (struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr, + add_dialog_event->params.dialog_id, + WLAN_TWT_SETUP_STATE_ACTIVE); } /** @@ -2117,7 +2130,8 @@ sme_process_twt_del_dialog_event(struct mac_context *mac, 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) { - sme_debug("add dialog event dropped"); + sme_debug("Del dialog event dropped for id:%d", + param->dialog_id); return; } diff --git a/core/wma/src/wma_twt.c b/core/wma/src/wma_twt.c index 9cb4602ec166..3b2bdab7ff6e 100644 --- a/core/wma/src/wma_twt.c +++ b/core/wma/src/wma_twt.c @@ -224,7 +224,8 @@ int wma_twt_add_dialog_complete_event_handler(void *handle, return qdf_status_to_os_return(status); } - wma_debug("TWT: Extract TWT add dialog event :%d", status); + wma_debug("TWT: Extract TWT add dialog event id:%d", + add_dialog_event->params.dialog_id); sme_msg.type = eWNI_SME_TWT_ADD_DIALOG_EVENT; sme_msg.bodyptr = add_dialog_event;