summaryrefslogtreecommitdiff
path: root/drivers/staging/wfx
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2020-05-26 19:18:17 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-27 10:18:09 +0200
commit398999dabc8cfc51c7274639cb87e2a316138859 (patch)
tree24d095fd60df69a9910177ebdd71787fbb7f81fc /drivers/staging/wfx
parent9a9cd090e996f80ec9edbd8ea58192f25e21ec74 (diff)
staging: wfx: split wfx_get_ps_timeout() from wfx_update_pm()
In the next commit, we will have to compute the PS timeout without changing the power save status of the device. This patch introduces wfx_get_ps_timeout() for that job and make wfx_update_pm() relies on it. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200526171821.934581-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx')
-rw-r--r--drivers/staging/wfx/sta.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index d0ab0b8dc404..12e8a5b638f1 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -200,36 +200,49 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
mutex_unlock(&wdev->conf_mutex);
}
-static int wfx_update_pm(struct wfx_vif *wvif)
+int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
{
- struct ieee80211_conf *conf = &wvif->wdev->hw->conf;
- bool ps = wvif->vif->bss_conf.ps;
- int ps_timeout = conf->dynamic_ps_timeout;
struct ieee80211_channel *chan0 = NULL, *chan1 = NULL;
+ struct ieee80211_conf *conf = &wvif->wdev->hw->conf;
- WARN_ON(conf->dynamic_ps_timeout < 0);
- if (!wvif->vif->bss_conf.assoc)
- return 0;
- if (!ps)
- ps_timeout = 0;
- if (wvif->uapsd_mask)
- ps_timeout = 0;
-
- // Kernel disable powersave when an AP is in use. In contrary, it is
- // absolutely necessary to enable legacy powersave for WF200 if channels
- // are differents.
+ WARN(!wvif->vif->bss_conf.assoc && enable_ps,
+ "enable_ps is reliable only if associated");
if (wdev_to_wvif(wvif->wdev, 0))
chan0 = wdev_to_wvif(wvif->wdev, 0)->vif->bss_conf.chandef.chan;
if (wdev_to_wvif(wvif->wdev, 1))
chan1 = wdev_to_wvif(wvif->wdev, 1)->vif->bss_conf.chandef.chan;
if (chan0 && chan1 && chan0->hw_value != chan1->hw_value &&
wvif->vif->type != NL80211_IFTYPE_AP) {
- ps = true;
+ // It is necessary to enable powersave if channels
+ // are differents.
+ if (enable_ps)
+ *enable_ps = true;
if (wvif->bss_not_support_ps_poll)
- ps_timeout = 30;
+ return 30;
else
- ps_timeout = 0;
+ return 0;
}
+ if (enable_ps)
+ *enable_ps = wvif->vif->bss_conf.ps;
+ if (wvif->vif->bss_conf.assoc && wvif->vif->bss_conf.ps)
+ return conf->dynamic_ps_timeout;
+ else
+ return -1;
+}
+
+int wfx_update_pm(struct wfx_vif *wvif)
+{
+ int ps_timeout;
+ bool ps;
+
+ if (!wvif->vif->bss_conf.assoc)
+ return 0;
+ ps_timeout = wfx_get_ps_timeout(wvif, &ps);
+ if (!ps)
+ ps_timeout = 0;
+ WARN_ON(ps_timeout < 0);
+ if (wvif->uapsd_mask)
+ ps_timeout = 0;
if (!wait_for_completion_timeout(&wvif->set_pm_mode_complete,
TU_TO_JIFFIES(512)))