aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/ipw2200.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2009-08-25 14:12:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-28 14:40:46 -0400
commitb8ecd988b1670035a05035c553c08331214d6603 (patch)
tree4a6eda87b8b9d8aab7658cfd6f553dc9c86a13be /drivers/net/wireless/ipw2x00/ipw2200.c
parent73f57f8398ed6cba82f9856e20d94d71e6edb3e2 (diff)
libipw: initiate cfg80211 API conversion
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. Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2x00/ipw2200.c')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c141
1 files changed, 113 insertions, 28 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 0ccec9f9f955..3f8372daf46a 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -103,6 +103,25 @@ 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
106 125
107#ifdef CONFIG_IPW2200_QOS 126#ifdef CONFIG_IPW2200_QOS
108static int qos_enable = 0; 127static int qos_enable = 0;
@@ -8640,24 +8659,6 @@ static int ipw_sw_reset(struct ipw_priv *priv, int option)
8640 * 8659 *
8641 */ 8660 */
8642 8661
8643static int ipw_wx_get_name(struct net_device *dev,
8644 struct iw_request_info *info,
8645 union iwreq_data *wrqu, char *extra)
8646{
8647 struct ipw_priv *priv = libipw_priv(dev);
8648 mutex_lock(&priv->mutex);
8649 if (priv->status & STATUS_RF_KILL_MASK)
8650 strcpy(wrqu->name, "radio off");
8651 else if (!(priv->status & STATUS_ASSOCIATED))
8652 strcpy(wrqu->name, "unassociated");
8653 else
8654 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c",
8655 ipw_modes[priv->assoc_request.ieee_mode]);
8656 IPW_DEBUG_WX("Name: %s\n", wrqu->name);
8657 mutex_unlock(&priv->mutex);
8658 return 0;
8659}
8660
8661static int ipw_set_channel(struct ipw_priv *priv, u8 channel) 8662static int ipw_set_channel(struct ipw_priv *priv, u8 channel)
8662{ 8663{
8663 if (channel == 0) { 8664 if (channel == 0) {
@@ -9957,7 +9958,7 @@ static int ipw_wx_sw_reset(struct net_device *dev,
9957/* Rebase the WE IOCTLs to zero for the handler array */ 9958/* Rebase the WE IOCTLs to zero for the handler array */
9958#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] 9959#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
9959static iw_handler ipw_wx_handlers[] = { 9960static iw_handler ipw_wx_handlers[] = {
9960 IW_IOCTL(SIOCGIWNAME) = ipw_wx_get_name, 9961 IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname,
9961 IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq, 9962 IW_IOCTL(SIOCSIWFREQ) = ipw_wx_set_freq,
9962 IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, 9963 IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq,
9963 IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, 9964 IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode,
@@ -11401,16 +11402,100 @@ static void ipw_bg_down(struct work_struct *work)
11401/* Called by register_netdev() */ 11402/* Called by register_netdev() */
11402static int ipw_net_init(struct net_device *dev) 11403static int ipw_net_init(struct net_device *dev)
11403{ 11404{
11405 int i, rc = 0;
11404 struct ipw_priv *priv = libipw_priv(dev); 11406 struct ipw_priv *priv = libipw_priv(dev);
11407 const struct libipw_geo *geo = libipw_get_geo(priv->ieee);
11408 struct wireless_dev *wdev = &priv->ieee->wdev;
11405 mutex_lock(&priv->mutex); 11409 mutex_lock(&priv->mutex);
11406 11410
11407 if (ipw_up(priv)) { 11411 if (ipw_up(priv)) {
11408 mutex_unlock(&priv->mutex); 11412 rc = -EIO;
11409 return -EIO; 11413 goto out;
11410 } 11414 }
11411 11415
11416 memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN);
11417
11418 /* fill-out priv->ieee->bg_band */
11419 if (geo->bg_channels) {
11420 struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band;
11421
11422 bg_band->band = IEEE80211_BAND_2GHZ;
11423 bg_band->n_channels = geo->bg_channels;
11424 bg_band->channels =
11425 kzalloc(geo->bg_channels *
11426 sizeof(struct ieee80211_channel), GFP_KERNEL);
11427 /* translate geo->bg to bg_band.channels */
11428 for (i = 0; i < geo->bg_channels; i++) {
11429 bg_band->channels[i].band = IEEE80211_BAND_2GHZ;
11430 bg_band->channels[i].center_freq = geo->bg[i].freq;
11431 bg_band->channels[i].hw_value = geo->bg[i].channel;
11432 bg_band->channels[i].max_power = geo->bg[i].max_power;
11433 if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY)
11434 bg_band->channels[i].flags |=
11435 IEEE80211_CHAN_PASSIVE_SCAN;
11436 if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS)
11437 bg_band->channels[i].flags |=
11438 IEEE80211_CHAN_NO_IBSS;
11439 if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT)
11440 bg_band->channels[i].flags |=
11441 IEEE80211_CHAN_RADAR;
11442 /* No equivalent for LIBIPW_CH_80211H_RULES,
11443 LIBIPW_CH_UNIFORM_SPREADING, or
11444 LIBIPW_CH_B_ONLY... */
11445 }
11446 /* point at bitrate info */
11447 bg_band->bitrates = ipw2200_bg_rates;
11448 bg_band->n_bitrates = ipw2200_num_bg_rates;
11449
11450 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band;
11451 }
11452
11453 /* fill-out priv->ieee->a_band */
11454 if (geo->a_channels) {
11455 struct ieee80211_supported_band *a_band = &priv->ieee->a_band;
11456
11457 a_band->band = IEEE80211_BAND_5GHZ;
11458 a_band->n_channels = geo->a_channels;
11459 a_band->channels =
11460 kzalloc(geo->a_channels *
11461 sizeof(struct ieee80211_channel), GFP_KERNEL);
11462 /* translate geo->bg to a_band.channels */
11463 for (i = 0; i < geo->a_channels; i++) {
11464 a_band->channels[i].band = IEEE80211_BAND_2GHZ;
11465 a_band->channels[i].center_freq = geo->a[i].freq;
11466 a_band->channels[i].hw_value = geo->a[i].channel;
11467 a_band->channels[i].max_power = geo->a[i].max_power;
11468 if (geo->a[i].flags & LIBIPW_CH_PASSIVE_ONLY)
11469 a_band->channels[i].flags |=
11470 IEEE80211_CHAN_PASSIVE_SCAN;
11471 if (geo->a[i].flags & LIBIPW_CH_NO_IBSS)
11472 a_band->channels[i].flags |=
11473 IEEE80211_CHAN_NO_IBSS;
11474 if (geo->a[i].flags & LIBIPW_CH_RADAR_DETECT)
11475 a_band->channels[i].flags |=
11476 IEEE80211_CHAN_RADAR;
11477 /* No equivalent for LIBIPW_CH_80211H_RULES,
11478 LIBIPW_CH_UNIFORM_SPREADING, or
11479 LIBIPW_CH_B_ONLY... */
11480 }
11481 /* point at bitrate info */
11482 a_band->bitrates = ipw2200_a_rates;
11483 a_band->n_bitrates = ipw2200_num_a_rates;
11484
11485 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = a_band;
11486 }
11487
11488 set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
11489
11490 /* With that information in place, we can now register the wiphy... */
11491 if (wiphy_register(wdev->wiphy)) {
11492 rc = -EIO;
11493 goto out;
11494 }
11495
11496out:
11412 mutex_unlock(&priv->mutex); 11497 mutex_unlock(&priv->mutex);
11413 return 0; 11498 return rc;
11414} 11499}
11415 11500
11416/* PCI driver stuff */ 11501/* PCI driver stuff */
@@ -11540,7 +11625,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11540 if (priv->prom_net_dev) 11625 if (priv->prom_net_dev)
11541 return -EPERM; 11626 return -EPERM;
11542 11627
11543 priv->prom_net_dev = alloc_ieee80211(sizeof(struct ipw_prom_priv)); 11628 priv->prom_net_dev = alloc_ieee80211(sizeof(struct ipw_prom_priv), 1);
11544 if (priv->prom_net_dev == NULL) 11629 if (priv->prom_net_dev == NULL)
11545 return -ENOMEM; 11630 return -ENOMEM;
11546 11631
@@ -11559,7 +11644,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11559 11644
11560 rc = register_netdev(priv->prom_net_dev); 11645 rc = register_netdev(priv->prom_net_dev);
11561 if (rc) { 11646 if (rc) {
11562 free_ieee80211(priv->prom_net_dev); 11647 free_ieee80211(priv->prom_net_dev, 1);
11563 priv->prom_net_dev = NULL; 11648 priv->prom_net_dev = NULL;
11564 return rc; 11649 return rc;
11565 } 11650 }
@@ -11573,7 +11658,7 @@ static void ipw_prom_free(struct ipw_priv *priv)
11573 return; 11658 return;
11574 11659
11575 unregister_netdev(priv->prom_net_dev); 11660 unregister_netdev(priv->prom_net_dev);
11576 free_ieee80211(priv->prom_net_dev); 11661 free_ieee80211(priv->prom_net_dev, 1);
11577 11662
11578 priv->prom_net_dev = NULL; 11663 priv->prom_net_dev = NULL;
11579} 11664}
@@ -11601,7 +11686,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11601 struct ipw_priv *priv; 11686 struct ipw_priv *priv;
11602 int i; 11687 int i;
11603 11688
11604 net_dev = alloc_ieee80211(sizeof(struct ipw_priv)); 11689 net_dev = alloc_ieee80211(sizeof(struct ipw_priv), 0);
11605 if (net_dev == NULL) { 11690 if (net_dev == NULL) {
11606 err = -ENOMEM; 11691 err = -ENOMEM;
11607 goto out; 11692 goto out;
@@ -11749,7 +11834,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11749 pci_disable_device(pdev); 11834 pci_disable_device(pdev);
11750 pci_set_drvdata(pdev, NULL); 11835 pci_set_drvdata(pdev, NULL);
11751 out_free_ieee80211: 11836 out_free_ieee80211:
11752 free_ieee80211(priv->net_dev); 11837 free_ieee80211(priv->net_dev, 0);
11753 out: 11838 out:
11754 return err; 11839 return err;
11755} 11840}
@@ -11816,7 +11901,7 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11816 pci_release_regions(pdev); 11901 pci_release_regions(pdev);
11817 pci_disable_device(pdev); 11902 pci_disable_device(pdev);
11818 pci_set_drvdata(pdev, NULL); 11903 pci_set_drvdata(pdev, NULL);
11819 free_ieee80211(priv->net_dev); 11904 free_ieee80211(priv->net_dev, 0);
11820 free_firmware(); 11905 free_firmware();
11821} 11906}
11822 11907