All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] wcn36xx: Fixup BMPS
@ 2021-10-22 14:04 Bryan O'Donoghue
  2021-10-22 14:04 ` [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss Bryan O'Donoghue
  2021-10-22 14:04 ` [PATCH 2/2] Revert "wcn36xx: Disable bmps when encryption is disabled" Bryan O'Donoghue
  0 siblings, 2 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2021-10-22 14:04 UTC (permalink / raw)
  To: kvalo, linux-wireless, wcn36xx
  Cc: loic.poulain, benl, daniel.thompson, bryan.odonoghue

This is a fairly simple set of fixes for BMPS. In the first instance
treating a series of BMPS entry fails as a connection loss. Three
consecutive entry failures are treated a loss-of-signal.

The second is a revert of a disable of BMPS for Open APs. We are finding
that with our latest kernels no longer suffer from this bug.

Bryan O'Donoghue (2):
  wcn36xx: Treat repeated BMPS entry fail as connection loss
  Revert "wcn36xx: Disable bmps when encryption is disabled"

 drivers/net/wireless/ath/wcn36xx/main.c    | 10 ----------
 drivers/net/wireless/ath/wcn36xx/pmc.c     | 14 ++++++++++----
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  3 ++-
 3 files changed, 12 insertions(+), 15 deletions(-)

-- 
2.33.0


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

* [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss
  2021-10-22 14:04 [PATCH 0/2] wcn36xx: Fixup BMPS Bryan O'Donoghue
@ 2021-10-22 14:04 ` Bryan O'Donoghue
  2021-10-25 13:41   ` Kalle Valo
  2021-10-27  7:43   ` Kalle Valo
  2021-10-22 14:04 ` [PATCH 2/2] Revert "wcn36xx: Disable bmps when encryption is disabled" Bryan O'Donoghue
  1 sibling, 2 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2021-10-22 14:04 UTC (permalink / raw)
  To: kvalo, linux-wireless, wcn36xx
  Cc: loic.poulain, benl, daniel.thompson, bryan.odonoghue

On an open AP when you pull the plug on the AP, if we are not already in
BMPS mode then the firmware will not generate a disconnection event.

Instead we need to monitor for failure to enter BMPS and treat a string of
failures as connection loss.

Secure AP connections don't appear to demonstrate this behavior so the
work-around is limited to open APs only.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/pmc.c     | 9 +++++++++
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/ath/wcn36xx/pmc.c
index 2d0780fefd477..592a9416e51f9 100644
--- a/drivers/net/wireless/ath/wcn36xx/pmc.c
+++ b/drivers/net/wireless/ath/wcn36xx/pmc.c
@@ -18,6 +18,8 @@
 
 #include "wcn36xx.h"
 
+#define WCN36XX_BMPS_FAIL_THREHOLD 3
+
 int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
 				 struct ieee80211_vif *vif)
 {
@@ -31,6 +33,7 @@ int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
 	if (!ret) {
 		wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
 		vif_priv->pw_state = WCN36XX_BMPS;
+		vif_priv->bmps_fail_ct = 0;
 		vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
 	} else {
 		/*
@@ -39,6 +42,12 @@ int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
 		 * received just after auth complete
 		 */
 		wcn36xx_err("Can not enter BMPS!\n");
+
+		if (vif_priv->bmps_fail_ct++ == WCN36XX_BMPS_FAIL_THREHOLD) {
+			wcn36xx_err("BMPS fail exceeded connection loss\n");
+			ieee80211_connection_loss(vif);
+			vif_priv->bmps_fail_ct = 0;
+		}
 	}
 	return ret;
 }
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 9469feed1475f..871aab7fd4e60 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -151,6 +151,8 @@ struct wcn36xx_vif {
 	} rekey_data;
 
 	struct list_head sta_list;
+
+	int bmps_fail_ct;
 };
 
 /**
-- 
2.33.0


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

* [PATCH 2/2] Revert "wcn36xx: Disable bmps when encryption is disabled"
  2021-10-22 14:04 [PATCH 0/2] wcn36xx: Fixup BMPS Bryan O'Donoghue
  2021-10-22 14:04 ` [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss Bryan O'Donoghue
@ 2021-10-22 14:04 ` Bryan O'Donoghue
  1 sibling, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2021-10-22 14:04 UTC (permalink / raw)
  To: kvalo, linux-wireless, wcn36xx
  Cc: loic.poulain, benl, daniel.thompson, bryan.odonoghue

This reverts commit c6522a5076e1a65877c51cfee313a74ef61cabf8.

Testing on tip-of-tree shows that this is working now. Revert this and
re-enable BMPS for Open APs.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c    | 10 ----------
 drivers/net/wireless/ath/wcn36xx/pmc.c     |  5 +----
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 -
 3 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index fbfa9947c4a5b..ad75e6faa3bae 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -630,15 +630,6 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 				}
 			}
 		}
-		/* FIXME: Only enable bmps support when encryption is enabled.
-		 * For any reasons, when connected to open/no-security BSS,
-		 * the wcn36xx controller in bmps mode does not forward
-		 * 'wake-up' beacons despite AP sends DTIM with station AID.
-		 * It could be due to a firmware issue or to the way driver
-		 * configure the station.
-		 */
-		if (vif->type == NL80211_IFTYPE_STATION)
-			vif_priv->allow_bmps = true;
 		break;
 	case DISABLE_KEY:
 		if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
@@ -966,7 +957,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 				    vif->addr,
 				    bss_conf->aid);
 			vif_priv->sta_assoc = false;
-			vif_priv->allow_bmps = false;
 			wcn36xx_smd_set_link_st(wcn,
 						bss_conf->bssid,
 						vif->addr,
diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/ath/wcn36xx/pmc.c
index 592a9416e51f9..d8119241b2fe8 100644
--- a/drivers/net/wireless/ath/wcn36xx/pmc.c
+++ b/drivers/net/wireless/ath/wcn36xx/pmc.c
@@ -25,10 +25,7 @@ int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
 {
 	int ret = 0;
 	struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
-
-	if (!vif_priv->allow_bmps)
-		return -ENOTSUPP;
-
+	/* TODO: Make sure the TX chain clean */
 	ret = wcn36xx_smd_enter_bmps(wcn, vif);
 	if (!ret) {
 		wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 871aab7fd4e60..8111488fed7bf 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -128,7 +128,6 @@ struct wcn36xx_vif {
 	enum wcn36xx_hal_bss_type bss_type;
 
 	/* Power management */
-	bool allow_bmps;
 	enum wcn36xx_power_state pw_state;
 
 	u8 bss_index;
-- 
2.33.0


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

* Re: [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss
  2021-10-22 14:04 ` [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss Bryan O'Donoghue
@ 2021-10-25 13:41   ` Kalle Valo
  2021-10-27  7:43   ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2021-10-25 13:41 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: linux-wireless, wcn36xx, loic.poulain, benl, daniel.thompson

Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:

> On an open AP when you pull the plug on the AP, if we are not already in
> BMPS mode then the firmware will not generate a disconnection event.
>
> Instead we need to monitor for failure to enter BMPS and treat a string of
> failures as connection loss.
>
> Secure AP connections don't appear to demonstrate this behavior so the
> work-around is limited to open APs only.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/net/wireless/ath/wcn36xx/pmc.c     | 9 +++++++++
>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 ++
>  2 files changed, 11 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/ath/wcn36xx/pmc.c
> index 2d0780fefd477..592a9416e51f9 100644
> --- a/drivers/net/wireless/ath/wcn36xx/pmc.c
> +++ b/drivers/net/wireless/ath/wcn36xx/pmc.c
> @@ -18,6 +18,8 @@
>  
>  #include "wcn36xx.h"
>  
> +#define WCN36XX_BMPS_FAIL_THREHOLD 3
> +
>  int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
>  				 struct ieee80211_vif *vif)
>  {
> @@ -31,6 +33,7 @@ int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
>  	if (!ret) {
>  		wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
>  		vif_priv->pw_state = WCN36XX_BMPS;
> +		vif_priv->bmps_fail_ct = 0;
>  		vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
>  	} else {
>  		/*
> @@ -39,6 +42,12 @@ int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
>  		 * received just after auth complete
>  		 */
>  		wcn36xx_err("Can not enter BMPS!\n");
> +
> +		if (vif_priv->bmps_fail_ct++ == WCN36XX_BMPS_FAIL_THREHOLD) {
> +			wcn36xx_err("BMPS fail exceeded connection loss\n");
> +			ieee80211_connection_loss(vif);

We shouldn't spam the kernel log when a connection to AP is lost, that's
a normal situation with wireless networks. So I removed the
wcn36xx_err() call in the pending branch.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss
  2021-10-22 14:04 ` [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss Bryan O'Donoghue
  2021-10-25 13:41   ` Kalle Valo
@ 2021-10-27  7:43   ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2021-10-27  7:43 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: linux-wireless, wcn36xx, loic.poulain, benl, daniel.thompson,
	bryan.odonoghue

Bryan O'Donoghue <bryan.odonoghue@linaro.org> wrote:

> On an open AP when you pull the plug on the AP, if we are not already in
> BMPS mode then the firmware will not generate a disconnection event.
> 
> Instead we need to monitor for failure to enter BMPS and treat a string of
> failures as connection loss.
> 
> Secure AP connections don't appear to demonstrate this behavior so the
> work-around is limited to open APs only.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

2 patches applied to ath-next branch of ath.git, thanks.

2f1ae32f736d wcn36xx: Treat repeated BMPS entry fail as connection loss
285bb1738e19 Revert "wcn36xx: Disable bmps when encryption is disabled"

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20211022140447.2846248-2-bryan.odonoghue@linaro.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2021-10-27  7:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 14:04 [PATCH 0/2] wcn36xx: Fixup BMPS Bryan O'Donoghue
2021-10-22 14:04 ` [PATCH 1/2] wcn36xx: Treat repeated BMPS entry fail as connection loss Bryan O'Donoghue
2021-10-25 13:41   ` Kalle Valo
2021-10-27  7:43   ` Kalle Valo
2021-10-22 14:04 ` [PATCH 2/2] Revert "wcn36xx: Disable bmps when encryption is disabled" Bryan O'Donoghue

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.