linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: only roll back station states for WDS when suspending
@ 2015-01-19 20:28 Luca Coelho
  2015-01-19 20:33 ` Johannes Berg
  2015-01-21 20:19 ` Luca Coelho
  0 siblings, 2 replies; 4+ messages in thread
From: Luca Coelho @ 2015-01-19 20:28 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

From: Luciano Coelho <luciano.coelho@intel.com>

In the suspend code, we shouldn't roll back the station states because
this is taken care of in other parts of the code, except for WDS
interfaces.  For AP types of interfaces, cfg80211 takes care of
disconnecting all stations before calling the driver's suspend code.
For station interfaces, this will be done in the quiesce code.

For WDS interfaces we still need to do it here, so move the code into
a new case switch for WDS.

Cc: stable@kernel.org [3.15+]
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
---
 net/mac80211/pm.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 8c8c678..ca405b6 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -86,20 +86,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 		}
 	}
 
-	/* tear down aggregation sessions and remove STAs */
-	mutex_lock(&local->sta_mtx);
-	list_for_each_entry(sta, &local->sta_list, list) {
-		if (sta->uploaded) {
-			enum ieee80211_sta_state state;
-
-			state = sta->sta_state;
-			for (; state > IEEE80211_STA_NOTEXIST; state--)
-				WARN_ON(drv_sta_state(local, sta->sdata, sta,
-						      state, state - 1));
-		}
-	}
-	mutex_unlock(&local->sta_mtx);
-
 	/* remove all interfaces that were created in the driver */
 	list_for_each_entry(sdata, &local->interfaces, list) {
 		if (!ieee80211_sdata_running(sdata))
@@ -111,6 +97,21 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 		case NL80211_IFTYPE_STATION:
 			ieee80211_mgd_quiesce(sdata);
 			break;
+		case NL80211_IFTYPE_WDS:
+			/* tear down aggregation sessions and remove STAs */
+			mutex_lock(&local->sta_mtx);
+			sta = sdata->u.wds.sta;
+			if (sta && sta->uploaded) {
+				enum ieee80211_sta_state state;
+
+				state = sta->sta_state;
+				for (; state > IEEE80211_STA_NOTEXIST; state--)
+					WARN_ON(drv_sta_state(local, sta->sdata,
+							      sta, state,
+							      state - 1));
+			}
+			mutex_unlock(&local->sta_mtx);
+			break;
 		default:
 			break;
 		}
-- 
2.1.4


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

* Re: [PATCH] mac80211: only roll back station states for WDS when suspending
  2015-01-19 20:28 [PATCH] mac80211: only roll back station states for WDS when suspending Luca Coelho
@ 2015-01-19 20:33 ` Johannes Berg
  2015-01-21 20:19 ` Luca Coelho
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2015-01-19 20:33 UTC (permalink / raw)
  To: Luca Coelho; +Cc: linux-wireless

On Mon, 2015-01-19 at 22:28 +0200, Luca Coelho wrote:
> From: Luciano Coelho <luciano.coelho@intel.com>
> 
> In the suspend code, we shouldn't roll back the station states because
> this is taken care of in other parts of the code, except for WDS
> interfaces.  For AP types of interfaces, cfg80211 takes care of
> disconnecting all stations before calling the driver's suspend code.
> For station interfaces, this will be done in the quiesce code.

That's actually correct only in the corner case of ongoing
authentication or association - in the common case of being associated
while suspending it's also handled by cfg80211. Similarly, of course,
for mesh and IBSS.

Would perhaps be worth mentioning that here.

johannes


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

* [PATCH] mac80211: only roll back station states for WDS when suspending
  2015-01-19 20:28 [PATCH] mac80211: only roll back station states for WDS when suspending Luca Coelho
  2015-01-19 20:33 ` Johannes Berg
@ 2015-01-21 20:19 ` Luca Coelho
  2015-01-23  9:51   ` Johannes Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Coelho @ 2015-01-21 20:19 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

From: Luciano Coelho <luciano.coelho@intel.com>

In normal cases (i.e. when we are fully associated), cfg80211 takes
care of removing all the stations before calling suspend in mac80211.

But in the corner case when we suspend during authentication or
association, mac80211 needs to roll back the station states.  But we
shouldn't roll back the station states in the suspend function,
because this is taken care of in other parts of the code, except for
WDS interfaces.  For AP types of interfaces, cfg80211 takes care of
disconnecting all stations before calling the driver's suspend code.
For station interfaces, this is done in the quiesce code.

For WDS interfaces we still need to do it here, so move the code into
a new switch case for WDS.

Cc: stable@kernel.org [3.15+]
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
---

In v2:

   * Reworked the commit message [Johannes]


 net/mac80211/pm.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 8c8c678..ca405b6 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -86,20 +86,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 		}
 	}
 
-	/* tear down aggregation sessions and remove STAs */
-	mutex_lock(&local->sta_mtx);
-	list_for_each_entry(sta, &local->sta_list, list) {
-		if (sta->uploaded) {
-			enum ieee80211_sta_state state;
-
-			state = sta->sta_state;
-			for (; state > IEEE80211_STA_NOTEXIST; state--)
-				WARN_ON(drv_sta_state(local, sta->sdata, sta,
-						      state, state - 1));
-		}
-	}
-	mutex_unlock(&local->sta_mtx);
-
 	/* remove all interfaces that were created in the driver */
 	list_for_each_entry(sdata, &local->interfaces, list) {
 		if (!ieee80211_sdata_running(sdata))
@@ -111,6 +97,21 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 		case NL80211_IFTYPE_STATION:
 			ieee80211_mgd_quiesce(sdata);
 			break;
+		case NL80211_IFTYPE_WDS:
+			/* tear down aggregation sessions and remove STAs */
+			mutex_lock(&local->sta_mtx);
+			sta = sdata->u.wds.sta;
+			if (sta && sta->uploaded) {
+				enum ieee80211_sta_state state;
+
+				state = sta->sta_state;
+				for (; state > IEEE80211_STA_NOTEXIST; state--)
+					WARN_ON(drv_sta_state(local, sta->sdata,
+							      sta, state,
+							      state - 1));
+			}
+			mutex_unlock(&local->sta_mtx);
+			break;
 		default:
 			break;
 		}
-- 
2.1.4


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

* Re: [PATCH] mac80211: only roll back station states for WDS when suspending
  2015-01-21 20:19 ` Luca Coelho
@ 2015-01-23  9:51   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2015-01-23  9:51 UTC (permalink / raw)
  To: Luca Coelho; +Cc: linux-wireless

On Wed, 2015-01-21 at 22:19 +0200, Luca Coelho wrote:
> From: Luciano Coelho <luciano.coelho@intel.com>
> 
> In normal cases (i.e. when we are fully associated), cfg80211 takes
> care of removing all the stations before calling suspend in mac80211.
> 
> But in the corner case when we suspend during authentication or
> association, mac80211 needs to roll back the station states.  But we
> shouldn't roll back the station states in the suspend function,
> because this is taken care of in other parts of the code, except for
> WDS interfaces.  For AP types of interfaces, cfg80211 takes care of
> disconnecting all stations before calling the driver's suspend code.
> For station interfaces, this is done in the quiesce code.
> 
> For WDS interfaces we still need to do it here, so move the code into
> a new switch case for WDS.

Applied.

johannes


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

end of thread, other threads:[~2015-01-23  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 20:28 [PATCH] mac80211: only roll back station states for WDS when suspending Luca Coelho
2015-01-19 20:33 ` Johannes Berg
2015-01-21 20:19 ` Luca Coelho
2015-01-23  9:51   ` Johannes Berg

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).