From ef4302f003c3f125ec31eda93fdd979136208e34 Mon Sep 17 00:00:00 2001 From: Pragaspathi Thilagaraj Date: Sat, 11 Jul 2020 01:29:36 +0530 Subject: [PATCH] qcacld-3.0: Don't allow roam invoke if roaming offload is not initialized Roam invoke is done by driver if reconnect to same bssid is received or driver FASTREASSOC command is received from the supplicant. If roaming module is not initialized at firmware, then still we send roam invoke to firmware and firmware sends roam invoke failure as part of which disconnection occurs. Check if roaming module is initialized at firmware, else return failure for the reassociation request from userspace. Send failure only if the kernel version is greater than 4.9, since the fix to handle reassociation failure is available from this version. Change-Id: I0feae326be751e50f7327c91739cd7dddab500e9 CRs-Fixed: 2724686 --- core/hdd/src/wlan_hdd_cfg80211.c | 5 +++-- core/hdd/src/wlan_hdd_ioctl.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 930c477a22b8..4826420ba6c0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -20342,10 +20342,11 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, } /* - * Check if this is reassoc to same bssid, if reassoc is success, return + * Check if this is reassoc to same bssid, if reassoc is success or if + * roam invoke is not allowed, return the status */ status = wlan_hdd_reassoc_bssid_hint(adapter, req); - if (!status) + if (!status || status == -EPERM) return status; /* Try disconnecting if already in connected state */ diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index a2cd264e25c3..5b2ccdc36023 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -515,6 +515,32 @@ QDF_STATUS hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, } #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) +/** + * hdd_is_fast_reassoc_allowed - check if roaming offload init is + * done. If roaming offload is not initialized, don't allow roam invoke + * to be triggered. + * @psoc: Pointer to psoc object + * @vdev_id: vdev_id + * + * This API should return true if kernel version is less than 4.9, because + * the earlier versions don't have the fix to handle reassociation failure. + * + * Return: true if roaming module initialization is done else false + */ +static bool +hdd_is_fast_reassoc_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) +{ + return MLME_IS_ROAM_INITIALIZED(psoc, vdev_id); +} +#else +static inline bool +hdd_is_fast_reassoc_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) +{ + return true; +} +#endif + int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, uint32_t ch_freq, const handoff_src src) { @@ -573,6 +599,14 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, /* Proceed with reassoc */ if (roaming_offload_enabled(hdd_ctx)) { + if (!hdd_is_fast_reassoc_allowed(hdd_ctx->psoc, + adapter->vdev_id)) { + hdd_err("LFR3: vdev[%d] Roaming module is not initialized", + adapter->vdev_id); + ret = -EPERM; + goto exit; + } + status = hdd_wma_send_fastreassoc_cmd(adapter, bssid, ch_freq); if (status != QDF_STATUS_SUCCESS) { hdd_err("Failed to send fast reassoc cmd");