diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index 90bec0f13acc..4dbc2c9071f5 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -3693,6 +3693,16 @@ int wlan_hdd_disable_dfs_chan_scan(hdd_context_t *hdd_ctx, int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand); +/** + * wlan_hdd_try_disconnect() - try disconnnect from previous connection + * @pAdapter: Pointer to adapter + * + * This function is used to disconnect from previous connection + * + * Return: 0 for success, non-zero for failure + */ +int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter); + #if defined(CFG80211_DISCONNECTED_V2) || \ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)) static inline void wlan_hdd_cfg80211_indicate_disconnect(struct net_device *dev, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4b0f69e9a851..60b4979ad159 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3671,8 +3671,13 @@ QDF_STATUS hdd_stop_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, * It is possible that the caller of this function does not * wish to close the session */ - if (true == bCloseSession) + if (true == bCloseSession) { + if (0 != wlan_hdd_try_disconnect(adapter)) { + hdd_err("Error: Can't disconnect adapter"); + return QDF_STATUS_E_FAILURE; + } hdd_wait_for_sme_close_sesion(hdd_ctx, adapter); + } break; case QDF_SAP_MODE: diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 214e20f9eebf..7b127c957a4a 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1712,9 +1712,6 @@ typedef QDF_STATUS (*csr_roamSessionCloseCallback)(void *pContext); #define CSR_IS_CONN_NDI(profile) (false) #endif -#define CSR_IS_CLOSE_SESSION_COMMAND(pCommand) \ - ((pCommand)->command == eSmeCommandDelStaSession) - QDF_STATUS csr_set_channels(tHalHandle hHal, tCsrConfigParam *pParam); QDF_STATUS csr_set_reg_info(tHalHandle hHal, uint8_t *apCntryCode); diff --git a/core/sme/inc/sme_inside.h b/core/sme/inc/sme_inside.h index fbc63490bd83..aef6c647b1c9 100644 --- a/core/sme/inc/sme_inside.h +++ b/core/sme/inc/sme_inside.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -223,11 +223,7 @@ bool csr_roam_is_valid40_mhz_channel(tpAniSirGlobal pmac, uint8_t channel); QDF_STATUS sme_acquire_global_lock(tSmeStruct *psSme); QDF_STATUS sme_release_global_lock(tSmeStruct *psSme); -QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac, - tSmeCmd *pCommand); QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg); -QDF_STATUS csr_process_del_sta_session_command(tpAniSirGlobal pMac, - tSmeCmd *pCommand); QDF_STATUS csr_process_del_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg); #ifdef FEATURE_WLAN_SCAN_PNO diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 4bc6f9b14f66..f5556cda9c8a 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -60,8 +60,6 @@ typedef enum eSmeCommandType { eSmeCommandRoam, eSmeCommandWmStatusChange, eSmeCommandSetKey, - eSmeCommandAddStaSession, - eSmeCommandDelStaSession, #ifdef FEATURE_WLAN_TDLS /* * eSmeTdlsCommandMask = 0x80000, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 3150a0dd5ba9..61734a3830d0 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -874,25 +874,6 @@ sme_process_cmd: if (CSR_IS_WAIT_FOR_KEY(pMac, pCommand->sessionId) && !CSR_IS_DISCONNECT_COMMAND(pCommand) && !CSR_IS_SET_KEY_COMMAND(pCommand)) { - if (CSR_IS_CLOSE_SESSION_COMMAND(pCommand)) { - tSmeCmd *sme_cmd = NULL; - - sms_log(pMac, LOGE, - FL("SessionId %d: close session command issued while waiting for key, issue disconnect first"), - pCommand->sessionId); - status = csr_prepare_disconnect_command(pMac, - pCommand->sessionId, &sme_cmd); - if (status == QDF_STATUS_SUCCESS && sme_cmd) { - csr_ll_lock(&pMac->sme.smeCmdPendingList); - csr_ll_insert_head(&pMac->sme.smeCmdPendingList, - &sme_cmd->Link, LL_ACCESS_NOLOCK); - pEntry = csr_ll_peek_head( - &pMac->sme.smeCmdPendingList, - LL_ACCESS_NOLOCK); - csr_ll_unlock(&pMac->sme.smeCmdPendingList); - goto sme_process_cmd; - } - } csr_ll_unlock(&pMac->sme.smeCmdActiveList); sms_log(pMac, LOGE, @@ -941,10 +922,6 @@ sme_process_cmd: csr_release_command_set_key(pMac, pCommand); } break; - case eSmeCommandAddStaSession: - csr_ll_unlock(&pMac->sme.smeCmdActiveList); - csr_process_add_sta_session_command(pMac, pCommand); - break; case eSmeCommandNdpInitiatorRequest: csr_ll_unlock(&pMac->sme.smeCmdActiveList); if (csr_process_ndp_initiator_request(pMac, pCommand) != @@ -972,10 +949,6 @@ sme_process_cmd: csr_release_command(pMac, pCommand); } break; - case eSmeCommandDelStaSession: - csr_ll_unlock(&pMac->sme.smeCmdActiveList); - csr_process_del_sta_session_command(pMac, pCommand); - break; case eSmeCommandRemainOnChannel: csr_ll_unlock(&pMac->sme.smeCmdActiveList); p2p_process_remain_on_channel_cmd(pMac, pCommand); diff --git a/core/sme/src/common/sme_trace.c b/core/sme/src/common/sme_trace.c index 751dcca1cfa8..057cd63c53c3 100644 --- a/core/sme/src/common/sme_trace.c +++ b/core/sme/src/common/sme_trace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -181,8 +181,6 @@ static uint8_t *sme_trace_get_command_string(uint32_t command) CASE_RETURN_STRING(eSmeCommandRoam); CASE_RETURN_STRING(eSmeCommandWmStatusChange); CASE_RETURN_STRING(eSmeCommandSetKey); - CASE_RETURN_STRING(eSmeCommandAddStaSession); - CASE_RETURN_STRING(eSmeCommandDelStaSession); #ifdef FEATURE_WLAN_TDLS CASE_RETURN_STRING(eSmeCommandTdlsSendMgmt); CASE_RETURN_STRING(eSmeCommandTdlsAddPeer); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index e825c63c0f94..3100f214120d 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -15260,8 +15260,6 @@ static QDF_STATUS csr_roam_session_opened(tpAniSirGlobal pMac, QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) { - tListElem *pEntry = NULL; - tSmeCmd *pCommand = NULL; struct add_sta_self_params *rsp; struct send_extcap_ie *msg; QDF_STATUS status; @@ -15270,18 +15268,6 @@ QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) sms_log(pMac, LOGE, "in %s msg ptr is NULL", __func__); return QDF_STATUS_E_FAILURE; } - pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); - if (!pEntry) { - sms_log(pMac, LOGE, "in %s NO commands are ACTIVE ...", - __func__); - return QDF_STATUS_E_FAILURE; - } - pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); - if (eSmeCommandAddStaSession != pCommand->command) { - sms_log(pMac, LOGE, "in %s Cmd not in active list ...", - __func__); - return QDF_STATUS_E_FAILURE; - } rsp = (struct add_sta_self_params *) pMsg; sms_log(pMac, LOG1, "Add Sta self rsp status = %d", rsp->status); @@ -15305,14 +15291,7 @@ QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) FL("Failed to send down the set IE req ")); } - csr_roam_session_opened(pMac, pCommand->sessionId); - /* Remove this command out of the active list */ - if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList, pEntry, - LL_ACCESS_LOCK)) { - /* Now put this command back on the avilable command list */ - csr_release_command(pMac, pCommand); - } - sme_process_pending_queue(pMac); + csr_roam_session_opened(pMac, rsp->session_id); return QDF_STATUS_SUCCESS; } @@ -15377,39 +15356,9 @@ QDF_STATUS csr_issue_add_sta_for_session_req(tpAniSirGlobal pMac, uint32_t type, uint32_t subType) { QDF_STATUS status = QDF_STATUS_SUCCESS; - tSmeCmd *pCommand; - pCommand = csr_get_command_buffer(pMac); - if (NULL == pCommand) { - status = QDF_STATUS_E_RESOURCES; - } else { - pCommand->command = eSmeCommandAddStaSession; - pCommand->sessionId = (uint8_t) sessionId; - qdf_mem_copy(pCommand->u.addStaSessionCmd.selfMacAddr, - sessionMacAddr, sizeof(tSirMacAddr)); - pCommand->u.addStaSessionCmd.currDeviceMode = - pMac->sme.currDeviceMode; - pCommand->u.addStaSessionCmd.type = type; - pCommand->u.addStaSessionCmd.subType = subType; - status = csr_queue_sme_command(pMac, pCommand, true); - if (!QDF_IS_STATUS_SUCCESS(status)) { - /* Should be panic?? */ - sms_log(pMac, LOGE, - FL(" fail to send message status = %d"), status); - } - } - return status; -} - -QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac, - tSmeCmd *pCommand) -{ - tAddStaForSessionCmd *pAddStaReq = - &pCommand->u.addStaSessionCmd; - uint8_t sessionId = pCommand->sessionId; struct add_sta_self_params *add_sta_self_req; uint8_t nss_2g; uint8_t nss_5g; - QDF_STATUS status = QDF_STATUS_E_NOMEM; struct scheduler_msg msg; add_sta_self_req = qdf_mem_malloc(sizeof(struct add_sta_self_params)); @@ -15420,14 +15369,14 @@ QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac, return status; } - csr_get_vdev_type_nss(pMac, pAddStaReq->currDeviceMode, + csr_get_vdev_type_nss(pMac, pMac->sme.currDeviceMode, &nss_2g, &nss_5g); - qdf_mem_copy(add_sta_self_req->self_mac_addr, pAddStaReq->selfMacAddr, + qdf_mem_copy(add_sta_self_req->self_mac_addr, sessionMacAddr, sizeof(tSirMacAddr)); - add_sta_self_req->curr_device_mode = pAddStaReq->currDeviceMode; + add_sta_self_req->curr_device_mode = pMac->sme.currDeviceMode; add_sta_self_req->session_id = sessionId; - add_sta_self_req->type = pAddStaReq->type; - add_sta_self_req->sub_type = pAddStaReq->subType; + add_sta_self_req->type = type; + add_sta_self_req->sub_type = subType; add_sta_self_req->nss_2g = nss_2g; add_sta_self_req->nss_5g = nss_5g; add_sta_self_req->tx_aggregation_size = @@ -15662,8 +15611,6 @@ QDF_STATUS csr_roam_open_session(tpAniSirGlobal mac_ctx, QDF_STATUS csr_process_del_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) { QDF_STATUS status = QDF_STATUS_E_FAILURE; - tListElem *pEntry = NULL; - tSmeCmd *pCommand = NULL; struct del_sta_self_params *rsp; uint8_t sessionId; @@ -15671,28 +15618,17 @@ QDF_STATUS csr_process_del_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) sms_log(pMac, LOGE, FL("msg ptr is NULL")); return status; } - pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); - if (!pEntry) { - sms_log(pMac, LOGE, FL("NO commands are ACTIVE ...")); - return status; - } - pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); - sessionId = pCommand->sessionId; - if (eSmeCommandDelStaSession != pCommand->command) { - sms_log(pMac, LOGE, FL("NO Del sta session command ACTIVE")); - return status; - } rsp = (struct del_sta_self_params *) pMsg; + sessionId = rsp->session_id; sms_log(pMac, LOG1, FL("Del Sta rsp status = %d"), rsp->status); /* This session is done. */ csr_cleanup_session(pMac, sessionId); - if (pCommand->u.delStaSessionCmd.callback) { + if (rsp->sme_callback) { status = sme_release_global_lock(&pMac->sme); if (!QDF_IS_STATUS_SUCCESS(status)) sms_log(pMac, LOG1, FL("Failed to Release Lock")); else { - pCommand->u.delStaSessionCmd. - callback(pCommand->u.delStaSessionCmd.pContext); + rsp->sme_callback(rsp->sme_ctx); status = sme_acquire_global_lock(&pMac->sme); if (!QDF_IS_STATUS_SUCCESS(status)) { sms_log(pMac, LOG1, FL("Failed to get Lock")); @@ -15700,15 +15636,8 @@ QDF_STATUS csr_process_del_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg) } } } - /* Remove this command out of the active list */ - if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList, pEntry, - LL_ACCESS_LOCK)) { - /* Now put this command back on the avilable command list */ - csr_release_command(pMac, pCommand); - } - sme_process_pending_queue(pMac); - status = QDF_STATUS_SUCCESS; - return status; + + return QDF_STATUS_SUCCESS; } @@ -15717,31 +15646,6 @@ csr_issue_del_sta_for_session_req(tpAniSirGlobal pMac, uint32_t sessionId, tSirMacAddr sessionMacAddr, csr_roamSessionCloseCallback callback, void *pContext) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tSmeCmd *pCommand; - pCommand = csr_get_command_buffer(pMac); - if (NULL == pCommand) { - status = QDF_STATUS_E_RESOURCES; - } else { - pCommand->command = eSmeCommandDelStaSession; - pCommand->sessionId = (uint8_t) sessionId; - pCommand->u.delStaSessionCmd.callback = callback; - pCommand->u.delStaSessionCmd.pContext = pContext; - qdf_mem_copy(pCommand->u.delStaSessionCmd.selfMacAddr, - sessionMacAddr, sizeof(tSirMacAddr)); - status = csr_queue_sme_command(pMac, pCommand, true); - if (!QDF_IS_STATUS_SUCCESS(status)) { - /* Should be panic?? */ - sms_log(pMac, LOGE, - FL(" fail to send message status = %d"), status); - } - } - return status; -} - -QDF_STATUS csr_process_del_sta_session_command(tpAniSirGlobal pMac, - tSmeCmd *pCommand) { struct del_sta_self_params *del_sta_self_req; struct scheduler_msg msg; @@ -15754,10 +15658,11 @@ QDF_STATUS csr_process_del_sta_session_command(tpAniSirGlobal pMac, } qdf_mem_copy(del_sta_self_req->self_mac_addr, - pCommand->u.delStaSessionCmd.selfMacAddr, - sizeof(tSirMacAddr)); + sessionMacAddr, sizeof(tSirMacAddr)); - del_sta_self_req->session_id = pCommand->sessionId; + del_sta_self_req->session_id = sessionId; + del_sta_self_req->sme_callback = callback; + del_sta_self_req->sme_ctx = pContext; msg.type = WMA_DEL_STA_SELF_REQ; msg.reserved = 0; msg.bodyptr = del_sta_self_req; diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index 29ccc9d9c872..8fc563cd1ff7 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -1277,11 +1277,15 @@ typedef struct sAbortScanParams { * struct del_sta_self_params - Del Sta Self params * @session_id: SME Session ID * @status: response status code + * @sme_callback: callback to be called from WMA to SME + * @sme_ctx: pointer to context provided by SME */ struct del_sta_self_params { tSirMacAddr self_mac_addr; uint8_t session_id; uint32_t status; + QDF_STATUS (*sme_callback) (void *sme_ctx); + void *sme_ctx; }; /**