Browse Source

qcacld-3.0: Add ini support to disable scan in connected state

Currently there is no ini parameter to disable the scanning if
the device is already connected.

Add ini parameter to support this feature.

Change-Id: I0f57be99ea335823c30a058d166b126d787e4461
CRs-Fixed: 2054521
Ashish Kumar Dhanotiya 8 năm trước cách đây
mục cha
commit
470af29603
3 tập tin đã thay đổi với 53 bổ sung0 xóa
  1. 24 0
      core/hdd/inc/wlan_hdd_cfg.h
  2. 10 0
      core/hdd/src/wlan_hdd_cfg.c
  3. 19 0
      core/hdd/src/wlan_hdd_scan.c

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

@@ -66,6 +66,29 @@
 #define MAX_CFG_INI_ITEMS   1024
 
 /* Defines for all of the things we read from the configuration (registry). */
+/*
+ * <ini>
+ * gEnableConnectedScan - Will enable or disable scan in connected state
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to enable or disable the scanning in
+ * Connected state
+ *
+ * Related: None
+ *
+ * Supported Feature: STA
+ *
+ * Usage: External
+ *
+ * <ini>
+ */
+
+#define CFG_ENABLE_CONNECTED_SCAN_NAME        "gEnableConnectedScan"
+#define CFG_ENABLE_CONNECTED_SCAN_MIN         (0)
+#define CFG_ENABLE_CONNECTED_SCAN_MAX         (1)
+#define CFG_ENABLE_CONNECTED_SCAN_DEFAULT     (1)
 
 /*
  * <ini>
@@ -10231,6 +10254,7 @@ struct hdd_config {
 	DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS);
 
 	/* Config parameters */
+	bool enable_connected_scan;
 	uint32_t RTSThreshold;
 	uint32_t FragmentationThreshold;
 	uint8_t OperatingChannel;

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

@@ -329,6 +329,13 @@ cb_notify_set_roam_scan_hi_rssi_scan_params(hdd_context_t *hdd_ctx,
 
 
 struct reg_table_entry g_registry_table[] = {
+	REG_VARIABLE(CFG_ENABLE_CONNECTED_SCAN_NAME, WLAN_PARAM_Integer,
+		     struct hdd_config, enable_connected_scan,
+		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		     CFG_ENABLE_CONNECTED_SCAN_DEFAULT,
+		     CFG_ENABLE_CONNECTED_SCAN_MIN,
+		     CFG_ENABLE_CONNECTED_SCAN_MAX),
+
 	REG_VARIABLE(CFG_RTS_THRESHOLD_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, RTSThreshold,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -5915,6 +5922,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
 	hdd_debug("Name = [%s] value = [%u]",
 		 CFG_FORCE_1X1_NAME,
 		 pHddCtx->config->is_force_1x1);
+	hdd_info("Name = [%s] Value = %u",
+		CFG_ENABLE_CONNECTED_SCAN_NAME,
+		pHddCtx->config->enable_connected_scan);
 }
 
 

+ 19 - 0
core/hdd/src/wlan_hdd_scan.c

@@ -1552,6 +1552,17 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 	if (!sme_is_session_id_valid(pHddCtx->hHal, pAdapter->sessionId))
 		return -EINVAL;
 
+	if ((eConnectionState_Associated ==
+			WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)->
+						conn_info.connState) &&
+	    (!pHddCtx->config->enable_connected_scan)) {
+		hdd_info("enable_connected_scan is false, Aborting scan");
+		pAdapter->request = request;
+		pAdapter->scan_source = source;
+		schedule_work(&pAdapter->scan_block_work);
+		return 0;
+	}
+
 	hdd_debug("Device_mode %s(%d)",
 		hdd_device_mode_to_string(pAdapter->device_mode),
 		pAdapter->device_mode);
@@ -2556,6 +2567,14 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
+	if ((eConnectionState_Associated ==
+				WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)->
+							conn_info.connState) &&
+	    (!pHddCtx->config->enable_connected_scan)) {
+		hdd_info("enable_connected_scan is false, Aborting scan");
+		return -EBUSY;
+	}
+
 	if (!sme_is_session_id_valid(pHddCtx->hHal, pAdapter->sessionId))
 		return -EINVAL;