linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: flush scan entries upon suspend
@ 2020-06-23 18:10 Luca Coelho
  2020-06-25  8:40 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Coelho @ 2020-06-23 18:10 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

When we suspend, we can't really remember our BSS table.
Purge all the data.
Export this function to allow driver to purge the BSS table
in case they feel the need to.
iwlwifi will need to do that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 include/net/cfg80211.h |  6 ++++++
 net/wireless/scan.c    | 10 ++++++++++
 net/wireless/sysfs.c   |  2 ++
 3 files changed, 18 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fc7e8807838d..03a72b5b1986 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -7882,4 +7882,10 @@ void cfg80211_update_owe_info_event(struct net_device *netdev,
 				    struct cfg80211_update_owe_info *owe_info,
 				    gfp_t gfp);
 
+/**
+ * cfg80211_bss_flush - resets all the scan entries
+ * @wiphy: the wiphy
+ */
+void cfg80211_bss_flush(struct wiphy *wiphy);
+
 #endif /* __NET_CFG80211_H */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 74ea4cfb39fb..e67a74488bbe 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -712,6 +712,16 @@ void cfg80211_bss_expire(struct cfg80211_registered_device *rdev)
 	__cfg80211_bss_expire(rdev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE);
 }
 
+void cfg80211_bss_flush(struct wiphy *wiphy)
+{
+	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
+
+	spin_lock_bh(&rdev->bss_lock);
+	__cfg80211_bss_expire(rdev, jiffies);
+	spin_unlock_bh(&rdev->bss_lock);
+}
+EXPORT_SYMBOL(cfg80211_bss_flush);
+
 const struct element *
 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
 			 const u8 *match, unsigned int match_len,
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 3ac1f48195d2..b670f0d78621 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -5,6 +5,7 @@
  *
  * Copyright 2005-2006	Jiri Benc <jbenc@suse.cz>
  * Copyright 2006	Johannes Berg <johannes@sipsolutions.net>
+ * Copyright (C) 2020 Intel Corporation
  */
 
 #include <linux/device.h>
@@ -107,6 +108,7 @@ static int wiphy_suspend(struct device *dev)
 	if (rdev->wiphy.registered) {
 		if (!rdev->wiphy.wowlan_config) {
 			cfg80211_leave_all(rdev);
+			cfg80211_bss_flush(&rdev->wiphy);
 			cfg80211_process_rdev_events(rdev);
 		}
 		if (rdev->ops->suspend)
-- 
2.27.0


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

* Re: [PATCH] cfg80211: flush scan entries upon suspend
  2020-06-23 18:10 [PATCH] cfg80211: flush scan entries upon suspend Luca Coelho
@ 2020-06-25  8:40 ` Johannes Berg
  2020-06-25  9:01   ` Grumbach, Emmanuel
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2020-06-25  8:40 UTC (permalink / raw)
  To: Luca Coelho; +Cc: linux-wireless, emmanuel.grumbach

On Tue, 2020-06-23 at 21:10 +0300, Luca Coelho wrote:
> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> 
> When we suspend, we can't really remember our BSS table.

Sure we can. We do today :-)

Yes, I know why you want this for iwlwifi, but this commit message isn't
good. And if you had a good commit message, you'd know that it's
actually only needed for iwlwifi, not for basically anyone else.

And, in fact, it's not even needed for iwlwifi because if you had WoWLAN
then the firmware stays running and you don't need it.

> Purge all the data.

We age it already since commit cb3a8eec0e66. That should be sufficient
for most devices.

And in fact, if it weren't, then this should have removed the ageing
that's now completely pointless :)

> Export this function to allow driver to purge the BSS table
> in case they feel the need to.
> iwlwifi will need to do that.

I think we should just have a patch to purge it, without the call in
sysfs.c, and do then iwlwifi can call it in the right places (when it
resets the firmware.)

Note this won't even be _perfect_ because there are reasons (like being
connected) that mean the entry is not removed even when flushing, so
that should probably be documented.

johannes


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

* RE: [PATCH] cfg80211: flush scan entries upon suspend
  2020-06-25  8:40 ` Johannes Berg
@ 2020-06-25  9:01   ` Grumbach, Emmanuel
  0 siblings, 0 replies; 3+ messages in thread
From: Grumbach, Emmanuel @ 2020-06-25  9:01 UTC (permalink / raw)
  To: Johannes Berg, Luca Coelho; +Cc: linux-wireless

> On Tue, 2020-06-23 at 21:10 +0300, Luca Coelho wrote:
> > From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> >
> > When we suspend, we can't really remember our BSS table.
> 
> Sure we can. We do today :-)
> 
> Yes, I know why you want this for iwlwifi, but this commit message isn't
> good. And if you had a good commit message, you'd know that it's actually
> only needed for iwlwifi, not for basically anyone else.

I agree the commit message isn't sufficient and was  written quickly to get the bugfix in, I should have rewritten it before getting it published.

> 
> And, in fact, it's not even needed for iwlwifi because if you had WoWLAN
> then the firmware stays running and you don't need it.
> 
> > Purge all the data.
> 
> We age it already since commit cb3a8eec0e66. That should be sufficient for
> most devices.
> 
> And in fact, if it weren't, then this should have removed the ageing that's
> now completely pointless :)
> 
> > Export this function to allow driver to purge the BSS table in case
> > they feel the need to.
> > iwlwifi will need to do that.
> 
> I think we should just have a patch to purge it, without the call in sysfs.c, and
> do then iwlwifi can call it in the right places (when it resets the firmware.)

I will rework this patch. I'll keep this function and call it from iwlwifi only.
 
> 
> Note this won't even be _perfect_ because there are reasons (like being
> connected) that mean the entry is not removed even when flushing, so that
> should probably be documented.
> 
> johannes


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

end of thread, other threads:[~2020-06-25  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 18:10 [PATCH] cfg80211: flush scan entries upon suspend Luca Coelho
2020-06-25  8:40 ` Johannes Berg
2020-06-25  9:01   ` Grumbach, Emmanuel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).