diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2014-02-27 04:07:21 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-04-09 04:55:47 -0400 |
commit | b6a550156bc08a472c9d2515631649e229fcfcef (patch) | |
tree | e47650bdbadff71e05f76c7b8e3a490347efffcd /net/wireless | |
parent | 71965c1d04b2b48ab7c56395bd1f996a56aaa592 (diff) |
cfg80211/mac80211: move more combination checks to mac80211
Get rid of the cfg80211_can_add_interface() and
cfg80211_can_change_interface() functions by moving that functionality
to mac80211. With this patch all interface combination checks are now
out of cfg80211 (except for the channel switch case which will be
addressed in a future commit).
Additionally, modify the ieee80211_check_combinations() function so
that an undefined chandef can be passed, in order to use it before a
channel is defined.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/core.c | 11 | ||||
-rw-r--r-- | net/wireless/core.h | 22 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 5 | ||||
-rw-r--r-- | net/wireless/util.c | 5 |
4 files changed, 5 insertions, 38 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 5a63c3cbda2e..33d12e23771c 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -439,10 +439,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy) | |||
439 | for (j = 0; j < c->n_limits; j++) { | 439 | for (j = 0; j < c->n_limits; j++) { |
440 | u16 types = c->limits[j].types; | 440 | u16 types = c->limits[j].types; |
441 | 441 | ||
442 | /* | 442 | /* interface types shouldn't overlap */ |
443 | * interface types shouldn't overlap, this is | ||
444 | * used in cfg80211_can_change_interface() | ||
445 | */ | ||
446 | if (WARN_ON(types & all_iftypes)) | 443 | if (WARN_ON(types & all_iftypes)) |
447 | return -EINVAL; | 444 | return -EINVAL; |
448 | all_iftypes |= types; | 445 | all_iftypes |= types; |
@@ -840,7 +837,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
840 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | 837 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
841 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 838 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
842 | struct cfg80211_registered_device *rdev; | 839 | struct cfg80211_registered_device *rdev; |
843 | int ret; | ||
844 | 840 | ||
845 | if (!wdev) | 841 | if (!wdev) |
846 | return NOTIFY_DONE; | 842 | return NOTIFY_DONE; |
@@ -1003,9 +999,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
1003 | case NETDEV_PRE_UP: | 999 | case NETDEV_PRE_UP: |
1004 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) | 1000 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) |
1005 | return notifier_from_errno(-EOPNOTSUPP); | 1001 | return notifier_from_errno(-EOPNOTSUPP); |
1006 | ret = cfg80211_can_add_interface(rdev, wdev->iftype); | 1002 | if (rfkill_blocked(rdev->rfkill)) |
1007 | if (ret) | 1003 | return notifier_from_errno(-ERFKILL); |
1008 | return notifier_from_errno(ret); | ||
1009 | break; | 1004 | break; |
1010 | } | 1005 | } |
1011 | 1006 | ||
diff --git a/net/wireless/core.h b/net/wireless/core.h index 6684c5d965d8..5bee6cc94b21 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -412,28 +412,6 @@ unsigned int | |||
412 | cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, | 412 | cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, |
413 | const struct cfg80211_chan_def *chandef); | 413 | const struct cfg80211_chan_def *chandef); |
414 | 414 | ||
415 | static inline int | ||
416 | cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, | ||
417 | struct wireless_dev *wdev, | ||
418 | enum nl80211_iftype iftype) | ||
419 | { | ||
420 | /* TODO: For this function, we'll probably need to keep some | ||
421 | * kind of interface combination check in cfg80211... | ||
422 | */ | ||
423 | return cfg80211_can_use_iftype_chan(rdev, wdev, iftype, NULL, | ||
424 | CHAN_MODE_UNDEFINED, 0); | ||
425 | } | ||
426 | |||
427 | static inline int | ||
428 | cfg80211_can_add_interface(struct cfg80211_registered_device *rdev, | ||
429 | enum nl80211_iftype iftype) | ||
430 | { | ||
431 | if (rfkill_blocked(rdev->rfkill)) | ||
432 | return -ERFKILL; | ||
433 | |||
434 | return cfg80211_can_change_interface(rdev, NULL, iftype); | ||
435 | } | ||
436 | |||
437 | static inline unsigned int elapsed_jiffies_msecs(unsigned long start) | 415 | static inline unsigned int elapsed_jiffies_msecs(unsigned long start) |
438 | { | 416 | { |
439 | unsigned long end = jiffies; | 417 | unsigned long end = jiffies; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 2b99aad33ae0..232d15c0ac6e 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -8969,9 +8969,8 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) | |||
8969 | if (wdev->p2p_started) | 8969 | if (wdev->p2p_started) |
8970 | return 0; | 8970 | return 0; |
8971 | 8971 | ||
8972 | err = cfg80211_can_add_interface(rdev, wdev->iftype); | 8972 | if (rfkill_blocked(rdev->rfkill)) |
8973 | if (err) | 8973 | return -ERFKILL; |
8974 | return err; | ||
8975 | 8974 | ||
8976 | err = rdev_start_p2p_device(rdev, wdev); | 8975 | err = rdev_start_p2p_device(rdev, wdev); |
8977 | if (err) | 8976 | if (err) |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 9bfc4c621509..5433659a08ee 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -888,11 +888,6 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
888 | return -EBUSY; | 888 | return -EBUSY; |
889 | 889 | ||
890 | if (ntype != otype && netif_running(dev)) { | 890 | if (ntype != otype && netif_running(dev)) { |
891 | err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr, | ||
892 | ntype); | ||
893 | if (err) | ||
894 | return err; | ||
895 | |||
896 | dev->ieee80211_ptr->use_4addr = false; | 891 | dev->ieee80211_ptr->use_4addr = false; |
897 | dev->ieee80211_ptr->mesh_id_up_len = 0; | 892 | dev->ieee80211_ptr->mesh_id_up_len = 0; |
898 | wdev_lock(dev->ieee80211_ptr); | 893 | wdev_lock(dev->ieee80211_ptr); |