Thread (17 messages) 17 messages, 3 authors, 2021-03-26

Re: [PATCH v3 02/12] wcn36xx: Run suspend for the first ieee80211_vif

From: Loic Poulain <hidden>
Date: 2021-03-19 16:50:51

On Fri, 19 Mar 2021 at 17:13, Bryan O'Donoghue
[off-list ref] 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.
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help