Эх сурвалжийг харах

qcacld-3.0: check sta connected state for dynamic rtpm

Current even without connection, there is possible
rtpm is vote for up, which block suspend. which cause
more power consumption.

change as only allow pm qos vote when sta connected.

Change-Id: I44176ee233d4b2fb1d7a0d51936c847b2ce5f327
CRs-Fixed: 3019401
Jingxiang Ge 3 жил өмнө
parent
commit
14d2284ce1

+ 8 - 0
core/hdd/inc/wlan_hdd_assoc.h

@@ -263,6 +263,14 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress(
  */
 void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx);
 
+/**
+ * hdd_is_any_sta_connected() - check if any sta in connected state
+ * @hdd_ctx: hdd context
+ *
+ * Return: true if any connected sta
+ */
+bool hdd_is_any_sta_connected(struct hdd_context *hdd_ctx);
+
 /**
  * hdd_sme_roam_callback() - hdd sme roam callback
  * @context: pointer to adapter context

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -527,6 +527,7 @@ typedef enum {
 	NET_DEV_HOLD_DISPLAY_TXRX_STATS = 58,
 	NET_DEV_HOLD_BUS_BW_MGR = 59,
 	NET_DEV_HOLD_START_PRE_CAC_TRANS = 60,
+	NET_DEV_HOLD_IS_ANY_STA_CONNECTED = 61,
 
 	/* Keep it at the end */
 	NET_DEV_HOLD_ID_MAX

+ 28 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -433,6 +433,34 @@ void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx)
 					     REASON_UNSPEC_FAILURE, false);
 }
 
+bool hdd_is_any_sta_connected(struct hdd_context *hdd_ctx)
+{
+	struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
+	wlan_net_dev_ref_dbgid dbgid =
+				NET_DEV_HOLD_IS_ANY_STA_CONNECTED;
+
+	if (!hdd_ctx) {
+		hdd_err("HDD context is NULL");
+		return false;
+	}
+
+	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
+					   dbgid) {
+		if (QDF_STA_MODE == adapter->device_mode ||
+		    QDF_P2P_CLIENT_MODE == adapter->device_mode) {
+			if (hdd_cm_is_vdev_connected(adapter)) {
+				hdd_adapter_dev_put_debug(adapter, dbgid);
+				if (next_adapter)
+					hdd_adapter_dev_put_debug(next_adapter,
+								  dbgid);
+				return true;
+			}
+		}
+		hdd_adapter_dev_put_debug(adapter, dbgid);
+	}
+	return false;
+}
+
 /**
  * hdd_remove_beacon_filter() - remove beacon filter
  * @adapter: Pointer to the hdd adapter

+ 8 - 0
core/hdd/src/wlan_hdd_cm_api.h

@@ -271,6 +271,14 @@ void hdd_cm_save_connect_status(struct hdd_adapter *adapter,
  */
 bool hdd_cm_is_vdev_associated(struct hdd_adapter *adapter);
 
+/**
+ * hdd_cm_is_vdev_connected() - Checks if vdev is connected or not
+ * @adapter: pointer to the adapter structure
+ *
+ * Returns: True if vdev is connected else false
+ */
+bool hdd_cm_is_vdev_connected(struct hdd_adapter *adapter);
+
 /**
  * hdd_cm_is_connecting() - Function to check connection in progress
  * @adapter: pointer to the adapter structure

+ 27 - 0
core/hdd/src/wlan_hdd_cm_connect.c

@@ -75,6 +75,33 @@ bool hdd_cm_is_vdev_associated(struct hdd_adapter *adapter)
 	return is_vdev_active;
 }
 
+bool hdd_cm_is_vdev_connected(struct hdd_adapter *adapter)
+{
+	struct wlan_objmgr_vdev *vdev;
+	bool is_vdev_connected;
+	enum QDF_OPMODE opmode;
+	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+
+	if (adapter->device_mode == QDF_NDI_MODE)
+		return (sta_ctx->conn_info.conn_state ==
+			eConnectionState_NdiConnected);
+
+	vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_CM_ID);
+	if (!vdev)
+		return false;
+
+	opmode = wlan_vdev_mlme_get_opmode(vdev);
+	if (opmode != QDF_STA_MODE && opmode != QDF_P2P_CLIENT_MODE) {
+		hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_CM_ID);
+		return false;
+	}
+	is_vdev_connected = ucfg_cm_is_vdev_connected(vdev);
+
+	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_CM_ID);
+
+	return is_vdev_connected;
+}
+
 bool hdd_cm_is_connecting(struct hdd_adapter *adapter)
 {
 	struct wlan_objmgr_vdev *vdev;

+ 1 - 0
core/hdd/src/wlan_hdd_main.c

@@ -6204,6 +6204,7 @@ static char *net_dev_ref_debug_string_from_id(wlan_net_dev_ref_dbgid dbgid)
 		"NET_DEV_HOLD_CACHE_STATION_STATS_CB",
 		"NET_DEV_HOLD_DISPLAY_TXRX_STATS",
 		"NET_DEV_HOLD_START_PRE_CAC_TRANS",
+		"NET_DEV_HOLD_IS_ANY_STA_CONNECTED",
 		"NET_DEV_HOLD_ID_MAX"};
 	int32_t num_dbg_strings = QDF_ARRAY_SIZE(strings);
 

+ 7 - 2
core/hdd/src/wlan_hdd_power.c

@@ -1184,6 +1184,7 @@ int wlan_hdd_pm_qos_notify(struct notifier_block *nb, unsigned long curr_val,
 	struct hdd_context *hdd_ctx = container_of(nb, struct hdd_context,
 						   pm_qos_notifier);
 	void *hif_ctx;
+	bool is_any_sta_connected = false;
 
 	if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
 		hdd_debug_rl("Driver Module closed; skipping pm qos notify");
@@ -1194,11 +1195,15 @@ int wlan_hdd_pm_qos_notify(struct notifier_block *nb, unsigned long curr_val,
 	if (!hif_ctx)
 		return -EINVAL;
 
-	hdd_debug("PM QOS update: runtime_pm_prevented %d Current value: %ld",
-		  hdd_ctx->runtime_pm_prevented, curr_val);
+	is_any_sta_connected = hdd_is_any_sta_connected(hdd_ctx);
+
+	hdd_debug("PM QOS update: runtime_pm_prevented %d Current value: %ld, is_any_sta_connected %d",
+		  hdd_ctx->runtime_pm_prevented, curr_val,
+		  is_any_sta_connected);
 	qdf_spin_lock_irqsave(&hdd_ctx->pm_qos_lock);
 
 	if (!hdd_ctx->runtime_pm_prevented &&
+	    is_any_sta_connected &&
 	    curr_val != wlan_hdd_get_pm_qos_cpu_latency()) {
 		hif_pm_runtime_get_noresume(hif_ctx, RTPM_ID_QOS_NOTIFY);
 		hdd_ctx->runtime_pm_prevented = true;