diff mbox

[RFC] brcmfmac: shutdown interfaces on PSM's watchdog fire

Message ID 20170224172423.10980-1-zajec5@gmail.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show

Commit Message

Rafał Miłecki Feb. 24, 2017, 5:24 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

When PSM's watchdog fires hardware / firmware is not operational. It
seems there isn't a way to restart firmware & reapply all settings so
instead shut all interfaces down. This is at least some signal for the
user things went wrong and allows reacting to it.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
This patch is RFC as I'm wondering if there is any other way to handle
such errors. I couldn't find anything except for that
cfg80211_shutdown_all_interfaces.

Unfortunately hostapd doesn't seem to react to this except for sth like:
Fri Feb 24 13:41:07 2017 daemon.notice hostapd: wlan0: INTERFACE-DISABLED

Shall we introduce some nl80211 even for such cases maybe?

Or maybe I'm totally wrong and there is some simple way for a driver to
request reconfiguration of all interfaces?
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 1 +
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c     | 4 ++++
 3 files changed, 10 insertions(+)

Comments

Kalle Valo March 7, 2017, 1:32 p.m. UTC | #1
Rafał Miłecki <zajec5@gmail.com> writes:

> From: Rafał Miłecki <rafal@milecki.pl>
>
> When PSM's watchdog fires hardware / firmware is not operational. It
> seems there isn't a way to restart firmware & reapply all settings so
> instead shut all interfaces down. This is at least some signal for the
> user things went wrong and allows reacting to it.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> This patch is RFC as I'm wondering if there is any other way to handle
> such errors. I couldn't find anything except for that
> cfg80211_shutdown_all_interfaces.
>
> Unfortunately hostapd doesn't seem to react to this except for sth like:
> Fri Feb 24 13:41:07 2017 daemon.notice hostapd: wlan0: INTERFACE-DISABLED
>
> Shall we introduce some nl80211 even for such cases maybe?
>
> Or maybe I'm totally wrong and there is some simple way for a driver to
> request reconfiguration of all interfaces?

Did you notice this on your email:

To:     unlisted-recipients:; (no To-header on input)
Rafał Miłecki March 7, 2017, 2:38 p.m. UTC | #2
On 7 March 2017 at 14:32, Kalle Valo <kvalo@codeaurora.org> wrote:
> Rafał Miłecki <zajec5@gmail.com> writes:
>
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> When PSM's watchdog fires hardware / firmware is not operational. It
>> seems there isn't a way to restart firmware & reapply all settings so
>> instead shut all interfaces down. This is at least some signal for the
>> user things went wrong and allows reacting to it.
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
>> This patch is RFC as I'm wondering if there is any other way to handle
>> such errors. I couldn't find anything except for that
>> cfg80211_shutdown_all_interfaces.
>>
>> Unfortunately hostapd doesn't seem to react to this except for sth like:
>> Fri Feb 24 13:41:07 2017 daemon.notice hostapd: wlan0: INTERFACE-DISABLED
>>
>> Shall we introduce some nl80211 even for such cases maybe?
>>
>> Or maybe I'm totally wrong and there is some simple way for a driver to
>> request reconfiguration of all interfaces?
>
> Did you notice this on your email:
>
> To:     unlisted-recipients:; (no To-header on input)

I guess I should have put linux-wireless in To. Normally I put you,
but since it's RFC, I left it empty and it went like this.

Anyway I believe it still reached linux-wireless. So any comments on this? :)
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 10098b7586f3..520d397bb963 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6981,3 +6981,8 @@  void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
 	wl_deinit_priv(cfg);
 	brcmf_free_wiphy(cfg->wiphy);
 }
+
+void brcmf_cfg80211_shutdown(struct brcmf_cfg80211_info *cfg)
+{
+	cfg80211_shutdown_all_interfaces(cfg->wiphy);
+}
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 8f19d95d4175..77dafe03bb31 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -385,6 +385,7 @@  struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
 						  struct device *busdev,
 						  bool p2pdev_forced);
 void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
+void brcmf_cfg80211_shutdown(struct brcmf_cfg80211_info *cfg);
 s32 brcmf_cfg80211_up(struct net_device *ndev);
 s32 brcmf_cfg80211_down(struct net_device *ndev);
 enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 2f2f3a5ad86a..c6c0f3e8ef00 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -753,6 +753,10 @@  static int brcmf_psm_watchdog_notify(struct brcmf_if *ifp,
 	if (err)
 		brcmf_err("Failed to get memory dump, %d\n", err);
 
+	brcmf_cfg80211_shutdown(ifp->drvr->config);
+
+	/* TODO: Stop the firmware */
+
 	return err;
 }