diff options
Diffstat (limited to 'drivers/net/wireless/airo.c')
| -rw-r--r-- | drivers/net/wireless/airo.c | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 32019fb878d8..b5cd850a4a59 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
| @@ -85,10 +85,10 @@ static struct pci_driver airo_driver = { | |||
| 85 | 85 | ||
| 86 | /* Include Wireless Extension definition and check version - Jean II */ | 86 | /* Include Wireless Extension definition and check version - Jean II */ |
| 87 | #include <linux/wireless.h> | 87 | #include <linux/wireless.h> |
| 88 | #define WIRELESS_SPY // enable iwspy support | 88 | #define WIRELESS_SPY /* enable iwspy support */ |
| 89 | #include <net/iw_handler.h> // New driver API | 89 | #include <net/iw_handler.h> /* New driver API */ |
| 90 | 90 | ||
| 91 | #define CISCO_EXT // enable Cisco extensions | 91 | #define CISCO_EXT /* enable Cisco extensions */ |
| 92 | #ifdef CISCO_EXT | 92 | #ifdef CISCO_EXT |
| 93 | #include <linux/delay.h> | 93 | #include <linux/delay.h> |
| 94 | #endif | 94 | #endif |
| @@ -281,7 +281,7 @@ MODULE_PARM_DESC(proc_perm, "The permission bits of the files in /proc"); | |||
| 281 | /* This is a kind of sloppy hack to get this information to OUT4500 and | 281 | /* This is a kind of sloppy hack to get this information to OUT4500 and |
| 282 | IN4500. I would be extremely interested in the situation where this | 282 | IN4500. I would be extremely interested in the situation where this |
| 283 | doesn't work though!!! */ | 283 | doesn't work though!!! */ |
| 284 | static int do8bitIO = 0; | 284 | static int do8bitIO /* = 0 */; |
| 285 | 285 | ||
| 286 | /* Return codes */ | 286 | /* Return codes */ |
| 287 | #define SUCCESS 0 | 287 | #define SUCCESS 0 |
| @@ -398,8 +398,8 @@ static int do8bitIO = 0; | |||
| 398 | #define MAXTXQ 64 | 398 | #define MAXTXQ 64 |
| 399 | 399 | ||
| 400 | /* BAP selectors */ | 400 | /* BAP selectors */ |
| 401 | #define BAP0 0 // Used for receiving packets | 401 | #define BAP0 0 /* Used for receiving packets */ |
| 402 | #define BAP1 2 // Used for xmiting packets and working with RIDS | 402 | #define BAP1 2 /* Used for xmiting packets and working with RIDS */ |
| 403 | 403 | ||
| 404 | /* Flags */ | 404 | /* Flags */ |
| 405 | #define COMMAND_BUSY 0x8000 | 405 | #define COMMAND_BUSY 0x8000 |
| @@ -1148,7 +1148,6 @@ static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); | |||
| 1148 | static void airo_networks_free(struct airo_info *ai); | 1148 | static void airo_networks_free(struct airo_info *ai); |
| 1149 | 1149 | ||
| 1150 | struct airo_info { | 1150 | struct airo_info { |
| 1151 | struct net_device_stats stats; | ||
| 1152 | struct net_device *dev; | 1151 | struct net_device *dev; |
| 1153 | struct list_head dev_list; | 1152 | struct list_head dev_list; |
| 1154 | /* Note, we can have MAX_FIDS outstanding. FIDs are 16-bits, so we | 1153 | /* Note, we can have MAX_FIDS outstanding. FIDs are 16-bits, so we |
| @@ -1924,7 +1923,7 @@ static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) { | |||
| 1924 | if (npacks >= MAXTXQ - 1) { | 1923 | if (npacks >= MAXTXQ - 1) { |
| 1925 | netif_stop_queue (dev); | 1924 | netif_stop_queue (dev); |
| 1926 | if (npacks > MAXTXQ) { | 1925 | if (npacks > MAXTXQ) { |
| 1927 | ai->stats.tx_fifo_errors++; | 1926 | dev->stats.tx_fifo_errors++; |
| 1928 | return 1; | 1927 | return 1; |
| 1929 | } | 1928 | } |
| 1930 | skb_queue_tail (&ai->txq, skb); | 1929 | skb_queue_tail (&ai->txq, skb); |
| @@ -2044,13 +2043,13 @@ static void get_tx_error(struct airo_info *ai, s32 fid) | |||
| 2044 | bap_read(ai, &status, 2, BAP0); | 2043 | bap_read(ai, &status, 2, BAP0); |
| 2045 | } | 2044 | } |
| 2046 | if (le16_to_cpu(status) & 2) /* Too many retries */ | 2045 | if (le16_to_cpu(status) & 2) /* Too many retries */ |
| 2047 | ai->stats.tx_aborted_errors++; | 2046 | ai->dev->stats.tx_aborted_errors++; |
| 2048 | if (le16_to_cpu(status) & 4) /* Transmit lifetime exceeded */ | 2047 | if (le16_to_cpu(status) & 4) /* Transmit lifetime exceeded */ |
| 2049 | ai->stats.tx_heartbeat_errors++; | 2048 | ai->dev->stats.tx_heartbeat_errors++; |
| 2050 | if (le16_to_cpu(status) & 8) /* Aid fail */ | 2049 | if (le16_to_cpu(status) & 8) /* Aid fail */ |
| 2051 | { } | 2050 | { } |
| 2052 | if (le16_to_cpu(status) & 0x10) /* MAC disabled */ | 2051 | if (le16_to_cpu(status) & 0x10) /* MAC disabled */ |
| 2053 | ai->stats.tx_carrier_errors++; | 2052 | ai->dev->stats.tx_carrier_errors++; |
| 2054 | if (le16_to_cpu(status) & 0x20) /* Association lost */ | 2053 | if (le16_to_cpu(status) & 0x20) /* Association lost */ |
| 2055 | { } | 2054 | { } |
| 2056 | /* We produce a TXDROP event only for retry or lifetime | 2055 | /* We produce a TXDROP event only for retry or lifetime |
| @@ -2102,7 +2101,7 @@ static void airo_end_xmit(struct net_device *dev) { | |||
| 2102 | for (; i < MAX_FIDS / 2 && (priv->fids[i] & 0xffff0000); i++); | 2101 | for (; i < MAX_FIDS / 2 && (priv->fids[i] & 0xffff0000); i++); |
| 2103 | } else { | 2102 | } else { |
| 2104 | priv->fids[fid] &= 0xffff; | 2103 | priv->fids[fid] &= 0xffff; |
| 2105 | priv->stats.tx_window_errors++; | 2104 | dev->stats.tx_window_errors++; |
| 2106 | } | 2105 | } |
| 2107 | if (i < MAX_FIDS / 2) | 2106 | if (i < MAX_FIDS / 2) |
| 2108 | netif_wake_queue(dev); | 2107 | netif_wake_queue(dev); |
| @@ -2128,7 +2127,7 @@ static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) { | |||
| 2128 | netif_stop_queue(dev); | 2127 | netif_stop_queue(dev); |
| 2129 | 2128 | ||
| 2130 | if (i == MAX_FIDS / 2) { | 2129 | if (i == MAX_FIDS / 2) { |
| 2131 | priv->stats.tx_fifo_errors++; | 2130 | dev->stats.tx_fifo_errors++; |
| 2132 | return 1; | 2131 | return 1; |
| 2133 | } | 2132 | } |
| 2134 | } | 2133 | } |
| @@ -2167,7 +2166,7 @@ static void airo_end_xmit11(struct net_device *dev) { | |||
| 2167 | for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); | 2166 | for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); |
| 2168 | } else { | 2167 | } else { |
| 2169 | priv->fids[fid] &= 0xffff; | 2168 | priv->fids[fid] &= 0xffff; |
| 2170 | priv->stats.tx_window_errors++; | 2169 | dev->stats.tx_window_errors++; |
| 2171 | } | 2170 | } |
| 2172 | if (i < MAX_FIDS) | 2171 | if (i < MAX_FIDS) |
| 2173 | netif_wake_queue(dev); | 2172 | netif_wake_queue(dev); |
| @@ -2199,7 +2198,7 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { | |||
| 2199 | netif_stop_queue(dev); | 2198 | netif_stop_queue(dev); |
| 2200 | 2199 | ||
| 2201 | if (i == MAX_FIDS) { | 2200 | if (i == MAX_FIDS) { |
| 2202 | priv->stats.tx_fifo_errors++; | 2201 | dev->stats.tx_fifo_errors++; |
| 2203 | return 1; | 2202 | return 1; |
| 2204 | } | 2203 | } |
| 2205 | } | 2204 | } |
| @@ -2219,8 +2218,9 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) { | |||
| 2219 | return 0; | 2218 | return 0; |
| 2220 | } | 2219 | } |
| 2221 | 2220 | ||
| 2222 | static void airo_read_stats(struct airo_info *ai) | 2221 | static void airo_read_stats(struct net_device *dev) |
| 2223 | { | 2222 | { |
| 2223 | struct airo_info *ai = dev->priv; | ||
| 2224 | StatsRid stats_rid; | 2224 | StatsRid stats_rid; |
| 2225 | __le32 *vals = stats_rid.vals; | 2225 | __le32 *vals = stats_rid.vals; |
| 2226 | 2226 | ||
| @@ -2232,23 +2232,24 @@ static void airo_read_stats(struct airo_info *ai) | |||
| 2232 | readStatsRid(ai, &stats_rid, RID_STATS, 0); | 2232 | readStatsRid(ai, &stats_rid, RID_STATS, 0); |
| 2233 | up(&ai->sem); | 2233 | up(&ai->sem); |
| 2234 | 2234 | ||
| 2235 | ai->stats.rx_packets = le32_to_cpu(vals[43]) + le32_to_cpu(vals[44]) + | 2235 | dev->stats.rx_packets = le32_to_cpu(vals[43]) + le32_to_cpu(vals[44]) + |
| 2236 | le32_to_cpu(vals[45]); | 2236 | le32_to_cpu(vals[45]); |
| 2237 | ai->stats.tx_packets = le32_to_cpu(vals[39]) + le32_to_cpu(vals[40]) + | 2237 | dev->stats.tx_packets = le32_to_cpu(vals[39]) + le32_to_cpu(vals[40]) + |
| 2238 | le32_to_cpu(vals[41]); | 2238 | le32_to_cpu(vals[41]); |
| 2239 | ai->stats.rx_bytes = le32_to_cpu(vals[92]); | 2239 | dev->stats.rx_bytes = le32_to_cpu(vals[92]); |
| 2240 | ai->stats.tx_bytes = le32_to_cpu(vals[91]); | 2240 | dev->stats.tx_bytes = le32_to_cpu(vals[91]); |
| 2241 | ai->stats.rx_errors = le32_to_cpu(vals[0]) + le32_to_cpu(vals[2]) + | 2241 | dev->stats.rx_errors = le32_to_cpu(vals[0]) + le32_to_cpu(vals[2]) + |
| 2242 | le32_to_cpu(vals[3]) + le32_to_cpu(vals[4]); | 2242 | le32_to_cpu(vals[3]) + le32_to_cpu(vals[4]); |
| 2243 | ai->stats.tx_errors = le32_to_cpu(vals[42]) + ai->stats.tx_fifo_errors; | 2243 | dev->stats.tx_errors = le32_to_cpu(vals[42]) + |
| 2244 | ai->stats.multicast = le32_to_cpu(vals[43]); | 2244 | dev->stats.tx_fifo_errors; |
| 2245 | ai->stats.collisions = le32_to_cpu(vals[89]); | 2245 | dev->stats.multicast = le32_to_cpu(vals[43]); |
| 2246 | dev->stats.collisions = le32_to_cpu(vals[89]); | ||
| 2246 | 2247 | ||
| 2247 | /* detailed rx_errors: */ | 2248 | /* detailed rx_errors: */ |
| 2248 | ai->stats.rx_length_errors = le32_to_cpu(vals[3]); | 2249 | dev->stats.rx_length_errors = le32_to_cpu(vals[3]); |
| 2249 | ai->stats.rx_crc_errors = le32_to_cpu(vals[4]); | 2250 | dev->stats.rx_crc_errors = le32_to_cpu(vals[4]); |
| 2250 | ai->stats.rx_frame_errors = le32_to_cpu(vals[2]); | 2251 | dev->stats.rx_frame_errors = le32_to_cpu(vals[2]); |
| 2251 | ai->stats.rx_fifo_errors = le32_to_cpu(vals[0]); | 2252 | dev->stats.rx_fifo_errors = le32_to_cpu(vals[0]); |
| 2252 | } | 2253 | } |
| 2253 | 2254 | ||
| 2254 | static struct net_device_stats *airo_get_stats(struct net_device *dev) | 2255 | static struct net_device_stats *airo_get_stats(struct net_device *dev) |
| @@ -2261,10 +2262,10 @@ static struct net_device_stats *airo_get_stats(struct net_device *dev) | |||
| 2261 | set_bit(JOB_STATS, &local->jobs); | 2262 | set_bit(JOB_STATS, &local->jobs); |
| 2262 | wake_up_interruptible(&local->thr_wait); | 2263 | wake_up_interruptible(&local->thr_wait); |
| 2263 | } else | 2264 | } else |
| 2264 | airo_read_stats(local); | 2265 | airo_read_stats(dev); |
| 2265 | } | 2266 | } |
| 2266 | 2267 | ||
| 2267 | return &local->stats; | 2268 | return &dev->stats; |
| 2268 | } | 2269 | } |
| 2269 | 2270 | ||
| 2270 | static void airo_set_promisc(struct airo_info *ai) { | 2271 | static void airo_set_promisc(struct airo_info *ai) { |
| @@ -3093,7 +3094,7 @@ static int airo_thread(void *data) { | |||
| 3093 | else if (test_bit(JOB_XMIT11, &ai->jobs)) | 3094 | else if (test_bit(JOB_XMIT11, &ai->jobs)) |
| 3094 | airo_end_xmit11(dev); | 3095 | airo_end_xmit11(dev); |
| 3095 | else if (test_bit(JOB_STATS, &ai->jobs)) | 3096 | else if (test_bit(JOB_STATS, &ai->jobs)) |
| 3096 | airo_read_stats(ai); | 3097 | airo_read_stats(dev); |
| 3097 | else if (test_bit(JOB_WSTATS, &ai->jobs)) | 3098 | else if (test_bit(JOB_WSTATS, &ai->jobs)) |
| 3098 | airo_read_wireless_stats(ai); | 3099 | airo_read_wireless_stats(ai); |
| 3099 | else if (test_bit(JOB_PROMISC, &ai->jobs)) | 3100 | else if (test_bit(JOB_PROMISC, &ai->jobs)) |
| @@ -3289,7 +3290,7 @@ static irqreturn_t airo_interrupt(int irq, void *dev_id) | |||
| 3289 | 3290 | ||
| 3290 | skb = dev_alloc_skb( len + hdrlen + 2 + 2 ); | 3291 | skb = dev_alloc_skb( len + hdrlen + 2 + 2 ); |
| 3291 | if ( !skb ) { | 3292 | if ( !skb ) { |
| 3292 | apriv->stats.rx_dropped++; | 3293 | dev->stats.rx_dropped++; |
| 3293 | goto badrx; | 3294 | goto badrx; |
| 3294 | } | 3295 | } |
| 3295 | skb_reserve(skb, 2); /* This way the IP header is aligned */ | 3296 | skb_reserve(skb, 2); /* This way the IP header is aligned */ |
| @@ -3557,7 +3558,7 @@ static void mpi_receive_802_3(struct airo_info *ai) | |||
| 3557 | 3558 | ||
| 3558 | skb = dev_alloc_skb(len); | 3559 | skb = dev_alloc_skb(len); |
| 3559 | if (!skb) { | 3560 | if (!skb) { |
| 3560 | ai->stats.rx_dropped++; | 3561 | ai->dev->stats.rx_dropped++; |
| 3561 | goto badrx; | 3562 | goto badrx; |
| 3562 | } | 3563 | } |
| 3563 | buffer = skb_put(skb,len); | 3564 | buffer = skb_put(skb,len); |
| @@ -3650,7 +3651,7 @@ void mpi_receive_802_11 (struct airo_info *ai) | |||
| 3650 | 3651 | ||
| 3651 | skb = dev_alloc_skb( len + hdrlen + 2 ); | 3652 | skb = dev_alloc_skb( len + hdrlen + 2 ); |
| 3652 | if ( !skb ) { | 3653 | if ( !skb ) { |
| 3653 | ai->stats.rx_dropped++; | 3654 | ai->dev->stats.rx_dropped++; |
| 3654 | goto badrx; | 3655 | goto badrx; |
| 3655 | } | 3656 | } |
| 3656 | buffer = (u16*)skb_put (skb, len + hdrlen); | 3657 | buffer = (u16*)skb_put (skb, len + hdrlen); |
| @@ -4560,22 +4561,13 @@ static ssize_t proc_read( struct file *file, | |||
| 4560 | size_t len, | 4561 | size_t len, |
| 4561 | loff_t *offset ) | 4562 | loff_t *offset ) |
| 4562 | { | 4563 | { |
| 4563 | loff_t pos = *offset; | 4564 | struct proc_data *priv = file->private_data; |
| 4564 | struct proc_data *priv = (struct proc_data*)file->private_data; | ||
| 4565 | 4565 | ||
| 4566 | if (!priv->rbuffer) | 4566 | if (!priv->rbuffer) |
| 4567 | return -EINVAL; | 4567 | return -EINVAL; |
| 4568 | 4568 | ||
| 4569 | if (pos < 0) | 4569 | return simple_read_from_buffer(buffer, len, offset, priv->rbuffer, |
| 4570 | return -EINVAL; | 4570 | priv->readlen); |
| 4571 | if (pos >= priv->readlen) | ||
| 4572 | return 0; | ||
| 4573 | if (len > priv->readlen - pos) | ||
| 4574 | len = priv->readlen - pos; | ||
| 4575 | if (copy_to_user(buffer, priv->rbuffer + pos, len)) | ||
| 4576 | return -EFAULT; | ||
| 4577 | *offset = pos + len; | ||
| 4578 | return len; | ||
| 4579 | } | 4571 | } |
| 4580 | 4572 | ||
| 4581 | /* | 4573 | /* |
| @@ -5530,11 +5522,13 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 5530 | Cmd cmd; | 5522 | Cmd cmd; |
| 5531 | Resp rsp; | 5523 | Resp rsp; |
| 5532 | 5524 | ||
| 5533 | if ((ai->APList == NULL) && | 5525 | if (!ai->APList) |
| 5534 | (ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL)) == NULL) | 5526 | ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL); |
| 5527 | if (!ai->APList) | ||
| 5535 | return -ENOMEM; | 5528 | return -ENOMEM; |
| 5536 | if ((ai->SSID == NULL) && | 5529 | if (!ai->SSID) |
| 5537 | (ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL)) == NULL) | 5530 | ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL); |
| 5531 | if (!ai->SSID) | ||
| 5538 | return -ENOMEM; | 5532 | return -ENOMEM; |
| 5539 | readAPListRid(ai, ai->APList); | 5533 | readAPListRid(ai, ai->APList); |
| 5540 | readSsidRid(ai, ai->SSID); | 5534 | readSsidRid(ai, ai->SSID); |
| @@ -5545,7 +5539,7 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 5545 | disable_MAC(ai, 0); | 5539 | disable_MAC(ai, 0); |
| 5546 | netif_device_detach(dev); | 5540 | netif_device_detach(dev); |
| 5547 | ai->power = state; | 5541 | ai->power = state; |
| 5548 | cmd.cmd=HOSTSLEEP; | 5542 | cmd.cmd = HOSTSLEEP; |
| 5549 | issuecommand(ai, &cmd, &rsp); | 5543 | issuecommand(ai, &cmd, &rsp); |
| 5550 | 5544 | ||
| 5551 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); | 5545 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); |
| @@ -5575,7 +5569,7 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
| 5575 | msleep(100); | 5569 | msleep(100); |
| 5576 | } | 5570 | } |
| 5577 | 5571 | ||
| 5578 | set_bit (FLAG_COMMIT, &ai->flags); | 5572 | set_bit(FLAG_COMMIT, &ai->flags); |
| 5579 | disable_MAC(ai, 0); | 5573 | disable_MAC(ai, 0); |
| 5580 | msleep(200); | 5574 | msleep(200); |
| 5581 | if (ai->SSID) { | 5575 | if (ai->SSID) { |
| @@ -5602,9 +5596,6 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
| 5602 | static int __init airo_init_module( void ) | 5596 | static int __init airo_init_module( void ) |
| 5603 | { | 5597 | { |
| 5604 | int i; | 5598 | int i; |
| 5605 | #if 0 | ||
| 5606 | int have_isa_dev = 0; | ||
| 5607 | #endif | ||
| 5608 | 5599 | ||
| 5609 | airo_entry = create_proc_entry("driver/aironet", | 5600 | airo_entry = create_proc_entry("driver/aironet", |
| 5610 | S_IFDIR | airo_perm, | 5601 | S_IFDIR | airo_perm, |
| @@ -5615,15 +5606,11 @@ static int __init airo_init_module( void ) | |||
| 5615 | airo_entry->gid = proc_gid; | 5606 | airo_entry->gid = proc_gid; |
| 5616 | } | 5607 | } |
| 5617 | 5608 | ||
| 5618 | for( i = 0; i < 4 && io[i] && irq[i]; i++ ) { | 5609 | for (i = 0; i < 4 && io[i] && irq[i]; i++) { |
| 5619 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " | 5610 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " |
| 5620 | "io=0x%x", irq[i], io[i] ); | 5611 | "io=0x%x", irq[i], io[i] ); |
| 5621 | if (init_airo_card( irq[i], io[i], 0, NULL )) | 5612 | if (init_airo_card( irq[i], io[i], 0, NULL )) |
| 5622 | #if 0 | ||
| 5623 | have_isa_dev = 1; | ||
| 5624 | #else | ||
| 5625 | /* do nothing */ ; | 5613 | /* do nothing */ ; |
| 5626 | #endif | ||
| 5627 | } | 5614 | } |
| 5628 | 5615 | ||
| 5629 | #ifdef CONFIG_PCI | 5616 | #ifdef CONFIG_PCI |
| @@ -5669,7 +5656,7 @@ static void __exit airo_cleanup_module( void ) | |||
| 5669 | 5656 | ||
| 5670 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) | 5657 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) |
| 5671 | { | 5658 | { |
| 5672 | if( !rssi_rid ) | 5659 | if (!rssi_rid) |
| 5673 | return 0; | 5660 | return 0; |
| 5674 | 5661 | ||
| 5675 | return (0x100 - rssi_rid[rssi].rssidBm); | 5662 | return (0x100 - rssi_rid[rssi].rssidBm); |
| @@ -5679,10 +5666,10 @@ static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm) | |||
| 5679 | { | 5666 | { |
| 5680 | int i; | 5667 | int i; |
| 5681 | 5668 | ||
| 5682 | if( !rssi_rid ) | 5669 | if (!rssi_rid) |
| 5683 | return 0; | 5670 | return 0; |
| 5684 | 5671 | ||
| 5685 | for( i = 0; i < 256; i++ ) | 5672 | for (i = 0; i < 256; i++) |
| 5686 | if (rssi_rid[i].rssidBm == dbm) | 5673 | if (rssi_rid[i].rssidBm == dbm) |
| 5687 | return rssi_rid[i].rssipct; | 5674 | return rssi_rid[i].rssipct; |
| 5688 | 5675 | ||
| @@ -7164,6 +7151,7 @@ out: | |||
| 7164 | * format that the Wireless Tools will understand - Jean II | 7151 | * format that the Wireless Tools will understand - Jean II |
| 7165 | */ | 7152 | */ |
| 7166 | static inline char *airo_translate_scan(struct net_device *dev, | 7153 | static inline char *airo_translate_scan(struct net_device *dev, |
| 7154 | struct iw_request_info *info, | ||
| 7167 | char *current_ev, | 7155 | char *current_ev, |
| 7168 | char *end_buf, | 7156 | char *end_buf, |
| 7169 | BSSListRid *bss) | 7157 | BSSListRid *bss) |
| @@ -7180,7 +7168,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7180 | iwe.cmd = SIOCGIWAP; | 7168 | iwe.cmd = SIOCGIWAP; |
| 7181 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 7169 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
| 7182 | memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); | 7170 | memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); |
| 7183 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); | 7171 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 7172 | &iwe, IW_EV_ADDR_LEN); | ||
| 7184 | 7173 | ||
| 7185 | /* Other entries will be displayed in the order we give them */ | 7174 | /* Other entries will be displayed in the order we give them */ |
| 7186 | 7175 | ||
| @@ -7190,7 +7179,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7190 | iwe.u.data.length = 32; | 7179 | iwe.u.data.length = 32; |
| 7191 | iwe.cmd = SIOCGIWESSID; | 7180 | iwe.cmd = SIOCGIWESSID; |
| 7192 | iwe.u.data.flags = 1; | 7181 | iwe.u.data.flags = 1; |
| 7193 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid); | 7182 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 7183 | &iwe, bss->ssid); | ||
| 7194 | 7184 | ||
| 7195 | /* Add mode */ | 7185 | /* Add mode */ |
| 7196 | iwe.cmd = SIOCGIWMODE; | 7186 | iwe.cmd = SIOCGIWMODE; |
| @@ -7200,7 +7190,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7200 | iwe.u.mode = IW_MODE_MASTER; | 7190 | iwe.u.mode = IW_MODE_MASTER; |
| 7201 | else | 7191 | else |
| 7202 | iwe.u.mode = IW_MODE_ADHOC; | 7192 | iwe.u.mode = IW_MODE_ADHOC; |
| 7203 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN); | 7193 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 7194 | &iwe, IW_EV_UINT_LEN); | ||
| 7204 | } | 7195 | } |
| 7205 | 7196 | ||
| 7206 | /* Add frequency */ | 7197 | /* Add frequency */ |
| @@ -7211,7 +7202,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7211 | */ | 7202 | */ |
| 7212 | iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000; | 7203 | iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000; |
| 7213 | iwe.u.freq.e = 1; | 7204 | iwe.u.freq.e = 1; |
| 7214 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); | 7205 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 7206 | &iwe, IW_EV_FREQ_LEN); | ||
| 7215 | 7207 | ||
| 7216 | dBm = le16_to_cpu(bss->dBm); | 7208 | dBm = le16_to_cpu(bss->dBm); |
| 7217 | 7209 | ||
| @@ -7231,7 +7223,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7231 | | IW_QUAL_DBM; | 7223 | | IW_QUAL_DBM; |
| 7232 | } | 7224 | } |
| 7233 | iwe.u.qual.noise = ai->wstats.qual.noise; | 7225 | iwe.u.qual.noise = ai->wstats.qual.noise; |
| 7234 | current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); | 7226 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, |
| 7227 | &iwe, IW_EV_QUAL_LEN); | ||
| 7235 | 7228 | ||
| 7236 | /* Add encryption capability */ | 7229 | /* Add encryption capability */ |
| 7237 | iwe.cmd = SIOCGIWENCODE; | 7230 | iwe.cmd = SIOCGIWENCODE; |
| @@ -7240,11 +7233,12 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7240 | else | 7233 | else |
| 7241 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 7234 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
| 7242 | iwe.u.data.length = 0; | 7235 | iwe.u.data.length = 0; |
| 7243 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid); | 7236 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 7237 | &iwe, bss->ssid); | ||
| 7244 | 7238 | ||
| 7245 | /* Rate : stuffing multiple values in a single event require a bit | 7239 | /* Rate : stuffing multiple values in a single event require a bit |
| 7246 | * more of magic - Jean II */ | 7240 | * more of magic - Jean II */ |
| 7247 | current_val = current_ev + IW_EV_LCP_LEN; | 7241 | current_val = current_ev + iwe_stream_lcp_len(info); |
| 7248 | 7242 | ||
| 7249 | iwe.cmd = SIOCGIWRATE; | 7243 | iwe.cmd = SIOCGIWRATE; |
| 7250 | /* Those two flags are ignored... */ | 7244 | /* Those two flags are ignored... */ |
| @@ -7257,10 +7251,12 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7257 | /* Bit rate given in 500 kb/s units (+ 0x80) */ | 7251 | /* Bit rate given in 500 kb/s units (+ 0x80) */ |
| 7258 | iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); | 7252 | iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); |
| 7259 | /* Add new value to event */ | 7253 | /* Add new value to event */ |
| 7260 | current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); | 7254 | current_val = iwe_stream_add_value(info, current_ev, |
| 7255 | current_val, end_buf, | ||
| 7256 | &iwe, IW_EV_PARAM_LEN); | ||
| 7261 | } | 7257 | } |
| 7262 | /* Check if we added any event */ | 7258 | /* Check if we added any event */ |
| 7263 | if((current_val - current_ev) > IW_EV_LCP_LEN) | 7259 | if ((current_val - current_ev) > iwe_stream_lcp_len(info)) |
| 7264 | current_ev = current_val; | 7260 | current_ev = current_val; |
| 7265 | 7261 | ||
| 7266 | /* Beacon interval */ | 7262 | /* Beacon interval */ |
| @@ -7269,7 +7265,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7269 | iwe.cmd = IWEVCUSTOM; | 7265 | iwe.cmd = IWEVCUSTOM; |
| 7270 | sprintf(buf, "bcn_int=%d", bss->beaconInterval); | 7266 | sprintf(buf, "bcn_int=%d", bss->beaconInterval); |
| 7271 | iwe.u.data.length = strlen(buf); | 7267 | iwe.u.data.length = strlen(buf); |
| 7272 | current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf); | 7268 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, |
| 7269 | &iwe, buf); | ||
| 7273 | kfree(buf); | 7270 | kfree(buf); |
| 7274 | } | 7271 | } |
| 7275 | 7272 | ||
| @@ -7303,8 +7300,10 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7303 | iwe.cmd = IWEVGENIE; | 7300 | iwe.cmd = IWEVGENIE; |
| 7304 | iwe.u.data.length = min(info_element->len + 2, | 7301 | iwe.u.data.length = min(info_element->len + 2, |
| 7305 | MAX_WPA_IE_LEN); | 7302 | MAX_WPA_IE_LEN); |
| 7306 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 7303 | current_ev = iwe_stream_add_point( |
| 7307 | &iwe, (char *) info_element); | 7304 | info, current_ev, |
| 7305 | end_buf, &iwe, | ||
| 7306 | (char *) info_element); | ||
| 7308 | } | 7307 | } |
| 7309 | break; | 7308 | break; |
| 7310 | 7309 | ||
| @@ -7312,8 +7311,9 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
| 7312 | iwe.cmd = IWEVGENIE; | 7311 | iwe.cmd = IWEVGENIE; |
| 7313 | iwe.u.data.length = min(info_element->len + 2, | 7312 | iwe.u.data.length = min(info_element->len + 2, |
| 7314 | MAX_WPA_IE_LEN); | 7313 | MAX_WPA_IE_LEN); |
| 7315 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 7314 | current_ev = iwe_stream_add_point( |
| 7316 | &iwe, (char *) info_element); | 7315 | info, current_ev, end_buf, |
| 7316 | &iwe, (char *) info_element); | ||
| 7317 | break; | 7317 | break; |
| 7318 | 7318 | ||
| 7319 | default: | 7319 | default: |
| @@ -7352,7 +7352,7 @@ static int airo_get_scan(struct net_device *dev, | |||
| 7352 | 7352 | ||
| 7353 | list_for_each_entry (net, &ai->network_list, list) { | 7353 | list_for_each_entry (net, &ai->network_list, list) { |
| 7354 | /* Translate to WE format this entry */ | 7354 | /* Translate to WE format this entry */ |
| 7355 | current_ev = airo_translate_scan(dev, current_ev, | 7355 | current_ev = airo_translate_scan(dev, info, current_ev, |
| 7356 | extra + dwrq->length, | 7356 | extra + dwrq->length, |
| 7357 | &net->bss); | 7357 | &net->bss); |
| 7358 | 7358 | ||
