Browse Source

qcacld-3.0: Set 2g vht20 cfg by both target capability and ini config

2g vht20 config should be decided by both capability indicated
by target and ini config. Only when F/W indicates 2g vht20
supported and ini config gEnableVhtFor24GHzBand=1, 2g vht20 is
enabled.

Change-Id: I5b7ad8f82b6000096327c501dc84ad05480ef0fd
CRs-Fixed: 2381514
Jianmin Zhu 6 years ago
parent
commit
c8bfffb89d

+ 10 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -1808,6 +1808,16 @@ wlan_mlme_get_vht_enable_gid(struct wlan_objmgr_psoc *psoc, bool *value);
 QDF_STATUS
 wlan_mlme_get_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value);
 
+/**
+ * wlan_mlme_set_vht_for_24ghz() - Enables/disables VHT for 24 ghz
+ * @psoc: psoc context
+ * @value: data to be set
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_mlme_set_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool value);
+
 /**
  * wlan_mlme_get_vendor_vht_for_24ghz() - nables/disables vendor VHT for 24 ghz
  * @psoc: psoc context

+ 16 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -2297,6 +2297,22 @@ ucfg_mlme_get_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value)
 	return wlan_mlme_get_vht_for_24ghz(psoc, value);
 }
 
+/**
+ * ucfg_mlme_set_vht_for_24ghz() - Enables/disables vht for 24ghz
+ * @psoc: psoc context
+ * @value: data to be set
+ *
+ * Inline UCFG API to be used by HDD/OSIF callers to set the
+ * ignore_peer_ht_opmode flag value
+ *
+ * Return: QDF_STATUS_SUCCESS or QDF_STATUS_FAILURE
+ */
+static inline QDF_STATUS
+ucfg_mlme_set_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool value)
+{
+	return wlan_mlme_set_vht_for_24ghz(psoc, value);
+}
+
 /**
  * ucfg_mlme_get_vendor_vht_for_24ghz() - Enables/disables vendor vht for 24ghz
  * @psoc: psoc context

+ 14 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -2732,6 +2732,20 @@ wlan_mlme_get_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value)
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+wlan_mlme_set_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool value)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj)
+		return QDF_STATUS_E_FAILURE;
+
+	mlme_obj->cfg.vht_caps.vht_cap_info.b24ghz_band = value;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 wlan_mlme_get_vendor_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value)
 {

+ 32 - 0
core/hdd/src/wlan_hdd_main.c

@@ -1815,6 +1815,33 @@ static void hdd_sar_target_config(struct hdd_context *hdd_ctx,
 	hdd_ctx->sar_version = cfg->sar_version;
 }
 
+static void hdd_update_vhtcap_2g(struct hdd_context *hdd_ctx)
+{
+	uint32_t chip_mode;
+	QDF_STATUS status;
+	bool b24ghz_band;
+
+	status = wlan_reg_get_chip_mode(hdd_ctx->pdev, &chip_mode);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to get chip mode");
+		return;
+	}
+	status = ucfg_mlme_get_vht_for_24ghz(hdd_ctx->psoc, &b24ghz_band);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to get 2g vht mode");
+		return;
+	}
+
+	b24ghz_band = b24ghz_band &&
+		      (chip_mode & WMI_HOST_REGDMN_MODE_11AC_VHT20);
+	status = ucfg_mlme_set_vht_for_24ghz(hdd_ctx->psoc, b24ghz_band);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		hdd_err("Failed to update 2g vht mode");
+		return;
+	}
+	hdd_debug("2g vht20: %d", b24ghz_band);
+}
+
 void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg)
 {
 	int ret;
@@ -2032,6 +2059,11 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg)
 	 */
 	hdd_update_wiphy_vhtcap(hdd_ctx);
 
+	/*
+	 * Update 2g vht capability
+	 */
+	hdd_update_vhtcap_2g(hdd_ctx);
+
 	hdd_ctx->wmi_max_len = cfg->wmi_max_len;
 
 	/*