Bläddra i källkod

qcacmn: Restrict dwell time only if SAP/GO is connected

Currently, in case of SAP/GO present active dwell time of scan req
on STA iface is restricted. This can result in less scan time but
STA can miss some AP's. So, decrease dwell time only if some client
is connected to SAP or GO.

Change-Id: I46fb76792941b7c79f541b8b358d02bb944f0086
CRs-Fixed: 2436910
Bala Venkatesh 6 år sedan
förälder
incheckning
d0838f8a9c

+ 22 - 0
umac/cmn_services/utils/inc/wlan_utility.h

@@ -44,6 +44,16 @@ struct wlan_vdev_ch_check_filter {
 };
 #endif
 
+/**
+ * struct wlan_peer_count- vdev connected peer count
+ * @opmode: QDF mode
+ * @peer_count: peer count
+ **/
+struct wlan_op_mode_peer_count {
+	enum QDF_OPMODE opmode;
+	uint16_t peer_count;
+};
+
 /**
  * wlan_chan_to_freq() - converts channel to frequency
  * @chan: channel number
@@ -297,4 +307,16 @@ QDF_STATUS wlan_util_is_pdev_restart_progress(struct wlan_objmgr_pdev *pdev,
  */
 QDF_STATUS wlan_util_is_pdev_scan_allowed(struct wlan_objmgr_pdev *pdev,
 					  wlan_objmgr_ref_dbgid dbg_id);
+
+/**
+ * wlan_util_get_mode_specific_peer_coun - This api gives vdev mode specific
+ * peer count`
+ * @pdev: PDEV object
+ * @mode: Operation mode.
+ *
+ * Return: int- peer count
+ */
+uint16_t wlan_util_get_peer_count_for_mode(struct wlan_objmgr_pdev *pdev,
+					   enum QDF_OPMODE mode);
+
 #endif /* _WLAN_UTILITY_H_ */

+ 43 - 0
umac/cmn_services/utils/src/wlan_utility.c

@@ -510,3 +510,46 @@ wlan_util_stats_get_rssi(bool db2dbm_enabled, int32_t bcn_snr, int32_t dat_snr,
 		*rssi = snr + TGT_NOISE_FLOOR_DBM;
 	}
 }
+
+/**
+ * wlan_util_get_mode_specific_peer_count - This api gives vdev mode specific
+ * peer count`
+ * @pdev: PDEV object
+ * @object: vdev object
+ * @arg: argument passed by caller
+ *
+ * Return: void
+ */
+static void
+wlan_util_get_mode_specific_peer_count(struct wlan_objmgr_pdev *pdev,
+				       void *object, void *arg)
+{
+	struct wlan_objmgr_vdev *vdev = object;
+	uint16_t temp_count = 0;
+	struct wlan_op_mode_peer_count *count = arg;
+
+	wlan_vdev_obj_lock(vdev);
+	if (wlan_vdev_mlme_get_opmode(vdev) == count->opmode) {
+		temp_count = wlan_vdev_get_peer_count(vdev);
+		/* Decrement the self peer count */
+		if (temp_count > 1)
+			count->peer_count += (temp_count - 1);
+	}
+	wlan_vdev_obj_unlock(vdev);
+}
+
+uint16_t wlan_util_get_peer_count_for_mode(struct wlan_objmgr_pdev *pdev,
+					   enum QDF_OPMODE mode)
+{
+	struct wlan_op_mode_peer_count count;
+
+	count.opmode = mode;
+	count.peer_count = 0;
+	wlan_objmgr_pdev_iterate_obj_list(pdev,
+					  WLAN_VDEV_OP,
+				wlan_util_get_mode_specific_peer_count,
+				&count, 0, WLAN_OBJMGR_ID);
+
+	return count.peer_count;
+}
+

+ 21 - 9
umac/scan/core/src/wlan_scan_manager.c

@@ -563,10 +563,14 @@ static void scm_req_update_concurrency_params(struct wlan_objmgr_vdev *vdev,
 {
 	bool ap_present, go_present, sta_active, p2p_cli_present, ndi_present;
 	struct wlan_objmgr_psoc *psoc;
+	uint16_t sap_peer_count = 0;
+	uint16_t go_peer_count = 0;
+	struct wlan_objmgr_pdev *pdev;
 
 	psoc = wlan_vdev_get_psoc(vdev);
+	pdev = wlan_vdev_get_pdev(vdev);
 
-	if (!psoc)
+	if (!psoc || !pdev)
 		return;
 
 	ap_present = policy_mgr_mode_specific_connection_count(
@@ -579,6 +583,12 @@ static void scm_req_update_concurrency_params(struct wlan_objmgr_vdev *vdev,
 				psoc, PM_STA_MODE, NULL);
 	ndi_present = policy_mgr_mode_specific_connection_count(
 				psoc, PM_NDI_MODE, NULL);
+	if (ap_present)
+		sap_peer_count =
+		wlan_util_get_peer_count_for_mode(pdev, QDF_SAP_MODE);
+	if (go_present)
+		go_peer_count =
+		wlan_util_get_peer_count_for_mode(pdev, QDF_P2P_GO_MODE);
 
 	if (policy_mgr_get_connection_count(psoc)) {
 		if (req->scan_req.scan_f_passive)
@@ -602,7 +612,8 @@ static void scm_req_update_concurrency_params(struct wlan_objmgr_vdev *vdev,
 	 * firmware spends more time on home channel which will increase the
 	 * probability of sending beacon at TBTT
 	 */
-	if (ap_present || go_present) {
+	if ((ap_present && sap_peer_count) ||
+	    (go_present && go_peer_count)) {
 		req->scan_req.dwell_time_active_2g = 0;
 		req->scan_req.min_rest_time = req->scan_req.max_rest_time;
 	}
@@ -703,17 +714,18 @@ static void scm_req_update_concurrency_params(struct wlan_objmgr_vdev *vdev,
 		 * dwell time. If DBS is supported and if SAP is on 2G channel
 		 * then keep passive dwell time default.
 		 */
-		req->scan_req.dwell_time_active =
+		if (sap_peer_count) {
+			req->scan_req.dwell_time_active =
 				QDF_MIN(req->scan_req.dwell_time_active,
 					(SCAN_CTS_DURATION_MS_MAX -
 					SCAN_ROAM_SCAN_CHANNEL_SWITCH_TIME));
-		if (!policy_mgr_is_hw_dbs_capable(psoc) ||
-		    (policy_mgr_is_hw_dbs_capable(psoc) &&
-		     WLAN_CHAN_IS_5GHZ(ap_chan))) {
-			req->scan_req.dwell_time_passive =
-				req->scan_req.dwell_time_active;
+			if (!policy_mgr_is_hw_dbs_capable(psoc) ||
+			    (policy_mgr_is_hw_dbs_capable(psoc) &&
+			     WLAN_CHAN_IS_5GHZ(ap_chan))) {
+				req->scan_req.dwell_time_passive =
+					req->scan_req.dwell_time_active;
+			}
 		}
-
 		if (scan_obj->scan_def.ap_scan_burst_duration) {
 			req->scan_req.burst_duration =
 				scan_obj->scan_def.ap_scan_burst_duration;