Browse Source

qcacmn: Set passive dwell time

Set passive dwell time to 28msecs for active
scan when bt a2dp is enabled and hw is not dbs
capable and when sta is connected on 2G band.

Change-Id: I44f2e3d98f2d7ddc52e4902ba989131c256da4ef
CRs-Fixed: 2160963
Yeshwanth Sriram Guntuka 7 years ago
parent
commit
b9e2f66377

+ 7 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -2198,4 +2198,11 @@ void policy_mgr_set_weight_of_dfs_passive_channels_to_zero(
  */
 bool policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(
 		struct wlan_objmgr_psoc *psoc);
+/**
+ * policy_mgr_is_sta_connected_2g() - check if sta connected in 2g
+ * @psoc: pointer to soc
+ *
+ * Return: true if sta is connected in 2g else false
+ */
+bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc);
 #endif /* __WLAN_POLICY_MGR_API_H */

+ 24 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -2740,3 +2740,27 @@ bool policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(
 
 	return status;
 }
+
+bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	uint32_t conn_index;
+	bool ret = false;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return ret;
+	}
+	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
+	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+	     conn_index++) {
+		if (pm_conc_connection_list[conn_index].mode == PM_STA_MODE &&
+		    pm_conc_connection_list[conn_index].chan <= 14 &&
+		    pm_conc_connection_list[conn_index].in_use)
+			ret = true;
+	}
+	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
+
+	return ret;
+}

+ 3 - 1
umac/scan/core/src/wlan_scan_main.h

@@ -130,7 +130,8 @@
  */
 #define SCAN_FLAG_EXT_FILTER_PUBLIC_ACTION_FRAME 0x4
 
-
+/* Passive dwell time if bt_a2dp is enabled. Time in msecs*/
+#define PASSIVE_DWELL_TIME_BT_A2DP_ENABLED 28
 
 /**
  * struct cb_handler - defines scan event handler
@@ -413,6 +414,7 @@ struct wlan_scan_obj {
 	struct pdev_scan_info pdev_info[WLAN_UMAC_MAX_PDEVS];
 	struct pno_def_config pno_cfg;
 	struct probe_req_whitelist_attr ie_whitelist;
+	bool bt_a2dp_enabled;
 };
 
 /**

+ 17 - 0
umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h

@@ -527,4 +527,21 @@ bool ucfg_ie_whitelist_enabled(struct wlan_objmgr_psoc *psoc,
  */
 bool ucfg_copy_ie_whitelist_attrs(struct wlan_objmgr_psoc *psoc,
 				struct probe_req_whitelist_attr *ie_whitelist);
+
+/**
+ * ucfg_scan_set_bt_activity() - API to set bt activity
+ * @psoc: pointer to psoc object
+ * @bt_a2dp_active: bt activiy value
+ *
+ * Return: None
+ */
+void ucfg_scan_set_bt_activity(struct wlan_objmgr_psoc *psoc,
+			       bool bt_a2dp_active);
+/**
+ * ucfg_scan_get_bt_activity() - API to get bt activity
+ * @psoc: pointer to psoc object
+ *
+ * Return: true if enabled else false.
+ */
+bool ucfg_scan_get_bt_activity(struct wlan_objmgr_psoc *psoc);
 #endif

+ 52 - 0
umac/scan/dispatcher/src/wlan_scan_ucfg_api.c

@@ -1015,9 +1015,34 @@ static void ucfg_scan_req_update_params(struct wlan_objmgr_vdev *vdev,
 	if (ap_or_go_present)
 		req->scan_req.min_rest_time = req->scan_req.max_rest_time;
 }
+
+/**
+ * ucfg_update_passive_dwell_time() - update dwell passive time
+ * @vdev: vdev object
+ * @dwell_time: pointer to passive dwell time
+ *
+ * Return: None
+ */
+static void ucfg_update_passive_dwell_time(struct wlan_objmgr_vdev *vdev,
+					   uint32_t *dwell_time)
+{
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_vdev_get_psoc(vdev);
+
+	if (!psoc)
+		return;
+
+	if (policy_mgr_is_sta_connected_2g(psoc) &&
+	    !policy_mgr_is_hw_dbs_capable(psoc) &&
+	    ucfg_scan_get_bt_activity(psoc))
+		*dwell_time = PASSIVE_DWELL_TIME_BT_A2DP_ENABLED;
+}
 #else
 static inline void ucfg_scan_req_update_params(struct wlan_objmgr_vdev *vdev,
 	struct scan_start_request *req){}
+static inline void ucfg_update_passive_dwell_time(struct wlan_objmgr_vdev *vdev,
+						  uint32_t *dwell_time){}
 #endif
 
 
@@ -1056,6 +1081,7 @@ ucfg_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
 	req->scan_req.scan_events = def->scan_events;
 	req->scan_req.scan_random.randomize = def->enable_mac_spoofing;
 	ucfg_scan_req_update_params(vdev, req);
+	ucfg_update_passive_dwell_time(vdev, &req->scan_req.dwell_time_passive);
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -1608,3 +1634,29 @@ bool ucfg_ie_whitelist_enabled(struct wlan_objmgr_psoc *psoc,
 
 	return true;
 }
+
+void ucfg_scan_set_bt_activity(struct wlan_objmgr_psoc *psoc,
+			       bool bt_a2dp_active)
+{
+	struct wlan_scan_obj *scan_obj;
+
+	scan_obj = wlan_psoc_get_scan_obj(psoc);
+	if (!scan_obj) {
+		scm_err("Failed to get scan object");
+		return;
+	}
+	scan_obj->bt_a2dp_enabled = bt_a2dp_active;
+}
+
+bool ucfg_scan_get_bt_activity(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_scan_obj *scan_obj;
+
+	scan_obj = wlan_psoc_get_scan_obj(psoc);
+	if (!scan_obj) {
+		scm_err("Failed to get scan object");
+		return false;
+	}
+
+	return scan_obj->bt_a2dp_enabled;
+}