From eab259362d1da060fc2aea6213e73495575d8910 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Fri, 13 Jul 2018 11:48:43 +0530 Subject: [PATCH] qcacld-3.0: Add error handling support while sending roam invoke cmd to fw Fix is to allow driver to send roam invoke command to firmware only when roaming is allowed by both driver as well as supplicant for current vdev. Change-Id: I76331c7c73672dd4c73b2cfaaba1e5c01652b982 CRs-Fixed: 2277523 --- core/hdd/inc/wlan_hdd_assoc.h | 11 +++++++---- core/hdd/src/wlan_hdd_ioctl.c | 20 +++++++++++++------- core/sme/src/common/sme_api.c | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_assoc.h b/core/hdd/inc/wlan_hdd_assoc.h index 5770413b567e..30d1bad5737e 100644 --- a/core/hdd/inc/wlan_hdd_assoc.h +++ b/core/hdd/inc/wlan_hdd_assoc.h @@ -359,8 +359,9 @@ void hdd_delete_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id); QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter, uint8_t sta_id); #ifdef WLAN_FEATURE_ROAM_OFFLOAD -void hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, - const tSirMacAddr bssid, int channel); +QDF_STATUS +hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, + const tSirMacAddr bssid, int channel); /** * hdd_save_gtk_params() - Save GTK offload params * @adapter: HDD adapter @@ -372,9 +373,11 @@ void hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, void hdd_save_gtk_params(struct hdd_adapter *adapter, struct csr_roam_info *csr_roam_info, bool is_reassoc); #else -static inline void hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, - const tSirMacAddr bssid, int channel) +static inline QDF_STATUS +hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, + const tSirMacAddr bssid, int channel) { + return QDF_STATUS_SUCCESS; } static inline void hdd_save_gtk_params(struct hdd_adapter *adapter, struct csr_roam_info *csr_roam_info, diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index e60caa4f0f2f..33f768fb9d2c 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -793,8 +793,9 @@ static int hdd_parse_reassoc_command_v1_data(const uint8_t *pValue, } #ifdef WLAN_FEATURE_ROAM_OFFLOAD -void hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, - const tSirMacAddr bssid, int channel) +QDF_STATUS hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, + const tSirMacAddr bssid, + int channel) { struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); @@ -804,9 +805,9 @@ void hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, roam_profile = hdd_roam_profile(adapter); qdf_mem_copy(connected_bssid, hdd_sta_ctx->conn_info.bssId.bytes, ETH_ALEN); - sme_fast_reassoc(adapter->hdd_ctx->mac_handle, roam_profile, - bssid, channel, adapter->session_id, - connected_bssid); + return sme_fast_reassoc(adapter->hdd_ctx->mac_handle, + roam_profile, bssid, channel, + adapter->session_id, connected_bssid); } #endif @@ -827,6 +828,7 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, struct hdd_station_ctx *sta_ctx; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); int ret = 0; + QDF_STATUS status; if (hdd_ctx == NULL) { hdd_err("Invalid hdd ctx"); @@ -869,8 +871,12 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, /* Proceed with reassoc */ if (roaming_offload_enabled(hdd_ctx)) { - hdd_wma_send_fastreassoc_cmd(adapter, - bssid, (int)channel); + status = hdd_wma_send_fastreassoc_cmd(adapter, + bssid, (int)channel); + if (status != QDF_STATUS_SUCCESS) { + hdd_err("Failed to send fast reassoc cmd"); + ret = -EINVAL; + } } else { tCsrHandoffRequest handoff; diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index f95869e02e4a..b416715babf0 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -15008,7 +15008,23 @@ QDF_STATUS sme_fast_reassoc(tHalHandle hal, struct csr_roam_profile *profile, struct wma_roam_invoke_cmd *fastreassoc; struct scheduler_msg msg = {0}; tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + struct csr_roam_session *session; + struct csr_roam_profile *roam_profile; + session = CSR_GET_SESSION(mac_ctx, vdev_id); + if (!session || !session->pCurRoamProfile) { + sme_err("session %d not found", vdev_id); + return QDF_STATUS_E_FAILURE; + } + + roam_profile = session->pCurRoamProfile; + if (roam_profile->supplicant_disabled_roaming || + roam_profile->driver_disabled_roaming) { + sme_debug("roaming status in Supplicant %d and in driver %d", + roam_profile->supplicant_disabled_roaming, + roam_profile->driver_disabled_roaming); + return QDF_STATUS_E_FAILURE; + } fastreassoc = qdf_mem_malloc(sizeof(*fastreassoc)); if (NULL == fastreassoc) { sme_err("qdf_mem_malloc failed for fastreassoc");