Browse Source

qcacld-3.0: Refactor TWT cfg

Refactor following TWT cfg items.
CFG_BCAST_TWT
CFG_ENABLE_TWT
CFG_TWT_RESPONDER
CFG_TWT_REQUESTOR
CFG_TWT_CONGESTION_TIMEOUT

Change-Id: Iad0c2ed0893513cc98bf12ec39d111b78c6e9d1f
CRs-Fixed: 2349558
Arif Hussain 6 years ago
parent
commit
b996145da9

+ 11 - 0
mlme/core/src/wlan_mlme_main.c

@@ -1067,6 +1067,16 @@ static void mlme_init_he_cap_in_cfg(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+static void mlme_init_twt_cfg(struct wlan_objmgr_psoc *psoc,
+			      struct wlan_mlme_cfg_twt *twt_cfg)
+{
+	twt_cfg->is_twt_bcast_enabled = cfg_get(psoc, CFG_BCAST_TWT);
+	twt_cfg->is_twt_enabled = cfg_get(psoc, CFG_ENABLE_TWT);
+	twt_cfg->is_twt_responder_enabled = cfg_get(psoc, CFG_TWT_RESPONDER);
+	twt_cfg->is_twt_requestor_enabled = cfg_get(psoc, CFG_TWT_REQUESTOR);
+	twt_cfg->twt_congestion_timeout = cfg_get(psoc, CFG_TWT_CONGESTION_TIMEOUT);
+}
+
 static void mlme_init_sap_cfg(struct wlan_objmgr_psoc *psoc,
 			      struct wlan_mlme_cfg_sap *sap_cfg)
 {
@@ -1802,6 +1812,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	mlme_init_obss_ht40_cfg(psoc, &mlme_cfg->obss_ht40);
 	mlme_init_product_details_cfg(&mlme_cfg->product_details);
 	mlme_init_sta_cfg(psoc, &mlme_cfg->sta);
+	mlme_init_twt_cfg(psoc, &mlme_cfg->twt_cfg);
 	mlme_init_lfr_cfg(psoc, &mlme_cfg->lfr);
 	mlme_init_feature_flag_in_cfg(psoc, &mlme_cfg->feature_flags);
 	mlme_init_scoring_cfg(psoc, &mlme_cfg->scoring);

+ 2 - 0
mlme/dispatcher/inc/cfg_mlme.h

@@ -43,6 +43,7 @@
 #include "cfg_sap_protection.h"
 #include "cfg_mlme_fe_wmm.h"
 #include "cfg_mlme_sap.h"
+#include "cfg_mlme_twt.h"
 #include "cfg_mlme_scoring.h"
 #include "cfg_mlme_oce.h"
 #include "cfg_mlme_threshold.h"
@@ -74,6 +75,7 @@
 	CFG_STA_ALL \
 	CFG_THRESHOLD_ALL \
 	CFG_TIMEOUT_ALL \
+	CFG_TWT_ALL \
 	CFG_VHT_CAPS_ALL \
 	CFG_WEP_PARAMS_ALL \
 	CFG_WPS_ALL

+ 149 - 0
mlme/dispatcher/inc/cfg_mlme_twt.h

@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2011-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: This file contains centralized definitions of converged configuration.
+ */
+
+#ifndef __CFG_MLME_TWT_H
+#define __CFG_MLME_TWT_H
+
+/*
+ * <ini>
+ * twt_requestor - twt requestor.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This cfg is used to store twt requestor config.
+ *
+ * Related: NA
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+#define CFG_TWT_REQUESTOR CFG_INI_BOOL( \
+		"twt_requestor", \
+		0, \
+		"TWT requestor")
+/*
+ * <ini>
+ * twt_responder - twt responder.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This cfg is used to store twt responder config.
+ *
+ * Related: NA
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+#define CFG_TWT_RESPONDER CFG_INI_BOOL( \
+		"twt_responder", \
+		0, \
+		"TWT responder")
+
+/*
+ * <ini>
+ * bcast_twt - to bcast twt capability.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This cfg is used to bcast twt capability.
+ *
+ * Related: NA
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+#define CFG_BCAST_TWT CFG_INI_BOOL( \
+		"bcast_twt", \
+		0, \
+		"Bcast 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 CFG_INI_BOOL( \
+		"enable_twt", \
+		1, \
+		"TWT support")
+
+/*
+ * <ini>
+ * twt_congestion_timeout - Target wake time congestion timeout.
+ * @Min: 0
+ * @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.
+ * A value of Zero indicates that this is a host triggered TWT and all the
+ * necessary configuration for TWT will be directed from the host.
+ *
+ * Related: NA
+ *
+ * Supported Feature: 11AX
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_TWT_CONGESTION_TIMEOUT CFG_INI_UINT( \
+		"twt_congestion_timeout", \
+		0, \
+		10000, \
+		100, \
+		CFG_VALUE_OR_DEFAULT, \
+		"twt congestion timeout")
+
+#define CFG_TWT_ALL \
+	CFG(CFG_BCAST_TWT) \
+	CFG(CFG_ENABLE_TWT) \
+	CFG(CFG_TWT_REQUESTOR) \
+	CFG(CFG_TWT_RESPONDER) \
+	CFG(CFG_TWT_CONGESTION_TIMEOUT)
+
+#endif /* __CFG_MLME_TWT_H */

+ 18 - 0
mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -944,6 +944,22 @@ struct wlan_mlme_acs {
 	bool is_external_acs_policy;
 };
 
+/*
+ * struct wlan_mlme_cfg_twt - All twt related cfg items
+ * @is_twt_bcast_enabled: twt capability for the session
+ * @is_twt_enabled: global twt configuration
+ * @is_twt_responder_enabled: twt responder
+ * @is_twt_requestor_enabled: twt requestor
+ * @twt_congestion_timeout: congestion timeout value
+ */
+struct wlan_mlme_cfg_twt {
+	bool is_twt_bcast_enabled;
+	bool is_twt_enabled;
+	bool is_twt_responder_enabled;
+	bool is_twt_requestor_enabled;
+	uint32_t twt_congestion_timeout;
+};
+
 /**
  * struct wlan_mlme_obss_ht40 - OBSS HT40 config items
  * @active_dwelltime:        obss active dwelltime
@@ -1585,6 +1601,7 @@ struct wlan_mlme_wep_cfg {
  * @oce: OCE related CFG items
  * @threshold: threshold related cfg items
  * @timeouts: mlme timeout related CFG items
+ * @twt_cfg: TWT CFG Items
  * @acs: ACS related CFG items
  * @feature_flags: Feature flag config items
  * @wep_params:  WEP related config items
@@ -1615,6 +1632,7 @@ struct wlan_mlme_cfg {
 	struct wlan_mlme_oce oce;
 	struct wlan_mlme_threshold threshold;
 	struct wlan_mlme_timeout timeouts;
+	struct wlan_mlme_cfg_twt twt_cfg;
 	struct wlan_mlme_acs acs;
 	struct wlan_mlme_feature_flag feature_flags;
 	struct wlan_mlme_wep_cfg wep_params;

+ 110 - 0
mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -699,6 +699,116 @@ QDF_STATUS
 ucfg_mlme_set_pmkid_modes(struct wlan_objmgr_psoc *psoc,
 			  uint32_t val);
 
+/**
+ * ucfg_mlme_get_twt_requestor() - Get twt requestor
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
+			    bool *val);
+
+/**
+ * ucfg_mlme_set_twt_requestor() - Set twt requestor
+ * @psoc: pointer to psoc object
+ * @val:  value that needs to set to this config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
+			    bool val);
+
+/**
+ * ucfg_mlme_get_twt_responder() - Get twt responder
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
+			    bool *val);
+
+/**
+ * ucfg_mlme_set_twt_responder() - Set twt responder
+ * @psoc: pointer to psoc object
+ * @val:  value that needs to set to this config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
+			    bool val);
+
+/**
+ * ucfg_mlme_get_bcast_twt() - Get bcast twt
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_bcast_twt(struct wlan_objmgr_psoc *psoc,
+			bool *val);
+
+/**
+ * ucfg_mlme_set_bcast_twt() - Set bcast twt
+ * @psoc: pointer to psoc object
+ * @val:  value that needs to set to this config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_bcast_twt(struct wlan_objmgr_psoc *psoc,
+			bool val);
+
+/**
+ * ucfg_mlme_get_twt_congestion_timeout() - Get twt congestion timeout
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
+				     uint32_t *val);
+
+/**
+ * ucfg_mlme_set_twt_congestion_timeout() - Set twt congestion timeout
+ * @psoc: pointer to psoc object
+ * @val:  value that needs to set to this config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
+				     uint32_t val);
+
+/**
+ * ucfg_mlme_get_enable_twt() - Get global twt config support
+ * @psoc: pointer to psoc object
+ * @val:  Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_enable_twt(struct wlan_objmgr_psoc *psoc,
+			 bool *val);
+
+/**
+ * ucfg_mlme_set_enable_twt() - Set global twt config support
+ * @psoc: pointer to psoc object
+ * @val:  value that needs to set to this config
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_enable_twt(struct wlan_objmgr_psoc *psoc,
+			 bool val);
+
 /**
  * ucfg_mlme_get_dot11p_mode() - Get the setting about 802.11p mode
  * @psoc: pointer to psoc object

+ 175 - 0
mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -241,6 +241,181 @@ ucfg_mlme_set_pmkid_modes(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
+			    bool *val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_TWT_REQUESTOR);
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.twt_cfg.is_twt_requestor_enabled;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
+			    bool val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mlme_obj->cfg.twt_cfg.is_twt_requestor_enabled = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
+			    bool *val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_TWT_RESPONDER);
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.twt_cfg.is_twt_responder_enabled;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
+			    bool val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mlme_obj->cfg.twt_cfg.is_twt_responder_enabled = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_get_bcast_twt(struct wlan_objmgr_psoc *psoc,
+			bool *val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_BCAST_TWT);
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.twt_cfg.is_twt_bcast_enabled;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_bcast_twt(struct wlan_objmgr_psoc *psoc,
+			bool val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mlme_obj->cfg.twt_cfg.is_twt_bcast_enabled = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_get_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
+				     uint32_t *val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_TWT_CONGESTION_TIMEOUT);
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.twt_cfg.twt_congestion_timeout;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
+				     uint32_t val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mlme_obj->cfg.twt_cfg.twt_congestion_timeout = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_get_enable_twt(struct wlan_objmgr_psoc *psoc,
+			 bool *val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*val = cfg_default(CFG_ENABLE_TWT);
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*val = mlme_obj->cfg.twt_cfg.is_twt_enabled;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_enable_twt(struct wlan_objmgr_psoc *psoc,
+			 bool val)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		mlme_err("mlme obj null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mlme_obj->cfg.twt_cfg.is_twt_enabled = val;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 ucfg_mlme_get_dot11p_mode(struct wlan_objmgr_psoc *psoc,
 			  enum dot11p_mode *out_mode)