• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <linux/ieee80211.h>
2 #include <linux/export.h>
3 #include <net/cfg80211.h>
4 #include "nl80211.h"
5 #include "core.h"
6 #include "rdev-ops.h"
7 
8 
__cfg80211_stop_ap(struct cfg80211_registered_device * rdev,struct net_device * dev,bool notify)9 int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
10 		       struct net_device *dev, bool notify)
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 
27 	err = rdev_stop_ap(rdev, dev);
28 	if (!err) {
29 		wdev->beacon_interval = 0;
30 		memset(&wdev->chandef, 0, sizeof(wdev->chandef));
31 		wdev->ssid_len = 0;
32 		rdev_set_qos_map(rdev, dev, NULL);
33 		if (notify)
34 			nl80211_send_ap_stopped(wdev);
35 	}
36 
37 	return err;
38 }
39 
cfg80211_stop_ap(struct cfg80211_registered_device * rdev,struct net_device * dev,bool notify)40 int cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
41 		     struct net_device *dev, bool notify)
42 {
43 	struct wireless_dev *wdev = dev->ieee80211_ptr;
44 	int err;
45 
46 	wdev_lock(wdev);
47 	err = __cfg80211_stop_ap(rdev, dev, notify);
48 	wdev_unlock(wdev);
49 
50 	return err;
51 }
52