diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c
index ff45c8f79ce4..7418cc57f76a 100644
--- a/components/mlme/core/src/wlan_mlme_main.c
+++ b/components/mlme/core/src/wlan_mlme_main.c
@@ -160,6 +160,8 @@ static void mlme_init_generic_cfg(struct wlan_objmgr_psoc *psoc,
struct wlan_mlme_generic *gen)
{
gen->rtt3_enabled = cfg_default(CFG_RTT3_ENABLE);
+ gen->rtt_mac_randomization =
+ cfg_get(psoc, CFG_ENABLE_RTT_MAC_RANDOMIZATION);
gen->band_capability =
cfg_get(psoc, CFG_BAND_CAPABILITY);
gen->band = gen->band_capability;
diff --git a/components/mlme/dispatcher/inc/cfg_mlme_generic.h b/components/mlme/dispatcher/inc/cfg_mlme_generic.h
index eb5362b7f427..56583f7b2308 100644
--- a/components/mlme/dispatcher/inc/cfg_mlme_generic.h
+++ b/components/mlme/dispatcher/inc/cfg_mlme_generic.h
@@ -73,6 +73,22 @@
CFG_VALUE_OR_DEFAULT, \
"PMF SA query retry interval for SAP")
+/*
+ *
+ * enable_rtt_mac_randomization - Enable/Disable rtt mac randomization
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * Usage: External
+ *
+ *
+ */
+#define CFG_ENABLE_RTT_MAC_RANDOMIZATION CFG_INI_BOOL( \
+ "enable_rtt_mac_randomization", \
+ 0, \
+ "Enable RTT MAC randomization")
+
#define CFG_RTT3_ENABLE CFG_BOOL( \
"rtt3_enabled", \
1, \
@@ -476,6 +492,7 @@
CFG(CFG_ENABLE_DEBUG_PACKET_LOG) \
CFG(CFG_PMF_SA_QUERY_MAX_RETRIES) \
CFG(CFG_PMF_SA_QUERY_RETRY_INTERVAL) \
+ CFG(CFG_ENABLE_RTT_MAC_RANDOMIZATION) \
CFG(CFG_RTT3_ENABLE) \
CFG(CFG_BAND_CAPABILITY) \
CFG(CFG_PREVENT_LINK_DOWN) \
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h
index 9a6d4e084ed8..410287714583 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_api.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h
@@ -257,6 +257,16 @@ QDF_STATUS wlan_mlme_get_prevent_link_down(struct wlan_objmgr_psoc *psoc,
QDF_STATUS wlan_mlme_get_select_5ghz_margin(struct wlan_objmgr_psoc *psoc,
uint8_t *select_5ghz_margin);
+/**
+ * wlan_mlme_get_rtt_mac_randomization() - Get the RTT MAC randomization config
+ * @psoc: pointer to psoc object
+ * @rtt_mac_randomization: Pointer to the variable from caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS wlan_mlme_get_rtt_mac_randomization(struct wlan_objmgr_psoc *psoc,
+ bool *rtt_mac_randomization);
+
/**
* wlan_mlme_get_crash_inject() - Get the crash inject config
* @psoc: pointer to psoc object
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
index 40d800cf32a5..7a93b8c46347 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h
@@ -923,6 +923,7 @@ struct wlan_mlme_chainmask {
* @pmf_sa_query_max_retries: PMF query max retries for SAP
* @pmf_sa_query_retry_interval: PMF query retry interval for SAP
* @dropped_pkt_disconnect_thresh: Threshold for dropped pkts before disconnect
+ * @rtt_mac_randomization: Enable/Disable RTT MAC randomization
* @rtt3_enabled: RTT3 enable or disable info
* @prevent_link_down: Enable/Disable prevention of link down
* @memory_deep_sleep: Enable/Disable memory deep sleep
@@ -945,6 +946,7 @@ struct wlan_mlme_generic {
uint8_t pmf_sa_query_max_retries;
uint16_t pmf_sa_query_retry_interval;
uint16_t dropped_pkt_disconnect_thresh;
+ bool rtt_mac_randomization;
bool rtt3_enabled;
bool prevent_link_down;
bool memory_deep_sleep;
diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
index fa2e8e5a16bc..028033455388 100644
--- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
+++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h
@@ -261,6 +261,20 @@ QDF_STATUS ucfg_mlme_get_select_5ghz_margin(struct wlan_objmgr_psoc *psoc,
return wlan_mlme_get_select_5ghz_margin(psoc, select_5ghz_margin);
}
+/**
+ * ucfg_mlme_get_rtt_mac_randomization() - Get the RTT MAC randomization config
+ * @psoc: pointer to psoc object
+ * @rtt_mac_randomization: Pointer to the variable from caller
+ *
+ * Return: QDF Status
+ */
+static inline
+QDF_STATUS ucfg_mlme_get_rtt_mac_randomization(struct wlan_objmgr_psoc *psoc,
+ bool *rtt_mac_randomization)
+{
+ return wlan_mlme_get_rtt_mac_randomization(psoc, rtt_mac_randomization);
+}
+
/**
* ucfg_mlme_get_crash_inject() - Get the crash inject config
* @psoc: pointer to psoc object
diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c
index cd7fcdd25598..3e783ba24fc2 100644
--- a/components/mlme/dispatcher/src/wlan_mlme_api.c
+++ b/components/mlme/dispatcher/src/wlan_mlme_api.c
@@ -229,6 +229,22 @@ QDF_STATUS wlan_mlme_get_select_5ghz_margin(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
+QDF_STATUS wlan_mlme_get_rtt_mac_randomization(struct wlan_objmgr_psoc *psoc,
+ bool *rtt_mac_randomization)
+{
+ struct wlan_mlme_psoc_obj *mlme_obj;
+
+ mlme_obj = mlme_get_psoc_obj(psoc);
+ if (!mlme_obj) {
+ mlme_err("Failed to get MLME Obj");
+ return QDF_STATUS_E_FAILURE;
+ }
+
+ *rtt_mac_randomization = mlme_obj->cfg.gen.rtt_mac_randomization;
+
+ return QDF_STATUS_SUCCESS;
+}
+
QDF_STATUS wlan_mlme_get_crash_inject(struct wlan_objmgr_psoc *psoc,
bool *crash_inject)
{
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 066d308ac168..adb4afbf7aaf 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -6233,22 +6233,6 @@ enum hdd_link_speed_rpt_type {
#define CFG_ENABLE_UNIT_TEST_FRAMEWORK_MAX (1)
#define CFG_ENABLE_UINT_TEST_FRAMEWORK_DEFAULT (0)
-/*
- *
- * enable_rtt_mac_randomization - Enable/Disable rtt mac randomization
- * @Min: 0
- * @Max: 1
- * @Default: 0
- *
- * Usage: External
- *
- *
- */
-#define CFG_ENABLE_RTT_MAC_RANDOMIZATION_NAME "enable_rtt_mac_randomization"
-#define CFG_ENABLE_RTT_MAC_RANDOMIZATION_MIN (0)
-#define CFG_ENABLE_RTT_MAC_RANDOMIZATION_MAX (1)
-#define CFG_ENABLE_RTT_MAC_RANDOMIZATION_DEFAULT (0)
-
/*
*
* gEnableSecondaryRate - Enable/Disable Secondary Retry Rate feature subset
@@ -6801,7 +6785,6 @@ struct hdd_config {
uint32_t enable_secondary_rate;
bool is_unit_test_framework_enabled;
bool enable_ftopen;
- bool enable_rtt_mac_randomization;
bool roam_force_rssi_trigger;
bool enable_change_channel_bandwidth;
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index 3dc4d2e41d77..009f0a989c48 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -2475,14 +2475,6 @@ struct reg_table_entry g_registry_table[] = {
CFG_ROAM_FT_OPEN_ENABLE_MIN,
CFG_ROAM_FT_OPEN_ENABLE_MAX),
- REG_VARIABLE(CFG_ENABLE_RTT_MAC_RANDOMIZATION_NAME,
- WLAN_PARAM_Integer,
- struct hdd_config, enable_rtt_mac_randomization,
- VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
- CFG_ENABLE_RTT_MAC_RANDOMIZATION_DEFAULT,
- CFG_ENABLE_RTT_MAC_RANDOMIZATION_MIN,
- CFG_ENABLE_RTT_MAC_RANDOMIZATION_MAX),
-
REG_VARIABLE(CFG_ENABLE_SECONDARY_RATE_NAME,
WLAN_PARAM_HexInteger,
struct hdd_config, enable_secondary_rate,
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index f5a77bc51c1e..57c470b09339 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -4026,6 +4026,7 @@ int hdd_vdev_create(struct hdd_adapter *adapter,
{
QDF_STATUS status;
int errno;
+ bool bval;
struct hdd_context *hdd_ctx;
struct sme_session_params sme_session_params = {0};
@@ -4097,11 +4098,16 @@ int hdd_vdev_create(struct hdd_adapter *adapter,
}
if (adapter->device_mode == QDF_STA_MODE) {
- hdd_debug("setting RTT mac randomization param: %d",
- hdd_ctx->config->enable_rtt_mac_randomization);
+ bval = false;
+ status = ucfg_mlme_get_rtt_mac_randomization(hdd_ctx->psoc,
+ &bval);
+ if (QDF_IS_STATUS_ERROR(status))
+ hdd_err("unable to get RTT MAC randomization value");
+
+ hdd_debug("setting RTT mac randomization param: %d", bval);
errno = sme_cli_set_command(adapter->session_id,
WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_INITIATOR_RANDOM_MAC,
- hdd_ctx->config->enable_rtt_mac_randomization,
+ bval,
VDEV_CMD);
if (0 != errno)
hdd_err("RTT mac randomization param set failed %d",