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: Thu, 20 Jun 2024 12:07:53 +0300 [thread overview]
Message-ID: <87plscj82e.fsf@kernel.org> (raw)
In-Reply-To: <f66c2719-f413-4348-8440-97a169430043@quicinc.com> (Baochen Qiang's message of "Tue, 18 Jun 2024 13:49:30 +0800")
Baochen Qiang <quic_bqiang@quicinc.com> writes:
>>> +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.
>
> Host asks firmware to enter WoW mode using a WMI command. While
> receiving it, firmware might be busy so that can not enter WoW
> immediately. In that case firmware notifies host of
> ATH12K_HTC_MSG_NACK_SUSPEND message, asking host to try again later.
> Per firmware team there could be up to 10 loops.
Not really a good firmware interface, oh well. I added a comment to
ath12k_wow_enable() explaining, thanks.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2024-06-20 9:08 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
2024-06-18 5:49 ` Baochen Qiang
2024-06-20 9:07 ` Kalle Valo [this message]
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=87plscj82e.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.