All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] mac80211: deauthenticate STAs before suspend
@ 2011-01-31 10:06 Rajkumar Manoharan
  2011-01-31 11:27 ` Johannes Berg
  2011-01-31 12:00 ` Sujith
  0 siblings, 2 replies; 8+ messages in thread
From: Rajkumar Manoharan @ 2011-01-31 10:06 UTC (permalink / raw)
  To: linux-wireless; +Cc: Rajkumar Manoharan

The STA is not deauthenticated before the system goes to sleep,
when the vif was configured by iw/iwconfig. This holds the AP
resources unnecessarily, till the STA entry got expired in AP.
So before going to sleep ensure that all stations
got deauthenticated.

Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
---
 include/net/cfg80211.h |    2 ++
 net/mac80211/cfg.c     |   21 +++++++++++++++++++++
 net/wireless/sysfs.c   |    6 ++++++
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 679a049..c50345f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1056,6 +1056,7 @@ struct cfg80211_pmksa {
  * wireless extensions but this is subject to reevaluation as soon as this
  * code is used more widely and we have a first user without wext.
  *
+ * @pre_suspend: dissociate STAs before suspending the wiphy device
  * @suspend: wiphy device needs to be suspended
  * @resume: wiphy device needs to be resumed
  *
@@ -1196,6 +1197,7 @@ struct cfg80211_pmksa {
  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
  */
 struct cfg80211_ops {
+	int	(*pre_suspend)(struct wiphy *wiphy);
 	int	(*suspend)(struct wiphy *wiphy);
 	int	(*resume)(struct wiphy *wiphy);
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4bc8a92..2daadf1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1245,6 +1245,25 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
 }
 
 #ifdef CONFIG_PM
+static int ieee80211_pre_suspend(struct wiphy *wiphy)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+	struct ieee80211_sub_if_data *sdata = NULL;
+	struct ieee80211_if_managed *ifmgd = NULL;
+	struct cfg80211_deauth_request req;
+
+	list_for_each_entry(sdata, &local->interfaces, list) {
+		ifmgd = &sdata->u.mgd;
+		if (ifmgd->associated) {
+			req.bss = ifmgd->associated;
+			req.reason_code = WLAN_REASON_DEAUTH_LEAVING;
+			req.local_state_change = false;
+			ieee80211_mgd_deauth(sdata, &req, NULL);
+		}
+	}
+	return 0;
+}
+
 static int ieee80211_suspend(struct wiphy *wiphy)
 {
 	return __ieee80211_suspend(wiphy_priv(wiphy));
@@ -1255,6 +1274,7 @@ static int ieee80211_resume(struct wiphy *wiphy)
 	return __ieee80211_resume(wiphy_priv(wiphy));
 }
 #else
+#define ieee80211_pre_suspend NULL
 #define ieee80211_suspend NULL
 #define ieee80211_resume NULL
 #endif
@@ -1969,6 +1989,7 @@ struct cfg80211_ops mac80211_config_ops = {
 	.change_bss = ieee80211_change_bss,
 	.set_txq_params = ieee80211_set_txq_params,
 	.set_channel = ieee80211_set_channel,
+	.pre_suspend = ieee80211_pre_suspend,
 	.suspend = ieee80211_suspend,
 	.resume = ieee80211_resume,
 	.scan = ieee80211_scan,
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 4294fa2..944d589 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -91,6 +91,12 @@ static int wiphy_suspend(struct device *dev, pm_message_t state)
 
 	rdev->suspend_at = get_seconds();
 
+	if (rdev->ops->pre_suspend) {
+		rtnl_lock();
+		ret = rdev->ops->pre_suspend(&rdev->wiphy);
+		rtnl_unlock();
+	}
+
 	if (rdev->ops->suspend) {
 		rtnl_lock();
 		ret = rdev->ops->suspend(&rdev->wiphy);
-- 
1.7.3.5


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

end of thread, other threads:[~2011-02-01 14:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ce260d15f83b54d9a328a2d636cf9a4e@rss.opera.com>
2011-02-01 10:02 ` [RFC] mac80211: deauthenticate STAs before suspend Arend van Spriel
2011-02-01 14:37   ` Rajkumar Manoharan
2011-01-31 10:06 Rajkumar Manoharan
2011-01-31 11:27 ` Johannes Berg
2011-01-31 11:38   ` Rajkumar Manoharan
2011-01-31 11:47     ` Jouni Malinen
2011-01-31 12:09       ` Johannes Berg
2011-01-31 12:00 ` Sujith

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.