diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-05-11 14:24:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-11 14:24:55 -0400 |
commit | cc755896a4274f11283bca32d1d658203844057a (patch) | |
tree | 218970ece71df99f686b9416b7fd88b921690ebb /net/wireless | |
parent | d250fe91ae129bff0968e685cc9c466d3a5e3482 (diff) | |
parent | 9459d59fbf0bc82ff4c804679fa8bc22788eca63 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
drivers/net/wireless/ath/ar9170/main.c
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/chan.c | 56 | ||||
-rw-r--r-- | net/wireless/core.h | 12 | ||||
-rw-r--r-- | net/wireless/ibss.c | 5 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 171 | ||||
-rw-r--r-- | net/wireless/sme.c | 5 | ||||
-rw-r--r-- | net/wireless/wext-compat.c | 15 | ||||
-rw-r--r-- | net/wireless/wext-sme.c | 2 |
7 files changed, 163 insertions, 103 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index bf1737fc9a7e..d92d088026bf 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -10,38 +10,6 @@ | |||
10 | #include "core.h" | 10 | #include "core.h" |
11 | 11 | ||
12 | struct ieee80211_channel * | 12 | struct ieee80211_channel * |
13 | rdev_fixed_channel(struct cfg80211_registered_device *rdev, | ||
14 | struct wireless_dev *for_wdev) | ||
15 | { | ||
16 | struct wireless_dev *wdev; | ||
17 | struct ieee80211_channel *result = NULL; | ||
18 | |||
19 | WARN_ON(!mutex_is_locked(&rdev->devlist_mtx)); | ||
20 | |||
21 | list_for_each_entry(wdev, &rdev->netdev_list, list) { | ||
22 | if (wdev == for_wdev) | ||
23 | continue; | ||
24 | |||
25 | /* | ||
26 | * Lock manually to tell lockdep about allowed | ||
27 | * nesting here if for_wdev->mtx is held already. | ||
28 | * This is ok as it's all under the rdev devlist | ||
29 | * mutex and as such can only be done once at any | ||
30 | * given time. | ||
31 | */ | ||
32 | mutex_lock_nested(&wdev->mtx, SINGLE_DEPTH_NESTING); | ||
33 | if (wdev->current_bss) | ||
34 | result = wdev->current_bss->pub.channel; | ||
35 | wdev_unlock(wdev); | ||
36 | |||
37 | if (result) | ||
38 | break; | ||
39 | } | ||
40 | |||
41 | return result; | ||
42 | } | ||
43 | |||
44 | struct ieee80211_channel * | ||
45 | rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | 13 | rdev_freq_to_chan(struct cfg80211_registered_device *rdev, |
46 | int freq, enum nl80211_channel_type channel_type) | 14 | int freq, enum nl80211_channel_type channel_type) |
47 | { | 15 | { |
@@ -75,15 +43,22 @@ rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | |||
75 | return chan; | 43 | return chan; |
76 | } | 44 | } |
77 | 45 | ||
78 | int rdev_set_freq(struct cfg80211_registered_device *rdev, | 46 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, |
79 | struct wireless_dev *for_wdev, | 47 | struct wireless_dev *wdev, int freq, |
80 | int freq, enum nl80211_channel_type channel_type) | 48 | enum nl80211_channel_type channel_type) |
81 | { | 49 | { |
82 | struct ieee80211_channel *chan; | 50 | struct ieee80211_channel *chan; |
83 | int result; | 51 | int result; |
84 | 52 | ||
85 | if (rdev_fixed_channel(rdev, for_wdev)) | 53 | if (wdev->iftype == NL80211_IFTYPE_MONITOR) |
86 | return -EBUSY; | 54 | wdev = NULL; |
55 | |||
56 | if (wdev) { | ||
57 | ASSERT_WDEV_LOCK(wdev); | ||
58 | |||
59 | if (!netif_running(wdev->netdev)) | ||
60 | return -ENETDOWN; | ||
61 | } | ||
87 | 62 | ||
88 | if (!rdev->ops->set_channel) | 63 | if (!rdev->ops->set_channel) |
89 | return -EOPNOTSUPP; | 64 | return -EOPNOTSUPP; |
@@ -92,11 +67,14 @@ int rdev_set_freq(struct cfg80211_registered_device *rdev, | |||
92 | if (!chan) | 67 | if (!chan) |
93 | return -EINVAL; | 68 | return -EINVAL; |
94 | 69 | ||
95 | result = rdev->ops->set_channel(&rdev->wiphy, chan, channel_type); | 70 | result = rdev->ops->set_channel(&rdev->wiphy, |
71 | wdev ? wdev->netdev : NULL, | ||
72 | chan, channel_type); | ||
96 | if (result) | 73 | if (result) |
97 | return result; | 74 | return result; |
98 | 75 | ||
99 | rdev->channel = chan; | 76 | if (wdev) |
77 | wdev->channel = chan; | ||
100 | 78 | ||
101 | return 0; | 79 | return 0; |
102 | } | 80 | } |
diff --git a/net/wireless/core.h b/net/wireless/core.h index b2234b436ead..ae930acf75e9 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -70,9 +70,6 @@ struct cfg80211_registered_device { | |||
70 | struct work_struct conn_work; | 70 | struct work_struct conn_work; |
71 | struct work_struct event_work; | 71 | struct work_struct event_work; |
72 | 72 | ||
73 | /* current channel */ | ||
74 | struct ieee80211_channel *channel; | ||
75 | |||
76 | /* must be last because of the way we do wiphy_priv(), | 73 | /* must be last because of the way we do wiphy_priv(), |
77 | * and it should at least be aligned to NETDEV_ALIGN */ | 74 | * and it should at least be aligned to NETDEV_ALIGN */ |
78 | struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN))); | 75 | struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN))); |
@@ -388,14 +385,11 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
388 | void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev); | 385 | void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev); |
389 | 386 | ||
390 | struct ieee80211_channel * | 387 | struct ieee80211_channel * |
391 | rdev_fixed_channel(struct cfg80211_registered_device *rdev, | ||
392 | struct wireless_dev *for_wdev); | ||
393 | struct ieee80211_channel * | ||
394 | rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | 388 | rdev_freq_to_chan(struct cfg80211_registered_device *rdev, |
395 | int freq, enum nl80211_channel_type channel_type); | 389 | int freq, enum nl80211_channel_type channel_type); |
396 | int rdev_set_freq(struct cfg80211_registered_device *rdev, | 390 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, |
397 | struct wireless_dev *for_wdev, | 391 | struct wireless_dev *wdev, int freq, |
398 | int freq, enum nl80211_channel_type channel_type); | 392 | enum nl80211_channel_type channel_type); |
399 | 393 | ||
400 | u16 cfg80211_calculate_bitrate(struct rate_info *rate); | 394 | u16 cfg80211_calculate_bitrate(struct rate_info *rate); |
401 | 395 | ||
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 6a5acf750174..adcabba02e20 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -81,15 +81,10 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
81 | struct cfg80211_cached_keys *connkeys) | 81 | struct cfg80211_cached_keys *connkeys) |
82 | { | 82 | { |
83 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 83 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
84 | struct ieee80211_channel *chan; | ||
85 | int err; | 84 | int err; |
86 | 85 | ||
87 | ASSERT_WDEV_LOCK(wdev); | 86 | ASSERT_WDEV_LOCK(wdev); |
88 | 87 | ||
89 | chan = rdev_fixed_channel(rdev, wdev); | ||
90 | if (chan && chan != params->channel) | ||
91 | return -EBUSY; | ||
92 | |||
93 | if (wdev->ssid_len) | 88 | if (wdev->ssid_len) |
94 | return -EALREADY; | 89 | return -EALREADY; |
95 | 90 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 01da83ddcff7..aaa1aad566cd 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -589,6 +589,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
589 | i++; | 589 | i++; |
590 | NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); | 590 | NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); |
591 | } | 591 | } |
592 | CMD(set_channel, SET_CHANNEL); | ||
592 | 593 | ||
593 | #undef CMD | 594 | #undef CMD |
594 | 595 | ||
@@ -689,10 +690,90 @@ static int parse_txq_params(struct nlattr *tb[], | |||
689 | return 0; | 690 | return 0; |
690 | } | 691 | } |
691 | 692 | ||
693 | static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev) | ||
694 | { | ||
695 | /* | ||
696 | * You can only set the channel explicitly for AP, mesh | ||
697 | * and WDS type interfaces; all others have their channel | ||
698 | * managed via their respective "establish a connection" | ||
699 | * command (connect, join, ...) | ||
700 | * | ||
701 | * Monitors are special as they are normally slaved to | ||
702 | * whatever else is going on, so they behave as though | ||
703 | * you tried setting the wiphy channel itself. | ||
704 | */ | ||
705 | return !wdev || | ||
706 | wdev->iftype == NL80211_IFTYPE_AP || | ||
707 | wdev->iftype == NL80211_IFTYPE_WDS || | ||
708 | wdev->iftype == NL80211_IFTYPE_MESH_POINT || | ||
709 | wdev->iftype == NL80211_IFTYPE_MONITOR; | ||
710 | } | ||
711 | |||
712 | static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, | ||
713 | struct wireless_dev *wdev, | ||
714 | struct genl_info *info) | ||
715 | { | ||
716 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | ||
717 | u32 freq; | ||
718 | int result; | ||
719 | |||
720 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) | ||
721 | return -EINVAL; | ||
722 | |||
723 | if (!nl80211_can_set_dev_channel(wdev)) | ||
724 | return -EOPNOTSUPP; | ||
725 | |||
726 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { | ||
727 | channel_type = nla_get_u32(info->attrs[ | ||
728 | NL80211_ATTR_WIPHY_CHANNEL_TYPE]); | ||
729 | if (channel_type != NL80211_CHAN_NO_HT && | ||
730 | channel_type != NL80211_CHAN_HT20 && | ||
731 | channel_type != NL80211_CHAN_HT40PLUS && | ||
732 | channel_type != NL80211_CHAN_HT40MINUS) | ||
733 | return -EINVAL; | ||
734 | } | ||
735 | |||
736 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | ||
737 | |||
738 | mutex_lock(&rdev->devlist_mtx); | ||
739 | if (wdev) { | ||
740 | wdev_lock(wdev); | ||
741 | result = cfg80211_set_freq(rdev, wdev, freq, channel_type); | ||
742 | wdev_unlock(wdev); | ||
743 | } else { | ||
744 | result = cfg80211_set_freq(rdev, NULL, freq, channel_type); | ||
745 | } | ||
746 | mutex_unlock(&rdev->devlist_mtx); | ||
747 | |||
748 | return result; | ||
749 | } | ||
750 | |||
751 | static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) | ||
752 | { | ||
753 | struct cfg80211_registered_device *rdev; | ||
754 | struct net_device *netdev; | ||
755 | int result; | ||
756 | |||
757 | rtnl_lock(); | ||
758 | |||
759 | result = get_rdev_dev_by_info_ifindex(info, &rdev, &netdev); | ||
760 | if (result) | ||
761 | goto unlock; | ||
762 | |||
763 | result = __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); | ||
764 | |||
765 | unlock: | ||
766 | rtnl_unlock(); | ||
767 | |||
768 | return result; | ||
769 | } | ||
770 | |||
692 | static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | 771 | static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) |
693 | { | 772 | { |
694 | struct cfg80211_registered_device *rdev; | 773 | struct cfg80211_registered_device *rdev; |
695 | int result = 0, rem_txq_params = 0; | 774 | struct net_device *netdev = NULL; |
775 | struct wireless_dev *wdev; | ||
776 | int result, rem_txq_params = 0; | ||
696 | struct nlattr *nl_txq_params; | 777 | struct nlattr *nl_txq_params; |
697 | u32 changed; | 778 | u32 changed; |
698 | u8 retry_short = 0, retry_long = 0; | 779 | u8 retry_short = 0, retry_long = 0; |
@@ -701,16 +782,50 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
701 | 782 | ||
702 | rtnl_lock(); | 783 | rtnl_lock(); |
703 | 784 | ||
785 | /* | ||
786 | * Try to find the wiphy and netdev. Normally this | ||
787 | * function shouldn't need the netdev, but this is | ||
788 | * done for backward compatibility -- previously | ||
789 | * setting the channel was done per wiphy, but now | ||
790 | * it is per netdev. Previous userland like hostapd | ||
791 | * also passed a netdev to set_wiphy, so that it is | ||
792 | * possible to let that go to the right netdev! | ||
793 | */ | ||
704 | mutex_lock(&cfg80211_mutex); | 794 | mutex_lock(&cfg80211_mutex); |
705 | 795 | ||
706 | rdev = __cfg80211_rdev_from_info(info); | 796 | if (info->attrs[NL80211_ATTR_IFINDEX]) { |
707 | if (IS_ERR(rdev)) { | 797 | int ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); |
708 | mutex_unlock(&cfg80211_mutex); | 798 | |
709 | result = PTR_ERR(rdev); | 799 | netdev = dev_get_by_index(genl_info_net(info), ifindex); |
710 | goto unlock; | 800 | if (netdev && netdev->ieee80211_ptr) { |
801 | rdev = wiphy_to_dev(netdev->ieee80211_ptr->wiphy); | ||
802 | mutex_lock(&rdev->mtx); | ||
803 | } else | ||
804 | netdev = NULL; | ||
711 | } | 805 | } |
712 | 806 | ||
713 | mutex_lock(&rdev->mtx); | 807 | if (!netdev) { |
808 | rdev = __cfg80211_rdev_from_info(info); | ||
809 | if (IS_ERR(rdev)) { | ||
810 | mutex_unlock(&cfg80211_mutex); | ||
811 | result = PTR_ERR(rdev); | ||
812 | goto unlock; | ||
813 | } | ||
814 | wdev = NULL; | ||
815 | netdev = NULL; | ||
816 | result = 0; | ||
817 | |||
818 | mutex_lock(&rdev->mtx); | ||
819 | } else if (netif_running(netdev) && | ||
820 | nl80211_can_set_dev_channel(netdev->ieee80211_ptr)) | ||
821 | wdev = netdev->ieee80211_ptr; | ||
822 | else | ||
823 | wdev = NULL; | ||
824 | |||
825 | /* | ||
826 | * end workaround code, by now the rdev is available | ||
827 | * and locked, and wdev may or may not be NULL. | ||
828 | */ | ||
714 | 829 | ||
715 | if (info->attrs[NL80211_ATTR_WIPHY_NAME]) | 830 | if (info->attrs[NL80211_ATTR_WIPHY_NAME]) |
716 | result = cfg80211_dev_rename( | 831 | result = cfg80211_dev_rename( |
@@ -749,26 +864,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
749 | } | 864 | } |
750 | 865 | ||
751 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { | 866 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { |
752 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | 867 | result = __nl80211_set_channel(rdev, wdev, info); |
753 | u32 freq; | ||
754 | |||
755 | result = -EINVAL; | ||
756 | |||
757 | if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { | ||
758 | channel_type = nla_get_u32(info->attrs[ | ||
759 | NL80211_ATTR_WIPHY_CHANNEL_TYPE]); | ||
760 | if (channel_type != NL80211_CHAN_NO_HT && | ||
761 | channel_type != NL80211_CHAN_HT20 && | ||
762 | channel_type != NL80211_CHAN_HT40PLUS && | ||
763 | channel_type != NL80211_CHAN_HT40MINUS) | ||
764 | goto bad_res; | ||
765 | } | ||
766 | |||
767 | freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); | ||
768 | |||
769 | mutex_lock(&rdev->devlist_mtx); | ||
770 | result = rdev_set_freq(rdev, NULL, freq, channel_type); | ||
771 | mutex_unlock(&rdev->devlist_mtx); | ||
772 | if (result) | 868 | if (result) |
773 | goto bad_res; | 869 | goto bad_res; |
774 | } | 870 | } |
@@ -865,6 +961,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
865 | 961 | ||
866 | bad_res: | 962 | bad_res: |
867 | mutex_unlock(&rdev->mtx); | 963 | mutex_unlock(&rdev->mtx); |
964 | if (netdev) | ||
965 | dev_put(netdev); | ||
868 | unlock: | 966 | unlock: |
869 | rtnl_unlock(); | 967 | rtnl_unlock(); |
870 | return result; | 968 | return result; |
@@ -3562,9 +3660,8 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
3562 | { | 3660 | { |
3563 | struct cfg80211_registered_device *rdev; | 3661 | struct cfg80211_registered_device *rdev; |
3564 | struct net_device *dev; | 3662 | struct net_device *dev; |
3565 | struct wireless_dev *wdev; | ||
3566 | struct cfg80211_crypto_settings crypto; | 3663 | struct cfg80211_crypto_settings crypto; |
3567 | struct ieee80211_channel *chan, *fixedchan; | 3664 | struct ieee80211_channel *chan; |
3568 | const u8 *bssid, *ssid, *ie = NULL, *prev_bssid = NULL; | 3665 | const u8 *bssid, *ssid, *ie = NULL, *prev_bssid = NULL; |
3569 | int err, ssid_len, ie_len = 0; | 3666 | int err, ssid_len, ie_len = 0; |
3570 | bool use_mfp = false; | 3667 | bool use_mfp = false; |
@@ -3607,16 +3704,6 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) | |||
3607 | goto out; | 3704 | goto out; |
3608 | } | 3705 | } |
3609 | 3706 | ||
3610 | mutex_lock(&rdev->devlist_mtx); | ||
3611 | wdev = dev->ieee80211_ptr; | ||
3612 | fixedchan = rdev_fixed_channel(rdev, wdev); | ||
3613 | if (fixedchan && chan != fixedchan) { | ||
3614 | err = -EBUSY; | ||
3615 | mutex_unlock(&rdev->devlist_mtx); | ||
3616 | goto out; | ||
3617 | } | ||
3618 | mutex_unlock(&rdev->devlist_mtx); | ||
3619 | |||
3620 | ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); | 3707 | ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); |
3621 | ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); | 3708 | ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); |
3622 | 3709 | ||
@@ -5186,6 +5273,12 @@ static struct genl_ops nl80211_ops[] = { | |||
5186 | .policy = nl80211_policy, | 5273 | .policy = nl80211_policy, |
5187 | .flags = GENL_ADMIN_PERM, | 5274 | .flags = GENL_ADMIN_PERM, |
5188 | }, | 5275 | }, |
5276 | { | ||
5277 | .cmd = NL80211_CMD_SET_CHANNEL, | ||
5278 | .doit = nl80211_set_channel, | ||
5279 | .policy = nl80211_policy, | ||
5280 | .flags = GENL_ADMIN_PERM, | ||
5281 | }, | ||
5189 | }; | 5282 | }; |
5190 | 5283 | ||
5191 | static struct genl_multicast_group nl80211_mlme_mcgrp = { | 5284 | static struct genl_multicast_group nl80211_mlme_mcgrp = { |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 8ddf5ae0dd03..72222f0074db 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -741,7 +741,6 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
741 | const u8 *prev_bssid) | 741 | const u8 *prev_bssid) |
742 | { | 742 | { |
743 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 743 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
744 | struct ieee80211_channel *chan; | ||
745 | struct cfg80211_bss *bss = NULL; | 744 | struct cfg80211_bss *bss = NULL; |
746 | int err; | 745 | int err; |
747 | 746 | ||
@@ -750,10 +749,6 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
750 | if (wdev->sme_state != CFG80211_SME_IDLE) | 749 | if (wdev->sme_state != CFG80211_SME_IDLE) |
751 | return -EALREADY; | 750 | return -EALREADY; |
752 | 751 | ||
753 | chan = rdev_fixed_channel(rdev, wdev); | ||
754 | if (chan && chan != connect->channel) | ||
755 | return -EBUSY; | ||
756 | |||
757 | if (WARN_ON(wdev->connect_keys)) { | 752 | if (WARN_ON(wdev->connect_keys)) { |
758 | kfree(wdev->connect_keys); | 753 | kfree(wdev->connect_keys); |
759 | wdev->connect_keys = NULL; | 754 | wdev->connect_keys = NULL; |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index a60a2773b497..96342993cf93 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -782,16 +782,22 @@ int cfg80211_wext_siwfreq(struct net_device *dev, | |||
782 | return cfg80211_mgd_wext_siwfreq(dev, info, wextfreq, extra); | 782 | return cfg80211_mgd_wext_siwfreq(dev, info, wextfreq, extra); |
783 | case NL80211_IFTYPE_ADHOC: | 783 | case NL80211_IFTYPE_ADHOC: |
784 | return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra); | 784 | return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra); |
785 | default: | 785 | case NL80211_IFTYPE_MONITOR: |
786 | case NL80211_IFTYPE_WDS: | ||
787 | case NL80211_IFTYPE_MESH_POINT: | ||
786 | freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); | 788 | freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); |
787 | if (freq < 0) | 789 | if (freq < 0) |
788 | return freq; | 790 | return freq; |
789 | if (freq == 0) | 791 | if (freq == 0) |
790 | return -EINVAL; | 792 | return -EINVAL; |
793 | wdev_lock(wdev); | ||
791 | mutex_lock(&rdev->devlist_mtx); | 794 | mutex_lock(&rdev->devlist_mtx); |
792 | err = rdev_set_freq(rdev, NULL, freq, NL80211_CHAN_NO_HT); | 795 | err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); |
793 | mutex_unlock(&rdev->devlist_mtx); | 796 | mutex_unlock(&rdev->devlist_mtx); |
797 | wdev_unlock(wdev); | ||
794 | return err; | 798 | return err; |
799 | default: | ||
800 | return -EOPNOTSUPP; | ||
795 | } | 801 | } |
796 | } | 802 | } |
797 | EXPORT_SYMBOL_GPL(cfg80211_wext_siwfreq); | 803 | EXPORT_SYMBOL_GPL(cfg80211_wext_siwfreq); |
@@ -801,7 +807,6 @@ int cfg80211_wext_giwfreq(struct net_device *dev, | |||
801 | struct iw_freq *freq, char *extra) | 807 | struct iw_freq *freq, char *extra) |
802 | { | 808 | { |
803 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 809 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
804 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | ||
805 | 810 | ||
806 | switch (wdev->iftype) { | 811 | switch (wdev->iftype) { |
807 | case NL80211_IFTYPE_STATION: | 812 | case NL80211_IFTYPE_STATION: |
@@ -809,9 +814,9 @@ int cfg80211_wext_giwfreq(struct net_device *dev, | |||
809 | case NL80211_IFTYPE_ADHOC: | 814 | case NL80211_IFTYPE_ADHOC: |
810 | return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); | 815 | return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); |
811 | default: | 816 | default: |
812 | if (!rdev->channel) | 817 | if (!wdev->channel) |
813 | return -EINVAL; | 818 | return -EINVAL; |
814 | freq->m = rdev->channel->center_freq; | 819 | freq->m = wdev->channel->center_freq; |
815 | freq->e = 6; | 820 | freq->e = 6; |
816 | return 0; | 821 | return 0; |
817 | } | 822 | } |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index d5c6140f4cb8..9818198add8a 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -108,7 +108,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
108 | 108 | ||
109 | /* SSID is not set, we just want to switch channel */ | 109 | /* SSID is not set, we just want to switch channel */ |
110 | if (chan && !wdev->wext.connect.ssid_len) { | 110 | if (chan && !wdev->wext.connect.ssid_len) { |
111 | err = rdev_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); | 111 | err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); |
112 | goto out; | 112 | goto out; |
113 | } | 113 | } |
114 | 114 | ||