blob: c3c90d5963bfec802afaef9ee5d7401b2a7f7d18 [file] [log] [blame]
Zhu Yibb9f8692009-05-21 21:20:45 +08001/*
2 * Intel Wireless Multicomm 3200 WiFi driver
3 *
4 * Copyright (C) 2009 Intel Corporation <ilw@linux.intel.com>
5 * Samuel Ortiz <samuel.ortiz@intel.com>
6 * Zhu Yi <yi.zhu@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *
22 */
23
Zhu Yibb9f8692009-05-21 21:20:45 +080024#include <linux/wireless.h>
Zhu Yibb9f8692009-05-21 21:20:45 +080025#include <net/cfg80211.h>
Zhu Yibb9f8692009-05-21 21:20:45 +080026
27#include "iwm.h"
Zhu Yibb9f8692009-05-21 21:20:45 +080028#include "commands.h"
Zhu Yibb9f8692009-05-21 21:20:45 +080029
30static int iwm_wext_siwfreq(struct net_device *dev,
31 struct iw_request_info *info,
32 struct iw_freq *freq, char *extra)
33{
34 struct iwm_priv *iwm = ndev_to_iwm(dev);
35
Samuel Ortiz9967d462009-07-16 17:34:10 +080036 switch (iwm->conf.mode) {
37 case UMAC_MODE_IBSS:
38 return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
39 default:
Zhu Yibb9f8692009-05-21 21:20:45 +080040 return -EOPNOTSUPP;
Samuel Ortiz9967d462009-07-16 17:34:10 +080041 }
Zhu Yibb9f8692009-05-21 21:20:45 +080042}
43
44static int iwm_wext_giwfreq(struct net_device *dev,
45 struct iw_request_info *info,
46 struct iw_freq *freq, char *extra)
47{
48 struct iwm_priv *iwm = ndev_to_iwm(dev);
49
Samuel Ortiz9967d462009-07-16 17:34:10 +080050 switch (iwm->conf.mode) {
51 case UMAC_MODE_IBSS:
Zhu Yibb9f8692009-05-21 21:20:45 +080052 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
Samuel Ortiz9967d462009-07-16 17:34:10 +080053 case UMAC_MODE_BSS:
54 return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
55 default:
56 return -EOPNOTSUPP;
57 }
Zhu Yibb9f8692009-05-21 21:20:45 +080058}
59
60static int iwm_wext_siwap(struct net_device *dev, struct iw_request_info *info,
61 struct sockaddr *ap_addr, char *extra)
62{
63 struct iwm_priv *iwm = ndev_to_iwm(dev);
64
Samuel Ortiz9967d462009-07-16 17:34:10 +080065 switch (iwm->conf.mode) {
66 case UMAC_MODE_IBSS:
Zhu Yibb9f8692009-05-21 21:20:45 +080067 return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
Samuel Ortiz9967d462009-07-16 17:34:10 +080068 case UMAC_MODE_BSS:
69 return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
70 default:
71 return -EOPNOTSUPP;
Zhu Yibb9f8692009-05-21 21:20:45 +080072 }
Zhu Yibb9f8692009-05-21 21:20:45 +080073}
74
75static int iwm_wext_giwap(struct net_device *dev, struct iw_request_info *info,
76 struct sockaddr *ap_addr, char *extra)
77{
78 struct iwm_priv *iwm = ndev_to_iwm(dev);
79
80 switch (iwm->conf.mode) {
81 case UMAC_MODE_IBSS:
82 return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
83 case UMAC_MODE_BSS:
Samuel Ortiz9967d462009-07-16 17:34:10 +080084 return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
Zhu Yibb9f8692009-05-21 21:20:45 +080085 default:
86 return -EOPNOTSUPP;
87 }
Zhu Yibb9f8692009-05-21 21:20:45 +080088}
89
90static int iwm_wext_siwessid(struct net_device *dev,
91 struct iw_request_info *info,
92 struct iw_point *data, char *ssid)
93{
94 struct iwm_priv *iwm = ndev_to_iwm(dev);
Zhu Yibb9f8692009-05-21 21:20:45 +080095
Samuel Ortiz9967d462009-07-16 17:34:10 +080096 switch (iwm->conf.mode) {
97 case UMAC_MODE_IBSS:
Zhu Yibb9f8692009-05-21 21:20:45 +080098 return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
Samuel Ortiz9967d462009-07-16 17:34:10 +080099 case UMAC_MODE_BSS:
100 return cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
101 default:
102 return -EOPNOTSUPP;
Zhu Yibb9f8692009-05-21 21:20:45 +0800103 }
Zhu Yibb9f8692009-05-21 21:20:45 +0800104}
105
106static int iwm_wext_giwessid(struct net_device *dev,
107 struct iw_request_info *info,
108 struct iw_point *data, char *ssid)
109{
110 struct iwm_priv *iwm = ndev_to_iwm(dev);
111
Samuel Ortiz9967d462009-07-16 17:34:10 +0800112 switch (iwm->conf.mode) {
113 case UMAC_MODE_IBSS:
Zhu Yibb9f8692009-05-21 21:20:45 +0800114 return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
Samuel Ortiz9967d462009-07-16 17:34:10 +0800115 case UMAC_MODE_BSS:
116 return cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
Zhu Yibb9f8692009-05-21 21:20:45 +0800117 default:
Samuel Ortiz9967d462009-07-16 17:34:10 +0800118 return -EOPNOTSUPP;
Zhu Yibb9f8692009-05-21 21:20:45 +0800119 }
Zhu Yibb9f8692009-05-21 21:20:45 +0800120}
121
Zhu Yibb9f8692009-05-21 21:20:45 +0800122static const iw_handler iwm_handlers[] =
123{
124 (iw_handler) NULL, /* SIOCSIWCOMMIT */
125 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
126 (iw_handler) NULL, /* SIOCSIWNWID */
127 (iw_handler) NULL, /* SIOCGIWNWID */
128 (iw_handler) iwm_wext_siwfreq, /* SIOCSIWFREQ */
129 (iw_handler) iwm_wext_giwfreq, /* SIOCGIWFREQ */
130 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
131 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
132 (iw_handler) NULL, /* SIOCSIWSENS */
133 (iw_handler) NULL, /* SIOCGIWSENS */
134 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
135 (iw_handler) cfg80211_wext_giwrange, /* SIOCGIWRANGE */
136 (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
137 (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
138 (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
139 (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
140 (iw_handler) NULL, /* SIOCSIWSPY */
141 (iw_handler) NULL, /* SIOCGIWSPY */
142 (iw_handler) NULL, /* SIOCSIWTHRSPY */
143 (iw_handler) NULL, /* SIOCGIWTHRSPY */
144 (iw_handler) iwm_wext_siwap, /* SIOCSIWAP */
145 (iw_handler) iwm_wext_giwap, /* SIOCGIWAP */
146 (iw_handler) NULL, /* SIOCSIWMLME */
147 (iw_handler) NULL, /* SIOCGIWAPLIST */
148 (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */
149 (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */
150 (iw_handler) iwm_wext_siwessid, /* SIOCSIWESSID */
151 (iw_handler) iwm_wext_giwessid, /* SIOCGIWESSID */
152 (iw_handler) NULL, /* SIOCSIWNICKN */
153 (iw_handler) NULL, /* SIOCGIWNICKN */
154 (iw_handler) NULL, /* -- hole -- */
155 (iw_handler) NULL, /* -- hole -- */
156 (iw_handler) NULL, /* SIOCSIWRATE */
Samuel Ortiz9967d462009-07-16 17:34:10 +0800157 (iw_handler) cfg80211_wext_giwrate, /* SIOCGIWRATE */
Zhu Yibb9f8692009-05-21 21:20:45 +0800158 (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */
159 (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */
160 (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */
161 (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */
Zhu Yi257862f2009-06-15 21:59:56 +0200162 (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */
163 (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */
Zhu Yibb9f8692009-05-21 21:20:45 +0800164 (iw_handler) NULL, /* SIOCSIWRETRY */
165 (iw_handler) NULL, /* SIOCGIWRETRY */
Samuel Ortiz13e0fe72009-06-15 21:59:52 +0200166 (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */
167 (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */
Johannes Bergbc92afd2009-07-01 21:26:57 +0200168 (iw_handler) cfg80211_wext_siwpower, /* SIOCSIWPOWER */
169 (iw_handler) cfg80211_wext_giwpower, /* SIOCGIWPOWER */
Zhu Yibb9f8692009-05-21 21:20:45 +0800170 (iw_handler) NULL, /* -- hole -- */
171 (iw_handler) NULL, /* -- hole -- */
Samuel Ortiz9967d462009-07-16 17:34:10 +0800172 (iw_handler) cfg80211_wext_siwgenie, /* SIOCSIWGENIE */
Zhu Yibb9f8692009-05-21 21:20:45 +0800173 (iw_handler) NULL, /* SIOCGIWGENIE */
Samuel Ortiz9967d462009-07-16 17:34:10 +0800174 (iw_handler) cfg80211_wext_siwauth, /* SIOCSIWAUTH */
175 (iw_handler) cfg80211_wext_giwauth, /* SIOCGIWAUTH */
Samuel Ortiz13e0fe72009-06-15 21:59:52 +0200176 (iw_handler) cfg80211_wext_siwencodeext, /* SIOCSIWENCODEEXT */
Zhu Yibb9f8692009-05-21 21:20:45 +0800177 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
178 (iw_handler) NULL, /* SIOCSIWPMKSA */
179 (iw_handler) NULL, /* -- hole -- */
180};
181
182const struct iw_handler_def iwm_iw_handler_def = {
183 .num_standard = ARRAY_SIZE(iwm_handlers),
184 .standard = (iw_handler *) iwm_handlers,
Samuel Ortiz9967d462009-07-16 17:34:10 +0800185 .get_wireless_stats = cfg80211_wireless_stats,
Zhu Yibb9f8692009-05-21 21:20:45 +0800186};
187