[PATCH 41/65] staging: wfx: with multiple vifs, force PS only if channels differs
From: JÃrÃme Pouiller
Date: Wed Jan 15 2020 - 07:15:33 EST
From: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>
When multiple vif are in use (the only supported configuration is one
station and one AP), the driver force power save flag on station.
This behavior allows the station to leave the station channel and make
its business on AP channel.
However, this has a big impact on station performances (especially since
only legacy PS is supported).
When both vifs use the same channel, it is not necessary to keep this
restriction. This greatly improve station performances.
Signed-off-by: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>
---
drivers/staging/wfx/sta.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index 94683a1440c8..bf285389c303 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -251,6 +251,7 @@ static int wfx_update_pm(struct wfx_vif *wvif)
struct ieee80211_conf *conf = &wvif->wdev->hw->conf;
bool ps = conf->flags & IEEE80211_CONF_PS;
int ps_timeout = conf->dynamic_ps_timeout;
+ struct ieee80211_channel *chan0 = NULL, *chan1 = NULL;
WARN_ON(conf->dynamic_ps_timeout < 0);
if (wvif->state != WFX_STATE_STA || !wvif->bss_params.aid)
@@ -260,10 +261,15 @@ static int wfx_update_pm(struct wfx_vif *wvif)
if (wvif->uapsd_mask)
ps_timeout = 0;
- // Kernel disable PowerSave when multiple vifs are in use. In contrary,
- // it is absolutly necessary to enable PowerSave for WF200
- // FIXME: only if channel vif0 != channel vif1
- if (wvif_count(wvif->wdev) > 1) {
+ // 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.
+ 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;
ps_timeout = 0;
}
--
2.25.0