Michal Kazior | 6077178 | 2012-06-29 12:46:56 +0200 | [diff] [blame] | 1 | #include <linux/ieee80211.h> |
| 2 | #include <linux/export.h> |
| 3 | #include <net/cfg80211.h> |
| 4 | #include "nl80211.h" |
| 5 | #include "core.h" |
Hila Gonen | e35e4d2 | 2012-06-27 17:19:42 +0300 | [diff] [blame] | 6 | #include "rdev-ops.h" |
Michal Kazior | 6077178 | 2012-06-29 12:46:56 +0200 | [diff] [blame] | 7 | |
| 8 | |
| 9 | static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev, |
| 10 | struct net_device *dev) |
| 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 | |
Hila Gonen | e35e4d2 | 2012-06-27 17:19:42 +0300 | [diff] [blame] | 27 | err = rdev_stop_ap(rdev, dev); |
Michal Kazior | f4489eb | 2012-06-29 12:46:58 +0200 | [diff] [blame] | 28 | if (!err) { |
Michal Kazior | 6077178 | 2012-06-29 12:46:56 +0200 | [diff] [blame] | 29 | wdev->beacon_interval = 0; |
Michal Kazior | f4489eb | 2012-06-29 12:46:58 +0200 | [diff] [blame] | 30 | wdev->channel = NULL; |
Antonio Quartulli | 06e191e | 2012-11-07 12:52:19 +0100 | [diff] [blame] | 31 | wdev->ssid_len = 0; |
Kyeyoon Park | fa9ffc7 | 2013-12-16 23:01:30 -0800 | [diff] [blame] | 32 | rdev_set_qos_map(rdev, dev, NULL); |
Michal Kazior | f4489eb | 2012-06-29 12:46:58 +0200 | [diff] [blame] | 33 | } |
Michal Kazior | 6077178 | 2012-06-29 12:46:56 +0200 | [diff] [blame] | 34 | |
| 35 | return err; |
| 36 | } |
| 37 | |
| 38 | int cfg80211_stop_ap(struct cfg80211_registered_device *rdev, |
| 39 | struct net_device *dev) |
| 40 | { |
| 41 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 42 | int err; |
| 43 | |
| 44 | wdev_lock(wdev); |
| 45 | err = __cfg80211_stop_ap(rdev, dev); |
| 46 | wdev_unlock(wdev); |
| 47 | |
| 48 | return err; |
| 49 | } |