aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/ipw2200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ipw2x00/ipw2200.c')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c141
1 files changed, 28 insertions, 113 deletions
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