All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Baochen Qiang <quic_bqiang@quicinc.com>
Cc: <ath12k@lists.infradead.org>,  <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v4 2/8] wifi: ath12k: implement WoW enable and wakeup commands
Date: Mon, 17 Jun 2024 16:43:23 +0300	[thread overview]
Message-ID: <87msnjn0qs.fsf@kernel.org> (raw)
In-Reply-To: <20240604055407.12506-3-quic_bqiang@quicinc.com> (Baochen Qiang's message of "Tue, 4 Jun 2024 13:54:01 +0800")

Baochen Qiang <quic_bqiang@quicinc.com> writes:

> Implement WoW enable and WoW wakeup commands which are needed
> for suspend/resume.
>
> Tested-on: WCN7850 hw2.0 PCI
> WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
>
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>

[...]

> +int ath12k_wow_enable(struct ath12k *ar)
> +{
> +	struct ath12k_base *ab = ar->ab;
> +	int i, ret;
> +
> +	clear_bit(ATH12K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags);
> +
> +	for (i = 0; i < ATH12K_WOW_RETRY_NUM; i++) {
> +		reinit_completion(&ab->htc_suspend);
> +
> +		ret = ath12k_wmi_wow_enable(ar);
> +		if (ret) {
> +			ath12k_warn(ab, "failed to issue wow enable: %d\n", ret);
> +			return ret;
> +		}
> +
> +		ret = wait_for_completion_timeout(&ab->htc_suspend, 3 * HZ);
> +		if (ret == 0) {
> +			ath12k_warn(ab,
> +				    "timed out while waiting for htc suspend completion\n");
> +			return -ETIMEDOUT;
> +		}
> +
> +		if (test_bit(ATH12K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags))
> +			/* success, suspend complete received */
> +			return 0;
> +
> +		ath12k_warn(ab, "htc suspend not complete, retrying (try %d)\n",
> +			    i);
> +		msleep(ATH12K_WOW_RETRY_WAIT_MS);
> +	}
> +
> +	ath12k_warn(ab, "htc suspend not complete, failing after %d tries\n", i);
> +
> +	return -ETIMEDOUT;
> +}

Why the loop here? Looks really odd to me and no explanation why it's
needed. ATH12K_WOW_RETRY_NUM seems to be 10 so this can loop a lot.

ath11k seems to have a similar loop and no comments there either. I
clearly missed that in review.

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

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


  reply	other threads:[~2024-06-17 13:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04  5:53 [PATCH v4 0/8] wifi: ath12k: add support for WoW Baochen Qiang
2024-06-04  5:54 ` [PATCH v4 1/8] wifi: ath12k: add ATH12K_DBG_WOW log level Baochen Qiang
2024-06-24 16:32   ` Kalle Valo
2024-06-04  5:54 ` [PATCH v4 2/8] wifi: ath12k: implement WoW enable and wakeup commands Baochen Qiang
2024-06-17 13:43   ` Kalle Valo [this message]
2024-06-18  5:49     ` Baochen Qiang
2024-06-20  9:07       ` Kalle Valo
2024-06-04  5:54 ` [PATCH v4 3/8] wifi: ath12k: add basic WoW functionalities Baochen Qiang
2024-06-04  5:54 ` [PATCH v4 4/8] wifi: ath12k: add WoW net-detect functionality Baochen Qiang
2024-06-04  5:54 ` [PATCH v4 5/8] wifi: ath12k: implement hardware data filter Baochen Qiang
2024-06-04  5:54 ` [PATCH v4 6/8] wifi: ath12k: support ARP and NS offload Baochen Qiang
2024-06-04 14:57   ` Jeff Johnson
2024-06-04  5:54 ` [PATCH v4 7/8] wifi: ath12k: support GTK rekey offload Baochen Qiang
2024-06-04 14:57   ` Jeff Johnson
2024-06-04  5:54 ` [PATCH v4 8/8] wifi: ath12k: handle keepalive during WoWLAN suspend and resume Baochen Qiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msnjn0qs.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=ath12k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_bqiang@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.