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;
14 ieee80211_stop_queues_by_reason(hw,
15 IEEE80211_QUEUE_STOP_REASON_SUSPEND);
17 flush_workqueue(local->hw.workqueue);
20 list_for_each_entry(sdata, &local->interfaces, list)
21 ieee80211_disable_keys(sdata);
24 list_for_each_entry(sta, &local->sta_list, list) {
26 if (local->ops->sta_notify) {
27 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
28 sdata = container_of(sdata->bss,
29 struct ieee80211_sub_if_data,
32 local->ops->sta_notify(hw, &sdata->vif,
33 STA_NOTIFY_REMOVE, &sta->sta);
37 /* remove all interfaces */
38 list_for_each_entry(sdata, &local->interfaces, list) {
40 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
41 sdata->vif.type != NL80211_IFTYPE_MONITOR &&
42 netif_running(sdata->dev)) {
43 conf.vif = &sdata->vif;
44 conf.type = sdata->vif.type;
45 conf.mac_addr = sdata->dev->dev_addr;
46 local->ops->remove_interface(hw, &conf);
50 /* flush again, in case driver queued work */
51 flush_workqueue(local->hw.workqueue);
54 if (local->open_count) {
55 ieee80211_led_radio(local, false);
61 int __ieee80211_resume(struct ieee80211_hw *hw)
63 struct ieee80211_local *local = hw_to_local(hw);
64 struct ieee80211_sub_if_data *sdata;
65 struct ieee80211_if_init_conf conf;
69 /* restart hardware */
70 if (local->open_count) {
71 res = local->ops->start(hw);
73 ieee80211_led_radio(local, hw->conf.radio_enabled);
77 list_for_each_entry(sdata, &local->interfaces, list) {
79 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
80 sdata->vif.type != NL80211_IFTYPE_MONITOR &&
81 netif_running(sdata->dev)) {
82 conf.vif = &sdata->vif;
83 conf.type = sdata->vif.type;
84 conf.mac_addr = sdata->dev->dev_addr;
85 res = local->ops->add_interface(hw, &conf);
90 list_for_each_entry(sta, &local->sta_list, list) {
92 if (local->ops->sta_notify) {
93 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
94 sdata = container_of(sdata->bss,
95 struct ieee80211_sub_if_data,
98 local->ops->sta_notify(hw, &sdata->vif,
99 STA_NOTIFY_ADD, &sta->sta);
104 list_for_each_entry(sdata, &local->interfaces, list)
105 if (netif_running(sdata->dev))
106 ieee80211_enable_keys(sdata);
108 /* setup RTS threshold */
109 if (local->ops->set_rts_threshold)
110 local->ops->set_rts_threshold(hw, local->rts_threshold);
112 /* reconfigure hardware */
113 ieee80211_hw_config(local, ~0);
115 netif_addr_lock_bh(local->mdev);
116 ieee80211_configure_filter(local);
117 netif_addr_unlock_bh(local->mdev);
119 ieee80211_wake_queues_by_reason(hw,
120 IEEE80211_QUEUE_STOP_REASON_SUSPEND);