2021-10-11 13:43:00

by Carl Huang

[permalink] [raw]
Subject: [PATCH 4/6] ath11k: purge rx pktlog when entering WoW

This change is to purge rx pktlog when entering WoW and reap
the mon_status buffer to keep it empty. When leaving WoW, host
restarts the reap timer. In WoW state, it's not allowed to feed
into mon_status rings per firmware request.

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1

Signed-off-by: Carl Huang <[email protected]>
---
drivers/net/wireless/ath/ath11k/core.c | 7 +------
drivers/net/wireless/ath/ath11k/dp_rx.c | 4 +---
drivers/net/wireless/ath/ath11k/dp_rx.h | 2 +-
drivers/net/wireless/ath/ath11k/wow.c | 19 +++++++++++++++++++
4 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index e67136b..9747659 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -327,12 +327,7 @@ int ath11k_core_resume(struct ath11k_base *ab)
ath11k_hif_ce_irq_enable(ab);
ath11k_hif_irq_enable(ab);

- ret = ath11k_dp_rx_pktlog_start(ab);
- if (ret) {
- ath11k_warn(ab, "failed to start rx pktlog during resume: %d\n",
- ret);
- return ret;
- }
+ ath11k_dp_rx_pktlog_start(ab);

ret = ath11k_wow_wakeup(ab);
if (ret) {
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 6d769ba..ae6db5d 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -5105,13 +5105,11 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar)
return 0;
}

-int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab)
+void ath11k_dp_rx_pktlog_start(struct ath11k_base *ab)
{
/* start reap timer */
mod_timer(&ab->mon_reap_timer,
jiffies + msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));
-
- return 0;
}

int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer)
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.h b/drivers/net/wireless/ath/ath11k/dp_rx.h
index 623da3b..2e63f2f 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.h
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.h
@@ -92,7 +92,7 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar);
int ath11k_dp_rx_pdev_mon_attach(struct ath11k *ar);
int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id);

-int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab);
+void ath11k_dp_rx_pktlog_start(struct ath11k_base *ab);
int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer);

#endif /* ATH11K_DP_RX_H */
diff --git a/drivers/net/wireless/ath/ath11k/wow.c b/drivers/net/wireless/ath/ath11k/wow.c
index 35f1c5c..8bd2ca2 100644
--- a/drivers/net/wireless/ath/ath11k/wow.c
+++ b/drivers/net/wireless/ath/ath11k/wow.c
@@ -13,6 +13,7 @@
#include "debug.h"
#include "wmi.h"
#include "wow.h"
+#include "dp_rx.h"

static const struct wiphy_wowlan_support ath11k_wowlan_support = {
.flags = WIPHY_WOWLAN_DISCONNECT |
@@ -557,6 +558,14 @@ int ath11k_wow_op_suspend(struct ieee80211_hw *hw,

mutex_lock(&ar->conf_mutex);

+ ret = ath11k_dp_rx_pktlog_stop(ar->ab, true);
+ if (ret) {
+ ath11k_warn(ar->ab,
+ "failed to stop dp rx (and timer) pktlog during wow suspend: %d\n",
+ ret);
+ goto exit;
+ }
+
ret = ath11k_wow_cleanup(ar);
if (ret) {
ath11k_warn(ar->ab, "failed to clear wow wakeup events: %d\n",
@@ -590,6 +599,14 @@ int ath11k_wow_op_suspend(struct ieee80211_hw *hw,
goto cleanup;
}

+ ret = ath11k_dp_rx_pktlog_stop(ar->ab, false);
+ if (ret) {
+ ath11k_warn(ar->ab,
+ "failed to stop dp rx pktlog during wow suspend: %d\n",
+ ret);
+ goto cleanup;
+ }
+
ath11k_ce_stop_shadow_timers(ar->ab);
ath11k_dp_stop_shadow_timers(ar->ab);

@@ -640,6 +657,8 @@ int ath11k_wow_op_resume(struct ieee80211_hw *hw)
ath11k_hif_ce_irq_enable(ar->ab);
ath11k_hif_irq_enable(ar->ab);

+ ath11k_dp_rx_pktlog_start(ar->ab);
+
ret = ath11k_wow_wakeup(ar->ab);
if (ret) {
ath11k_warn(ar->ab, "failed to wakeup from wow: %d\n", ret);
--
2.7.4


2021-12-09 15:12:48

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 4/6] ath11k: purge rx pktlog when entering WoW

Carl Huang <[email protected]> writes:

> This change is to purge rx pktlog when entering WoW and reap
> the mon_status buffer to keep it empty. When leaving WoW, host
> restarts the reap timer. In WoW state, it's not allowed to feed
> into mon_status rings per firmware request.

"per firmware request" is not clear for me. Do you "per firmware team's
recommendation" or what?

> @@ -327,12 +327,7 @@ int ath11k_core_resume(struct ath11k_base *ab)
> ath11k_hif_ce_irq_enable(ab);
> ath11k_hif_irq_enable(ab);
>
> - ret = ath11k_dp_rx_pktlog_start(ab);
> - if (ret) {
> - ath11k_warn(ab, "failed to start rx pktlog during resume: %d\n",
> - ret);
> - return ret;
> - }
> + ath11k_dp_rx_pktlog_start(ab);

Why remove error handling? We should always handle the errors.

>
> ret = ath11k_wow_wakeup(ab);
> if (ret) {
> diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
> index 6d769ba..ae6db5d 100644
> --- a/drivers/net/wireless/ath/ath11k/dp_rx.c
> +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
> @@ -5105,13 +5105,11 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar)
> return 0;
> }
>
> -int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab)
> +void ath11k_dp_rx_pktlog_start(struct ath11k_base *ab)
> {
> /* start reap timer */
> mod_timer(&ab->mon_reap_timer,
> jiffies + msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));
> -
> - return 0;
> }

Ah, you remove it here as well. But for consistency it's better to have
this return an error code.

> @@ -640,6 +657,8 @@ int ath11k_wow_op_resume(struct ieee80211_hw *hw)
> ath11k_hif_ce_irq_enable(ar->ab);
> ath11k_hif_irq_enable(ar->ab);
>
> + ath11k_dp_rx_pktlog_start(ar->ab);

Error handling here as well, please.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches