Merge tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux/fpc-iii.git] / net / wireless / ap.c
blob550ac9d827fe7d7f266f0ac511afec0aa4d8f8c3
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/ieee80211.h>
3 #include <linux/export.h>
4 #include <net/cfg80211.h>
5 #include "nl80211.h"
6 #include "core.h"
7 #include "rdev-ops.h"
10 int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
11 struct net_device *dev, bool notify)
13 struct wireless_dev *wdev = dev->ieee80211_ptr;
14 int err;
16 ASSERT_WDEV_LOCK(wdev);
18 if (!rdev->ops->stop_ap)
19 return -EOPNOTSUPP;
21 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
22 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
23 return -EOPNOTSUPP;
25 if (!wdev->beacon_interval)
26 return -ENOENT;
28 err = rdev_stop_ap(rdev, dev);
29 if (!err) {
30 wdev->conn_owner_nlportid = 0;
31 wdev->beacon_interval = 0;
32 memset(&wdev->chandef, 0, sizeof(wdev->chandef));
33 wdev->ssid_len = 0;
34 rdev_set_qos_map(rdev, dev, NULL);
35 if (notify)
36 nl80211_send_ap_stopped(wdev);
38 /* Should we apply the grace period during beaconing interface
39 * shutdown also?
41 cfg80211_sched_dfs_chan_update(rdev);
44 schedule_work(&cfg80211_disconnect_work);
46 return err;
49 int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
50 struct net_device *dev, bool notify)
52 struct wireless_dev *wdev = dev->ieee80211_ptr;
53 int err;
55 wdev_lock(wdev);
56 err = __cfg80211_stop_ap(rdev, dev, notify);
57 wdev_unlock(wdev);
59 return err;