diff options
author | John W. Linville <linville@tuxdriver.com> | 2009-08-25 14:12:25 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-23 17:05:26 -0500 |
commit | a3caa99e6c68f466c13cfea74097f6fb01b45e25 (patch) | |
tree | e5dae94b31a4ab78abb505a4fd26329e690d177b /drivers/net/wireless/ipw2x00/libipw_module.c | |
parent | 9f13084d52d40dcce5a5f00586410acdb5a3fbff (diff) |
libipw: initiate cfg80211 API conversion (v2)
Initiate the conversion of libipw to the new cfg80211 configuration API.
For now, leave CONFIG_IPW2200_PROMISCUOUS stuff alone. Eventually
migrate it to cfg80211 when the add/del/change_virtual_intf methods
are implemented.
(v2: Fix unconditional wiphy_unregister in libipw which was causing
problems for ipw2100, somewhat based on prior attempted fix
by Zhu Yi <yi.zhu@intel.com>. Previously both original version of
this patch and Zhu Yi's fix attempt were reverted due to
discovery of regressions. -- JWL)
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2x00/libipw_module.c')
-rw-r--r-- | drivers/net/wireless/ipw2x00/libipw_module.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c index eb2b60834c17..e8a1ac5f8e11 100644 --- a/drivers/net/wireless/ipw2x00/libipw_module.c +++ b/drivers/net/wireless/ipw2x00/libipw_module.c | |||
@@ -62,6 +62,9 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION); | |||
62 | MODULE_AUTHOR(DRV_COPYRIGHT); | 62 | MODULE_AUTHOR(DRV_COPYRIGHT); |
63 | MODULE_LICENSE("GPL"); | 63 | MODULE_LICENSE("GPL"); |
64 | 64 | ||
65 | struct cfg80211_ops libipw_config_ops = { }; | ||
66 | void *libipw_wiphy_privid = &libipw_wiphy_privid; | ||
67 | |||
65 | static int libipw_networks_allocate(struct libipw_device *ieee) | 68 | static int libipw_networks_allocate(struct libipw_device *ieee) |
66 | { | 69 | { |
67 | if (ieee->networks) | 70 | if (ieee->networks) |
@@ -140,7 +143,7 @@ int libipw_change_mtu(struct net_device *dev, int new_mtu) | |||
140 | } | 143 | } |
141 | EXPORT_SYMBOL(libipw_change_mtu); | 144 | EXPORT_SYMBOL(libipw_change_mtu); |
142 | 145 | ||
143 | struct net_device *alloc_ieee80211(int sizeof_priv) | 146 | struct net_device *alloc_ieee80211(int sizeof_priv, int monitor) |
144 | { | 147 | { |
145 | struct libipw_device *ieee; | 148 | struct libipw_device *ieee; |
146 | struct net_device *dev; | 149 | struct net_device *dev; |
@@ -157,10 +160,31 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
157 | 160 | ||
158 | ieee->dev = dev; | 161 | ieee->dev = dev; |
159 | 162 | ||
163 | if (!monitor) { | ||
164 | ieee->wdev.wiphy = wiphy_new(&libipw_config_ops, 0); | ||
165 | if (!ieee->wdev.wiphy) { | ||
166 | LIBIPW_ERROR("Unable to allocate wiphy.\n"); | ||
167 | goto failed_free_netdev; | ||
168 | } | ||
169 | |||
170 | ieee->dev->ieee80211_ptr = &ieee->wdev; | ||
171 | ieee->wdev.iftype = NL80211_IFTYPE_STATION; | ||
172 | |||
173 | /* Fill-out wiphy structure bits we know... Not enough info | ||
174 | here to call set_wiphy_dev or set MAC address or channel info | ||
175 | -- have to do that in ->ndo_init... */ | ||
176 | ieee->wdev.wiphy->privid = libipw_wiphy_privid; | ||
177 | |||
178 | ieee->wdev.wiphy->max_scan_ssids = 1; | ||
179 | ieee->wdev.wiphy->max_scan_ie_len = 0; | ||
180 | ieee->wdev.wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | ||
181 | | BIT(NL80211_IFTYPE_ADHOC); | ||
182 | } | ||
183 | |||
160 | err = libipw_networks_allocate(ieee); | 184 | err = libipw_networks_allocate(ieee); |
161 | if (err) { | 185 | if (err) { |
162 | LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err); | 186 | LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err); |
163 | goto failed_free_netdev; | 187 | goto failed_free_wiphy; |
164 | } | 188 | } |
165 | libipw_networks_initialize(ieee); | 189 | libipw_networks_initialize(ieee); |
166 | 190 | ||
@@ -193,19 +217,27 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
193 | 217 | ||
194 | return dev; | 218 | return dev; |
195 | 219 | ||
220 | failed_free_wiphy: | ||
221 | if (!monitor) | ||
222 | wiphy_free(ieee->wdev.wiphy); | ||
196 | failed_free_netdev: | 223 | failed_free_netdev: |
197 | free_netdev(dev); | 224 | free_netdev(dev); |
198 | failed: | 225 | failed: |
199 | return NULL; | 226 | return NULL; |
200 | } | 227 | } |
201 | 228 | ||
202 | void free_ieee80211(struct net_device *dev) | 229 | void free_ieee80211(struct net_device *dev, int monitor) |
203 | { | 230 | { |
204 | struct libipw_device *ieee = netdev_priv(dev); | 231 | struct libipw_device *ieee = netdev_priv(dev); |
205 | 232 | ||
206 | lib80211_crypt_info_free(&ieee->crypt_info); | 233 | lib80211_crypt_info_free(&ieee->crypt_info); |
207 | 234 | ||
208 | libipw_networks_free(ieee); | 235 | libipw_networks_free(ieee); |
236 | |||
237 | /* free cfg80211 resources */ | ||
238 | if (!monitor) | ||
239 | wiphy_free(ieee->wdev.wiphy); | ||
240 | |||
209 | free_netdev(dev); | 241 | free_netdev(dev); |
210 | } | 242 | } |
211 | 243 | ||