Browse Source

qcacld-3.0: Fix regression in the sched_scan interval value

In Kernel commit 3b06d27 ("cfg80211: Add multiple scan plans
			  for scheduled scan")

The interval in the sched_scan plan request is changed to second.
Driver needs to do the conversion to msec before set to firmware.

Also, driver can only support one sched_plan so far, so set this
back to wiphy and adds sanity check when request comes to driver.

Change-Id: Id725f2726e1caafe48c6b76d59a24f71ffa01af6
CRs-fixed: 1029203
Ryan Hsu 8 years ago
parent
commit
b736bc55f2
3 changed files with 20 additions and 4 deletions
  1. 3 0
      core/hdd/src/wlan_hdd_cfg80211.c
  2. 16 4
      core/hdd/src/wlan_hdd_scan.c
  3. 1 0
      core/mac/inc/sir_api.h

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

@@ -6123,6 +6123,9 @@ int wlan_hdd_cfg80211_init(struct device *dev,
 		wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS;
 		wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS;
 		wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || defined(WITH_BACKPORTS)
+		wiphy->max_sched_scan_plans = SIR_PNO_MAX_PLAN_REQUEST;
+#endif
 	}
 #endif /*FEATURE_WLAN_SCAN_PNO */
 

+ 16 - 4
core/hdd/src/wlan_hdd_scan.c

@@ -2250,9 +2250,10 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
 	 *
 	 * After Kernel 4.4
 	 *   User can configure multiple scan_plans, each scan would have
-	 *   separate scan cycle and interval. For our use case, we would
-	 *   only have supplicant set one scan_plan, and firmware also support
-	 *   only one as well, so pick up the first index.
+	 *   separate scan cycle and interval. (interval is in unit of second.)
+	 *   For our use case, we would only have supplicant set one scan_plan,
+	 *   and firmware also support only one as well, so pick up the first
+	 *   index.
 	 *
 	 *   Taking power consumption into account
 	 *   firmware after gPNOScanTimerRepeatValue times fast_scan_period
@@ -2260,7 +2261,18 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
 	 *   shall be in slow_scan_period mode until next PNO Start.
 	 */
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) || defined(WITH_BACKPORTS)
-	pPnoRequest->fast_scan_period = request->scan_plans[0].interval;
+	if (WARN_ON(request->n_scan_plans > SIR_PNO_MAX_PLAN_REQUEST)) {
+		ret = -EINVAL;
+		goto error;
+	}
+
+	/* TBD: only one sched_scan plan we can support now, so we only
+	 * retrieve the first plan and ignore the rest of them.
+	 * If there are more than 1 sched_pan request we can support, the
+	 * PnoRequet structure will also need to be revised.
+	 */
+	pPnoRequest->fast_scan_period = request->scan_plans[0].interval *
+						MSEC_PER_SEC;
 #else
 	pPnoRequest->fast_scan_period = request->interval;
 #endif

+ 1 - 0
core/mac/inc/sir_api.h

@@ -2716,6 +2716,7 @@ typedef struct sAniIbssRouteTable {
 
 
 /* Set PNO */
+#define SIR_PNO_MAX_PLAN_REQUEST   1
 #define SIR_PNO_MAX_NETW_CHANNELS  26
 #define SIR_PNO_MAX_NETW_CHANNELS_EX  60
 #define SIR_PNO_MAX_SUPP_NETWORKS  16