소스 검색

qcacld-3.0: Refactor stats cfg items

Refactor following stats cfg items
CFG_PERIODIC_STATS_DISPLAY_TIME
CFG_LINK_SPEED_RSSI_MID
CFG_REPORT_MAX_LINK_SPEED
CFG_LINK_SPEED_RSSI_LOW
CFG_LINK_SPEED_RSSI_HIGH

Change-Id: I1b699d5fe5b3182c292cf10c85f842169bf14342
CRs-Fixed: 2362068
Arif Hussain 6 년 전
부모
커밋
ea44e974cd

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

@@ -1270,6 +1270,21 @@ static void mlme_init_sta_cfg(struct wlan_objmgr_psoc *psoc,
 		cfg_get(psoc, CFG_STA_KEEPALIVE_METHOD);
 }
 
+static void mlme_init_stats_cfg(struct wlan_objmgr_psoc *psoc,
+				struct wlan_mlme_stats_cfg *stats)
+{
+	stats->stats_periodic_display_time =
+		cfg_get(psoc, CFG_PERIODIC_STATS_DISPLAY_TIME);
+	stats->stats_link_speed_rssi_high =
+		cfg_get(psoc, CFG_LINK_SPEED_RSSI_HIGH);
+	stats->stats_link_speed_rssi_med =
+		cfg_get(psoc, CFG_LINK_SPEED_RSSI_MID);
+	stats->stats_link_speed_rssi_low =
+		cfg_get(psoc, CFG_LINK_SPEED_RSSI_LOW);
+	stats->stats_report_max_link_speed_rssi =
+		cfg_get(psoc, CFG_REPORT_MAX_LINK_SPEED);
+}
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 static void mlme_init_roam_offload_cfg(struct wlan_objmgr_psoc *psoc,
 				       struct wlan_mlme_lfr_cfg *lfr)
@@ -1986,6 +2001,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	mlme_init_product_details_cfg(&mlme_cfg->product_details);
 	mlme_init_powersave_params(psoc, &mlme_cfg->ps_params);
 	mlme_init_sta_cfg(psoc, &mlme_cfg->sta);
+	mlme_init_stats_cfg(psoc, &mlme_cfg->stats);
 	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);

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

@@ -45,6 +45,7 @@
 #include "cfg_mlme_fe_wmm.h"
 #include "cfg_mlme_powersave.h"
 #include "cfg_mlme_sap.h"
+#include "cfg_mlme_stats.h"
 #include "cfg_mlme_twt.h"
 #include "cfg_mlme_scoring.h"
 #include "cfg_mlme_oce.h"
@@ -87,6 +88,7 @@
 	CFG_SAP_PROTECTION_ALL \
 	CFG_SCORING_ALL \
 	CFG_STA_ALL \
+	CFG_STATS_ALL \
 	CFG_THRESHOLD_ALL \
 	CFG_TIMEOUT_ALL \
 	CFG_TWT_ALL \

+ 162 - 0
mlme/dispatcher/inc/cfg_mlme_stats.h

@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2012-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_STATS_H
+#define __CFG_MLME_STATS_H
+
+enum mlme_stats_link_speed_rpt_type {
+	CFG_STATS_LINK_SPEED_REPORT_ACTUAL = 0,
+	CFG_STATS_LINK_SPEED_REPORT_MAX = 1,
+	CFG_STATS_LINK_SPEED_REPORT_MAX_SCALED = 2,
+};
+
+/*
+ * <ini>
+ * periodic_stats_display_time - time(seconds) after which stats will be printed
+ * @Min: 0
+ * @Max: 256
+ * @Default: 10
+ *
+ * This values specifies the recurring time period after which stats will be
+ * printed in wlan driver logs.
+ *
+ * Usage: Internal / External
+ *
+ * </ini>
+ */
+#define CFG_PERIODIC_STATS_DISPLAY_TIME CFG_INI_UINT( \
+		"periodic_stats_display_time", \
+		0, \
+		256, \
+		10, \
+		CFG_VALUE_OR_DEFAULT, \
+		"time after which stats will be printed")
+
+/*
+ * <ini>
+ * gLinkSpeedRssiMed - Used when eHDD_LINK_SPEED_REPORT_SCALED is selected
+ * @Min: -127
+ * @Max: 0
+ * @Default: -65
+ *
+ * This ini is used to set medium rssi link speed
+ *
+ * Related: None
+ *
+ * Supported Feature: STA
+ *
+ * Usage: Internal / External
+ *
+ * </ini>
+ */
+#define CFG_LINK_SPEED_RSSI_MID CFG_INI_INT( \
+		"gLinkSpeedRssiMed", \
+		-127, \
+		0, \
+		-65, \
+		CFG_VALUE_OR_DEFAULT, \
+		"medium rssi link speed")
+
+/*
+ * <ini>
+ * gReportMaxLinkSpeed - Max link speed
+ * @Min: CFG_STATS_LINK_SPEED_REPORT_ACTUAL
+ * @Max: CFG_STATS_LINK_SPEED_REPORT_MAX_SCALED
+ * @Default: CFG_STATS_LINK_SPEED_REPORT_ACTUAL
+ *
+ * This ini is used to set Max link speed
+ *
+ * Related: None
+ *
+ * Supported Feature: STA
+ *
+ * Usage: Internal / External
+ *
+ * </ini>
+ */
+#define CFG_REPORT_MAX_LINK_SPEED CFG_INI_UINT( \
+		"gReportMaxLinkSpeed", \
+		CFG_STATS_LINK_SPEED_REPORT_ACTUAL, \
+		CFG_STATS_LINK_SPEED_REPORT_ACTUAL, \
+		CFG_STATS_LINK_SPEED_REPORT_MAX_SCALED, \
+		CFG_VALUE_OR_DEFAULT, \
+		"Max link speed")
+
+/*
+ * <ini>
+ * gLinkSpeedRssiLow - Used when eHDD_LINK_SPEED_REPORT_SCALED is selected
+ * @Min: -127
+ * @Max: 0
+ * @Default: -80
+ *
+ * This ini is used to set low rssi link speed
+ *
+ * Related: None
+ *
+ * Supported Feature: STA
+ *
+ * Usage: Internal / External
+ *
+ * </ini>
+ */
+#define CFG_LINK_SPEED_RSSI_LOW CFG_INI_INT( \
+		"gLinkSpeedRssiLow", \
+		-127, \
+		0, \
+		-80, \
+		CFG_VALUE_OR_DEFAULT, \
+		"low rssi link speed")
+
+/*
+ * <ini>
+ * gLinkSpeedRssiHigh - Report the max possible speed with RSSI scaling
+ * @Min: -127
+ * @Max: 0
+ * @Default: -55
+ *
+ * This ini is used to set default eHDD_LINK_SPEED_REPORT
+ * Used when eHDD_LINK_SPEED_REPORT_SCALED is selected
+ *
+ * Related: None
+ *
+ * Supported Feature: STA
+ *
+ * Usage: Internal / External
+ *
+ * </ini>
+ */
+#define CFG_LINK_SPEED_RSSI_HIGH CFG_INI_INT( \
+		"gLinkSpeedRssiHigh", \
+		-127, \
+		0, \
+		-55, \
+		CFG_VALUE_OR_DEFAULT, \
+		"max possible rssi link speed")
+
+#define CFG_STATS_ALL \
+	CFG(CFG_PERIODIC_STATS_DISPLAY_TIME) \
+	CFG(CFG_LINK_SPEED_RSSI_HIGH) \
+	CFG(CFG_LINK_SPEED_RSSI_MID) \
+	CFG(CFG_LINK_SPEED_RSSI_LOW) \
+	CFG(CFG_REPORT_MAX_LINK_SPEED)
+
+#endif /* __CFG_MLME_STATS_H */

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

@@ -1136,6 +1136,22 @@ struct wlan_mlme_sta_cfg {
 	enum station_keepalive_method sta_keepalive_method;
 };
 
+/**
+ * struct wlan_mlme_stats_cfg - MLME stats configuration items
+ * @stats_periodic_display_time: time after which stats will be printed
+ * @stats_link_speed_rssi_high: rssi link speed, high
+ * @stats_link_speed_rssi_med: medium rssi link speed
+ * @stats_link_speed_rssi_low: rssi link speed, low
+ * @stats_report_max_link_speed_rssi: report speed limit
+ */
+struct wlan_mlme_stats_cfg {
+	uint32_t stats_periodic_display_time;
+	int stats_link_speed_rssi_high;
+	int stats_link_speed_rssi_med;
+	int stats_link_speed_rssi_low;
+	uint32_t stats_report_max_link_speed_rssi;
+};
+
 /**
  * enum roaming_dfs_channel_type - Allow dfs channel in roam
  * @CFG_ROAMING_DFS_CHANNEL_DISABLED:   Disallow dfs channel in roam
@@ -1804,6 +1820,7 @@ struct wlan_mlme_reg {
  * @sap_cfg: sap CFG items
  * @nss_chains_ini_cfg: Per vdev nss, chains related CFG items
  * @sta: sta CFG Items
+ * @stats: stats CFG Items
  * @scoring: BSS Scoring related CFG Items
  * @oce: OCE related CFG items
  * @threshold: threshold related cfg items
@@ -1843,6 +1860,7 @@ struct wlan_mlme_cfg {
 	struct wlan_mlme_cfg_sap sap_cfg;
 	struct wlan_mlme_nss_chains nss_chains_ini_cfg;
 	struct wlan_mlme_sta_cfg sta;
+	struct wlan_mlme_stats_cfg stats;
 	struct wlan_mlme_scoring_cfg scoring;
 	struct wlan_mlme_oce oce;
 	struct wlan_mlme_threshold threshold;

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

@@ -2484,6 +2484,64 @@ QDF_STATUS
 ucfg_mlme_get_sta_keepalive_method(struct wlan_objmgr_psoc *psoc,
 				   enum station_keepalive_method *val);
 
+/**
+ * ucfg_mlme_stats_get_periodic_display_time() - get display time
+ * @psoc: pointer to psoc object
+ * @periodic_display_time: buffer to hold value
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc,
+					  uint32_t *periodic_display_time);
+
+/**
+ * ucfg_mlme_stats_get_cfg_values() - get stats cfg values
+ * @psoc: pointer to psoc object
+ * @link_speed_rssi_high: link speed high limit
+ * @link_speed_rssi_mid: link speed high mid
+ * @link_speed_rssi_low: link speed high low
+ * @link_speed_rssi_report: link speed report limit
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_stats_get_cfg_values(struct wlan_objmgr_psoc *psoc,
+			       int *link_speed_rssi_high,
+			       int *link_speed_rssi_mid,
+			       int *link_speed_rssi_low,
+			       uint32_t *link_speed_rssi_report);
+
+/**
+ * ucfg_mlme_stats_is_link_speed_report_actual() - is link speed report set
+ * actual
+ * @psoc: pointer to psoc object
+ *
+ * Return: True is report set to actual
+ */
+bool
+ucfg_mlme_stats_is_link_speed_report_actual(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_mlme_stats_is_link_speed_report_max() - is link speed report set
+ * max
+ * @psoc: pointer to psoc object
+ *
+ * Return: True is report set to max
+ */
+bool
+ucfg_mlme_stats_is_link_speed_report_max(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_mlme_stats_is_link_speed_report_max_scaled() - is link speed report set
+ * max scaled
+ * @psoc: pointer to psoc object
+ *
+ * Return: True is report set to max scaled
+ */
+bool
+ucfg_mlme_stats_is_link_speed_report_max_scaled(struct wlan_objmgr_psoc *psoc);
+
 /**
  * ucfg_mlme_get_wmm_dir_ac_vi() - Get TSPEC direction
  * for VI

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

@@ -1116,6 +1116,105 @@ ucfg_mlme_set_wmi_wq_watchdog_timeout(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+ucfg_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc,
+					  uint32_t *periodic_display_time)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*periodic_display_time =
+			cfg_default(CFG_PERIODIC_STATS_DISPLAY_TIME);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*periodic_display_time =
+		mlme_obj->cfg.stats.stats_periodic_display_time;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_stats_get_cfg_values(struct wlan_objmgr_psoc *psoc,
+			       int *link_speed_rssi_high,
+			       int *link_speed_rssi_mid,
+			       int *link_speed_rssi_low,
+			       uint32_t *link_speed_rssi_report)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*link_speed_rssi_high =
+			cfg_default(CFG_LINK_SPEED_RSSI_HIGH);
+		*link_speed_rssi_mid =
+			cfg_default(CFG_LINK_SPEED_RSSI_MID);
+		*link_speed_rssi_low =
+			cfg_default(CFG_LINK_SPEED_RSSI_LOW);
+		*link_speed_rssi_report =
+			cfg_default(CFG_REPORT_MAX_LINK_SPEED);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*link_speed_rssi_high =
+		mlme_obj->cfg.stats.stats_link_speed_rssi_high;
+	*link_speed_rssi_mid =
+		mlme_obj->cfg.stats.stats_link_speed_rssi_med;
+	*link_speed_rssi_low =
+		mlme_obj->cfg.stats.stats_link_speed_rssi_low;
+	*link_speed_rssi_report =
+		mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+bool ucfg_mlme_stats_is_link_speed_report_actual(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+	int report_link_speed = 0;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj)
+		report_link_speed = cfg_default(CFG_REPORT_MAX_LINK_SPEED);
+	else
+		report_link_speed =
+			mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
+
+	return (report_link_speed == CFG_STATS_LINK_SPEED_REPORT_ACTUAL);
+}
+
+bool ucfg_mlme_stats_is_link_speed_report_max(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+	int report_link_speed = 0;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj)
+		report_link_speed = cfg_default(CFG_REPORT_MAX_LINK_SPEED);
+	else
+		report_link_speed =
+			mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
+
+	return (report_link_speed == CFG_STATS_LINK_SPEED_REPORT_MAX);
+}
+
+bool
+ucfg_mlme_stats_is_link_speed_report_max_scaled(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+	int report_link_speed = 0;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj)
+		report_link_speed = cfg_default(CFG_REPORT_MAX_LINK_SPEED);
+	else
+		report_link_speed =
+			mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
+
+	return (report_link_speed == CFG_STATS_LINK_SPEED_REPORT_MAX_SCALED);
+}
+
 QDF_STATUS
 ucfg_mlme_get_ps_data_inactivity_timeout(struct wlan_objmgr_psoc *psoc,
 					 uint32_t *inactivity_timeout)