linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@linaro.org>
To: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org,
	Shawn Guo <shawn.guo@linaro.org>, Benjamin Li <benl@squareup.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: Re: [PATCH v3 02/12] wcn36xx: Run suspend for the first ieee80211_vif
Date: Fri, 19 Mar 2021 17:57:51 +0100	[thread overview]
Message-ID: <CAMZdPi8ahq61qOxyjci4KyMANGxSt2oey2y1U=NNOKs1Mu+sPw@mail.gmail.com> (raw)
In-Reply-To: <20210319161520.3590510-3-bryan.odonoghue@linaro.org>

On Fri, 19 Mar 2021 at 17:13, Bryan O'Donoghue
<bryan.odonoghue@linaro.org> wrote:
>
> A subsequent set of patches will extend out suspend/resume support in this
> driver, we cannot set the firmware up for multiple ipv4/ipv6 addresses and
> as such we can't iterate through a list of ieee80211_vif.

You mean connection can only be maintained (offloaded) in suspend for
only one vif? If so maybe what you want to retrieve is the first
client-associated vif and not the first vif.

>
> Constrain the interaction with the firmware to the first ieee80211_vif on
> the suspend/resume/wowlan path.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 43 +++++++++++++++++++++++--
>  1 file changed, 40 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index b361e40697a6..c0c1ea18864f 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1088,15 +1088,39 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
>
>  #ifdef CONFIG_PM
>
> +struct ieee80211_vif *wcn36xx_get_first_vif(struct wcn36xx *wcn)
> +{
> +       struct wcn36xx_vif *tmp;
> +       struct ieee80211_vif *vif = NULL;
> +
> +       list_for_each_entry(tmp, &wcn->vif_list, list) {
> +               vif = wcn36xx_priv_to_vif(tmp);
> +               if (vif)
> +                       break;
> +       }
> +       return vif;
> +}
> +
>  static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
>  {
>         struct wcn36xx *wcn = hw->priv;
> -       int ret;
> +       struct ieee80211_vif *vif = NULL;
> +       struct wcn36xx_vif *vif_priv = NULL;
> +       int ret = 0;
>
>         wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n");
>
>         flush_workqueue(wcn->hal_ind_wq);
> -       ret = wcn36xx_smd_set_power_params(wcn, true);
> +       mutex_lock(&wcn->conf_mutex);
> +       vif = wcn36xx_get_first_vif(wcn);
> +       if (vif) {
> +               vif_priv = wcn36xx_vif_to_priv(vif);
> +               if (!vif_priv->sta_assoc)
> +                       goto out;
> +               ret = wcn36xx_smd_set_power_params(wcn, true);
> +       }
> +out:
> +       mutex_unlock(&wcn->conf_mutex);
>
>         return ret;
>  }
> @@ -1104,11 +1128,24 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
>  static int wcn36xx_resume(struct ieee80211_hw *hw)
>  {
>         struct wcn36xx *wcn = hw->priv;
> +       struct ieee80211_vif *vif = NULL;
> +       struct wcn36xx_vif *vif_priv = NULL;
>
>         wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n");
>
>         flush_workqueue(wcn->hal_ind_wq);
> -       wcn36xx_smd_set_power_params(wcn, false);
> +       mutex_lock(&wcn->conf_mutex);
> +       vif = wcn36xx_get_first_vif(wcn);
> +       if (vif) {
> +               vif_priv = wcn36xx_vif_to_priv(vif);
> +               if (!vif_priv->sta_assoc)
> +                       goto out;
> +
> +               wcn36xx_smd_set_power_params(wcn, false);
> +       }
> +out:
> +       mutex_unlock(&wcn->conf_mutex);
> +
>         return 0;
>  }
>
> --
> 2.30.1
>

  reply	other threads:[~2021-03-19 16:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 16:15 [PATCH v3 00/12] wcn36xx: Enable downstream consistent Wake on Lan Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 01/12] wcn36xx: Return result of set_power_params in suspend Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 02/12] wcn36xx: Run suspend for the first ieee80211_vif Bryan O'Donoghue
2021-03-19 16:57   ` Loic Poulain [this message]
2021-03-20 12:40     ` Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 03/12] wcn36xx: Add ipv4 ARP offload support in suspend Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 04/12] wcn36xx: Do not flush indication queue on suspend/resume Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 05/12] wcn36xx: Add ipv6 address tracking Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 06/12] wcn36xx: Add ipv6 namespace offload in suspend Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 07/12] wcn36xx: Add set_rekey_data callback Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 08/12] wcn36xx: Add GTK offload to WoWLAN path Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 09/12] wcn36xx: Add GTK offload info to WoWLAN resume Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 10/12] wcn36xx: Add Host suspend indication support Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 11/12] wcn36xx: Add host resume request support Bryan O'Donoghue
2021-03-19 16:15 ` [PATCH v3 12/12] wcn36xx: Enable WOWLAN flags Bryan O'Donoghue
2021-03-25 19:52 ` [PATCH v3 00/12] wcn36xx: Enable downstream consistent Wake on Lan Benjamin Li
2021-03-26  1:46   ` Bryan O'Donoghue

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='CAMZdPi8ahq61qOxyjci4KyMANGxSt2oey2y1U=NNOKs1Mu+sPw@mail.gmail.com' \
    --to=loic.poulain@linaro.org \
    --cc=benl@squareup.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=wcn36xx@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).