qcacld-3.0: 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.

qcacld-2.0 to qcacld-3.0 propagation

Change-Id: I55028533ebbf03910755da1b35c2fa57d97ce43b
CRs-Fixed: 1016872
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index c91fa41..a3ab748 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -2551,4 +2551,23 @@
 
 void hdd_get_bpf_offload_cb(void *hdd_context, struct sir_bpf_get_offload *);
 void hdd_init_bpf_completion(void);
+
+#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,
+							bool locally_generated,
+							int reason)
+{
+	cfg80211_disconnected(dev, reason, NULL, 0,
+				locally_generated, GFP_KERNEL);
+}
+#else
+static inline void wlan_hdd_cfg80211_indicate_disconnect(struct net_device *dev,
+							bool locally_generated,
+							int reason)
+{
+	cfg80211_disconnected(dev, reason, NULL, 0,
+				GFP_KERNEL);
+}
+#endif
 #endif