wlan: Use cfg80211_roamed_bss API to indicate the roaming

After disconnect request, the driver sends disconnect
indication to the kernel and it schedules a workqueue to
process this disconnect event. Now if this workqueue is
delayed and connect request is received before its
scheduled, the disconnect event workqueue reset the
ssid_len of the wdev.

Now as the ssid_len does not match with bss ssid length the
get bss returns NULL and thus roam indication is not sent
to supplicant.

To fix this use cfg80211_roamed_bss to indicate the roaming
and use the ssid and ssid len from driver to get the bss.

Change-Id: I5b88ce41951cb61582ee801be124ca0b5b6b825b
CRs-Fixed: 1098150
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 88bab0b..f3c6f66 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -9364,6 +9364,45 @@
 }
 
 /**
+ * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
+ * @wiphy: wiphy
+ * @channel: channel of the BSS to find
+ * @bssid: bssid of the BSS to find
+ * @ssid: ssid of the BSS to find
+ * @ssid_len: ssid len of of the BSS to find
+ *
+ * The API is a wrapper to get bss from kernel matching the chan,
+ * bssid and ssid
+ *
+ * Return: Void
+ */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) \
+    && !defined(WITH_BACKPORTS) && !defined(IEEE80211_PRIVACY)
+
+struct cfg80211_bss* hdd_get_bss_entry(struct wiphy *wiphy,
+      struct ieee80211_channel *channel,
+      const u8 *bssid,
+      const u8 *ssid, size_t ssid_len)
+{
+   return cfg80211_get_bss(wiphy, channel, bssid,
+           ssid, ssid_len,
+           WLAN_CAPABILITY_ESS,
+           WLAN_CAPABILITY_ESS);
+}
+#else
+struct cfg80211_bss* hdd_get_bss_entry(struct wiphy *wiphy,
+      struct ieee80211_channel *channel,
+      const u8 *bssid,
+      const u8 *ssid, size_t ssid_len)
+{
+   return cfg80211_get_bss(wiphy, channel, bssid,
+           ssid, ssid_len,
+           IEEE80211_BSS_TYPE_ESS,
+           IEEE80211_PRIVACY_ANY);
+}
+#endif
+
+/**
  * hdd_connect_result() - API to send connection status to supplicant
  * @dev: network device
  * @bssid: bssid to which we want to associate
@@ -9406,18 +9445,10 @@
                   IEEE80211_BAND_5GHZ);
 
        chan = ieee80211_get_channel(padapter->wdev.wiphy, freq);
-
-       bss = cfg80211_get_bss(padapter->wdev.wiphy, chan, bssid,
-             roam_info->u.pConnectedProfile->SSID.ssId,
-             roam_info->u.pConnectedProfile->SSID.length,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) \
-    && !defined(WITH_BACKPORTS) && !defined(IEEE80211_PRIVACY)
-             WLAN_CAPABILITY_ESS
-             WLAN_CAPABILITY_ESS);
-#else
-             IEEE80211_BSS_TYPE_ESS,
-             IEEE80211_PRIVACY_ANY);
-#endif
+       bss = hdd_get_bss_entry(padapter->wdev.wiphy,
+              chan, bssid,
+              roam_info->u.pConnectedProfile->SSID.ssId,
+              roam_info->u.pConnectedProfile->SSID.length);
    }
 
    cfg80211_connect_bss(dev, bssid, bss, req_ie, req_ie_len,