aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/Kconfig7
-rw-r--r--drivers/net/wireless/airo.c331
-rw-r--r--drivers/net/wireless/ipw2100.c48
-rw-r--r--drivers/net/wireless/ipw2100.h6
-rw-r--r--drivers/net/wireless/ipw2200.c876
-rw-r--r--drivers/net/wireless/ipw2200.h64
-rw-r--r--drivers/net/wireless/netwave_cs.c2
-rw-r--r--drivers/net/wireless/strip.c4
-rw-r--r--drivers/net/wireless/wavelan.p.h6
-rw-r--r--drivers/net/wireless/wavelan_cs.p.h9
10 files changed, 814 insertions, 539 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index ef85d76575a2..a1ede41d9071 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -6,7 +6,8 @@ menu "Wireless LAN (non-hamradio)"
6 depends on NETDEVICES 6 depends on NETDEVICES
7 7
8config NET_RADIO 8config NET_RADIO
9 bool "Wireless LAN drivers (non-hamradio) & Wireless Extensions" 9 bool "Wireless LAN drivers (non-hamradio)"
10 select WIRELESS_EXT
10 ---help--- 11 ---help---
11 Support for wireless LANs and everything having to do with radio, 12 Support for wireless LANs and everything having to do with radio,
12 but not with amateur radio or FM broadcasting. 13 but not with amateur radio or FM broadcasting.
@@ -239,7 +240,8 @@ config IPW2200_DEBUG
239 240
240config AIRO 241config AIRO
241 tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" 242 tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
242 depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN) 243 depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN)
244 select CRYPTO
243 ---help--- 245 ---help---
244 This is the standard Linux driver to support Cisco/Aironet ISA and 246 This is the standard Linux driver to support Cisco/Aironet ISA and
245 PCI 802.11 wireless cards. 247 PCI 802.11 wireless cards.
@@ -387,6 +389,7 @@ config PCMCIA_SPECTRUM
387config AIRO_CS 389config AIRO_CS
388 tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" 390 tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"
389 depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) 391 depends on NET_RADIO && PCMCIA && (BROKEN || !M32R)
392 select CRYPTO
390 ---help--- 393 ---help---
391 This is the standard Linux driver to support Cisco/Aironet PCMCIA 394 This is the standard Linux driver to support Cisco/Aironet PCMCIA
392 802.11 wireless cards. This driver is the same as the Aironet 395 802.11 wireless cards. This driver is the same as the Aironet
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index a4c7ae94614d..ef6495b07890 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -36,6 +36,7 @@
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 <linux/scatterlist.h>
39#include <linux/crypto.h>
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/system.h> 41#include <asm/system.h>
41 42
@@ -87,14 +88,6 @@ static struct pci_driver airo_driver = {
87#include <linux/delay.h> 88#include <linux/delay.h>
88#endif 89#endif
89 90
90/* Support Cisco MIC feature */
91#define MICSUPPORT
92
93#if defined(MICSUPPORT) && !defined(CONFIG_CRYPTO)
94#warning MIC support requires Crypto API
95#undef MICSUPPORT
96#endif
97
98/* Hack to do some power saving */ 91/* Hack to do some power saving */
99#define POWER_ON_DOWN 92#define POWER_ON_DOWN
100 93
@@ -1118,7 +1111,6 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp);
1118static int writerids(struct net_device *dev, aironet_ioctl *comp); 1111static int writerids(struct net_device *dev, aironet_ioctl *comp);
1119static int flashcard(struct net_device *dev, aironet_ioctl *comp); 1112static int flashcard(struct net_device *dev, aironet_ioctl *comp);
1120#endif /* CISCO_EXT */ 1113#endif /* CISCO_EXT */
1121#ifdef MICSUPPORT
1122static void micinit(struct airo_info *ai); 1114static void micinit(struct airo_info *ai);
1123static int micsetup(struct airo_info *ai); 1115static int micsetup(struct airo_info *ai);
1124static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len); 1116static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len);
@@ -1127,9 +1119,6 @@ static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket,
1127static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); 1119static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi);
1128static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); 1120static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm);
1129 1121
1130#include <linux/crypto.h>
1131#endif
1132
1133struct airo_info { 1122struct airo_info {
1134 struct net_device_stats stats; 1123 struct net_device_stats stats;
1135 struct net_device *dev; 1124 struct net_device *dev;
@@ -1190,12 +1179,10 @@ struct airo_info {
1190 unsigned long scan_timestamp; /* Time started to scan */ 1179 unsigned long scan_timestamp; /* Time started to scan */
1191 struct iw_spy_data spy_data; 1180 struct iw_spy_data spy_data;
1192 struct iw_public_data wireless_data; 1181 struct iw_public_data wireless_data;
1193#ifdef MICSUPPORT
1194 /* MIC stuff */ 1182 /* MIC stuff */
1195 struct crypto_tfm *tfm; 1183 struct crypto_tfm *tfm;
1196 mic_module mod[2]; 1184 mic_module mod[2];
1197 mic_statistics micstats; 1185 mic_statistics micstats;
1198#endif
1199 HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors 1186 HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors
1200 HostTxDesc txfids[MPI_MAX_FIDS]; 1187 HostTxDesc txfids[MPI_MAX_FIDS];
1201 HostRidDesc config_desc; 1188 HostRidDesc config_desc;
@@ -1229,7 +1216,6 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime);
1229static int flashputbuf(struct airo_info *ai); 1216static int flashputbuf(struct airo_info *ai);
1230static int flashrestart(struct airo_info *ai,struct net_device *dev); 1217static int flashrestart(struct airo_info *ai,struct net_device *dev);
1231 1218
1232#ifdef MICSUPPORT
1233/*********************************************************************** 1219/***********************************************************************
1234 * MIC ROUTINES * 1220 * MIC ROUTINES *
1235 *********************************************************************** 1221 ***********************************************************************
@@ -1686,7 +1672,6 @@ static void emmh32_final(emmh32_context *context, u8 digest[4])
1686 digest[2] = (val>>8) & 0xFF; 1672 digest[2] = (val>>8) & 0xFF;
1687 digest[3] = val & 0xFF; 1673 digest[3] = val & 0xFF;
1688} 1674}
1689#endif
1690 1675
1691static int readBSSListRid(struct airo_info *ai, int first, 1676static int readBSSListRid(struct airo_info *ai, int first,
1692 BSSListRid *list) { 1677 BSSListRid *list) {
@@ -2005,7 +1990,6 @@ static int mpi_send_packet (struct net_device *dev)
2005 * Firmware automaticly puts 802 header on so 1990 * Firmware automaticly puts 802 header on so
2006 * we don't need to account for it in the length 1991 * we don't need to account for it in the length
2007 */ 1992 */
2008#ifdef MICSUPPORT
2009 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && 1993 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
2010 (ntohs(((u16 *)buffer)[6]) != 0x888E)) { 1994 (ntohs(((u16 *)buffer)[6]) != 0x888E)) {
2011 MICBuffer pMic; 1995 MICBuffer pMic;
@@ -2022,9 +2006,7 @@ static int mpi_send_packet (struct net_device *dev)
2022 memcpy (sendbuf, &pMic, sizeof(pMic)); 2006 memcpy (sendbuf, &pMic, sizeof(pMic));
2023 sendbuf += sizeof(pMic); 2007 sendbuf += sizeof(pMic);
2024 memcpy (sendbuf, buffer, len - sizeof(etherHead)); 2008 memcpy (sendbuf, buffer, len - sizeof(etherHead));
2025 } else 2009 } else {
2026#endif
2027 {
2028 *payloadLen = cpu_to_le16(len - sizeof(etherHead)); 2010 *payloadLen = cpu_to_le16(len - sizeof(etherHead));
2029 2011
2030 dev->trans_start = jiffies; 2012 dev->trans_start = jiffies;
@@ -2400,9 +2382,7 @@ void stop_airo_card( struct net_device *dev, int freeres )
2400 ai->shared, ai->shared_dma); 2382 ai->shared, ai->shared_dma);
2401 } 2383 }
2402 } 2384 }
2403#ifdef MICSUPPORT
2404 crypto_free_tfm(ai->tfm); 2385 crypto_free_tfm(ai->tfm);
2405#endif
2406 del_airo_dev( dev ); 2386 del_airo_dev( dev );
2407 free_netdev( dev ); 2387 free_netdev( dev );
2408} 2388}
@@ -2726,9 +2706,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2726 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES); 2706 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES);
2727 if (ai->thr_pid < 0) 2707 if (ai->thr_pid < 0)
2728 goto err_out_free; 2708 goto err_out_free;
2729#ifdef MICSUPPORT
2730 ai->tfm = NULL; 2709 ai->tfm = NULL;
2731#endif
2732 rc = add_airo_dev( dev ); 2710 rc = add_airo_dev( dev );
2733 if (rc) 2711 if (rc)
2734 goto err_out_thr; 2712 goto err_out_thr;
@@ -2969,10 +2947,8 @@ static int airo_thread(void *data) {
2969 airo_read_wireless_stats(ai); 2947 airo_read_wireless_stats(ai);
2970 else if (test_bit(JOB_PROMISC, &ai->flags)) 2948 else if (test_bit(JOB_PROMISC, &ai->flags))
2971 airo_set_promisc(ai); 2949 airo_set_promisc(ai);
2972#ifdef MICSUPPORT
2973 else if (test_bit(JOB_MIC, &ai->flags)) 2950 else if (test_bit(JOB_MIC, &ai->flags))
2974 micinit(ai); 2951 micinit(ai);
2975#endif
2976 else if (test_bit(JOB_EVENT, &ai->flags)) 2952 else if (test_bit(JOB_EVENT, &ai->flags))
2977 airo_send_event(dev); 2953 airo_send_event(dev);
2978 else if (test_bit(JOB_AUTOWEP, &ai->flags)) 2954 else if (test_bit(JOB_AUTOWEP, &ai->flags))
@@ -3010,12 +2986,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3010 2986
3011 if ( status & EV_MIC ) { 2987 if ( status & EV_MIC ) {
3012 OUT4500( apriv, EVACK, EV_MIC ); 2988 OUT4500( apriv, EVACK, EV_MIC );
3013#ifdef MICSUPPORT
3014 if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) { 2989 if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) {
3015 set_bit(JOB_MIC, &apriv->flags); 2990 set_bit(JOB_MIC, &apriv->flags);
3016 wake_up_interruptible(&apriv->thr_wait); 2991 wake_up_interruptible(&apriv->thr_wait);
3017 } 2992 }
3018#endif
3019 } 2993 }
3020 if ( status & EV_LINK ) { 2994 if ( status & EV_LINK ) {
3021 union iwreq_data wrqu; 2995 union iwreq_data wrqu;
@@ -3194,11 +3168,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3194 } 3168 }
3195 bap_read (apriv, buffer + hdrlen/2, len, BAP0); 3169 bap_read (apriv, buffer + hdrlen/2, len, BAP0);
3196 } else { 3170 } else {
3197#ifdef MICSUPPORT
3198 MICBuffer micbuf; 3171 MICBuffer micbuf;
3199#endif
3200 bap_read (apriv, buffer, ETH_ALEN*2, BAP0); 3172 bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
3201#ifdef MICSUPPORT
3202 if (apriv->micstats.enabled) { 3173 if (apriv->micstats.enabled) {
3203 bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0); 3174 bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
3204 if (ntohs(micbuf.typelen) > 0x05DC) 3175 if (ntohs(micbuf.typelen) > 0x05DC)
@@ -3211,15 +3182,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3211 skb_trim (skb, len + hdrlen); 3182 skb_trim (skb, len + hdrlen);
3212 } 3183 }
3213 } 3184 }
3214#endif
3215 bap_read(apriv,buffer+ETH_ALEN,len,BAP0); 3185 bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
3216#ifdef MICSUPPORT
3217 if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) { 3186 if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
3218badmic: 3187badmic:
3219 dev_kfree_skb_irq (skb); 3188 dev_kfree_skb_irq (skb);
3220#else
3221 if (0) {
3222#endif
3223badrx: 3189badrx:
3224 OUT4500( apriv, EVACK, EV_RX); 3190 OUT4500( apriv, EVACK, EV_RX);
3225 goto exitrx; 3191 goto exitrx;
@@ -3430,10 +3396,8 @@ static void mpi_receive_802_3(struct airo_info *ai)
3430 int len = 0; 3396 int len = 0;
3431 struct sk_buff *skb; 3397 struct sk_buff *skb;
3432 char *buffer; 3398 char *buffer;
3433#ifdef MICSUPPORT
3434 int off = 0; 3399 int off = 0;
3435 MICBuffer micbuf; 3400 MICBuffer micbuf;
3436#endif
3437 3401
3438 memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); 3402 memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd));
3439 /* Make sure we got something */ 3403 /* Make sure we got something */
@@ -3448,7 +3412,6 @@ static void mpi_receive_802_3(struct airo_info *ai)
3448 goto badrx; 3412 goto badrx;
3449 } 3413 }
3450 buffer = skb_put(skb,len); 3414 buffer = skb_put(skb,len);
3451#ifdef MICSUPPORT
3452 memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2); 3415 memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2);
3453 if (ai->micstats.enabled) { 3416 if (ai->micstats.enabled) {
3454 memcpy(&micbuf, 3417 memcpy(&micbuf,
@@ -3470,9 +3433,6 @@ badmic:
3470 dev_kfree_skb_irq (skb); 3433 dev_kfree_skb_irq (skb);
3471 goto badrx; 3434 goto badrx;
3472 } 3435 }
3473#else
3474 memcpy(buffer, ai->rxfids[0].virtual_host_addr, len);
3475#endif
3476#ifdef WIRELESS_SPY 3436#ifdef WIRELESS_SPY
3477 if (ai->spy_data.spy_number > 0) { 3437 if (ai->spy_data.spy_number > 0) {
3478 char *sa; 3438 char *sa;
@@ -3689,13 +3649,11 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3689 ai->config.authType = AUTH_OPEN; 3649 ai->config.authType = AUTH_OPEN;
3690 ai->config.modulation = MOD_CCK; 3650 ai->config.modulation = MOD_CCK;
3691 3651
3692#ifdef MICSUPPORT
3693 if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) && 3652 if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&
3694 (micsetup(ai) == SUCCESS)) { 3653 (micsetup(ai) == SUCCESS)) {
3695 ai->config.opmode |= MODE_MIC; 3654 ai->config.opmode |= MODE_MIC;
3696 set_bit(FLAG_MIC_CAPABLE, &ai->flags); 3655 set_bit(FLAG_MIC_CAPABLE, &ai->flags);
3697 } 3656 }
3698#endif
3699 3657
3700 /* Save off the MAC */ 3658 /* Save off the MAC */
3701 for( i = 0; i < ETH_ALEN; i++ ) { 3659 for( i = 0; i < ETH_ALEN; i++ ) {
@@ -4170,15 +4128,12 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
4170 } 4128 }
4171 len -= ETH_ALEN * 2; 4129 len -= ETH_ALEN * 2;
4172 4130
4173#ifdef MICSUPPORT
4174 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && 4131 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
4175 (ntohs(((u16 *)pPacket)[6]) != 0x888E)) { 4132 (ntohs(((u16 *)pPacket)[6]) != 0x888E)) {
4176 if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) 4133 if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS)
4177 return ERROR; 4134 return ERROR;
4178 miclen = sizeof(pMic); 4135 miclen = sizeof(pMic);
4179 } 4136 }
4180#endif
4181
4182 // packet is destination[6], source[6], payload[len-12] 4137 // packet is destination[6], source[6], payload[len-12]
4183 // write the payload length and dst/src/payload 4138 // write the payload length and dst/src/payload
4184 if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR; 4139 if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR;
@@ -5801,11 +5756,13 @@ static int airo_set_wap(struct net_device *dev,
5801 Cmd cmd; 5756 Cmd cmd;
5802 Resp rsp; 5757 Resp rsp;
5803 APListRid APList_rid; 5758 APListRid APList_rid;
5804 static const unsigned char bcast[ETH_ALEN] = { 255, 255, 255, 255, 255, 255 }; 5759 static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
5760 static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
5805 5761
5806 if (awrq->sa_family != ARPHRD_ETHER) 5762 if (awrq->sa_family != ARPHRD_ETHER)
5807 return -EINVAL; 5763 return -EINVAL;
5808 else if (!memcmp(bcast, awrq->sa_data, ETH_ALEN)) { 5764 else if (!memcmp(any, awrq->sa_data, ETH_ALEN) ||
5765 !memcmp(off, awrq->sa_data, ETH_ALEN)) {
5809 memset(&cmd, 0, sizeof(cmd)); 5766 memset(&cmd, 0, sizeof(cmd));
5810 cmd.cmd=CMD_LOSE_SYNC; 5767 cmd.cmd=CMD_LOSE_SYNC;
5811 if (down_interruptible(&local->sem)) 5768 if (down_interruptible(&local->sem))
@@ -6296,6 +6253,267 @@ static int airo_get_encode(struct net_device *dev,
6296 6253
6297/*------------------------------------------------------------------*/ 6254/*------------------------------------------------------------------*/
6298/* 6255/*
6256 * Wireless Handler : set extended Encryption parameters
6257 */
6258static int airo_set_encodeext(struct net_device *dev,
6259 struct iw_request_info *info,
6260 union iwreq_data *wrqu,
6261 char *extra)
6262{
6263 struct airo_info *local = dev->priv;
6264 struct iw_point *encoding = &wrqu->encoding;
6265 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
6266 CapabilityRid cap_rid; /* Card capability info */
6267 int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 );
6268 u16 currentAuthType = local->config.authType;
6269 int idx, key_len, alg = ext->alg; /* Check encryption mode */
6270 wep_key_t key;
6271
6272 /* Is WEP supported ? */
6273 readCapabilityRid(local, &cap_rid, 1);
6274 /* Older firmware doesn't support this...
6275 if(!(cap_rid.softCap & 2)) {
6276 return -EOPNOTSUPP;
6277 } */
6278 readConfigRid(local, 1);
6279
6280 /* Determine and validate the key index */
6281 idx = encoding->flags & IW_ENCODE_INDEX;
6282 if (idx) {
6283 if (idx < 1 || idx > ((cap_rid.softCap & 0x80) ? 4:1))
6284 return -EINVAL;
6285 idx--;
6286 } else
6287 idx = get_wep_key(local, 0xffff);
6288
6289 if (encoding->flags & IW_ENCODE_DISABLED)
6290 alg = IW_ENCODE_ALG_NONE;
6291
6292 /* Just setting the transmit key? */
6293 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
6294 set_wep_key(local, idx, NULL, 0, perm, 1);
6295 } else {
6296 /* Set the requested key first */
6297 memset(key.key, 0, MAX_KEY_SIZE);
6298 switch (alg) {
6299 case IW_ENCODE_ALG_NONE:
6300 key.len = 0;
6301 break;
6302 case IW_ENCODE_ALG_WEP:
6303 if (ext->key_len > MIN_KEY_SIZE) {
6304 key.len = MAX_KEY_SIZE;
6305 } else if (ext->key_len > 0) {
6306 key.len = MIN_KEY_SIZE;
6307 } else {
6308 return -EINVAL;
6309 }
6310 key_len = min (ext->key_len, key.len);
6311 memcpy(key.key, ext->key, key_len);
6312 break;
6313 default:
6314 return -EINVAL;
6315 }
6316 /* Send the key to the card */
6317 set_wep_key(local, idx, key.key, key.len, perm, 1);
6318 }
6319
6320 /* Read the flags */
6321 if(encoding->flags & IW_ENCODE_DISABLED)
6322 local->config.authType = AUTH_OPEN; // disable encryption
6323 if(encoding->flags & IW_ENCODE_RESTRICTED)
6324 local->config.authType = AUTH_SHAREDKEY; // Only Both
6325 if(encoding->flags & IW_ENCODE_OPEN)
6326 local->config.authType = AUTH_ENCRYPT; // Only Wep
6327 /* Commit the changes to flags if needed */
6328 if (local->config.authType != currentAuthType)
6329 set_bit (FLAG_COMMIT, &local->flags);
6330
6331 return -EINPROGRESS;
6332}
6333
6334
6335/*------------------------------------------------------------------*/
6336/*
6337 * Wireless Handler : get extended Encryption parameters
6338 */
6339static int airo_get_encodeext(struct net_device *dev,
6340 struct iw_request_info *info,
6341 union iwreq_data *wrqu,
6342 char *extra)
6343{
6344 struct airo_info *local = dev->priv;
6345 struct iw_point *encoding = &wrqu->encoding;
6346 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
6347 CapabilityRid cap_rid; /* Card capability info */
6348 int idx, max_key_len;
6349
6350 /* Is it supported ? */
6351 readCapabilityRid(local, &cap_rid, 1);
6352 if(!(cap_rid.softCap & 2)) {
6353 return -EOPNOTSUPP;
6354 }
6355 readConfigRid(local, 1);
6356
6357 max_key_len = encoding->length - sizeof(*ext);
6358 if (max_key_len < 0)
6359 return -EINVAL;
6360
6361 idx = encoding->flags & IW_ENCODE_INDEX;
6362 if (idx) {
6363 if (idx < 1 || idx > ((cap_rid.softCap & 0x80) ? 4:1))
6364 return -EINVAL;
6365 idx--;
6366 } else
6367 idx = get_wep_key(local, 0xffff);
6368
6369 encoding->flags = idx + 1;
6370 memset(ext, 0, sizeof(*ext));
6371
6372 /* Check encryption mode */
6373 switch(local->config.authType) {
6374 case AUTH_ENCRYPT:
6375 encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED;
6376 break;
6377 case AUTH_SHAREDKEY:
6378 encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED;
6379 break;
6380 default:
6381 case AUTH_OPEN:
6382 encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED;
6383 break;
6384 }
6385 /* We can't return the key, so set the proper flag and return zero */
6386 encoding->flags |= IW_ENCODE_NOKEY;
6387 memset(extra, 0, 16);
6388
6389 /* Copy the key to the user buffer */
6390 ext->key_len = get_wep_key(local, idx);
6391 if (ext->key_len > 16) {
6392 ext->key_len=0;
6393 }
6394
6395 return 0;
6396}
6397
6398
6399/*------------------------------------------------------------------*/
6400/*
6401 * Wireless Handler : set extended authentication parameters
6402 */
6403static int airo_set_auth(struct net_device *dev,
6404 struct iw_request_info *info,
6405 union iwreq_data *wrqu, char *extra)
6406{
6407 struct airo_info *local = dev->priv;
6408 struct iw_param *param = &wrqu->param;
6409 u16 currentAuthType = local->config.authType;
6410
6411 switch (param->flags & IW_AUTH_INDEX) {
6412 case IW_AUTH_WPA_VERSION:
6413 case IW_AUTH_CIPHER_PAIRWISE:
6414 case IW_AUTH_CIPHER_GROUP:
6415 case IW_AUTH_KEY_MGMT:
6416 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
6417 case IW_AUTH_PRIVACY_INVOKED:
6418 /*
6419 * airo does not use these parameters
6420 */
6421 break;
6422
6423 case IW_AUTH_DROP_UNENCRYPTED:
6424 if (param->value) {
6425 /* Only change auth type if unencrypted */
6426 if (currentAuthType == AUTH_OPEN)
6427 local->config.authType = AUTH_ENCRYPT;
6428 } else {
6429 local->config.authType = AUTH_OPEN;
6430 }
6431
6432 /* Commit the changes to flags if needed */
6433 if (local->config.authType != currentAuthType)
6434 set_bit (FLAG_COMMIT, &local->flags);
6435 break;
6436
6437 case IW_AUTH_80211_AUTH_ALG: {
6438 /* FIXME: What about AUTH_OPEN? This API seems to
6439 * disallow setting our auth to AUTH_OPEN.
6440 */
6441 if (param->value & IW_AUTH_ALG_SHARED_KEY) {
6442 local->config.authType = AUTH_SHAREDKEY;
6443 } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) {
6444 local->config.authType = AUTH_ENCRYPT;
6445 } else
6446 return -EINVAL;
6447 break;
6448
6449 /* Commit the changes to flags if needed */
6450 if (local->config.authType != currentAuthType)
6451 set_bit (FLAG_COMMIT, &local->flags);
6452 }
6453
6454 case IW_AUTH_WPA_ENABLED:
6455 /* Silently accept disable of WPA */
6456 if (param->value > 0)
6457 return -EOPNOTSUPP;
6458 break;
6459
6460 default:
6461 return -EOPNOTSUPP;
6462 }
6463 return -EINPROGRESS;
6464}
6465
6466
6467/*------------------------------------------------------------------*/
6468/*
6469 * Wireless Handler : get extended authentication parameters
6470 */
6471static int airo_get_auth(struct net_device *dev,
6472 struct iw_request_info *info,
6473 union iwreq_data *wrqu, char *extra)
6474{
6475 struct airo_info *local = dev->priv;
6476 struct iw_param *param = &wrqu->param;
6477 u16 currentAuthType = local->config.authType;
6478
6479 switch (param->flags & IW_AUTH_INDEX) {
6480 case IW_AUTH_DROP_UNENCRYPTED:
6481 switch (currentAuthType) {
6482 case AUTH_SHAREDKEY:
6483 case AUTH_ENCRYPT:
6484 param->value = 1;
6485 break;
6486 default:
6487 param->value = 0;
6488 break;
6489 }
6490 break;
6491
6492 case IW_AUTH_80211_AUTH_ALG:
6493 switch (currentAuthType) {
6494 case AUTH_SHAREDKEY:
6495 param->value = IW_AUTH_ALG_SHARED_KEY;
6496 break;
6497 case AUTH_ENCRYPT:
6498 default:
6499 param->value = IW_AUTH_ALG_OPEN_SYSTEM;
6500 break;
6501 }
6502 break;
6503
6504 case IW_AUTH_WPA_ENABLED:
6505 param->value = 0;
6506 break;
6507
6508 default:
6509 return -EOPNOTSUPP;
6510 }
6511 return 0;
6512}
6513
6514
6515/*------------------------------------------------------------------*/
6516/*
6299 * Wireless Handler : set Tx-Power 6517 * Wireless Handler : set Tx-Power
6300 */ 6518 */
6301static int airo_set_txpow(struct net_device *dev, 6519static int airo_set_txpow(struct net_device *dev,
@@ -7050,6 +7268,15 @@ static const iw_handler airo_handler[] =
7050 (iw_handler) airo_get_encode, /* SIOCGIWENCODE */ 7268 (iw_handler) airo_get_encode, /* SIOCGIWENCODE */
7051 (iw_handler) airo_set_power, /* SIOCSIWPOWER */ 7269 (iw_handler) airo_set_power, /* SIOCSIWPOWER */
7052 (iw_handler) airo_get_power, /* SIOCGIWPOWER */ 7270 (iw_handler) airo_get_power, /* SIOCGIWPOWER */
7271 (iw_handler) NULL, /* -- hole -- */
7272 (iw_handler) NULL, /* -- hole -- */
7273 (iw_handler) NULL, /* SIOCSIWGENIE */
7274 (iw_handler) NULL, /* SIOCGIWGENIE */
7275 (iw_handler) airo_set_auth, /* SIOCSIWAUTH */
7276 (iw_handler) airo_get_auth, /* SIOCGIWAUTH */
7277 (iw_handler) airo_set_encodeext, /* SIOCSIWENCODEEXT */
7278 (iw_handler) airo_get_encodeext, /* SIOCGIWENCODEEXT */
7279 (iw_handler) NULL, /* SIOCSIWPMKSA */
7053}; 7280};
7054 7281
7055/* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here. 7282/* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here.
@@ -7270,13 +7497,11 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
7270 case AIROGSTAT: ridcode = RID_STATUS; break; 7497 case AIROGSTAT: ridcode = RID_STATUS; break;
7271 case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; 7498 case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
7272 case AIROGSTATSC32: ridcode = RID_STATS; break; 7499 case AIROGSTATSC32: ridcode = RID_STATS; break;
7273#ifdef MICSUPPORT
7274 case AIROGMICSTATS: 7500 case AIROGMICSTATS:
7275 if (copy_to_user(comp->data, &ai->micstats, 7501 if (copy_to_user(comp->data, &ai->micstats,
7276 min((int)comp->len,(int)sizeof(ai->micstats)))) 7502 min((int)comp->len,(int)sizeof(ai->micstats))))
7277 return -EFAULT; 7503 return -EFAULT;
7278 return 0; 7504 return 0;
7279#endif
7280 case AIRORRID: ridcode = comp->ridnum; break; 7505 case AIRORRID: ridcode = comp->ridnum; break;
7281 default: 7506 default:
7282 return -EINVAL; 7507 return -EINVAL;
@@ -7308,9 +7533,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
7308static int writerids(struct net_device *dev, aironet_ioctl *comp) { 7533static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7309 struct airo_info *ai = dev->priv; 7534 struct airo_info *ai = dev->priv;
7310 int ridcode; 7535 int ridcode;
7311#ifdef MICSUPPORT
7312 int enabled; 7536 int enabled;
7313#endif
7314 Resp rsp; 7537 Resp rsp;
7315 static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); 7538 static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
7316 unsigned char *iobuf; 7539 unsigned char *iobuf;
@@ -7367,11 +7590,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7367 7590
7368 PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); 7591 PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1);
7369 7592
7370#ifdef MICSUPPORT
7371 enabled = ai->micstats.enabled; 7593 enabled = ai->micstats.enabled;
7372 memset(&ai->micstats,0,sizeof(ai->micstats)); 7594 memset(&ai->micstats,0,sizeof(ai->micstats));
7373 ai->micstats.enabled = enabled; 7595 ai->micstats.enabled = enabled;
7374#endif
7375 7596
7376 if (copy_to_user(comp->data, iobuf, 7597 if (copy_to_user(comp->data, iobuf,
7377 min((int)comp->len, (int)RIDSIZE))) { 7598 min((int)comp->len, (int)RIDSIZE))) {
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 6290c9f7e939..eb79198ac450 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -167,7 +167,7 @@ that only one external action is invoked at a time.
167 167
168#include "ipw2100.h" 168#include "ipw2100.h"
169 169
170#define IPW2100_VERSION "1.1.3" 170#define IPW2100_VERSION "git-1.1.4"
171 171
172#define DRV_NAME "ipw2100" 172#define DRV_NAME "ipw2100"
173#define DRV_VERSION IPW2100_VERSION 173#define DRV_VERSION IPW2100_VERSION
@@ -1672,6 +1672,18 @@ static int ipw2100_start_scan(struct ipw2100_priv *priv)
1672 return err; 1672 return err;
1673} 1673}
1674 1674
1675static const struct ieee80211_geo ipw_geos[] = {
1676 { /* Restricted */
1677 "---",
1678 .bg_channels = 14,
1679 .bg = {{2412, 1}, {2417, 2}, {2422, 3},
1680 {2427, 4}, {2432, 5}, {2437, 6},
1681 {2442, 7}, {2447, 8}, {2452, 9},
1682 {2457, 10}, {2462, 11}, {2467, 12},
1683 {2472, 13}, {2484, 14}},
1684 },
1685};
1686
1675static int ipw2100_up(struct ipw2100_priv *priv, int deferred) 1687static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1676{ 1688{
1677 unsigned long flags; 1689 unsigned long flags;
@@ -1727,6 +1739,13 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1727 goto exit; 1739 goto exit;
1728 } 1740 }
1729 1741
1742 /* Initialize the geo */
1743 if (ieee80211_set_geo(priv->ieee, &ipw_geos[0])) {
1744 printk(KERN_WARNING DRV_NAME "Could not set geo\n");
1745 return 0;
1746 }
1747 priv->ieee->freq_band = IEEE80211_24GHZ_BAND;
1748
1730 lock = LOCK_NONE; 1749 lock = LOCK_NONE;
1731 if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { 1750 if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) {
1732 printk(KERN_ERR DRV_NAME 1751 printk(KERN_ERR DRV_NAME
@@ -3750,7 +3769,7 @@ static ssize_t store_memory(struct device *d, struct device_attribute *attr,
3750 struct net_device *dev = priv->net_dev; 3769 struct net_device *dev = priv->net_dev;
3751 const char *p = buf; 3770 const char *p = buf;
3752 3771
3753 (void) dev; /* kill unused-var warning for debug-only code */ 3772 (void)dev; /* kill unused-var warning for debug-only code */
3754 3773
3755 if (count < 1) 3774 if (count < 1)
3756 return count; 3775 return count;
@@ -4070,7 +4089,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr,
4070 unsigned long val; 4089 unsigned long val;
4071 char *p = buffer; 4090 char *p = buffer;
4072 4091
4073 (void) dev; /* kill unused-var warning for debug-only code */ 4092 (void)dev; /* kill unused-var warning for debug-only code */
4074 4093
4075 IPW_DEBUG_INFO("enter\n"); 4094 IPW_DEBUG_INFO("enter\n");
4076 4095
@@ -5107,12 +5126,13 @@ static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power)
5107 .host_command_length = 4 5126 .host_command_length = 4
5108 }; 5127 };
5109 int err = 0; 5128 int err = 0;
5129 u32 tmp = tx_power;
5110 5130
5111 if (tx_power != IPW_TX_POWER_DEFAULT) 5131 if (tx_power != IPW_TX_POWER_DEFAULT)
5112 tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / 5132 tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 /
5113 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); 5133 (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM);
5114 5134
5115 cmd.host_command_parameters[0] = tx_power; 5135 cmd.host_command_parameters[0] = tmp;
5116 5136
5117 if (priv->ieee->iw_mode == IW_MODE_ADHOC) 5137 if (priv->ieee->iw_mode == IW_MODE_ADHOC)
5118 err = ipw2100_hw_send_command(priv, &cmd); 5138 err = ipw2100_hw_send_command(priv, &cmd);
@@ -5365,9 +5385,12 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode)
5365 SEC_LEVEL_0, 0, 1); 5385 SEC_LEVEL_0, 0, 1);
5366 } else { 5386 } else {
5367 auth_mode = IPW_AUTH_OPEN; 5387 auth_mode = IPW_AUTH_OPEN;
5368 if ((priv->ieee->sec.flags & SEC_AUTH_MODE) && 5388 if (priv->ieee->sec.flags & SEC_AUTH_MODE) {
5369 (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) 5389 if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)
5370 auth_mode = IPW_AUTH_SHARED; 5390 auth_mode = IPW_AUTH_SHARED;
5391 else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP)
5392 auth_mode = IPW_AUTH_LEAP_CISCO_ID;
5393 }
5371 5394
5372 sec_level = SEC_LEVEL_0; 5395 sec_level = SEC_LEVEL_0;
5373 if (priv->ieee->sec.flags & SEC_LEVEL) 5396 if (priv->ieee->sec.flags & SEC_LEVEL)
@@ -5760,6 +5783,9 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value)
5760 } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { 5783 } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) {
5761 sec.auth_mode = WLAN_AUTH_OPEN; 5784 sec.auth_mode = WLAN_AUTH_OPEN;
5762 ieee->open_wep = 1; 5785 ieee->open_wep = 1;
5786 } else if (value & IW_AUTH_ALG_LEAP) {
5787 sec.auth_mode = WLAN_AUTH_LEAP;
5788 ieee->open_wep = 1;
5763 } else 5789 } else
5764 return -EINVAL; 5790 return -EINVAL;
5765 5791
@@ -5771,8 +5797,8 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value)
5771 return ret; 5797 return ret;
5772} 5798}
5773 5799
5774void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, 5800static void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv,
5775 char *wpa_ie, int wpa_ie_len) 5801 char *wpa_ie, int wpa_ie_len)
5776{ 5802{
5777 5803
5778 struct ipw2100_wpa_assoc_frame frame; 5804 struct ipw2100_wpa_assoc_frame frame;
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h
index f6c51441fa87..51360910d222 100644
--- a/drivers/net/wireless/ipw2100.h
+++ b/drivers/net/wireless/ipw2100.h
@@ -392,8 +392,10 @@ struct ipw2100_notification {
392#define IPW_WEP104_CIPHER (1<<5) 392#define IPW_WEP104_CIPHER (1<<5)
393#define IPW_CKIP_CIPHER (1<<6) 393#define IPW_CKIP_CIPHER (1<<6)
394 394
395#define IPW_AUTH_OPEN 0 395#define IPW_AUTH_OPEN 0
396#define IPW_AUTH_SHARED 1 396#define IPW_AUTH_SHARED 1
397#define IPW_AUTH_LEAP 2
398#define IPW_AUTH_LEAP_CISCO_ID 0x80
397 399
398struct statistic { 400struct statistic {
399 int value; 401 int value;
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 14beab4bc91c..0702f0eeb784 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -33,7 +33,7 @@
33#include "ipw2200.h" 33#include "ipw2200.h"
34#include <linux/version.h> 34#include <linux/version.h>
35 35
36#define IPW2200_VERSION "git-1.0.8" 36#define IPW2200_VERSION "git-1.0.10"
37#define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" 37#define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver"
38#define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" 38#define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation"
39#define DRV_VERSION IPW2200_VERSION 39#define DRV_VERSION IPW2200_VERSION
@@ -55,7 +55,9 @@ static int associate = 1;
55static int auto_create = 1; 55static int auto_create = 1;
56static int led = 0; 56static int led = 0;
57static int disable = 0; 57static int disable = 0;
58static int hwcrypto = 1; 58static int bt_coexist = 0;
59static int hwcrypto = 0;
60static int roaming = 1;
59static const char ipw_modes[] = { 61static const char ipw_modes[] = {
60 'a', 'b', 'g', '?' 62 'a', 'b', 'g', '?'
61}; 63};
@@ -227,12 +229,15 @@ static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len)
227 return total; 229 return total;
228} 230}
229 231
232/* alias for 32-bit indirect read (for SRAM/reg above 4K), with debug wrapper */
230static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); 233static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg);
231#define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) 234#define ipw_read_reg32(a, b) _ipw_read_reg32(a, b)
232 235
236/* alias for 8-bit indirect read (for SRAM/reg above 4K), with debug wrapper */
233static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); 237static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg);
234#define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) 238#define ipw_read_reg8(a, b) _ipw_read_reg8(a, b)
235 239
240/* 8-bit indirect write (for SRAM/reg above 4K), with debug wrapper */
236static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); 241static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value);
237static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) 242static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c)
238{ 243{
@@ -241,6 +246,7 @@ static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c)
241 _ipw_write_reg8(a, b, c); 246 _ipw_write_reg8(a, b, c);
242} 247}
243 248
249/* 16-bit indirect write (for SRAM/reg above 4K), with debug wrapper */
244static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); 250static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value);
245static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) 251static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c)
246{ 252{
@@ -249,6 +255,7 @@ static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c)
249 _ipw_write_reg16(a, b, c); 255 _ipw_write_reg16(a, b, c);
250} 256}
251 257
258/* 32-bit indirect write (for SRAM/reg above 4K), with debug wrapper */
252static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); 259static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value);
253static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) 260static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c)
254{ 261{
@@ -257,48 +264,70 @@ static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c)
257 _ipw_write_reg32(a, b, c); 264 _ipw_write_reg32(a, b, c);
258} 265}
259 266
267/* 8-bit direct write (low 4K) */
260#define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) 268#define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs))
269
270/* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */
261#define ipw_write8(ipw, ofs, val) \ 271#define ipw_write8(ipw, ofs, val) \
262 IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ 272 IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \
263 _ipw_write8(ipw, ofs, val) 273 _ipw_write8(ipw, ofs, val)
264 274
275/* 16-bit direct write (low 4K) */
265#define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) 276#define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs))
277
278/* 16-bit direct write (for low 4K of SRAM/regs), with debug wrapper */
266#define ipw_write16(ipw, ofs, val) \ 279#define ipw_write16(ipw, ofs, val) \
267 IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ 280 IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \
268 _ipw_write16(ipw, ofs, val) 281 _ipw_write16(ipw, ofs, val)
269 282
283/* 32-bit direct write (low 4K) */
270#define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) 284#define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs))
285
286/* 32-bit direct write (for low 4K of SRAM/regs), with debug wrapper */
271#define ipw_write32(ipw, ofs, val) \ 287#define ipw_write32(ipw, ofs, val) \
272 IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ 288 IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \
273 _ipw_write32(ipw, ofs, val) 289 _ipw_write32(ipw, ofs, val)
274 290
291/* 8-bit direct read (low 4K) */
275#define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) 292#define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs))
293
294/* 8-bit direct read (low 4K), with debug wrapper */
276static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) 295static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs)
277{ 296{
278 IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); 297 IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs));
279 return _ipw_read8(ipw, ofs); 298 return _ipw_read8(ipw, ofs);
280} 299}
281 300
301/* alias to 8-bit direct read (low 4K of SRAM/regs), with debug wrapper */
282#define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) 302#define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs)
283 303
304/* 16-bit direct read (low 4K) */
284#define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) 305#define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs))
306
307/* 16-bit direct read (low 4K), with debug wrapper */
285static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) 308static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs)
286{ 309{
287 IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); 310 IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs));
288 return _ipw_read16(ipw, ofs); 311 return _ipw_read16(ipw, ofs);
289} 312}
290 313
314/* alias to 16-bit direct read (low 4K of SRAM/regs), with debug wrapper */
291#define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) 315#define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs)
292 316
317/* 32-bit direct read (low 4K) */
293#define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) 318#define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs))
319
320/* 32-bit direct read (low 4K), with debug wrapper */
294static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) 321static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs)
295{ 322{
296 IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); 323 IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs));
297 return _ipw_read32(ipw, ofs); 324 return _ipw_read32(ipw, ofs);
298} 325}
299 326
327/* alias to 32-bit direct read (low 4K of SRAM/regs), with debug wrapper */
300#define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) 328#define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs)
301 329
330/* multi-byte read (above 4K), with debug wrapper */
302static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); 331static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int);
303static inline void __ipw_read_indirect(const char *f, int l, 332static inline void __ipw_read_indirect(const char *f, int l,
304 struct ipw_priv *a, u32 b, u8 * c, int d) 333 struct ipw_priv *a, u32 b, u8 * c, int d)
@@ -308,15 +337,17 @@ static inline void __ipw_read_indirect(const char *f, int l,
308 _ipw_read_indirect(a, b, c, d); 337 _ipw_read_indirect(a, b, c, d);
309} 338}
310 339
340/* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */
311#define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) 341#define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d)
312 342
343/* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */
313static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, 344static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data,
314 int num); 345 int num);
315#define ipw_write_indirect(a, b, c, d) \ 346#define ipw_write_indirect(a, b, c, d) \
316 IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ 347 IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \
317 _ipw_write_indirect(a, b, c, d) 348 _ipw_write_indirect(a, b, c, d)
318 349
319/* indirect write s */ 350/* 32-bit indirect write (above 4K) */
320static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) 351static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value)
321{ 352{
322 IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); 353 IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value);
@@ -324,22 +355,29 @@ static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value)
324 _ipw_write32(priv, IPW_INDIRECT_DATA, value); 355 _ipw_write32(priv, IPW_INDIRECT_DATA, value);
325} 356}
326 357
358/* 8-bit indirect write (above 4K) */
327static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) 359static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value)
328{ 360{
361 u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */
362 u32 dif_len = reg - aligned_addr;
363
329 IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); 364 IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value);
330 _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); 365 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr);
331 _ipw_write8(priv, IPW_INDIRECT_DATA, value); 366 _ipw_write8(priv, IPW_INDIRECT_DATA + dif_len, value);
332} 367}
333 368
369/* 16-bit indirect write (above 4K) */
334static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) 370static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value)
335{ 371{
372 u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */
373 u32 dif_len = (reg - aligned_addr) & (~0x1ul);
374
336 IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); 375 IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value);
337 _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); 376 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr);
338 _ipw_write16(priv, IPW_INDIRECT_DATA, value); 377 _ipw_write16(priv, IPW_INDIRECT_DATA + dif_len, value);
339} 378}
340 379
341/* indirect read s */ 380/* 8-bit indirect read (above 4K) */
342
343static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) 381static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg)
344{ 382{
345 u32 word; 383 u32 word;
@@ -349,6 +387,7 @@ static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg)
349 return (word >> ((reg & 0x3) * 8)) & 0xff; 387 return (word >> ((reg & 0x3) * 8)) & 0xff;
350} 388}
351 389
390/* 32-bit indirect read (above 4K) */
352static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) 391static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg)
353{ 392{
354 u32 value; 393 u32 value;
@@ -361,11 +400,12 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg)
361 return value; 400 return value;
362} 401}
363 402
364/* iterative/auto-increment 32 bit reads and writes */ 403/* General purpose, no alignment requirement, iterative (multi-byte) read, */
404/* for area above 1st 4K of SRAM/reg space */
365static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, 405static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
366 int num) 406 int num)
367{ 407{
368 u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; 408 u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */
369 u32 dif_len = addr - aligned_addr; 409 u32 dif_len = addr - aligned_addr;
370 u32 i; 410 u32 i;
371 411
@@ -375,7 +415,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
375 return; 415 return;
376 } 416 }
377 417
378 /* Read the first nibble byte by byte */ 418 /* Read the first dword (or portion) byte by byte */
379 if (unlikely(dif_len)) { 419 if (unlikely(dif_len)) {
380 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); 420 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr);
381 /* Start reading at aligned_addr + dif_len */ 421 /* Start reading at aligned_addr + dif_len */
@@ -384,11 +424,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
384 aligned_addr += 4; 424 aligned_addr += 4;
385 } 425 }
386 426
427 /* Read all of the middle dwords as dwords, with auto-increment */
387 _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); 428 _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr);
388 for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) 429 for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4)
389 *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); 430 *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA);
390 431
391 /* Copy the last nibble */ 432 /* Read the last dword (or portion) byte by byte */
392 if (unlikely(num)) { 433 if (unlikely(num)) {
393 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); 434 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr);
394 for (i = 0; num > 0; i++, num--) 435 for (i = 0; num > 0; i++, num--)
@@ -396,10 +437,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
396 } 437 }
397} 438}
398 439
440/* General purpose, no alignment requirement, iterative (multi-byte) write, */
441/* for area above 1st 4K of SRAM/reg space */
399static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, 442static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
400 int num) 443 int num)
401{ 444{
402 u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; 445 u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */
403 u32 dif_len = addr - aligned_addr; 446 u32 dif_len = addr - aligned_addr;
404 u32 i; 447 u32 i;
405 448
@@ -409,20 +452,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
409 return; 452 return;
410 } 453 }
411 454
412 /* Write the first nibble byte by byte */ 455 /* Write the first dword (or portion) byte by byte */
413 if (unlikely(dif_len)) { 456 if (unlikely(dif_len)) {
414 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); 457 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr);
415 /* Start reading at aligned_addr + dif_len */ 458 /* Start writing at aligned_addr + dif_len */
416 for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) 459 for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++)
417 _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); 460 _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf);
418 aligned_addr += 4; 461 aligned_addr += 4;
419 } 462 }
420 463
464 /* Write all of the middle dwords as dwords, with auto-increment */
421 _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); 465 _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr);
422 for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) 466 for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4)
423 _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); 467 _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf);
424 468
425 /* Copy the last nibble */ 469 /* Write the last dword (or portion) byte by byte */
426 if (unlikely(num)) { 470 if (unlikely(num)) {
427 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); 471 _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr);
428 for (i = 0; num > 0; i++, num--, buf++) 472 for (i = 0; num > 0; i++, num--, buf++)
@@ -430,17 +474,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf,
430 } 474 }
431} 475}
432 476
477/* General purpose, no alignment requirement, iterative (multi-byte) write, */
478/* for 1st 4K of SRAM/regs space */
433static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, 479static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf,
434 int num) 480 int num)
435{ 481{
436 memcpy_toio((priv->hw_base + addr), buf, num); 482 memcpy_toio((priv->hw_base + addr), buf, num);
437} 483}
438 484
485/* Set bit(s) in low 4K of SRAM/regs */
439static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) 486static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask)
440{ 487{
441 ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); 488 ipw_write32(priv, reg, ipw_read32(priv, reg) | mask);
442} 489}
443 490
491/* Clear bit(s) in low 4K of SRAM/regs */
444static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) 492static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask)
445{ 493{
446 ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); 494 ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask);
@@ -701,7 +749,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv)
701 749
702} 750}
703 751
704u32 ipw_register_toggle(u32 reg) 752static u32 ipw_register_toggle(u32 reg)
705{ 753{
706 reg &= ~IPW_START_STANDBY; 754 reg &= ~IPW_START_STANDBY;
707 if (reg & IPW_GATE_ODMA) 755 if (reg & IPW_GATE_ODMA)
@@ -722,11 +770,11 @@ u32 ipw_register_toggle(u32 reg)
722 * - On radio OFF, turn off any LEDs started during radio on 770 * - On radio OFF, turn off any LEDs started during radio on
723 * 771 *
724 */ 772 */
725#define LD_TIME_LINK_ON 300 773#define LD_TIME_LINK_ON msecs_to_jiffies(300)
726#define LD_TIME_LINK_OFF 2700 774#define LD_TIME_LINK_OFF msecs_to_jiffies(2700)
727#define LD_TIME_ACT_ON 250 775#define LD_TIME_ACT_ON msecs_to_jiffies(250)
728 776
729void ipw_led_link_on(struct ipw_priv *priv) 777static void ipw_led_link_on(struct ipw_priv *priv)
730{ 778{
731 unsigned long flags; 779 unsigned long flags;
732 u32 led; 780 u32 led;
@@ -764,12 +812,12 @@ void ipw_led_link_on(struct ipw_priv *priv)
764static void ipw_bg_led_link_on(void *data) 812static void ipw_bg_led_link_on(void *data)
765{ 813{
766 struct ipw_priv *priv = data; 814 struct ipw_priv *priv = data;
767 down(&priv->sem); 815 mutex_lock(&priv->mutex);
768 ipw_led_link_on(data); 816 ipw_led_link_on(data);
769 up(&priv->sem); 817 mutex_unlock(&priv->mutex);
770} 818}
771 819
772void ipw_led_link_off(struct ipw_priv *priv) 820static void ipw_led_link_off(struct ipw_priv *priv)
773{ 821{
774 unsigned long flags; 822 unsigned long flags;
775 u32 led; 823 u32 led;
@@ -808,9 +856,9 @@ void ipw_led_link_off(struct ipw_priv *priv)
808static void ipw_bg_led_link_off(void *data) 856static void ipw_bg_led_link_off(void *data)
809{ 857{
810 struct ipw_priv *priv = data; 858 struct ipw_priv *priv = data;
811 down(&priv->sem); 859 mutex_lock(&priv->mutex);
812 ipw_led_link_off(data); 860 ipw_led_link_off(data);
813 up(&priv->sem); 861 mutex_unlock(&priv->mutex);
814} 862}
815 863
816static void __ipw_led_activity_on(struct ipw_priv *priv) 864static void __ipw_led_activity_on(struct ipw_priv *priv)
@@ -847,6 +895,7 @@ static void __ipw_led_activity_on(struct ipw_priv *priv)
847 } 895 }
848} 896}
849 897
898#if 0
850void ipw_led_activity_on(struct ipw_priv *priv) 899void ipw_led_activity_on(struct ipw_priv *priv)
851{ 900{
852 unsigned long flags; 901 unsigned long flags;
@@ -854,8 +903,9 @@ void ipw_led_activity_on(struct ipw_priv *priv)
854 __ipw_led_activity_on(priv); 903 __ipw_led_activity_on(priv);
855 spin_unlock_irqrestore(&priv->lock, flags); 904 spin_unlock_irqrestore(&priv->lock, flags);
856} 905}
906#endif /* 0 */
857 907
858void ipw_led_activity_off(struct ipw_priv *priv) 908static void ipw_led_activity_off(struct ipw_priv *priv)
859{ 909{
860 unsigned long flags; 910 unsigned long flags;
861 u32 led; 911 u32 led;
@@ -885,12 +935,12 @@ void ipw_led_activity_off(struct ipw_priv *priv)
885static void ipw_bg_led_activity_off(void *data) 935static void ipw_bg_led_activity_off(void *data)
886{ 936{
887 struct ipw_priv *priv = data; 937 struct ipw_priv *priv = data;
888 down(&priv->sem); 938 mutex_lock(&priv->mutex);
889 ipw_led_activity_off(data); 939 ipw_led_activity_off(data);
890 up(&priv->sem); 940 mutex_unlock(&priv->mutex);
891} 941}
892 942
893void ipw_led_band_on(struct ipw_priv *priv) 943static void ipw_led_band_on(struct ipw_priv *priv)
894{ 944{
895 unsigned long flags; 945 unsigned long flags;
896 u32 led; 946 u32 led;
@@ -925,7 +975,7 @@ void ipw_led_band_on(struct ipw_priv *priv)
925 spin_unlock_irqrestore(&priv->lock, flags); 975 spin_unlock_irqrestore(&priv->lock, flags);
926} 976}
927 977
928void ipw_led_band_off(struct ipw_priv *priv) 978static void ipw_led_band_off(struct ipw_priv *priv)
929{ 979{
930 unsigned long flags; 980 unsigned long flags;
931 u32 led; 981 u32 led;
@@ -948,24 +998,24 @@ void ipw_led_band_off(struct ipw_priv *priv)
948 spin_unlock_irqrestore(&priv->lock, flags); 998 spin_unlock_irqrestore(&priv->lock, flags);
949} 999}
950 1000
951void ipw_led_radio_on(struct ipw_priv *priv) 1001static void ipw_led_radio_on(struct ipw_priv *priv)
952{ 1002{
953 ipw_led_link_on(priv); 1003 ipw_led_link_on(priv);
954} 1004}
955 1005
956void ipw_led_radio_off(struct ipw_priv *priv) 1006static void ipw_led_radio_off(struct ipw_priv *priv)
957{ 1007{
958 ipw_led_activity_off(priv); 1008 ipw_led_activity_off(priv);
959 ipw_led_link_off(priv); 1009 ipw_led_link_off(priv);
960} 1010}
961 1011
962void ipw_led_link_up(struct ipw_priv *priv) 1012static void ipw_led_link_up(struct ipw_priv *priv)
963{ 1013{
964 /* Set the Link Led on for all nic types */ 1014 /* Set the Link Led on for all nic types */
965 ipw_led_link_on(priv); 1015 ipw_led_link_on(priv);
966} 1016}
967 1017
968void ipw_led_link_down(struct ipw_priv *priv) 1018static void ipw_led_link_down(struct ipw_priv *priv)
969{ 1019{
970 ipw_led_activity_off(priv); 1020 ipw_led_activity_off(priv);
971 ipw_led_link_off(priv); 1021 ipw_led_link_off(priv);
@@ -974,7 +1024,7 @@ void ipw_led_link_down(struct ipw_priv *priv)
974 ipw_led_radio_off(priv); 1024 ipw_led_radio_off(priv);
975} 1025}
976 1026
977void ipw_led_init(struct ipw_priv *priv) 1027static void ipw_led_init(struct ipw_priv *priv)
978{ 1028{
979 priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; 1029 priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE];
980 1030
@@ -1025,7 +1075,7 @@ void ipw_led_init(struct ipw_priv *priv)
1025 } 1075 }
1026} 1076}
1027 1077
1028void ipw_led_shutdown(struct ipw_priv *priv) 1078static void ipw_led_shutdown(struct ipw_priv *priv)
1029{ 1079{
1030 ipw_led_activity_off(priv); 1080 ipw_led_activity_off(priv);
1031 ipw_led_link_off(priv); 1081 ipw_led_link_off(priv);
@@ -1074,6 +1124,7 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
1074 1124
1075static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) 1125static inline u32 ipw_get_event_log_len(struct ipw_priv *priv)
1076{ 1126{
1127 /* length = 1st dword in log */
1077 return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); 1128 return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG));
1078} 1129}
1079 1130
@@ -1870,7 +1921,8 @@ static char *get_cmd_string(u8 cmd)
1870} 1921}
1871 1922
1872#define HOST_COMPLETE_TIMEOUT HZ 1923#define HOST_COMPLETE_TIMEOUT HZ
1873static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) 1924
1925static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1874{ 1926{
1875 int rc = 0; 1927 int rc = 0;
1876 unsigned long flags; 1928 unsigned long flags;
@@ -1897,9 +1949,15 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1897 IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", 1949 IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n",
1898 get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, 1950 get_cmd_string(cmd->cmd), cmd->cmd, cmd->len,
1899 priv->status); 1951 priv->status);
1900 printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len);
1901 1952
1902 rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); 1953#ifndef DEBUG_CMD_WEP_KEY
1954 if (cmd->cmd == IPW_CMD_WEP_KEY)
1955 IPW_DEBUG_HC("WEP_KEY command masked out for secure.\n");
1956 else
1957#endif
1958 printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len);
1959
1960 rc = ipw_queue_tx_hcmd(priv, cmd->cmd, cmd->param, cmd->len, 0);
1903 if (rc) { 1961 if (rc) {
1904 priv->status &= ~STATUS_HCMD_ACTIVE; 1962 priv->status &= ~STATUS_HCMD_ACTIVE;
1905 IPW_ERROR("Failed to send %s: Reason %d\n", 1963 IPW_ERROR("Failed to send %s: Reason %d\n",
@@ -1942,61 +2000,62 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1942 return rc; 2000 return rc;
1943} 2001}
1944 2002
1945static int ipw_send_host_complete(struct ipw_priv *priv) 2003static int ipw_send_cmd_simple(struct ipw_priv *priv, u8 command)
1946{ 2004{
1947 struct host_cmd cmd = { 2005 struct host_cmd cmd = {
1948 .cmd = IPW_CMD_HOST_COMPLETE, 2006 .cmd = command,
1949 .len = 0
1950 }; 2007 };
1951 2008
2009 return __ipw_send_cmd(priv, &cmd);
2010}
2011
2012static int ipw_send_cmd_pdu(struct ipw_priv *priv, u8 command, u8 len,
2013 void *data)
2014{
2015 struct host_cmd cmd = {
2016 .cmd = command,
2017 .len = len,
2018 .param = data,
2019 };
2020
2021 return __ipw_send_cmd(priv, &cmd);
2022}
2023
2024static int ipw_send_host_complete(struct ipw_priv *priv)
2025{
1952 if (!priv) { 2026 if (!priv) {
1953 IPW_ERROR("Invalid args\n"); 2027 IPW_ERROR("Invalid args\n");
1954 return -1; 2028 return -1;
1955 } 2029 }
1956 2030
1957 return ipw_send_cmd(priv, &cmd); 2031 return ipw_send_cmd_simple(priv, IPW_CMD_HOST_COMPLETE);
1958} 2032}
1959 2033
1960static int ipw_send_system_config(struct ipw_priv *priv, 2034static int ipw_send_system_config(struct ipw_priv *priv,
1961 struct ipw_sys_config *config) 2035 struct ipw_sys_config *config)
1962{ 2036{
1963 struct host_cmd cmd = {
1964 .cmd = IPW_CMD_SYSTEM_CONFIG,
1965 .len = sizeof(*config)
1966 };
1967
1968 if (!priv || !config) { 2037 if (!priv || !config) {
1969 IPW_ERROR("Invalid args\n"); 2038 IPW_ERROR("Invalid args\n");
1970 return -1; 2039 return -1;
1971 } 2040 }
1972 2041
1973 memcpy(cmd.param, config, sizeof(*config)); 2042 return ipw_send_cmd_pdu(priv, IPW_CMD_SYSTEM_CONFIG, sizeof(*config),
1974 return ipw_send_cmd(priv, &cmd); 2043 config);
1975} 2044}
1976 2045
1977static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) 2046static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len)
1978{ 2047{
1979 struct host_cmd cmd = {
1980 .cmd = IPW_CMD_SSID,
1981 .len = min(len, IW_ESSID_MAX_SIZE)
1982 };
1983
1984 if (!priv || !ssid) { 2048 if (!priv || !ssid) {
1985 IPW_ERROR("Invalid args\n"); 2049 IPW_ERROR("Invalid args\n");
1986 return -1; 2050 return -1;
1987 } 2051 }
1988 2052
1989 memcpy(cmd.param, ssid, cmd.len); 2053 return ipw_send_cmd_pdu(priv, IPW_CMD_SSID, min(len, IW_ESSID_MAX_SIZE),
1990 return ipw_send_cmd(priv, &cmd); 2054 ssid);
1991} 2055}
1992 2056
1993static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) 2057static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
1994{ 2058{
1995 struct host_cmd cmd = {
1996 .cmd = IPW_CMD_ADAPTER_ADDRESS,
1997 .len = ETH_ALEN
1998 };
1999
2000 if (!priv || !mac) { 2059 if (!priv || !mac) {
2001 IPW_ERROR("Invalid args\n"); 2060 IPW_ERROR("Invalid args\n");
2002 return -1; 2061 return -1;
@@ -2005,8 +2064,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
2005 IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", 2064 IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n",
2006 priv->net_dev->name, MAC_ARG(mac)); 2065 priv->net_dev->name, MAC_ARG(mac));
2007 2066
2008 memcpy(cmd.param, mac, ETH_ALEN); 2067 return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac);
2009 return ipw_send_cmd(priv, &cmd);
2010} 2068}
2011 2069
2012/* 2070/*
@@ -2036,9 +2094,9 @@ static void ipw_adapter_restart(void *adapter)
2036static void ipw_bg_adapter_restart(void *data) 2094static void ipw_bg_adapter_restart(void *data)
2037{ 2095{
2038 struct ipw_priv *priv = data; 2096 struct ipw_priv *priv = data;
2039 down(&priv->sem); 2097 mutex_lock(&priv->mutex);
2040 ipw_adapter_restart(data); 2098 ipw_adapter_restart(data);
2041 up(&priv->sem); 2099 mutex_unlock(&priv->mutex);
2042} 2100}
2043 2101
2044#define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) 2102#define IPW_SCAN_CHECK_WATCHDOG (5 * HZ)
@@ -2048,8 +2106,8 @@ static void ipw_scan_check(void *data)
2048 struct ipw_priv *priv = data; 2106 struct ipw_priv *priv = data;
2049 if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { 2107 if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) {
2050 IPW_DEBUG_SCAN("Scan completion watchdog resetting " 2108 IPW_DEBUG_SCAN("Scan completion watchdog resetting "
2051 "adapter (%dms).\n", 2109 "adapter after (%dms).\n",
2052 IPW_SCAN_CHECK_WATCHDOG / 100); 2110 jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
2053 queue_work(priv->workqueue, &priv->adapter_restart); 2111 queue_work(priv->workqueue, &priv->adapter_restart);
2054 } 2112 }
2055} 2113}
@@ -2057,59 +2115,48 @@ static void ipw_scan_check(void *data)
2057static void ipw_bg_scan_check(void *data) 2115static void ipw_bg_scan_check(void *data)
2058{ 2116{
2059 struct ipw_priv *priv = data; 2117 struct ipw_priv *priv = data;
2060 down(&priv->sem); 2118 mutex_lock(&priv->mutex);
2061 ipw_scan_check(data); 2119 ipw_scan_check(data);
2062 up(&priv->sem); 2120 mutex_unlock(&priv->mutex);
2063} 2121}
2064 2122
2065static int ipw_send_scan_request_ext(struct ipw_priv *priv, 2123static int ipw_send_scan_request_ext(struct ipw_priv *priv,
2066 struct ipw_scan_request_ext *request) 2124 struct ipw_scan_request_ext *request)
2067{ 2125{
2068 struct host_cmd cmd = { 2126 return ipw_send_cmd_pdu(priv, IPW_CMD_SCAN_REQUEST_EXT,
2069 .cmd = IPW_CMD_SCAN_REQUEST_EXT, 2127 sizeof(*request), request);
2070 .len = sizeof(*request)
2071 };
2072
2073 memcpy(cmd.param, request, sizeof(*request));
2074 return ipw_send_cmd(priv, &cmd);
2075} 2128}
2076 2129
2077static int ipw_send_scan_abort(struct ipw_priv *priv) 2130static int ipw_send_scan_abort(struct ipw_priv *priv)
2078{ 2131{
2079 struct host_cmd cmd = {
2080 .cmd = IPW_CMD_SCAN_ABORT,
2081 .len = 0
2082 };
2083
2084 if (!priv) { 2132 if (!priv) {
2085 IPW_ERROR("Invalid args\n"); 2133 IPW_ERROR("Invalid args\n");
2086 return -1; 2134 return -1;
2087 } 2135 }
2088 2136
2089 return ipw_send_cmd(priv, &cmd); 2137 return ipw_send_cmd_simple(priv, IPW_CMD_SCAN_ABORT);
2090} 2138}
2091 2139
2092static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) 2140static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens)
2093{ 2141{
2094 struct host_cmd cmd = { 2142 struct ipw_sensitivity_calib calib = {
2095 .cmd = IPW_CMD_SENSITIVITY_CALIB, 2143 .beacon_rssi_raw = sens,
2096 .len = sizeof(struct ipw_sensitivity_calib)
2097 }; 2144 };
2098 struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) 2145
2099 &cmd.param; 2146 return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib),
2100 calib->beacon_rssi_raw = sens; 2147 &calib);
2101 return ipw_send_cmd(priv, &cmd);
2102} 2148}
2103 2149
2104static int ipw_send_associate(struct ipw_priv *priv, 2150static int ipw_send_associate(struct ipw_priv *priv,
2105 struct ipw_associate *associate) 2151 struct ipw_associate *associate)
2106{ 2152{
2107 struct host_cmd cmd = {
2108 .cmd = IPW_CMD_ASSOCIATE,
2109 .len = sizeof(*associate)
2110 };
2111
2112 struct ipw_associate tmp_associate; 2153 struct ipw_associate tmp_associate;
2154
2155 if (!priv || !associate) {
2156 IPW_ERROR("Invalid args\n");
2157 return -1;
2158 }
2159
2113 memcpy(&tmp_associate, associate, sizeof(*associate)); 2160 memcpy(&tmp_associate, associate, sizeof(*associate));
2114 tmp_associate.policy_support = 2161 tmp_associate.policy_support =
2115 cpu_to_le16(tmp_associate.policy_support); 2162 cpu_to_le16(tmp_associate.policy_support);
@@ -2122,80 +2169,55 @@ static int ipw_send_associate(struct ipw_priv *priv,
2122 cpu_to_le16(tmp_associate.beacon_interval); 2169 cpu_to_le16(tmp_associate.beacon_interval);
2123 tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); 2170 tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window);
2124 2171
2125 if (!priv || !associate) { 2172 return ipw_send_cmd_pdu(priv, IPW_CMD_ASSOCIATE, sizeof(tmp_associate),
2126 IPW_ERROR("Invalid args\n"); 2173 &tmp_associate);
2127 return -1;
2128 }
2129
2130 memcpy(cmd.param, &tmp_associate, sizeof(*associate));
2131 return ipw_send_cmd(priv, &cmd);
2132} 2174}
2133 2175
2134static int ipw_send_supported_rates(struct ipw_priv *priv, 2176static int ipw_send_supported_rates(struct ipw_priv *priv,
2135 struct ipw_supported_rates *rates) 2177 struct ipw_supported_rates *rates)
2136{ 2178{
2137 struct host_cmd cmd = {
2138 .cmd = IPW_CMD_SUPPORTED_RATES,
2139 .len = sizeof(*rates)
2140 };
2141
2142 if (!priv || !rates) { 2179 if (!priv || !rates) {
2143 IPW_ERROR("Invalid args\n"); 2180 IPW_ERROR("Invalid args\n");
2144 return -1; 2181 return -1;
2145 } 2182 }
2146 2183
2147 memcpy(cmd.param, rates, sizeof(*rates)); 2184 return ipw_send_cmd_pdu(priv, IPW_CMD_SUPPORTED_RATES, sizeof(*rates),
2148 return ipw_send_cmd(priv, &cmd); 2185 rates);
2149} 2186}
2150 2187
2151static int ipw_set_random_seed(struct ipw_priv *priv) 2188static int ipw_set_random_seed(struct ipw_priv *priv)
2152{ 2189{
2153 struct host_cmd cmd = { 2190 u32 val;
2154 .cmd = IPW_CMD_SEED_NUMBER,
2155 .len = sizeof(u32)
2156 };
2157 2191
2158 if (!priv) { 2192 if (!priv) {
2159 IPW_ERROR("Invalid args\n"); 2193 IPW_ERROR("Invalid args\n");
2160 return -1; 2194 return -1;
2161 } 2195 }
2162 2196
2163 get_random_bytes(&cmd.param, sizeof(u32)); 2197 get_random_bytes(&val, sizeof(val));
2164 2198
2165 return ipw_send_cmd(priv, &cmd); 2199 return ipw_send_cmd_pdu(priv, IPW_CMD_SEED_NUMBER, sizeof(val), &val);
2166} 2200}
2167 2201
2168static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) 2202static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
2169{ 2203{
2170 struct host_cmd cmd = {
2171 .cmd = IPW_CMD_CARD_DISABLE,
2172 .len = sizeof(u32)
2173 };
2174
2175 if (!priv) { 2204 if (!priv) {
2176 IPW_ERROR("Invalid args\n"); 2205 IPW_ERROR("Invalid args\n");
2177 return -1; 2206 return -1;
2178 } 2207 }
2179 2208
2180 *((u32 *) & cmd.param) = phy_off; 2209 return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off),
2181 2210 &phy_off);
2182 return ipw_send_cmd(priv, &cmd);
2183} 2211}
2184 2212
2185static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) 2213static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power)
2186{ 2214{
2187 struct host_cmd cmd = {
2188 .cmd = IPW_CMD_TX_POWER,
2189 .len = sizeof(*power)
2190 };
2191
2192 if (!priv || !power) { 2215 if (!priv || !power) {
2193 IPW_ERROR("Invalid args\n"); 2216 IPW_ERROR("Invalid args\n");
2194 return -1; 2217 return -1;
2195 } 2218 }
2196 2219
2197 memcpy(cmd.param, power, sizeof(*power)); 2220 return ipw_send_cmd_pdu(priv, IPW_CMD_TX_POWER, sizeof(*power), power);
2198 return ipw_send_cmd(priv, &cmd);
2199} 2221}
2200 2222
2201static int ipw_set_tx_power(struct ipw_priv *priv) 2223static int ipw_set_tx_power(struct ipw_priv *priv)
@@ -2247,18 +2269,14 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts)
2247 struct ipw_rts_threshold rts_threshold = { 2269 struct ipw_rts_threshold rts_threshold = {
2248 .rts_threshold = rts, 2270 .rts_threshold = rts,
2249 }; 2271 };
2250 struct host_cmd cmd = {
2251 .cmd = IPW_CMD_RTS_THRESHOLD,
2252 .len = sizeof(rts_threshold)
2253 };
2254 2272
2255 if (!priv) { 2273 if (!priv) {
2256 IPW_ERROR("Invalid args\n"); 2274 IPW_ERROR("Invalid args\n");
2257 return -1; 2275 return -1;
2258 } 2276 }
2259 2277
2260 memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); 2278 return ipw_send_cmd_pdu(priv, IPW_CMD_RTS_THRESHOLD,
2261 return ipw_send_cmd(priv, &cmd); 2279 sizeof(rts_threshold), &rts_threshold);
2262} 2280}
2263 2281
2264static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) 2282static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
@@ -2266,27 +2284,19 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
2266 struct ipw_frag_threshold frag_threshold = { 2284 struct ipw_frag_threshold frag_threshold = {
2267 .frag_threshold = frag, 2285 .frag_threshold = frag,
2268 }; 2286 };
2269 struct host_cmd cmd = {
2270 .cmd = IPW_CMD_FRAG_THRESHOLD,
2271 .len = sizeof(frag_threshold)
2272 };
2273 2287
2274 if (!priv) { 2288 if (!priv) {
2275 IPW_ERROR("Invalid args\n"); 2289 IPW_ERROR("Invalid args\n");
2276 return -1; 2290 return -1;
2277 } 2291 }
2278 2292
2279 memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); 2293 return ipw_send_cmd_pdu(priv, IPW_CMD_FRAG_THRESHOLD,
2280 return ipw_send_cmd(priv, &cmd); 2294 sizeof(frag_threshold), &frag_threshold);
2281} 2295}
2282 2296
2283static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) 2297static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
2284{ 2298{
2285 struct host_cmd cmd = { 2299 u32 param;
2286 .cmd = IPW_CMD_POWER_MODE,
2287 .len = sizeof(u32)
2288 };
2289 u32 *param = (u32 *) (&cmd.param);
2290 2300
2291 if (!priv) { 2301 if (!priv) {
2292 IPW_ERROR("Invalid args\n"); 2302 IPW_ERROR("Invalid args\n");
@@ -2297,17 +2307,18 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
2297 * level */ 2307 * level */
2298 switch (mode) { 2308 switch (mode) {
2299 case IPW_POWER_BATTERY: 2309 case IPW_POWER_BATTERY:
2300 *param = IPW_POWER_INDEX_3; 2310 param = IPW_POWER_INDEX_3;
2301 break; 2311 break;
2302 case IPW_POWER_AC: 2312 case IPW_POWER_AC:
2303 *param = IPW_POWER_MODE_CAM; 2313 param = IPW_POWER_MODE_CAM;
2304 break; 2314 break;
2305 default: 2315 default:
2306 *param = mode; 2316 param = mode;
2307 break; 2317 break;
2308 } 2318 }
2309 2319
2310 return ipw_send_cmd(priv, &cmd); 2320 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
2321 &param);
2311} 2322}
2312 2323
2313static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) 2324static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit)
@@ -2316,18 +2327,14 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit)
2316 .short_retry_limit = slimit, 2327 .short_retry_limit = slimit,
2317 .long_retry_limit = llimit 2328 .long_retry_limit = llimit
2318 }; 2329 };
2319 struct host_cmd cmd = {
2320 .cmd = IPW_CMD_RETRY_LIMIT,
2321 .len = sizeof(retry_limit)
2322 };
2323 2330
2324 if (!priv) { 2331 if (!priv) {
2325 IPW_ERROR("Invalid args\n"); 2332 IPW_ERROR("Invalid args\n");
2326 return -1; 2333 return -1;
2327 } 2334 }
2328 2335
2329 memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); 2336 return ipw_send_cmd_pdu(priv, IPW_CMD_RETRY_LIMIT, sizeof(retry_limit),
2330 return ipw_send_cmd(priv, &cmd); 2337 &retry_limit);
2331} 2338}
2332 2339
2333/* 2340/*
@@ -2454,7 +2461,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv)
2454 /* 2461 /*
2455 If the data looks correct, then copy it to our private 2462 If the data looks correct, then copy it to our private
2456 copy. Otherwise let the firmware know to perform the operation 2463 copy. Otherwise let the firmware know to perform the operation
2457 on it's own 2464 on its own.
2458 */ 2465 */
2459 if (priv->eeprom[EEPROM_VERSION] != 0) { 2466 if (priv->eeprom[EEPROM_VERSION] != 0) {
2460 IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); 2467 IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n");
@@ -2707,22 +2714,25 @@ static int ipw_fw_dma_add_buffer(struct ipw_priv *priv,
2707 2714
2708static int ipw_fw_dma_wait(struct ipw_priv *priv) 2715static int ipw_fw_dma_wait(struct ipw_priv *priv)
2709{ 2716{
2710 u32 current_index = 0; 2717 u32 current_index = 0, previous_index;
2711 u32 watchdog = 0; 2718 u32 watchdog = 0;
2712 2719
2713 IPW_DEBUG_FW(">> : \n"); 2720 IPW_DEBUG_FW(">> : \n");
2714 2721
2715 current_index = ipw_fw_dma_command_block_index(priv); 2722 current_index = ipw_fw_dma_command_block_index(priv);
2716 IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n", 2723 IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%08X\n",
2717 (int)priv->sram_desc.last_cb_index); 2724 (int)priv->sram_desc.last_cb_index);
2718 2725
2719 while (current_index < priv->sram_desc.last_cb_index) { 2726 while (current_index < priv->sram_desc.last_cb_index) {
2720 udelay(50); 2727 udelay(50);
2728 previous_index = current_index;
2721 current_index = ipw_fw_dma_command_block_index(priv); 2729 current_index = ipw_fw_dma_command_block_index(priv);
2722 2730
2723 watchdog++; 2731 if (previous_index < current_index) {
2724 2732 watchdog = 0;
2725 if (watchdog > 400) { 2733 continue;
2734 }
2735 if (++watchdog > 400) {
2726 IPW_DEBUG_FW_INFO("Timeout\n"); 2736 IPW_DEBUG_FW_INFO("Timeout\n");
2727 ipw_fw_dma_dump_command_block(priv); 2737 ipw_fw_dma_dump_command_block(priv);
2728 ipw_fw_dma_abort(priv); 2738 ipw_fw_dma_abort(priv);
@@ -2772,6 +2782,7 @@ static inline int ipw_alive(struct ipw_priv *priv)
2772 return ipw_read32(priv, 0x90) == 0xd55555d5; 2782 return ipw_read32(priv, 0x90) == 0xd55555d5;
2773} 2783}
2774 2784
2785/* timeout in msec, attempted in 10-msec quanta */
2775static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, 2786static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask,
2776 int timeout) 2787 int timeout)
2777{ 2788{
@@ -2800,10 +2811,11 @@ static int ipw_stop_master(struct ipw_priv *priv)
2800 /* stop master. typical delay - 0 */ 2811 /* stop master. typical delay - 0 */
2801 ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); 2812 ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER);
2802 2813
2814 /* timeout is in msec, polled in 10-msec quanta */
2803 rc = ipw_poll_bit(priv, IPW_RESET_REG, 2815 rc = ipw_poll_bit(priv, IPW_RESET_REG,
2804 IPW_RESET_REG_MASTER_DISABLED, 100); 2816 IPW_RESET_REG_MASTER_DISABLED, 100);
2805 if (rc < 0) { 2817 if (rc < 0) {
2806 IPW_ERROR("stop master failed in 10ms\n"); 2818 IPW_ERROR("wait for stop master failed after 100ms\n");
2807 return -1; 2819 return -1;
2808 } 2820 }
2809 2821
@@ -2890,8 +2902,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
2890 mdelay(1); 2902 mdelay(1);
2891 2903
2892 /* enable ucode store */ 2904 /* enable ucode store */
2893 ipw_write_reg8(priv, DINO_CONTROL_REG, 0x0); 2905 ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0x0);
2894 ipw_write_reg8(priv, DINO_CONTROL_REG, DINO_ENABLE_CS); 2906 ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_CS);
2895 mdelay(1); 2907 mdelay(1);
2896 2908
2897 /* write ucode */ 2909 /* write ucode */
@@ -3036,7 +3048,7 @@ static int ipw_stop_nic(struct ipw_priv *priv)
3036 rc = ipw_poll_bit(priv, IPW_RESET_REG, 3048 rc = ipw_poll_bit(priv, IPW_RESET_REG,
3037 IPW_RESET_REG_MASTER_DISABLED, 500); 3049 IPW_RESET_REG_MASTER_DISABLED, 500);
3038 if (rc < 0) { 3050 if (rc < 0) {
3039 IPW_ERROR("wait for reg master disabled failed\n"); 3051 IPW_ERROR("wait for reg master disabled failed after 500ms\n");
3040 return rc; 3052 return rc;
3041 } 3053 }
3042 3054
@@ -3209,55 +3221,31 @@ static int ipw_load(struct ipw_priv *priv)
3209 const struct firmware *firmware = NULL; 3221 const struct firmware *firmware = NULL;
3210 const struct firmware *ucode = NULL; 3222 const struct firmware *ucode = NULL;
3211#endif 3223#endif
3224 char *ucode_name;
3225 char *fw_name;
3212 int rc = 0, retries = 3; 3226 int rc = 0, retries = 3;
3213 3227
3214#ifdef CONFIG_PM 3228 switch (priv->ieee->iw_mode) {
3215 if (!fw_loaded) { 3229 case IW_MODE_ADHOC:
3216#endif 3230 ucode_name = IPW_FW_NAME("ibss_ucode");
3217 rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot")); 3231 fw_name = IPW_FW_NAME("ibss");
3218 if (rc) 3232 break;
3219 goto error;
3220
3221 switch (priv->ieee->iw_mode) {
3222 case IW_MODE_ADHOC:
3223 rc = ipw_get_fw(priv, &ucode,
3224 IPW_FW_NAME("ibss_ucode"));
3225 if (rc)
3226 goto error;
3227
3228 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("ibss"));
3229 break;
3230
3231#ifdef CONFIG_IPW2200_MONITOR 3233#ifdef CONFIG_IPW2200_MONITOR
3232 case IW_MODE_MONITOR: 3234 case IW_MODE_MONITOR:
3233 rc = ipw_get_fw(priv, &ucode, 3235 ucode_name = IPW_FW_NAME("sniffer_ucode");
3234 IPW_FW_NAME("sniffer_ucode")); 3236 fw_name = IPW_FW_NAME("sniffer");
3235 if (rc) 3237 break;
3236 goto error;
3237
3238 rc = ipw_get_fw(priv, &firmware,
3239 IPW_FW_NAME("sniffer"));
3240 break;
3241#endif 3238#endif
3242 case IW_MODE_INFRA: 3239 case IW_MODE_INFRA:
3243 rc = ipw_get_fw(priv, &ucode, IPW_FW_NAME("bss_ucode")); 3240 ucode_name = IPW_FW_NAME("bss_ucode");
3244 if (rc) 3241 fw_name = IPW_FW_NAME("bss");
3245 goto error; 3242 break;
3246 3243 default:
3247 rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("bss")); 3244 rc = -EINVAL;
3248 break;
3249
3250 default:
3251 rc = -EINVAL;
3252 }
3253
3254 if (rc)
3255 goto error;
3256
3257#ifdef CONFIG_PM
3258 fw_loaded = 1;
3259 } 3245 }
3260#endif 3246
3247 if (rc < 0)
3248 goto error;
3261 3249
3262 if (!priv->rxq) 3250 if (!priv->rxq)
3263 priv->rxq = ipw_rx_queue_alloc(priv); 3251 priv->rxq = ipw_rx_queue_alloc(priv);
@@ -3279,7 +3267,7 @@ static int ipw_load(struct ipw_priv *priv)
3279 ipw_stop_nic(priv); 3267 ipw_stop_nic(priv);
3280 3268
3281 rc = ipw_reset_nic(priv); 3269 rc = ipw_reset_nic(priv);
3282 if (rc) { 3270 if (rc < 0) {
3283 IPW_ERROR("Unable to reset NIC\n"); 3271 IPW_ERROR("Unable to reset NIC\n");
3284 goto error; 3272 goto error;
3285 } 3273 }
@@ -3287,6 +3275,15 @@ static int ipw_load(struct ipw_priv *priv)
3287 ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, 3275 ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND,
3288 IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); 3276 IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND);
3289 3277
3278#ifdef CONFIG_PM
3279 if (!fw_loaded) {
3280#endif
3281 rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot"));
3282 if (rc < 0)
3283 goto error;
3284#ifdef CONFIG_PM
3285 }
3286#endif
3290 /* DMA the initial boot firmware into the device */ 3287 /* DMA the initial boot firmware into the device */
3291 rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), 3288 rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header),
3292 bootfw->size - sizeof(struct fw_header)); 3289 bootfw->size - sizeof(struct fw_header));
@@ -3298,7 +3295,7 @@ static int ipw_load(struct ipw_priv *priv)
3298 /* kick start the device */ 3295 /* kick start the device */
3299 ipw_start_nic(priv); 3296 ipw_start_nic(priv);
3300 3297
3301 /* wait for the device to finish it's initial startup sequence */ 3298 /* wait for the device to finish its initial startup sequence */
3302 rc = ipw_poll_bit(priv, IPW_INTA_RW, 3299 rc = ipw_poll_bit(priv, IPW_INTA_RW,
3303 IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); 3300 IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500);
3304 if (rc < 0) { 3301 if (rc < 0) {
@@ -3310,6 +3307,16 @@ static int ipw_load(struct ipw_priv *priv)
3310 /* ack fw init done interrupt */ 3307 /* ack fw init done interrupt */
3311 ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); 3308 ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE);
3312 3309
3310#ifdef CONFIG_PM
3311 if (!fw_loaded) {
3312#endif
3313 rc = ipw_get_fw(priv, &ucode, ucode_name);
3314 if (rc < 0)
3315 goto error;
3316#ifdef CONFIG_PM
3317 }
3318#endif
3319
3313 /* DMA the ucode into the device */ 3320 /* DMA the ucode into the device */
3314 rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), 3321 rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header),
3315 ucode->size - sizeof(struct fw_header)); 3322 ucode->size - sizeof(struct fw_header));
@@ -3321,6 +3328,16 @@ static int ipw_load(struct ipw_priv *priv)
3321 /* stop nic */ 3328 /* stop nic */
3322 ipw_stop_nic(priv); 3329 ipw_stop_nic(priv);
3323 3330
3331#ifdef CONFIG_PM
3332 if (!fw_loaded) {
3333#endif
3334 rc = ipw_get_fw(priv, &firmware, fw_name);
3335 if (rc < 0)
3336 goto error;
3337#ifdef CONFIG_PM
3338 }
3339#endif
3340
3324 /* DMA bss firmware into the device */ 3341 /* DMA bss firmware into the device */
3325 rc = ipw_load_firmware(priv, firmware->data + 3342 rc = ipw_load_firmware(priv, firmware->data +
3326 sizeof(struct fw_header), 3343 sizeof(struct fw_header),
@@ -3329,11 +3346,14 @@ static int ipw_load(struct ipw_priv *priv)
3329 IPW_ERROR("Unable to load firmware: %d\n", rc); 3346 IPW_ERROR("Unable to load firmware: %d\n", rc);
3330 goto error; 3347 goto error;
3331 } 3348 }
3349#ifdef CONFIG_PM
3350 fw_loaded = 1;
3351#endif
3332 3352
3333 ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); 3353 ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0);
3334 3354
3335 rc = ipw_queue_reset(priv); 3355 rc = ipw_queue_reset(priv);
3336 if (rc) { 3356 if (rc < 0) {
3337 IPW_ERROR("Unable to initialize queues\n"); 3357 IPW_ERROR("Unable to initialize queues\n");
3338 goto error; 3358 goto error;
3339 } 3359 }
@@ -3362,7 +3382,7 @@ static int ipw_load(struct ipw_priv *priv)
3362 rc = ipw_poll_bit(priv, IPW_INTA_RW, 3382 rc = ipw_poll_bit(priv, IPW_INTA_RW,
3363 IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); 3383 IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500);
3364 if (rc < 0) { 3384 if (rc < 0) {
3365 IPW_ERROR("device failed to start after 500ms\n"); 3385 IPW_ERROR("device failed to start within 500ms\n");
3366 goto error; 3386 goto error;
3367 } 3387 }
3368 IPW_DEBUG_INFO("device response after %dms\n", rc); 3388 IPW_DEBUG_INFO("device response after %dms\n", rc);
@@ -3715,9 +3735,9 @@ static int ipw_disassociate(void *data)
3715static void ipw_bg_disassociate(void *data) 3735static void ipw_bg_disassociate(void *data)
3716{ 3736{
3717 struct ipw_priv *priv = data; 3737 struct ipw_priv *priv = data;
3718 down(&priv->sem); 3738 mutex_lock(&priv->mutex);
3719 ipw_disassociate(data); 3739 ipw_disassociate(data);
3720 up(&priv->sem); 3740 mutex_unlock(&priv->mutex);
3721} 3741}
3722 3742
3723static void ipw_system_config(void *data) 3743static void ipw_system_config(void *data)
@@ -4077,9 +4097,9 @@ static void ipw_gather_stats(struct ipw_priv *priv)
4077static void ipw_bg_gather_stats(void *data) 4097static void ipw_bg_gather_stats(void *data)
4078{ 4098{
4079 struct ipw_priv *priv = data; 4099 struct ipw_priv *priv = data;
4080 down(&priv->sem); 4100 mutex_lock(&priv->mutex);
4081 ipw_gather_stats(data); 4101 ipw_gather_stats(data);
4082 up(&priv->sem); 4102 mutex_unlock(&priv->mutex);
4083} 4103}
4084 4104
4085/* Missed beacon behavior: 4105/* Missed beacon behavior:
@@ -4121,8 +4141,9 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
4121 return; 4141 return;
4122 } 4142 }
4123 4143
4124 if (missed_count > priv->roaming_threshold && 4144 if (roaming &&
4125 missed_count <= priv->disassociate_threshold) { 4145 (missed_count > priv->roaming_threshold &&
4146 missed_count <= priv->disassociate_threshold)) {
4126 /* If we are not already roaming, set the ROAM 4147 /* If we are not already roaming, set the ROAM
4127 * bit in the status and kick off a scan. 4148 * bit in the status and kick off a scan.
4128 * This can happen several times before we reach 4149 * This can happen several times before we reach
@@ -4150,7 +4171,6 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
4150 } 4171 }
4151 4172
4152 IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); 4173 IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count);
4153
4154} 4174}
4155 4175
4156/** 4176/**
@@ -4911,13 +4931,13 @@ static void ipw_rx_queue_replenish(void *data)
4911static void ipw_bg_rx_queue_replenish(void *data) 4931static void ipw_bg_rx_queue_replenish(void *data)
4912{ 4932{
4913 struct ipw_priv *priv = data; 4933 struct ipw_priv *priv = data;
4914 down(&priv->sem); 4934 mutex_lock(&priv->mutex);
4915 ipw_rx_queue_replenish(data); 4935 ipw_rx_queue_replenish(data);
4916 up(&priv->sem); 4936 mutex_unlock(&priv->mutex);
4917} 4937}
4918 4938
4919/* Assumes that the skb field of the buffers in 'pool' is kept accurate. 4939/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
4920 * If an SKB has been detached, the POOL needs to have it's SKB set to NULL 4940 * If an SKB has been detached, the POOL needs to have its SKB set to NULL
4921 * This free routine walks the list of POOL entries and if SKB is set to 4941 * This free routine walks the list of POOL entries and if SKB is set to
4922 * non NULL it is unmapped and freed 4942 * non NULL it is unmapped and freed
4923 */ 4943 */
@@ -5257,10 +5277,11 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5257 if (priv->ieee->scan_age != 0 && 5277 if (priv->ieee->scan_age != 0 &&
5258 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { 5278 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
5259 IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " 5279 IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded "
5260 "because of age: %lums.\n", 5280 "because of age: %ums.\n",
5261 escape_essid(network->ssid, network->ssid_len), 5281 escape_essid(network->ssid, network->ssid_len),
5262 MAC_ARG(network->bssid), 5282 MAC_ARG(network->bssid),
5263 1000 * (jiffies - network->last_scanned) / HZ); 5283 jiffies_to_msecs(jiffies -
5284 network->last_scanned));
5264 return 0; 5285 return 0;
5265 } 5286 }
5266 5287
@@ -5369,7 +5390,7 @@ static void ipw_merge_adhoc_network(void *data)
5369 return; 5390 return;
5370 } 5391 }
5371 5392
5372 down(&priv->sem); 5393 mutex_lock(&priv->mutex);
5373 if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { 5394 if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) {
5374 IPW_DEBUG_MERGE("remove network %s\n", 5395 IPW_DEBUG_MERGE("remove network %s\n",
5375 escape_essid(priv->essid, 5396 escape_essid(priv->essid,
@@ -5379,7 +5400,7 @@ static void ipw_merge_adhoc_network(void *data)
5379 5400
5380 ipw_disassociate(priv); 5401 ipw_disassociate(priv);
5381 priv->assoc_network = match.network; 5402 priv->assoc_network = match.network;
5382 up(&priv->sem); 5403 mutex_unlock(&priv->mutex);
5383 return; 5404 return;
5384 } 5405 }
5385} 5406}
@@ -5467,11 +5488,12 @@ static int ipw_best_network(struct ipw_priv *priv,
5467 if (network->last_associate && 5488 if (network->last_associate &&
5468 time_after(network->last_associate + (HZ * 3UL), jiffies)) { 5489 time_after(network->last_associate + (HZ * 3UL), jiffies)) {
5469 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 5490 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
5470 "because of storming (%lus since last " 5491 "because of storming (%ums since last "
5471 "assoc attempt).\n", 5492 "assoc attempt).\n",
5472 escape_essid(network->ssid, network->ssid_len), 5493 escape_essid(network->ssid, network->ssid_len),
5473 MAC_ARG(network->bssid), 5494 MAC_ARG(network->bssid),
5474 (jiffies - network->last_associate) / HZ); 5495 jiffies_to_msecs(jiffies -
5496 network->last_associate));
5475 return 0; 5497 return 0;
5476 } 5498 }
5477 5499
@@ -5479,10 +5501,11 @@ static int ipw_best_network(struct ipw_priv *priv,
5479 if (priv->ieee->scan_age != 0 && 5501 if (priv->ieee->scan_age != 0 &&
5480 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { 5502 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
5481 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " 5503 IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded "
5482 "because of age: %lums.\n", 5504 "because of age: %ums.\n",
5483 escape_essid(network->ssid, network->ssid_len), 5505 escape_essid(network->ssid, network->ssid_len),
5484 MAC_ARG(network->bssid), 5506 MAC_ARG(network->bssid),
5485 1000 * (jiffies - network->last_scanned) / HZ); 5507 jiffies_to_msecs(jiffies -
5508 network->last_scanned));
5486 return 0; 5509 return 0;
5487 } 5510 }
5488 5511
@@ -5671,54 +5694,44 @@ static void ipw_adhoc_create(struct ipw_priv *priv,
5671 5694
5672static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) 5695static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index)
5673{ 5696{
5674 struct ipw_tgi_tx_key *key; 5697 struct ipw_tgi_tx_key key;
5675 struct host_cmd cmd = {
5676 .cmd = IPW_CMD_TGI_TX_KEY,
5677 .len = sizeof(*key)
5678 };
5679 5698
5680 if (!(priv->ieee->sec.flags & (1 << index))) 5699 if (!(priv->ieee->sec.flags & (1 << index)))
5681 return; 5700 return;
5682 5701
5683 key = (struct ipw_tgi_tx_key *)&cmd.param; 5702 key.key_id = index;
5684 key->key_id = index; 5703 memcpy(key.key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH);
5685 memcpy(key->key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); 5704 key.security_type = type;
5686 key->security_type = type; 5705 key.station_index = 0; /* always 0 for BSS */
5687 key->station_index = 0; /* always 0 for BSS */ 5706 key.flags = 0;
5688 key->flags = 0;
5689 /* 0 for new key; previous value of counter (after fatal error) */ 5707 /* 0 for new key; previous value of counter (after fatal error) */
5690 key->tx_counter[0] = 0; 5708 key.tx_counter[0] = 0;
5691 key->tx_counter[1] = 0; 5709 key.tx_counter[1] = 0;
5692 5710
5693 ipw_send_cmd(priv, &cmd); 5711 ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key);
5694} 5712}
5695 5713
5696static void ipw_send_wep_keys(struct ipw_priv *priv, int type) 5714static void ipw_send_wep_keys(struct ipw_priv *priv, int type)
5697{ 5715{
5698 struct ipw_wep_key *key; 5716 struct ipw_wep_key key;
5699 int i; 5717 int i;
5700 struct host_cmd cmd = {
5701 .cmd = IPW_CMD_WEP_KEY,
5702 .len = sizeof(*key)
5703 };
5704 5718
5705 key = (struct ipw_wep_key *)&cmd.param; 5719 key.cmd_id = DINO_CMD_WEP_KEY;
5706 key->cmd_id = DINO_CMD_WEP_KEY; 5720 key.seq_num = 0;
5707 key->seq_num = 0;
5708 5721
5709 /* Note: AES keys cannot be set for multiple times. 5722 /* Note: AES keys cannot be set for multiple times.
5710 * Only set it at the first time. */ 5723 * Only set it at the first time. */
5711 for (i = 0; i < 4; i++) { 5724 for (i = 0; i < 4; i++) {
5712 key->key_index = i | type; 5725 key.key_index = i | type;
5713 if (!(priv->ieee->sec.flags & (1 << i))) { 5726 if (!(priv->ieee->sec.flags & (1 << i))) {
5714 key->key_size = 0; 5727 key.key_size = 0;
5715 continue; 5728 continue;
5716 } 5729 }
5717 5730
5718 key->key_size = priv->ieee->sec.key_sizes[i]; 5731 key.key_size = priv->ieee->sec.key_sizes[i];
5719 memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); 5732 memcpy(key.key, priv->ieee->sec.keys[i], key.key_size);
5720 5733
5721 ipw_send_cmd(priv, &cmd); 5734 ipw_send_cmd_pdu(priv, IPW_CMD_WEP_KEY, sizeof(key), &key);
5722 } 5735 }
5723} 5736}
5724 5737
@@ -5822,9 +5835,9 @@ static void ipw_adhoc_check(void *data)
5822static void ipw_bg_adhoc_check(void *data) 5835static void ipw_bg_adhoc_check(void *data)
5823{ 5836{
5824 struct ipw_priv *priv = data; 5837 struct ipw_priv *priv = data;
5825 down(&priv->sem); 5838 mutex_lock(&priv->mutex);
5826 ipw_adhoc_check(data); 5839 ipw_adhoc_check(data);
5827 up(&priv->sem); 5840 mutex_unlock(&priv->mutex);
5828} 5841}
5829 5842
5830#ifdef CONFIG_IPW2200_DEBUG 5843#ifdef CONFIG_IPW2200_DEBUG
@@ -6051,7 +6064,7 @@ static int ipw_request_scan(struct ipw_priv *priv)
6051 (priv->status & STATUS_EXIT_PENDING)) 6064 (priv->status & STATUS_EXIT_PENDING))
6052 return 0; 6065 return 0;
6053 6066
6054 down(&priv->sem); 6067 mutex_lock(&priv->mutex);
6055 6068
6056 if (priv->status & STATUS_SCANNING) { 6069 if (priv->status & STATUS_SCANNING) {
6057 IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); 6070 IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n");
@@ -6159,16 +6172,16 @@ static int ipw_request_scan(struct ipw_priv *priv)
6159 queue_delayed_work(priv->workqueue, &priv->scan_check, 6172 queue_delayed_work(priv->workqueue, &priv->scan_check,
6160 IPW_SCAN_CHECK_WATCHDOG); 6173 IPW_SCAN_CHECK_WATCHDOG);
6161 done: 6174 done:
6162 up(&priv->sem); 6175 mutex_unlock(&priv->mutex);
6163 return err; 6176 return err;
6164} 6177}
6165 6178
6166static void ipw_bg_abort_scan(void *data) 6179static void ipw_bg_abort_scan(void *data)
6167{ 6180{
6168 struct ipw_priv *priv = data; 6181 struct ipw_priv *priv = data;
6169 down(&priv->sem); 6182 mutex_lock(&priv->mutex);
6170 ipw_abort_scan(data); 6183 ipw_abort_scan(data);
6171 up(&priv->sem); 6184 mutex_unlock(&priv->mutex);
6172} 6185}
6173 6186
6174static int ipw_wpa_enable(struct ipw_priv *priv, int value) 6187static int ipw_wpa_enable(struct ipw_priv *priv, int value)
@@ -6193,6 +6206,9 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value)
6193 } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { 6206 } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) {
6194 sec.auth_mode = WLAN_AUTH_OPEN; 6207 sec.auth_mode = WLAN_AUTH_OPEN;
6195 ieee->open_wep = 1; 6208 ieee->open_wep = 1;
6209 } else if (value & IW_AUTH_ALG_LEAP) {
6210 sec.auth_mode = WLAN_AUTH_LEAP;
6211 ieee->open_wep = 1;
6196 } else 6212 } else
6197 return -EINVAL; 6213 return -EINVAL;
6198 6214
@@ -6204,7 +6220,8 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value)
6204 return ret; 6220 return ret;
6205} 6221}
6206 6222
6207void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) 6223static void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie,
6224 int wpa_ie_len)
6208{ 6225{
6209 /* make sure WPA is enabled */ 6226 /* make sure WPA is enabled */
6210 ipw_wpa_enable(priv, 1); 6227 ipw_wpa_enable(priv, 1);
@@ -6215,15 +6232,10 @@ void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len)
6215static int ipw_set_rsn_capa(struct ipw_priv *priv, 6232static int ipw_set_rsn_capa(struct ipw_priv *priv,
6216 char *capabilities, int length) 6233 char *capabilities, int length)
6217{ 6234{
6218 struct host_cmd cmd = {
6219 .cmd = IPW_CMD_RSN_CAPABILITIES,
6220 .len = length,
6221 };
6222
6223 IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); 6235 IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n");
6224 6236
6225 memcpy(cmd.param, capabilities, length); 6237 return ipw_send_cmd_pdu(priv, IPW_CMD_RSN_CAPABILITIES, length,
6226 return ipw_send_cmd(priv, &cmd); 6238 capabilities);
6227} 6239}
6228 6240
6229/* 6241/*
@@ -6244,7 +6256,7 @@ static int ipw_wx_set_genie(struct net_device *dev,
6244 (wrqu->data.length && extra == NULL)) 6256 (wrqu->data.length && extra == NULL))
6245 return -EINVAL; 6257 return -EINVAL;
6246 6258
6247 //down(&priv->sem); 6259 //mutex_lock(&priv->mutex);
6248 6260
6249 //if (!ieee->wpa_enabled) { 6261 //if (!ieee->wpa_enabled) {
6250 // err = -EOPNOTSUPP; 6262 // err = -EOPNOTSUPP;
@@ -6270,7 +6282,7 @@ static int ipw_wx_set_genie(struct net_device *dev,
6270 6282
6271 ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); 6283 ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len);
6272 out: 6284 out:
6273 //up(&priv->sem); 6285 //mutex_unlock(&priv->mutex);
6274 return err; 6286 return err;
6275} 6287}
6276 6288
@@ -6283,7 +6295,7 @@ static int ipw_wx_get_genie(struct net_device *dev,
6283 struct ieee80211_device *ieee = priv->ieee; 6295 struct ieee80211_device *ieee = priv->ieee;
6284 int err = 0; 6296 int err = 0;
6285 6297
6286 //down(&priv->sem); 6298 //mutex_lock(&priv->mutex);
6287 6299
6288 //if (!ieee->wpa_enabled) { 6300 //if (!ieee->wpa_enabled) {
6289 // err = -EOPNOTSUPP; 6301 // err = -EOPNOTSUPP;
@@ -6304,7 +6316,7 @@ static int ipw_wx_get_genie(struct net_device *dev,
6304 memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); 6316 memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len);
6305 6317
6306 out: 6318 out:
6307 //up(&priv->sem); 6319 //mutex_unlock(&priv->mutex);
6308 return err; 6320 return err;
6309} 6321}
6310 6322
@@ -6964,12 +6976,12 @@ static void ipw_bg_qos_activate(void *data)
6964 if (priv == NULL) 6976 if (priv == NULL)
6965 return; 6977 return;
6966 6978
6967 down(&priv->sem); 6979 mutex_lock(&priv->mutex);
6968 6980
6969 if (priv->status & STATUS_ASSOCIATED) 6981 if (priv->status & STATUS_ASSOCIATED)
6970 ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); 6982 ipw_qos_activate(priv, &(priv->assoc_network->qos_data));
6971 6983
6972 up(&priv->sem); 6984 mutex_unlock(&priv->mutex);
6973} 6985}
6974 6986
6975static int ipw_handle_probe_response(struct net_device *dev, 6987static int ipw_handle_probe_response(struct net_device *dev,
@@ -7010,25 +7022,15 @@ static int ipw_handle_assoc_response(struct net_device *dev,
7010static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters 7022static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters
7011 *qos_param) 7023 *qos_param)
7012{ 7024{
7013 struct host_cmd cmd = { 7025 return ipw_send_cmd_pdu(priv, IPW_CMD_QOS_PARAMETERS,
7014 .cmd = IPW_CMD_QOS_PARAMETERS, 7026 sizeof(*qos_param) * 3, qos_param);
7015 .len = (sizeof(struct ieee80211_qos_parameters) * 3)
7016 };
7017
7018 memcpy(cmd.param, qos_param, sizeof(*qos_param) * 3);
7019 return ipw_send_cmd(priv, &cmd);
7020} 7027}
7021 7028
7022static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element 7029static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element
7023 *qos_param) 7030 *qos_param)
7024{ 7031{
7025 struct host_cmd cmd = { 7032 return ipw_send_cmd_pdu(priv, IPW_CMD_WME_INFO, sizeof(*qos_param),
7026 .cmd = IPW_CMD_WME_INFO, 7033 qos_param);
7027 .len = sizeof(*qos_param)
7028 };
7029
7030 memcpy(cmd.param, qos_param, sizeof(*qos_param));
7031 return ipw_send_cmd(priv, &cmd);
7032} 7034}
7033 7035
7034#endif /* CONFIG_IPW_QOS */ 7036#endif /* CONFIG_IPW_QOS */
@@ -7052,19 +7054,22 @@ static int ipw_associate_network(struct ipw_priv *priv,
7052 7054
7053 memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); 7055 memset(&priv->assoc_request, 0, sizeof(priv->assoc_request));
7054 priv->assoc_request.channel = network->channel; 7056 priv->assoc_request.channel = network->channel;
7057 priv->assoc_request.auth_key = 0;
7058
7055 if ((priv->capability & CAP_PRIVACY_ON) && 7059 if ((priv->capability & CAP_PRIVACY_ON) &&
7056 (priv->capability & CAP_SHARED_KEY)) { 7060 (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) {
7057 priv->assoc_request.auth_type = AUTH_SHARED_KEY; 7061 priv->assoc_request.auth_type = AUTH_SHARED_KEY;
7058 priv->assoc_request.auth_key = priv->ieee->sec.active_key; 7062 priv->assoc_request.auth_key = priv->ieee->sec.active_key;
7059 7063
7060 if ((priv->capability & CAP_PRIVACY_ON) && 7064 if ((priv->ieee->sec.level == SEC_LEVEL_1) &&
7061 (priv->ieee->sec.level == SEC_LEVEL_1) &&
7062 !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) 7065 !(priv->ieee->host_encrypt || priv->ieee->host_decrypt))
7063 ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); 7066 ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP);
7064 } else { 7067
7068 } else if ((priv->capability & CAP_PRIVACY_ON) &&
7069 (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP))
7070 priv->assoc_request.auth_type = AUTH_LEAP;
7071 else
7065 priv->assoc_request.auth_type = AUTH_OPEN; 7072 priv->assoc_request.auth_type = AUTH_OPEN;
7066 priv->assoc_request.auth_key = 0;
7067 }
7068 7073
7069 if (priv->ieee->wpa_ie_len) { 7074 if (priv->ieee->wpa_ie_len) {
7070 priv->assoc_request.policy_support = 0x02; /* RSN active */ 7075 priv->assoc_request.policy_support = 0x02; /* RSN active */
@@ -7278,9 +7283,9 @@ static void ipw_roam(void *data)
7278static void ipw_bg_roam(void *data) 7283static void ipw_bg_roam(void *data)
7279{ 7284{
7280 struct ipw_priv *priv = data; 7285 struct ipw_priv *priv = data;
7281 down(&priv->sem); 7286 mutex_lock(&priv->mutex);
7282 ipw_roam(data); 7287 ipw_roam(data);
7283 up(&priv->sem); 7288 mutex_unlock(&priv->mutex);
7284} 7289}
7285 7290
7286static int ipw_associate(void *data) 7291static int ipw_associate(void *data)
@@ -7375,9 +7380,9 @@ static int ipw_associate(void *data)
7375static void ipw_bg_associate(void *data) 7380static void ipw_bg_associate(void *data)
7376{ 7381{
7377 struct ipw_priv *priv = data; 7382 struct ipw_priv *priv = data;
7378 down(&priv->sem); 7383 mutex_lock(&priv->mutex);
7379 ipw_associate(data); 7384 ipw_associate(data);
7380 up(&priv->sem); 7385 mutex_unlock(&priv->mutex);
7381} 7386}
7382 7387
7383static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, 7388static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv,
@@ -8126,7 +8131,7 @@ static int ipw_wx_get_name(struct net_device *dev,
8126 union iwreq_data *wrqu, char *extra) 8131 union iwreq_data *wrqu, char *extra)
8127{ 8132{
8128 struct ipw_priv *priv = ieee80211_priv(dev); 8133 struct ipw_priv *priv = ieee80211_priv(dev);
8129 down(&priv->sem); 8134 mutex_lock(&priv->mutex);
8130 if (priv->status & STATUS_RF_KILL_MASK) 8135 if (priv->status & STATUS_RF_KILL_MASK)
8131 strcpy(wrqu->name, "radio off"); 8136 strcpy(wrqu->name, "radio off");
8132 else if (!(priv->status & STATUS_ASSOCIATED)) 8137 else if (!(priv->status & STATUS_ASSOCIATED))
@@ -8135,7 +8140,7 @@ static int ipw_wx_get_name(struct net_device *dev,
8135 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", 8140 snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c",
8136 ipw_modes[priv->assoc_request.ieee_mode]); 8141 ipw_modes[priv->assoc_request.ieee_mode]);
8137 IPW_DEBUG_WX("Name: %s\n", wrqu->name); 8142 IPW_DEBUG_WX("Name: %s\n", wrqu->name);
8138 up(&priv->sem); 8143 mutex_unlock(&priv->mutex);
8139 return 0; 8144 return 0;
8140} 8145}
8141 8146
@@ -8204,9 +8209,9 @@ static int ipw_wx_set_freq(struct net_device *dev,
8204 8209
8205 if (fwrq->m == 0) { 8210 if (fwrq->m == 0) {
8206 IPW_DEBUG_WX("SET Freq/Channel -> any\n"); 8211 IPW_DEBUG_WX("SET Freq/Channel -> any\n");
8207 down(&priv->sem); 8212 mutex_lock(&priv->mutex);
8208 ret = ipw_set_channel(priv, 0); 8213 ret = ipw_set_channel(priv, 0);
8209 up(&priv->sem); 8214 mutex_unlock(&priv->mutex);
8210 return ret; 8215 return ret;
8211 } 8216 }
8212 /* if setting by freq convert to channel */ 8217 /* if setting by freq convert to channel */
@@ -8234,9 +8239,9 @@ static int ipw_wx_set_freq(struct net_device *dev,
8234 } 8239 }
8235 8240
8236 IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); 8241 IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m);
8237 down(&priv->sem); 8242 mutex_lock(&priv->mutex);
8238 ret = ipw_set_channel(priv, channel); 8243 ret = ipw_set_channel(priv, channel);
8239 up(&priv->sem); 8244 mutex_unlock(&priv->mutex);
8240 return ret; 8245 return ret;
8241} 8246}
8242 8247
@@ -8250,14 +8255,14 @@ static int ipw_wx_get_freq(struct net_device *dev,
8250 8255
8251 /* If we are associated, trying to associate, or have a statically 8256 /* If we are associated, trying to associate, or have a statically
8252 * configured CHANNEL then return that; otherwise return ANY */ 8257 * configured CHANNEL then return that; otherwise return ANY */
8253 down(&priv->sem); 8258 mutex_lock(&priv->mutex);
8254 if (priv->config & CFG_STATIC_CHANNEL || 8259 if (priv->config & CFG_STATIC_CHANNEL ||
8255 priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) 8260 priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED))
8256 wrqu->freq.m = priv->channel; 8261 wrqu->freq.m = priv->channel;
8257 else 8262 else
8258 wrqu->freq.m = 0; 8263 wrqu->freq.m = 0;
8259 8264
8260 up(&priv->sem); 8265 mutex_unlock(&priv->mutex);
8261 IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); 8266 IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel);
8262 return 0; 8267 return 0;
8263} 8268}
@@ -8287,7 +8292,7 @@ static int ipw_wx_set_mode(struct net_device *dev,
8287 if (wrqu->mode == priv->ieee->iw_mode) 8292 if (wrqu->mode == priv->ieee->iw_mode)
8288 return 0; 8293 return 0;
8289 8294
8290 down(&priv->sem); 8295 mutex_lock(&priv->mutex);
8291 8296
8292 ipw_sw_reset(priv, 0); 8297 ipw_sw_reset(priv, 0);
8293 8298
@@ -8310,7 +8315,7 @@ static int ipw_wx_set_mode(struct net_device *dev,
8310 priv->ieee->iw_mode = wrqu->mode; 8315 priv->ieee->iw_mode = wrqu->mode;
8311 8316
8312 queue_work(priv->workqueue, &priv->adapter_restart); 8317 queue_work(priv->workqueue, &priv->adapter_restart);
8313 up(&priv->sem); 8318 mutex_unlock(&priv->mutex);
8314 return err; 8319 return err;
8315} 8320}
8316 8321
@@ -8319,10 +8324,10 @@ static int ipw_wx_get_mode(struct net_device *dev,
8319 union iwreq_data *wrqu, char *extra) 8324 union iwreq_data *wrqu, char *extra)
8320{ 8325{
8321 struct ipw_priv *priv = ieee80211_priv(dev); 8326 struct ipw_priv *priv = ieee80211_priv(dev);
8322 down(&priv->sem); 8327 mutex_lock(&priv->mutex);
8323 wrqu->mode = priv->ieee->iw_mode; 8328 wrqu->mode = priv->ieee->iw_mode;
8324 IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); 8329 IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode);
8325 up(&priv->sem); 8330 mutex_unlock(&priv->mutex);
8326 return 0; 8331 return 0;
8327} 8332}
8328 8333
@@ -8369,7 +8374,7 @@ static int ipw_wx_get_range(struct net_device *dev,
8369 range->avg_qual.level = 0; /* FIXME to real average level */ 8374 range->avg_qual.level = 0; /* FIXME to real average level */
8370 range->avg_qual.noise = 0; 8375 range->avg_qual.noise = 0;
8371 range->avg_qual.updated = 7; /* Updated all three */ 8376 range->avg_qual.updated = 7; /* Updated all three */
8372 down(&priv->sem); 8377 mutex_lock(&priv->mutex);
8373 range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); 8378 range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES);
8374 8379
8375 for (i = 0; i < range->num_bitrates; i++) 8380 for (i = 0; i < range->num_bitrates; i++)
@@ -8387,7 +8392,7 @@ static int ipw_wx_get_range(struct net_device *dev,
8387 8392
8388 /* Set the Wireless Extension versions */ 8393 /* Set the Wireless Extension versions */
8389 range->we_version_compiled = WIRELESS_EXT; 8394 range->we_version_compiled = WIRELESS_EXT;
8390 range->we_version_source = 16; 8395 range->we_version_source = 18;
8391 8396
8392 i = 0; 8397 i = 0;
8393 if (priv->ieee->mode & (IEEE_B | IEEE_G)) { 8398 if (priv->ieee->mode & (IEEE_B | IEEE_G)) {
@@ -8411,7 +8416,7 @@ static int ipw_wx_get_range(struct net_device *dev,
8411 range->num_channels = i; 8416 range->num_channels = i;
8412 range->num_frequency = i; 8417 range->num_frequency = i;
8413 8418
8414 up(&priv->sem); 8419 mutex_unlock(&priv->mutex);
8415 8420
8416 /* Event capability (kernel + driver) */ 8421 /* Event capability (kernel + driver) */
8417 range->event_capa[0] = (IW_EVENT_CAPA_K_0 | 8422 range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
@@ -8419,6 +8424,9 @@ static int ipw_wx_get_range(struct net_device *dev,
8419 IW_EVENT_CAPA_MASK(SIOCGIWAP)); 8424 IW_EVENT_CAPA_MASK(SIOCGIWAP));
8420 range->event_capa[1] = IW_EVENT_CAPA_K_1; 8425 range->event_capa[1] = IW_EVENT_CAPA_K_1;
8421 8426
8427 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
8428 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
8429
8422 IPW_DEBUG_WX("GET Range\n"); 8430 IPW_DEBUG_WX("GET Range\n");
8423 return 0; 8431 return 0;
8424} 8432}
@@ -8438,7 +8446,7 @@ static int ipw_wx_set_wap(struct net_device *dev,
8438 8446
8439 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) 8447 if (wrqu->ap_addr.sa_family != ARPHRD_ETHER)
8440 return -EINVAL; 8448 return -EINVAL;
8441 down(&priv->sem); 8449 mutex_lock(&priv->mutex);
8442 if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || 8450 if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) ||
8443 !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { 8451 !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) {
8444 /* we disable mandatory BSSID association */ 8452 /* we disable mandatory BSSID association */
@@ -8447,14 +8455,14 @@ static int ipw_wx_set_wap(struct net_device *dev,
8447 IPW_DEBUG_ASSOC("Attempting to associate with new " 8455 IPW_DEBUG_ASSOC("Attempting to associate with new "
8448 "parameters.\n"); 8456 "parameters.\n");
8449 ipw_associate(priv); 8457 ipw_associate(priv);
8450 up(&priv->sem); 8458 mutex_unlock(&priv->mutex);
8451 return 0; 8459 return 0;
8452 } 8460 }
8453 8461
8454 priv->config |= CFG_STATIC_BSSID; 8462 priv->config |= CFG_STATIC_BSSID;
8455 if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { 8463 if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) {
8456 IPW_DEBUG_WX("BSSID set to current BSSID.\n"); 8464 IPW_DEBUG_WX("BSSID set to current BSSID.\n");
8457 up(&priv->sem); 8465 mutex_unlock(&priv->mutex);
8458 return 0; 8466 return 0;
8459 } 8467 }
8460 8468
@@ -8468,7 +8476,7 @@ static int ipw_wx_set_wap(struct net_device *dev,
8468 if (!ipw_disassociate(priv)) 8476 if (!ipw_disassociate(priv))
8469 ipw_associate(priv); 8477 ipw_associate(priv);
8470 8478
8471 up(&priv->sem); 8479 mutex_unlock(&priv->mutex);
8472 return 0; 8480 return 0;
8473} 8481}
8474 8482
@@ -8479,7 +8487,7 @@ static int ipw_wx_get_wap(struct net_device *dev,
8479 struct ipw_priv *priv = ieee80211_priv(dev); 8487 struct ipw_priv *priv = ieee80211_priv(dev);
8480 /* If we are associated, trying to associate, or have a statically 8488 /* If we are associated, trying to associate, or have a statically
8481 * configured BSSID then return that; otherwise return ANY */ 8489 * configured BSSID then return that; otherwise return ANY */
8482 down(&priv->sem); 8490 mutex_lock(&priv->mutex);
8483 if (priv->config & CFG_STATIC_BSSID || 8491 if (priv->config & CFG_STATIC_BSSID ||
8484 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 8492 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
8485 wrqu->ap_addr.sa_family = ARPHRD_ETHER; 8493 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
@@ -8489,7 +8497,7 @@ static int ipw_wx_get_wap(struct net_device *dev,
8489 8497
8490 IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", 8498 IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n",
8491 MAC_ARG(wrqu->ap_addr.sa_data)); 8499 MAC_ARG(wrqu->ap_addr.sa_data));
8492 up(&priv->sem); 8500 mutex_unlock(&priv->mutex);
8493 return 0; 8501 return 0;
8494} 8502}
8495 8503
@@ -8500,7 +8508,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
8500 struct ipw_priv *priv = ieee80211_priv(dev); 8508 struct ipw_priv *priv = ieee80211_priv(dev);
8501 char *essid = ""; /* ANY */ 8509 char *essid = ""; /* ANY */
8502 int length = 0; 8510 int length = 0;
8503 down(&priv->sem); 8511 mutex_lock(&priv->mutex);
8504 if (wrqu->essid.flags && wrqu->essid.length) { 8512 if (wrqu->essid.flags && wrqu->essid.length) {
8505 length = wrqu->essid.length - 1; 8513 length = wrqu->essid.length - 1;
8506 essid = extra; 8514 essid = extra;
@@ -8515,7 +8523,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
8515 priv->config &= ~CFG_STATIC_ESSID; 8523 priv->config &= ~CFG_STATIC_ESSID;
8516 ipw_associate(priv); 8524 ipw_associate(priv);
8517 } 8525 }
8518 up(&priv->sem); 8526 mutex_unlock(&priv->mutex);
8519 return 0; 8527 return 0;
8520 } 8528 }
8521 8529
@@ -8525,7 +8533,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
8525 8533
8526 if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { 8534 if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) {
8527 IPW_DEBUG_WX("ESSID set to current ESSID.\n"); 8535 IPW_DEBUG_WX("ESSID set to current ESSID.\n");
8528 up(&priv->sem); 8536 mutex_unlock(&priv->mutex);
8529 return 0; 8537 return 0;
8530 } 8538 }
8531 8539
@@ -8540,7 +8548,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
8540 if (!ipw_disassociate(priv)) 8548 if (!ipw_disassociate(priv))
8541 ipw_associate(priv); 8549 ipw_associate(priv);
8542 8550
8543 up(&priv->sem); 8551 mutex_unlock(&priv->mutex);
8544 return 0; 8552 return 0;
8545} 8553}
8546 8554
@@ -8552,7 +8560,7 @@ static int ipw_wx_get_essid(struct net_device *dev,
8552 8560
8553 /* If we are associated, trying to associate, or have a statically 8561 /* If we are associated, trying to associate, or have a statically
8554 * configured ESSID then return that; otherwise return ANY */ 8562 * configured ESSID then return that; otherwise return ANY */
8555 down(&priv->sem); 8563 mutex_lock(&priv->mutex);
8556 if (priv->config & CFG_STATIC_ESSID || 8564 if (priv->config & CFG_STATIC_ESSID ||
8557 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 8565 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
8558 IPW_DEBUG_WX("Getting essid: '%s'\n", 8566 IPW_DEBUG_WX("Getting essid: '%s'\n",
@@ -8565,7 +8573,7 @@ static int ipw_wx_get_essid(struct net_device *dev,
8565 wrqu->essid.length = 0; 8573 wrqu->essid.length = 0;
8566 wrqu->essid.flags = 0; /* active */ 8574 wrqu->essid.flags = 0; /* active */
8567 } 8575 }
8568 up(&priv->sem); 8576 mutex_unlock(&priv->mutex);
8569 return 0; 8577 return 0;
8570} 8578}
8571 8579
@@ -8578,12 +8586,12 @@ static int ipw_wx_set_nick(struct net_device *dev,
8578 IPW_DEBUG_WX("Setting nick to '%s'\n", extra); 8586 IPW_DEBUG_WX("Setting nick to '%s'\n", extra);
8579 if (wrqu->data.length > IW_ESSID_MAX_SIZE) 8587 if (wrqu->data.length > IW_ESSID_MAX_SIZE)
8580 return -E2BIG; 8588 return -E2BIG;
8581 down(&priv->sem); 8589 mutex_lock(&priv->mutex);
8582 wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); 8590 wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick));
8583 memset(priv->nick, 0, sizeof(priv->nick)); 8591 memset(priv->nick, 0, sizeof(priv->nick));
8584 memcpy(priv->nick, extra, wrqu->data.length); 8592 memcpy(priv->nick, extra, wrqu->data.length);
8585 IPW_DEBUG_TRACE("<<\n"); 8593 IPW_DEBUG_TRACE("<<\n");
8586 up(&priv->sem); 8594 mutex_unlock(&priv->mutex);
8587 return 0; 8595 return 0;
8588 8596
8589} 8597}
@@ -8594,11 +8602,11 @@ static int ipw_wx_get_nick(struct net_device *dev,
8594{ 8602{
8595 struct ipw_priv *priv = ieee80211_priv(dev); 8603 struct ipw_priv *priv = ieee80211_priv(dev);
8596 IPW_DEBUG_WX("Getting nick\n"); 8604 IPW_DEBUG_WX("Getting nick\n");
8597 down(&priv->sem); 8605 mutex_lock(&priv->mutex);
8598 wrqu->data.length = strlen(priv->nick) + 1; 8606 wrqu->data.length = strlen(priv->nick) + 1;
8599 memcpy(extra, priv->nick, wrqu->data.length); 8607 memcpy(extra, priv->nick, wrqu->data.length);
8600 wrqu->data.flags = 1; /* active */ 8608 wrqu->data.flags = 1; /* active */
8601 up(&priv->sem); 8609 mutex_unlock(&priv->mutex);
8602 return 0; 8610 return 0;
8603} 8611}
8604 8612
@@ -8691,7 +8699,7 @@ static int ipw_wx_set_rate(struct net_device *dev,
8691 apply: 8699 apply:
8692 IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", 8700 IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n",
8693 mask, fixed ? "fixed" : "sub-rates"); 8701 mask, fixed ? "fixed" : "sub-rates");
8694 down(&priv->sem); 8702 mutex_lock(&priv->mutex);
8695 if (mask == IEEE80211_DEFAULT_RATES_MASK) { 8703 if (mask == IEEE80211_DEFAULT_RATES_MASK) {
8696 priv->config &= ~CFG_FIXED_RATE; 8704 priv->config &= ~CFG_FIXED_RATE;
8697 ipw_set_fixed_rate(priv, priv->ieee->mode); 8705 ipw_set_fixed_rate(priv, priv->ieee->mode);
@@ -8700,7 +8708,7 @@ static int ipw_wx_set_rate(struct net_device *dev,
8700 8708
8701 if (priv->rates_mask == mask) { 8709 if (priv->rates_mask == mask) {
8702 IPW_DEBUG_WX("Mask set to current mask.\n"); 8710 IPW_DEBUG_WX("Mask set to current mask.\n");
8703 up(&priv->sem); 8711 mutex_unlock(&priv->mutex);
8704 return 0; 8712 return 0;
8705 } 8713 }
8706 8714
@@ -8711,7 +8719,7 @@ static int ipw_wx_set_rate(struct net_device *dev,
8711 if (!ipw_disassociate(priv)) 8719 if (!ipw_disassociate(priv))
8712 ipw_associate(priv); 8720 ipw_associate(priv);
8713 8721
8714 up(&priv->sem); 8722 mutex_unlock(&priv->mutex);
8715 return 0; 8723 return 0;
8716} 8724}
8717 8725
@@ -8720,9 +8728,9 @@ static int ipw_wx_get_rate(struct net_device *dev,
8720 union iwreq_data *wrqu, char *extra) 8728 union iwreq_data *wrqu, char *extra)
8721{ 8729{
8722 struct ipw_priv *priv = ieee80211_priv(dev); 8730 struct ipw_priv *priv = ieee80211_priv(dev);
8723 down(&priv->sem); 8731 mutex_lock(&priv->mutex);
8724 wrqu->bitrate.value = priv->last_rate; 8732 wrqu->bitrate.value = priv->last_rate;
8725 up(&priv->sem); 8733 mutex_unlock(&priv->mutex);
8726 IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); 8734 IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value);
8727 return 0; 8735 return 0;
8728} 8736}
@@ -8732,20 +8740,20 @@ static int ipw_wx_set_rts(struct net_device *dev,
8732 union iwreq_data *wrqu, char *extra) 8740 union iwreq_data *wrqu, char *extra)
8733{ 8741{
8734 struct ipw_priv *priv = ieee80211_priv(dev); 8742 struct ipw_priv *priv = ieee80211_priv(dev);
8735 down(&priv->sem); 8743 mutex_lock(&priv->mutex);
8736 if (wrqu->rts.disabled) 8744 if (wrqu->rts.disabled)
8737 priv->rts_threshold = DEFAULT_RTS_THRESHOLD; 8745 priv->rts_threshold = DEFAULT_RTS_THRESHOLD;
8738 else { 8746 else {
8739 if (wrqu->rts.value < MIN_RTS_THRESHOLD || 8747 if (wrqu->rts.value < MIN_RTS_THRESHOLD ||
8740 wrqu->rts.value > MAX_RTS_THRESHOLD) { 8748 wrqu->rts.value > MAX_RTS_THRESHOLD) {
8741 up(&priv->sem); 8749 mutex_unlock(&priv->mutex);
8742 return -EINVAL; 8750 return -EINVAL;
8743 } 8751 }
8744 priv->rts_threshold = wrqu->rts.value; 8752 priv->rts_threshold = wrqu->rts.value;
8745 } 8753 }
8746 8754
8747 ipw_send_rts_threshold(priv, priv->rts_threshold); 8755 ipw_send_rts_threshold(priv, priv->rts_threshold);
8748 up(&priv->sem); 8756 mutex_unlock(&priv->mutex);
8749 IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); 8757 IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold);
8750 return 0; 8758 return 0;
8751} 8759}
@@ -8755,11 +8763,11 @@ static int ipw_wx_get_rts(struct net_device *dev,
8755 union iwreq_data *wrqu, char *extra) 8763 union iwreq_data *wrqu, char *extra)
8756{ 8764{
8757 struct ipw_priv *priv = ieee80211_priv(dev); 8765 struct ipw_priv *priv = ieee80211_priv(dev);
8758 down(&priv->sem); 8766 mutex_lock(&priv->mutex);
8759 wrqu->rts.value = priv->rts_threshold; 8767 wrqu->rts.value = priv->rts_threshold;
8760 wrqu->rts.fixed = 0; /* no auto select */ 8768 wrqu->rts.fixed = 0; /* no auto select */
8761 wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); 8769 wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD);
8762 up(&priv->sem); 8770 mutex_unlock(&priv->mutex);
8763 IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); 8771 IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value);
8764 return 0; 8772 return 0;
8765} 8773}
@@ -8771,7 +8779,7 @@ static int ipw_wx_set_txpow(struct net_device *dev,
8771 struct ipw_priv *priv = ieee80211_priv(dev); 8779 struct ipw_priv *priv = ieee80211_priv(dev);
8772 int err = 0; 8780 int err = 0;
8773 8781
8774 down(&priv->sem); 8782 mutex_lock(&priv->mutex);
8775 if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { 8783 if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) {
8776 err = -EINPROGRESS; 8784 err = -EINPROGRESS;
8777 goto out; 8785 goto out;
@@ -8794,7 +8802,7 @@ static int ipw_wx_set_txpow(struct net_device *dev,
8794 priv->tx_power = wrqu->power.value; 8802 priv->tx_power = wrqu->power.value;
8795 err = ipw_set_tx_power(priv); 8803 err = ipw_set_tx_power(priv);
8796 out: 8804 out:
8797 up(&priv->sem); 8805 mutex_unlock(&priv->mutex);
8798 return err; 8806 return err;
8799} 8807}
8800 8808
@@ -8803,12 +8811,12 @@ static int ipw_wx_get_txpow(struct net_device *dev,
8803 union iwreq_data *wrqu, char *extra) 8811 union iwreq_data *wrqu, char *extra)
8804{ 8812{
8805 struct ipw_priv *priv = ieee80211_priv(dev); 8813 struct ipw_priv *priv = ieee80211_priv(dev);
8806 down(&priv->sem); 8814 mutex_lock(&priv->mutex);
8807 wrqu->power.value = priv->tx_power; 8815 wrqu->power.value = priv->tx_power;
8808 wrqu->power.fixed = 1; 8816 wrqu->power.fixed = 1;
8809 wrqu->power.flags = IW_TXPOW_DBM; 8817 wrqu->power.flags = IW_TXPOW_DBM;
8810 wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; 8818 wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0;
8811 up(&priv->sem); 8819 mutex_unlock(&priv->mutex);
8812 8820
8813 IPW_DEBUG_WX("GET TX Power -> %s %d \n", 8821 IPW_DEBUG_WX("GET TX Power -> %s %d \n",
8814 wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); 8822 wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value);
@@ -8821,13 +8829,13 @@ static int ipw_wx_set_frag(struct net_device *dev,
8821 union iwreq_data *wrqu, char *extra) 8829 union iwreq_data *wrqu, char *extra)
8822{ 8830{
8823 struct ipw_priv *priv = ieee80211_priv(dev); 8831 struct ipw_priv *priv = ieee80211_priv(dev);
8824 down(&priv->sem); 8832 mutex_lock(&priv->mutex);
8825 if (wrqu->frag.disabled) 8833 if (wrqu->frag.disabled)
8826 priv->ieee->fts = DEFAULT_FTS; 8834 priv->ieee->fts = DEFAULT_FTS;
8827 else { 8835 else {
8828 if (wrqu->frag.value < MIN_FRAG_THRESHOLD || 8836 if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
8829 wrqu->frag.value > MAX_FRAG_THRESHOLD) { 8837 wrqu->frag.value > MAX_FRAG_THRESHOLD) {
8830 up(&priv->sem); 8838 mutex_unlock(&priv->mutex);
8831 return -EINVAL; 8839 return -EINVAL;
8832 } 8840 }
8833 8841
@@ -8835,7 +8843,7 @@ static int ipw_wx_set_frag(struct net_device *dev,
8835 } 8843 }
8836 8844
8837 ipw_send_frag_threshold(priv, wrqu->frag.value); 8845 ipw_send_frag_threshold(priv, wrqu->frag.value);
8838 up(&priv->sem); 8846 mutex_unlock(&priv->mutex);
8839 IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); 8847 IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value);
8840 return 0; 8848 return 0;
8841} 8849}
@@ -8845,11 +8853,11 @@ static int ipw_wx_get_frag(struct net_device *dev,
8845 union iwreq_data *wrqu, char *extra) 8853 union iwreq_data *wrqu, char *extra)
8846{ 8854{
8847 struct ipw_priv *priv = ieee80211_priv(dev); 8855 struct ipw_priv *priv = ieee80211_priv(dev);
8848 down(&priv->sem); 8856 mutex_lock(&priv->mutex);
8849 wrqu->frag.value = priv->ieee->fts; 8857 wrqu->frag.value = priv->ieee->fts;
8850 wrqu->frag.fixed = 0; /* no auto select */ 8858 wrqu->frag.fixed = 0; /* no auto select */
8851 wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); 8859 wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS);
8852 up(&priv->sem); 8860 mutex_unlock(&priv->mutex);
8853 IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); 8861 IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value);
8854 8862
8855 return 0; 8863 return 0;
@@ -8870,7 +8878,7 @@ static int ipw_wx_set_retry(struct net_device *dev,
8870 if (wrqu->retry.value < 0 || wrqu->retry.value > 255) 8878 if (wrqu->retry.value < 0 || wrqu->retry.value > 255)
8871 return -EINVAL; 8879 return -EINVAL;
8872 8880
8873 down(&priv->sem); 8881 mutex_lock(&priv->mutex);
8874 if (wrqu->retry.flags & IW_RETRY_MIN) 8882 if (wrqu->retry.flags & IW_RETRY_MIN)
8875 priv->short_retry_limit = (u8) wrqu->retry.value; 8883 priv->short_retry_limit = (u8) wrqu->retry.value;
8876 else if (wrqu->retry.flags & IW_RETRY_MAX) 8884 else if (wrqu->retry.flags & IW_RETRY_MAX)
@@ -8882,7 +8890,7 @@ static int ipw_wx_set_retry(struct net_device *dev,
8882 8890
8883 ipw_send_retry_limit(priv, priv->short_retry_limit, 8891 ipw_send_retry_limit(priv, priv->short_retry_limit,
8884 priv->long_retry_limit); 8892 priv->long_retry_limit);
8885 up(&priv->sem); 8893 mutex_unlock(&priv->mutex);
8886 IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", 8894 IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n",
8887 priv->short_retry_limit, priv->long_retry_limit); 8895 priv->short_retry_limit, priv->long_retry_limit);
8888 return 0; 8896 return 0;
@@ -8894,11 +8902,11 @@ static int ipw_wx_get_retry(struct net_device *dev,
8894{ 8902{
8895 struct ipw_priv *priv = ieee80211_priv(dev); 8903 struct ipw_priv *priv = ieee80211_priv(dev);
8896 8904
8897 down(&priv->sem); 8905 mutex_lock(&priv->mutex);
8898 wrqu->retry.disabled = 0; 8906 wrqu->retry.disabled = 0;
8899 8907
8900 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { 8908 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
8901 up(&priv->sem); 8909 mutex_unlock(&priv->mutex);
8902 return -EINVAL; 8910 return -EINVAL;
8903 } 8911 }
8904 8912
@@ -8912,7 +8920,7 @@ static int ipw_wx_get_retry(struct net_device *dev,
8912 wrqu->retry.flags = IW_RETRY_LIMIT; 8920 wrqu->retry.flags = IW_RETRY_LIMIT;
8913 wrqu->retry.value = priv->short_retry_limit; 8921 wrqu->retry.value = priv->short_retry_limit;
8914 } 8922 }
8915 up(&priv->sem); 8923 mutex_unlock(&priv->mutex);
8916 8924
8917 IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); 8925 IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value);
8918 8926
@@ -8929,7 +8937,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid,
8929 (priv->status & STATUS_EXIT_PENDING)) 8937 (priv->status & STATUS_EXIT_PENDING))
8930 return 0; 8938 return 0;
8931 8939
8932 down(&priv->sem); 8940 mutex_lock(&priv->mutex);
8933 8941
8934 if (priv->status & STATUS_RF_KILL_MASK) { 8942 if (priv->status & STATUS_RF_KILL_MASK) {
8935 IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); 8943 IPW_DEBUG_HC("Aborting scan due to RF kill activation\n");
@@ -8981,7 +8989,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid,
8981 priv->status |= STATUS_SCANNING; 8989 priv->status |= STATUS_SCANNING;
8982 8990
8983 done: 8991 done:
8984 up(&priv->sem); 8992 mutex_unlock(&priv->mutex);
8985 return err; 8993 return err;
8986} 8994}
8987 8995
@@ -9024,7 +9032,7 @@ static int ipw_wx_set_encode(struct net_device *dev,
9024 int ret; 9032 int ret;
9025 u32 cap = priv->capability; 9033 u32 cap = priv->capability;
9026 9034
9027 down(&priv->sem); 9035 mutex_lock(&priv->mutex);
9028 ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); 9036 ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key);
9029 9037
9030 /* In IBSS mode, we need to notify the firmware to update 9038 /* In IBSS mode, we need to notify the firmware to update
@@ -9034,7 +9042,7 @@ static int ipw_wx_set_encode(struct net_device *dev,
9034 priv->status & STATUS_ASSOCIATED) 9042 priv->status & STATUS_ASSOCIATED)
9035 ipw_disassociate(priv); 9043 ipw_disassociate(priv);
9036 9044
9037 up(&priv->sem); 9045 mutex_unlock(&priv->mutex);
9038 return ret; 9046 return ret;
9039} 9047}
9040 9048
@@ -9052,17 +9060,17 @@ static int ipw_wx_set_power(struct net_device *dev,
9052{ 9060{
9053 struct ipw_priv *priv = ieee80211_priv(dev); 9061 struct ipw_priv *priv = ieee80211_priv(dev);
9054 int err; 9062 int err;
9055 down(&priv->sem); 9063 mutex_lock(&priv->mutex);
9056 if (wrqu->power.disabled) { 9064 if (wrqu->power.disabled) {
9057 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); 9065 priv->power_mode = IPW_POWER_LEVEL(priv->power_mode);
9058 err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); 9066 err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM);
9059 if (err) { 9067 if (err) {
9060 IPW_DEBUG_WX("failed setting power mode.\n"); 9068 IPW_DEBUG_WX("failed setting power mode.\n");
9061 up(&priv->sem); 9069 mutex_unlock(&priv->mutex);
9062 return err; 9070 return err;
9063 } 9071 }
9064 IPW_DEBUG_WX("SET Power Management Mode -> off\n"); 9072 IPW_DEBUG_WX("SET Power Management Mode -> off\n");
9065 up(&priv->sem); 9073 mutex_unlock(&priv->mutex);
9066 return 0; 9074 return 0;
9067 } 9075 }
9068 9076
@@ -9074,7 +9082,7 @@ static int ipw_wx_set_power(struct net_device *dev,
9074 default: /* Otherwise we don't support it */ 9082 default: /* Otherwise we don't support it */
9075 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 9083 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n",
9076 wrqu->power.flags); 9084 wrqu->power.flags);
9077 up(&priv->sem); 9085 mutex_unlock(&priv->mutex);
9078 return -EOPNOTSUPP; 9086 return -EOPNOTSUPP;
9079 } 9087 }
9080 9088
@@ -9087,12 +9095,12 @@ static int ipw_wx_set_power(struct net_device *dev,
9087 err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); 9095 err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
9088 if (err) { 9096 if (err) {
9089 IPW_DEBUG_WX("failed setting power mode.\n"); 9097 IPW_DEBUG_WX("failed setting power mode.\n");
9090 up(&priv->sem); 9098 mutex_unlock(&priv->mutex);
9091 return err; 9099 return err;
9092 } 9100 }
9093 9101
9094 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); 9102 IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode);
9095 up(&priv->sem); 9103 mutex_unlock(&priv->mutex);
9096 return 0; 9104 return 0;
9097} 9105}
9098 9106
@@ -9101,13 +9109,13 @@ static int ipw_wx_get_power(struct net_device *dev,
9101 union iwreq_data *wrqu, char *extra) 9109 union iwreq_data *wrqu, char *extra)
9102{ 9110{
9103 struct ipw_priv *priv = ieee80211_priv(dev); 9111 struct ipw_priv *priv = ieee80211_priv(dev);
9104 down(&priv->sem); 9112 mutex_lock(&priv->mutex);
9105 if (!(priv->power_mode & IPW_POWER_ENABLED)) 9113 if (!(priv->power_mode & IPW_POWER_ENABLED))
9106 wrqu->power.disabled = 1; 9114 wrqu->power.disabled = 1;
9107 else 9115 else
9108 wrqu->power.disabled = 0; 9116 wrqu->power.disabled = 0;
9109 9117
9110 up(&priv->sem); 9118 mutex_unlock(&priv->mutex);
9111 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); 9119 IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode);
9112 9120
9113 return 0; 9121 return 0;
@@ -9120,7 +9128,7 @@ static int ipw_wx_set_powermode(struct net_device *dev,
9120 struct ipw_priv *priv = ieee80211_priv(dev); 9128 struct ipw_priv *priv = ieee80211_priv(dev);
9121 int mode = *(int *)extra; 9129 int mode = *(int *)extra;
9122 int err; 9130 int err;
9123 down(&priv->sem); 9131 mutex_lock(&priv->mutex);
9124 if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { 9132 if ((mode < 1) || (mode > IPW_POWER_LIMIT)) {
9125 mode = IPW_POWER_AC; 9133 mode = IPW_POWER_AC;
9126 priv->power_mode = mode; 9134 priv->power_mode = mode;
@@ -9133,11 +9141,11 @@ static int ipw_wx_set_powermode(struct net_device *dev,
9133 9141
9134 if (err) { 9142 if (err) {
9135 IPW_DEBUG_WX("failed setting power mode.\n"); 9143 IPW_DEBUG_WX("failed setting power mode.\n");
9136 up(&priv->sem); 9144 mutex_unlock(&priv->mutex);
9137 return err; 9145 return err;
9138 } 9146 }
9139 } 9147 }
9140 up(&priv->sem); 9148 mutex_unlock(&priv->mutex);
9141 return 0; 9149 return 0;
9142} 9150}
9143 9151
@@ -9186,7 +9194,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
9186 IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); 9194 IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode);
9187 return -EINVAL; 9195 return -EINVAL;
9188 } 9196 }
9189 down(&priv->sem); 9197 mutex_lock(&priv->mutex);
9190 if (priv->adapter == IPW_2915ABG) { 9198 if (priv->adapter == IPW_2915ABG) {
9191 priv->ieee->abg_true = 1; 9199 priv->ieee->abg_true = 1;
9192 if (mode & IEEE_A) { 9200 if (mode & IEEE_A) {
@@ -9198,7 +9206,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
9198 if (mode & IEEE_A) { 9206 if (mode & IEEE_A) {
9199 IPW_WARNING("Attempt to set 2200BG into " 9207 IPW_WARNING("Attempt to set 2200BG into "
9200 "802.11a mode\n"); 9208 "802.11a mode\n");
9201 up(&priv->sem); 9209 mutex_unlock(&priv->mutex);
9202 return -EINVAL; 9210 return -EINVAL;
9203 } 9211 }
9204 9212
@@ -9235,7 +9243,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev,
9235 IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", 9243 IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n",
9236 mode & IEEE_A ? 'a' : '.', 9244 mode & IEEE_A ? 'a' : '.',
9237 mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); 9245 mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.');
9238 up(&priv->sem); 9246 mutex_unlock(&priv->mutex);
9239 return 0; 9247 return 0;
9240} 9248}
9241 9249
@@ -9244,7 +9252,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
9244 union iwreq_data *wrqu, char *extra) 9252 union iwreq_data *wrqu, char *extra)
9245{ 9253{
9246 struct ipw_priv *priv = ieee80211_priv(dev); 9254 struct ipw_priv *priv = ieee80211_priv(dev);
9247 down(&priv->sem); 9255 mutex_lock(&priv->mutex);
9248 switch (priv->ieee->mode) { 9256 switch (priv->ieee->mode) {
9249 case IEEE_A: 9257 case IEEE_A:
9250 strncpy(extra, "802.11a (1)", MAX_WX_STRING); 9258 strncpy(extra, "802.11a (1)", MAX_WX_STRING);
@@ -9275,7 +9283,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev,
9275 IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); 9283 IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra);
9276 9284
9277 wrqu->data.length = strlen(extra) + 1; 9285 wrqu->data.length = strlen(extra) + 1;
9278 up(&priv->sem); 9286 mutex_unlock(&priv->mutex);
9279 9287
9280 return 0; 9288 return 0;
9281} 9289}
@@ -9286,7 +9294,7 @@ static int ipw_wx_set_preamble(struct net_device *dev,
9286{ 9294{
9287 struct ipw_priv *priv = ieee80211_priv(dev); 9295 struct ipw_priv *priv = ieee80211_priv(dev);
9288 int mode = *(int *)extra; 9296 int mode = *(int *)extra;
9289 down(&priv->sem); 9297 mutex_lock(&priv->mutex);
9290 /* Switching from SHORT -> LONG requires a disassociation */ 9298 /* Switching from SHORT -> LONG requires a disassociation */
9291 if (mode == 1) { 9299 if (mode == 1) {
9292 if (!(priv->config & CFG_PREAMBLE_LONG)) { 9300 if (!(priv->config & CFG_PREAMBLE_LONG)) {
@@ -9305,11 +9313,11 @@ static int ipw_wx_set_preamble(struct net_device *dev,
9305 priv->config &= ~CFG_PREAMBLE_LONG; 9313 priv->config &= ~CFG_PREAMBLE_LONG;
9306 goto done; 9314 goto done;
9307 } 9315 }
9308 up(&priv->sem); 9316 mutex_unlock(&priv->mutex);
9309 return -EINVAL; 9317 return -EINVAL;
9310 9318
9311 done: 9319 done:
9312 up(&priv->sem); 9320 mutex_unlock(&priv->mutex);
9313 return 0; 9321 return 0;
9314} 9322}
9315 9323
@@ -9318,12 +9326,12 @@ static int ipw_wx_get_preamble(struct net_device *dev,
9318 union iwreq_data *wrqu, char *extra) 9326 union iwreq_data *wrqu, char *extra)
9319{ 9327{
9320 struct ipw_priv *priv = ieee80211_priv(dev); 9328 struct ipw_priv *priv = ieee80211_priv(dev);
9321 down(&priv->sem); 9329 mutex_lock(&priv->mutex);
9322 if (priv->config & CFG_PREAMBLE_LONG) 9330 if (priv->config & CFG_PREAMBLE_LONG)
9323 snprintf(wrqu->name, IFNAMSIZ, "long (1)"); 9331 snprintf(wrqu->name, IFNAMSIZ, "long (1)");
9324 else 9332 else
9325 snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); 9333 snprintf(wrqu->name, IFNAMSIZ, "auto (0)");
9326 up(&priv->sem); 9334 mutex_unlock(&priv->mutex);
9327 return 0; 9335 return 0;
9328} 9336}
9329 9337
@@ -9335,7 +9343,7 @@ static int ipw_wx_set_monitor(struct net_device *dev,
9335 struct ipw_priv *priv = ieee80211_priv(dev); 9343 struct ipw_priv *priv = ieee80211_priv(dev);
9336 int *parms = (int *)extra; 9344 int *parms = (int *)extra;
9337 int enable = (parms[0] > 0); 9345 int enable = (parms[0] > 0);
9338 down(&priv->sem); 9346 mutex_lock(&priv->mutex);
9339 IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); 9347 IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]);
9340 if (enable) { 9348 if (enable) {
9341 if (priv->ieee->iw_mode != IW_MODE_MONITOR) { 9349 if (priv->ieee->iw_mode != IW_MODE_MONITOR) {
@@ -9350,13 +9358,13 @@ static int ipw_wx_set_monitor(struct net_device *dev,
9350 ipw_set_channel(priv, parms[1]); 9358 ipw_set_channel(priv, parms[1]);
9351 } else { 9359 } else {
9352 if (priv->ieee->iw_mode != IW_MODE_MONITOR) { 9360 if (priv->ieee->iw_mode != IW_MODE_MONITOR) {
9353 up(&priv->sem); 9361 mutex_unlock(&priv->mutex);
9354 return 0; 9362 return 0;
9355 } 9363 }
9356 priv->net_dev->type = ARPHRD_ETHER; 9364 priv->net_dev->type = ARPHRD_ETHER;
9357 queue_work(priv->workqueue, &priv->adapter_restart); 9365 queue_work(priv->workqueue, &priv->adapter_restart);
9358 } 9366 }
9359 up(&priv->sem); 9367 mutex_unlock(&priv->mutex);
9360 return 0; 9368 return 0;
9361} 9369}
9362 9370
@@ -9386,7 +9394,7 @@ static int ipw_wx_sw_reset(struct net_device *dev,
9386 9394
9387 IPW_DEBUG_WX("SW_RESET\n"); 9395 IPW_DEBUG_WX("SW_RESET\n");
9388 9396
9389 down(&priv->sem); 9397 mutex_lock(&priv->mutex);
9390 9398
9391 ret = ipw_sw_reset(priv, 0); 9399 ret = ipw_sw_reset(priv, 0);
9392 if (!ret) { 9400 if (!ret) {
@@ -9398,9 +9406,9 @@ static int ipw_wx_sw_reset(struct net_device *dev,
9398 * module parameter, so take appropriate action */ 9406 * module parameter, so take appropriate action */
9399 ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); 9407 ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW);
9400 9408
9401 up(&priv->sem); 9409 mutex_unlock(&priv->mutex);
9402 ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); 9410 ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL);
9403 down(&priv->sem); 9411 mutex_lock(&priv->mutex);
9404 9412
9405 if (!(priv->status & STATUS_RF_KILL_MASK)) { 9413 if (!(priv->status & STATUS_RF_KILL_MASK)) {
9406 /* Configuration likely changed -- force [re]association */ 9414 /* Configuration likely changed -- force [re]association */
@@ -9410,7 +9418,7 @@ static int ipw_wx_sw_reset(struct net_device *dev,
9410 ipw_associate(priv); 9418 ipw_associate(priv);
9411 } 9419 }
9412 9420
9413 up(&priv->sem); 9421 mutex_unlock(&priv->mutex);
9414 9422
9415 return 0; 9423 return 0;
9416} 9424}
@@ -9586,7 +9594,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev)
9586static void init_sys_config(struct ipw_sys_config *sys_config) 9594static void init_sys_config(struct ipw_sys_config *sys_config)
9587{ 9595{
9588 memset(sys_config, 0, sizeof(struct ipw_sys_config)); 9596 memset(sys_config, 0, sizeof(struct ipw_sys_config));
9589 sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ 9597 sys_config->bt_coexistence = 0;
9590 sys_config->answer_broadcast_ssid_probe = 0; 9598 sys_config->answer_broadcast_ssid_probe = 0;
9591 sys_config->accept_all_data_frames = 0; 9599 sys_config->accept_all_data_frames = 0;
9592 sys_config->accept_non_directed_frames = 1; 9600 sys_config->accept_non_directed_frames = 1;
@@ -9607,11 +9615,11 @@ static int ipw_net_open(struct net_device *dev)
9607 struct ipw_priv *priv = ieee80211_priv(dev); 9615 struct ipw_priv *priv = ieee80211_priv(dev);
9608 IPW_DEBUG_INFO("dev->open\n"); 9616 IPW_DEBUG_INFO("dev->open\n");
9609 /* we should be verifying the device is ready to be opened */ 9617 /* we should be verifying the device is ready to be opened */
9610 down(&priv->sem); 9618 mutex_lock(&priv->mutex);
9611 if (!(priv->status & STATUS_RF_KILL_MASK) && 9619 if (!(priv->status & STATUS_RF_KILL_MASK) &&
9612 (priv->status & STATUS_ASSOCIATED)) 9620 (priv->status & STATUS_ASSOCIATED))
9613 netif_start_queue(dev); 9621 netif_start_queue(dev);
9614 up(&priv->sem); 9622 mutex_unlock(&priv->mutex);
9615 return 0; 9623 return 0;
9616} 9624}
9617 9625
@@ -9890,13 +9898,13 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p)
9890 struct sockaddr *addr = p; 9898 struct sockaddr *addr = p;
9891 if (!is_valid_ether_addr(addr->sa_data)) 9899 if (!is_valid_ether_addr(addr->sa_data))
9892 return -EADDRNOTAVAIL; 9900 return -EADDRNOTAVAIL;
9893 down(&priv->sem); 9901 mutex_lock(&priv->mutex);
9894 priv->config |= CFG_CUSTOM_MAC; 9902 priv->config |= CFG_CUSTOM_MAC;
9895 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); 9903 memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
9896 printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", 9904 printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n",
9897 priv->net_dev->name, MAC_ARG(priv->mac_addr)); 9905 priv->net_dev->name, MAC_ARG(priv->mac_addr));
9898 queue_work(priv->workqueue, &priv->adapter_restart); 9906 queue_work(priv->workqueue, &priv->adapter_restart);
9899 up(&priv->sem); 9907 mutex_unlock(&priv->mutex);
9900 return 0; 9908 return 0;
9901} 9909}
9902 9910
@@ -9940,9 +9948,9 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev,
9940 9948
9941 if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) 9949 if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE)
9942 return -EINVAL; 9950 return -EINVAL;
9943 down(&p->sem); 9951 mutex_lock(&p->mutex);
9944 memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); 9952 memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len);
9945 up(&p->sem); 9953 mutex_unlock(&p->mutex);
9946 return 0; 9954 return 0;
9947} 9955}
9948 9956
@@ -9954,12 +9962,12 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev,
9954 9962
9955 if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) 9963 if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE)
9956 return -EINVAL; 9964 return -EINVAL;
9957 down(&p->sem); 9965 mutex_lock(&p->mutex);
9958 memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); 9966 memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len);
9959 for (i = IPW_EEPROM_DATA; 9967 for (i = IPW_EEPROM_DATA;
9960 i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) 9968 i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++)
9961 ipw_write8(p, i, p->eeprom[i]); 9969 ipw_write8(p, i, p->eeprom[i]);
9962 up(&p->sem); 9970 mutex_unlock(&p->mutex);
9963 return 0; 9971 return 0;
9964} 9972}
9965 9973
@@ -10054,12 +10062,12 @@ static void ipw_rf_kill(void *adapter)
10054static void ipw_bg_rf_kill(void *data) 10062static void ipw_bg_rf_kill(void *data)
10055{ 10063{
10056 struct ipw_priv *priv = data; 10064 struct ipw_priv *priv = data;
10057 down(&priv->sem); 10065 mutex_lock(&priv->mutex);
10058 ipw_rf_kill(data); 10066 ipw_rf_kill(data);
10059 up(&priv->sem); 10067 mutex_unlock(&priv->mutex);
10060} 10068}
10061 10069
10062void ipw_link_up(struct ipw_priv *priv) 10070static void ipw_link_up(struct ipw_priv *priv)
10063{ 10071{
10064 priv->last_seq_num = -1; 10072 priv->last_seq_num = -1;
10065 priv->last_frag_num = -1; 10073 priv->last_frag_num = -1;
@@ -10089,12 +10097,12 @@ void ipw_link_up(struct ipw_priv *priv)
10089static void ipw_bg_link_up(void *data) 10097static void ipw_bg_link_up(void *data)
10090{ 10098{
10091 struct ipw_priv *priv = data; 10099 struct ipw_priv *priv = data;
10092 down(&priv->sem); 10100 mutex_lock(&priv->mutex);
10093 ipw_link_up(data); 10101 ipw_link_up(data);
10094 up(&priv->sem); 10102 mutex_unlock(&priv->mutex);
10095} 10103}
10096 10104
10097void ipw_link_down(struct ipw_priv *priv) 10105static void ipw_link_down(struct ipw_priv *priv)
10098{ 10106{
10099 ipw_led_link_down(priv); 10107 ipw_led_link_down(priv);
10100 netif_carrier_off(priv->net_dev); 10108 netif_carrier_off(priv->net_dev);
@@ -10117,9 +10125,9 @@ void ipw_link_down(struct ipw_priv *priv)
10117static void ipw_bg_link_down(void *data) 10125static void ipw_bg_link_down(void *data)
10118{ 10126{
10119 struct ipw_priv *priv = data; 10127 struct ipw_priv *priv = data;
10120 down(&priv->sem); 10128 mutex_lock(&priv->mutex);
10121 ipw_link_down(data); 10129 ipw_link_down(data);
10122 up(&priv->sem); 10130 mutex_unlock(&priv->mutex);
10123} 10131}
10124 10132
10125static int ipw_setup_deferred_work(struct ipw_priv *priv) 10133static int ipw_setup_deferred_work(struct ipw_priv *priv)
@@ -10292,6 +10300,20 @@ static int ipw_config(struct ipw_priv *priv)
10292 10300
10293 /* set basic system config settings */ 10301 /* set basic system config settings */
10294 init_sys_config(&priv->sys_config); 10302 init_sys_config(&priv->sys_config);
10303
10304 /* Support Bluetooth if we have BT h/w on board, and user wants to.
10305 * Does not support BT priority yet (don't abort or defer our Tx) */
10306 if (bt_coexist) {
10307 unsigned char bt_caps = priv->eeprom[EEPROM_SKU_CAPABILITY];
10308
10309 if (bt_caps & EEPROM_SKU_CAP_BT_CHANNEL_SIG)
10310 priv->sys_config.bt_coexistence
10311 |= CFG_BT_COEXISTENCE_SIGNAL_CHNL;
10312 if (bt_caps & EEPROM_SKU_CAP_BT_OOB)
10313 priv->sys_config.bt_coexistence
10314 |= CFG_BT_COEXISTENCE_OOB;
10315 }
10316
10295 if (priv->ieee->iw_mode == IW_MODE_ADHOC) 10317 if (priv->ieee->iw_mode == IW_MODE_ADHOC)
10296 priv->sys_config.answer_broadcast_ssid_probe = 1; 10318 priv->sys_config.answer_broadcast_ssid_probe = 1;
10297 else 10319 else
@@ -10782,9 +10804,9 @@ static int ipw_up(struct ipw_priv *priv)
10782static void ipw_bg_up(void *data) 10804static void ipw_bg_up(void *data)
10783{ 10805{
10784 struct ipw_priv *priv = data; 10806 struct ipw_priv *priv = data;
10785 down(&priv->sem); 10807 mutex_lock(&priv->mutex);
10786 ipw_up(data); 10808 ipw_up(data);
10787 up(&priv->sem); 10809 mutex_unlock(&priv->mutex);
10788} 10810}
10789 10811
10790static void ipw_deinit(struct ipw_priv *priv) 10812static void ipw_deinit(struct ipw_priv *priv)
@@ -10853,23 +10875,23 @@ static void ipw_down(struct ipw_priv *priv)
10853static void ipw_bg_down(void *data) 10875static void ipw_bg_down(void *data)
10854{ 10876{
10855 struct ipw_priv *priv = data; 10877 struct ipw_priv *priv = data;
10856 down(&priv->sem); 10878 mutex_lock(&priv->mutex);
10857 ipw_down(data); 10879 ipw_down(data);
10858 up(&priv->sem); 10880 mutex_unlock(&priv->mutex);
10859} 10881}
10860 10882
10861/* Called by register_netdev() */ 10883/* Called by register_netdev() */
10862static int ipw_net_init(struct net_device *dev) 10884static int ipw_net_init(struct net_device *dev)
10863{ 10885{
10864 struct ipw_priv *priv = ieee80211_priv(dev); 10886 struct ipw_priv *priv = ieee80211_priv(dev);
10865 down(&priv->sem); 10887 mutex_lock(&priv->mutex);
10866 10888
10867 if (ipw_up(priv)) { 10889 if (ipw_up(priv)) {
10868 up(&priv->sem); 10890 mutex_unlock(&priv->mutex);
10869 return -EIO; 10891 return -EIO;
10870 } 10892 }
10871 10893
10872 up(&priv->sem); 10894 mutex_unlock(&priv->mutex);
10873 return 0; 10895 return 0;
10874} 10896}
10875 10897
@@ -10959,7 +10981,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
10959 for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) 10981 for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++)
10960 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); 10982 INIT_LIST_HEAD(&priv->ibss_mac_hash[i]);
10961 10983
10962 init_MUTEX(&priv->sem); 10984 mutex_init(&priv->mutex);
10963 if (pci_enable_device(pdev)) { 10985 if (pci_enable_device(pdev)) {
10964 err = -ENODEV; 10986 err = -ENODEV;
10965 goto out_free_ieee80211; 10987 goto out_free_ieee80211;
@@ -11017,7 +11039,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11017 SET_MODULE_OWNER(net_dev); 11039 SET_MODULE_OWNER(net_dev);
11018 SET_NETDEV_DEV(net_dev, &pdev->dev); 11040 SET_NETDEV_DEV(net_dev, &pdev->dev);
11019 11041
11020 down(&priv->sem); 11042 mutex_lock(&priv->mutex);
11021 11043
11022 priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; 11044 priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit;
11023 priv->ieee->set_security = shim__set_security; 11045 priv->ieee->set_security = shim__set_security;
@@ -11050,11 +11072,11 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11050 err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); 11072 err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group);
11051 if (err) { 11073 if (err) {
11052 IPW_ERROR("failed to create sysfs device attributes\n"); 11074 IPW_ERROR("failed to create sysfs device attributes\n");
11053 up(&priv->sem); 11075 mutex_unlock(&priv->mutex);
11054 goto out_release_irq; 11076 goto out_release_irq;
11055 } 11077 }
11056 11078
11057 up(&priv->sem); 11079 mutex_unlock(&priv->mutex);
11058 err = register_netdev(net_dev); 11080 err = register_netdev(net_dev);
11059 if (err) { 11081 if (err) {
11060 IPW_ERROR("failed to register network device\n"); 11082 IPW_ERROR("failed to register network device\n");
@@ -11091,13 +11113,13 @@ static void ipw_pci_remove(struct pci_dev *pdev)
11091 if (!priv) 11113 if (!priv)
11092 return; 11114 return;
11093 11115
11094 down(&priv->sem); 11116 mutex_lock(&priv->mutex);
11095 11117
11096 priv->status |= STATUS_EXIT_PENDING; 11118 priv->status |= STATUS_EXIT_PENDING;
11097 ipw_down(priv); 11119 ipw_down(priv);
11098 sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); 11120 sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group);
11099 11121
11100 up(&priv->sem); 11122 mutex_unlock(&priv->mutex);
11101 11123
11102 unregister_netdev(priv->net_dev); 11124 unregister_netdev(priv->net_dev);
11103 11125
@@ -11281,12 +11303,18 @@ module_param(mode, int, 0444);
11281MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); 11303MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)");
11282#endif 11304#endif
11283 11305
11306module_param(bt_coexist, int, 0444);
11307MODULE_PARM_DESC(bt_coexist, "enable bluetooth coexistence (default off)");
11308
11284module_param(hwcrypto, int, 0444); 11309module_param(hwcrypto, int, 0444);
11285MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); 11310MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default off)");
11286 11311
11287module_param(cmdlog, int, 0444); 11312module_param(cmdlog, int, 0444);
11288MODULE_PARM_DESC(cmdlog, 11313MODULE_PARM_DESC(cmdlog,
11289 "allocate a ring buffer for logging firmware commands"); 11314 "allocate a ring buffer for logging firmware commands");
11290 11315
11316module_param(roaming, int, 0444);
11317MODULE_PARM_DESC(roaming, "enable roaming support (default on)");
11318
11291module_exit(ipw_exit); 11319module_exit(ipw_exit);
11292module_init(ipw_init); 11320module_init(ipw_init);
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index e65620a4d79e..5405ba105abf 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -33,6 +33,7 @@
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <linux/config.h> 34#include <linux/config.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/mutex.h>
36 37
37#include <linux/pci.h> 38#include <linux/pci.h>
38#include <linux/netdevice.h> 39#include <linux/netdevice.h>
@@ -46,6 +47,7 @@
46#include <linux/firmware.h> 47#include <linux/firmware.h>
47#include <linux/wireless.h> 48#include <linux/wireless.h>
48#include <linux/dma-mapping.h> 49#include <linux/dma-mapping.h>
50#include <linux/jiffies.h>
49#include <asm/io.h> 51#include <asm/io.h>
50 52
51#include <net/ieee80211.h> 53#include <net/ieee80211.h>
@@ -852,7 +854,7 @@ struct ipw_scan_request_ext {
852 u16 dwell_time[IPW_SCAN_TYPES]; 854 u16 dwell_time[IPW_SCAN_TYPES];
853} __attribute__ ((packed)); 855} __attribute__ ((packed));
854 856
855extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) 857static inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index)
856{ 858{
857 if (index % 2) 859 if (index % 2)
858 return scan->scan_type[index / 2] & 0x0F; 860 return scan->scan_type[index / 2] & 0x0F;
@@ -860,7 +862,7 @@ extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index)
860 return (scan->scan_type[index / 2] & 0xF0) >> 4; 862 return (scan->scan_type[index / 2] & 0xF0) >> 4;
861} 863}
862 864
863extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, 865static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan,
864 u8 index, u8 scan_type) 866 u8 index, u8 scan_type)
865{ 867{
866 if (index % 2) 868 if (index % 2)
@@ -1120,7 +1122,7 @@ struct ipw_priv {
1120 struct ieee80211_device *ieee; 1122 struct ieee80211_device *ieee;
1121 1123
1122 spinlock_t lock; 1124 spinlock_t lock;
1123 struct semaphore sem; 1125 struct mutex mutex;
1124 1126
1125 /* basic pci-network driver stuff */ 1127 /* basic pci-network driver stuff */
1126 struct pci_dev *pci_dev; 1128 struct pci_dev *pci_dev;
@@ -1406,13 +1408,6 @@ do { if (ipw_debug_level & (level)) \
1406* Register bit definitions 1408* Register bit definitions
1407*/ 1409*/
1408 1410
1409/* Dino control registers bits */
1410
1411#define DINO_ENABLE_SYSTEM 0x80
1412#define DINO_ENABLE_CS 0x40
1413#define DINO_RXFIFO_DATA 0x01
1414#define DINO_CONTROL_REG 0x00200000
1415
1416#define IPW_INTA_RW 0x00000008 1411#define IPW_INTA_RW 0x00000008
1417#define IPW_INTA_MASK_R 0x0000000C 1412#define IPW_INTA_MASK_R 0x0000000C
1418#define IPW_INDIRECT_ADDR 0x00000010 1413#define IPW_INDIRECT_ADDR 0x00000010
@@ -1459,6 +1454,11 @@ do { if (ipw_debug_level & (level)) \
1459#define IPW_DOMAIN_0_END 0x1000 1454#define IPW_DOMAIN_0_END 0x1000
1460#define CLX_MEM_BAR_SIZE 0x1000 1455#define CLX_MEM_BAR_SIZE 0x1000
1461 1456
1457/* Dino/baseband control registers bits */
1458
1459#define DINO_ENABLE_SYSTEM 0x80 /* 1 = baseband processor on, 0 = reset */
1460#define DINO_ENABLE_CS 0x40 /* 1 = enable ucode load */
1461#define DINO_RXFIFO_DATA 0x01 /* 1 = data available */
1462#define IPW_BASEBAND_CONTROL_STATUS 0X00200000 1462#define IPW_BASEBAND_CONTROL_STATUS 0X00200000
1463#define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 1463#define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004
1464#define IPW_BASEBAND_RX_FIFO_READ 0X00200004 1464#define IPW_BASEBAND_RX_FIFO_READ 0X00200004
@@ -1567,13 +1567,18 @@ do { if (ipw_debug_level & (level)) \
1567#define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ 1567#define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */
1568#define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ 1568#define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */
1569 1569
1570/* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ 1570/* NIC type as found in the one byte EEPROM_NIC_TYPE offset */
1571#define EEPROM_NIC_TYPE_0 0 1571#define EEPROM_NIC_TYPE_0 0
1572#define EEPROM_NIC_TYPE_1 1 1572#define EEPROM_NIC_TYPE_1 1
1573#define EEPROM_NIC_TYPE_2 2 1573#define EEPROM_NIC_TYPE_2 2
1574#define EEPROM_NIC_TYPE_3 3 1574#define EEPROM_NIC_TYPE_3 3
1575#define EEPROM_NIC_TYPE_4 4 1575#define EEPROM_NIC_TYPE_4 4
1576 1576
1577/* Bluetooth Coexistence capabilities as found in EEPROM_SKU_CAPABILITY */
1578#define EEPROM_SKU_CAP_BT_CHANNEL_SIG 0x01 /* we can tell BT our channel # */
1579#define EEPROM_SKU_CAP_BT_PRIORITY 0x02 /* BT can take priority over us */
1580#define EEPROM_SKU_CAP_BT_OOB 0x04 /* we can signal BT out-of-band */
1581
1577#define FW_MEM_REG_LOWER_BOUND 0x00300000 1582#define FW_MEM_REG_LOWER_BOUND 0x00300000
1578#define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) 1583#define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40)
1579#define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) 1584#define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04)
@@ -1658,9 +1663,10 @@ enum {
1658 IPW_FW_ERROR_FATAL_ERROR 1663 IPW_FW_ERROR_FATAL_ERROR
1659}; 1664};
1660 1665
1661#define AUTH_OPEN 0 1666#define AUTH_OPEN 0
1662#define AUTH_SHARED_KEY 1 1667#define AUTH_SHARED_KEY 1
1663#define AUTH_IGNORE 3 1668#define AUTH_LEAP 2
1669#define AUTH_IGNORE 3
1664 1670
1665#define HC_ASSOCIATE 0 1671#define HC_ASSOCIATE 0
1666#define HC_REASSOCIATE 1 1672#define HC_REASSOCIATE 1
@@ -1860,7 +1866,7 @@ struct host_cmd {
1860 u8 cmd; 1866 u8 cmd;
1861 u8 len; 1867 u8 len;
1862 u16 reserved; 1868 u16 reserved;
1863 u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; 1869 u32 *param;
1864} __attribute__ ((packed)); 1870} __attribute__ ((packed));
1865 1871
1866struct ipw_cmd_log { 1872struct ipw_cmd_log {
@@ -1869,21 +1875,23 @@ struct ipw_cmd_log {
1869 struct host_cmd cmd; 1875 struct host_cmd cmd;
1870}; 1876};
1871 1877
1872#define CFG_BT_COEXISTENCE_MIN 0x00 1878/* SysConfig command parameters ... */
1873#define CFG_BT_COEXISTENCE_DEFER 0x02 1879/* bt_coexistence param */
1874#define CFG_BT_COEXISTENCE_KILL 0x04 1880#define CFG_BT_COEXISTENCE_SIGNAL_CHNL 0x01 /* tell BT our chnl # */
1875#define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 1881#define CFG_BT_COEXISTENCE_DEFER 0x02 /* defer our Tx if BT traffic */
1876#define CFG_BT_COEXISTENCE_OOB 0x10 1882#define CFG_BT_COEXISTENCE_KILL 0x04 /* kill our Tx if BT traffic */
1877#define CFG_BT_COEXISTENCE_MAX 0xFF 1883#define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 /* multimedia extensions */
1878#define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM */ 1884#define CFG_BT_COEXISTENCE_OOB 0x10 /* signal BT via out-of-band */
1879 1885
1880#define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 1886/* clear-to-send to self param */
1881#define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 1887#define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x00
1888#define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x01
1882#define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN 1889#define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN
1883 1890
1884#define CFG_SYS_ANTENNA_BOTH 0x000 1891/* Antenna diversity param (h/w can select best antenna, based on signal) */
1885#define CFG_SYS_ANTENNA_A 0x001 1892#define CFG_SYS_ANTENNA_BOTH 0x00 /* NIC selects best antenna */
1886#define CFG_SYS_ANTENNA_B 0x003 1893#define CFG_SYS_ANTENNA_A 0x01 /* force antenna A */
1894#define CFG_SYS_ANTENNA_B 0x03 /* force antenna B */
1887 1895
1888/* 1896/*
1889 * The definitions below were lifted off the ipw2100 driver, which only 1897 * The definitions below were lifted off the ipw2100 driver, which only
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index bf6271ee387a..75ce6ddb0cf5 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -55,10 +55,8 @@
55#include <linux/etherdevice.h> 55#include <linux/etherdevice.h>
56#include <linux/skbuff.h> 56#include <linux/skbuff.h>
57#include <linux/bitops.h> 57#include <linux/bitops.h>
58#ifdef CONFIG_NET_RADIO
59#include <linux/wireless.h> 58#include <linux/wireless.h>
60#include <net/iw_handler.h> 59#include <net/iw_handler.h>
61#endif
62 60
63#include <pcmcia/cs_types.h> 61#include <pcmcia/cs_types.h>
64#include <pcmcia/cs.h> 62#include <pcmcia/cs.h>
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 18baacfc5a2c..18a44580b53b 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -112,7 +112,7 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE";
112#include <linux/ip.h> 112#include <linux/ip.h>
113#include <linux/tcp.h> 113#include <linux/tcp.h>
114#include <linux/time.h> 114#include <linux/time.h>
115 115#include <linux/jiffies.h>
116 116
117/************************************************************************/ 117/************************************************************************/
118/* Useful structures and definitions */ 118/* Useful structures and definitions */
@@ -1569,7 +1569,7 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
1569 del_timer(&strip_info->idle_timer); 1569 del_timer(&strip_info->idle_timer);
1570 1570
1571 1571
1572 if (jiffies - strip_info->pps_timer > HZ) { 1572 if (time_after(jiffies, strip_info->pps_timer + HZ)) {
1573 unsigned long t = jiffies - strip_info->pps_timer; 1573 unsigned long t = jiffies - strip_info->pps_timer;
1574 unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t; 1574 unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t;
1575 unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t; 1575 unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t;
diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h
index 166e28b9a4f7..5cb0bc8bb128 100644
--- a/drivers/net/wireless/wavelan.p.h
+++ b/drivers/net/wireless/wavelan.p.h
@@ -98,11 +98,7 @@
98 * characteristics of the hardware. Applications such as mobile IP may 98 * characteristics of the hardware. Applications such as mobile IP may
99 * take advantage of it. 99 * take advantage of it.
100 * 100 *
101 * You will need to enable the CONFIG_NET_RADIO define in the kernel 101 * It might be a good idea as well to fetch the wireless tools to
102 * configuration to enable the wireless extensions (this is the one
103 * giving access to the radio network device choice).
104 *
105 * It might also be a good idea as well to fetch the wireless tools to
106 * configure the device and play a bit. 102 * configure the device and play a bit.
107 */ 103 */
108 104
diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h
index f2d597568151..451f6271dcbc 100644
--- a/drivers/net/wireless/wavelan_cs.p.h
+++ b/drivers/net/wireless/wavelan_cs.p.h
@@ -99,11 +99,7 @@
99 * caracteristics of the hardware in a standard way and support for 99 * caracteristics of the hardware in a standard way and support for
100 * applications for taking advantage of it (like Mobile IP). 100 * applications for taking advantage of it (like Mobile IP).
101 * 101 *
102 * You will need to enable the CONFIG_NET_RADIO define in the kernel 102 * It might be a good idea as well to fetch the wireless tools to
103 * configuration to enable the wireless extensions (this is the one
104 * giving access to the radio network device choice).
105 *
106 * It might also be a good idea as well to fetch the wireless tools to
107 * configure the device and play a bit. 103 * configure the device and play a bit.
108 */ 104 */
109 105
@@ -440,11 +436,8 @@
440#include <linux/ioport.h> 436#include <linux/ioport.h>
441#include <linux/fcntl.h> 437#include <linux/fcntl.h>
442#include <linux/ethtool.h> 438#include <linux/ethtool.h>
443
444#ifdef CONFIG_NET_RADIO
445#include <linux/wireless.h> /* Wireless extensions */ 439#include <linux/wireless.h> /* Wireless extensions */
446#include <net/iw_handler.h> /* New driver API */ 440#include <net/iw_handler.h> /* New driver API */
447#endif
448 441
449/* Pcmcia headers that we need */ 442/* Pcmcia headers that we need */
450#include <pcmcia/cs_types.h> 443#include <pcmcia/cs_types.h>