66#include "driver-ops.h"
77#include "led.h"
88
9- /* return value indicates whether the driver should be further notified */
10- static void ieee80211_quiesce (struct ieee80211_sub_if_data * sdata )
11- {
12- switch (sdata -> vif .type ) {
13- case NL80211_IFTYPE_STATION :
14- ieee80211_sta_quiesce (sdata );
15- break ;
16- case NL80211_IFTYPE_ADHOC :
17- ieee80211_ibss_quiesce (sdata );
18- break ;
19- case NL80211_IFTYPE_MESH_POINT :
20- ieee80211_mesh_quiesce (sdata );
21- break ;
22- default :
23- break ;
24- }
25-
26- cancel_work_sync (& sdata -> work );
27- }
28-
299int __ieee80211_suspend (struct ieee80211_hw * hw , struct cfg80211_wowlan * wowlan )
3010{
3111 struct ieee80211_local * local = hw_to_local (hw );
3212 struct ieee80211_sub_if_data * sdata ;
3313 struct sta_info * sta ;
34- struct ieee80211_chanctx * ctx ;
3514
3615 if (!local -> open_count )
3716 goto suspend ;
@@ -95,17 +74,10 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
9574 WARN_ON (err != 1 );
9675 return err ;
9776 } else {
98- list_for_each_entry (sdata , & local -> interfaces , list )
99- if (ieee80211_sdata_running (sdata ))
100- ieee80211_quiesce (sdata );
10177 goto suspend ;
10278 }
10379 }
10480
105- /* disable keys */
106- list_for_each_entry (sdata , & local -> interfaces , list )
107- ieee80211_disable_keys (sdata );
108-
10981 /* tear down aggregation sessions and remove STAs */
11082 mutex_lock (& local -> sta_mtx );
11183 list_for_each_entry (sta , & local -> sta_list , list ) {
@@ -117,100 +89,25 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
11789 WARN_ON (drv_sta_state (local , sta -> sdata , sta ,
11890 state , state - 1 ));
11991 }
120-
121- mesh_plink_quiesce (sta );
12292 }
12393 mutex_unlock (& local -> sta_mtx );
12494
12595 /* remove all interfaces */
12696 list_for_each_entry (sdata , & local -> interfaces , list ) {
127- static u8 zero_addr [ETH_ALEN ] = {};
128- u32 changed = 0 ;
129-
13097 if (!ieee80211_sdata_running (sdata ))
13198 continue ;
132-
133- switch (sdata -> vif .type ) {
134- case NL80211_IFTYPE_AP_VLAN :
135- case NL80211_IFTYPE_MONITOR :
136- /* skip these */
137- continue ;
138- case NL80211_IFTYPE_STATION :
139- if (sdata -> vif .bss_conf .assoc )
140- changed = BSS_CHANGED_ASSOC |
141- BSS_CHANGED_BSSID |
142- BSS_CHANGED_IDLE ;
143- break ;
144- case NL80211_IFTYPE_AP :
145- case NL80211_IFTYPE_ADHOC :
146- case NL80211_IFTYPE_MESH_POINT :
147- if (sdata -> vif .bss_conf .enable_beacon )
148- changed = BSS_CHANGED_BEACON_ENABLED ;
149- break ;
150- default :
151- break ;
152- }
153-
154- ieee80211_quiesce (sdata );
155-
156- sdata -> suspend_bss_conf = sdata -> vif .bss_conf ;
157- memset (& sdata -> vif .bss_conf , 0 , sizeof (sdata -> vif .bss_conf ));
158- sdata -> vif .bss_conf .idle = true;
159- if (sdata -> suspend_bss_conf .bssid )
160- sdata -> vif .bss_conf .bssid = zero_addr ;
161-
162- /* disable beaconing or remove association */
163- ieee80211_bss_info_change_notify (sdata , changed );
164-
165- if (sdata -> vif .type == NL80211_IFTYPE_AP &&
166- rcu_access_pointer (sdata -> u .ap .beacon ))
167- drv_stop_ap (local , sdata );
168-
169- if (local -> use_chanctx ) {
170- struct ieee80211_chanctx_conf * conf ;
171-
172- mutex_lock (& local -> chanctx_mtx );
173- conf = rcu_dereference_protected (
174- sdata -> vif .chanctx_conf ,
175- lockdep_is_held (& local -> chanctx_mtx ));
176- if (conf ) {
177- ctx = container_of (conf ,
178- struct ieee80211_chanctx ,
179- conf );
180- drv_unassign_vif_chanctx (local , sdata , ctx );
181- }
182-
183- mutex_unlock (& local -> chanctx_mtx );
184- }
18599 drv_remove_interface (local , sdata );
186100 }
187101
188102 sdata = rtnl_dereference (local -> monitor_sdata );
189- if (sdata ) {
190- if (local -> use_chanctx ) {
191- struct ieee80211_chanctx_conf * conf ;
192-
193- mutex_lock (& local -> chanctx_mtx );
194- conf = rcu_dereference_protected (
195- sdata -> vif .chanctx_conf ,
196- lockdep_is_held (& local -> chanctx_mtx ));
197- if (conf ) {
198- ctx = container_of (conf ,
199- struct ieee80211_chanctx ,
200- conf );
201- drv_unassign_vif_chanctx (local , sdata , ctx );
202- }
203-
204- mutex_unlock (& local -> chanctx_mtx );
205- }
206-
103+ if (sdata )
207104 drv_remove_interface (local , sdata );
208- }
209105
210- mutex_lock (& local -> chanctx_mtx );
211- list_for_each_entry (ctx , & local -> chanctx_list , list )
212- drv_remove_chanctx (local , ctx );
213- mutex_unlock (& local -> chanctx_mtx );
106+ /*
107+ * We disconnected on all interfaces before suspend, all channel
108+ * contexts should be released.
109+ */
110+ WARN_ON (!list_empty (& local -> chanctx_list ));
214111
215112 /* stop hardware - this must stop RX */
216113 if (local -> open_count )
0 commit comments