qcacld-3.0: Report HT TX STBC capability to kernel

Propagate from qcacld-2.0 to qcacld-3.0

Currently the driver does not report HT TX STBC capability
to the kernel. This prevents hostapd from starting if it
has been configured with HT TX STBC capability. To prevent
this issue correctly report the HT TX STBC capability to the
kernel.

CRs-Fixed: 1046306
Change-Id: Id182de3916f4e556dde30048776ea07b0fbfdc7d
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index ba5c336..0e198ad 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -8947,8 +8947,8 @@
 }
 
 /**
- * wlan_hdd_cfg80211_deinit - Deinit cfg80211
- * @ wiphy: the wiphy to validate against
+ * wlan_hdd_cfg80211_deinit() - Deinit cfg80211
+ * @wiphy: the wiphy to validate against
  *
  * this function deinit cfg80211 and cleanup the
  * memory allocated in wlan_hdd_cfg80211_init also
@@ -8970,15 +8970,50 @@
 	hdd_reset_global_reg_params();
 }
 
+/**
+ * wlan_hdd_update_band_cap() - update capabilities for supported bands
+ * @hdd_ctx: HDD context
+ *
+ * this function will update capabilities for supported bands
+ *
+ * Return: void
+ */
+static void wlan_hdd_update_band_cap(hdd_context_t *hdd_ctx)
+{
+	uint32_t val32;
+	uint16_t val16;
+	tSirMacHTCapabilityInfo *ht_cap_info;
+	QDF_STATUS status;
+
+	status = sme_cfg_get_int(hdd_ctx->hHal, WNI_CFG_HT_CAP_INFO, &val32);
+	if (QDF_STATUS_SUCCESS != status) {
+		hdd_err("could not get HT capability info");
+		val32 = 0;
+	}
+	val16 = (uint16_t)val32;
+	ht_cap_info = (tSirMacHTCapabilityInfo *)&val16;
+
+	if (ht_cap_info->txSTBC == true) {
+		if (NULL != hdd_ctx->wiphy->bands[NL80211_BAND_2GHZ])
+			hdd_ctx->wiphy->bands[NL80211_BAND_2GHZ]->ht_cap.cap |=
+						IEEE80211_HT_CAP_TX_STBC;
+		if (NULL != hdd_ctx->wiphy->bands[NL80211_BAND_5GHZ])
+			hdd_ctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap |=
+						IEEE80211_HT_CAP_TX_STBC;
+	}
+}
+
 /*
  * In this function, wiphy structure is updated after QDF
  * initialization. In wlan_hdd_cfg80211_init, only the
  * default values will be initialized. The final initialization
  * of all required members can be done here.
  */
-void wlan_hdd_update_wiphy(struct wiphy *wiphy, struct hdd_config *pCfg)
+void wlan_hdd_update_wiphy(hdd_context_t *hdd_ctx)
 {
-	wiphy->max_ap_assoc_sta = pCfg->maxNumberOfPeers;
+	hdd_ctx->wiphy->max_ap_assoc_sta = hdd_ctx->config->maxNumberOfPeers;
+
+	wlan_hdd_update_band_cap(hdd_ctx);
 }
 
 /* In this function we are registering wiphy. */
@@ -8987,7 +9022,6 @@
 	ENTER();
 	/* Register our wiphy dev with cfg80211 */
 	if (0 > wiphy_register(wiphy)) {
-		/* print error */
 		hdd_err("wiphy register failed");
 		return -EIO;
 	}