aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2009-11-13 16:56:13 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-13 17:33:48 -0500
commit8cc3174ef98fbb317d9ee18e20102908ff7faffc (patch)
treec5b22434cdb51beaf548542d24c5e9301499b930 /drivers/net
parentd01032e4fd33110f9f3a085a36cb819c1dfc5827 (diff)
Revert "libipw: initiate cfg80211 API conversion"
This reverts commit b8ecd988b1670035a05035c553c08331214d6603. Due to poor API call balancing by me, this commit not only broke ipw2200 if it can't find it's firmware, it broke ipw2100 basically anytime you removed the module. At this point in the cycle, let's just put it back to a sane state and try again next time... Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c6
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c141
-rw-r--r--drivers/net/wireless/ipw2x00/libipw.h8
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_module.c42
4 files changed, 36 insertions, 161 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 240cff1e6979..6e2fc0cb6f8a 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -6029,7 +6029,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6029 struct ipw2100_priv *priv; 6029 struct ipw2100_priv *priv;
6030 struct net_device *dev; 6030 struct net_device *dev;
6031 6031
6032 dev = alloc_ieee80211(sizeof(struct ipw2100_priv), 0); 6032 dev = alloc_ieee80211(sizeof(struct ipw2100_priv));
6033 if (!dev) 6033 if (!dev)
6034 return NULL; 6034 return NULL;
6035 priv = libipw_priv(dev); 6035 priv = libipw_priv(dev);
@@ -6342,7 +6342,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6342 sysfs_remove_group(&pci_dev->dev.kobj, 6342 sysfs_remove_group(&pci_dev->dev.kobj,
6343 &ipw2100_attribute_group); 6343 &ipw2100_attribute_group);
6344 6344
6345 free_ieee80211(dev, 0); 6345 free_ieee80211(dev);
6346 pci_set_drvdata(pci_dev, NULL); 6346 pci_set_drvdata(pci_dev, NULL);
6347 } 6347 }
6348 6348
@@ -6400,7 +6400,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6400 if (dev->base_addr) 6400 if (dev->base_addr)
6401 iounmap((void __iomem *)dev->base_addr); 6401 iounmap((void __iomem *)dev->base_addr);
6402 6402
6403 free_ieee80211(dev, 0); 6403 free_ieee80211(dev);
6404 } 6404 }
6405 6405
6406 pci_release_regions(pci_dev); 6406 pci_release_regions(pci_dev);
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 8d58e6ed4e7d..0d30a9e2d3df 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -103,25 +103,6 @@ static int antenna = CFG_SYS_ANTENNA_BOTH;
103static int rtap_iface = 0; /* def: 0 -- do not create rtap interface */ 103static int rtap_iface = 0; /* def: 0 -- do not create rtap interface */
104#endif 104#endif
105 105
106static struct ieee80211_rate ipw2200_rates[] = {
107 { .bitrate = 10 },
108 { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
109 { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
110 { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE },
111 { .bitrate = 60 },
112 { .bitrate = 90 },
113 { .bitrate = 120 },
114 { .bitrate = 180 },
115 { .bitrate = 240 },
116 { .bitrate = 360 },
117 { .bitrate = 480 },
118 { .bitrate = 540 }
119};
120
121#define ipw2200_a_rates (ipw2200_rates + 4)
122#define ipw2200_num_a_rates 8
123#define ipw2200_bg_rates (ipw2200_rates + 0)
124#define ipw2200_num_bg_rates 12
125 106
126#ifdef CONFIG_IPW2200_QOS 107#ifdef CONFIG_IPW2200_QOS
127static int qos_enable = 0; 108static int qos_enable = 0;
@@ -8673,6 +8654,24 @@ static int ipw_sw_reset(struct ipw_priv *priv, int option)
8673 * 8654 *
8674 */ 8655 */
8675 8656
8657static int ipw_wx_get_name(struct net_device *dev,
8658 struct iw_request_info *info,
8659 union iwreq_data *wrqu, char *extra)
8660{
8661 struct ipw_priv *priv = libipw_priv(dev);
8662 mutex_lock(&priv->mutex);
8663 if (priv->status & STATUS_RF_KILL_MASK)
8664 strcpy(wrqu->name, "radio off");
8665 else if (!(priv->status & STATUS_ASSOCIATED))
8666 strcpy(wrqu->name, "unassociated");
8667 else
8668 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c",
8669 ipw_modes[priv->assoc_request.ieee_mode]);
8670 IPW_DEBUG_WX("Name: %s\n", wrqu->name);
8671 mutex_unlock(&priv->mutex);
8672 return 0;
8673}
8674
8676static int ipw_set_channel(struct ipw_priv *priv, u8 channel) 8675static int ipw_set_channel(struct ipw_priv *priv, u8 channel)
8677{ 8676{
8678 if (channel == 0) { 8677 if (channel == 0) {
@@ -9972,7 +9971,7 @@ static int ipw_wx_sw_reset(struct net_device *dev,
9972/* Rebase the WE IOCTLs to zero for the handler array */ 9971/* Rebase the WE IOCTLs to zero for the handler array */
9973#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] 9972#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
9974static iw_handler ipw_wx_handlers[] = { 9973static iw_handler ipw_wx_handlers[] = {
9975 IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname, 9974 IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name,
9976 IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, 9975 IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq,
9977 IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, 9976 IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq,
9978 IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, 9977 IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode,
@@ -11416,100 +11415,16 @@ static void ipw_bg_down(struct work_struct *work)
11416/* Called by register_netdev() */ 11415/* Called by register_netdev() */
11417static int ipw_net_init(struct net_device *dev) 11416static int ipw_net_init(struct net_device *dev)
11418{ 11417{
11419 int i, rc = 0;
11420 struct ipw_priv *priv = libipw_priv(dev); 11418 struct ipw_priv *priv = libipw_priv(dev);
11421 const struct libipw_geo *geo = libipw_get_geo(priv->ieee);
11422 struct wireless_dev *wdev = &priv->ieee->wdev;
11423 mutex_lock(&priv->mutex); 11419 mutex_lock(&priv->mutex);
11424 11420
11425 if (ipw_up(priv)) { 11421 if (ipw_up(priv)) {
11426 rc = -EIO; 11422 mutex_unlock(&priv->mutex);
11427 goto out; 11423 return -EIO;
11428 }
11429
11430 memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN);
11431
11432 /* fill-out priv->ieee->bg_band */
11433 if (geo->bg_channels) {
11434 struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band;
11435
11436 bg_band->band = IEEE80211_BAND_2GHZ;
11437 bg_band->n_channels = geo->bg_channels;
11438 bg_band->channels =
11439 kzalloc(geo->bg_channels *
11440 sizeof(struct ieee80211_channel), GFP_KERNEL);
11441 /* translate geo->bg to bg_band.channels */
11442 for (i = 0; i < geo->bg_channels; i++) {
11443 bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
11444 bg_band->channels[i].center_freq = geo->bg[i].freq;
11445 bg_band->channels[i].hw_value = geo->bg[i].channel;
11446 bg_band->channels[i].max_power = geo->bg[i].max_power;
11447 if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY)
11448 bg_band->channels[i].flags |=
11449 IEEE80211_CHAN_PASSIVE_SCAN;
11450 if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS)
11451 bg_band->channels[i].flags |=
11452 IEEE80211_CHAN_NO_IBSS;
11453 if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT)
11454 bg_band->channels[i].flags |=
11455 IEEE80211_CHAN_RADAR;
11456 /* No equivalent for LIBIPW_CH_80211H_RULES,
11457 LIBIPW_CH_UNIFORM_SPREADING, or
11458 LIBIPW_CH_B_ONLY... */
11459 }
11460 /* point at bitrate info */
11461 bg_band->bitrates = ipw2200_bg_rates;
11462 bg_band->n_bitrates = ipw2200_num_bg_rates;
11463
11464 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band;
11465 }
11466
11467 /* fill-out priv->ieee->a_band */
11468 if (geo->a_channels) {
11469 struct ieee80211_supported_band *a_band = &priv->ieee->a_band;
11470
11471 a_band->band = IEEE80211_BAND_5GHZ;
11472 a_band->n_channels = geo->a_channels;
11473 a_band->channels =
11474 kzalloc(geo->a_channels *
11475 sizeof(struct ieee80211_channel), GFP_KERNEL);
11476 /* translate geo->bg to a_band.channels */
11477 for (i = 0; i < geo->a_channels; i++) {
11478 a_band->channels[i].band = IEEE80211_BAND_2GHZ;
11479 a_band->channels[i].center_freq = geo->a[i].freq;
11480 a_band->channels[i].hw_value = geo->a[i].channel;
11481 a_band->channels[i].max_power = geo->a[i].max_power;
11482 if (geo->a[i].flags & LIBIPW_CH_PASSIVE_ONLY)
11483 a_band->channels[i].flags |=
11484 IEEE80211_CHAN_PASSIVE_SCAN;
11485 if (geo->a[i].flags & LIBIPW_CH_NO_IBSS)
11486 a_band->channels[i].flags |=
11487 IEEE80211_CHAN_NO_IBSS;
11488 if (geo->a[i].flags & LIBIPW_CH_RADAR_DETECT)
11489 a_band->channels[i].flags |=
11490 IEEE80211_CHAN_RADAR;
11491 /* No equivalent for LIBIPW_CH_80211H_RULES,
11492 LIBIPW_CH_UNIFORM_SPREADING, or
11493 LIBIPW_CH_B_ONLY... */
11494 }
11495 /* point at bitrate info */
11496 a_band->bitrates = ipw2200_a_rates;
11497 a_band->n_bitrates = ipw2200_num_a_rates;
11498
11499 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = a_band;
11500 }
11501
11502 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
11503
11504 /* With that information in place, we can now register the wiphy... */
11505 if (wiphy_register(wdev->wiphy)) {
11506 rc = -EIO;
11507 goto out;
11508 } 11424 }
11509 11425
11510out:
11511 mutex_unlock(&priv->mutex); 11426 mutex_unlock(&priv->mutex);
11512 return rc; 11427 return 0;
11513} 11428}
11514 11429
11515/* PCI driver stuff */ 11430/* PCI driver stuff */
@@ -11640,7 +11555,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11640 if (priv->prom_net_dev) 11555 if (priv->prom_net_dev)
11641 return -EPERM; 11556 return -EPERM;
11642 11557
11643 priv->prom_net_dev = alloc_ieee80211(sizeof(struct ipw_prom_priv), 1); 11558 priv->prom_net_dev = alloc_ieee80211(sizeof(struct ipw_prom_priv));
11644 if (priv->prom_net_dev == NULL) 11559 if (priv->prom_net_dev == NULL)
11645 return -ENOMEM; 11560 return -ENOMEM;
11646 11561
@@ -11659,7 +11574,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11659 11574
11660 rc = register_netdev(priv->prom_net_dev); 11575 rc = register_netdev(priv->prom_net_dev);
11661 if (rc) { 11576 if (rc) {
11662 free_ieee80211(priv->prom_net_dev, 1); 11577 free_ieee80211(priv->prom_net_dev);
11663 priv->prom_net_dev = NULL; 11578 priv->prom_net_dev = NULL;
11664 return rc; 11579 return rc;
11665 } 11580 }
@@ -11673,7 +11588,7 @@ static void ipw_prom_free(struct ipw_priv *priv)
11673 return; 11588 return;
11674 11589
11675 unregister_netdev(priv->prom_net_dev); 11590 unregister_netdev(priv->prom_net_dev);
11676 free_ieee80211(priv->prom_net_dev, 1); 11591 free_ieee80211(priv->prom_net_dev);
11677 11592
11678 priv->prom_net_dev = NULL; 11593 priv->prom_net_dev = NULL;
11679} 11594}
@@ -11701,7 +11616,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11701 struct ipw_priv *priv; 11616 struct ipw_priv *priv;
11702 int i; 11617 int i;
11703 11618
11704 net_dev = alloc_ieee80211(sizeof(struct ipw_priv), 0); 11619 net_dev = alloc_ieee80211(sizeof(struct ipw_priv));
11705 if (net_dev == NULL) { 11620 if (net_dev == NULL) {
11706 err = -ENOMEM; 11621 err = -ENOMEM;
11707 goto out; 11622 goto out;
@@ -11849,7 +11764,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11849 pci_disable_device(pdev); 11764 pci_disable_device(pdev);
11850 pci_set_drvdata(pdev, NULL); 11765 pci_set_drvdata(pdev, NULL);
11851 out_free_ieee80211: 11766 out_free_ieee80211:
11852 free_ieee80211(priv->net_dev, 0); 11767 free_ieee80211(priv->net_dev);
11853 out: 11768 out:
11854 return err; 11769 return err;
11855} 11770}
@@ -11916,7 +11831,7 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11916 pci_release_regions(pdev); 11831 pci_release_regions(pdev);
11917 pci_disable_device(pdev); 11832 pci_disable_device(pdev);
11918 pci_set_drvdata(pdev, NULL); 11833 pci_set_drvdata(pdev, NULL);
11919 free_ieee80211(priv->net_dev, 0); 11834 free_ieee80211(priv->net_dev);
11920 free_firmware(); 11835 free_firmware();
11921} 11836}
11922 11837
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h
index bf45391172f3..1e334ff6bd52 100644
--- a/drivers/net/wireless/ipw2x00/libipw.h
+++ b/drivers/net/wireless/ipw2x00/libipw.h
@@ -31,7 +31,6 @@
31#include <linux/ieee80211.h> 31#include <linux/ieee80211.h>
32 32
33#include <net/lib80211.h> 33#include <net/lib80211.h>
34#include <net/cfg80211.h>
35 34
36#define LIBIPW_VERSION "git-1.1.13" 35#define LIBIPW_VERSION "git-1.1.13"
37 36
@@ -784,15 +783,12 @@ struct libipw_geo {
784 783
785struct libipw_device { 784struct libipw_device {
786 struct net_device *dev; 785 struct net_device *dev;
787 struct wireless_dev wdev;
788 struct libipw_security sec; 786 struct libipw_security sec;
789 787
790 /* Bookkeeping structures */ 788 /* Bookkeeping structures */
791 struct libipw_stats ieee_stats; 789 struct libipw_stats ieee_stats;
792 790
793 struct libipw_geo geo; 791 struct libipw_geo geo;
794 struct ieee80211_supported_band bg_band;
795 struct ieee80211_supported_band a_band;
796 792
797 /* Probe / Beacon management */ 793 /* Probe / Beacon management */
798 struct list_head network_free_list; 794 struct list_head network_free_list;
@@ -1018,8 +1014,8 @@ static inline int libipw_is_cck_rate(u8 rate)
1018} 1014}
1019 1015
1020/* ieee80211.c */ 1016/* ieee80211.c */
1021extern void free_ieee80211(struct net_device *dev, int monitor); 1017extern void free_ieee80211(struct net_device *dev);
1022extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor); 1018extern struct net_device *alloc_ieee80211(int sizeof_priv);
1023extern int libipw_change_mtu(struct net_device *dev, int new_mtu); 1019extern int libipw_change_mtu(struct net_device *dev, int new_mtu);
1024 1020
1025extern void libipw_networks_age(struct libipw_device *ieee, 1021extern void libipw_networks_age(struct libipw_device *ieee,
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c
index a0e9f6aed7da..eb2b60834c17 100644
--- a/drivers/net/wireless/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/ipw2x00/libipw_module.c
@@ -62,9 +62,6 @@ MODULE_DESCRIPTION(DRV_DESCRIPTION);
62MODULE_AUTHOR(DRV_COPYRIGHT); 62MODULE_AUTHOR(DRV_COPYRIGHT);
63MODULE_LICENSE("GPL"); 63MODULE_LICENSE("GPL");
64 64
65struct cfg80211_ops libipw_config_ops = { };
66void *libipw_wiphy_privid = &libipw_wiphy_privid;
67
68static int libipw_networks_allocate(struct libipw_device *ieee) 65static int libipw_networks_allocate(struct libipw_device *ieee)
69{ 66{
70 if (ieee->networks) 67 if (ieee->networks)
@@ -143,7 +140,7 @@ int libipw_change_mtu(struct net_device *dev, int new_mtu)
143} 140}
144EXPORT_SYMBOL(libipw_change_mtu); 141EXPORT_SYMBOL(libipw_change_mtu);
145 142
146struct net_device *alloc_ieee80211(int sizeof_priv, int monitor) 143struct net_device *alloc_ieee80211(int sizeof_priv)
147{ 144{
148 struct libipw_device *ieee; 145 struct libipw_device *ieee;
149 struct net_device *dev; 146 struct net_device *dev;
@@ -160,31 +157,10 @@ struct net_device *alloc_ieee80211(int sizeof_priv, int monitor)
160 157
161 ieee->dev = dev; 158 ieee->dev = dev;
162 159
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
184 err = libipw_networks_allocate(ieee); 160 err = libipw_networks_allocate(ieee);
185 if (err) { 161 if (err) {
186 LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err); 162 LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err);
187 goto failed_free_wiphy; 163 goto failed_free_netdev;
188 } 164 }
189 libipw_networks_initialize(ieee); 165 libipw_networks_initialize(ieee);
190 166
@@ -217,31 +193,19 @@ struct net_device *alloc_ieee80211(int sizeof_priv, int monitor)
217 193
218 return dev; 194 return dev;
219 195
220failed_free_wiphy:
221 if (!monitor)
222 wiphy_free(ieee->wdev.wiphy);
223failed_free_netdev: 196failed_free_netdev:
224 free_netdev(dev); 197 free_netdev(dev);
225failed: 198failed:
226 return NULL; 199 return NULL;
227} 200}
228 201
229void free_ieee80211(struct net_device *dev, int monitor) 202void free_ieee80211(struct net_device *dev)
230{ 203{
231 struct libipw_device *ieee = netdev_priv(dev); 204 struct libipw_device *ieee = netdev_priv(dev);
232 205
233 lib80211_crypt_info_free(&ieee->crypt_info); 206 lib80211_crypt_info_free(&ieee->crypt_info);
234 207
235 libipw_networks_free(ieee); 208 libipw_networks_free(ieee);
236
237 /* free cfg80211 resources */
238 if (!monitor) {
239 wiphy_unregister(ieee->wdev.wiphy);
240 kfree(ieee->a_band.channels);
241 kfree(ieee->bg_band.channels);
242 wiphy_free(ieee->wdev.wiphy);
243 }
244
245 free_netdev(dev); 209 free_netdev(dev);
246} 210}
247 211