diff options
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r-- | drivers/net/wireless/airo.c | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index e30f8b79ea89..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 |
@@ -5522,11 +5522,13 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5522 | Cmd cmd; | 5522 | Cmd cmd; |
5523 | Resp rsp; | 5523 | Resp rsp; |
5524 | 5524 | ||
5525 | if ((ai->APList == NULL) && | 5525 | if (!ai->APList) |
5526 | (ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL)) == NULL) | 5526 | ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL); |
5527 | if (!ai->APList) | ||
5527 | return -ENOMEM; | 5528 | return -ENOMEM; |
5528 | if ((ai->SSID == NULL) && | 5529 | if (!ai->SSID) |
5529 | (ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL)) == NULL) | 5530 | ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL); |
5531 | if (!ai->SSID) | ||
5530 | return -ENOMEM; | 5532 | return -ENOMEM; |
5531 | readAPListRid(ai, ai->APList); | 5533 | readAPListRid(ai, ai->APList); |
5532 | readSsidRid(ai, ai->SSID); | 5534 | readSsidRid(ai, ai->SSID); |
@@ -5537,7 +5539,7 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5537 | disable_MAC(ai, 0); | 5539 | disable_MAC(ai, 0); |
5538 | netif_device_detach(dev); | 5540 | netif_device_detach(dev); |
5539 | ai->power = state; | 5541 | ai->power = state; |
5540 | cmd.cmd=HOSTSLEEP; | 5542 | cmd.cmd = HOSTSLEEP; |
5541 | issuecommand(ai, &cmd, &rsp); | 5543 | issuecommand(ai, &cmd, &rsp); |
5542 | 5544 | ||
5543 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); | 5545 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); |
@@ -5567,7 +5569,7 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
5567 | msleep(100); | 5569 | msleep(100); |
5568 | } | 5570 | } |
5569 | 5571 | ||
5570 | set_bit (FLAG_COMMIT, &ai->flags); | 5572 | set_bit(FLAG_COMMIT, &ai->flags); |
5571 | disable_MAC(ai, 0); | 5573 | disable_MAC(ai, 0); |
5572 | msleep(200); | 5574 | msleep(200); |
5573 | if (ai->SSID) { | 5575 | if (ai->SSID) { |
@@ -5594,9 +5596,6 @@ static int airo_pci_resume(struct pci_dev *pdev) | |||
5594 | static int __init airo_init_module( void ) | 5596 | static int __init airo_init_module( void ) |
5595 | { | 5597 | { |
5596 | int i; | 5598 | int i; |
5597 | #if 0 | ||
5598 | int have_isa_dev = 0; | ||
5599 | #endif | ||
5600 | 5599 | ||
5601 | airo_entry = create_proc_entry("driver/aironet", | 5600 | airo_entry = create_proc_entry("driver/aironet", |
5602 | S_IFDIR | airo_perm, | 5601 | S_IFDIR | airo_perm, |
@@ -5607,15 +5606,11 @@ static int __init airo_init_module( void ) | |||
5607 | airo_entry->gid = proc_gid; | 5606 | airo_entry->gid = proc_gid; |
5608 | } | 5607 | } |
5609 | 5608 | ||
5610 | for( i = 0; i < 4 && io[i] && irq[i]; i++ ) { | 5609 | for (i = 0; i < 4 && io[i] && irq[i]; i++) { |
5611 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " | 5610 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " |
5612 | "io=0x%x", irq[i], io[i] ); | 5611 | "io=0x%x", irq[i], io[i] ); |
5613 | if (init_airo_card( irq[i], io[i], 0, NULL )) | 5612 | if (init_airo_card( irq[i], io[i], 0, NULL )) |
5614 | #if 0 | ||
5615 | have_isa_dev = 1; | ||
5616 | #else | ||
5617 | /* do nothing */ ; | 5613 | /* do nothing */ ; |
5618 | #endif | ||
5619 | } | 5614 | } |
5620 | 5615 | ||
5621 | #ifdef CONFIG_PCI | 5616 | #ifdef CONFIG_PCI |
@@ -5661,7 +5656,7 @@ static void __exit airo_cleanup_module( void ) | |||
5661 | 5656 | ||
5662 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) | 5657 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) |
5663 | { | 5658 | { |
5664 | if( !rssi_rid ) | 5659 | if (!rssi_rid) |
5665 | return 0; | 5660 | return 0; |
5666 | 5661 | ||
5667 | return (0x100 - rssi_rid[rssi].rssidBm); | 5662 | return (0x100 - rssi_rid[rssi].rssidBm); |
@@ -5671,10 +5666,10 @@ static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm) | |||
5671 | { | 5666 | { |
5672 | int i; | 5667 | int i; |
5673 | 5668 | ||
5674 | if( !rssi_rid ) | 5669 | if (!rssi_rid) |
5675 | return 0; | 5670 | return 0; |
5676 | 5671 | ||
5677 | for( i = 0; i < 256; i++ ) | 5672 | for (i = 0; i < 256; i++) |
5678 | if (rssi_rid[i].rssidBm == dbm) | 5673 | if (rssi_rid[i].rssidBm == dbm) |
5679 | return rssi_rid[i].rssipct; | 5674 | return rssi_rid[i].rssipct; |
5680 | 5675 | ||
@@ -7156,6 +7151,7 @@ out: | |||
7156 | * format that the Wireless Tools will understand - Jean II | 7151 | * format that the Wireless Tools will understand - Jean II |
7157 | */ | 7152 | */ |
7158 | 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, | ||
7159 | char *current_ev, | 7155 | char *current_ev, |
7160 | char *end_buf, | 7156 | char *end_buf, |
7161 | BSSListRid *bss) | 7157 | BSSListRid *bss) |
@@ -7172,7 +7168,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7172 | iwe.cmd = SIOCGIWAP; | 7168 | iwe.cmd = SIOCGIWAP; |
7173 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 7169 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
7174 | memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); | 7170 | memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); |
7175 | 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); | ||
7176 | 7173 | ||
7177 | /* Other entries will be displayed in the order we give them */ | 7174 | /* Other entries will be displayed in the order we give them */ |
7178 | 7175 | ||
@@ -7182,7 +7179,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7182 | iwe.u.data.length = 32; | 7179 | iwe.u.data.length = 32; |
7183 | iwe.cmd = SIOCGIWESSID; | 7180 | iwe.cmd = SIOCGIWESSID; |
7184 | iwe.u.data.flags = 1; | 7181 | iwe.u.data.flags = 1; |
7185 | 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); | ||
7186 | 7184 | ||
7187 | /* Add mode */ | 7185 | /* Add mode */ |
7188 | iwe.cmd = SIOCGIWMODE; | 7186 | iwe.cmd = SIOCGIWMODE; |
@@ -7192,7 +7190,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7192 | iwe.u.mode = IW_MODE_MASTER; | 7190 | iwe.u.mode = IW_MODE_MASTER; |
7193 | else | 7191 | else |
7194 | iwe.u.mode = IW_MODE_ADHOC; | 7192 | iwe.u.mode = IW_MODE_ADHOC; |
7195 | 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); | ||
7196 | } | 7195 | } |
7197 | 7196 | ||
7198 | /* Add frequency */ | 7197 | /* Add frequency */ |
@@ -7203,7 +7202,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7203 | */ | 7202 | */ |
7204 | 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; |
7205 | iwe.u.freq.e = 1; | 7204 | iwe.u.freq.e = 1; |
7206 | 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); | ||
7207 | 7207 | ||
7208 | dBm = le16_to_cpu(bss->dBm); | 7208 | dBm = le16_to_cpu(bss->dBm); |
7209 | 7209 | ||
@@ -7223,7 +7223,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7223 | | IW_QUAL_DBM; | 7223 | | IW_QUAL_DBM; |
7224 | } | 7224 | } |
7225 | iwe.u.qual.noise = ai->wstats.qual.noise; | 7225 | iwe.u.qual.noise = ai->wstats.qual.noise; |
7226 | 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); | ||
7227 | 7228 | ||
7228 | /* Add encryption capability */ | 7229 | /* Add encryption capability */ |
7229 | iwe.cmd = SIOCGIWENCODE; | 7230 | iwe.cmd = SIOCGIWENCODE; |
@@ -7232,11 +7233,12 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7232 | else | 7233 | else |
7233 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 7234 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
7234 | iwe.u.data.length = 0; | 7235 | iwe.u.data.length = 0; |
7235 | 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); | ||
7236 | 7238 | ||
7237 | /* Rate : stuffing multiple values in a single event require a bit | 7239 | /* Rate : stuffing multiple values in a single event require a bit |
7238 | * more of magic - Jean II */ | 7240 | * more of magic - Jean II */ |
7239 | current_val = current_ev + IW_EV_LCP_LEN; | 7241 | current_val = current_ev + iwe_stream_lcp_len(info); |
7240 | 7242 | ||
7241 | iwe.cmd = SIOCGIWRATE; | 7243 | iwe.cmd = SIOCGIWRATE; |
7242 | /* Those two flags are ignored... */ | 7244 | /* Those two flags are ignored... */ |
@@ -7249,10 +7251,12 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7249 | /* Bit rate given in 500 kb/s units (+ 0x80) */ | 7251 | /* Bit rate given in 500 kb/s units (+ 0x80) */ |
7250 | iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); | 7252 | iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); |
7251 | /* Add new value to event */ | 7253 | /* Add new value to event */ |
7252 | 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); | ||
7253 | } | 7257 | } |
7254 | /* Check if we added any event */ | 7258 | /* Check if we added any event */ |
7255 | if((current_val - current_ev) > IW_EV_LCP_LEN) | 7259 | if ((current_val - current_ev) > iwe_stream_lcp_len(info)) |
7256 | current_ev = current_val; | 7260 | current_ev = current_val; |
7257 | 7261 | ||
7258 | /* Beacon interval */ | 7262 | /* Beacon interval */ |
@@ -7261,7 +7265,8 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7261 | iwe.cmd = IWEVCUSTOM; | 7265 | iwe.cmd = IWEVCUSTOM; |
7262 | sprintf(buf, "bcn_int=%d", bss->beaconInterval); | 7266 | sprintf(buf, "bcn_int=%d", bss->beaconInterval); |
7263 | iwe.u.data.length = strlen(buf); | 7267 | iwe.u.data.length = strlen(buf); |
7264 | 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); | ||
7265 | kfree(buf); | 7270 | kfree(buf); |
7266 | } | 7271 | } |
7267 | 7272 | ||
@@ -7295,8 +7300,10 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7295 | iwe.cmd = IWEVGENIE; | 7300 | iwe.cmd = IWEVGENIE; |
7296 | iwe.u.data.length = min(info_element->len + 2, | 7301 | iwe.u.data.length = min(info_element->len + 2, |
7297 | MAX_WPA_IE_LEN); | 7302 | MAX_WPA_IE_LEN); |
7298 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 7303 | current_ev = iwe_stream_add_point( |
7299 | &iwe, (char *) info_element); | 7304 | info, current_ev, |
7305 | end_buf, &iwe, | ||
7306 | (char *) info_element); | ||
7300 | } | 7307 | } |
7301 | break; | 7308 | break; |
7302 | 7309 | ||
@@ -7304,8 +7311,9 @@ static inline char *airo_translate_scan(struct net_device *dev, | |||
7304 | iwe.cmd = IWEVGENIE; | 7311 | iwe.cmd = IWEVGENIE; |
7305 | iwe.u.data.length = min(info_element->len + 2, | 7312 | iwe.u.data.length = min(info_element->len + 2, |
7306 | MAX_WPA_IE_LEN); | 7313 | MAX_WPA_IE_LEN); |
7307 | current_ev = iwe_stream_add_point(current_ev, end_buf, | 7314 | current_ev = iwe_stream_add_point( |
7308 | &iwe, (char *) info_element); | 7315 | info, current_ev, end_buf, |
7316 | &iwe, (char *) info_element); | ||
7309 | break; | 7317 | break; |
7310 | 7318 | ||
7311 | default: | 7319 | default: |
@@ -7344,7 +7352,7 @@ static int airo_get_scan(struct net_device *dev, | |||
7344 | 7352 | ||
7345 | list_for_each_entry (net, &ai->network_list, list) { | 7353 | list_for_each_entry (net, &ai->network_list, list) { |
7346 | /* Translate to WE format this entry */ | 7354 | /* Translate to WE format this entry */ |
7347 | current_ev = airo_translate_scan(dev, current_ev, | 7355 | current_ev = airo_translate_scan(dev, info, current_ev, |
7348 | extra + dwrq->length, | 7356 | extra + dwrq->length, |
7349 | &net->bss); | 7357 | &net->bss); |
7350 | 7358 | ||