All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wcn36xx: Fix dynamic power saving
@ 2017-12-08 16:34 ` Loic Poulain
  0 siblings, 0 replies; 5+ messages in thread
From: Loic Poulain @ 2017-12-08 16:34 UTC (permalink / raw)
  To: kvalo
  Cc: wcn36xx, linux-wireless, linux-arm-msm, nicolas.dechesne,
	k.eugene.e, Loic Poulain

Since driver does not report hardware dynamic power saving cap,
this is up to the mac80211 to manage power saving timeout and
state machine, using the ieee80211 config callback to report
PS changes. This patch enables/disables PS mode according to
the new configuration.

Remove old behaviour enabling PS mode in a static way, this make
the device unusable when power save is enabled since device is
forced to PS regardless RX/TX traffic.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index f0b4d43..436b8ea 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 		}
 	}
 
+	if (changed & IEEE80211_CONF_CHANGE_PS) {
+		list_for_each_entry(tmp, &wcn->vif_list, list) {
+			vif = wcn36xx_priv_to_vif(tmp);
+			if (hw->conf.flags & IEEE80211_CONF_PS) {
+				if (vif->bss_conf.ps) /* ps allowed ? */
+					wcn36xx_pmc_enter_bmps_state(wcn, vif);
+			} else {
+				wcn36xx_pmc_exit_bmps_state(wcn, vif);
+			}
+		}
+	}
+
 	mutex_unlock(&wcn->conf_mutex);
 
 	return 0;
@@ -747,17 +759,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 		vif_priv->dtim_period = bss_conf->dtim_period;
 	}
 
-	if (changed & BSS_CHANGED_PS) {
-		wcn36xx_dbg(WCN36XX_DBG_MAC,
-			    "mac bss PS set %d\n",
-			    bss_conf->ps);
-		if (bss_conf->ps) {
-			wcn36xx_pmc_enter_bmps_state(wcn, vif);
-		} else {
-			wcn36xx_pmc_exit_bmps_state(wcn, vif);
-		}
-	}
-
 	if (changed & BSS_CHANGED_BSSID) {
 		wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n",
 			    bss_conf->bssid);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] wcn36xx: Fix dynamic power saving
@ 2017-12-08 16:34 ` Loic Poulain
  0 siblings, 0 replies; 5+ messages in thread
From: Loic Poulain @ 2017-12-08 16:34 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: wcn36xx-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	nicolas.dechesne-QSEj5FYQhm4dnm+yROfE0A,
	k.eugene.e-Re5JQEeQqe8AvxtiuMwx3w, Loic Poulain

Since driver does not report hardware dynamic power saving cap,
this is up to the mac80211 to manage power saving timeout and
state machine, using the ieee80211 config callback to report
PS changes. This patch enables/disables PS mode according to
the new configuration.

Remove old behaviour enabling PS mode in a static way, this make
the device unusable when power save is enabled since device is
forced to PS regardless RX/TX traffic.

Signed-off-by: Loic Poulain <loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index f0b4d43..436b8ea 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 		}
 	}
 
+	if (changed & IEEE80211_CONF_CHANGE_PS) {
+		list_for_each_entry(tmp, &wcn->vif_list, list) {
+			vif = wcn36xx_priv_to_vif(tmp);
+			if (hw->conf.flags & IEEE80211_CONF_PS) {
+				if (vif->bss_conf.ps) /* ps allowed ? */
+					wcn36xx_pmc_enter_bmps_state(wcn, vif);
+			} else {
+				wcn36xx_pmc_exit_bmps_state(wcn, vif);
+			}
+		}
+	}
+
 	mutex_unlock(&wcn->conf_mutex);
 
 	return 0;
@@ -747,17 +759,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 		vif_priv->dtim_period = bss_conf->dtim_period;
 	}
 
-	if (changed & BSS_CHANGED_PS) {
-		wcn36xx_dbg(WCN36XX_DBG_MAC,
-			    "mac bss PS set %d\n",
-			    bss_conf->ps);
-		if (bss_conf->ps) {
-			wcn36xx_pmc_enter_bmps_state(wcn, vif);
-		} else {
-			wcn36xx_pmc_exit_bmps_state(wcn, vif);
-		}
-	}

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] wcn36xx: Fix dynamic power saving
@ 2017-12-09  0:45   ` Bjorn Andersson
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2017-12-09  0:45 UTC (permalink / raw)
  To: Loic Poulain
  Cc: kvalo, wcn36xx, linux-wireless, linux-arm-msm, nicolas.dechesne,
	k.eugene.e

On Fri 08 Dec 08:34 PST 2017, Loic Poulain wrote:

> Since driver does not report hardware dynamic power saving cap,
> this is up to the mac80211 to manage power saving timeout and
> state machine, using the ieee80211 config callback to report
> PS changes. This patch enables/disables PS mode according to
> the new configuration.
> 
> Remove old behaviour enabling PS mode in a static way, this make
> the device unusable when power save is enabled since device is
> forced to PS regardless RX/TX traffic.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

With below nit.

> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index f0b4d43..436b8ea 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
>  		}
>  	}
>  
> +	if (changed & IEEE80211_CONF_CHANGE_PS) {
> +		list_for_each_entry(tmp, &wcn->vif_list, list) {
> +			vif = wcn36xx_priv_to_vif(tmp);
> +			if (hw->conf.flags & IEEE80211_CONF_PS) {
> +				if (vif->bss_conf.ps) /* ps allowed ? */
> +					wcn36xx_pmc_enter_bmps_state(wcn, vif);
> +			} else {
> +				wcn36xx_pmc_exit_bmps_state(wcn, vif);

During startup I get the error print from wcn36xx_pmc_exit_bmps_state()
that we're not in BMPS state. There's no harm in this, but the error
might concern people.

How about we in addition to this, change the wcn36xx_err() to a
wcn36xx_dbg(PMC...) ?

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] wcn36xx: Fix dynamic power saving
@ 2017-12-09  0:45   ` Bjorn Andersson
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2017-12-09  0:45 UTC (permalink / raw)
  To: Loic Poulain
  Cc: kvalo-sgV2jX0FEOL9JmXXK+q4OQ,
	wcn36xx-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	nicolas.dechesne-QSEj5FYQhm4dnm+yROfE0A,
	k.eugene.e-Re5JQEeQqe8AvxtiuMwx3w

On Fri 08 Dec 08:34 PST 2017, Loic Poulain wrote:

> Since driver does not report hardware dynamic power saving cap,
> this is up to the mac80211 to manage power saving timeout and
> state machine, using the ieee80211 config callback to report
> PS changes. This patch enables/disables PS mode according to
> the new configuration.
> 
> Remove old behaviour enabling PS mode in a static way, this make
> the device unusable when power save is enabled since device is
> forced to PS regardless RX/TX traffic.
> 
> Signed-off-by: Loic Poulain <loic.poulain-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Acked-by: Bjorn Andersson <bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

With below nit.

> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index f0b4d43..436b8ea 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
>  		}
>  	}
>  
> +	if (changed & IEEE80211_CONF_CHANGE_PS) {
> +		list_for_each_entry(tmp, &wcn->vif_list, list) {
> +			vif = wcn36xx_priv_to_vif(tmp);
> +			if (hw->conf.flags & IEEE80211_CONF_PS) {
> +				if (vif->bss_conf.ps) /* ps allowed ? */
> +					wcn36xx_pmc_enter_bmps_state(wcn, vif);
> +			} else {
> +				wcn36xx_pmc_exit_bmps_state(wcn, vif);

During startup I get the error print from wcn36xx_pmc_exit_bmps_state()
that we're not in BMPS state. There's no harm in this, but the error
might concern people.

How about we in addition to this, change the wcn36xx_err() to a
wcn36xx_dbg(PMC...) ?

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] wcn36xx: Fix dynamic power saving
  2017-12-09  0:45   ` Bjorn Andersson
  (?)
@ 2017-12-11  8:39   ` Loic Poulain
  -1 siblings, 0 replies; 5+ messages in thread
From: Loic Poulain @ 2017-12-11  8:39 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: kvalo, wcn36xx, linux-wireless, linux-arm-msm, Nicolas Dechesne,
	Eugene Krasnikov

Hi Bjorn,

On 9 December 2017 at 01:45, Bjorn Andersson <bjorn.andersson@linaro.org> wrote:
>>               }
>>       }
>>
>> +     if (changed & IEEE80211_CONF_CHANGE_PS) {
>> +             list_for_each_entry(tmp, &wcn->vif_list, list) {
>> +                     vif = wcn36xx_priv_to_vif(tmp);
>> +                     if (hw->conf.flags & IEEE80211_CONF_PS) {
>> +                             if (vif->bss_conf.ps) /* ps allowed ? */
>> +                                     wcn36xx_pmc_enter_bmps_state(wcn, vif);
>> +                     } else {
>> +                             wcn36xx_pmc_exit_bmps_state(wcn, vif);
>
> During startup I get the error print from wcn36xx_pmc_exit_bmps_state()
> that we're not in BMPS state. There's no harm in this, but the error
> might concern people.
>
> How about we in addition to this, change the wcn36xx_err() to a
> wcn36xx_dbg(PMC...) ?

Thanks for reporting this, I assume mac80211 disable PS mode before enabling it
on timeout... It makes sense to avoid this error msg since balancing
is well managed
by this driver.

Regards,
Loic

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-11  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-08 16:34 [PATCH] wcn36xx: Fix dynamic power saving Loic Poulain
2017-12-08 16:34 ` Loic Poulain
2017-12-09  0:45 ` Bjorn Andersson
2017-12-09  0:45   ` Bjorn Andersson
2017-12-11  8:39   ` Loic Poulain

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.