diff --git a/mlme/core/src/wlan_mlme_main.c b/mlme/core/src/wlan_mlme_main.c
index 214044646b..5d9caadef1 100644
--- a/mlme/core/src/wlan_mlme_main.c
+++ b/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);
diff --git a/mlme/dispatcher/inc/cfg_mlme.h b/mlme/dispatcher/inc/cfg_mlme.h
index 47c0c387a4..db18e3a198 100644
--- a/mlme/dispatcher/inc/cfg_mlme.h
+++ b/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 \
diff --git a/mlme/dispatcher/inc/cfg_mlme_stats.h b/mlme/dispatcher/inc/cfg_mlme_stats.h
new file mode 100644
index 0000000000..b98b652f1d
--- /dev/null
+++ b/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,
+};
+
+/*
+ *
+ * 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
+ *
+ *
+ */
+#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")
+
+/*
+ *
+ * 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
+ *
+ *
+ */
+#define CFG_LINK_SPEED_RSSI_MID CFG_INI_INT( \
+ "gLinkSpeedRssiMed", \
+ -127, \
+ 0, \
+ -65, \
+ CFG_VALUE_OR_DEFAULT, \
+ "medium rssi link speed")
+
+/*
+ *
+ * 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
+ *
+ *
+ */
+#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")
+
+/*
+ *
+ * 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
+ *
+ *
+ */
+#define CFG_LINK_SPEED_RSSI_LOW CFG_INI_INT( \
+ "gLinkSpeedRssiLow", \
+ -127, \
+ 0, \
+ -80, \
+ CFG_VALUE_OR_DEFAULT, \
+ "low rssi link speed")
+
+/*
+ *
+ * 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
+ *
+ *
+ */
+#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 */
diff --git a/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/mlme/dispatcher/inc/wlan_mlme_public_struct.h
index b61635f8d5..d8bf5b3ae0 100644
--- a/mlme/dispatcher/inc/wlan_mlme_public_struct.h
+++ b/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;
diff --git a/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
index e0140312cc..5bececea74 100644
--- a/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
+++ b/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
diff --git a/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/mlme/dispatcher/src/wlan_mlme_ucfg_api.c
index f423c3f993..be4090c505 100644
--- a/mlme/dispatcher/src/wlan_mlme_ucfg_api.c
+++ b/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)