Browse Source

qcacld-3.0: Introduce TWT INI items

Introduce the below configuration items for
Target Wake Time feature.
enable_twt: Enable/Disable the TWT feature using this configuration
item.
twt_congestion_timeout: This ini is used to configure the target wake
time congestion timeout value in the units of milliseconds.STA uses this
timer to continuously monitor channel congestion levels to decide
whether to start or stop TWT.

Change-Id: I225b63e4f21357d57d28a9aa7e9ae1cd8c4c694f
CRs-Fixed: 2238302
Varun Reddy Yeturu 7 years ago
parent
commit
96285a2c96
4 changed files with 152 additions and 0 deletions
  1. 52 0
      core/hdd/inc/wlan_hdd_cfg.h
  2. 46 0
      core/hdd/inc/wlan_hdd_twt.h
  3. 17 0
      core/hdd/src/wlan_hdd_cfg.c
  4. 37 0
      core/hdd/src/wlan_hdd_twt.c

+ 52 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -11426,6 +11426,54 @@ enum hdd_wext_control {
 #define CFG_HE_STA_OBSSPD_DEFAULT (0x15b8c2ae)
 
 #endif /* WLAN_FEATURE_11AX */
+#ifdef WLAN_FEATURE_TWT
+/*
+ * <ini>
+ * enable_twt - Enable Target Wake Time support.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to enable or disable TWT support.
+ *
+ * Related: NA
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_TWT_NAME    "enable_twt"
+#define CFG_ENABLE_TWT_MIN     (0)
+#define CFG_ENABLE_TWT_MAX     (1)
+#define CFG_ENABLE_TWT_DEFAULT (1)
+
+/*
+ * <ini>
+ * twt_congestion_timeout - Target wake time congestion timeout.
+ * @Min: 10
+ * @Max: 10000
+ * @Default: 100
+ *
+ * STA uses this timer to continuously monitor channel congestion levels to
+ * decide whether to start or stop TWT. This ini is used to configure the
+ * target wake time congestion timeout value in the units of milliseconds.
+ *
+ * Related: NA
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_TWT_CONGESTION_TIMEOUT_NAME    "twt_congestion_timeout"
+#define CFG_TWT_CONGESTION_TIMEOUT_MIN     (10)
+#define CFG_TWT_CONGESTION_TIMEOUT_MAX     (10000)
+#define CFG_TWT_CONGESTION_TIMEOUT_DEFAULT (100)
+
+#endif /* WLAN_FEATURE_TWT */
 
 /*
  * <ini>
@@ -14964,6 +15012,10 @@ struct hdd_config {
 	bool enable_ul_mimo;
 	bool enable_ul_ofdma;
 	uint32_t he_sta_obsspd;
+#endif
+#ifdef WLAN_FEATURE_TWT
+	bool enable_twt;
+	uint32_t twt_congestion_timeout;
 #endif
 	uint32_t arp_ac_category;
 	bool ani_enabled;

+ 46 - 0
core/hdd/inc/wlan_hdd_twt.h

@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC : wlan_hdd_twt.h
+ *
+ * WLAN Host Device Driver file for TWT (Target Wake Time) support.
+ *
+ */
+
+#if !defined(WLAN_HDD_TWT_H)
+#define WLAN_HDD_TWT_H
+
+struct hdd_context;
+
+#ifdef WLAN_FEATURE_TWT
+/**
+ * hdd_twt_print_ini_config() - Print TWT INI config items
+ * @hdd_ctx: HDD Context
+ *
+ * Return: None
+ */
+void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx);
+
+#else
+static inline void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx)
+{
+}
+
+#endif
+#endif /* if !defined(WLAN_HDD_TWT_H)*/

+ 17 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -41,6 +41,7 @@
 #include "wifi_pos_api.h"
 #include "wlan_hdd_green_ap.h"
 #include "wlan_hdd_green_ap_cfg.h"
+#include "wlan_hdd_twt.h"
 
 static void
 cb_notify_set_roam_prefer5_g_hz(struct hdd_context *hdd_ctx, unsigned long notifyId)
@@ -4453,6 +4454,21 @@ struct reg_table_entry g_registry_table[] = {
 		     CFG_HE_STA_OBSSPD_MIN,
 		     CFG_HE_STA_OBSSPD_MAX),
 #endif
+#ifdef WLAN_FEATURE_TWT
+	REG_VARIABLE(CFG_ENABLE_TWT_NAME, WLAN_PARAM_Integer,
+		     struct hdd_config, enable_twt,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_ENABLE_TWT_DEFAULT,
+		     CFG_ENABLE_TWT_MIN,
+		     CFG_ENABLE_TWT_MAX),
+
+	REG_VARIABLE(CFG_TWT_CONGESTION_TIMEOUT_NAME, WLAN_PARAM_Integer,
+		     struct hdd_config, twt_congestion_timeout,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_TWT_CONGESTION_TIMEOUT_DEFAULT,
+		     CFG_TWT_CONGESTION_TIMEOUT_MIN,
+		     CFG_TWT_CONGESTION_TIMEOUT_MAX),
+#endif
 
 	REG_VARIABLE(CFG_ARP_AC_CATEGORY, WLAN_PARAM_Integer,
 		struct hdd_config, arp_ac_category,
@@ -7110,6 +7126,7 @@ void hdd_cfg_print(struct hdd_context *hdd_ctx)
 
 	hdd_per_roam_print_ini_config(hdd_ctx);
 	hdd_he_print_ini_config(hdd_ctx);
+	hdd_twt_print_ini_config(hdd_ctx);
 	hdd_debug("Name = [%s] Value = [%d]",
 		CFG_ARP_AC_CATEGORY,
 		hdd_ctx->config->arp_ac_category);

+ 37 - 0
core/hdd/src/wlan_hdd_twt.c

@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC : wlan_hdd_twt.c
+ *
+ * WLAN Host Device Driver file for TWT (Target Wake Time) support.
+ *
+ */
+
+#include "wlan_hdd_twt.h"
+#include "wlan_hdd_main.h"
+#include "wlan_hdd_cfg.h"
+
+void hdd_twt_print_ini_config(struct hdd_context *hdd_ctx)
+{
+	hdd_debug("Name = [%s] Value = [%d]", CFG_ENABLE_TWT_NAME,
+		  hdd_ctx->config->enable_twt);
+	hdd_debug("Name = [%s] Value = [%d]", CFG_TWT_CONGESTION_TIMEOUT_NAME,
+		  hdd_ctx->config->twt_congestion_timeout);
+}
+