Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cd2decb authored by Ashish's avatar Ashish Committed by Madan Koyyalamudi
Browse files

qcacld-3.0: Prevent runtime suspend on ll_stats and get station requests

Currently when ll_stats or get station request comes and while fw
sends the response of the request, it is possible that driver can go into
runtime suspend state while fw still wants to send few more stats
events. Because of this ll_stats request or station stats request gets
time out in host.

To address above issue, add logic to prevent runtime suspend when
ll_stats or station stats request is received in host driver.

Change-Id: I7704a3b9b3e8ad187677705e1b11fbd82be73cfb
CRs-FixeD: 3096165
parent 72a123fc
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -1152,6 +1152,7 @@ struct hdd_chan_change_params {
 * @user: user context to prevent/allow runtime pm
 * @is_user_wakelock_acquired: boolean to check if user wakelock status
 * @monitor_mode: monitor mode context to prevent/allow runtime pm
 * @stats: stats context to prevent/allow runtime pm
 *
 * Runtime PM control for underlying activities
 */
@@ -1161,6 +1162,7 @@ struct hdd_runtime_pm_context {
	qdf_runtime_lock_t user;
	bool is_user_wakelock_acquired;
	qdf_runtime_lock_t monitor_mode;
	qdf_runtime_lock_t stats;
};

/*
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
 * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -1437,6 +1437,7 @@ static void hdd_runtime_suspend_context_init(struct hdd_context *hdd_ctx)
	qdf_runtime_lock_init(&ctx->connect);
	qdf_runtime_lock_init(&ctx->user);
	qdf_runtime_lock_init(&ctx->monitor_mode);
	qdf_runtime_lock_init(&ctx->stats);

	ctx->is_user_wakelock_acquired = false;

@@ -1456,6 +1457,7 @@ static void hdd_runtime_suspend_context_deinit(struct hdd_context *hdd_ctx)
	if (ctx->is_user_wakelock_acquired)
		qdf_runtime_pm_allow_suspend(&ctx->user);

	qdf_runtime_lock_deinit(&ctx->stats);
	qdf_runtime_lock_deinit(&ctx->monitor_mode);
	qdf_runtime_lock_deinit(&ctx->user);
	qdf_runtime_lock_deinit(&ctx->connect);
+13 −0
Original line number Diff line number Diff line
@@ -2010,6 +2010,8 @@ static int wlan_hdd_send_ll_stats_req(struct hdd_adapter *adapter,
		return -ENOMEM;
	}

	qdf_runtime_pm_prevent_suspend(&hdd_ctx->runtime_context.stats);

	cookie = osif_request_cookie(request);

	priv = osif_request_priv(request);
@@ -2056,6 +2058,8 @@ static int wlan_hdd_send_ll_stats_req(struct hdd_adapter *adapter,
	hdd_exit();
	osif_request_put(request);

	qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.stats);

	return ret;
}

@@ -6853,16 +6857,23 @@ int wlan_hdd_get_station_stats(struct hdd_adapter *adapter)
	int ret = 0;
	struct stats_event *stats;
	struct wlan_objmgr_vdev *vdev;
	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);

	if (!get_station_fw_request_needed) {
		hdd_debug("return cached get_station stats");
		return 0;
	}

	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret)
		return ret;

	vdev = hdd_objmgr_get_vdev(adapter);
	if (!vdev)
		return -EINVAL;

	qdf_runtime_pm_prevent_suspend(&hdd_ctx->runtime_context.stats);

	stats = wlan_cfg80211_mc_cp_stats_get_station_stats(vdev, &ret);
	if (ret || !stats) {
		wlan_cfg80211_mc_cp_stats_free_stats_event(stats);
@@ -6875,6 +6886,8 @@ int wlan_hdd_get_station_stats(struct hdd_adapter *adapter)
	wlan_cfg80211_mc_cp_stats_free_stats_event(stats);

out:
	qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.stats);

	hdd_objmgr_put_vdev(vdev);
	return ret;
}