qcacld-3.0: Add ini support for tcp_adv_win_scale

WLAN driver changes this system paramerter (via cnss-daemon) when the RX
throughput requirement changes LOW->HIGH or HIGH->LOW. This depends on
the whether the number of RX packets received in last 100ms interval is
greater than 500 or not. The 100ms and 500 thresh params are
configurable via WLAN ini file WCNSS_qcom_cfg.ini.

Add ini support to enable/disable changing of this system parameter by
WLAN driver. Since tcp_adv_win_scale is a system parameter, some
customers may not want the WLAN driver to change it and may want to set
their own default values.

"gTcpAdvWinScaleEnable=0" when added to the ini file will prevent
the driver from making any changes to the system parameter
"/proc/sys/net/ipv4/tcp_adv_win_scale". The default value of the ini
file param gTcpAdvWinScaleEnable is "1".

CRs-Fixed: 2033338
Change-Id: I19288bba11841cf176118abaf08ccaabaf2f79b9
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 2a45634..19f1ec6 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -8012,6 +8012,25 @@
 #define CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_DEFAULT (100)
 #define CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MIN     (0)
 #define CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MAX     (10000)
+/*
+ * <ini>
+ * gTcpAdvWinScaleEnable - Control to enable  TCP adv window scaling
+ * @Min: -0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to enable dynamic configuration of TCP adv window scaling system parameter.
+ *
+ * Supported Feature: Tcp Advance Window Scaling
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_TCP_ADV_WIN_SCALE                      "gTcpAdvWinScaleEnable"
+#define CFG_ENABLE_TCP_ADV_WIN_SCALE_DEFAULT              (1)
+#define CFG_ENABLE_TCP_ADV_WIN_SCALE_MIN                  (0)
+#define CFG_ENABLE_TCP_ADV_WIN_SCALE_MAX                  (1)
 
 /*
  * <ini>
@@ -14040,6 +14059,7 @@
 	uint32_t busBandwidthLowThreshold;
 	uint32_t busBandwidthComputeInterval;
 	uint32_t enable_tcp_delack;
+	uint32_t enable_tcp_adv_win_scale;
 	uint32_t tcpDelackThresholdHigh;
 	uint32_t tcpDelackThresholdLow;
 	uint32_t tcp_tx_high_tput_thres;
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index c79da6d..96bbd55 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -3210,6 +3210,13 @@
 		     CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MIN,
 		     CFG_BUS_BANDWIDTH_COMPUTE_INTERVAL_MAX),
 
+	REG_VARIABLE(CFG_ENABLE_TCP_ADV_WIN_SCALE, WLAN_PARAM_Integer,
+		     struct hdd_config, enable_tcp_adv_win_scale,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_ENABLE_TCP_ADV_WIN_SCALE_DEFAULT,
+		     CFG_ENABLE_TCP_ADV_WIN_SCALE_MIN,
+		     CFG_ENABLE_TCP_ADV_WIN_SCALE_MAX),
+
 	REG_VARIABLE(CFG_ENABLE_TCP_DELACK, WLAN_PARAM_Integer,
 		     struct hdd_config, enable_tcp_delack,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -6572,6 +6579,9 @@
 	hdd_debug("Name = [gbusBandwidthComputeInterval] Value = [%u] ",
 		  hdd_ctx->config->busBandwidthComputeInterval);
 	hdd_debug("Name = [%s] Value = [%u] ",
+		  CFG_ENABLE_TCP_ADV_WIN_SCALE,
+		  hdd_ctx->config->enable_tcp_adv_win_scale);
+	hdd_debug("Name = [%s] Value = [%u] ",
 		  CFG_ENABLE_TCP_DELACK,
 		  hdd_ctx->config->enable_tcp_delack);
 	hdd_debug("Name = [gTcpDelAckThresholdHigh] Value = [%u] ",
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 9568bac..ade06d2 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -6508,7 +6508,9 @@
 		if (hdd_ctx->config->enable_tcp_delack)
 			rx_tp_data.rx_tp_flags |= TCP_DEL_ACK_IND;
 
-		rx_tp_data.rx_tp_flags |= TCP_ADV_WIN_SCL;
+		if (hdd_ctx->config->enable_tcp_adv_win_scale)
+			rx_tp_data.rx_tp_flags |= TCP_ADV_WIN_SCL;
+
 		rx_tp_data.level = next_rx_level;
 		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
 				WLAN_SVC_WLAN_TP_IND, &rx_tp_data,