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