Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx> 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@xxxxxxxxxx> > --- > 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