Browse Source

qcacld-3.0: Refactor CFG_FINE_TIME_MEAS_CAPABILITY cfg

Refactor following CFG_FINE_TIME_MEAS_CAPABILITY cfg items.

Change-Id: I854e584e366490f788ee778adad3fec0c2b5c8cc
CRs-Fixed: 2357070
Arif Hussain 6 years ago
parent
commit
cdd24e47d0

+ 4 - 1
mlme/core/inc/wlan_mlme_main.h

@@ -181,6 +181,9 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc);
  *
  * Return: pointer to MLME object
  */
-struct wlan_mlme_psoc_obj *mlme_get_psoc_obj(struct wlan_objmgr_psoc *psoc);
+#define mlme_get_psoc_obj(psoc) mlme_get_psoc_obj_fl(psoc, __func__, __LINE__)
+struct wlan_mlme_psoc_obj *mlme_get_psoc_obj_fl(struct wlan_objmgr_psoc *psoc,
+						const char *func,
+						uint32_t line);
 
 #endif

+ 12 - 1
mlme/core/src/wlan_mlme_main.c

@@ -28,13 +28,16 @@
 
 #define NUM_OF_SOUNDING_DIMENSIONS     1 /*Nss - 1, (Nss = 2 for 2x2)*/
 
-struct wlan_mlme_psoc_obj *mlme_get_psoc_obj(struct wlan_objmgr_psoc *psoc)
+struct wlan_mlme_psoc_obj *mlme_get_psoc_obj_fl(struct wlan_objmgr_psoc *psoc,
+						const char *func, uint32_t line)
 {
 	struct wlan_mlme_psoc_obj *mlme_obj;
 
 	mlme_obj = (struct wlan_mlme_psoc_obj *)
 		wlan_objmgr_psoc_get_comp_private_obj(psoc,
 						      WLAN_UMAC_COMP_MLME);
+	if (!mlme_obj)
+		mlme_err("mlme obj is null, %s:%d", func, line);
 
 	return mlme_obj;
 }
@@ -1700,6 +1703,13 @@ static void mlme_init_wep_cfg(struct wlan_mlme_wep_cfg *wep_params)
 	mlme_init_wep_keys(wep_params);
 }
 
+static void mlme_init_wifi_pos_cfg(struct wlan_objmgr_psoc *psoc,
+				   struct wlan_mlme_wifi_pos_cfg *wifi_pos_cfg)
+{
+	wifi_pos_cfg->fine_time_meas_cap =
+		cfg_get(psoc, CFG_FINE_TIME_MEAS_CAPABILITY);
+}
+
 #ifdef FEATURE_WLAN_ESE
 static void mlme_init_inactivity_intv(struct wlan_objmgr_psoc *psoc,
 				      struct wlan_mlme_wmm_params *wmm_params)
@@ -1857,6 +1867,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	mlme_init_power_cfg(psoc, &mlme_cfg->power);
 	mlme_init_oce_cfg(psoc, &mlme_cfg->oce);
 	mlme_init_wep_cfg(&mlme_cfg->wep_params);
+	mlme_init_wifi_pos_cfg(psoc, &mlme_cfg->wifi_pos_cfg);
 	mlme_init_wps_params_cfg(psoc, &mlme_cfg->wps_params);
 
 	return status;

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

@@ -50,6 +50,7 @@
 #include "cfg_mlme_threshold.h"
 #include "cfg_mlme_feature_flag.h"
 #include "cfg_mlme_wep_params.h"
+#include "cfg_mlme_wifi_pos.h"
 
 /* Please Maintain Alphabetic Order here */
 #define CFG_MLME_ALL \
@@ -80,6 +81,7 @@
 	CFG_TWT_ALL \
 	CFG_VHT_CAPS_ALL \
 	CFG_WEP_PARAMS_ALL \
+	CFG_WIFI_POS_ALL \
 	CFG_WPS_ALL
 
 #endif /* __CFG_MLME_H */

+ 74 - 0
mlme/dispatcher/inc/cfg_mlme_wifi_pos.h

@@ -0,0 +1,74 @@
+/*
+ * 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_WIFI_POS_H
+#define __CFG_MLME_WIFI_POS_H
+
+/*
+ * <ini>
+ * gfine_time_meas_cap - fine timing measurement capability information
+ * @Min: 0x0000
+ * @Max: 0x00BD
+ * @Default: 0x00BD
+ *
+ * fine timing measurement capability information
+ *
+ * <----- fine_time_meas_cap (in bits) ----->
+ * +----------+-----+-----+------+------+-------+-------+-----+-----+
+ * |   8-31   |  7  |  6  |   5  |   4  |   3   |   2   |  1  |  0  |
+ * +----------+-----+-----+------+------+-------+-------+-----+-----+
+ * | reserved | SAP | SAP |P2P-GO|P2P-GO|P2P-CLI|P2P-CLI| STA | STA |
+ * |          |resp |init |resp  |init  |resp   |init   |resp |init |
+ * +----------+-----+-----+------+------+-------+-------+-----+-----+
+ *
+ * resp - responder role; init- initiator role
+ *
+ * CFG_FINE_TIME_MEAS_CAPABILITY_MAX computed based on the table
+ * +-----------------+-----------------+-----------+
+ * |  Device Role    |   Initiator     | Responder |
+ * +-----------------+-----------------+-----------+
+ * |   Station       |       Y         |     N     |
+ * |   P2P-CLI       |       Y         |     Y     |
+ * |   P2P-GO        |       Y         |     Y     |
+ * |   SAP           |       N         |     Y     |
+ * +-----------------+-----------------+-----------+
+ *
+ * Related: None
+ *
+ * Supported Feature: WIFI POS
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_FINE_TIME_MEAS_CAPABILITY CFG_INI_UINT( \
+			"gfine_time_meas_cap", \
+			0x0000, \
+			0x00BD, \
+			0x00BD, \
+			CFG_VALUE_OR_DEFAULT, \
+			"fine timing measurement capability")
+
+#define CFG_WIFI_POS_ALL \
+	CFG(CFG_FINE_TIME_MEAS_CAPABILITY)
+
+#endif /* __CFG_MLME_WIFI_POS_H */

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

@@ -1644,6 +1644,14 @@ struct wlan_mlme_wep_cfg {
 	struct mlme_cfg_str wep_default_key_4;
 };
 
+/**
+ * struct wlan_mlme_wifi_pos_cfg - WIFI POS configs
+ * @fine_time_meas_cap: fine timing measurement capability information
+ */
+struct wlan_mlme_wifi_pos_cfg {
+	uint32_t fine_time_meas_cap;
+};
+
 /**
  * struct wlan_mlme_cfg - MLME config items
  * @chainmask_cfg: VHT chainmask related cfg items
@@ -1672,6 +1680,7 @@ struct wlan_mlme_wep_cfg {
  * @acs: ACS related CFG items
  * @feature_flags: Feature flag config items
  * @wep_params:  WEP related config items
+ * @wifi_pos_cfg: WIFI POS config
  * @wmm_params: WMM related CFG & INI Items
  * @wps_params: WPS related CFG itmes
  */
@@ -1704,6 +1713,7 @@ struct wlan_mlme_cfg {
 	struct wlan_mlme_acs acs;
 	struct wlan_mlme_feature_flag feature_flags;
 	struct wlan_mlme_wep_cfg wep_params;
+	struct wlan_mlme_wifi_pos_cfg wifi_pos_cfg;
 	struct wlan_mlme_wmm_params wmm_params;
 	struct wlan_mlme_wps_params wps_params;
 };

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

@@ -789,6 +789,28 @@ QDF_STATUS
 ucfg_mlme_set_dfs_filter_offload(struct wlan_objmgr_psoc *psoc,
 				 bool dfs_filter_offload);
 
+/**
+ * ucfg_mlme_get_fine_time_meas_cap() - Get fine timing measurement capability
+ * @psoc: pointer to psoc object
+ * @fine_time_meas_cap: Pointer to the value which will be filled for the caller
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_fine_time_meas_cap(struct wlan_objmgr_psoc *psoc,
+				 uint32_t *fine_time_meas_cap);
+
+/**
+ * ucfg_mlme_set_fine_time_meas_cap() - Set fine timing measurement capability
+ * @psoc: pointer to psoc object
+ * @fine_time_meas_cap:  Value to be set
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_fine_time_meas_cap(struct wlan_objmgr_psoc *psoc,
+				 uint32_t fine_time_meas_cap);
+
 /**
  * ucfg_mlme_get_pmkid_modes() - Get PMKID modes
  * @psoc: pointer to psoc object

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

@@ -206,6 +206,39 @@ ucfg_mlme_get_dfs_master_capability(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+ucfg_mlme_get_fine_time_meas_cap(struct wlan_objmgr_psoc *psoc,
+				 uint32_t *fine_time_meas_cap)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*fine_time_meas_cap =
+			cfg_default(CFG_FINE_TIME_MEAS_CAPABILITY);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*fine_time_meas_cap = mlme_obj->cfg.wifi_pos_cfg.fine_time_meas_cap;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_fine_time_meas_cap(struct wlan_objmgr_psoc *psoc,
+				 uint32_t fine_time_meas_cap)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj)
+		return QDF_STATUS_E_INVAL;
+
+	mlme_obj->cfg.wifi_pos_cfg.fine_time_meas_cap = fine_time_meas_cap;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 ucfg_mlme_get_dfs_disable_channel_switch(struct wlan_objmgr_psoc *psoc,
 					 bool *dfs_disable_channel_switch)