All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-07-20 13:49 ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently, WLAN chip is powered once during driver probe and is kept
ON (powered) always even when WLAN is not active; keeping the chip
powered ON all the time will consume extra power which is not
desirable on a battery operated device. Same is the case with non-WoW
suspend, chip will not be put into low power mode when the system is
suspended resulting in higher battery drain.

Send QMI MODE OFF command to firmware during WiFi OFF to put device
into low power mode.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Manikanta Pubbisetty (4):
  ath11k: Fix double free issue during SRNG deinit
  ath11k: Move hardware initialization logic to start()
  ath11k: Enable low power mode when WLAN is not active
  ath11k: Fix failed to parse regulatory event print

 drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
 drivers/net/wireless/ath/ath11k/core.h |   8 +-
 drivers/net/wireless/ath/ath11k/hal.c  |   1 +
 drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
 drivers/net/wireless/ath/ath11k/reg.c  |   2 +
 5 files changed, 189 insertions(+), 92 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-07-20 13:49 ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently, WLAN chip is powered once during driver probe and is kept
ON (powered) always even when WLAN is not active; keeping the chip
powered ON all the time will consume extra power which is not
desirable on a battery operated device. Same is the case with non-WoW
suspend, chip will not be put into low power mode when the system is
suspended resulting in higher battery drain.

Send QMI MODE OFF command to firmware during WiFi OFF to put device
into low power mode.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Manikanta Pubbisetty (4):
  ath11k: Fix double free issue during SRNG deinit
  ath11k: Move hardware initialization logic to start()
  ath11k: Enable low power mode when WLAN is not active
  ath11k: Fix failed to parse regulatory event print

 drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
 drivers/net/wireless/ath/ath11k/core.h |   8 +-
 drivers/net/wireless/ath/ath11k/hal.c  |   1 +
 drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
 drivers/net/wireless/ath/ath11k/reg.c  |   2 +
 5 files changed, 189 insertions(+), 92 deletions(-)

-- 
2.35.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ath11k: Fix double free issue during SRNG deinit
  2022-07-20 13:49 ` Manikanta Pubbisetty
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently struct ath11k_hal::srng_config pointer is not assigned
to NULL after freeing the memory in ath11k_hal_srng_deinit().
This could lead to double free issue in a scerario where
ath11k_hal_srng_deinit() is invoked back to back.

In the current code, although the chances are very low, the above
said scenario could happen when hardware recovery has failed and
then there is another FW assert where ath11k_hal_srng_deinit() is
invoked once again as part of recovery. Addressing this issue is
important when low power mode support is enabled in the driver
(will be added by a future patch) where this scenario is likely.

Fix this by assigning the struct ath11k_hal::srng_config pointer
to NULL after freeing the memory.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/hal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index bda71ab5a1f2..ebdf3b1a6661 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -1319,6 +1319,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab)
 	ath11k_hal_free_cont_rdp(ab);
 	ath11k_hal_free_cont_wrp(ab);
 	kfree(hal->srng_config);
+	hal->srng_config = NULL;
 }
 EXPORT_SYMBOL(ath11k_hal_srng_deinit);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 1/4] ath11k: Fix double free issue during SRNG deinit
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently struct ath11k_hal::srng_config pointer is not assigned
to NULL after freeing the memory in ath11k_hal_srng_deinit().
This could lead to double free issue in a scerario where
ath11k_hal_srng_deinit() is invoked back to back.

In the current code, although the chances are very low, the above
said scenario could happen when hardware recovery has failed and
then there is another FW assert where ath11k_hal_srng_deinit() is
invoked once again as part of recovery. Addressing this issue is
important when low power mode support is enabled in the driver
(will be added by a future patch) where this scenario is likely.

Fix this by assigning the struct ath11k_hal::srng_config pointer
to NULL after freeing the memory.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/hal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index bda71ab5a1f2..ebdf3b1a6661 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -1319,6 +1319,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab)
 	ath11k_hal_free_cont_rdp(ab);
 	ath11k_hal_free_cont_wrp(ab);
 	kfree(hal->srng_config);
+	hal->srng_config = NULL;
 }
 EXPORT_SYMBOL(ath11k_hal_srng_deinit);
 
-- 
2.35.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/4] ath11k: Move hardware initialization logic to start()
  2022-07-20 13:49 ` Manikanta Pubbisetty
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently during recovery, hardware is re-initialized as part of
ath11k_core_reconfigure_on_crash(). In order to enable low power
mode support in the driver, it is required to move the hardware
re-initialization logic to ath11k_ops.start() hook.

Since ath11k_ops.start() hook is called during WiFi ON/resume and
also during hardware recovery, it is better to defer the hardware
initialization to ath11k_ops.start() in the case of hardware recovery.
This will help ensure that there is only path for the initialization
of the hardware across different scenarios. A future patch will add
the support of initializing the hardware from start() hook in
WiFi ON/resume cases as well.

Commit 38194f3a605e ("ath11k: add synchronization operation between
reconfigure of mac80211 and ath11k_base") introduced a similar change that
applies just to QCA6390/WCN6855 to defer the initialization of the hardware
during recovery by using wait logic. This is no more needed and therefore
remove it.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 87 +++++++++++---------------
 drivers/net/wireless/ath/ath11k/core.h |  6 +-
 drivers/net/wireless/ath/ath11k/mac.c  | 29 +++------
 3 files changed, 44 insertions(+), 78 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index c8e0bc935838..f4f88a19539e 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1498,10 +1498,8 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 	return ret;
 }
 
-static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
+static void ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 {
-	int ret;
-
 	mutex_lock(&ab->core_lock);
 	ath11k_thermal_unregister(ab);
 	ath11k_hif_irq_disable(ab);
@@ -1513,27 +1511,8 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 	mutex_unlock(&ab->core_lock);
 
 	ath11k_dp_free(ab);
-	ath11k_hal_srng_deinit(ab);
 
 	ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1;
-
-	ret = ath11k_hal_srng_init(ab);
-	if (ret)
-		return ret;
-
-	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
-
-	ret = ath11k_core_qmi_firmware_ready(ab);
-	if (ret)
-		goto err_hal_srng_deinit;
-
-	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
-
-	return 0;
-
-err_hal_srng_deinit:
-	ath11k_hal_srng_deinit(ab);
-	return ret;
 }
 
 void ath11k_core_halt(struct ath11k *ar)
@@ -1694,22 +1673,10 @@ static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab)
 static void ath11k_core_restart(struct work_struct *work)
 {
 	struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work);
-	int ret;
-
-	if (!ab->is_reset)
-		ath11k_core_pre_reconfigure_recovery(ab);
-
-	ret = ath11k_core_reconfigure_on_crash(ab);
-	if (ret) {
-		ath11k_err(ab, "failed to reconfigure driver on crash recovery\n");
-		return;
-	}
-
-	if (ab->is_reset)
-		complete_all(&ab->reconfigure_complete);
 
-	if (!ab->is_reset)
-		ath11k_core_post_reconfigure_recovery(ab);
+	ath11k_core_pre_reconfigure_recovery(ab);
+	ath11k_core_reconfigure_on_crash(ab);
+	ath11k_core_post_reconfigure_recovery(ab);
 }
 
 static void ath11k_core_reset(struct work_struct *work)
@@ -1763,18 +1730,6 @@ static void ath11k_core_reset(struct work_struct *work)
 
 	ab->is_reset = true;
 	atomic_set(&ab->recovery_count, 0);
-	reinit_completion(&ab->recovery_start);
-	atomic_set(&ab->recovery_start_count, 0);
-
-	ath11k_core_pre_reconfigure_recovery(ab);
-
-	reinit_completion(&ab->reconfigure_complete);
-	ath11k_core_post_reconfigure_recovery(ab);
-
-	ath11k_dbg(ab, ATH11K_DBG_BOOT, "waiting recovery start...\n");
-
-	time_left = wait_for_completion_timeout(&ab->recovery_start,
-						ATH11K_RECOVER_START_TIMEOUT_HZ);
 
 	ath11k_hif_power_down(ab);
 	ath11k_hif_power_up(ab);
@@ -1882,8 +1837,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 	spin_lock_init(&ab->base_lock);
 	mutex_init(&ab->vdev_id_11d_lock);
 	init_completion(&ab->reset_complete);
-	init_completion(&ab->reconfigure_complete);
-	init_completion(&ab->recovery_start);
 
 	INIT_LIST_HEAD(&ab->peers);
 	init_waitqueue_head(&ab->peer_mapping_wq);
@@ -1910,5 +1863,37 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 }
 EXPORT_SYMBOL(ath11k_core_alloc);
 
+int ath11k_core_start_device(struct ath11k_base *ab)
+{
+	int ret;
+
+	if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags))
+		return 0;
+
+	ath11k_hal_srng_deinit(ab);
+
+	ret = ath11k_hal_srng_init(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to init srng: %d\n", ret);
+		return ret;
+	}
+
+	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
+
+	ret = ath11k_core_qmi_firmware_ready(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to init core: %d\n", ret);
+		goto err_hal_srng_deinit;
+	}
+
+	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+
+	return 0;
+
+err_hal_srng_deinit:
+	ath11k_hal_srng_deinit(ab);
+	return ret;
+}
+
 MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11ax wireless LAN cards.");
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 2bd5eb9df4d4..5ecb60a1b51d 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -60,8 +60,6 @@ extern unsigned int ath11k_frame_mode;
 #define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3
 #define ATH11K_RESET_MAX_FAIL_COUNT_FINAL 5
 #define ATH11K_RESET_FAIL_TIMEOUT_HZ (20 * HZ)
-#define ATH11K_RECONFIGURE_TIMEOUT_HZ (10 * HZ)
-#define ATH11K_RECOVER_START_TIMEOUT_HZ (20 * HZ)
 
 enum ath11k_supported_bw {
 	ATH11K_BW_20	= 0,
@@ -913,11 +911,8 @@ struct ath11k_base {
 	struct work_struct reset_work;
 	atomic_t reset_count;
 	atomic_t recovery_count;
-	atomic_t recovery_start_count;
 	bool is_reset;
 	struct completion reset_complete;
-	struct completion reconfigure_complete;
-	struct completion recovery_start;
 	/* continuous recovery fail count */
 	atomic_t fail_cont_count;
 	unsigned long reset_fail_timeout;
@@ -1144,6 +1139,7 @@ int ath11k_core_check_smbios(struct ath11k_base *ab);
 void ath11k_core_halt(struct ath11k *ar);
 int ath11k_core_resume(struct ath11k_base *ab);
 int ath11k_core_suspend(struct ath11k_base *ab);
+int ath11k_core_start_device(struct ath11k_base *ab);
 
 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
 						    const char *filename);
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index d83d3c944594..84f2604a16e4 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5753,27 +5753,6 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable)
 	return ret;
 }
 
-static void ath11k_mac_wait_reconfigure(struct ath11k_base *ab)
-{
-	int recovery_start_count;
-
-	if (!ab->is_reset)
-		return;
-
-	recovery_start_count = atomic_inc_return(&ab->recovery_start_count);
-	ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery start count %d\n", recovery_start_count);
-
-	if (recovery_start_count == ab->num_radios) {
-		complete(&ab->recovery_start);
-		ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery started success\n");
-	}
-
-	ath11k_dbg(ab, ATH11K_DBG_MAC, "waiting reconfigure...\n");
-
-	wait_for_completion_timeout(&ab->reconfigure_complete,
-				    ATH11K_RECONFIGURE_TIMEOUT_HZ);
-}
-
 static int ath11k_mac_op_start(struct ieee80211_hw *hw)
 {
 	struct ath11k *ar = hw->priv;
@@ -5782,6 +5761,13 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
 	int ret;
 
 	ath11k_mac_drain_tx(ar);
+
+	ret = ath11k_core_start_device(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to start device : %d\n", ret);
+		return ret;
+	}
+
 	mutex_lock(&ar->conf_mutex);
 
 	switch (ar->state) {
@@ -5790,7 +5776,6 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
 		break;
 	case ATH11K_STATE_RESTARTING:
 		ar->state = ATH11K_STATE_RESTARTED;
-		ath11k_mac_wait_reconfigure(ab);
 		break;
 	case ATH11K_STATE_RESTARTED:
 	case ATH11K_STATE_WEDGED:
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 2/4] ath11k: Move hardware initialization logic to start()
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently during recovery, hardware is re-initialized as part of
ath11k_core_reconfigure_on_crash(). In order to enable low power
mode support in the driver, it is required to move the hardware
re-initialization logic to ath11k_ops.start() hook.

Since ath11k_ops.start() hook is called during WiFi ON/resume and
also during hardware recovery, it is better to defer the hardware
initialization to ath11k_ops.start() in the case of hardware recovery.
This will help ensure that there is only path for the initialization
of the hardware across different scenarios. A future patch will add
the support of initializing the hardware from start() hook in
WiFi ON/resume cases as well.

Commit 38194f3a605e ("ath11k: add synchronization operation between
reconfigure of mac80211 and ath11k_base") introduced a similar change that
applies just to QCA6390/WCN6855 to defer the initialization of the hardware
during recovery by using wait logic. This is no more needed and therefore
remove it.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 87 +++++++++++---------------
 drivers/net/wireless/ath/ath11k/core.h |  6 +-
 drivers/net/wireless/ath/ath11k/mac.c  | 29 +++------
 3 files changed, 44 insertions(+), 78 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index c8e0bc935838..f4f88a19539e 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1498,10 +1498,8 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 	return ret;
 }
 
-static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
+static void ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 {
-	int ret;
-
 	mutex_lock(&ab->core_lock);
 	ath11k_thermal_unregister(ab);
 	ath11k_hif_irq_disable(ab);
@@ -1513,27 +1511,8 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 	mutex_unlock(&ab->core_lock);
 
 	ath11k_dp_free(ab);
-	ath11k_hal_srng_deinit(ab);
 
 	ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1;
-
-	ret = ath11k_hal_srng_init(ab);
-	if (ret)
-		return ret;
-
-	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
-
-	ret = ath11k_core_qmi_firmware_ready(ab);
-	if (ret)
-		goto err_hal_srng_deinit;
-
-	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
-
-	return 0;
-
-err_hal_srng_deinit:
-	ath11k_hal_srng_deinit(ab);
-	return ret;
 }
 
 void ath11k_core_halt(struct ath11k *ar)
@@ -1694,22 +1673,10 @@ static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab)
 static void ath11k_core_restart(struct work_struct *work)
 {
 	struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work);
-	int ret;
-
-	if (!ab->is_reset)
-		ath11k_core_pre_reconfigure_recovery(ab);
-
-	ret = ath11k_core_reconfigure_on_crash(ab);
-	if (ret) {
-		ath11k_err(ab, "failed to reconfigure driver on crash recovery\n");
-		return;
-	}
-
-	if (ab->is_reset)
-		complete_all(&ab->reconfigure_complete);
 
-	if (!ab->is_reset)
-		ath11k_core_post_reconfigure_recovery(ab);
+	ath11k_core_pre_reconfigure_recovery(ab);
+	ath11k_core_reconfigure_on_crash(ab);
+	ath11k_core_post_reconfigure_recovery(ab);
 }
 
 static void ath11k_core_reset(struct work_struct *work)
@@ -1763,18 +1730,6 @@ static void ath11k_core_reset(struct work_struct *work)
 
 	ab->is_reset = true;
 	atomic_set(&ab->recovery_count, 0);
-	reinit_completion(&ab->recovery_start);
-	atomic_set(&ab->recovery_start_count, 0);
-
-	ath11k_core_pre_reconfigure_recovery(ab);
-
-	reinit_completion(&ab->reconfigure_complete);
-	ath11k_core_post_reconfigure_recovery(ab);
-
-	ath11k_dbg(ab, ATH11K_DBG_BOOT, "waiting recovery start...\n");
-
-	time_left = wait_for_completion_timeout(&ab->recovery_start,
-						ATH11K_RECOVER_START_TIMEOUT_HZ);
 
 	ath11k_hif_power_down(ab);
 	ath11k_hif_power_up(ab);
@@ -1882,8 +1837,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 	spin_lock_init(&ab->base_lock);
 	mutex_init(&ab->vdev_id_11d_lock);
 	init_completion(&ab->reset_complete);
-	init_completion(&ab->reconfigure_complete);
-	init_completion(&ab->recovery_start);
 
 	INIT_LIST_HEAD(&ab->peers);
 	init_waitqueue_head(&ab->peer_mapping_wq);
@@ -1910,5 +1863,37 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 }
 EXPORT_SYMBOL(ath11k_core_alloc);
 
+int ath11k_core_start_device(struct ath11k_base *ab)
+{
+	int ret;
+
+	if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags))
+		return 0;
+
+	ath11k_hal_srng_deinit(ab);
+
+	ret = ath11k_hal_srng_init(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to init srng: %d\n", ret);
+		return ret;
+	}
+
+	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
+
+	ret = ath11k_core_qmi_firmware_ready(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to init core: %d\n", ret);
+		goto err_hal_srng_deinit;
+	}
+
+	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+
+	return 0;
+
+err_hal_srng_deinit:
+	ath11k_hal_srng_deinit(ab);
+	return ret;
+}
+
 MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11ax wireless LAN cards.");
 MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 2bd5eb9df4d4..5ecb60a1b51d 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -60,8 +60,6 @@ extern unsigned int ath11k_frame_mode;
 #define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3
 #define ATH11K_RESET_MAX_FAIL_COUNT_FINAL 5
 #define ATH11K_RESET_FAIL_TIMEOUT_HZ (20 * HZ)
-#define ATH11K_RECONFIGURE_TIMEOUT_HZ (10 * HZ)
-#define ATH11K_RECOVER_START_TIMEOUT_HZ (20 * HZ)
 
 enum ath11k_supported_bw {
 	ATH11K_BW_20	= 0,
@@ -913,11 +911,8 @@ struct ath11k_base {
 	struct work_struct reset_work;
 	atomic_t reset_count;
 	atomic_t recovery_count;
-	atomic_t recovery_start_count;
 	bool is_reset;
 	struct completion reset_complete;
-	struct completion reconfigure_complete;
-	struct completion recovery_start;
 	/* continuous recovery fail count */
 	atomic_t fail_cont_count;
 	unsigned long reset_fail_timeout;
@@ -1144,6 +1139,7 @@ int ath11k_core_check_smbios(struct ath11k_base *ab);
 void ath11k_core_halt(struct ath11k *ar);
 int ath11k_core_resume(struct ath11k_base *ab);
 int ath11k_core_suspend(struct ath11k_base *ab);
+int ath11k_core_start_device(struct ath11k_base *ab);
 
 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
 						    const char *filename);
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index d83d3c944594..84f2604a16e4 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5753,27 +5753,6 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable)
 	return ret;
 }
 
-static void ath11k_mac_wait_reconfigure(struct ath11k_base *ab)
-{
-	int recovery_start_count;
-
-	if (!ab->is_reset)
-		return;
-
-	recovery_start_count = atomic_inc_return(&ab->recovery_start_count);
-	ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery start count %d\n", recovery_start_count);
-
-	if (recovery_start_count == ab->num_radios) {
-		complete(&ab->recovery_start);
-		ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery started success\n");
-	}
-
-	ath11k_dbg(ab, ATH11K_DBG_MAC, "waiting reconfigure...\n");
-
-	wait_for_completion_timeout(&ab->reconfigure_complete,
-				    ATH11K_RECONFIGURE_TIMEOUT_HZ);
-}
-
 static int ath11k_mac_op_start(struct ieee80211_hw *hw)
 {
 	struct ath11k *ar = hw->priv;
@@ -5782,6 +5761,13 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
 	int ret;
 
 	ath11k_mac_drain_tx(ar);
+
+	ret = ath11k_core_start_device(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to start device : %d\n", ret);
+		return ret;
+	}
+
 	mutex_lock(&ar->conf_mutex);
 
 	switch (ar->state) {
@@ -5790,7 +5776,6 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw)
 		break;
 	case ATH11K_STATE_RESTARTING:
 		ar->state = ATH11K_STATE_RESTARTED;
-		ath11k_mac_wait_reconfigure(ab);
 		break;
 	case ATH11K_STATE_RESTARTED:
 	case ATH11K_STATE_WEDGED:
-- 
2.35.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/4] ath11k: Enable low power mode when WLAN is not active
  2022-07-20 13:49 ` Manikanta Pubbisetty
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently, WLAN chip is powered once during driver probe and is kept
ON (powered) always even when WLAN is not active; keeping the chip
powered ON all the time will consume extra power which is not
desirable for a battery operated device. Same is the case with non-WoW
suspend, chip will never be put into low power mode when the system is
suspended resulting in higher battery drain.

As per the recommendation, sending a PDEV suspend WMI command followed
by a QMI MODE OFF command will cease all WLAN activity and put the device
in low power mode. When WLAN interfaces are brought up, sending a QMI
MISSION MODE command would be sufficient to bring the chip out of low
power. This is a better approach than doing hif_power_down()/hif_power_up()
for every WiFi ON/OFF sequence since the turnaround time for entry/exit of
low power mode is much less. Overhead is just the time taken for sending
QMI MODE OFF & QMI MISSION MODE commands instead of going through the
entire chip boot & QMI init sequence.

Change is applicable for all ath11k devices and should not cause any
negative impact.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Change-Id: I3cfc7420cef2a3eb88aed57f92c08a6e71647e5c
Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 155 ++++++++++++++++++++++---
 drivers/net/wireless/ath/ath11k/core.h |   2 +
 drivers/net/wireless/ath/ath11k/mac.c  |   4 +
 3 files changed, 144 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index f4f88a19539e..2dd51f1ecfd0 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1210,7 +1210,6 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 static void ath11k_core_soc_destroy(struct ath11k_base *ab)
 {
 	ath11k_debugfs_soc_destroy(ab);
-	ath11k_dp_free(ab);
 	ath11k_reg_free(ab);
 	ath11k_qmi_deinit_service(ab);
 }
@@ -1266,11 +1265,7 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
 
 static void ath11k_core_pdev_destroy(struct ath11k_base *ab)
 {
-	ath11k_spectral_deinit(ab);
-	ath11k_thermal_unregister(ab);
 	ath11k_mac_unregister(ab);
-	ath11k_hif_irq_disable(ab);
-	ath11k_dp_pdev_free(ab);
 	ath11k_debugfs_pdev_destroy(ab);
 }
 
@@ -1423,7 +1418,7 @@ static int ath11k_core_rfkill_config(struct ath11k_base *ab)
 	return ret;
 }
 
-int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
+static int ath11k_core_setup_device(struct ath11k_base *ab)
 {
 	int ret;
 
@@ -1456,17 +1451,44 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		break;
 	default:
 		ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_dp_free;
 	}
 
 	if (ath11k_frame_mode == ATH11K_HW_TXRX_RAW)
 		set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
 
+	return 0;
+
+err_dp_free:
+	ath11k_dp_free(ab);
+err_firmware_stop:
+	ath11k_qmi_firmware_stop(ab);
+
+	return ret;
+}
+
+static void ath11k_core_free_device(struct ath11k_base *ab)
+{
+	ath11k_dp_free(ab);
+	ath11k_qmi_firmware_stop(ab);
+}
+
+int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
+{
+	int ret;
+
+	ret = ath11k_core_setup_device(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to setup device: %d\n", ret);
+		return ret;
+	}
+
 	mutex_lock(&ab->core_lock);
 	ret = ath11k_core_start(ab);
 	if (ret) {
 		ath11k_err(ab, "failed to start core: %d\n", ret);
-		goto err_dp_free;
+		goto err_core_free;
 	}
 
 	ret = ath11k_core_pdev_create(ab);
@@ -1482,6 +1504,7 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		goto err_core_stop;
 	}
 
+	ath11k_core_stop_device(ab);
 	mutex_unlock(&ab->core_lock);
 
 	return 0;
@@ -1489,11 +1512,9 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 err_core_stop:
 	ath11k_core_stop(ab);
 	ath11k_mac_destroy(ab);
-err_dp_free:
-	ath11k_dp_free(ab);
+err_core_free:
 	mutex_unlock(&ab->core_lock);
-err_firmware_stop:
-	ath11k_qmi_firmware_stop(ab);
+	ath11k_core_free_device(ab);
 
 	return ret;
 }
@@ -1794,7 +1815,6 @@ void ath11k_core_deinit(struct ath11k_base *ab)
 	mutex_lock(&ab->core_lock);
 
 	ath11k_core_pdev_destroy(ab);
-	ath11k_core_stop(ab);
 
 	mutex_unlock(&ab->core_lock);
 
@@ -1863,35 +1883,136 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 }
 EXPORT_SYMBOL(ath11k_core_alloc);
 
+static int ath11k_core_suspend_target(struct ath11k_base *ab, u32 suspend_opt)
+{
+	struct ath11k *ar;
+	struct ath11k_pdev *pdev;
+	unsigned long time_left;
+	int ret;
+	int i;
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+
+		reinit_completion(&ab->htc_suspend);
+
+		ret = ath11k_wmi_pdev_suspend(ar, suspend_opt, pdev->pdev_id);
+		if (ret) {
+			ath11k_warn(ab, "could not suspend target (%d)\n", ret);
+			return ret;
+		}
+
+		time_left = wait_for_completion_timeout(&ab->htc_suspend, 3 * HZ);
+
+		if (!time_left) {
+			ath11k_warn(ab, "suspend timed out - target pause event never came\n");
+			return -ETIMEDOUT;
+		}
+	}
+
+	return 0;
+}
+
+void ath11k_core_stop_device(struct ath11k_base *ab)
+{
+	ath11k_core_suspend_target(ab, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
+	ath11k_hif_irq_disable(ab);
+	ath11k_hif_stop(ab);
+
+	if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags))
+		ath11k_qmi_firmware_stop(ab);
+
+	ath11k_wmi_detach(ab);
+	ath11k_dp_pdev_reo_cleanup(ab);
+	ath11k_spectral_deinit(ab);
+	ath11k_thermal_unregister(ab);
+	ath11k_dp_pdev_free(ab);
+	ath11k_dp_free(ab);
+}
+
+int ath11k_core_any_pdevs_on(struct ath11k_base *ab)
+{
+	struct ath11k_pdev *pdev;
+	struct ath11k *ar;
+	int i;
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+		if (!ar)
+			continue;
+
+		if (ar->state == ATH11K_STATE_ON)
+			return true;
+	}
+
+	return false;
+}
+
 int ath11k_core_start_device(struct ath11k_base *ab)
 {
 	int ret;
 
-	if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags))
+	/* Initialize the hardware/firmware only for the first PDEV
+	 * or during hardware recovery.
+	 */
+	if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags) &&
+	    ath11k_core_any_pdevs_on(ab))
 		return 0;
 
+	mutex_lock(&ab->core_lock);
+
 	ath11k_hal_srng_deinit(ab);
 
 	ret = ath11k_hal_srng_init(ab);
 	if (ret) {
 		ath11k_err(ab, "failed to init srng: %d\n", ret);
-		return ret;
+		goto err_unlock;
 	}
 
 	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
 
-	ret = ath11k_core_qmi_firmware_ready(ab);
+	ret = ath11k_core_setup_device(ab);
 	if (ret) {
-		ath11k_err(ab, "failed to init core: %d\n", ret);
+		ath11k_err(ab, "failed to setup device: %d\n", ret);
 		goto err_hal_srng_deinit;
 	}
 
+	ret = ath11k_core_start(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to start core: %d\n", ret);
+		goto err_core_free;
+	}
+
+	ret = ath11k_core_pdev_create(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to create pdev core: %d\n", ret);
+		goto err_core_stop;
+	}
+	ath11k_hif_irq_enable(ab);
+
+	ret = ath11k_core_rfkill_config(ab);
+	if (ret && ret != -EOPNOTSUPP) {
+		ath11k_err(ab, "failed to config rfkill: %d\n", ret);
+		goto err_core_stop;
+	}
+
 	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
 
+	mutex_unlock(&ab->core_lock);
+
 	return 0;
 
+err_core_stop:
+	ath11k_core_stop(ab);
+	ath11k_mac_destroy(ab);
+err_core_free:
+	ath11k_core_free_device(ab);
 err_hal_srng_deinit:
 	ath11k_hal_srng_deinit(ab);
+err_unlock:
+	mutex_unlock(&ab->core_lock);
 	return ret;
 }
 
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 5ecb60a1b51d..61f8a3e7cabe 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -1140,6 +1140,8 @@ void ath11k_core_halt(struct ath11k *ar);
 int ath11k_core_resume(struct ath11k_base *ab);
 int ath11k_core_suspend(struct ath11k_base *ab);
 int ath11k_core_start_device(struct ath11k_base *ab);
+void ath11k_core_stop_device(struct ath11k_base *ab);
+int ath11k_core_any_pdevs_on(struct ath11k_base *ab);
 
 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
 						    const char *filename);
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 84f2604a16e4..c459e43dee74 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5926,6 +5926,10 @@ static void ath11k_mac_op_stop(struct ieee80211_hw *hw)
 	synchronize_rcu();
 
 	atomic_set(&ar->num_pending_mgmt_tx, 0);
+
+	/* If all PDEVs on the SoC are down, then power down the device */
+	if (!ath11k_core_any_pdevs_on(ar->ab))
+		ath11k_core_stop_device(ar->ab);
 }
 
 static void
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 3/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

Currently, WLAN chip is powered once during driver probe and is kept
ON (powered) always even when WLAN is not active; keeping the chip
powered ON all the time will consume extra power which is not
desirable for a battery operated device. Same is the case with non-WoW
suspend, chip will never be put into low power mode when the system is
suspended resulting in higher battery drain.

As per the recommendation, sending a PDEV suspend WMI command followed
by a QMI MODE OFF command will cease all WLAN activity and put the device
in low power mode. When WLAN interfaces are brought up, sending a QMI
MISSION MODE command would be sufficient to bring the chip out of low
power. This is a better approach than doing hif_power_down()/hif_power_up()
for every WiFi ON/OFF sequence since the turnaround time for entry/exit of
low power mode is much less. Overhead is just the time taken for sending
QMI MODE OFF & QMI MISSION MODE commands instead of going through the
entire chip boot & QMI init sequence.

Change is applicable for all ath11k devices and should not cause any
negative impact.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Change-Id: I3cfc7420cef2a3eb88aed57f92c08a6e71647e5c
Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 155 ++++++++++++++++++++++---
 drivers/net/wireless/ath/ath11k/core.h |   2 +
 drivers/net/wireless/ath/ath11k/mac.c  |   4 +
 3 files changed, 144 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index f4f88a19539e..2dd51f1ecfd0 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1210,7 +1210,6 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 static void ath11k_core_soc_destroy(struct ath11k_base *ab)
 {
 	ath11k_debugfs_soc_destroy(ab);
-	ath11k_dp_free(ab);
 	ath11k_reg_free(ab);
 	ath11k_qmi_deinit_service(ab);
 }
@@ -1266,11 +1265,7 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
 
 static void ath11k_core_pdev_destroy(struct ath11k_base *ab)
 {
-	ath11k_spectral_deinit(ab);
-	ath11k_thermal_unregister(ab);
 	ath11k_mac_unregister(ab);
-	ath11k_hif_irq_disable(ab);
-	ath11k_dp_pdev_free(ab);
 	ath11k_debugfs_pdev_destroy(ab);
 }
 
@@ -1423,7 +1418,7 @@ static int ath11k_core_rfkill_config(struct ath11k_base *ab)
 	return ret;
 }
 
-int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
+static int ath11k_core_setup_device(struct ath11k_base *ab)
 {
 	int ret;
 
@@ -1456,17 +1451,44 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		break;
 	default:
 		ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_dp_free;
 	}
 
 	if (ath11k_frame_mode == ATH11K_HW_TXRX_RAW)
 		set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
 
+	return 0;
+
+err_dp_free:
+	ath11k_dp_free(ab);
+err_firmware_stop:
+	ath11k_qmi_firmware_stop(ab);
+
+	return ret;
+}
+
+static void ath11k_core_free_device(struct ath11k_base *ab)
+{
+	ath11k_dp_free(ab);
+	ath11k_qmi_firmware_stop(ab);
+}
+
+int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
+{
+	int ret;
+
+	ret = ath11k_core_setup_device(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to setup device: %d\n", ret);
+		return ret;
+	}
+
 	mutex_lock(&ab->core_lock);
 	ret = ath11k_core_start(ab);
 	if (ret) {
 		ath11k_err(ab, "failed to start core: %d\n", ret);
-		goto err_dp_free;
+		goto err_core_free;
 	}
 
 	ret = ath11k_core_pdev_create(ab);
@@ -1482,6 +1504,7 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 		goto err_core_stop;
 	}
 
+	ath11k_core_stop_device(ab);
 	mutex_unlock(&ab->core_lock);
 
 	return 0;
@@ -1489,11 +1512,9 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
 err_core_stop:
 	ath11k_core_stop(ab);
 	ath11k_mac_destroy(ab);
-err_dp_free:
-	ath11k_dp_free(ab);
+err_core_free:
 	mutex_unlock(&ab->core_lock);
-err_firmware_stop:
-	ath11k_qmi_firmware_stop(ab);
+	ath11k_core_free_device(ab);
 
 	return ret;
 }
@@ -1794,7 +1815,6 @@ void ath11k_core_deinit(struct ath11k_base *ab)
 	mutex_lock(&ab->core_lock);
 
 	ath11k_core_pdev_destroy(ab);
-	ath11k_core_stop(ab);
 
 	mutex_unlock(&ab->core_lock);
 
@@ -1863,35 +1883,136 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
 }
 EXPORT_SYMBOL(ath11k_core_alloc);
 
+static int ath11k_core_suspend_target(struct ath11k_base *ab, u32 suspend_opt)
+{
+	struct ath11k *ar;
+	struct ath11k_pdev *pdev;
+	unsigned long time_left;
+	int ret;
+	int i;
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+
+		reinit_completion(&ab->htc_suspend);
+
+		ret = ath11k_wmi_pdev_suspend(ar, suspend_opt, pdev->pdev_id);
+		if (ret) {
+			ath11k_warn(ab, "could not suspend target (%d)\n", ret);
+			return ret;
+		}
+
+		time_left = wait_for_completion_timeout(&ab->htc_suspend, 3 * HZ);
+
+		if (!time_left) {
+			ath11k_warn(ab, "suspend timed out - target pause event never came\n");
+			return -ETIMEDOUT;
+		}
+	}
+
+	return 0;
+}
+
+void ath11k_core_stop_device(struct ath11k_base *ab)
+{
+	ath11k_core_suspend_target(ab, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
+	ath11k_hif_irq_disable(ab);
+	ath11k_hif_stop(ab);
+
+	if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags))
+		ath11k_qmi_firmware_stop(ab);
+
+	ath11k_wmi_detach(ab);
+	ath11k_dp_pdev_reo_cleanup(ab);
+	ath11k_spectral_deinit(ab);
+	ath11k_thermal_unregister(ab);
+	ath11k_dp_pdev_free(ab);
+	ath11k_dp_free(ab);
+}
+
+int ath11k_core_any_pdevs_on(struct ath11k_base *ab)
+{
+	struct ath11k_pdev *pdev;
+	struct ath11k *ar;
+	int i;
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = &ab->pdevs[i];
+		ar = pdev->ar;
+		if (!ar)
+			continue;
+
+		if (ar->state == ATH11K_STATE_ON)
+			return true;
+	}
+
+	return false;
+}
+
 int ath11k_core_start_device(struct ath11k_base *ab)
 {
 	int ret;
 
-	if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags))
+	/* Initialize the hardware/firmware only for the first PDEV
+	 * or during hardware recovery.
+	 */
+	if (!test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags) &&
+	    ath11k_core_any_pdevs_on(ab))
 		return 0;
 
+	mutex_lock(&ab->core_lock);
+
 	ath11k_hal_srng_deinit(ab);
 
 	ret = ath11k_hal_srng_init(ab);
 	if (ret) {
 		ath11k_err(ab, "failed to init srng: %d\n", ret);
-		return ret;
+		goto err_unlock;
 	}
 
 	clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
 
-	ret = ath11k_core_qmi_firmware_ready(ab);
+	ret = ath11k_core_setup_device(ab);
 	if (ret) {
-		ath11k_err(ab, "failed to init core: %d\n", ret);
+		ath11k_err(ab, "failed to setup device: %d\n", ret);
 		goto err_hal_srng_deinit;
 	}
 
+	ret = ath11k_core_start(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to start core: %d\n", ret);
+		goto err_core_free;
+	}
+
+	ret = ath11k_core_pdev_create(ab);
+	if (ret) {
+		ath11k_err(ab, "failed to create pdev core: %d\n", ret);
+		goto err_core_stop;
+	}
+	ath11k_hif_irq_enable(ab);
+
+	ret = ath11k_core_rfkill_config(ab);
+	if (ret && ret != -EOPNOTSUPP) {
+		ath11k_err(ab, "failed to config rfkill: %d\n", ret);
+		goto err_core_stop;
+	}
+
 	clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
 
+	mutex_unlock(&ab->core_lock);
+
 	return 0;
 
+err_core_stop:
+	ath11k_core_stop(ab);
+	ath11k_mac_destroy(ab);
+err_core_free:
+	ath11k_core_free_device(ab);
 err_hal_srng_deinit:
 	ath11k_hal_srng_deinit(ab);
+err_unlock:
+	mutex_unlock(&ab->core_lock);
 	return ret;
 }
 
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 5ecb60a1b51d..61f8a3e7cabe 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -1140,6 +1140,8 @@ void ath11k_core_halt(struct ath11k *ar);
 int ath11k_core_resume(struct ath11k_base *ab);
 int ath11k_core_suspend(struct ath11k_base *ab);
 int ath11k_core_start_device(struct ath11k_base *ab);
+void ath11k_core_stop_device(struct ath11k_base *ab);
+int ath11k_core_any_pdevs_on(struct ath11k_base *ab);
 
 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
 						    const char *filename);
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 84f2604a16e4..c459e43dee74 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5926,6 +5926,10 @@ static void ath11k_mac_op_stop(struct ieee80211_hw *hw)
 	synchronize_rcu();
 
 	atomic_set(&ar->num_pending_mgmt_tx, 0);
+
+	/* If all PDEVs on the SoC are down, then power down the device */
+	if (!ath11k_core_any_pdevs_on(ar->ab))
+		ath11k_core_stop_device(ar->ab);
 }
 
 static void
-- 
2.35.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/4] ath11k: Fix failed to parse regulatory event print
  2022-07-20 13:49 ` Manikanta Pubbisetty
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

In the continuous WiFi ON/OFF scenario, we see a lot of
"failed to parse regulatory event" prints on the console.
This is because we already would have created a regulatory
domain for the wiphy and we will discard the subsequent
events to create the same regulatory event.

Fix this error print by freeing up the regulatory resources
in WiFi OFF and create the database again in WiFi ON. The same
applies for hardware recovery as well.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 3 ++-
 drivers/net/wireless/ath/ath11k/reg.c  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 2dd51f1ecfd0..a3d6f1b28405 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1210,7 +1210,6 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 static void ath11k_core_soc_destroy(struct ath11k_base *ab)
 {
 	ath11k_debugfs_soc_destroy(ab);
-	ath11k_reg_free(ab);
 	ath11k_qmi_deinit_service(ab);
 }
 
@@ -1532,6 +1531,7 @@ static void ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 	mutex_unlock(&ab->core_lock);
 
 	ath11k_dp_free(ab);
+	ath11k_reg_free(ab);
 
 	ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1;
 }
@@ -1929,6 +1929,7 @@ void ath11k_core_stop_device(struct ath11k_base *ab)
 	ath11k_thermal_unregister(ab);
 	ath11k_dp_pdev_free(ab);
 	ath11k_dp_free(ab);
+	ath11k_reg_free(ab);
 }
 
 int ath11k_core_any_pdevs_on(struct ath11k_base *ab)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index 7ee3ff69dfc8..0aa4c7b039d0 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -757,5 +757,7 @@ void ath11k_reg_free(struct ath11k_base *ab)
 	for (i = 0; i < ab->hw_params.max_radios; i++) {
 		kfree(ab->default_regd[i]);
 		kfree(ab->new_regd[i]);
+		ab->default_regd[i] = NULL;
+		ab->new_regd[i] = NULL;
 	}
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 4/4] ath11k: Fix failed to parse regulatory event print
@ 2022-07-20 13:49   ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-07-20 13:49 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Manikanta Pubbisetty

In the continuous WiFi ON/OFF scenario, we see a lot of
"failed to parse regulatory event" prints on the console.
This is because we already would have created a regulatory
domain for the wiphy and we will discard the subsequent
events to create the same regulatory event.

Fix this error print by freeing up the regulatory resources
in WiFi OFF and create the database again in WiFi ON. The same
applies for hardware recovery as well.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c | 3 ++-
 drivers/net/wireless/ath/ath11k/reg.c  | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 2dd51f1ecfd0..a3d6f1b28405 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1210,7 +1210,6 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 static void ath11k_core_soc_destroy(struct ath11k_base *ab)
 {
 	ath11k_debugfs_soc_destroy(ab);
-	ath11k_reg_free(ab);
 	ath11k_qmi_deinit_service(ab);
 }
 
@@ -1532,6 +1531,7 @@ static void ath11k_core_reconfigure_on_crash(struct ath11k_base *ab)
 	mutex_unlock(&ab->core_lock);
 
 	ath11k_dp_free(ab);
+	ath11k_reg_free(ab);
 
 	ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1;
 }
@@ -1929,6 +1929,7 @@ void ath11k_core_stop_device(struct ath11k_base *ab)
 	ath11k_thermal_unregister(ab);
 	ath11k_dp_pdev_free(ab);
 	ath11k_dp_free(ab);
+	ath11k_reg_free(ab);
 }
 
 int ath11k_core_any_pdevs_on(struct ath11k_base *ab)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index 7ee3ff69dfc8..0aa4c7b039d0 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -757,5 +757,7 @@ void ath11k_reg_free(struct ath11k_base *ab)
 	for (i = 0; i < ab->hw_params.max_radios; i++) {
 		kfree(ab->default_regd[i]);
 		kfree(ab->new_regd[i]);
+		ab->default_regd[i] = NULL;
+		ab->new_regd[i] = NULL;
 	}
 }
-- 
2.35.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-07-20 13:49 ` Manikanta Pubbisetty
@ 2022-07-22 22:00   ` Limonciello, Mario
  -1 siblings, 0 replies; 26+ messages in thread
From: Limonciello, Mario @ 2022-07-22 22:00 UTC (permalink / raw)
  To: Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
> Currently, WLAN chip is powered once during driver probe and is kept
> ON (powered) always even when WLAN is not active; keeping the chip
> powered ON all the time will consume extra power which is not
> desirable on a battery operated device. Same is the case with non-WoW
> suspend, chip will not be put into low power mode when the system is
> suspended resulting in higher battery drain.
> 
> Send QMI MODE OFF command to firmware during WiFi OFF to put device
> into low power mode.
> 
> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
> 
> Manikanta Pubbisetty (4):
>    ath11k: Fix double free issue during SRNG deinit
>    ath11k: Move hardware initialization logic to start()
>    ath11k: Enable low power mode when WLAN is not active
>    ath11k: Fix failed to parse regulatory event print
> 
>   drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>   5 files changed, 189 insertions(+), 92 deletions(-)
> 

This series looked potentially promising to me for a problem that I'm 
seeing on a notebook failing to sleep where WLAN_WAKE is asserted on the 
WCN6855 on resume even though WoW wasn't set at all.  This is 
problematic as it causes a spurious wake while SUT is reading from the 
EC since two IRQs are now active and the kernel wakes from that.
Removing the WCN6855 from the system it doesn't happen.

I figured I'd give it a spin to see if it improved things.
I applied the series on top of 5.19-rc7 and it applied cleanly but I get 
timeouts on wlan card init (and of course suspend fails now too).

Here's the mhi/ath11k_pci snippets:

[    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
0xb4000000-0xb41fffff 64bit]
[    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
[    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
[    3.106892] mhi mhi0: Requested to power ON
[    3.107054] mhi mhi0: Power on setup success
[    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
[    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
board_id 0xff soc_id 0x400c0210
[    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
fw_build_timestamp 2021-12-16 03:42 fw_build_id 
WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
[    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
[    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
Country regulatory setting
[    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
Country regulatory setting
[   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, err 
= -110
[   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw ini:-110
[   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware start: -110
[   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
[   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
[   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110

And so - on.
Is it functionally dependent on other patches in linux-next or another 
tree I won't see in 5.19?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-07-22 22:00   ` Limonciello, Mario
  0 siblings, 0 replies; 26+ messages in thread
From: Limonciello, Mario @ 2022-07-22 22:00 UTC (permalink / raw)
  To: Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
> Currently, WLAN chip is powered once during driver probe and is kept
> ON (powered) always even when WLAN is not active; keeping the chip
> powered ON all the time will consume extra power which is not
> desirable on a battery operated device. Same is the case with non-WoW
> suspend, chip will not be put into low power mode when the system is
> suspended resulting in higher battery drain.
> 
> Send QMI MODE OFF command to firmware during WiFi OFF to put device
> into low power mode.
> 
> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
> 
> Manikanta Pubbisetty (4):
>    ath11k: Fix double free issue during SRNG deinit
>    ath11k: Move hardware initialization logic to start()
>    ath11k: Enable low power mode when WLAN is not active
>    ath11k: Fix failed to parse regulatory event print
> 
>   drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>   5 files changed, 189 insertions(+), 92 deletions(-)
> 

This series looked potentially promising to me for a problem that I'm 
seeing on a notebook failing to sleep where WLAN_WAKE is asserted on the 
WCN6855 on resume even though WoW wasn't set at all.  This is 
problematic as it causes a spurious wake while SUT is reading from the 
EC since two IRQs are now active and the kernel wakes from that.
Removing the WCN6855 from the system it doesn't happen.

I figured I'd give it a spin to see if it improved things.
I applied the series on top of 5.19-rc7 and it applied cleanly but I get 
timeouts on wlan card init (and of course suspend fails now too).

Here's the mhi/ath11k_pci snippets:

[    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
0xb4000000-0xb41fffff 64bit]
[    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
[    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
[    3.106892] mhi mhi0: Requested to power ON
[    3.107054] mhi mhi0: Power on setup success
[    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
[    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
board_id 0xff soc_id 0x400c0210
[    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
fw_build_timestamp 2021-12-16 03:42 fw_build_id 
WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
[    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
[    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
Country regulatory setting
[    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
Country regulatory setting
[   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, err 
= -110
[   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw ini:-110
[   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware start: -110
[   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
[   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
[   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110

And so - on.
Is it functionally dependent on other patches in linux-next or another 
tree I won't see in 5.19?

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-07-22 22:00   ` Limonciello, Mario
@ 2022-07-23 12:09     ` Limonciello, Mario
  -1 siblings, 0 replies; 26+ messages in thread
From: Limonciello, Mario @ 2022-07-23 12:09 UTC (permalink / raw)
  To: Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

On 7/22/2022 17:00, Limonciello, Mario wrote:
> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>> Currently, WLAN chip is powered once during driver probe and is kept
>> ON (powered) always even when WLAN is not active; keeping the chip
>> powered ON all the time will consume extra power which is not
>> desirable on a battery operated device. Same is the case with non-WoW
>> suspend, chip will not be put into low power mode when the system is
>> suspended resulting in higher battery drain.
>>
>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>> into low power mode.
>>
>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>
>> Manikanta Pubbisetty (4):
>>    ath11k: Fix double free issue during SRNG deinit
>>    ath11k: Move hardware initialization logic to start()
>>    ath11k: Enable low power mode when WLAN is not active
>>    ath11k: Fix failed to parse regulatory event print
>>
>>   drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>
> 
> This series looked potentially promising to me for a problem that I'm 
> seeing on a notebook failing to sleep where WLAN_WAKE is asserted on the 
> WCN6855 on resume even though WoW wasn't set at all.  This is 
> problematic as it causes a spurious wake while SUT is reading from the 
> EC since two IRQs are now active and the kernel wakes from that.
> Removing the WCN6855 from the system it doesn't happen.
> 
> I figured I'd give it a spin to see if it improved things.
> I applied the series on top of 5.19-rc7 and it applied cleanly but I get 
> timeouts on wlan card init (and of course suspend fails now too).
> 
> Here's the mhi/ath11k_pci snippets:
> 
> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
> 0xb4000000-0xb41fffff 64bit]
> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
> [    3.106892] mhi mhi0: Requested to power ON
> [    3.107054] mhi mhi0: Power on setup success
> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
> board_id 0xff soc_id 0x400c0210
> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
> Country regulatory setting
> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
> Country regulatory setting
> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, err 
> = -110
> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw ini:-110
> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware start: -110
> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
> 
> And so - on.
> Is it functionally dependent on other patches in linux-next or another 
> tree I won't see in 5.19?

I had a try with linux-next and your series but I reproduce the same 
failure I described above.

ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
e320c8ef9841 ath11k: Move hardware initialization logic to start()
dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
specific files for 20220722



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-07-23 12:09     ` Limonciello, Mario
  0 siblings, 0 replies; 26+ messages in thread
From: Limonciello, Mario @ 2022-07-23 12:09 UTC (permalink / raw)
  To: Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

On 7/22/2022 17:00, Limonciello, Mario wrote:
> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>> Currently, WLAN chip is powered once during driver probe and is kept
>> ON (powered) always even when WLAN is not active; keeping the chip
>> powered ON all the time will consume extra power which is not
>> desirable on a battery operated device. Same is the case with non-WoW
>> suspend, chip will not be put into low power mode when the system is
>> suspended resulting in higher battery drain.
>>
>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>> into low power mode.
>>
>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>
>> Manikanta Pubbisetty (4):
>>    ath11k: Fix double free issue during SRNG deinit
>>    ath11k: Move hardware initialization logic to start()
>>    ath11k: Enable low power mode when WLAN is not active
>>    ath11k: Fix failed to parse regulatory event print
>>
>>   drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>
> 
> This series looked potentially promising to me for a problem that I'm 
> seeing on a notebook failing to sleep where WLAN_WAKE is asserted on the 
> WCN6855 on resume even though WoW wasn't set at all.  This is 
> problematic as it causes a spurious wake while SUT is reading from the 
> EC since two IRQs are now active and the kernel wakes from that.
> Removing the WCN6855 from the system it doesn't happen.
> 
> I figured I'd give it a spin to see if it improved things.
> I applied the series on top of 5.19-rc7 and it applied cleanly but I get 
> timeouts on wlan card init (and of course suspend fails now too).
> 
> Here's the mhi/ath11k_pci snippets:
> 
> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
> 0xb4000000-0xb41fffff 64bit]
> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
> [    3.106892] mhi mhi0: Requested to power ON
> [    3.107054] mhi mhi0: Power on setup success
> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
> board_id 0xff soc_id 0x400c0210
> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
> Country regulatory setting
> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
> Country regulatory setting
> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, err 
> = -110
> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw ini:-110
> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware start: -110
> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
> 
> And so - on.
> Is it functionally dependent on other patches in linux-next or another 
> tree I won't see in 5.19?

I had a try with linux-next and your series but I reproduce the same 
failure I described above.

ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
e320c8ef9841 ath11k: Move hardware initialization logic to start()
dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
specific files for 20220722



-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-07-23 12:09     ` Limonciello, Mario
@ 2022-08-25 11:24       ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-08-25 11:24 UTC (permalink / raw)
  To: Limonciello, Mario, ath11k; +Cc: linux-wireless

On 7/23/2022 5:39 PM, Limonciello, Mario wrote:
> On 7/22/2022 17:00, Limonciello, Mario wrote:
>> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>>> Currently, WLAN chip is powered once during driver probe and is kept
>>> ON (powered) always even when WLAN is not active; keeping the chip
>>> powered ON all the time will consume extra power which is not
>>> desirable on a battery operated device. Same is the case with non-WoW
>>> suspend, chip will not be put into low power mode when the system is
>>> suspended resulting in higher battery drain.
>>>
>>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>>> into low power mode.
>>>
>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>>
>>> Manikanta Pubbisetty (4):
>>>    ath11k: Fix double free issue during SRNG deinit
>>>    ath11k: Move hardware initialization logic to start()
>>>    ath11k: Enable low power mode when WLAN is not active
>>>    ath11k: Fix failed to parse regulatory event print
>>>
>>>   drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
>>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>>
>>
>> This series looked potentially promising to me for a problem that I'm 
>> seeing on a notebook failing to sleep where WLAN_WAKE is asserted on 
>> the WCN6855 on resume even though WoW wasn't set at all.  This is 
>> problematic as it causes a spurious wake while SUT is reading from the 
>> EC since two IRQs are now active and the kernel wakes from that.
>> Removing the WCN6855 from the system it doesn't happen.
>>
>> I figured I'd give it a spin to see if it improved things.
>> I applied the series on top of 5.19-rc7 and it applied cleanly but I 
>> get timeouts on wlan card init (and of course suspend fails now too).
>>
>> Here's the mhi/ath11k_pci snippets:
>>
>> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
>> 0xb4000000-0xb41fffff 64bit]
>> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
>> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
>> [    3.106892] mhi mhi0: Requested to power ON
>> [    3.107054] mhi mhi0: Power on setup success
>> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
>> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
>> board_id 0xff soc_id 0x400c0210
>> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
>> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
>> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
>> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
>> Country regulatory setting
>> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
>> Country regulatory setting
>> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, 
>> err = -110
>> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw 
>> ini:-110
>> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware start: 
>> -110
>> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
>> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
>> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
>>
>> And so - on.
>> Is it functionally dependent on other patches in linux-next or another 
>> tree I won't see in 5.19?
> 
> I had a try with linux-next and your series but I reproduce the same 
> failure I described above.
> 
> ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
> 4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
> e320c8ef9841 ath11k: Move hardware initialization logic to start()
> dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
> 18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
> specific files for 20220722
> 
> 

Sorry for late reply and thanks for reporting the bug.
After several rounds of discussions with the concerned teams on the 
failure that you have reported, we have root caused the issue.

The changes that I have posted will not work on other targets like 
WCN6855 as is. It requires additional changes and therefore lots of testing.

For now, I have posted a V2 enabling the "low power mode" design only on
WCN6750. I have started working on enabling the logic for other chipsets 
also. Once the changes are well tested, I'll post a separate patch to 
enable it on WCN6855. It might take a little more time.

Thanks,
Manikanta

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-08-25 11:24       ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-08-25 11:24 UTC (permalink / raw)
  To: Limonciello, Mario, ath11k; +Cc: linux-wireless

On 7/23/2022 5:39 PM, Limonciello, Mario wrote:
> On 7/22/2022 17:00, Limonciello, Mario wrote:
>> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>>> Currently, WLAN chip is powered once during driver probe and is kept
>>> ON (powered) always even when WLAN is not active; keeping the chip
>>> powered ON all the time will consume extra power which is not
>>> desirable on a battery operated device. Same is the case with non-WoW
>>> suspend, chip will not be put into low power mode when the system is
>>> suspended resulting in higher battery drain.
>>>
>>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>>> into low power mode.
>>>
>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>>
>>> Manikanta Pubbisetty (4):
>>>    ath11k: Fix double free issue during SRNG deinit
>>>    ath11k: Move hardware initialization logic to start()
>>>    ath11k: Enable low power mode when WLAN is not active
>>>    ath11k: Fix failed to parse regulatory event print
>>>
>>>   drivers/net/wireless/ath/ath11k/core.c | 237 ++++++++++++++++++-------
>>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>>
>>
>> This series looked potentially promising to me for a problem that I'm 
>> seeing on a notebook failing to sleep where WLAN_WAKE is asserted on 
>> the WCN6855 on resume even though WoW wasn't set at all.  This is 
>> problematic as it causes a spurious wake while SUT is reading from the 
>> EC since two IRQs are now active and the kernel wakes from that.
>> Removing the WCN6855 from the system it doesn't happen.
>>
>> I figured I'd give it a spin to see if it improved things.
>> I applied the series on top of 5.19-rc7 and it applied cleanly but I 
>> get timeouts on wlan card init (and of course suspend fails now too).
>>
>> Here's the mhi/ath11k_pci snippets:
>>
>> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
>> 0xb4000000-0xb41fffff 64bit]
>> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
>> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
>> [    3.106892] mhi mhi0: Requested to power ON
>> [    3.107054] mhi mhi0: Power on setup success
>> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
>> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
>> board_id 0xff soc_id 0x400c0210
>> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
>> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
>> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
>> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
>> Country regulatory setting
>> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
>> Country regulatory setting
>> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, 
>> err = -110
>> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw 
>> ini:-110
>> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware start: 
>> -110
>> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
>> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
>> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
>>
>> And so - on.
>> Is it functionally dependent on other patches in linux-next or another 
>> tree I won't see in 5.19?
> 
> I had a try with linux-next and your series but I reproduce the same 
> failure I described above.
> 
> ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
> 4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
> e320c8ef9841 ath11k: Move hardware initialization logic to start()
> dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
> 18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
> specific files for 20220722
> 
> 

Sorry for late reply and thanks for reporting the bug.
After several rounds of discussions with the concerned teams on the 
failure that you have reported, we have root caused the issue.

The changes that I have posted will not work on other targets like 
WCN6855 as is. It requires additional changes and therefore lots of testing.

For now, I have posted a V2 enabling the "low power mode" design only on
WCN6750. I have started working on enabling the logic for other chipsets 
also. Once the changes are well tested, I'll post a separate patch to 
enable it on WCN6855. It might take a little more time.

Thanks,
Manikanta

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-08-25 11:24       ` Manikanta Pubbisetty
@ 2022-08-25 17:16         ` Limonciello, Mario
  -1 siblings, 0 replies; 26+ messages in thread
From: Limonciello, Mario @ 2022-08-25 17:16 UTC (permalink / raw)
  To: Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

On 8/25/2022 06:24, Manikanta Pubbisetty wrote:
> On 7/23/2022 5:39 PM, Limonciello, Mario wrote:
>> On 7/22/2022 17:00, Limonciello, Mario wrote:
>>> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>>>> Currently, WLAN chip is powered once during driver probe and is kept
>>>> ON (powered) always even when WLAN is not active; keeping the chip
>>>> powered ON all the time will consume extra power which is not
>>>> desirable on a battery operated device. Same is the case with non-WoW
>>>> suspend, chip will not be put into low power mode when the system is
>>>> suspended resulting in higher battery drain.
>>>>
>>>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>>>> into low power mode.
>>>>
>>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>>>
>>>> Manikanta Pubbisetty (4):
>>>>    ath11k: Fix double free issue during SRNG deinit
>>>>    ath11k: Move hardware initialization logic to start()
>>>>    ath11k: Enable low power mode when WLAN is not active
>>>>    ath11k: Fix failed to parse regulatory event print
>>>>
>>>>   drivers/net/wireless/ath/ath11k/core.c | 237 
>>>> ++++++++++++++++++-------
>>>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>>>
>>>
>>> This series looked potentially promising to me for a problem that I'm 
>>> seeing on a notebook failing to sleep where WLAN_WAKE is asserted on 
>>> the WCN6855 on resume even though WoW wasn't set at all.  This is 
>>> problematic as it causes a spurious wake while SUT is reading from 
>>> the EC since two IRQs are now active and the kernel wakes from that.
>>> Removing the WCN6855 from the system it doesn't happen.
>>>
>>> I figured I'd give it a spin to see if it improved things.
>>> I applied the series on top of 5.19-rc7 and it applied cleanly but I 
>>> get timeouts on wlan card init (and of course suspend fails now too).
>>>
>>> Here's the mhi/ath11k_pci snippets:
>>>
>>> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
>>> 0xb4000000-0xb41fffff 64bit]
>>> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
>>> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
>>> [    3.106892] mhi mhi0: Requested to power ON
>>> [    3.107054] mhi mhi0: Power on setup success
>>> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
>>> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
>>> board_id 0xff soc_id 0x400c0210
>>> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
>>> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
>>> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
>>> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>>> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>> Country regulatory setting
>>> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>> Country regulatory setting
>>> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, 
>>> err = -110
>>> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw 
>>> ini:-110
>>> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware 
>>> start: -110
>>> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
>>> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
>>> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
>>>
>>> And so - on.
>>> Is it functionally dependent on other patches in linux-next or 
>>> another tree I won't see in 5.19?
>>
>> I had a try with linux-next and your series but I reproduce the same 
>> failure I described above.
>>
>> ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
>> 4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
>> e320c8ef9841 ath11k: Move hardware initialization logic to start()
>> dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
>> 18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
>> specific files for 20220722
>>
>>
> 
> Sorry for late reply and thanks for reporting the bug.
> After several rounds of discussions with the concerned teams on the 
> failure that you have reported, we have root caused the issue.
> 

Thanks for getting back to me and confirming that.

> The changes that I have posted will not work on other targets like 
> WCN6855 as is. It requires additional changes and therefore lots of 
> testing.

Well glad I reported it and saved you a regression!

> 
> For now, I have posted a V2 enabling the "low power mode" design only on
> WCN6750. I have started working on enabling the logic for other chipsets 
> also. Once the changes are well tested, I'll post a separate patch to 
> enable it on WCN6855. It might take a little more time.
> 

Will low power mode on WCN6855 also require F/W changes, or you expect 
that it will be able to be done entirely in the kernel driver?

I am eager to see if low power mode can fix my existing mentioned issue. 
  If it can you may CC me when they go out and I'm happy to test these 
patches too when you have them ready.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-08-25 17:16         ` Limonciello, Mario
  0 siblings, 0 replies; 26+ messages in thread
From: Limonciello, Mario @ 2022-08-25 17:16 UTC (permalink / raw)
  To: Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

On 8/25/2022 06:24, Manikanta Pubbisetty wrote:
> On 7/23/2022 5:39 PM, Limonciello, Mario wrote:
>> On 7/22/2022 17:00, Limonciello, Mario wrote:
>>> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>>>> Currently, WLAN chip is powered once during driver probe and is kept
>>>> ON (powered) always even when WLAN is not active; keeping the chip
>>>> powered ON all the time will consume extra power which is not
>>>> desirable on a battery operated device. Same is the case with non-WoW
>>>> suspend, chip will not be put into low power mode when the system is
>>>> suspended resulting in higher battery drain.
>>>>
>>>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>>>> into low power mode.
>>>>
>>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>>>
>>>> Manikanta Pubbisetty (4):
>>>>    ath11k: Fix double free issue during SRNG deinit
>>>>    ath11k: Move hardware initialization logic to start()
>>>>    ath11k: Enable low power mode when WLAN is not active
>>>>    ath11k: Fix failed to parse regulatory event print
>>>>
>>>>   drivers/net/wireless/ath/ath11k/core.c | 237 
>>>> ++++++++++++++++++-------
>>>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>>>
>>>
>>> This series looked potentially promising to me for a problem that I'm 
>>> seeing on a notebook failing to sleep where WLAN_WAKE is asserted on 
>>> the WCN6855 on resume even though WoW wasn't set at all.  This is 
>>> problematic as it causes a spurious wake while SUT is reading from 
>>> the EC since two IRQs are now active and the kernel wakes from that.
>>> Removing the WCN6855 from the system it doesn't happen.
>>>
>>> I figured I'd give it a spin to see if it improved things.
>>> I applied the series on top of 5.19-rc7 and it applied cleanly but I 
>>> get timeouts on wlan card init (and of course suspend fails now too).
>>>
>>> Here's the mhi/ath11k_pci snippets:
>>>
>>> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
>>> 0xb4000000-0xb41fffff 64bit]
>>> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
>>> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
>>> [    3.106892] mhi mhi0: Requested to power ON
>>> [    3.107054] mhi mhi0: Power on setup success
>>> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
>>> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
>>> board_id 0xff soc_id 0x400c0210
>>> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
>>> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
>>> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
>>> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>>> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>> Country regulatory setting
>>> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>> Country regulatory setting
>>> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, 
>>> err = -110
>>> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw 
>>> ini:-110
>>> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware 
>>> start: -110
>>> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
>>> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
>>> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
>>>
>>> And so - on.
>>> Is it functionally dependent on other patches in linux-next or 
>>> another tree I won't see in 5.19?
>>
>> I had a try with linux-next and your series but I reproduce the same 
>> failure I described above.
>>
>> ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
>> 4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
>> e320c8ef9841 ath11k: Move hardware initialization logic to start()
>> dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
>> 18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
>> specific files for 20220722
>>
>>
> 
> Sorry for late reply and thanks for reporting the bug.
> After several rounds of discussions with the concerned teams on the 
> failure that you have reported, we have root caused the issue.
> 

Thanks for getting back to me and confirming that.

> The changes that I have posted will not work on other targets like 
> WCN6855 as is. It requires additional changes and therefore lots of 
> testing.

Well glad I reported it and saved you a regression!

> 
> For now, I have posted a V2 enabling the "low power mode" design only on
> WCN6750. I have started working on enabling the logic for other chipsets 
> also. Once the changes are well tested, I'll post a separate patch to 
> enable it on WCN6855. It might take a little more time.
> 

Will low power mode on WCN6855 also require F/W changes, or you expect 
that it will be able to be done entirely in the kernel driver?

I am eager to see if low power mode can fix my existing mentioned issue. 
  If it can you may CC me when they go out and I'm happy to test these 
patches too when you have them ready.


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-08-25 17:16         ` Limonciello, Mario
@ 2022-08-25 21:01           ` Mark Herbert
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Herbert @ 2022-08-25 21:01 UTC (permalink / raw)
  To: Limonciello, Mario, Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

>
>> The changes that I have posted will not work on other targets like 
>> WCN6855 as is. It requires additional changes and therefore lots of 
>> testing.
>

Will the changes be possible for QCA6390 as well?  Currently this chip 
only activates power saving mode when it is connected, but behaves badly 
when not associated to any network. So there is a chance that this kind 
of solution will help.


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-08-25 21:01           ` Mark Herbert
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Herbert @ 2022-08-25 21:01 UTC (permalink / raw)
  To: Limonciello, Mario, Manikanta Pubbisetty, ath11k; +Cc: linux-wireless

>
>> The changes that I have posted will not work on other targets like 
>> WCN6855 as is. It requires additional changes and therefore lots of 
>> testing.
>

Will the changes be possible for QCA6390 as well?  Currently this chip 
only activates power saving mode when it is connected, but behaves badly 
when not associated to any network. So there is a chance that this kind 
of solution will help.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-08-25 17:16         ` Limonciello, Mario
@ 2022-08-29  5:28           ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-08-29  5:28 UTC (permalink / raw)
  To: Limonciello, Mario, ath11k; +Cc: linux-wireless

On 8/25/2022 10:46 PM, Limonciello, Mario wrote:
> On 8/25/2022 06:24, Manikanta Pubbisetty wrote:
>> On 7/23/2022 5:39 PM, Limonciello, Mario wrote:
>>> On 7/22/2022 17:00, Limonciello, Mario wrote:
>>>> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>>>>> Currently, WLAN chip is powered once during driver probe and is kept
>>>>> ON (powered) always even when WLAN is not active; keeping the chip
>>>>> powered ON all the time will consume extra power which is not
>>>>> desirable on a battery operated device. Same is the case with non-WoW
>>>>> suspend, chip will not be put into low power mode when the system is
>>>>> suspended resulting in higher battery drain.
>>>>>
>>>>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>>>>> into low power mode.
>>>>>
>>>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>>>>
>>>>> Manikanta Pubbisetty (4):
>>>>>    ath11k: Fix double free issue during SRNG deinit
>>>>>    ath11k: Move hardware initialization logic to start()
>>>>>    ath11k: Enable low power mode when WLAN is not active
>>>>>    ath11k: Fix failed to parse regulatory event print
>>>>>
>>>>>   drivers/net/wireless/ath/ath11k/core.c | 237 
>>>>> ++++++++++++++++++-------
>>>>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>>>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>>>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>>>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>>>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>>>>
>>>>
>>>> This series looked potentially promising to me for a problem that 
>>>> I'm seeing on a notebook failing to sleep where WLAN_WAKE is 
>>>> asserted on the WCN6855 on resume even though WoW wasn't set at 
>>>> all.  This is problematic as it causes a spurious wake while SUT is 
>>>> reading from the EC since two IRQs are now active and the kernel 
>>>> wakes from that.
>>>> Removing the WCN6855 from the system it doesn't happen.
>>>>
>>>> I figured I'd give it a spin to see if it improved things.
>>>> I applied the series on top of 5.19-rc7 and it applied cleanly but I 
>>>> get timeouts on wlan card init (and of course suspend fails now too).
>>>>
>>>> Here's the mhi/ath11k_pci snippets:
>>>>
>>>> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
>>>> 0xb4000000-0xb41fffff 64bit]
>>>> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
>>>> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
>>>> [    3.106892] mhi mhi0: Requested to power ON
>>>> [    3.107054] mhi mhi0: Power on setup success
>>>> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
>>>> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
>>>> board_id 0xff soc_id 0x400c0210
>>>> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
>>>> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
>>>> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
>>>> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>>>> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>>> Country regulatory setting
>>>> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>>> Country regulatory setting
>>>> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, 
>>>> err = -110
>>>> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw 
>>>> ini:-110
>>>> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware 
>>>> start: -110
>>>> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
>>>> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
>>>> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
>>>>
>>>> And so - on.
>>>> Is it functionally dependent on other patches in linux-next or 
>>>> another tree I won't see in 5.19?
>>>
>>> I had a try with linux-next and your series but I reproduce the same 
>>> failure I described above.
>>>
>>> ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
>>> 4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
>>> e320c8ef9841 ath11k: Move hardware initialization logic to start()
>>> dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
>>> 18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
>>> specific files for 20220722
>>>
>>>
>>
>> Sorry for late reply and thanks for reporting the bug.
>> After several rounds of discussions with the concerned teams on the 
>> failure that you have reported, we have root caused the issue.
>>
> 
> Thanks for getting back to me and confirming that.
> 
>> The changes that I have posted will not work on other targets like 
>> WCN6855 as is. It requires additional changes and therefore lots of 
>> testing.
> 
> Well glad I reported it and saved you a regression!
> 
>>
>> For now, I have posted a V2 enabling the "low power mode" design only on
>> WCN6750. I have started working on enabling the logic for other 
>> chipsets also. Once the changes are well tested, I'll post a separate 
>> patch to enable it on WCN6855. It might take a little more time.
>>
> 
> Will low power mode on WCN6855 also require F/W changes, or you expect 
> that it will be able to be done entirely in the kernel driver?

It should most likely be a driver change.

> 
> I am eager to see if low power mode can fix my existing mentioned issue. 
>   If it can you may CC me when they go out and I'm happy to test these 
> patches too when you have them ready.
> 

Sure, thanks!!

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-08-29  5:28           ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-08-29  5:28 UTC (permalink / raw)
  To: Limonciello, Mario, ath11k; +Cc: linux-wireless

On 8/25/2022 10:46 PM, Limonciello, Mario wrote:
> On 8/25/2022 06:24, Manikanta Pubbisetty wrote:
>> On 7/23/2022 5:39 PM, Limonciello, Mario wrote:
>>> On 7/22/2022 17:00, Limonciello, Mario wrote:
>>>> On 7/20/2022 08:49, Manikanta Pubbisetty wrote:
>>>>> Currently, WLAN chip is powered once during driver probe and is kept
>>>>> ON (powered) always even when WLAN is not active; keeping the chip
>>>>> powered ON all the time will consume extra power which is not
>>>>> desirable on a battery operated device. Same is the case with non-WoW
>>>>> suspend, chip will not be put into low power mode when the system is
>>>>> suspended resulting in higher battery drain.
>>>>>
>>>>> Send QMI MODE OFF command to firmware during WiFi OFF to put device
>>>>> into low power mode.
>>>>>
>>>>> Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
>>>>>
>>>>> Manikanta Pubbisetty (4):
>>>>>    ath11k: Fix double free issue during SRNG deinit
>>>>>    ath11k: Move hardware initialization logic to start()
>>>>>    ath11k: Enable low power mode when WLAN is not active
>>>>>    ath11k: Fix failed to parse regulatory event print
>>>>>
>>>>>   drivers/net/wireless/ath/ath11k/core.c | 237 
>>>>> ++++++++++++++++++-------
>>>>>   drivers/net/wireless/ath/ath11k/core.h |   8 +-
>>>>>   drivers/net/wireless/ath/ath11k/hal.c  |   1 +
>>>>>   drivers/net/wireless/ath/ath11k/mac.c  |  33 ++--
>>>>>   drivers/net/wireless/ath/ath11k/reg.c  |   2 +
>>>>>   5 files changed, 189 insertions(+), 92 deletions(-)
>>>>>
>>>>
>>>> This series looked potentially promising to me for a problem that 
>>>> I'm seeing on a notebook failing to sleep where WLAN_WAKE is 
>>>> asserted on the WCN6855 on resume even though WoW wasn't set at 
>>>> all.  This is problematic as it causes a spurious wake while SUT is 
>>>> reading from the EC since two IRQs are now active and the kernel 
>>>> wakes from that.
>>>> Removing the WCN6855 from the system it doesn't happen.
>>>>
>>>> I figured I'd give it a spin to see if it improved things.
>>>> I applied the series on top of 5.19-rc7 and it applied cleanly but I 
>>>> get timeouts on wlan card init (and of course suspend fails now too).
>>>>
>>>> Here's the mhi/ath11k_pci snippets:
>>>>
>>>> [    2.864110] ath11k_pci 0000:01:00.0: BAR 0: assigned [mem 
>>>> 0xb4000000-0xb41fffff 64bit]
>>>> [    2.864901] ath11k_pci 0000:01:00.0: MSI vectors: 32
>>>> [    2.864912] ath11k_pci 0000:01:00.0: wcn6855 hw2.1
>>>> [    3.106892] mhi mhi0: Requested to power ON
>>>> [    3.107054] mhi mhi0: Power on setup success
>>>> [    3.198178] mhi mhi0: Wait for device to enter SBL or Mission mode
>>>> [    3.971019] ath11k_pci 0000:01:00.0: chip_id 0x2 chip_family 0xb 
>>>> board_id 0xff soc_id 0x400c0210
>>>> [    3.971025] ath11k_pci 0000:01:00.0: fw_version 0x11080bbb 
>>>> fw_build_timestamp 2021-12-16 03:42 fw_build_id 
>>>> WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
>>>> [    4.290328] ath11k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>>>> [    4.308760] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>>> Country regulatory setting
>>>> [    4.309028] ath11k_pci 0000:01:00.0: Failed to set the requested 
>>>> Country regulatory setting
>>>> [   14.386201] ath11k_pci 0000:01:00.0: qmi failed wlan ini request, 
>>>> err = -110
>>>> [   14.386210] ath11k_pci 0000:01:00.0: qmi failed to send wlan fw 
>>>> ini:-110
>>>> [   14.386214] ath11k_pci 0000:01:00.0: failed to send firmware 
>>>> start: -110
>>>> [   14.386243] ath11k_pci 0000:01:00.0: failed to start firmware: -110
>>>> [   14.386266] ath11k_pci 0000:01:00.0: failed to setup device: -110
>>>> [   14.386300] ath11k_pci 0000:01:00.0: failed to start device : -110
>>>>
>>>> And so - on.
>>>> Is it functionally dependent on other patches in linux-next or 
>>>> another tree I won't see in 5.19?
>>>
>>> I had a try with linux-next and your series but I reproduce the same 
>>> failure I described above.
>>>
>>> ee3a066e4f4e (HEAD) ath11k: Fix failed to parse regulatory event print
>>> 4f850f1e26dc ath11k: Enable low power mode when WLAN is not active
>>> e320c8ef9841 ath11k: Move hardware initialization logic to start()
>>> dbc26036c1ef ath11k: Fix double free issue during SRNG deinit
>>> 18c107a1f120 (tag: next-20220722, linux-next/master) Add linux-next 
>>> specific files for 20220722
>>>
>>>
>>
>> Sorry for late reply and thanks for reporting the bug.
>> After several rounds of discussions with the concerned teams on the 
>> failure that you have reported, we have root caused the issue.
>>
> 
> Thanks for getting back to me and confirming that.
> 
>> The changes that I have posted will not work on other targets like 
>> WCN6855 as is. It requires additional changes and therefore lots of 
>> testing.
> 
> Well glad I reported it and saved you a regression!
> 
>>
>> For now, I have posted a V2 enabling the "low power mode" design only on
>> WCN6750. I have started working on enabling the logic for other 
>> chipsets also. Once the changes are well tested, I'll post a separate 
>> patch to enable it on WCN6855. It might take a little more time.
>>
> 
> Will low power mode on WCN6855 also require F/W changes, or you expect 
> that it will be able to be done entirely in the kernel driver?

It should most likely be a driver change.

> 
> I am eager to see if low power mode can fix my existing mentioned issue. 
>   If it can you may CC me when they go out and I'm happy to test these 
> patches too when you have them ready.
> 

Sure, thanks!!

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-08-25 21:01           ` Mark Herbert
@ 2022-08-29  5:30             ` Manikanta Pubbisetty
  -1 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-08-29  5:30 UTC (permalink / raw)
  To: Mark Herbert, Limonciello, Mario, ath11k; +Cc: linux-wireless

On 8/26/2022 2:31 AM, Mark Herbert wrote:
>>
>>> The changes that I have posted will not work on other targets like 
>>> WCN6855 as is. It requires additional changes and therefore lots of 
>>> testing.
>>
> 
> Will the changes be possible for QCA6390 as well?  Currently this chip 
> only activates power saving mode when it is connected, but behaves badly 
> when not associated to any network. So there is a chance that this kind 
> of solution will help.
> 

Not associated to any network as in Wi-Fi is ON and not connected or 
Wi-Fi is off?

Manikanta

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-08-29  5:30             ` Manikanta Pubbisetty
  0 siblings, 0 replies; 26+ messages in thread
From: Manikanta Pubbisetty @ 2022-08-29  5:30 UTC (permalink / raw)
  To: Mark Herbert, Limonciello, Mario, ath11k; +Cc: linux-wireless

On 8/26/2022 2:31 AM, Mark Herbert wrote:
>>
>>> The changes that I have posted will not work on other targets like 
>>> WCN6855 as is. It requires additional changes and therefore lots of 
>>> testing.
>>
> 
> Will the changes be possible for QCA6390 as well?  Currently this chip 
> only activates power saving mode when it is connected, but behaves badly 
> when not associated to any network. So there is a chance that this kind 
> of solution will help.
> 

Not associated to any network as in Wi-Fi is ON and not connected or 
Wi-Fi is off?

Manikanta

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
  2022-08-29  5:30             ` Manikanta Pubbisetty
@ 2022-08-29  6:27               ` Mark Herbert
  -1 siblings, 0 replies; 26+ messages in thread
From: Mark Herbert @ 2022-08-29  6:27 UTC (permalink / raw)
  To: Manikanta Pubbisetty, Limonciello, Mario, ath11k; +Cc: linux-wireless


On 8/29/22 08:30, Manikanta Pubbisetty wrote:
> On 8/26/2022 2:31 AM, Mark Herbert wrote:
>>>
>>>> The changes that I have posted will not work on other targets like 
>>>> WCN6855 as is. It requires additional changes and therefore lots of 
>>>> testing.
>>>
>>
>> Will the changes be possible for QCA6390 as well?  Currently this 
>> chip only activates power saving mode when it is connected, but 
>> behaves badly when not associated to any network. So there is a 
>> chance that this kind of solution will help.
>>
>
> Not associated to any network as in Wi-Fi is ON and not connected or 
> Wi-Fi is off?
>
> Manikanta

The way it works now.

I boot my laptop (it is Dell XPS 13 9310). If the network is available 
and QCA6390 associates with it - the CPU package  goes for PC10 state 
for about 70% of time on idle. Even if I disconnect now it will be still 
good.

But if I boot my laptop and never connect (associate to any WiFi ) - the 
CPU will never reach below PC3 with WiFi on. If I disable WiFi - it 
reaches PC10, if enable back - again PC3.


The point is QCA6390 need to be associated to network after boot (or 
hibernation resume) before it activates powersave mode. If this very 
first associatiion is not happening - it will eat battery as mad.

For now I've workarounded it by setting a systemd timer service to check 
if the WiFi is not  associated for f 3 minutes and if it is not - switch 
wifi off.

But it is very strange why this first association is mandatory, because 
if this forst association after boot happened - QCA6390 behaves 
perfectly with WiFi on but not asociated. And continue to work perfectly 
until hardware restart (reboot or hibernate resume) - then again first 
association is needed.  I was thinking that it is happening because the 
ath11k_mac_vif_setup_ps is called only after the association so I've 
tested the patch to call it earlier, and still no luck.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active
@ 2022-08-29  6:27               ` Mark Herbert
  0 siblings, 0 replies; 26+ messages in thread
From: Mark Herbert @ 2022-08-29  6:27 UTC (permalink / raw)
  To: Manikanta Pubbisetty, Limonciello, Mario, ath11k; +Cc: linux-wireless


On 8/29/22 08:30, Manikanta Pubbisetty wrote:
> On 8/26/2022 2:31 AM, Mark Herbert wrote:
>>>
>>>> The changes that I have posted will not work on other targets like 
>>>> WCN6855 as is. It requires additional changes and therefore lots of 
>>>> testing.
>>>
>>
>> Will the changes be possible for QCA6390 as well?  Currently this 
>> chip only activates power saving mode when it is connected, but 
>> behaves badly when not associated to any network. So there is a 
>> chance that this kind of solution will help.
>>
>
> Not associated to any network as in Wi-Fi is ON and not connected or 
> Wi-Fi is off?
>
> Manikanta

The way it works now.

I boot my laptop (it is Dell XPS 13 9310). If the network is available 
and QCA6390 associates with it - the CPU package  goes for PC10 state 
for about 70% of time on idle. Even if I disconnect now it will be still 
good.

But if I boot my laptop and never connect (associate to any WiFi ) - the 
CPU will never reach below PC3 with WiFi on. If I disable WiFi - it 
reaches PC10, if enable back - again PC3.


The point is QCA6390 need to be associated to network after boot (or 
hibernation resume) before it activates powersave mode. If this very 
first associatiion is not happening - it will eat battery as mad.

For now I've workarounded it by setting a systemd timer service to check 
if the WiFi is not  associated for f 3 minutes and if it is not - switch 
wifi off.

But it is very strange why this first association is mandatory, because 
if this forst association after boot happened - QCA6390 behaves 
perfectly with WiFi on but not asociated. And continue to work perfectly 
until hardware restart (reboot or hibernate resume) - then again first 
association is needed.  I was thinking that it is happening because the 
ath11k_mac_vif_setup_ps is called only after the association so I've 
tested the patch to call it earlier, and still no luck.


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-08-29  6:27 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 13:49 [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active Manikanta Pubbisetty
2022-07-20 13:49 ` Manikanta Pubbisetty
2022-07-20 13:49 ` [PATCH 1/4] ath11k: Fix double free issue during SRNG deinit Manikanta Pubbisetty
2022-07-20 13:49   ` Manikanta Pubbisetty
2022-07-20 13:49 ` [PATCH 2/4] ath11k: Move hardware initialization logic to start() Manikanta Pubbisetty
2022-07-20 13:49   ` Manikanta Pubbisetty
2022-07-20 13:49 ` [PATCH 3/4] ath11k: Enable low power mode when WLAN is not active Manikanta Pubbisetty
2022-07-20 13:49   ` Manikanta Pubbisetty
2022-07-20 13:49 ` [PATCH 4/4] ath11k: Fix failed to parse regulatory event print Manikanta Pubbisetty
2022-07-20 13:49   ` Manikanta Pubbisetty
2022-07-22 22:00 ` [PATCH 0/4] ath11k: Enable low power mode when WLAN is not active Limonciello, Mario
2022-07-22 22:00   ` Limonciello, Mario
2022-07-23 12:09   ` Limonciello, Mario
2022-07-23 12:09     ` Limonciello, Mario
2022-08-25 11:24     ` Manikanta Pubbisetty
2022-08-25 11:24       ` Manikanta Pubbisetty
2022-08-25 17:16       ` Limonciello, Mario
2022-08-25 17:16         ` Limonciello, Mario
2022-08-25 21:01         ` Mark Herbert
2022-08-25 21:01           ` Mark Herbert
2022-08-29  5:30           ` Manikanta Pubbisetty
2022-08-29  5:30             ` Manikanta Pubbisetty
2022-08-29  6:27             ` Mark Herbert
2022-08-29  6:27               ` Mark Herbert
2022-08-29  5:28         ` Manikanta Pubbisetty
2022-08-29  5:28           ` Manikanta Pubbisetty

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.