Kaynağa Gözat

qcacld-3.0: Add SAP TX leakage threshold into ini file

Propagate from qcacld-2.0 to qcacld-3.0

Current value of SAP TX leakage threshold is a fixed value 310,
since different product may need different threshold, add it
into ini file now.

Change-Id: I0df8ac14f5e9e812a8ec5e5127df21eff0a8502b
CRs-Fixed: 955258
Yingying Tang 8 yıl önce
ebeveyn
işleme
b4832f7faf

+ 12 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -3570,6 +3570,17 @@ enum dot11p_mode {
 #define CFG_SAP_FORCE_11N_FOR_11AC_MAX     (1)
 #define CFG_SAP_FORCE_11N_FOR_11AC_DEFAULT (0)
 
+/*
+ * sap tx leakage threshold
+ * customer can set this value from 100 to 1000 which means
+ * sap tx leakage threshold is -10db to -100db
+ */
+#define CFG_SAP_TX_LEAKAGE_THRESHOLD_NAME    "gsap_tx_leakage_threshold"
+#define CFG_SAP_TX_LEAKAGE_THRESHOLD_MIN     (100)
+#define CFG_SAP_TX_LEAKAGE_THRESHOLD_MAX     (1000)
+#define CFG_SAP_TX_LEAKAGE_THRESHOLD_DEFAULT (310)
+
+
 /*
  * Enable filtering of replayed multicast packets
  * In a typical infrastructure setup, it is quite normal to receive
@@ -4289,6 +4300,7 @@ struct hdd_config {
 	bool indoor_channel_support;
 	/* parameter to force sap into 11n */
 	bool sap_force_11n_for_11ac;
+	uint16_t sap_tx_leakage_threshold;
 	bool multicast_replay_filter;
 	/* parameter for indicating sifs burst duration to fw */
 	uint8_t sifs_burst_duration;

+ 8 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -3986,6 +3986,14 @@ REG_TABLE_ENTRY g_registry_table[] = {
 		     CFG_INDOOR_CHANNEL_SUPPORT_MIN,
 		     CFG_INDOOR_CHANNEL_SUPPORT_MAX),
 
+	REG_VARIABLE(CFG_SAP_TX_LEAKAGE_THRESHOLD_NAME,
+		WLAN_PARAM_Integer,
+		struct hdd_config, sap_tx_leakage_threshold,
+		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		CFG_SAP_TX_LEAKAGE_THRESHOLD_DEFAULT,
+		CFG_SAP_TX_LEAKAGE_THRESHOLD_MIN,
+		CFG_SAP_TX_LEAKAGE_THRESHOLD_MAX),
+
 	REG_VARIABLE(CFG_BUG_ON_REINIT_FAILURE_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, bug_on_reinit_failure,
 		     VAR_FLAGS_OPTIONAL |

+ 3 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -7209,6 +7209,9 @@ int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
 		pConfig->ieee80211d = 0;
 	}
 
+	wlansap_set_tx_leakage_threshold(hHal,
+		iniConfig->sap_tx_leakage_threshold);
+
 	capab_info = pMgmt_frame->u.beacon.capab_info;
 
 	pConfig->privacy = (pMgmt_frame->u.beacon.capab_info &

+ 4 - 0
core/sap/inc/sap_api.h

@@ -708,6 +708,7 @@ typedef struct sSapDfsInfo {
 	 * channel switch is disabled.
 	 */
 	uint8_t disable_dfs_ch_switch;
+	uint16_t tx_leakage_threshold;
 } tSapDfsInfo;
 
 typedef struct tagSapCtxList {
@@ -964,8 +965,11 @@ QDF_STATUS wlansap_acs_chselect(void *pvos_gctx,
 		tpWLAN_SAPEventCB pacs_event_callback,
 		tsap_Config_t *pconfig,
 		void *pusr_context);
+
 uint32_t wlansap_get_chan_width(void *cds_ctx);
 
+QDF_STATUS wlansap_set_tx_leakage_threshold(tHalHandle hal,
+			uint16_t tx_leakage_threshold);
 #ifdef __cplusplus
 }
 #endif

+ 11 - 1
core/sap/src/sap_fsm.c

@@ -1007,6 +1007,16 @@ sap_mark_leaking_ch(ptSapContext sap_ctx,
 	uint32_t         j = 0;
 	uint32_t         k = 0;
 	uint8_t          dfs_nol_channel;
+	tHalHandle      hal = CDS_GET_HAL_CB(sap_ctx->pvosGCtx);
+	tpAniSirGlobal  mac;
+
+	if (NULL == hal) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			"%s: Invalid hal pointer", __func__);
+		return QDF_STATUS_E_FAULT;
+	}
+
+	mac = PMAC_STRUCT(hal);
 
 
 	/* traverse target_chan_matrix and */
@@ -1051,7 +1061,7 @@ sap_mark_leaking_ch(ptSapContext sap_ctx,
 			 * to NOL channel
 			 */
 			if (target_chan_matrix[k].leak_lvl <=
-					SAP_TX_LEAKAGE_THRES) {
+				mac->sap.SapDfsInfo.tx_leakage_threshold) {
 				/*
 				 * candidate channel will have
 				 * bad leakage in NOL channel,

+ 28 - 1
core/sap/src/sap_module.c

@@ -3622,7 +3622,6 @@ void wlan_sap_enable_phy_error_logs(tHalHandle hal, bool enable_log)
 	mac_ctx->sap.enable_dfs_phy_error_logs = enable_log;
 }
 
-
 /**
  * wlansap_get_chan_width() - get sap channel width.
  * @cds_ctx: pointer of global cds context
@@ -3638,3 +3637,31 @@ uint32_t wlansap_get_chan_width(void *cds_ctx)
 	sapcontext = CDS_GET_SAP_CB(cds_ctx);
 	return wlan_sap_get_vht_ch_width(sapcontext);
 }
+
+/**
+ * wlansap_set_tx_leakage_threshold() - set sap tx leakage threshold.
+ * @hal: HAL pointer
+ * @tx_leakage_threshold: sap tx leakage threshold
+ *
+ * This function set sap tx leakage threshold.
+ *
+ * Return: QDF_STATUS.
+ */
+QDF_STATUS wlansap_set_tx_leakage_threshold(tHalHandle hal,
+			uint16_t tx_leakage_threshold)
+{
+	tpAniSirGlobal mac;
+
+	if (NULL == hal) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
+			"%s: Invalid hal pointer", __func__);
+		return QDF_STATUS_E_FAULT;
+	}
+
+	mac = PMAC_STRUCT(hal);
+	mac->sap.SapDfsInfo.tx_leakage_threshold = tx_leakage_threshold;
+	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
+			"%s: leakage_threshold %d", __func__,
+			mac->sap.SapDfsInfo.tx_leakage_threshold);
+	return QDF_STATUS_SUCCESS;
+}