diff options
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r-- | drivers/net/wireless/airo.c | 92 |
1 files changed, 33 insertions, 59 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 06998c2240d9..750c0167539c 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/in.h> | 36 | #include <linux/in.h> |
37 | #include <linux/bitops.h> | 37 | #include <linux/bitops.h> |
38 | #include <linux/scatterlist.h> | ||
38 | #include <asm/io.h> | 39 | #include <asm/io.h> |
39 | #include <asm/system.h> | 40 | #include <asm/system.h> |
40 | 41 | ||
@@ -1046,7 +1047,6 @@ static WifiCtlHdr wifictlhdr8023 = { | |||
1046 | } | 1047 | } |
1047 | }; | 1048 | }; |
1048 | 1049 | ||
1049 | #ifdef WIRELESS_EXT | ||
1050 | // Frequency list (map channels to frequencies) | 1050 | // Frequency list (map channels to frequencies) |
1051 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, | 1051 | static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, |
1052 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; | 1052 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; |
@@ -1067,7 +1067,6 @@ typedef struct wep_key_t { | |||
1067 | 1067 | ||
1068 | /* List of Wireless Handlers (new API) */ | 1068 | /* List of Wireless Handlers (new API) */ |
1069 | static const struct iw_handler_def airo_handler_def; | 1069 | static const struct iw_handler_def airo_handler_def; |
1070 | #endif /* WIRELESS_EXT */ | ||
1071 | 1070 | ||
1072 | static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; | 1071 | static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; |
1073 | 1072 | ||
@@ -1110,10 +1109,8 @@ static irqreturn_t airo_interrupt( int irq, void* dev_id, struct pt_regs | |||
1110 | static int airo_thread(void *data); | 1109 | static int airo_thread(void *data); |
1111 | static void timer_func( struct net_device *dev ); | 1110 | static void timer_func( struct net_device *dev ); |
1112 | static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 1111 | static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
1113 | #ifdef WIRELESS_EXT | ||
1114 | static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); | 1112 | static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); |
1115 | static void airo_read_wireless_stats (struct airo_info *local); | 1113 | static void airo_read_wireless_stats (struct airo_info *local); |
1116 | #endif /* WIRELESS_EXT */ | ||
1117 | #ifdef CISCO_EXT | 1114 | #ifdef CISCO_EXT |
1118 | static int readrids(struct net_device *dev, aironet_ioctl *comp); | 1115 | static int readrids(struct net_device *dev, aironet_ioctl *comp); |
1119 | static int writerids(struct net_device *dev, aironet_ioctl *comp); | 1116 | static int writerids(struct net_device *dev, aironet_ioctl *comp); |
@@ -1187,12 +1184,10 @@ struct airo_info { | |||
1187 | int fid; | 1184 | int fid; |
1188 | } xmit, xmit11; | 1185 | } xmit, xmit11; |
1189 | struct net_device *wifidev; | 1186 | struct net_device *wifidev; |
1190 | #ifdef WIRELESS_EXT | ||
1191 | struct iw_statistics wstats; // wireless stats | 1187 | struct iw_statistics wstats; // wireless stats |
1192 | unsigned long scan_timestamp; /* Time started to scan */ | 1188 | unsigned long scan_timestamp; /* Time started to scan */ |
1193 | struct iw_spy_data spy_data; | 1189 | struct iw_spy_data spy_data; |
1194 | struct iw_public_data wireless_data; | 1190 | struct iw_public_data wireless_data; |
1195 | #endif /* WIRELESS_EXT */ | ||
1196 | #ifdef MICSUPPORT | 1191 | #ifdef MICSUPPORT |
1197 | /* MIC stuff */ | 1192 | /* MIC stuff */ |
1198 | struct crypto_tfm *tfm; | 1193 | struct crypto_tfm *tfm; |
@@ -1596,11 +1591,9 @@ static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct | |||
1596 | aes_counter[12] = (u8)(counter >> 24); | 1591 | aes_counter[12] = (u8)(counter >> 24); |
1597 | counter++; | 1592 | counter++; |
1598 | memcpy (plain, aes_counter, 16); | 1593 | memcpy (plain, aes_counter, 16); |
1599 | sg[0].page = virt_to_page(plain); | 1594 | sg_set_buf(sg, plain, 16); |
1600 | sg[0].offset = ((long) plain & ~PAGE_MASK); | ||
1601 | sg[0].length = 16; | ||
1602 | crypto_cipher_encrypt(tfm, sg, sg, 16); | 1595 | crypto_cipher_encrypt(tfm, sg, sg, 16); |
1603 | cipher = kmap(sg[0].page) + sg[0].offset; | 1596 | cipher = kmap(sg->page) + sg->offset; |
1604 | for (j=0; (j<16) && (i< (sizeof(context->coeff)/sizeof(context->coeff[0]))); ) { | 1597 | for (j=0; (j<16) && (i< (sizeof(context->coeff)/sizeof(context->coeff[0]))); ) { |
1605 | context->coeff[i++] = ntohl(*(u32 *)&cipher[j]); | 1598 | context->coeff[i++] = ntohl(*(u32 *)&cipher[j]); |
1606 | j += 4; | 1599 | j += 4; |
@@ -2387,14 +2380,10 @@ void stop_airo_card( struct net_device *dev, int freeres ) | |||
2387 | dev_kfree_skb(skb); | 2380 | dev_kfree_skb(skb); |
2388 | } | 2381 | } |
2389 | 2382 | ||
2390 | if (ai->flash) | 2383 | kfree(ai->flash); |
2391 | kfree(ai->flash); | 2384 | kfree(ai->rssi); |
2392 | if (ai->rssi) | 2385 | kfree(ai->APList); |
2393 | kfree(ai->rssi); | 2386 | kfree(ai->SSID); |
2394 | if (ai->APList) | ||
2395 | kfree(ai->APList); | ||
2396 | if (ai->SSID) | ||
2397 | kfree(ai->SSID); | ||
2398 | if (freeres) { | 2387 | if (freeres) { |
2399 | /* PCMCIA frees this stuff, so only for PCI and ISA */ | 2388 | /* PCMCIA frees this stuff, so only for PCI and ISA */ |
2400 | release_region( dev->base_addr, 64 ); | 2389 | release_region( dev->base_addr, 64 ); |
@@ -2527,7 +2516,8 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2527 | unsigned long mem_start, mem_len, aux_start, aux_len; | 2516 | unsigned long mem_start, mem_len, aux_start, aux_len; |
2528 | int rc = -1; | 2517 | int rc = -1; |
2529 | int i; | 2518 | int i; |
2530 | unsigned char *busaddroff,*vpackoff; | 2519 | dma_addr_t busaddroff; |
2520 | unsigned char *vpackoff; | ||
2531 | unsigned char __iomem *pciaddroff; | 2521 | unsigned char __iomem *pciaddroff; |
2532 | 2522 | ||
2533 | mem_start = pci_resource_start(pci, 1); | 2523 | mem_start = pci_resource_start(pci, 1); |
@@ -2570,7 +2560,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2570 | /* | 2560 | /* |
2571 | * Setup descriptor RX, TX, CONFIG | 2561 | * Setup descriptor RX, TX, CONFIG |
2572 | */ | 2562 | */ |
2573 | busaddroff = (unsigned char *)ai->shared_dma; | 2563 | busaddroff = ai->shared_dma; |
2574 | pciaddroff = ai->pciaux + AUX_OFFSET; | 2564 | pciaddroff = ai->pciaux + AUX_OFFSET; |
2575 | vpackoff = ai->shared; | 2565 | vpackoff = ai->shared; |
2576 | 2566 | ||
@@ -2579,7 +2569,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2579 | ai->rxfids[i].pending = 0; | 2569 | ai->rxfids[i].pending = 0; |
2580 | ai->rxfids[i].card_ram_off = pciaddroff; | 2570 | ai->rxfids[i].card_ram_off = pciaddroff; |
2581 | ai->rxfids[i].virtual_host_addr = vpackoff; | 2571 | ai->rxfids[i].virtual_host_addr = vpackoff; |
2582 | ai->rxfids[i].rx_desc.host_addr = (dma_addr_t) busaddroff; | 2572 | ai->rxfids[i].rx_desc.host_addr = busaddroff; |
2583 | ai->rxfids[i].rx_desc.valid = 1; | 2573 | ai->rxfids[i].rx_desc.valid = 1; |
2584 | ai->rxfids[i].rx_desc.len = PKTSIZE; | 2574 | ai->rxfids[i].rx_desc.len = PKTSIZE; |
2585 | ai->rxfids[i].rx_desc.rdy = 0; | 2575 | ai->rxfids[i].rx_desc.rdy = 0; |
@@ -2594,7 +2584,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2594 | ai->txfids[i].card_ram_off = pciaddroff; | 2584 | ai->txfids[i].card_ram_off = pciaddroff; |
2595 | ai->txfids[i].virtual_host_addr = vpackoff; | 2585 | ai->txfids[i].virtual_host_addr = vpackoff; |
2596 | ai->txfids[i].tx_desc.valid = 1; | 2586 | ai->txfids[i].tx_desc.valid = 1; |
2597 | ai->txfids[i].tx_desc.host_addr = (dma_addr_t) busaddroff; | 2587 | ai->txfids[i].tx_desc.host_addr = busaddroff; |
2598 | memcpy(ai->txfids[i].virtual_host_addr, | 2588 | memcpy(ai->txfids[i].virtual_host_addr, |
2599 | &wifictlhdr8023, sizeof(wifictlhdr8023)); | 2589 | &wifictlhdr8023, sizeof(wifictlhdr8023)); |
2600 | 2590 | ||
@@ -2607,8 +2597,8 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, | |||
2607 | /* Rid descriptor setup */ | 2597 | /* Rid descriptor setup */ |
2608 | ai->config_desc.card_ram_off = pciaddroff; | 2598 | ai->config_desc.card_ram_off = pciaddroff; |
2609 | ai->config_desc.virtual_host_addr = vpackoff; | 2599 | ai->config_desc.virtual_host_addr = vpackoff; |
2610 | ai->config_desc.rid_desc.host_addr = (dma_addr_t) busaddroff; | 2600 | ai->config_desc.rid_desc.host_addr = busaddroff; |
2611 | ai->ridbus = (dma_addr_t)busaddroff; | 2601 | ai->ridbus = busaddroff; |
2612 | ai->config_desc.rid_desc.rid = 0; | 2602 | ai->config_desc.rid_desc.rid = 0; |
2613 | ai->config_desc.rid_desc.len = RIDSIZE; | 2603 | ai->config_desc.rid_desc.len = RIDSIZE; |
2614 | ai->config_desc.rid_desc.valid = 1; | 2604 | ai->config_desc.rid_desc.valid = 1; |
@@ -2647,9 +2637,7 @@ static void wifi_setup(struct net_device *dev) | |||
2647 | dev->get_stats = &airo_get_stats; | 2637 | dev->get_stats = &airo_get_stats; |
2648 | dev->set_mac_address = &airo_set_mac_address; | 2638 | dev->set_mac_address = &airo_set_mac_address; |
2649 | dev->do_ioctl = &airo_ioctl; | 2639 | dev->do_ioctl = &airo_ioctl; |
2650 | #ifdef WIRELESS_EXT | ||
2651 | dev->wireless_handlers = &airo_handler_def; | 2640 | dev->wireless_handlers = &airo_handler_def; |
2652 | #endif /* WIRELESS_EXT */ | ||
2653 | dev->change_mtu = &airo_change_mtu; | 2641 | dev->change_mtu = &airo_change_mtu; |
2654 | dev->open = &airo_open; | 2642 | dev->open = &airo_open; |
2655 | dev->stop = &airo_close; | 2643 | dev->stop = &airo_close; |
@@ -2675,9 +2663,7 @@ static struct net_device *init_wifidev(struct airo_info *ai, | |||
2675 | dev->priv = ethdev->priv; | 2663 | dev->priv = ethdev->priv; |
2676 | dev->irq = ethdev->irq; | 2664 | dev->irq = ethdev->irq; |
2677 | dev->base_addr = ethdev->base_addr; | 2665 | dev->base_addr = ethdev->base_addr; |
2678 | #ifdef WIRELESS_EXT | ||
2679 | dev->wireless_data = ethdev->wireless_data; | 2666 | dev->wireless_data = ethdev->wireless_data; |
2680 | #endif /* WIRELESS_EXT */ | ||
2681 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); | 2667 | memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); |
2682 | err = register_netdev(dev); | 2668 | err = register_netdev(dev); |
2683 | if (err<0) { | 2669 | if (err<0) { |
@@ -2755,11 +2741,9 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
2755 | dev->set_multicast_list = &airo_set_multicast_list; | 2741 | dev->set_multicast_list = &airo_set_multicast_list; |
2756 | dev->set_mac_address = &airo_set_mac_address; | 2742 | dev->set_mac_address = &airo_set_mac_address; |
2757 | dev->do_ioctl = &airo_ioctl; | 2743 | dev->do_ioctl = &airo_ioctl; |
2758 | #ifdef WIRELESS_EXT | ||
2759 | dev->wireless_handlers = &airo_handler_def; | 2744 | dev->wireless_handlers = &airo_handler_def; |
2760 | ai->wireless_data.spy_data = &ai->spy_data; | 2745 | ai->wireless_data.spy_data = &ai->spy_data; |
2761 | dev->wireless_data = &ai->wireless_data; | 2746 | dev->wireless_data = &ai->wireless_data; |
2762 | #endif /* WIRELESS_EXT */ | ||
2763 | dev->change_mtu = &airo_change_mtu; | 2747 | dev->change_mtu = &airo_change_mtu; |
2764 | dev->open = &airo_open; | 2748 | dev->open = &airo_open; |
2765 | dev->stop = &airo_close; | 2749 | dev->stop = &airo_close; |
@@ -3637,10 +3621,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3637 | int rc; | 3621 | int rc; |
3638 | 3622 | ||
3639 | memset( &mySsid, 0, sizeof( mySsid ) ); | 3623 | memset( &mySsid, 0, sizeof( mySsid ) ); |
3640 | if (ai->flash) { | 3624 | kfree (ai->flash); |
3641 | kfree (ai->flash); | 3625 | ai->flash = NULL; |
3642 | ai->flash = NULL; | ||
3643 | } | ||
3644 | 3626 | ||
3645 | /* The NOP is the first step in getting the card going */ | 3627 | /* The NOP is the first step in getting the card going */ |
3646 | cmd.cmd = NOP; | 3628 | cmd.cmd = NOP; |
@@ -3677,14 +3659,10 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3677 | tdsRssiRid rssi_rid; | 3659 | tdsRssiRid rssi_rid; |
3678 | CapabilityRid cap_rid; | 3660 | CapabilityRid cap_rid; |
3679 | 3661 | ||
3680 | if (ai->APList) { | 3662 | kfree(ai->APList); |
3681 | kfree(ai->APList); | 3663 | ai->APList = NULL; |
3682 | ai->APList = NULL; | 3664 | kfree(ai->SSID); |
3683 | } | 3665 | ai->SSID = NULL; |
3684 | if (ai->SSID) { | ||
3685 | kfree(ai->SSID); | ||
3686 | ai->SSID = NULL; | ||
3687 | } | ||
3688 | // general configuration (read/modify/write) | 3666 | // general configuration (read/modify/write) |
3689 | status = readConfigRid(ai, lock); | 3667 | status = readConfigRid(ai, lock); |
3690 | if ( status != SUCCESS ) return ERROR; | 3668 | if ( status != SUCCESS ) return ERROR; |
@@ -3698,10 +3676,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) | |||
3698 | memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */ | 3676 | memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */ |
3699 | } | 3677 | } |
3700 | else { | 3678 | else { |
3701 | if (ai->rssi) { | 3679 | kfree(ai->rssi); |
3702 | kfree(ai->rssi); | 3680 | ai->rssi = NULL; |
3703 | ai->rssi = NULL; | ||
3704 | } | ||
3705 | if (cap_rid.softCap & 8) | 3681 | if (cap_rid.softCap & 8) |
3706 | ai->config.rmode |= RXMODE_NORMALIZED_RSSI; | 3682 | ai->config.rmode |= RXMODE_NORMALIZED_RSSI; |
3707 | else | 3683 | else |
@@ -5380,11 +5356,13 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) { | |||
5380 | 5356 | ||
5381 | static int proc_close( struct inode *inode, struct file *file ) | 5357 | static int proc_close( struct inode *inode, struct file *file ) |
5382 | { | 5358 | { |
5383 | struct proc_data *data = (struct proc_data *)file->private_data; | 5359 | struct proc_data *data = file->private_data; |
5384 | if ( data->on_close != NULL ) data->on_close( inode, file ); | 5360 | |
5385 | if ( data->rbuffer ) kfree( data->rbuffer ); | 5361 | if (data->on_close != NULL) |
5386 | if ( data->wbuffer ) kfree( data->wbuffer ); | 5362 | data->on_close(inode, file); |
5387 | kfree( data ); | 5363 | kfree(data->rbuffer); |
5364 | kfree(data->wbuffer); | ||
5365 | kfree(data); | ||
5388 | return 0; | 5366 | return 0; |
5389 | } | 5367 | } |
5390 | 5368 | ||
@@ -5515,12 +5493,13 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
5515 | struct net_device *dev = pci_get_drvdata(pdev); | 5493 | struct net_device *dev = pci_get_drvdata(pdev); |
5516 | struct airo_info *ai = dev->priv; | 5494 | struct airo_info *ai = dev->priv; |
5517 | Resp rsp; | 5495 | Resp rsp; |
5496 | pci_power_t prev_state = pdev->current_state; | ||
5518 | 5497 | ||
5519 | pci_set_power_state(pdev, 0); | 5498 | pci_set_power_state(pdev, PCI_D0); |
5520 | pci_restore_state(pdev); | 5499 | pci_restore_state(pdev); |
5521 | pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0); | 5500 | pci_enable_wake(pdev, PCI_D0, 0); |
5522 | 5501 | ||
5523 | if (ai->power.event > 1) { | 5502 | if (prev_state != PCI_D1) { |
5524 | reset_card(dev, 0); | 5503 | reset_card(dev, 0); |
5525 | mpi_init_descriptors(ai); | 5504 | mpi_init_descriptors(ai); |
5526 | setup_card(ai, dev->dev_addr, 0); | 5505 | setup_card(ai, dev->dev_addr, 0); |
@@ -5598,7 +5577,6 @@ static void __exit airo_cleanup_module( void ) | |||
5598 | remove_proc_entry("aironet", proc_root_driver); | 5577 | remove_proc_entry("aironet", proc_root_driver); |
5599 | } | 5578 | } |
5600 | 5579 | ||
5601 | #ifdef WIRELESS_EXT | ||
5602 | /* | 5580 | /* |
5603 | * Initial Wireless Extension code for Aironet driver by : | 5581 | * Initial Wireless Extension code for Aironet driver by : |
5604 | * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 | 5582 | * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00 |
@@ -7107,8 +7085,6 @@ static const struct iw_handler_def airo_handler_def = | |||
7107 | .get_wireless_stats = airo_get_wireless_stats, | 7085 | .get_wireless_stats = airo_get_wireless_stats, |
7108 | }; | 7086 | }; |
7109 | 7087 | ||
7110 | #endif /* WIRELESS_EXT */ | ||
7111 | |||
7112 | /* | 7088 | /* |
7113 | * This defines the configuration part of the Wireless Extensions | 7089 | * This defines the configuration part of the Wireless Extensions |
7114 | * Note : irq and spinlock protection will occur in the subroutines | 7090 | * Note : irq and spinlock protection will occur in the subroutines |
@@ -7187,7 +7163,6 @@ static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
7187 | return rc; | 7163 | return rc; |
7188 | } | 7164 | } |
7189 | 7165 | ||
7190 | #ifdef WIRELESS_EXT | ||
7191 | /* | 7166 | /* |
7192 | * Get the Wireless stats out of the driver | 7167 | * Get the Wireless stats out of the driver |
7193 | * Note : irq and spinlock protection will occur in the subroutines | 7168 | * Note : irq and spinlock protection will occur in the subroutines |
@@ -7260,7 +7235,6 @@ static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) | |||
7260 | 7235 | ||
7261 | return &local->wstats; | 7236 | return &local->wstats; |
7262 | } | 7237 | } |
7263 | #endif /* WIRELESS_EXT */ | ||
7264 | 7238 | ||
7265 | #ifdef CISCO_EXT | 7239 | #ifdef CISCO_EXT |
7266 | /* | 7240 | /* |