]>
Commit | Line | Data |
---|---|---|
60771780 MK |
1 | #include <linux/ieee80211.h> |
2 | #include <linux/export.h> | |
3 | #include <net/cfg80211.h> | |
4 | #include "nl80211.h" | |
5 | #include "core.h" | |
e35e4d28 | 6 | #include "rdev-ops.h" |
60771780 MK |
7 | |
8 | ||
f04c2203 MK |
9 | int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev, |
10 | struct net_device *dev, bool notify) | |
60771780 MK |
11 | { |
12 | struct wireless_dev *wdev = dev->ieee80211_ptr; | |
13 | int err; | |
14 | ||
15 | ASSERT_WDEV_LOCK(wdev); | |
16 | ||
17 | if (!rdev->ops->stop_ap) | |
18 | return -EOPNOTSUPP; | |
19 | ||
20 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | |
21 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) | |
22 | return -EOPNOTSUPP; | |
23 | ||
24 | if (!wdev->beacon_interval) | |
25 | return -ENOENT; | |
26 | ||
e35e4d28 | 27 | err = rdev_stop_ap(rdev, dev); |
f4489ebe | 28 | if (!err) { |
60771780 | 29 | wdev->beacon_interval = 0; |
9e0e2961 | 30 | memset(&wdev->chandef, 0, sizeof(wdev->chandef)); |
06e191e2 | 31 | wdev->ssid_len = 0; |
fa9ffc74 | 32 | rdev_set_qos_map(rdev, dev, NULL); |
7c8d5e03 IP |
33 | if (notify) |
34 | nl80211_send_ap_stopped(wdev); | |
b35a51c7 VT |
35 | |
36 | /* Should we apply the grace period during beaconing interface | |
37 | * shutdown also? | |
38 | */ | |
39 | cfg80211_sched_dfs_chan_update(rdev); | |
f4489ebe | 40 | } |
60771780 MK |
41 | |
42 | return err; | |
43 | } | |
44 | ||
45 | int cfg80211_stop_ap(struct cfg80211_registered_device *rdev, | |
7c8d5e03 | 46 | struct net_device *dev, bool notify) |
60771780 MK |
47 | { |
48 | struct wireless_dev *wdev = dev->ieee80211_ptr; | |
49 | int err; | |
50 | ||
51 | wdev_lock(wdev); | |
7c8d5e03 | 52 | err = __cfg80211_stop_ap(rdev, dev, notify); |
60771780 MK |
53 | wdev_unlock(wdev); |
54 | ||
55 | return err; | |
56 | } |