qcacld-3.0: Add INI to force the P2p-Go to 11n for 11AC

The existing INI gSapForce11NFor11AC forces both P2P-Go and  SAP to 11n for
11AC. Add gGoForce11NFor11AC to force SAP and GO separately.

Change-Id: I26dce96ec582bed0ff3c62bd5f06fc96e85f0ee4
CRs-Fixed: 2140051
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 72bc8e6..2a45634 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -9901,6 +9901,11 @@
 #define CFG_SAP_FORCE_11N_FOR_11AC_MAX     (1)
 #define CFG_SAP_FORCE_11N_FOR_11AC_DEFAULT (0)
 
+#define CFG_GO_FORCE_11N_FOR_11AC_NAME    "gGoForce11NFor11AC"
+#define CFG_GO_FORCE_11N_FOR_11AC_MIN     (0)
+#define CFG_GO_FORCE_11N_FOR_11AC_MAX     (1)
+#define CFG_GO_FORCE_11N_FOR_11AC_DEFAULT (0)
+
 /*
  * sap tx leakage threshold
  * customer can set this value from 100 to 1000 which means
@@ -14257,6 +14262,7 @@
 	bool indoor_channel_support;
 	/* parameter to force sap into 11n */
 	bool sap_force_11n_for_11ac;
+	bool go_force_11n_for_11ac;
 	uint16_t sap_tx_leakage_threshold;
 	bool multicast_replay_filter;
 	/* parameter for indicating sifs burst duration to fw */
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index b9ed97c..c79da6d 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -4366,6 +4366,13 @@
 		     CFG_SAP_FORCE_11N_FOR_11AC_MIN,
 		     CFG_SAP_FORCE_11N_FOR_11AC_MAX),
 
+	REG_VARIABLE(CFG_GO_FORCE_11N_FOR_11AC_NAME, WLAN_PARAM_Integer,
+		     struct hdd_config, go_force_11n_for_11ac,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_GO_FORCE_11N_FOR_11AC_DEFAULT,
+		     CFG_GO_FORCE_11N_FOR_11AC_MIN,
+		     CFG_GO_FORCE_11N_FOR_11AC_MAX),
+
 	REG_VARIABLE(CFG_INTERFACE_CHANGE_WAIT_NAME, WLAN_PARAM_Integer,
 			struct hdd_config, iface_change_wait_time,
 			VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK,
@@ -6881,6 +6888,9 @@
 		CFG_SAP_FORCE_11N_FOR_11AC_NAME,
 		hdd_ctx->config->sap_force_11n_for_11ac);
 	hdd_debug("Name = [%s] Value = [%d]",
+		CFG_GO_FORCE_11N_FOR_11AC_NAME,
+		hdd_ctx->config->go_force_11n_for_11ac);
+	hdd_debug("Name = [%s] Value = [%d]",
 		CFG_BPF_PACKET_FILTER_OFFLOAD,
 		hdd_ctx->config->bpf_packet_filter_enable);
 	hdd_debug("Name = [%s] Value = [%u]",
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index e41e189..bb18d1f 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -2563,7 +2563,10 @@
 	else
 		vht_enabled = 0;
 
-	if (hdd_ctx->config->sap_force_11n_for_11ac) {
+	if (((adapter->device_mode == QDF_SAP_MODE) &&
+	     (hdd_ctx->config->sap_force_11n_for_11ac)) ||
+	     ((adapter->device_mode == QDF_P2P_GO_MODE) &&
+	     (hdd_ctx->config->go_force_11n_for_11ac))) {
 		vht_enabled = 0;
 		hdd_log(LOG1, FL("VHT is Disabled in ACS"));
 	}
@@ -2577,7 +2580,9 @@
 			ch_width = 20;
 	}
 
-	/* this may be possible, when sap_force_11n_for_11ac is set */
+	/* this may be possible, when sap_force_11n_for_11ac or
+	 * go_force_11n_for_11ac is set
+	 */
 	if ((ch_width == 80 || ch_width == 160) && !vht_enabled) {
 		if (ht_enabled && ht40_enabled)
 			ch_width = 40;
@@ -2683,7 +2688,10 @@
 	sap_config->acs_cfg.band = hw_mode;
 	/* ACS override for android */
 	if (hdd_ctx->config->sap_p2p_11ac_override && ht_enabled &&
-	    !hdd_ctx->config->sap_force_11n_for_11ac) {
+	    !(((adapter->device_mode == QDF_SAP_MODE) &&
+	      (hdd_ctx->config->sap_force_11n_for_11ac)) ||
+	      ((adapter->device_mode == QDF_P2P_GO_MODE) &&
+	      (hdd_ctx->config->go_force_11n_for_11ac)))) {
 		hdd_debug("ACS Config override for 11AC vhtChannelWidth %d",
 			hdd_ctx->config->vhtChannelWidth);
 		vht_enabled = 1;
diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c
index b939581..a77aa11 100644
--- a/core/hdd/src/wlan_hdd_hostapd.c
+++ b/core/hdd/src/wlan_hdd_hostapd.c
@@ -7322,8 +7322,11 @@
 			sap_cfg->SapHw_mode == eCSR_DOT11_MODE_11ac_ONLY ||
 			sap_cfg->SapHw_mode == eCSR_DOT11_MODE_11ax ||
 			sap_cfg->SapHw_mode == eCSR_DOT11_MODE_11ax_ONLY) &&
-			!hdd_ctx->config->sap_force_11n_for_11ac) {
-		hdd_debug("** Driver force override for SAP/Go **");
+			!(((ap_adapter->device_mode == QDF_SAP_MODE) &&
+			(hdd_ctx->config->sap_force_11n_for_11ac)) ||
+			((ap_adapter->device_mode == QDF_P2P_GO_MODE) &&
+			(hdd_ctx->config->go_force_11n_for_11ac)))) {
+		hdd_debug("** Driver force 11AC override for SAP/Go **");
 
 		/* 11n only shall not be overridden since it may be on purpose*/
 		if (sap_cfg->SapHw_mode == eCSR_DOT11_MODE_11n)
@@ -7396,7 +7399,10 @@
 			sap_cfg->SapHw_mode = eCSR_DOT11_MODE_11ac;
 	}
 
-	if (hdd_ctx->config->sap_force_11n_for_11ac) {
+	if (((ap_adapter->device_mode == QDF_SAP_MODE) &&
+	     (hdd_ctx->config->sap_force_11n_for_11ac)) ||
+	     ((ap_adapter->device_mode == QDF_P2P_GO_MODE) &&
+	     (hdd_ctx->config->go_force_11n_for_11ac))) {
 		if (sap_cfg->SapHw_mode == eCSR_DOT11_MODE_11ac ||
 		    sap_cfg->SapHw_mode == eCSR_DOT11_MODE_11ac_ONLY)
 			sap_cfg->SapHw_mode = eCSR_DOT11_MODE_11n;
@@ -7944,7 +7950,10 @@
 	if (!cds_is_sub_20_mhz_enabled())
 		wlan_hdd_set_sap_hwmode(adapter);
 
-	if (hdd_ctx->config->sap_force_11n_for_11ac) {
+	if (((adapter->device_mode == QDF_SAP_MODE) &&
+	     (hdd_ctx->config->sap_force_11n_for_11ac)) ||
+	     ((adapter->device_mode == QDF_P2P_GO_MODE) &&
+	     (hdd_ctx->config->go_force_11n_for_11ac))) {
 		if (pConfig->SapHw_mode == eCSR_DOT11_MODE_11ac ||
 		    pConfig->SapHw_mode == eCSR_DOT11_MODE_11ac_ONLY)
 			pConfig->SapHw_mode = eCSR_DOT11_MODE_11n;
@@ -7966,7 +7975,10 @@
 		sme_config->csrConfig.WMMSupportMode = eCsrRoamWmmNoQos;
 	sme_update_config(hdd_ctx->hHal, sme_config);
 
-	if (!hdd_ctx->config->sap_force_11n_for_11ac) {
+	if (!((adapter->device_mode == QDF_SAP_MODE) &&
+	     (hdd_ctx->config->sap_force_11n_for_11ac)) ||
+	     ((adapter->device_mode == QDF_P2P_GO_MODE) &&
+	     (hdd_ctx->config->go_force_11n_for_11ac))) {
 		pConfig->ch_width_orig =
 			hdd_map_nl_chan_width(pConfig->ch_width_orig);
 	} else {