1 #include <net/mac80211.h>
2 #include <net/rtnetlink.h>
4 #include "ieee80211_i.h"
7 int __ieee80211_suspend(struct ieee80211_hw
*hw
)
9 struct ieee80211_local
*local
= hw_to_local(hw
);
10 struct ieee80211_sub_if_data
*sdata
;
11 struct ieee80211_if_init_conf conf
;
15 ieee80211_stop_queues_by_reason(hw
,
16 IEEE80211_QUEUE_STOP_REASON_SUSPEND
);
18 flush_workqueue(local
->hw
.workqueue
);
21 list_for_each_entry(sdata
, &local
->interfaces
, list
)
22 ieee80211_disable_keys(sdata
);
24 /* Tear down aggregation sessions */
28 if (hw
->flags
& IEEE80211_HW_AMPDU_AGGREGATION
) {
29 list_for_each_entry_rcu(sta
, &local
->sta_list
, list
) {
30 set_sta_flags(sta
, WLAN_STA_SUSPEND
);
31 ieee80211_sta_tear_down_BA_sessions(sta
);
38 if (local
->ops
->sta_notify
) {
39 spin_lock_irqsave(&local
->sta_lock
, flags
);
40 list_for_each_entry(sta
, &local
->sta_list
, list
) {
41 if (sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
)
42 sdata
= container_of(sdata
->bss
,
43 struct ieee80211_sub_if_data
,
46 local
->ops
->sta_notify(hw
, &sdata
->vif
,
47 STA_NOTIFY_REMOVE
, &sta
->sta
);
49 spin_unlock_irqrestore(&local
->sta_lock
, flags
);
52 /* remove all interfaces */
53 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
54 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
55 sdata
->vif
.type
!= NL80211_IFTYPE_MONITOR
&&
56 netif_running(sdata
->dev
)) {
57 conf
.vif
= &sdata
->vif
;
58 conf
.type
= sdata
->vif
.type
;
59 conf
.mac_addr
= sdata
->dev
->dev_addr
;
60 local
->ops
->remove_interface(hw
, &conf
);
64 /* flush again, in case driver queued work */
65 flush_workqueue(local
->hw
.workqueue
);
68 if (local
->open_count
) {
69 ieee80211_led_radio(local
, false);
76 * __ieee80211_resume() is a static inline which just calls
77 * ieee80211_reconfig(), which is also needed for hardware
78 * hang/firmware failure/etc. recovery.