summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnurag Chouhan <achouhan@codeaurora.org>2016-10-28 18:52:27 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-11-11 19:51:06 +0530
commitfbef740168f0907ee0c069bb87d0610fb6a1e080 (patch)
treebb03ff606dbc3c3ce305872dd3c884d279f43451
parentec2911393f217392ec31a9481acbfb06afe23dd8 (diff)
qcacld-2.0: Add support to honour multiple scan plans
Add Support to configure multiple 'scan plans' for scheduled scan. Each 'scan plan' defines the number of scan cycles and the interval between scans. The scan plans are executed in the order they were configured. The last scan plan will always run infinitely and thus defines only the interval between scans The maximum number of scan plans supported by the device and the maximum number of iterations in a single scan plan are advertised to userspace so it can configure the scan plans appropriately. Change-Id: I9afc1f97ebb55caa5121f3623d7bbeb6ba63df7b CRs-Fixed: 1083591
-rw-r--r--CORE/HDD/inc/wlan_hdd_cfg.h20
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg.c15
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c95
3 files changed, 114 insertions, 16 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
index 8088b1fdb453..cb33d4662484 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -4138,6 +4138,24 @@ FG_BTC_BT_INTERVAL_PAGE_P2P_STA_DEFAULT
#define CFG_TARGET_WAKEUP_TYPE_MAX (4)
#define CFG_TARGET_WAKEUP_TYPE_DEFAULT (1)
+/*
+ * maximum interval (in seconds) for a
+ * single scan plan supported by the device.
+ */
+#define CFG_MAX_SCHED_SCAN_PLAN_INT_NAME "g_max_sched_scan_plan_int"
+#define CFG_MAX_SCHED_SCAN_PLAN_INT_MIN (1)
+#define CFG_MAX_SCHED_SCAN_PLAN_INT_MAX (7200)
+#define CFG_MAX_SCHED_SCAN_PLAN_INT_DEFAULT (3600)
+
+/*
+ * maximum number of iterations for a single
+ * scan plan supported by the device.
+ */
+#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_NAME "g_max_sched_scan_plan_itrns"
+#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MIN (1)
+#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MAX (100)
+#define CFG_MAX_SCHED_SCAN_PLAN_ITRNS_DEFAULT (10)
+
/*---------------------------------------------------------------------------
Type declarations
-------------------------------------------------------------------------*/
@@ -4941,6 +4959,8 @@ struct hdd_config {
uint32_t host_wakeup_type;
uint32_t target_wakeup_gpio;
uint32_t target_wakeup_type;
+ uint32_t max_sched_scan_plan_interval;
+ uint32_t max_sched_scan_plan_iterations;
};
typedef struct hdd_config hdd_config_t;
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index c61265a6daec..9d7b69453d2f 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -4772,6 +4772,21 @@ REG_TABLE_ENTRY g_registry_table[] =
CFG_TARGET_WAKEUP_TYPE_DEFAULT,
CFG_TARGET_WAKEUP_TYPE_MIN,
CFG_TARGET_WAKEUP_TYPE_MAX),
+
+ REG_VARIABLE(CFG_MAX_SCHED_SCAN_PLAN_INT_NAME, WLAN_PARAM_Integer,
+ hdd_config_t, max_sched_scan_plan_interval,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_MAX_SCHED_SCAN_PLAN_INT_DEFAULT,
+ CFG_MAX_SCHED_SCAN_PLAN_INT_MIN,
+ CFG_MAX_SCHED_SCAN_PLAN_INT_MAX),
+
+ REG_VARIABLE(CFG_MAX_SCHED_SCAN_PLAN_ITRNS_NAME, WLAN_PARAM_Integer,
+ hdd_config_t, max_sched_scan_plan_iterations,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_MAX_SCHED_SCAN_PLAN_ITRNS_DEFAULT,
+ CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MIN,
+ CFG_MAX_SCHED_SCAN_PLAN_ITRNS_MAX),
+
};
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 4695c960680b..ea7c4dc74ece 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -131,6 +131,13 @@
#define WLAN_HDD_TGT_NOISE_FLOOR_DBM (-96)
+/*
+ * max_sched_scan_plans defined to 2 for
+ * (1)fast scan
+ * (2)slow scan
+ */
+#define MAX_SCHED_SCAN_PLANS 2
+
/* For IBSS, enable obss, fromllb, overlapOBSS & overlapFromllb protection
check. The bit map is defined in:
@@ -12361,6 +12368,33 @@ struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size)
return wiphy;
}
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(4,4,0)) || \
+ defined (CFG80211_MULTI_SCAN_PLAN_BACKPORT)
+/**
+ * hdd_config_sched_scan_plans_to_wiphy() - configure sched scan plans to wiphy
+ * @wiphy: pointer to wiphy
+ * @config: pointer to config
+ *
+ * Return: None
+ */
+static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy,
+ hdd_config_t *config)
+{
+ wiphy->max_sched_scan_plans = MAX_SCHED_SCAN_PLANS;
+ if (config->max_sched_scan_plan_interval)
+ wiphy->max_sched_scan_plan_interval =
+ config->max_sched_scan_plan_interval;
+ if (config->max_sched_scan_plan_iterations)
+ wiphy->max_sched_scan_plan_iterations =
+ config->max_sched_scan_plan_iterations;
+}
+#else
+static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy,
+ hdd_config_t *config)
+{
+}
+#endif
+
/*
* FUNCTION: wlan_hdd_cfg80211_init
* This function is called by hdd_wlan_startup()
@@ -12605,6 +12639,9 @@ int wlan_hdd_cfg80211_init(struct device *dev,
wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
#endif
wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER;
+
+ hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg);
+
EXIT();
return 0;
}
@@ -22328,6 +22365,47 @@ static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *adapter)
return eHAL_STATUS_FAILURE;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)) || \
+ defined (CFG80211_MULTI_SCAN_PLAN_BACKPORT)
+/**
+ * hdd_config_sched_scan_plan() - configures the sched scan plans
+ * from the framework.
+ * @pno_req: pointer to PNO scan request
+ * @request: pointer to scan request from framework
+ *
+ * Return: None
+ */
+static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req,
+ struct cfg80211_sched_scan_request *request
+ hdd_context_t *hdd_ctx)
+{
+ pno_req->fast_scan_period =
+ request->scan_plans[0].interval * MSEC_PER_SEC;
+ pno_req->fast_scan_max_cycles = request->scan_plans[0].iterations;
+ pno_req->slow_scan_period =
+ request->scan_plans[1].interval * MSEC_PER_SEC;
+ hddLog(LOGE, "Base scan interval: %d sec, scan cycles: %d, slow scan interval %d",
+ request->scan_plans[0].interval,
+ request->scan_plans[0].iterations,
+ request->scan_plans[1].interval);
+
+}
+#else
+static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req,
+ struct cfg80211_sched_scan_request *request,
+ hdd_context_t *hdd_ctx)
+{
+ pno_req->fast_scan_period = request->interval;
+ pno_req->fast_scan_max_cycles =
+ hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue;
+ pno_req->slow_scan_period =
+ hdd_ctx->cfg_ini->pno_slow_scan_multiplier *
+ pno_req->fast_scan_period;
+ hddLog(LOGE, "Base scan interval: %d sec PNOScanTimerRepeatValue: %d",
+ (request->interval / 1000),
+ hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue);
+}
+#endif
/*
* FUNCTION: __wlan_hdd_cfg80211_sched_scan_start
@@ -22565,22 +22643,7 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
pPnoRequest->us5GProbeTemplateLen);
}
- /*
- * Driver gets only one time interval which is hard coded in
- * supplicant for 10000ms. Taking power consumption into account
- * firmware after gPNOScanTimerRepeatValue times fast_scan_period switches
- * slow_scan_period. This is less frequent scans and firmware shall be
- * in slow_scan_period mode until next PNO Start.
- */
- pPnoRequest->fast_scan_period = request->interval;
- pPnoRequest->fast_scan_max_cycles =
- pHddCtx->cfg_ini->configPNOScanTimerRepeatValue;
- pPnoRequest->slow_scan_period = pHddCtx->cfg_ini->pno_slow_scan_multiplier *
- pPnoRequest->fast_scan_period;
-
- hddLog(LOG1, "Base scan interval: %d sec PNOScanTimerRepeatValue: %d",
- (request->interval / 1000),
- pHddCtx->cfg_ini->configPNOScanTimerRepeatValue);
+ hdd_config_sched_scan_plan(pPnoRequest, request, pHddCtx);
pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE;