summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaurank kathpalia <gkathpal@codeaurora.org>2018-01-15 16:27:31 +0530
committersnandini <snandini@codeaurora.org>2018-01-24 01:51:02 -0800
commit8b6039f463d2279cf4e73c80f0abeb8e9e1f9299 (patch)
treeae2afe4a8b4f34d9d13adc8ce69af232635a109c
parent7912b966e3cd5ed66ba22233489a093f91fa1e46 (diff)
qcacld-3.0: Modify dwell time and DBS scan based on scan request
Based on the the scan request flags from kernel, modify the adaptive dwell time , and the DBS scan request. In high accuracy mode, disable DBS scan and adaptive dwell time scan mode. In a low power/span mode, enable aggressive adaptive dwell time and DBS scan to save power and time. Change-Id: I23498799c05a252cbc9c9f6d50b847130dd0ceac CRs-Fixed: 2173156
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c15
-rw-r--r--core/hdd/src/wlan_hdd_scan.c61
-rw-r--r--core/hdd/src/wlan_hdd_scan.h10
-rw-r--r--core/sme/inc/csr_api.h1
-rw-r--r--core/sme/inc/sme_api.h31
-rw-r--r--core/sme/src/csr/csr_api_scan.c9
6 files changed, 109 insertions, 18 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index c52aca33387f..5d145a3b855e 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -13579,6 +13579,19 @@ static void wlan_hdd_cfg80211_set_wiphy_fils_feature(struct wiphy *wiphy)
}
#endif
+#if defined (CFG80211_SCAN_DBS_CONTROL_SUPPORT) || \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0))
+static void wlan_hdd_cfg80211_set_wiphy_scan_flags(struct wiphy *wiphy)
+{
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_LOW_SPAN_SCAN);
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_LOW_POWER_SCAN);
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN);
+}
+#else
+static void wlan_hdd_cfg80211_set_wiphy_scan_flags(struct wiphy *wiphy)
+{
+}
+#endif
/*
* FUNCTION: wlan_hdd_cfg80211_init
* This function is called by hdd_wlan_startup()
@@ -13645,6 +13658,8 @@ int wlan_hdd_cfg80211_init(struct device *dev,
if (pCfg->is_fils_enabled)
wlan_hdd_cfg80211_set_wiphy_fils_feature(wiphy);
+ wlan_hdd_cfg80211_set_wiphy_scan_flags(wiphy);
+
hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg);
wlan_hdd_cfg80211_add_connected_pno_support(wiphy);
diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c
index e6609e8c5ee5..1f84f1ea41a4 100644
--- a/core/hdd/src/wlan_hdd_scan.c
+++ b/core/hdd/src/wlan_hdd_scan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -603,22 +603,36 @@ static int hdd_indicate_scan_result(struct hdd_scan_info *scanInfo,
* 2. Directed scan
* 3. Channel list has only few channels
* 4. Channel list has single band channels
- * For remaining cases, dbs scan is requested.
+ * 5. A high accuracy scan request is sent by kernel.
*
+ * DBS scan is enabled for these conditions:
+ * 1. A low power or low span scan request is sent by kernel.
+ * For remaining cases DBS is enabled by default.
* Return: void
*/
static void hdd_update_dbs_scan_ctrl_ext_flag(hdd_context_t *hdd_ctx,
tCsrScanRequest *scan_req)
{
uint32_t num_chan;
- uint32_t scan_dbs_policy = HDD_SCAN_DBS_POLICY_FORCE_NONDBS;
+ uint32_t scan_dbs_policy = SME_SCAN_DBS_POLICY_FORCE_NONDBS;
uint32_t conn_cnt;
/* Resetting the scan_ctrl_flags_ext to 0 */
scan_req->scan_ctrl_flags_ext = 0;
+ if (scan_req->scan_flags & SME_SCAN_FLAG_HIGH_ACCURACY) {
+ hdd_debug("DBS disabled due to high accuracy scan request");
+ goto end;
+ }
+ if (scan_req->scan_flags & SME_SCAN_FLAG_LOW_POWER ||
+ scan_req->scan_flags & SME_SCAN_FLAG_LOW_SPAN) {
+ hdd_debug("DBS enable due to Low span/power request 0x%x",
+ scan_req->scan_flags);
+ scan_dbs_policy = SME_SCAN_DBS_POLICY_IGNORE_DUTY;
+ goto end;
+ }
if (!(hdd_ctx->is_dbs_scan_duty_cycle_enabled)) {
- scan_dbs_policy = HDD_SCAN_DBS_POLICY_IGNORE_DUTY;
+ scan_dbs_policy = SME_SCAN_DBS_POLICY_IGNORE_DUTY;
hdd_info("DBS scan duty cycle is disabled");
goto end;
}
@@ -632,7 +646,7 @@ static void hdd_update_dbs_scan_ctrl_ext_flag(hdd_context_t *hdd_ctx,
conn_cnt = cds_get_connection_count();
if (conn_cnt > 0) {
hdd_debug("%d active connections, go for DBS scan", conn_cnt);
- scan_dbs_policy = HDD_SCAN_DBS_POLICY_DEFAULT;
+ scan_dbs_policy = SME_SCAN_DBS_POLICY_DEFAULT;
goto end;
}
@@ -654,7 +668,7 @@ static void hdd_update_dbs_scan_ctrl_ext_flag(hdd_context_t *hdd_ctx,
/* num_chan=0 means all channels */
if (!num_chan)
- scan_dbs_policy = HDD_SCAN_DBS_POLICY_DEFAULT;
+ scan_dbs_policy = SME_SCAN_DBS_POLICY_DEFAULT;
if (num_chan < HDD_MIN_CHAN_DBS_SCAN_THRESHOLD)
goto end;
@@ -663,7 +677,7 @@ static void hdd_update_dbs_scan_ctrl_ext_flag(hdd_context_t *hdd_ctx,
if (!CDS_IS_SAME_BAND_CHANNELS(
scan_req->ChannelInfo.ChannelList[0],
scan_req->ChannelInfo.ChannelList[num_chan-1])) {
- scan_dbs_policy = HDD_SCAN_DBS_POLICY_DEFAULT;
+ scan_dbs_policy = SME_SCAN_DBS_POLICY_DEFAULT;
break;
}
num_chan--;
@@ -671,8 +685,8 @@ static void hdd_update_dbs_scan_ctrl_ext_flag(hdd_context_t *hdd_ctx,
end:
scan_req->scan_ctrl_flags_ext |=
- ((scan_dbs_policy << HDD_SCAN_FLAG_EXT_DBS_SCAN_POLICY_BIT)
- & HDD_SCAN_FLAG_EXT_DBS_SCAN_POLICY_MASK);
+ ((scan_dbs_policy << SME_SCAN_FLAG_EXT_DBS_SCAN_POLICY_BIT)
+ & SME_SCAN_FLAG_EXT_DBS_SCAN_POLICY_MASK);
hdd_debug("scan_ctrl_flags_ext: 0x%x", scan_req->scan_ctrl_flags_ext);
}
@@ -1855,6 +1869,34 @@ static int wlan_hdd_populate_ie_whitelist(hdd_adapter_t *adapter,
}
/**
+ * wlan_hdd_scan_flags() - Set scan flags according to scan request
+ * @scan_req: Pointer to csr scan req
+ *
+ * Return: None
+ */
+#if defined(CFG80211_SCAN_DBS_CONTROL_SUPPORT) || \
+ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0))
+static void hdd_update_scan_flags(tCsrScanRequest *scan_req,
+ struct cfg80211_scan_request *request)
+{
+ if (!request)
+ return;
+
+ if (request->flags & NL80211_SCAN_FLAG_HIGH_ACCURACY)
+ scan_req->scan_flags |= SME_SCAN_FLAG_HIGH_ACCURACY;
+ if (request->flags & NL80211_SCAN_FLAG_LOW_SPAN)
+ scan_req->scan_flags |= SME_SCAN_FLAG_LOW_SPAN;
+ if (request->flags & NL80211_SCAN_FLAG_LOW_POWER)
+ scan_req->scan_flags |= SME_SCAN_FLAG_LOW_POWER;
+
+}
+#else
+static void hdd_update_scan_flags(tCsrScanRequest *scan_req,
+ struct cfg80211_scan_request *request)
+{
+}
+#endif
+/**
* wlan_hdd_free_voui() - Deallocate csr scan req ie whitelist attrs
* @scan_req: Pointer to csr scan req
*
@@ -2354,6 +2396,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
if (status)
goto free_mem;
+ hdd_update_scan_flags(&scan_req, request);
hdd_update_dbs_scan_ctrl_ext_flag(pHddCtx, &scan_req);
qdf_runtime_pm_prevent_suspend(&pHddCtx->runtime_context.scan);
wma_get_scan_id(&scan_req_id);
diff --git a/core/hdd/src/wlan_hdd_scan.h b/core/hdd/src/wlan_hdd_scan.h
index 3acabc05f942..518b0497bc63 100644
--- a/core/hdd/src/wlan_hdd_scan.h
+++ b/core/hdd/src/wlan_hdd_scan.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -37,14 +37,6 @@
/* (30 Mins) */
#define MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT (30 * 60 * 1000)
-/* DBS Scan policy selection ext flags */
-#define HDD_SCAN_FLAG_EXT_DBS_SCAN_POLICY_MASK 0x00000003
-#define HDD_SCAN_FLAG_EXT_DBS_SCAN_POLICY_BIT 0
-#define HDD_SCAN_DBS_POLICY_DEFAULT 0x0
-#define HDD_SCAN_DBS_POLICY_FORCE_NONDBS 0x1
-#define HDD_SCAN_DBS_POLICY_IGNORE_DUTY 0x2
-#define HDD_SCAN_DBS_POLICY_MAX 0x3
-
/* Minimum number of channels for enabling DBS Scan */
#define HDD_MIN_CHAN_DBS_SCAN_THRESHOLD 8
diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h
index 2e934530ad8f..9d7c7e8e2993 100644
--- a/core/sme/inc/csr_api.h
+++ b/core/sme/inc/csr_api.h
@@ -298,6 +298,7 @@ typedef struct tagCsrScanRequest {
enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode;
eCsrRequestType requestType; /* 11d scan or full scan */
uint32_t scan_ctrl_flags_ext; /* Scan control flags extended */
+ uint32_t scan_flags;
bool p2pSearch;
bool skipDfsChnlInP2pSearch;
bool bcnRptReqScan; /* is Scan issued by Beacon Report Request */
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 9a750586d0dc..6efac4f2924d 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -77,6 +77,14 @@
#define SME_ENTER() sme_logfl(QDF_TRACE_LEVEL_DEBUG, "enter")
#define SME_EXIT() sme_logfl(QDF_TRACE_LEVEL_DEBUG, "exit")
+/* DBS Scan policy selection ext flags */
+#define SME_SCAN_FLAG_EXT_DBS_SCAN_POLICY_MASK 0x00000003
+#define SME_SCAN_FLAG_EXT_DBS_SCAN_POLICY_BIT 0
+#define SME_SCAN_DBS_POLICY_DEFAULT 0x0
+#define SME_SCAN_DBS_POLICY_FORCE_NONDBS 0x1
+#define SME_SCAN_DBS_POLICY_IGNORE_DUTY 0x2
+#define SME_SCAN_DBS_POLICY_MAX 0x3
+
#define SME_SESSION_ID_ANY 50
#define SME_INVALID_COUNTRY_CODE "XX"
@@ -224,6 +232,29 @@ struct sme_oem_capability {
};
/**
+ * enum sme_scan_flags - scan request control flags
+ *
+ * @SME_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time
+ * taken to accomplish the scan. Thus, this flag intends the driver to
+ * perform the scan request with lesser span/duration. It is specific to
+ * the driver implementations on how this is accomplished. Scan accuracy
+ * may get impacted with this flag. This flag cannot be used with
+ * @SME_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts
+ * to consume optimal possible power. Drivers can resort to their
+ * specific means to optimize the power. Scan accuracy may get impacted
+ * with this flag.
+ * @SME_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the
+ * extent of scan results obtained. Thus HIGH_ACCURACY scan flag aims to
+ * get maximum possible scan results. This flag hints the driver to use
+ * the best possible scan configuration to improve the accuracy in
+ * scanning.Latency and power use may get impacted with this flag.
+ */
+enum sme_scan_flags {
+ SME_SCAN_FLAG_LOW_SPAN = 1<<0,
+ SME_SCAN_FLAG_LOW_POWER = 1<<1,
+ SME_SCAN_FLAG_HIGH_ACCURACY = 1<<2,
+};
+/**
* struct sme_5g_pref_params : 5G preference params to be read from ini
* @rssi_boost_threshold_5g: RSSI threshold above which 5 GHz is favored
* @rssi_boost_factor_5g: Factor by which 5GHz RSSI is boosted
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c
index f54fa612cc0a..a91443192338 100644
--- a/core/sme/src/csr/csr_api_scan.c
+++ b/core/sme/src/csr/csr_api_scan.c
@@ -604,6 +604,15 @@ QDF_STATUS csr_scan_request(tpAniSirGlobal pMac, uint16_t sessionId,
cfg_prm->scan_adaptive_dwell_mode;
}
+ if (scan_req->scan_flags & SME_SCAN_FLAG_HIGH_ACCURACY)
+ scan_req->scan_adaptive_dwell_mode = WMI_DWELL_MODE_STATIC;
+
+ if (scan_req->scan_flags & SME_SCAN_FLAG_LOW_POWER ||
+ scan_req->scan_flags & SME_SCAN_FLAG_LOW_SPAN) {
+ scan_req->scan_adaptive_dwell_mode = WMI_DWELL_MODE_AGGRESSIVE;
+ }
+ sme_debug("Set scan adaptive dwell mode %d ",
+ scan_req->scan_adaptive_dwell_mode);
status = csr_scan_copy_request(pMac, &scan_cmd->u.scanCmd.u.scanRequest,
scan_req);
/*