Browse Source

qcacld-3.0: Enable configurable dfs_pri_multiplier

Enable configurable dfs_pri_multiplier. The ETSI typ2 type3 radar
detection ratio is lower than expected(>80%) while channel loading is
high(>30%). The host improvement for this are:
	1. Add configurable dfs_pri_multiplier, controlled by
	   DFS_PRI_MULTIPLIER. Default value 2, min 1, max 10.
	2. Lower adrastea ETSI type 2/3/4 radar filter rssi_threshold,
	   controlled by DFS_OVERRIDE_RF_THRESHOLD, dfs log shows that
	   QCS405 target report RSSI range [18, 45] while radar power
	   is 3 dbm. By using default rssi_threshold 24 will reject
	   many radar pulses, which leads to low detection ratio.
	3. Calculate deltapri for each searchpri based on dfs_pri_multiplier
	   in dfs_count_the_other_delay_elements(), check deltapri
	   between [1, dfs_pri_multiplier] * refpri and searchpri, if
	   the primargin is desired, mark it as matched pulse.
	4. Pick lowpri as refpri for the radar filter with
	   rf_ignore_pri_window equals to 0 while DFS_PRI_MULTIPLIER is
	   enabled. Observed original findref logic has some problems
	   which selects refpri is bigger than lowpri, which leads to
	   the lowpri pulses pri_match are set to 0, and in this case,
	   radar was not detected. Example for the issue, assume
	   rf->rf_pulseid 34 (ETSI type 2) has 7 pulses with pri:
	   1489, 2978, 2978, 2978, 1489, 2978, 1489 us in this case,
	   highscore is 4 (2978), scoreindex is 5, refpri is 2978, which
	   leads to: index 0, 4, 6 pulses with pri_match 0 in
	   dfs_count_the_other_delay_elements(). The fix is to select
	   lowpri as refpri(1489 in this case).

Change-Id: I1f3ca3298c9ab1f1e2651ad6b4a0a4810f83f8a1
CRs-Fixed: 2522506
Hangtian Zhu 5 years ago
parent
commit
9a28ed0437

+ 6 - 0
Kbuild

@@ -2286,6 +2286,12 @@ cppflags-$(CONFIG_MULTI_IF_LOG) += -DMULTI_IF_LOG
 #Set SLUB_MEM_OPTIMIZE
 cppflags-$(CONFIG_SLUB_MEM_OPTIMIZE) += -DSLUB_MEM_OPTIMIZE
 
+#Set DFS_PRI_MULTIPLIER
+cppflags-$(CONFIG_DFS_PRI_MULTIPLIER) += -DDFS_PRI_MULTIPLIER
+
+#Set DFS_OVERRIDE_RF_THRESHOLD
+cppflags-$(CONFIG_DFS_OVERRIDE_RF_THRESHOLD) += -DDFS_OVERRIDE_RF_THRESHOLD
+
 #Enable OL debug and wmi unified functions
 cppflags-$(CONFIG_ATH_PERF_PWR_OFFLOAD) += -DATH_PERF_PWR_OFFLOAD
 

+ 2 - 0
components/mlme/core/src/wlan_mlme_main.c

@@ -940,6 +940,8 @@ static void mlme_init_dfs_cfg(struct wlan_objmgr_psoc *psoc,
 		cfg_get(psoc, CFG_DISABLE_DFS_JAPAN_W53);
 	dfs_cfg->sap_tx_leakage_threshold =
 		cfg_get(psoc, CFG_SAP_TX_LEAKAGE_THRESHOLD);
+	dfs_cfg->dfs_pri_multiplier =
+		cfg_get(psoc, CFG_DFS_RADAR_PRI_MULTIPLIER);
 }
 
 static void mlme_init_feature_flag_in_cfg(

+ 27 - 1
components/mlme/dispatcher/inc/cfg_mlme_dfs.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 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
@@ -47,6 +47,31 @@
 			CFG_VALUE_OR_DEFAULT, \
 			"sap tx leakage threshold")
 
+/*
+ * <ini>
+ * gDFSradarMappingPriMultiplier - dfs pri multiplier
+ * @Min: 1
+ * @Max: 10
+ * @Default: 2
+ *
+ * customer can set this value from 1 to 10 which means
+ * host could handle missing pulses while there is high
+ * channel loading, for example: 30% ETSI and 50% Japan W53
+ *
+ * Related: none
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_DFS_RADAR_PRI_MULTIPLIER CFG_INI_UINT( \
+			"gDFSradarMappingPriMultiplier", \
+			1, \
+			10, \
+			2, \
+			CFG_VALUE_OR_DEFAULT, \
+			"dfs pri multiplier")
+
 /*
  * <ini>
  * gDfsBeaconTxEnhanced - beacon tx enhanced
@@ -203,6 +228,7 @@
 	CFG(CFG_DISABLE_DFS_CH_SWITCH) \
 	CFG(CFG_DFS_BEACON_TX_ENHANCED) \
 	CFG(CFG_SAP_TX_LEAKAGE_THRESHOLD) \
+	CFG(CFG_DFS_RADAR_PRI_MULTIPLIER) \
 	CFG(CFG_ENABLE_NON_DFS_CHAN_ON_RADAR) \
 	CFG(CFG_ENABLE_DFS_MASTER_CAPABILITY) \
 	CFG(CFG_DISABLE_DFS_JAPAN_W53) \

+ 2 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -702,6 +702,7 @@ struct wlan_mlme_cfg_sap {
  * @dfs_prefer_non_dfs: perefer non dfs channel after radar
  * @dfs_disable_japan_w53: Disable W53 channels
  * @sap_tx_leakage_threshold: sap tx leakage threshold
+ * @dfs_pri_multiplier: dfs_pri_multiplier for handle missing pulses
  */
 struct wlan_mlme_dfs_cfg {
 	bool dfs_master_capable;
@@ -712,6 +713,7 @@ struct wlan_mlme_dfs_cfg {
 	bool dfs_prefer_non_dfs;
 	bool dfs_disable_japan_w53;
 	uint32_t sap_tx_leakage_threshold;
+	uint32_t dfs_pri_multiplier;
 };
 
 /**

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

@@ -751,6 +751,28 @@ QDF_STATUS
 ucfg_mlme_set_sap_tx_leakage_threshold(struct wlan_objmgr_psoc *psoc,
 				       uint32_t sap_tx_leakage_threshold);
 
+/*
+ * ucfg_mlme_get_dfs_pri_multiplier() - Get dfs pri multiplier
+ * @psoc: pointer to psoc object
+ * @dfs_pri_multiplier: Pointer to the value which will be filled
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_get_dfs_pri_multiplier(struct wlan_objmgr_psoc *psoc,
+				 uint32_t *dfs_pri_multiplier);
+
+/*
+ * ucfg_mlme_set_dfs_pri_multiplier() - Set dfs pri multiplier
+ * @psoc: pointer to psoc object
+ * @dfs_pri_multiplier: Value that needs to be set.
+ *
+ * Return: QDF Status
+ */
+QDF_STATUS
+ucfg_mlme_set_dfs_pri_multiplier(struct wlan_objmgr_psoc *psoc,
+				 uint32_t dfs_pri_multiplier);
+
 /*
  * ucfg_mlme_get_dfs_filter_offload() - Get the dfs filter offload
  * @psoc: pointer to psoc object

+ 35 - 0
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -325,6 +325,41 @@ ucfg_mlme_set_sap_tx_leakage_threshold(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+ucfg_mlme_get_dfs_pri_multiplier(struct wlan_objmgr_psoc *psoc,
+				 uint32_t *dfs_pri_multiplier)
+{
+	struct wlan_mlme_psoc_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_obj(psoc);
+	if (!mlme_obj) {
+		*dfs_pri_multiplier =
+			cfg_default(CFG_DFS_RADAR_PRI_MULTIPLIER);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*dfs_pri_multiplier =
+		mlme_obj->cfg.dfs_cfg.dfs_pri_multiplier;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+ucfg_mlme_set_dfs_pri_multiplier(struct wlan_objmgr_psoc *psoc,
+				 uint32_t dfs_pri_multiplier)
+{
+	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.dfs_cfg.dfs_pri_multiplier =
+		dfs_pri_multiplier;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 ucfg_mlme_get_dfs_filter_offload(struct wlan_objmgr_psoc *psoc,
 				 bool *dfs_filter_offload)

+ 2 - 0
configs/default_defconfig

@@ -106,6 +106,8 @@ ifeq ($(CONFIG_ARCH_QCS40X), y)
 	CONFIG_RX_PERFORMANCE := y
 	CONFIG_TGT_NUM_MSDU_DESC := 900
 	CONFIG_MULTI_IF_LOG := y
+	CONFIG_DFS_PRI_MULTIPLIER := y
+	CONFIG_DFS_OVERRIDE_RF_THRESHOLD := y
 endif
 CONFIG_WLAN_FEATURE_MBSSID := y
 

+ 2 - 0
configs/qcs40x.snoc.perf_defconfig

@@ -33,6 +33,8 @@ CONFIG_WLAN_SPECTRAL_ENABLE := y
 CONFIG_WMI_CMD_STRINGS := n
 CONFIG_SOFTAP_CHANNEL_RANGE := y
 CONFIG_FEATURE_WLAN_SCAN_PNO := y
+CONFIG_DFS_PRI_MULTIPLIER := y
+CONFIG_DFS_OVERRIDE_RF_THRESHOLD := y
 
 # Interface specific features
 CONFIG_ROME_IF = snoc

+ 23 - 0
core/hdd/src/wlan_hdd_regulatory.c

@@ -1265,6 +1265,26 @@ static enum nl80211_dfs_regions dfs_reg_to_nl80211_dfs_regions(
 	}
 }
 
+/**
+ * hdd_set_dfs_pri_multiplier() - Set dfs_pri_multiplier for ETSI region
+ * @dfs_region: DFS region
+ *
+ * Return: none
+ */
+#ifdef DFS_PRI_MULTIPLIER
+static void hdd_set_dfs_pri_multiplier(struct hdd_context *hdd_ctx,
+				       enum dfs_reg dfs_region)
+{
+	if (dfs_region == DFS_ETSI_REGION)
+		wlan_sap_set_dfs_pri_multiplier(hdd_ctx->mac_handle);
+}
+#else
+static inline void hdd_set_dfs_pri_multiplier(struct hdd_context *hdd_ctx,
+					      enum dfs_reg dfs_region)
+{
+}
+#endif
+
 void hdd_send_wiphy_regd_sync_event(struct hdd_context *hdd_ctx)
 {
 	struct ieee80211_regdomain *regd;
@@ -1302,6 +1322,9 @@ void hdd_send_wiphy_regd_sync_event(struct hdd_context *hdd_ctx)
 	qdf_mem_copy(regd->alpha2, reg_rules->alpha2, REG_ALPHA2_LEN + 1);
 	regd->dfs_region =
 		dfs_reg_to_nl80211_dfs_regions(reg_rules->dfs_region);
+
+	hdd_set_dfs_pri_multiplier(hdd_ctx, reg_rules->dfs_region);
+
 	regd_rules = regd->reg_rules;
 	hdd_debug("Regulatory Domain %s", regd->alpha2);
 	hdd_debug("start freq\tend freq\t@ max_bw\tant_gain\tpwr\tflags");

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

@@ -1276,6 +1276,20 @@ static inline QDF_STATUS wlansap_set_dfs_nol(struct sap_context *sap_ctx,
 }
 #endif
 
+/**
+ * wlan_sap_set_dfs_pri_multiplier() - Set dfs_pri_multiplier
+ * @mac_handle: Opaque handle to the global MAC context
+ *
+ * Return: none
+ */
+#ifdef DFS_PRI_MULTIPLIER
+void wlan_sap_set_dfs_pri_multiplier(mac_handle_t mac_handle);
+#else
+static inline void wlan_sap_set_dfs_pri_multiplier(mac_handle_t mac_handle)
+{
+}
+#endif
+
 /**
  * wlan_sap_set_vendor_acs() - Set vendor specific acs in sap context
  * @sap_context: SAP context

+ 13 - 0
core/sap/src/sap_module.c

@@ -2625,6 +2625,19 @@ void wlan_sap_enable_phy_error_logs(mac_handle_t mac_handle,
 			sizeof(uint32_t), NULL, NULL, &error);
 }
 
+#ifdef DFS_PRI_MULTIPLIER
+void wlan_sap_set_dfs_pri_multiplier(mac_handle_t mac_handle)
+{
+	int error;
+
+	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
+
+	tgt_dfs_control(mac_ctx->pdev, DFS_SET_PRI_MULTIPILER,
+			&mac_ctx->mlme_cfg->dfs_cfg.dfs_pri_multiplier,
+			sizeof(uint32_t), NULL, NULL, &error);
+}
+#endif
+
 uint32_t wlansap_get_chan_width(struct sap_context *sap_ctx)
 {
 	return wlan_sap_get_vht_ch_width(sap_ctx);