wlan: Send disconnect event to upper layers upon disconnect

Indicate disconnect event to nl80211 and thereby to the supplicant
by invoking cfg80211_disconnect upon disconnect as kernel 3.11 onward
releases will not indicate the same to upper layers.

Call to cfg80211_disconnect also signifies whether disconnect is
triggered by the supplicant or received from the AP by setting the
"from_ap" flag accordingly.

Change-Id: I55028533ebbf03910755da1b35c2fa57d97ce43b
CRs-Fixed: 1016872
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 614487a..d16b9bd 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -14699,6 +14699,15 @@
      hddLog(LOG1,
               FL("Set HDD connState to eConnectionState_NotConnected"));
     pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
+    /* Sending disconnect event to userspace for kernel version < 3.11
+     * is handled by __cfg80211_disconnect call to __cfg80211_disconnected
+     */
+    hddLog(LOG1, FL("Send disconnected event to userspace"));
+
+    wlan_hdd_cfg80211_indicate_disconnect(pAdapter->dev, false,
+                                          WLAN_REASON_UNSPECIFIED);
+#endif
 
     EXIT();
     return result;