aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-27 06:01:50 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-29 15:46:14 -0400
commit0e82ffe3b90bcad72cfe80e4379946b8fb0691ca (patch)
treec6b73524d4db86ddcaa866d7ea81a9600b610413 /net/mac80211/wext.c
parenta7bc376c858e0e724b8cb2db09b6874562d377ca (diff)
cfg80211: combine iwfreq implementations
Until now we implemented iwfreq for managed mode, we needed to keep the implementations separate, but now that we have all versions implemented we can combine them and export just one handler. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c73
1 files changed, 2 insertions, 71 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 5acb8140ee58..7cd9aa79ef52 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -27,75 +27,6 @@
27#include "aes_ccm.h" 27#include "aes_ccm.h"
28 28
29 29
30static int ieee80211_ioctl_siwfreq(struct net_device *dev,
31 struct iw_request_info *info,
32 struct iw_freq *freq, char *extra)
33{
34 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
35 struct ieee80211_local *local = sdata->local;
36 struct ieee80211_channel *chan;
37
38 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
39 return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
40 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
41 return cfg80211_mgd_wext_siwfreq(dev, info, freq, extra);
42
43 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
44 if (freq->e == 0) {
45 if (freq->m < 0)
46 return -EINVAL;
47 else
48 chan = ieee80211_get_channel(local->hw.wiphy,
49 ieee80211_channel_to_frequency(freq->m));
50 } else {
51 int i, div = 1000000;
52 for (i = 0; i < freq->e; i++)
53 div /= 10;
54 if (div <= 0)
55 return -EINVAL;
56 chan = ieee80211_get_channel(local->hw.wiphy, freq->m / div);
57 }
58
59 if (!chan)
60 return -EINVAL;
61
62 if (chan->flags & IEEE80211_CHAN_DISABLED)
63 return -EINVAL;
64
65 /*
66 * no change except maybe auto -> fixed, ignore the HT
67 * setting so you can fix a channel you're on already
68 */
69 if (local->oper_channel == chan)
70 return 0;
71
72 local->oper_channel = chan;
73 local->oper_channel_type = NL80211_CHAN_NO_HT;
74 ieee80211_hw_config(local, 0);
75
76 return 0;
77}
78
79
80static int ieee80211_ioctl_giwfreq(struct net_device *dev,
81 struct iw_request_info *info,
82 struct iw_freq *freq, char *extra)
83{
84 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
85 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
86
87 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
88 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
89 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
90 return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
91
92 freq->m = local->oper_channel->center_freq;
93 freq->e = 6;
94
95 return 0;
96}
97
98
99static int ieee80211_ioctl_siwessid(struct net_device *dev, 30static int ieee80211_ioctl_siwessid(struct net_device *dev,
100 struct iw_request_info *info, 31 struct iw_request_info *info,
101 struct iw_point *data, char *ssid) 32 struct iw_point *data, char *ssid)
@@ -173,8 +104,8 @@ static const iw_handler ieee80211_handler[] =
173 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */ 104 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
174 (iw_handler) NULL, /* SIOCSIWNWID */ 105 (iw_handler) NULL, /* SIOCSIWNWID */
175 (iw_handler) NULL, /* SIOCGIWNWID */ 106 (iw_handler) NULL, /* SIOCGIWNWID */
176 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ 107 (iw_handler) cfg80211_wext_siwfreq, /* SIOCSIWFREQ */
177 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ 108 (iw_handler) cfg80211_wext_giwfreq, /* SIOCGIWFREQ */
178 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */ 109 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
179 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */ 110 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
180 (iw_handler) NULL, /* SIOCSIWSENS */ 111 (iw_handler) NULL, /* SIOCSIWSENS */