diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-20 13:30:31 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-20 13:30:31 -0500 |
| commit | c7cace6437b2f8bbab5ef05b465738283a9a100a (patch) | |
| tree | 304a7dca0354eaa8ac21aa05cd287e317fa21b8c /drivers/net/wireless | |
| parent | a90779bfc83b7489270a8ce2c3fc9df20dac2b24 (diff) | |
| parent | 2e9ff56efbc005ab2b92b68df65940c7459446c6 (diff) | |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (150 commits)
[PATCH] ipw2100: Update version ipw2100 stamp to 1.2.2
[PATCH] ipw2100: move mutex.h include from ipw2100.c to ipw2100.h
[PATCH] ipw2100: semaphore to mutexes conversion
[PATCH] ipw2100: Fix radiotap code gcc warning
[PATCH] ipw2100: add radiotap headers to packtes captured in monitor mode
[PATCH] ipw2x00: expend Copyright to 2006
[PATCH] drivers/net/wireless/ipw2200.c: fix an array overun
[PATCH] ieee80211: Don't update network statistics from off-channel packets.
[PATCH] ipw2200: Update ipw2200 version stamp to 1.1.1
[PATCH] ipw2200: switch to the new ipw2200-fw-3.0 image format
[PATCH] ipw2200: wireless extension sensitivity threshold support
[PATCH] ipw2200: Enables the "slow diversity" algorithm
[PATCH] ipw2200: Set a meaningful silence threshold value
[PATCH] ipw2200: export `debug' module param only if CONFIG_IPW2200_DEBUG
[PATCH] ipw2200: Change debug level for firmware error logging
[PATCH] ipw2200: Filter unsupported channels out in ad-hoc mode
[PATCH] ipw2200: Fix ipw_sw_reset() implementation inconsistent with comment
[PATCH] ipw2200: Fix rf_kill is activated after mode change with 'disable=1'
[PATCH] ipw2200: remove the WPA card associates to non-WPA AP checking
[PATCH] ipw2200: Add signal level to iwlist scan output
...
Diffstat (limited to 'drivers/net/wireless')
| -rw-r--r-- | drivers/net/wireless/Kconfig | 32 | ||||
| -rw-r--r-- | drivers/net/wireless/airo.c | 338 | ||||
| -rw-r--r-- | drivers/net/wireless/atmel.c | 110 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2100.c | 266 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2100.h | 17 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2200.c | 1239 | ||||
| -rw-r--r-- | drivers/net/wireless/ipw2200.h | 103 | ||||
| -rw-r--r-- | drivers/net/wireless/netwave_cs.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/strip.c | 4 | ||||
| -rw-r--r-- | drivers/net/wireless/wavelan.p.h | 6 | ||||
| -rw-r--r-- | drivers/net/wireless/wavelan_cs.p.h | 9 |
11 files changed, 1184 insertions, 942 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index ef85d76575a2..5b0a19a5058d 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 | ||
| 8 | config NET_RADIO | 8 | config 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. |
| @@ -135,8 +136,9 @@ comment "Wireless 802.11b ISA/PCI cards support" | |||
| 135 | 136 | ||
| 136 | config IPW2100 | 137 | config IPW2100 |
| 137 | tristate "Intel PRO/Wireless 2100 Network Connection" | 138 | tristate "Intel PRO/Wireless 2100 Network Connection" |
| 138 | depends on NET_RADIO && PCI && IEEE80211 | 139 | depends on NET_RADIO && PCI |
| 139 | select FW_LOADER | 140 | select FW_LOADER |
| 141 | select IEEE80211 | ||
| 140 | ---help--- | 142 | ---help--- |
| 141 | A driver for the Intel PRO/Wireless 2100 Network | 143 | A driver for the Intel PRO/Wireless 2100 Network |
| 142 | Connection 802.11b wireless network adapter. | 144 | Connection 802.11b wireless network adapter. |
| @@ -188,8 +190,9 @@ config IPW2100_DEBUG | |||
| 188 | 190 | ||
| 189 | config IPW2200 | 191 | config IPW2200 |
| 190 | tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" | 192 | tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" |
| 191 | depends on NET_RADIO && IEEE80211 && PCI | 193 | depends on NET_RADIO && PCI |
| 192 | select FW_LOADER | 194 | select FW_LOADER |
| 195 | select IEEE80211 | ||
| 193 | ---help--- | 196 | ---help--- |
| 194 | A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network | 197 | A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network |
| 195 | Connection adapters. | 198 | Connection adapters. |
| @@ -201,7 +204,7 @@ config IPW2200 | |||
| 201 | In order to use this driver, you will need a firmware image for it. | 204 | In order to use this driver, you will need a firmware image for it. |
| 202 | You can obtain the firmware from | 205 | You can obtain the firmware from |
| 203 | <http://ipw2200.sf.net/>. See the above referenced README.ipw2200 | 206 | <http://ipw2200.sf.net/>. See the above referenced README.ipw2200 |
| 204 | for information on where to install the firmare images. | 207 | for information on where to install the firmware images. |
| 205 | 208 | ||
| 206 | You will also very likely need the Wireless Tools in order to | 209 | You will also very likely need the Wireless Tools in order to |
| 207 | configure your card: | 210 | configure your card: |
| @@ -213,6 +216,19 @@ config IPW2200 | |||
| 213 | say M here and read <file:Documentation/modules.txt>. The module | 216 | say M here and read <file:Documentation/modules.txt>. The module |
| 214 | will be called ipw2200.ko. | 217 | will be called ipw2200.ko. |
| 215 | 218 | ||
| 219 | config IPW2200_MONITOR | ||
| 220 | bool "Enable promiscuous mode" | ||
| 221 | depends on IPW2200 | ||
| 222 | ---help--- | ||
| 223 | Enables promiscuous/monitor mode support for the ipw2200 driver. | ||
| 224 | With this feature compiled into the driver, you can switch to | ||
| 225 | promiscuous mode via the Wireless Tool's Monitor mode. While in this | ||
| 226 | mode, no packets can be sent. | ||
| 227 | |||
| 228 | config IPW_QOS | ||
| 229 | bool "Enable QoS support" | ||
| 230 | depends on IPW2200 && EXPERIMENTAL | ||
| 231 | |||
| 216 | config IPW2200_DEBUG | 232 | config IPW2200_DEBUG |
| 217 | bool "Enable full debugging output in IPW2200 module." | 233 | bool "Enable full debugging output in IPW2200 module." |
| 218 | depends on IPW2200 | 234 | depends on IPW2200 |
| @@ -239,13 +255,14 @@ config IPW2200_DEBUG | |||
| 239 | 255 | ||
| 240 | config AIRO | 256 | config AIRO |
| 241 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" | 257 | tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" |
| 242 | depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN) | 258 | depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN) |
| 259 | select CRYPTO | ||
| 243 | ---help--- | 260 | ---help--- |
| 244 | This is the standard Linux driver to support Cisco/Aironet ISA and | 261 | This is the standard Linux driver to support Cisco/Aironet ISA and |
| 245 | PCI 802.11 wireless cards. | 262 | PCI 802.11 wireless cards. |
| 246 | It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X | 263 | It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X |
| 247 | - with or without encryption) as well as card before the Cisco | 264 | - with or without encryption) as well as card before the Cisco |
| 248 | aquisition (Aironet 4500, Aironet 4800, Aironet 4800B). | 265 | acquisition (Aironet 4500, Aironet 4800, Aironet 4800B). |
| 249 | 266 | ||
| 250 | This driver support both the standard Linux Wireless Extensions | 267 | This driver support both the standard Linux Wireless Extensions |
| 251 | and Cisco proprietary API, so both the Linux Wireless Tools and the | 268 | and Cisco proprietary API, so both the Linux Wireless Tools and the |
| @@ -387,13 +404,14 @@ config PCMCIA_SPECTRUM | |||
| 387 | config AIRO_CS | 404 | config AIRO_CS |
| 388 | tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" | 405 | tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" |
| 389 | depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) | 406 | depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) |
| 407 | select CRYPTO | ||
| 390 | ---help--- | 408 | ---help--- |
| 391 | This is the standard Linux driver to support Cisco/Aironet PCMCIA | 409 | This is the standard Linux driver to support Cisco/Aironet PCMCIA |
| 392 | 802.11 wireless cards. This driver is the same as the Aironet | 410 | 802.11 wireless cards. This driver is the same as the Aironet |
| 393 | driver part of the Linux Pcmcia package. | 411 | driver part of the Linux Pcmcia package. |
| 394 | It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X | 412 | It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X |
| 395 | - with or without encryption) as well as card before the Cisco | 413 | - with or without encryption) as well as card before the Cisco |
| 396 | aquisition (Aironet 4500, Aironet 4800, Aironet 4800B). It also | 414 | acquisition (Aironet 4500, Aironet 4800, Aironet 4800B). It also |
| 397 | supports OEM of Cisco such as the DELL TrueMobile 4800 and Xircom | 415 | supports OEM of Cisco such as the DELL TrueMobile 4800 and Xircom |
| 398 | 802.11b cards. | 416 | 802.11b cards. |
| 399 | 417 | ||
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index a4c7ae94614d..864937a409e5 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); | |||
| 1118 | static int writerids(struct net_device *dev, aironet_ioctl *comp); | 1111 | static int writerids(struct net_device *dev, aironet_ioctl *comp); |
| 1119 | static int flashcard(struct net_device *dev, aironet_ioctl *comp); | 1112 | static int flashcard(struct net_device *dev, aironet_ioctl *comp); |
| 1120 | #endif /* CISCO_EXT */ | 1113 | #endif /* CISCO_EXT */ |
| 1121 | #ifdef MICSUPPORT | ||
| 1122 | static void micinit(struct airo_info *ai); | 1114 | static void micinit(struct airo_info *ai); |
| 1123 | static int micsetup(struct airo_info *ai); | 1115 | static int micsetup(struct airo_info *ai); |
| 1124 | static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len); | 1116 | static 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, | |||
| 1127 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); | 1119 | static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); |
| 1128 | static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); | 1120 | static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); |
| 1129 | 1121 | ||
| 1130 | #include <linux/crypto.h> | ||
| 1131 | #endif | ||
| 1132 | |||
| 1133 | struct airo_info { | 1122 | struct 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); | |||
| 1229 | static int flashputbuf(struct airo_info *ai); | 1216 | static int flashputbuf(struct airo_info *ai); |
| 1230 | static int flashrestart(struct airo_info *ai,struct net_device *dev); | 1217 | static 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 | ||
| 1691 | static int readBSSListRid(struct airo_info *ai, int first, | 1676 | static 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)) { |
| 3218 | badmic: | 3187 | badmic: |
| 3219 | dev_kfree_skb_irq (skb); | 3188 | dev_kfree_skb_irq (skb); |
| 3220 | #else | ||
| 3221 | if (0) { | ||
| 3222 | #endif | ||
| 3223 | badrx: | 3189 | badrx: |
| 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; |
| @@ -5081,7 +5036,6 @@ static int set_wep_key(struct airo_info *ai, u16 index, | |||
| 5081 | wkr.len = sizeof(wkr); | 5036 | wkr.len = sizeof(wkr); |
| 5082 | wkr.kindex = 0xffff; | 5037 | wkr.kindex = 0xffff; |
| 5083 | wkr.mac[0] = (char)index; | 5038 | wkr.mac[0] = (char)index; |
| 5084 | if (perm) printk(KERN_INFO "Setting transmit key to %d\n", index); | ||
| 5085 | if (perm) ai->defindex = (char)index; | 5039 | if (perm) ai->defindex = (char)index; |
| 5086 | } else { | 5040 | } else { |
| 5087 | // We are actually setting the key | 5041 | // We are actually setting the key |
| @@ -5090,7 +5044,6 @@ static int set_wep_key(struct airo_info *ai, u16 index, | |||
| 5090 | wkr.klen = keylen; | 5044 | wkr.klen = keylen; |
| 5091 | memcpy( wkr.key, key, keylen ); | 5045 | memcpy( wkr.key, key, keylen ); |
| 5092 | memcpy( wkr.mac, macaddr, ETH_ALEN ); | 5046 | memcpy( wkr.mac, macaddr, ETH_ALEN ); |
| 5093 | printk(KERN_INFO "Setting key %d\n", index); | ||
| 5094 | } | 5047 | } |
| 5095 | 5048 | ||
| 5096 | if (perm) disable_MAC(ai, lock); | 5049 | if (perm) disable_MAC(ai, lock); |
| @@ -5801,11 +5754,13 @@ static int airo_set_wap(struct net_device *dev, | |||
| 5801 | Cmd cmd; | 5754 | Cmd cmd; |
| 5802 | Resp rsp; | 5755 | Resp rsp; |
| 5803 | APListRid APList_rid; | 5756 | APListRid APList_rid; |
| 5804 | static const unsigned char bcast[ETH_ALEN] = { 255, 255, 255, 255, 255, 255 }; | 5757 | static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 5758 | static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
| 5805 | 5759 | ||
| 5806 | if (awrq->sa_family != ARPHRD_ETHER) | 5760 | if (awrq->sa_family != ARPHRD_ETHER) |
| 5807 | return -EINVAL; | 5761 | return -EINVAL; |
| 5808 | else if (!memcmp(bcast, awrq->sa_data, ETH_ALEN)) { | 5762 | else if (!memcmp(any, awrq->sa_data, ETH_ALEN) || |
| 5763 | !memcmp(off, awrq->sa_data, ETH_ALEN)) { | ||
| 5809 | memset(&cmd, 0, sizeof(cmd)); | 5764 | memset(&cmd, 0, sizeof(cmd)); |
| 5810 | cmd.cmd=CMD_LOSE_SYNC; | 5765 | cmd.cmd=CMD_LOSE_SYNC; |
| 5811 | if (down_interruptible(&local->sem)) | 5766 | if (down_interruptible(&local->sem)) |
| @@ -6296,6 +6251,272 @@ static int airo_get_encode(struct net_device *dev, | |||
| 6296 | 6251 | ||
| 6297 | /*------------------------------------------------------------------*/ | 6252 | /*------------------------------------------------------------------*/ |
| 6298 | /* | 6253 | /* |
| 6254 | * Wireless Handler : set extended Encryption parameters | ||
| 6255 | */ | ||
| 6256 | static int airo_set_encodeext(struct net_device *dev, | ||
| 6257 | struct iw_request_info *info, | ||
| 6258 | union iwreq_data *wrqu, | ||
| 6259 | char *extra) | ||
| 6260 | { | ||
| 6261 | struct airo_info *local = dev->priv; | ||
| 6262 | struct iw_point *encoding = &wrqu->encoding; | ||
| 6263 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
| 6264 | CapabilityRid cap_rid; /* Card capability info */ | ||
| 6265 | int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 ); | ||
| 6266 | u16 currentAuthType = local->config.authType; | ||
| 6267 | int idx, key_len, alg = ext->alg, set_key = 1; | ||
| 6268 | wep_key_t key; | ||
| 6269 | |||
| 6270 | /* Is WEP supported ? */ | ||
| 6271 | readCapabilityRid(local, &cap_rid, 1); | ||
| 6272 | /* Older firmware doesn't support this... | ||
| 6273 | if(!(cap_rid.softCap & 2)) { | ||
| 6274 | return -EOPNOTSUPP; | ||
| 6275 | } */ | ||
| 6276 | readConfigRid(local, 1); | ||
| 6277 | |||
| 6278 | /* Determine and validate the key index */ | ||
| 6279 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
| 6280 | if (idx) { | ||
| 6281 | if (idx < 1 || idx > ((cap_rid.softCap & 0x80) ? 4:1)) | ||
| 6282 | return -EINVAL; | ||
| 6283 | idx--; | ||
| 6284 | } else | ||
| 6285 | idx = get_wep_key(local, 0xffff); | ||
| 6286 | |||
| 6287 | if (encoding->flags & IW_ENCODE_DISABLED) | ||
| 6288 | alg = IW_ENCODE_ALG_NONE; | ||
| 6289 | |||
| 6290 | if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { | ||
| 6291 | /* Only set transmit key index here, actual | ||
| 6292 | * key is set below if needed. | ||
| 6293 | */ | ||
| 6294 | set_wep_key(local, idx, NULL, 0, perm, 1); | ||
| 6295 | set_key = ext->key_len > 0 ? 1 : 0; | ||
| 6296 | } | ||
| 6297 | |||
| 6298 | if (set_key) { | ||
| 6299 | /* Set the requested key first */ | ||
| 6300 | memset(key.key, 0, MAX_KEY_SIZE); | ||
| 6301 | switch (alg) { | ||
| 6302 | case IW_ENCODE_ALG_NONE: | ||
| 6303 | key.len = 0; | ||
| 6304 | break; | ||
| 6305 | case IW_ENCODE_ALG_WEP: | ||
| 6306 | if (ext->key_len > MIN_KEY_SIZE) { | ||
| 6307 | key.len = MAX_KEY_SIZE; | ||
| 6308 | } else if (ext->key_len > 0) { | ||
| 6309 | key.len = MIN_KEY_SIZE; | ||
| 6310 | } else { | ||
| 6311 | return -EINVAL; | ||
| 6312 | } | ||
| 6313 | key_len = min (ext->key_len, key.len); | ||
| 6314 | memcpy(key.key, ext->key, key_len); | ||
| 6315 | break; | ||
| 6316 | default: | ||
| 6317 | return -EINVAL; | ||
| 6318 | } | ||
| 6319 | /* Send the key to the card */ | ||
| 6320 | set_wep_key(local, idx, key.key, key.len, perm, 1); | ||
| 6321 | } | ||
| 6322 | |||
| 6323 | /* Read the flags */ | ||
| 6324 | if(encoding->flags & IW_ENCODE_DISABLED) | ||
| 6325 | local->config.authType = AUTH_OPEN; // disable encryption | ||
| 6326 | if(encoding->flags & IW_ENCODE_RESTRICTED) | ||
| 6327 | local->config.authType = AUTH_SHAREDKEY; // Only Both | ||
| 6328 | if(encoding->flags & IW_ENCODE_OPEN) | ||
| 6329 | local->config.authType = AUTH_ENCRYPT; // Only Wep | ||
| 6330 | /* Commit the changes to flags if needed */ | ||
| 6331 | if (local->config.authType != currentAuthType) | ||
| 6332 | set_bit (FLAG_COMMIT, &local->flags); | ||
| 6333 | |||
| 6334 | return -EINPROGRESS; | ||
| 6335 | } | ||
| 6336 | |||
| 6337 | |||
| 6338 | /*------------------------------------------------------------------*/ | ||
| 6339 | /* | ||
| 6340 | * Wireless Handler : get extended Encryption parameters | ||
| 6341 | */ | ||
| 6342 | static int airo_get_encodeext(struct net_device *dev, | ||
| 6343 | struct iw_request_info *info, | ||
| 6344 | union iwreq_data *wrqu, | ||
| 6345 | char *extra) | ||
| 6346 | { | ||
| 6347 | struct airo_info *local = dev->priv; | ||
| 6348 | struct iw_point *encoding = &wrqu->encoding; | ||
| 6349 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
| 6350 | CapabilityRid cap_rid; /* Card capability info */ | ||
| 6351 | int idx, max_key_len; | ||
| 6352 | |||
| 6353 | /* Is it supported ? */ | ||
| 6354 | readCapabilityRid(local, &cap_rid, 1); | ||
| 6355 | if(!(cap_rid.softCap & 2)) { | ||
| 6356 | return -EOPNOTSUPP; | ||
| 6357 | } | ||
| 6358 | readConfigRid(local, 1); | ||
| 6359 | |||
| 6360 | max_key_len = encoding->length - sizeof(*ext); | ||
| 6361 | if (max_key_len < 0) | ||
| 6362 | return -EINVAL; | ||
| 6363 | |||
| 6364 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
| 6365 | if (idx) { | ||
| 6366 | if (idx < 1 || idx > ((cap_rid.softCap & 0x80) ? 4:1)) | ||
| 6367 | return -EINVAL; | ||
| 6368 | idx--; | ||
| 6369 | } else | ||
| 6370 | idx = get_wep_key(local, 0xffff); | ||
| 6371 | |||
| 6372 | encoding->flags = idx + 1; | ||
| 6373 | memset(ext, 0, sizeof(*ext)); | ||
| 6374 | |||
| 6375 | /* Check encryption mode */ | ||
| 6376 | switch(local->config.authType) { | ||
| 6377 | case AUTH_ENCRYPT: | ||
| 6378 | encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; | ||
| 6379 | break; | ||
| 6380 | case AUTH_SHAREDKEY: | ||
| 6381 | encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; | ||
| 6382 | break; | ||
| 6383 | default: | ||
| 6384 | case AUTH_OPEN: | ||
| 6385 | encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED; | ||
| 6386 | break; | ||
| 6387 | } | ||
| 6388 | /* We can't return the key, so set the proper flag and return zero */ | ||
| 6389 | encoding->flags |= IW_ENCODE_NOKEY; | ||
| 6390 | memset(extra, 0, 16); | ||
| 6391 | |||
| 6392 | /* Copy the key to the user buffer */ | ||
| 6393 | ext->key_len = get_wep_key(local, idx); | ||
| 6394 | if (ext->key_len > 16) { | ||
| 6395 | ext->key_len=0; | ||
| 6396 | } | ||
| 6397 | |||
| 6398 | return 0; | ||
| 6399 | } | ||
| 6400 | |||
| 6401 | |||
| 6402 | /*------------------------------------------------------------------*/ | ||
| 6403 | /* | ||
| 6404 | * Wireless Handler : set extended authentication parameters | ||
| 6405 | */ | ||
| 6406 | static int airo_set_auth(struct net_device *dev, | ||
| 6407 | struct iw_request_info *info, | ||
| 6408 | union iwreq_data *wrqu, char *extra) | ||
| 6409 | { | ||
| 6410 | struct airo_info *local = dev->priv; | ||
| 6411 | struct iw_param *param = &wrqu->param; | ||
| 6412 | u16 currentAuthType = local->config.authType; | ||
| 6413 | |||
| 6414 | switch (param->flags & IW_AUTH_INDEX) { | ||
| 6415 | case IW_AUTH_WPA_VERSION: | ||
| 6416 | case IW_AUTH_CIPHER_PAIRWISE: | ||
| 6417 | case IW_AUTH_CIPHER_GROUP: | ||
| 6418 | case IW_AUTH_KEY_MGMT: | ||
| 6419 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: | ||
| 6420 | case IW_AUTH_PRIVACY_INVOKED: | ||
| 6421 | /* | ||
| 6422 | * airo does not use these parameters | ||
| 6423 | */ | ||
| 6424 | break; | ||
| 6425 | |||
| 6426 | case IW_AUTH_DROP_UNENCRYPTED: | ||
| 6427 | if (param->value) { | ||
| 6428 | /* Only change auth type if unencrypted */ | ||
| 6429 | if (currentAuthType == AUTH_OPEN) | ||
| 6430 | local->config.authType = AUTH_ENCRYPT; | ||
| 6431 | } else { | ||
| 6432 | local->config.authType = AUTH_OPEN; | ||
| 6433 | } | ||
| 6434 | |||
| 6435 | /* Commit the changes to flags if needed */ | ||
| 6436 | if (local->config.authType != currentAuthType) | ||
| 6437 | set_bit (FLAG_COMMIT, &local->flags); | ||
| 6438 | break; | ||
| 6439 | |||
| 6440 | case IW_AUTH_80211_AUTH_ALG: { | ||
| 6441 | /* FIXME: What about AUTH_OPEN? This API seems to | ||
| 6442 | * disallow setting our auth to AUTH_OPEN. | ||
| 6443 | */ | ||
| 6444 | if (param->value & IW_AUTH_ALG_SHARED_KEY) { | ||
| 6445 | local->config.authType = AUTH_SHAREDKEY; | ||
| 6446 | } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { | ||
| 6447 | local->config.authType = AUTH_ENCRYPT; | ||
| 6448 | } else | ||
| 6449 | return -EINVAL; | ||
| 6450 | break; | ||
| 6451 | |||
| 6452 | /* Commit the changes to flags if needed */ | ||
| 6453 | if (local->config.authType != currentAuthType) | ||
| 6454 | set_bit (FLAG_COMMIT, &local->flags); | ||
| 6455 | } | ||
| 6456 | |||
| 6457 | case IW_AUTH_WPA_ENABLED: | ||
| 6458 | /* Silently accept disable of WPA */ | ||
| 6459 | if (param->value > 0) | ||
| 6460 | return -EOPNOTSUPP; | ||
| 6461 | break; | ||
| 6462 | |||
| 6463 | default: | ||
| 6464 | return -EOPNOTSUPP; | ||
| 6465 | } | ||
| 6466 | return -EINPROGRESS; | ||
| 6467 | } | ||
| 6468 | |||
| 6469 | |||
| 6470 | /*------------------------------------------------------------------*/ | ||
| 6471 | /* | ||
| 6472 | * Wireless Handler : get extended authentication parameters | ||
| 6473 | */ | ||
| 6474 | static int airo_get_auth(struct net_device *dev, | ||
| 6475 | struct iw_request_info *info, | ||
| 6476 | union iwreq_data *wrqu, char *extra) | ||
| 6477 | { | ||
| 6478 | struct airo_info *local = dev->priv; | ||
| 6479 | struct iw_param *param = &wrqu->param; | ||
| 6480 | u16 currentAuthType = local->config.authType; | ||
| 6481 | |||
| 6482 | switch (param->flags & IW_AUTH_INDEX) { | ||
| 6483 | case IW_AUTH_DROP_UNENCRYPTED: | ||
| 6484 | switch (currentAuthType) { | ||
| 6485 | case AUTH_SHAREDKEY: | ||
| 6486 | case AUTH_ENCRYPT: | ||
| 6487 | param->value = 1; | ||
| 6488 | break; | ||
| 6489 | default: | ||
| 6490 | param->value = 0; | ||
| 6491 | break; | ||
| 6492 | } | ||
| 6493 | break; | ||
| 6494 | |||
| 6495 | case IW_AUTH_80211_AUTH_ALG: | ||
| 6496 | switch (currentAuthType) { | ||
| 6497 | case AUTH_SHAREDKEY: | ||
| 6498 | param->value = IW_AUTH_ALG_SHARED_KEY; | ||
| 6499 | break; | ||
| 6500 | case AUTH_ENCRYPT: | ||
| 6501 | default: | ||
| 6502 | param->value = IW_AUTH_ALG_OPEN_SYSTEM; | ||
| 6503 | break; | ||
| 6504 | } | ||
| 6505 | break; | ||
| 6506 | |||
| 6507 | case IW_AUTH_WPA_ENABLED: | ||
| 6508 | param->value = 0; | ||
| 6509 | break; | ||
| 6510 | |||
| 6511 | default: | ||
| 6512 | return -EOPNOTSUPP; | ||
| 6513 | } | ||
| 6514 | return 0; | ||
| 6515 | } | ||
| 6516 | |||
| 6517 | |||
| 6518 | /*------------------------------------------------------------------*/ | ||
| 6519 | /* | ||
| 6299 | * Wireless Handler : set Tx-Power | 6520 | * Wireless Handler : set Tx-Power |
| 6300 | */ | 6521 | */ |
| 6301 | static int airo_set_txpow(struct net_device *dev, | 6522 | static int airo_set_txpow(struct net_device *dev, |
| @@ -7050,6 +7271,15 @@ static const iw_handler airo_handler[] = | |||
| 7050 | (iw_handler) airo_get_encode, /* SIOCGIWENCODE */ | 7271 | (iw_handler) airo_get_encode, /* SIOCGIWENCODE */ |
| 7051 | (iw_handler) airo_set_power, /* SIOCSIWPOWER */ | 7272 | (iw_handler) airo_set_power, /* SIOCSIWPOWER */ |
| 7052 | (iw_handler) airo_get_power, /* SIOCGIWPOWER */ | 7273 | (iw_handler) airo_get_power, /* SIOCGIWPOWER */ |
| 7274 | (iw_handler) NULL, /* -- hole -- */ | ||
| 7275 | (iw_handler) NULL, /* -- hole -- */ | ||
| 7276 | (iw_handler) NULL, /* SIOCSIWGENIE */ | ||
| 7277 | (iw_handler) NULL, /* SIOCGIWGENIE */ | ||
| 7278 | (iw_handler) airo_set_auth, /* SIOCSIWAUTH */ | ||
| 7279 | (iw_handler) airo_get_auth, /* SIOCGIWAUTH */ | ||
| 7280 | (iw_handler) airo_set_encodeext, /* SIOCSIWENCODEEXT */ | ||
| 7281 | (iw_handler) airo_get_encodeext, /* SIOCGIWENCODEEXT */ | ||
| 7282 | (iw_handler) NULL, /* SIOCSIWPMKSA */ | ||
| 7053 | }; | 7283 | }; |
| 7054 | 7284 | ||
| 7055 | /* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here. | 7285 | /* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here. |
| @@ -7270,13 +7500,11 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { | |||
| 7270 | case AIROGSTAT: ridcode = RID_STATUS; break; | 7500 | case AIROGSTAT: ridcode = RID_STATUS; break; |
| 7271 | case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; | 7501 | case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; |
| 7272 | case AIROGSTATSC32: ridcode = RID_STATS; break; | 7502 | case AIROGSTATSC32: ridcode = RID_STATS; break; |
| 7273 | #ifdef MICSUPPORT | ||
| 7274 | case AIROGMICSTATS: | 7503 | case AIROGMICSTATS: |
| 7275 | if (copy_to_user(comp->data, &ai->micstats, | 7504 | if (copy_to_user(comp->data, &ai->micstats, |
| 7276 | min((int)comp->len,(int)sizeof(ai->micstats)))) | 7505 | min((int)comp->len,(int)sizeof(ai->micstats)))) |
| 7277 | return -EFAULT; | 7506 | return -EFAULT; |
| 7278 | return 0; | 7507 | return 0; |
| 7279 | #endif | ||
| 7280 | case AIRORRID: ridcode = comp->ridnum; break; | 7508 | case AIRORRID: ridcode = comp->ridnum; break; |
| 7281 | default: | 7509 | default: |
| 7282 | return -EINVAL; | 7510 | return -EINVAL; |
| @@ -7308,9 +7536,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { | |||
| 7308 | static int writerids(struct net_device *dev, aironet_ioctl *comp) { | 7536 | static int writerids(struct net_device *dev, aironet_ioctl *comp) { |
| 7309 | struct airo_info *ai = dev->priv; | 7537 | struct airo_info *ai = dev->priv; |
| 7310 | int ridcode; | 7538 | int ridcode; |
| 7311 | #ifdef MICSUPPORT | ||
| 7312 | int enabled; | 7539 | int enabled; |
| 7313 | #endif | ||
| 7314 | Resp rsp; | 7540 | Resp rsp; |
| 7315 | static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); | 7541 | static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); |
| 7316 | unsigned char *iobuf; | 7542 | unsigned char *iobuf; |
| @@ -7367,11 +7593,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { | |||
| 7367 | 7593 | ||
| 7368 | PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); | 7594 | PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); |
| 7369 | 7595 | ||
| 7370 | #ifdef MICSUPPORT | ||
| 7371 | enabled = ai->micstats.enabled; | 7596 | enabled = ai->micstats.enabled; |
| 7372 | memset(&ai->micstats,0,sizeof(ai->micstats)); | 7597 | memset(&ai->micstats,0,sizeof(ai->micstats)); |
| 7373 | ai->micstats.enabled = enabled; | 7598 | ai->micstats.enabled = enabled; |
| 7374 | #endif | ||
| 7375 | 7599 | ||
| 7376 | if (copy_to_user(comp->data, iobuf, | 7600 | if (copy_to_user(comp->data, iobuf, |
| 7377 | min((int)comp->len, (int)RIDSIZE))) { | 7601 | min((int)comp->len, (int)RIDSIZE))) { |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index dfc24016ba81..87afa6878f26 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
| @@ -137,44 +137,6 @@ static struct { | |||
| 137 | #define MAC_BOOT_COMPLETE 0x0010 // MAC boot has been completed | 137 | #define MAC_BOOT_COMPLETE 0x0010 // MAC boot has been completed |
| 138 | #define MAC_INIT_OK 0x0002 // MAC boot has been completed | 138 | #define MAC_INIT_OK 0x0002 // MAC boot has been completed |
| 139 | 139 | ||
| 140 | #define C80211_SUBTYPE_MGMT_ASS_REQUEST 0x00 | ||
| 141 | #define C80211_SUBTYPE_MGMT_ASS_RESPONSE 0x10 | ||
| 142 | #define C80211_SUBTYPE_MGMT_REASS_REQUEST 0x20 | ||
| 143 | #define C80211_SUBTYPE_MGMT_REASS_RESPONSE 0x30 | ||
| 144 | #define C80211_SUBTYPE_MGMT_ProbeRequest 0x40 | ||
| 145 | #define C80211_SUBTYPE_MGMT_ProbeResponse 0x50 | ||
| 146 | #define C80211_SUBTYPE_MGMT_BEACON 0x80 | ||
| 147 | #define C80211_SUBTYPE_MGMT_ATIM 0x90 | ||
| 148 | #define C80211_SUBTYPE_MGMT_DISASSOSIATION 0xA0 | ||
| 149 | #define C80211_SUBTYPE_MGMT_Authentication 0xB0 | ||
| 150 | #define C80211_SUBTYPE_MGMT_Deauthentication 0xC0 | ||
| 151 | |||
| 152 | #define C80211_MGMT_AAN_OPENSYSTEM 0x0000 | ||
| 153 | #define C80211_MGMT_AAN_SHAREDKEY 0x0001 | ||
| 154 | |||
| 155 | #define C80211_MGMT_CAPABILITY_ESS 0x0001 // see 802.11 p.58 | ||
| 156 | #define C80211_MGMT_CAPABILITY_IBSS 0x0002 // - " - | ||
| 157 | #define C80211_MGMT_CAPABILITY_CFPollable 0x0004 // - " - | ||
| 158 | #define C80211_MGMT_CAPABILITY_CFPollRequest 0x0008 // - " - | ||
| 159 | #define C80211_MGMT_CAPABILITY_Privacy 0x0010 // - " - | ||
| 160 | |||
| 161 | #define C80211_MGMT_SC_Success 0 | ||
| 162 | #define C80211_MGMT_SC_Unspecified 1 | ||
| 163 | #define C80211_MGMT_SC_SupportCapabilities 10 | ||
| 164 | #define C80211_MGMT_SC_ReassDenied 11 | ||
| 165 | #define C80211_MGMT_SC_AssDenied 12 | ||
| 166 | #define C80211_MGMT_SC_AuthAlgNotSupported 13 | ||
| 167 | #define C80211_MGMT_SC_AuthTransSeqNumError 14 | ||
| 168 | #define C80211_MGMT_SC_AuthRejectChallenge 15 | ||
| 169 | #define C80211_MGMT_SC_AuthRejectTimeout 16 | ||
| 170 | #define C80211_MGMT_SC_AssDeniedHandleAP 17 | ||
| 171 | #define C80211_MGMT_SC_AssDeniedBSSRate 18 | ||
| 172 | |||
| 173 | #define C80211_MGMT_ElementID_SSID 0 | ||
| 174 | #define C80211_MGMT_ElementID_SupportedRates 1 | ||
| 175 | #define C80211_MGMT_ElementID_ChallengeText 16 | ||
| 176 | #define C80211_MGMT_CAPABILITY_ShortPreamble 0x0020 | ||
| 177 | |||
| 178 | #define MIB_MAX_DATA_BYTES 212 | 140 | #define MIB_MAX_DATA_BYTES 212 |
| 179 | #define MIB_HEADER_SIZE 4 /* first four fields */ | 141 | #define MIB_HEADER_SIZE 4 /* first four fields */ |
| 180 | 142 | ||
| @@ -2835,7 +2797,7 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, | |||
| 2835 | u8 channel) | 2797 | u8 channel) |
| 2836 | { | 2798 | { |
| 2837 | int rejoin = 0; | 2799 | int rejoin = 0; |
| 2838 | int new = capability & C80211_MGMT_CAPABILITY_ShortPreamble ? | 2800 | int new = capability & MFIE_TYPE_POWER_CONSTRAINT ? |
| 2839 | SHORT_PREAMBLE : LONG_PREAMBLE; | 2801 | SHORT_PREAMBLE : LONG_PREAMBLE; |
| 2840 | 2802 | ||
| 2841 | if (priv->preamble != new) { | 2803 | if (priv->preamble != new) { |
| @@ -2921,11 +2883,11 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) | |||
| 2921 | memcpy(header.addr2, priv->dev->dev_addr, 6); | 2883 | memcpy(header.addr2, priv->dev->dev_addr, 6); |
| 2922 | memcpy(header.addr3, priv->CurrentBSSID, 6); | 2884 | memcpy(header.addr3, priv->CurrentBSSID, 6); |
| 2923 | 2885 | ||
| 2924 | body.capability = cpu_to_le16(C80211_MGMT_CAPABILITY_ESS); | 2886 | body.capability = cpu_to_le16(WLAN_CAPABILITY_ESS); |
| 2925 | if (priv->wep_is_on) | 2887 | if (priv->wep_is_on) |
| 2926 | body.capability |= cpu_to_le16(C80211_MGMT_CAPABILITY_Privacy); | 2888 | body.capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); |
| 2927 | if (priv->preamble == SHORT_PREAMBLE) | 2889 | if (priv->preamble == SHORT_PREAMBLE) |
| 2928 | body.capability |= cpu_to_le16(C80211_MGMT_CAPABILITY_ShortPreamble); | 2890 | body.capability |= cpu_to_le16(MFIE_TYPE_POWER_CONSTRAINT); |
| 2929 | 2891 | ||
| 2930 | body.listen_interval = cpu_to_le16(priv->listen_interval * priv->beacon_period); | 2892 | body.listen_interval = cpu_to_le16(priv->listen_interval * priv->beacon_period); |
| 2931 | 2893 | ||
| @@ -2939,10 +2901,10 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc) | |||
| 2939 | bodysize = 12 + priv->SSID_size; | 2901 | bodysize = 12 + priv->SSID_size; |
| 2940 | } | 2902 | } |
| 2941 | 2903 | ||
| 2942 | ssid_el_p[0] = C80211_MGMT_ElementID_SSID; | 2904 | ssid_el_p[0] = MFIE_TYPE_SSID; |
| 2943 | ssid_el_p[1] = priv->SSID_size; | 2905 | ssid_el_p[1] = priv->SSID_size; |
| 2944 | memcpy(ssid_el_p + 2, priv->SSID, priv->SSID_size); | 2906 | memcpy(ssid_el_p + 2, priv->SSID, priv->SSID_size); |
| 2945 | ssid_el_p[2 + priv->SSID_size] = C80211_MGMT_ElementID_SupportedRates; | 2907 | ssid_el_p[2 + priv->SSID_size] = MFIE_TYPE_RATES; |
| 2946 | ssid_el_p[3 + priv->SSID_size] = 4; /* len of suported rates */ | 2908 | ssid_el_p[3 + priv->SSID_size] = 4; /* len of suported rates */ |
| 2947 | memcpy(ssid_el_p + 4 + priv->SSID_size, atmel_basic_rates, 4); | 2909 | memcpy(ssid_el_p + 4 + priv->SSID_size, atmel_basic_rates, 4); |
| 2948 | 2910 | ||
| @@ -3004,7 +2966,7 @@ static void store_bss_info(struct atmel_private *priv, | |||
| 3004 | u16 beacon_period, u8 channel, u8 rssi, u8 ssid_len, | 2966 | u16 beacon_period, u8 channel, u8 rssi, u8 ssid_len, |
| 3005 | u8 *ssid, int is_beacon) | 2967 | u8 *ssid, int is_beacon) |
| 3006 | { | 2968 | { |
| 3007 | u8 *bss = capability & C80211_MGMT_CAPABILITY_ESS ? header->addr2 : header->addr3; | 2969 | u8 *bss = capability & WLAN_CAPABILITY_ESS ? header->addr2 : header->addr3; |
| 3008 | int i, index; | 2970 | int i, index; |
| 3009 | 2971 | ||
| 3010 | for (index = -1, i = 0; i < priv->BSS_list_entries; i++) | 2972 | for (index = -1, i = 0; i < priv->BSS_list_entries; i++) |
| @@ -3030,16 +2992,16 @@ static void store_bss_info(struct atmel_private *priv, | |||
| 3030 | 2992 | ||
| 3031 | priv->BSSinfo[index].channel = channel; | 2993 | priv->BSSinfo[index].channel = channel; |
| 3032 | priv->BSSinfo[index].beacon_period = beacon_period; | 2994 | priv->BSSinfo[index].beacon_period = beacon_period; |
| 3033 | priv->BSSinfo[index].UsingWEP = capability & C80211_MGMT_CAPABILITY_Privacy; | 2995 | priv->BSSinfo[index].UsingWEP = capability & WLAN_CAPABILITY_PRIVACY; |
| 3034 | memcpy(priv->BSSinfo[index].SSID, ssid, ssid_len); | 2996 | memcpy(priv->BSSinfo[index].SSID, ssid, ssid_len); |
| 3035 | priv->BSSinfo[index].SSIDsize = ssid_len; | 2997 | priv->BSSinfo[index].SSIDsize = ssid_len; |
| 3036 | 2998 | ||
| 3037 | if (capability & C80211_MGMT_CAPABILITY_IBSS) | 2999 | if (capability & WLAN_CAPABILITY_IBSS) |
| 3038 | priv->BSSinfo[index].BSStype = IW_MODE_ADHOC; | 3000 | priv->BSSinfo[index].BSStype = IW_MODE_ADHOC; |
| 3039 | else if (capability & C80211_MGMT_CAPABILITY_ESS) | 3001 | else if (capability & WLAN_CAPABILITY_ESS) |
| 3040 | priv->BSSinfo[index].BSStype =IW_MODE_INFRA; | 3002 | priv->BSSinfo[index].BSStype =IW_MODE_INFRA; |
| 3041 | 3003 | ||
| 3042 | priv->BSSinfo[index].preamble = capability & C80211_MGMT_CAPABILITY_ShortPreamble ? | 3004 | priv->BSSinfo[index].preamble = capability & MFIE_TYPE_POWER_CONSTRAINT ? |
| 3043 | SHORT_PREAMBLE : LONG_PREAMBLE; | 3005 | SHORT_PREAMBLE : LONG_PREAMBLE; |
| 3044 | } | 3006 | } |
| 3045 | 3007 | ||
| @@ -3050,7 +3012,7 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
| 3050 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); | 3012 | u16 trans_seq_no = le16_to_cpu(auth->trans_seq); |
| 3051 | u16 system = le16_to_cpu(auth->alg); | 3013 | u16 system = le16_to_cpu(auth->alg); |
| 3052 | 3014 | ||
| 3053 | if (status == C80211_MGMT_SC_Success && !priv->wep_is_on) { | 3015 | if (status == WLAN_STATUS_SUCCESS && !priv->wep_is_on) { |
| 3054 | /* no WEP */ | 3016 | /* no WEP */ |
| 3055 | if (priv->station_was_associated) { | 3017 | if (priv->station_was_associated) { |
| 3056 | atmel_enter_state(priv, STATION_STATE_REASSOCIATING); | 3018 | atmel_enter_state(priv, STATION_STATE_REASSOCIATING); |
| @@ -3063,19 +3025,19 @@ static void authenticate(struct atmel_private *priv, u16 frame_len) | |||
| 3063 | } | 3025 | } |
| 3064 | } | 3026 | } |
| 3065 | 3027 | ||
| 3066 | if (status == C80211_MGMT_SC_Success && priv->wep_is_on) { | 3028 | if (status == WLAN_STATUS_SUCCESS && priv->wep_is_on) { |
| 3067 | int should_associate = 0; | 3029 | int should_associate = 0; |
| 3068 | /* WEP */ | 3030 | /* WEP */ |
| 3069 | if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) | 3031 | if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) |
| 3070 | return; | 3032 | return; |
| 3071 | 3033 | ||
| 3072 | if (system == C80211_MGMT_AAN_OPENSYSTEM) { | 3034 | if (system == WLAN_AUTH_OPEN) { |
| 3073 | if (trans_seq_no == 0x0002) { | 3035 | if (trans_seq_no == 0x0002) { |
| 3074 | should_associate = 1; | 3036 | should_associate = 1; |
| 3075 | } | 3037 | } |
| 3076 | } else if (system == C80211_MGMT_AAN_SHAREDKEY) { | 3038 | } else if (system == WLAN_AUTH_SHARED_KEY) { |
| 3077 | if (trans_seq_no == 0x0002 && | 3039 | if (trans_seq_no == 0x0002 && |
| 3078 | auth->el_id == C80211_MGMT_ElementID_ChallengeText) { | 3040 | auth->el_id == MFIE_TYPE_CHALLENGE) { |
| 3079 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); | 3041 | send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); |
| 3080 | return; | 3042 | return; |
| 3081 | } else if (trans_seq_no == 0x0004) { | 3043 | } else if (trans_seq_no == 0x0004) { |
| @@ -3140,8 +3102,8 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) | |||
| 3140 | if (frame_len < 8 + rates_len) | 3102 | if (frame_len < 8 + rates_len) |
| 3141 | return; | 3103 | return; |
| 3142 | 3104 | ||
| 3143 | if (status == C80211_MGMT_SC_Success) { | 3105 | if (status == WLAN_STATUS_SUCCESS) { |
| 3144 | if (subtype == C80211_SUBTYPE_MGMT_ASS_RESPONSE) | 3106 | if (subtype == IEEE80211_STYPE_ASSOC_RESP) |
| 3145 | priv->AssociationRequestRetryCnt = 0; | 3107 | priv->AssociationRequestRetryCnt = 0; |
| 3146 | else | 3108 | else |
| 3147 | priv->ReAssociationRequestRetryCnt = 0; | 3109 | priv->ReAssociationRequestRetryCnt = 0; |
| @@ -3178,9 +3140,9 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) | |||
| 3178 | return; | 3140 | return; |
| 3179 | } | 3141 | } |
| 3180 | 3142 | ||
| 3181 | if (subtype == C80211_SUBTYPE_MGMT_ASS_RESPONSE && | 3143 | if (subtype == IEEE80211_STYPE_ASSOC_RESP && |
| 3182 | status != C80211_MGMT_SC_AssDeniedBSSRate && | 3144 | status != WLAN_STATUS_ASSOC_DENIED_RATES && |
| 3183 | status != C80211_MGMT_SC_SupportCapabilities && | 3145 | status != WLAN_STATUS_CAPS_UNSUPPORTED && |
| 3184 | priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { | 3146 | priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { |
| 3185 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3147 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
| 3186 | priv->AssociationRequestRetryCnt++; | 3148 | priv->AssociationRequestRetryCnt++; |
| @@ -3188,9 +3150,9 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) | |||
| 3188 | return; | 3150 | return; |
| 3189 | } | 3151 | } |
| 3190 | 3152 | ||
| 3191 | if (subtype == C80211_SUBTYPE_MGMT_REASS_RESPONSE && | 3153 | if (subtype == IEEE80211_STYPE_REASSOC_RESP && |
| 3192 | status != C80211_MGMT_SC_AssDeniedBSSRate && | 3154 | status != WLAN_STATUS_ASSOC_DENIED_RATES && |
| 3193 | status != C80211_MGMT_SC_SupportCapabilities && | 3155 | status != WLAN_STATUS_CAPS_UNSUPPORTED && |
| 3194 | priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { | 3156 | priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { |
| 3195 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3157 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
| 3196 | priv->ReAssociationRequestRetryCnt++; | 3158 | priv->ReAssociationRequestRetryCnt++; |
| @@ -3325,8 +3287,8 @@ static void atmel_management_frame(struct atmel_private *priv, | |||
| 3325 | 3287 | ||
| 3326 | subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE; | 3288 | subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE; |
| 3327 | switch (subtype) { | 3289 | switch (subtype) { |
| 3328 | case C80211_SUBTYPE_MGMT_BEACON: | 3290 | case IEEE80211_STYPE_BEACON: |
| 3329 | case C80211_SUBTYPE_MGMT_ProbeResponse: | 3291 | case IEEE80211_STYPE_PROBE_RESP: |
| 3330 | 3292 | ||
| 3331 | /* beacon frame has multiple variable-length fields - | 3293 | /* beacon frame has multiple variable-length fields - |
| 3332 | never let an engineer loose with a data structure design. */ | 3294 | never let an engineer loose with a data structure design. */ |
| @@ -3384,19 +3346,19 @@ static void atmel_management_frame(struct atmel_private *priv, | |||
| 3384 | beacon_interval, channel, rssi, | 3346 | beacon_interval, channel, rssi, |
| 3385 | ssid_length, | 3347 | ssid_length, |
| 3386 | &beacon->rates_el_id, | 3348 | &beacon->rates_el_id, |
| 3387 | subtype == C80211_SUBTYPE_MGMT_BEACON); | 3349 | subtype == IEEE80211_STYPE_BEACON); |
| 3388 | } | 3350 | } |
| 3389 | break; | 3351 | break; |
| 3390 | 3352 | ||
| 3391 | case C80211_SUBTYPE_MGMT_Authentication: | 3353 | case IEEE80211_STYPE_AUTH: |
| 3392 | 3354 | ||
| 3393 | if (priv->station_state == STATION_STATE_AUTHENTICATING) | 3355 | if (priv->station_state == STATION_STATE_AUTHENTICATING) |
| 3394 | authenticate(priv, frame_len); | 3356 | authenticate(priv, frame_len); |
| 3395 | 3357 | ||
| 3396 | break; | 3358 | break; |
| 3397 | 3359 | ||
| 3398 | case C80211_SUBTYPE_MGMT_ASS_RESPONSE: | 3360 | case IEEE80211_STYPE_ASSOC_RESP: |
| 3399 | case C80211_SUBTYPE_MGMT_REASS_RESPONSE: | 3361 | case IEEE80211_STYPE_REASSOC_RESP: |
| 3400 | 3362 | ||
| 3401 | if (priv->station_state == STATION_STATE_ASSOCIATING || | 3363 | if (priv->station_state == STATION_STATE_ASSOCIATING || |
| 3402 | priv->station_state == STATION_STATE_REASSOCIATING) | 3364 | priv->station_state == STATION_STATE_REASSOCIATING) |
| @@ -3404,7 +3366,7 @@ static void atmel_management_frame(struct atmel_private *priv, | |||
| 3404 | 3366 | ||
| 3405 | break; | 3367 | break; |
| 3406 | 3368 | ||
| 3407 | case C80211_SUBTYPE_MGMT_DISASSOSIATION: | 3369 | case IEEE80211_STYPE_DISASSOC: |
| 3408 | if (priv->station_is_associated && | 3370 | if (priv->station_is_associated && |
| 3409 | priv->operating_mode == IW_MODE_INFRA && | 3371 | priv->operating_mode == IW_MODE_INFRA && |
| 3410 | is_frame_from_current_bss(priv, header)) { | 3372 | is_frame_from_current_bss(priv, header)) { |
| @@ -3417,7 +3379,7 @@ static void atmel_management_frame(struct atmel_private *priv, | |||
| 3417 | 3379 | ||
| 3418 | break; | 3380 | break; |
| 3419 | 3381 | ||
| 3420 | case C80211_SUBTYPE_MGMT_Deauthentication: | 3382 | case IEEE80211_STYPE_DEAUTH: |
| 3421 | if (priv->operating_mode == IW_MODE_INFRA && | 3383 | if (priv->operating_mode == IW_MODE_INFRA && |
| 3422 | is_frame_from_current_bss(priv, header)) { | 3384 | is_frame_from_current_bss(priv, header)) { |
| 3423 | priv->station_was_associated = 0; | 3385 | priv->station_was_associated = 0; |
| @@ -3453,12 +3415,12 @@ static void atmel_management_timer(u_long a) | |||
| 3453 | priv->AuthenticationRequestRetryCnt = 0; | 3415 | priv->AuthenticationRequestRetryCnt = 0; |
| 3454 | restart_search(priv); | 3416 | restart_search(priv); |
| 3455 | } else { | 3417 | } else { |
| 3456 | int auth = C80211_MGMT_AAN_OPENSYSTEM; | 3418 | int auth = WLAN_AUTH_OPEN; |
| 3457 | priv->AuthenticationRequestRetryCnt++; | 3419 | priv->AuthenticationRequestRetryCnt++; |
| 3458 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3420 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
| 3459 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3421 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
| 3460 | if (priv->wep_is_on && priv->exclude_unencrypted) | 3422 | if (priv->wep_is_on && priv->exclude_unencrypted) |
| 3461 | auth = C80211_MGMT_AAN_SHAREDKEY; | 3423 | auth = WLAN_AUTH_SHARED_KEY; |
| 3462 | send_authentication_request(priv, auth, NULL, 0); | 3424 | send_authentication_request(priv, auth, NULL, 0); |
| 3463 | } | 3425 | } |
| 3464 | break; | 3426 | break; |
| @@ -3558,14 +3520,14 @@ static void atmel_command_irq(struct atmel_private *priv) | |||
| 3558 | priv->station_was_associated = priv->station_is_associated; | 3520 | priv->station_was_associated = priv->station_is_associated; |
| 3559 | atmel_enter_state(priv, STATION_STATE_READY); | 3521 | atmel_enter_state(priv, STATION_STATE_READY); |
| 3560 | } else { | 3522 | } else { |
| 3561 | int auth = C80211_MGMT_AAN_OPENSYSTEM; | 3523 | int auth = WLAN_AUTH_OPEN; |
| 3562 | priv->AuthenticationRequestRetryCnt = 0; | 3524 | priv->AuthenticationRequestRetryCnt = 0; |
| 3563 | atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); | 3525 | atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); |
| 3564 | 3526 | ||
| 3565 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); | 3527 | mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); |
| 3566 | priv->CurrentAuthentTransactionSeqNum = 0x0001; | 3528 | priv->CurrentAuthentTransactionSeqNum = 0x0001; |
| 3567 | if (priv->wep_is_on && priv->exclude_unencrypted) | 3529 | if (priv->wep_is_on && priv->exclude_unencrypted) |
| 3568 | auth = C80211_MGMT_AAN_SHAREDKEY; | 3530 | auth = WLAN_AUTH_SHARED_KEY; |
| 3569 | send_authentication_request(priv, auth, NULL, 0); | 3531 | send_authentication_request(priv, auth, NULL, 0); |
| 3570 | } | 3532 | } |
| 3571 | return; | 3533 | return; |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 6290c9f7e939..72335c8eb97f 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | ||
| 3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify it | 5 | This program is free software; you can redistribute it and/or modify it |
| 6 | under the terms of version 2 of the GNU General Public License as | 6 | under the terms of version 2 of the GNU General Public License as |
| @@ -167,12 +167,12 @@ 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.2.2" |
| 171 | 171 | ||
| 172 | #define DRV_NAME "ipw2100" | 172 | #define DRV_NAME "ipw2100" |
| 173 | #define DRV_VERSION IPW2100_VERSION | 173 | #define DRV_VERSION IPW2100_VERSION |
| 174 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" | 174 | #define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" |
| 175 | #define DRV_COPYRIGHT "Copyright(c) 2003-2005 Intel Corporation" | 175 | #define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" |
| 176 | 176 | ||
| 177 | /* Debugging stuff */ | 177 | /* Debugging stuff */ |
| 178 | #ifdef CONFIG_IPW2100_DEBUG | 178 | #ifdef CONFIG_IPW2100_DEBUG |
| @@ -1418,7 +1418,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | |||
| 1418 | if (priv->status & STATUS_ENABLED) | 1418 | if (priv->status & STATUS_ENABLED) |
| 1419 | return 0; | 1419 | return 0; |
| 1420 | 1420 | ||
| 1421 | down(&priv->adapter_sem); | 1421 | mutex_lock(&priv->adapter_mutex); |
| 1422 | 1422 | ||
| 1423 | if (rf_kill_active(priv)) { | 1423 | if (rf_kill_active(priv)) { |
| 1424 | IPW_DEBUG_HC("Command aborted due to RF kill active.\n"); | 1424 | IPW_DEBUG_HC("Command aborted due to RF kill active.\n"); |
| @@ -1444,7 +1444,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv) | |||
| 1444 | } | 1444 | } |
| 1445 | 1445 | ||
| 1446 | fail_up: | 1446 | fail_up: |
| 1447 | up(&priv->adapter_sem); | 1447 | mutex_unlock(&priv->adapter_mutex); |
| 1448 | return err; | 1448 | return err; |
| 1449 | } | 1449 | } |
| 1450 | 1450 | ||
| @@ -1576,7 +1576,7 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv) | |||
| 1576 | cancel_delayed_work(&priv->hang_check); | 1576 | cancel_delayed_work(&priv->hang_check); |
| 1577 | } | 1577 | } |
| 1578 | 1578 | ||
| 1579 | down(&priv->adapter_sem); | 1579 | mutex_lock(&priv->adapter_mutex); |
| 1580 | 1580 | ||
| 1581 | err = ipw2100_hw_send_command(priv, &cmd); | 1581 | err = ipw2100_hw_send_command(priv, &cmd); |
| 1582 | if (err) { | 1582 | if (err) { |
| @@ -1595,7 +1595,7 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv) | |||
| 1595 | IPW_DEBUG_INFO("TODO: implement scan state machine\n"); | 1595 | IPW_DEBUG_INFO("TODO: implement scan state machine\n"); |
| 1596 | 1596 | ||
| 1597 | fail_up: | 1597 | fail_up: |
| 1598 | up(&priv->adapter_sem); | 1598 | mutex_unlock(&priv->adapter_mutex); |
| 1599 | return err; | 1599 | return err; |
| 1600 | } | 1600 | } |
| 1601 | 1601 | ||
| @@ -1672,6 +1672,18 @@ static int ipw2100_start_scan(struct ipw2100_priv *priv) | |||
| 1672 | return err; | 1672 | return err; |
| 1673 | } | 1673 | } |
| 1674 | 1674 | ||
| 1675 | static 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 | |||
| 1675 | static int ipw2100_up(struct ipw2100_priv *priv, int deferred) | 1687 | static 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 |
| @@ -1869,7 +1888,7 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) | |||
| 1869 | priv->status |= STATUS_RESET_PENDING; | 1888 | priv->status |= STATUS_RESET_PENDING; |
| 1870 | spin_unlock_irqrestore(&priv->low_lock, flags); | 1889 | spin_unlock_irqrestore(&priv->low_lock, flags); |
| 1871 | 1890 | ||
| 1872 | down(&priv->action_sem); | 1891 | mutex_lock(&priv->action_mutex); |
| 1873 | /* stop timed checks so that they don't interfere with reset */ | 1892 | /* stop timed checks so that they don't interfere with reset */ |
| 1874 | priv->stop_hang_check = 1; | 1893 | priv->stop_hang_check = 1; |
| 1875 | cancel_delayed_work(&priv->hang_check); | 1894 | cancel_delayed_work(&priv->hang_check); |
| @@ -1879,7 +1898,7 @@ static void ipw2100_reset_adapter(struct ipw2100_priv *priv) | |||
| 1879 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); | 1898 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); |
| 1880 | 1899 | ||
| 1881 | ipw2100_up(priv, 0); | 1900 | ipw2100_up(priv, 0); |
| 1882 | up(&priv->action_sem); | 1901 | mutex_unlock(&priv->action_mutex); |
| 1883 | 1902 | ||
| 1884 | } | 1903 | } |
| 1885 | 1904 | ||
| @@ -2371,15 +2390,6 @@ static void isr_rx(struct ipw2100_priv *priv, int i, | |||
| 2371 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); | 2390 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); |
| 2372 | return; | 2391 | return; |
| 2373 | } | 2392 | } |
| 2374 | #ifdef CONFIG_IPW2100_MONITOR | ||
| 2375 | if (unlikely(priv->ieee->iw_mode == IW_MODE_MONITOR && | ||
| 2376 | priv->config & CFG_CRC_CHECK && | ||
| 2377 | status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { | ||
| 2378 | IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); | ||
| 2379 | priv->ieee->stats.rx_errors++; | ||
| 2380 | return; | ||
| 2381 | } | ||
| 2382 | #endif | ||
| 2383 | 2393 | ||
| 2384 | if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && | 2394 | if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && |
| 2385 | !(priv->status & STATUS_ASSOCIATED))) { | 2395 | !(priv->status & STATUS_ASSOCIATED))) { |
| @@ -2427,6 +2437,89 @@ static void isr_rx(struct ipw2100_priv *priv, int i, | |||
| 2427 | priv->rx_queue.drv[i].host_addr = packet->dma_addr; | 2437 | priv->rx_queue.drv[i].host_addr = packet->dma_addr; |
| 2428 | } | 2438 | } |
| 2429 | 2439 | ||
| 2440 | #ifdef CONFIG_IPW2100_MONITOR | ||
| 2441 | |||
| 2442 | static void isr_rx_monitor(struct ipw2100_priv *priv, int i, | ||
| 2443 | struct ieee80211_rx_stats *stats) | ||
| 2444 | { | ||
| 2445 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | ||
| 2446 | struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; | ||
| 2447 | |||
| 2448 | /* Magic struct that slots into the radiotap header -- no reason | ||
| 2449 | * to build this manually element by element, we can write it much | ||
| 2450 | * more efficiently than we can parse it. ORDER MATTERS HERE */ | ||
| 2451 | struct ipw_rt_hdr { | ||
| 2452 | struct ieee80211_radiotap_header rt_hdr; | ||
| 2453 | s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ | ||
| 2454 | } *ipw_rt; | ||
| 2455 | |||
| 2456 | IPW_DEBUG_RX("Handler...\n"); | ||
| 2457 | |||
| 2458 | if (unlikely(status->frame_size > skb_tailroom(packet->skb) - | ||
| 2459 | sizeof(struct ipw_rt_hdr))) { | ||
| 2460 | IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" | ||
| 2461 | " Dropping.\n", | ||
| 2462 | priv->net_dev->name, | ||
| 2463 | status->frame_size, | ||
| 2464 | skb_tailroom(packet->skb)); | ||
| 2465 | priv->ieee->stats.rx_errors++; | ||
| 2466 | return; | ||
| 2467 | } | ||
| 2468 | |||
| 2469 | if (unlikely(!netif_running(priv->net_dev))) { | ||
| 2470 | priv->ieee->stats.rx_errors++; | ||
| 2471 | priv->wstats.discard.misc++; | ||
| 2472 | IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); | ||
| 2473 | return; | ||
| 2474 | } | ||
| 2475 | |||
| 2476 | if (unlikely(priv->config & CFG_CRC_CHECK && | ||
| 2477 | status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { | ||
| 2478 | IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); | ||
| 2479 | priv->ieee->stats.rx_errors++; | ||
| 2480 | return; | ||
| 2481 | } | ||
| 2482 | |||
| 2483 | pci_unmap_single(priv->pci_dev, packet->dma_addr, | ||
| 2484 | sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); | ||
| 2485 | memmove(packet->skb->data + sizeof(struct ipw_rt_hdr), | ||
| 2486 | packet->skb->data, status->frame_size); | ||
| 2487 | |||
| 2488 | ipw_rt = (struct ipw_rt_hdr *) packet->skb->data; | ||
| 2489 | |||
| 2490 | ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; | ||
| 2491 | ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ | ||
| 2492 | ipw_rt->rt_hdr.it_len = sizeof(struct ipw_rt_hdr); /* total hdr+data */ | ||
| 2493 | |||
| 2494 | ipw_rt->rt_hdr.it_present = 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL; | ||
| 2495 | |||
| 2496 | ipw_rt->rt_dbmsignal = status->rssi + IPW2100_RSSI_TO_DBM; | ||
| 2497 | |||
| 2498 | skb_put(packet->skb, status->frame_size + sizeof(struct ipw_rt_hdr)); | ||
| 2499 | |||
| 2500 | if (!ieee80211_rx(priv->ieee, packet->skb, stats)) { | ||
| 2501 | priv->ieee->stats.rx_errors++; | ||
| 2502 | |||
| 2503 | /* ieee80211_rx failed, so it didn't free the SKB */ | ||
| 2504 | dev_kfree_skb_any(packet->skb); | ||
| 2505 | packet->skb = NULL; | ||
| 2506 | } | ||
| 2507 | |||
| 2508 | /* We need to allocate a new SKB and attach it to the RDB. */ | ||
| 2509 | if (unlikely(ipw2100_alloc_skb(priv, packet))) { | ||
| 2510 | IPW_DEBUG_WARNING( | ||
| 2511 | "%s: Unable to allocate SKB onto RBD ring - disabling " | ||
| 2512 | "adapter.\n", priv->net_dev->name); | ||
| 2513 | /* TODO: schedule adapter shutdown */ | ||
| 2514 | IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); | ||
| 2515 | } | ||
| 2516 | |||
| 2517 | /* Update the RDB entry */ | ||
| 2518 | priv->rx_queue.drv[i].host_addr = packet->dma_addr; | ||
| 2519 | } | ||
| 2520 | |||
| 2521 | #endif | ||
| 2522 | |||
| 2430 | static int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) | 2523 | static int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) |
| 2431 | { | 2524 | { |
| 2432 | struct ipw2100_status *status = &priv->status_queue.drv[i]; | 2525 | struct ipw2100_status *status = &priv->status_queue.drv[i]; |
| @@ -2558,7 +2651,7 @@ static void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
| 2558 | case P8023_DATA_VAL: | 2651 | case P8023_DATA_VAL: |
| 2559 | #ifdef CONFIG_IPW2100_MONITOR | 2652 | #ifdef CONFIG_IPW2100_MONITOR |
| 2560 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | 2653 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
| 2561 | isr_rx(priv, i, &stats); | 2654 | isr_rx_monitor(priv, i, &stats); |
| 2562 | break; | 2655 | break; |
| 2563 | } | 2656 | } |
| 2564 | #endif | 2657 | #endif |
| @@ -3750,7 +3843,7 @@ static ssize_t store_memory(struct device *d, struct device_attribute *attr, | |||
| 3750 | struct net_device *dev = priv->net_dev; | 3843 | struct net_device *dev = priv->net_dev; |
| 3751 | const char *p = buf; | 3844 | const char *p = buf; |
| 3752 | 3845 | ||
| 3753 | (void) dev; /* kill unused-var warning for debug-only code */ | 3846 | (void)dev; /* kill unused-var warning for debug-only code */ |
| 3754 | 3847 | ||
| 3755 | if (count < 1) | 3848 | if (count < 1) |
| 3756 | return count; | 3849 | return count; |
| @@ -3863,7 +3956,7 @@ static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) | |||
| 3863 | #ifdef CONFIG_IPW2100_MONITOR | 3956 | #ifdef CONFIG_IPW2100_MONITOR |
| 3864 | case IW_MODE_MONITOR: | 3957 | case IW_MODE_MONITOR: |
| 3865 | priv->last_mode = priv->ieee->iw_mode; | 3958 | priv->last_mode = priv->ieee->iw_mode; |
| 3866 | priv->net_dev->type = ARPHRD_IEEE80211; | 3959 | priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; |
| 3867 | break; | 3960 | break; |
| 3868 | #endif /* CONFIG_IPW2100_MONITOR */ | 3961 | #endif /* CONFIG_IPW2100_MONITOR */ |
| 3869 | } | 3962 | } |
| @@ -4070,7 +4163,7 @@ static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, | |||
| 4070 | unsigned long val; | 4163 | unsigned long val; |
| 4071 | char *p = buffer; | 4164 | char *p = buffer; |
| 4072 | 4165 | ||
| 4073 | (void) dev; /* kill unused-var warning for debug-only code */ | 4166 | (void)dev; /* kill unused-var warning for debug-only code */ |
| 4074 | 4167 | ||
| 4075 | IPW_DEBUG_INFO("enter\n"); | 4168 | IPW_DEBUG_INFO("enter\n"); |
| 4076 | 4169 | ||
| @@ -4119,7 +4212,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
| 4119 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", | 4212 | IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", |
| 4120 | disable_radio ? "OFF" : "ON"); | 4213 | disable_radio ? "OFF" : "ON"); |
| 4121 | 4214 | ||
| 4122 | down(&priv->action_sem); | 4215 | mutex_lock(&priv->action_mutex); |
| 4123 | 4216 | ||
| 4124 | if (disable_radio) { | 4217 | if (disable_radio) { |
| 4125 | priv->status |= STATUS_RF_KILL_SW; | 4218 | priv->status |= STATUS_RF_KILL_SW; |
| @@ -4137,7 +4230,7 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) | |||
| 4137 | schedule_reset(priv); | 4230 | schedule_reset(priv); |
| 4138 | } | 4231 | } |
| 4139 | 4232 | ||
| 4140 | up(&priv->action_sem); | 4233 | mutex_unlock(&priv->action_mutex); |
| 4141 | return 1; | 4234 | return 1; |
| 4142 | } | 4235 | } |
| 4143 | 4236 | ||
| @@ -5107,12 +5200,13 @@ static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) | |||
| 5107 | .host_command_length = 4 | 5200 | .host_command_length = 4 |
| 5108 | }; | 5201 | }; |
| 5109 | int err = 0; | 5202 | int err = 0; |
| 5203 | u32 tmp = tx_power; | ||
| 5110 | 5204 | ||
| 5111 | if (tx_power != IPW_TX_POWER_DEFAULT) | 5205 | if (tx_power != IPW_TX_POWER_DEFAULT) |
| 5112 | tx_power = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / | 5206 | tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / |
| 5113 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); | 5207 | (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); |
| 5114 | 5208 | ||
| 5115 | cmd.host_command_parameters[0] = tx_power; | 5209 | cmd.host_command_parameters[0] = tmp; |
| 5116 | 5210 | ||
| 5117 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | 5211 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) |
| 5118 | err = ipw2100_hw_send_command(priv, &cmd); | 5212 | err = ipw2100_hw_send_command(priv, &cmd); |
| @@ -5365,9 +5459,12 @@ static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) | |||
| 5365 | SEC_LEVEL_0, 0, 1); | 5459 | SEC_LEVEL_0, 0, 1); |
| 5366 | } else { | 5460 | } else { |
| 5367 | auth_mode = IPW_AUTH_OPEN; | 5461 | auth_mode = IPW_AUTH_OPEN; |
| 5368 | if ((priv->ieee->sec.flags & SEC_AUTH_MODE) && | 5462 | if (priv->ieee->sec.flags & SEC_AUTH_MODE) { |
| 5369 | (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) | 5463 | if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) |
| 5370 | auth_mode = IPW_AUTH_SHARED; | 5464 | auth_mode = IPW_AUTH_SHARED; |
| 5465 | else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP) | ||
| 5466 | auth_mode = IPW_AUTH_LEAP_CISCO_ID; | ||
| 5467 | } | ||
| 5371 | 5468 | ||
| 5372 | sec_level = SEC_LEVEL_0; | 5469 | sec_level = SEC_LEVEL_0; |
| 5373 | if (priv->ieee->sec.flags & SEC_LEVEL) | 5470 | if (priv->ieee->sec.flags & SEC_LEVEL) |
| @@ -5437,7 +5534,7 @@ static void shim__set_security(struct net_device *dev, | |||
| 5437 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 5534 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
| 5438 | int i, force_update = 0; | 5535 | int i, force_update = 0; |
| 5439 | 5536 | ||
| 5440 | down(&priv->action_sem); | 5537 | mutex_lock(&priv->action_mutex); |
| 5441 | if (!(priv->status & STATUS_INITIALIZED)) | 5538 | if (!(priv->status & STATUS_INITIALIZED)) |
| 5442 | goto done; | 5539 | goto done; |
| 5443 | 5540 | ||
| @@ -5510,7 +5607,7 @@ static void shim__set_security(struct net_device *dev, | |||
| 5510 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) | 5607 | if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) |
| 5511 | ipw2100_configure_security(priv, 0); | 5608 | ipw2100_configure_security(priv, 0); |
| 5512 | done: | 5609 | done: |
| 5513 | up(&priv->action_sem); | 5610 | mutex_unlock(&priv->action_mutex); |
| 5514 | } | 5611 | } |
| 5515 | 5612 | ||
| 5516 | static int ipw2100_adapter_setup(struct ipw2100_priv *priv) | 5613 | static int ipw2100_adapter_setup(struct ipw2100_priv *priv) |
| @@ -5634,7 +5731,7 @@ static int ipw2100_set_address(struct net_device *dev, void *p) | |||
| 5634 | if (!is_valid_ether_addr(addr->sa_data)) | 5731 | if (!is_valid_ether_addr(addr->sa_data)) |
| 5635 | return -EADDRNOTAVAIL; | 5732 | return -EADDRNOTAVAIL; |
| 5636 | 5733 | ||
| 5637 | down(&priv->action_sem); | 5734 | mutex_lock(&priv->action_mutex); |
| 5638 | 5735 | ||
| 5639 | priv->config |= CFG_CUSTOM_MAC; | 5736 | priv->config |= CFG_CUSTOM_MAC; |
| 5640 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); | 5737 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); |
| @@ -5644,12 +5741,12 @@ static int ipw2100_set_address(struct net_device *dev, void *p) | |||
| 5644 | goto done; | 5741 | goto done; |
| 5645 | 5742 | ||
| 5646 | priv->reset_backoff = 0; | 5743 | priv->reset_backoff = 0; |
| 5647 | up(&priv->action_sem); | 5744 | mutex_unlock(&priv->action_mutex); |
| 5648 | ipw2100_reset_adapter(priv); | 5745 | ipw2100_reset_adapter(priv); |
| 5649 | return 0; | 5746 | return 0; |
| 5650 | 5747 | ||
| 5651 | done: | 5748 | done: |
| 5652 | up(&priv->action_sem); | 5749 | mutex_unlock(&priv->action_mutex); |
| 5653 | return err; | 5750 | return err; |
| 5654 | } | 5751 | } |
| 5655 | 5752 | ||
| @@ -5760,6 +5857,9 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) | |||
| 5760 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { | 5857 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { |
| 5761 | sec.auth_mode = WLAN_AUTH_OPEN; | 5858 | sec.auth_mode = WLAN_AUTH_OPEN; |
| 5762 | ieee->open_wep = 1; | 5859 | ieee->open_wep = 1; |
| 5860 | } else if (value & IW_AUTH_ALG_LEAP) { | ||
| 5861 | sec.auth_mode = WLAN_AUTH_LEAP; | ||
| 5862 | ieee->open_wep = 1; | ||
| 5763 | } else | 5863 | } else |
| 5764 | return -EINVAL; | 5864 | return -EINVAL; |
| 5765 | 5865 | ||
| @@ -5771,8 +5871,8 @@ static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) | |||
| 5771 | return ret; | 5871 | return ret; |
| 5772 | } | 5872 | } |
| 5773 | 5873 | ||
| 5774 | void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, | 5874 | static void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, |
| 5775 | char *wpa_ie, int wpa_ie_len) | 5875 | char *wpa_ie, int wpa_ie_len) |
| 5776 | { | 5876 | { |
| 5777 | 5877 | ||
| 5778 | struct ipw2100_wpa_assoc_frame frame; | 5878 | struct ipw2100_wpa_assoc_frame frame; |
| @@ -5989,8 +6089,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, | |||
| 5989 | strcpy(priv->nick, "ipw2100"); | 6089 | strcpy(priv->nick, "ipw2100"); |
| 5990 | 6090 | ||
| 5991 | spin_lock_init(&priv->low_lock); | 6091 | spin_lock_init(&priv->low_lock); |
| 5992 | sema_init(&priv->action_sem, 1); | 6092 | mutex_init(&priv->action_mutex); |
| 5993 | sema_init(&priv->adapter_sem, 1); | 6093 | mutex_init(&priv->adapter_mutex); |
| 5994 | 6094 | ||
| 5995 | init_waitqueue_head(&priv->wait_command_queue); | 6095 | init_waitqueue_head(&priv->wait_command_queue); |
| 5996 | 6096 | ||
| @@ -6155,7 +6255,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
| 6155 | * member to call a function that then just turns and calls ipw2100_up. | 6255 | * member to call a function that then just turns and calls ipw2100_up. |
| 6156 | * net_dev->init is called after name allocation but before the | 6256 | * net_dev->init is called after name allocation but before the |
| 6157 | * notifier chain is called */ | 6257 | * notifier chain is called */ |
| 6158 | down(&priv->action_sem); | 6258 | mutex_lock(&priv->action_mutex); |
| 6159 | err = register_netdev(dev); | 6259 | err = register_netdev(dev); |
| 6160 | if (err) { | 6260 | if (err) { |
| 6161 | printk(KERN_WARNING DRV_NAME | 6261 | printk(KERN_WARNING DRV_NAME |
| @@ -6191,12 +6291,12 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
| 6191 | 6291 | ||
| 6192 | priv->status |= STATUS_INITIALIZED; | 6292 | priv->status |= STATUS_INITIALIZED; |
| 6193 | 6293 | ||
| 6194 | up(&priv->action_sem); | 6294 | mutex_unlock(&priv->action_mutex); |
| 6195 | 6295 | ||
| 6196 | return 0; | 6296 | return 0; |
| 6197 | 6297 | ||
| 6198 | fail_unlock: | 6298 | fail_unlock: |
| 6199 | up(&priv->action_sem); | 6299 | mutex_unlock(&priv->action_mutex); |
| 6200 | 6300 | ||
| 6201 | fail: | 6301 | fail: |
| 6202 | if (dev) { | 6302 | if (dev) { |
| @@ -6236,7 +6336,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
| 6236 | struct net_device *dev; | 6336 | struct net_device *dev; |
| 6237 | 6337 | ||
| 6238 | if (priv) { | 6338 | if (priv) { |
| 6239 | down(&priv->action_sem); | 6339 | mutex_lock(&priv->action_mutex); |
| 6240 | 6340 | ||
| 6241 | priv->status &= ~STATUS_INITIALIZED; | 6341 | priv->status &= ~STATUS_INITIALIZED; |
| 6242 | 6342 | ||
| @@ -6251,9 +6351,9 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev) | |||
| 6251 | /* Take down the hardware */ | 6351 | /* Take down the hardware */ |
| 6252 | ipw2100_down(priv); | 6352 | ipw2100_down(priv); |
| 6253 | 6353 | ||
| 6254 | /* Release the semaphore so that the network subsystem can | 6354 | /* Release the mutex so that the network subsystem can |
| 6255 | * complete any needed calls into the driver... */ | 6355 | * complete any needed calls into the driver... */ |
| 6256 | up(&priv->action_sem); | 6356 | mutex_unlock(&priv->action_mutex); |
| 6257 | 6357 | ||
| 6258 | /* Unregister the device first - this results in close() | 6358 | /* Unregister the device first - this results in close() |
| 6259 | * being called if the device is open. If we free storage | 6359 | * being called if the device is open. If we free storage |
| @@ -6292,7 +6392,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
| 6292 | 6392 | ||
| 6293 | IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); | 6393 | IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); |
| 6294 | 6394 | ||
| 6295 | down(&priv->action_sem); | 6395 | mutex_lock(&priv->action_mutex); |
| 6296 | if (priv->status & STATUS_INITIALIZED) { | 6396 | if (priv->status & STATUS_INITIALIZED) { |
| 6297 | /* Take down the device; powers it off, etc. */ | 6397 | /* Take down the device; powers it off, etc. */ |
| 6298 | ipw2100_down(priv); | 6398 | ipw2100_down(priv); |
| @@ -6305,7 +6405,7 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
| 6305 | pci_disable_device(pci_dev); | 6405 | pci_disable_device(pci_dev); |
| 6306 | pci_set_power_state(pci_dev, PCI_D3hot); | 6406 | pci_set_power_state(pci_dev, PCI_D3hot); |
| 6307 | 6407 | ||
| 6308 | up(&priv->action_sem); | 6408 | mutex_unlock(&priv->action_mutex); |
| 6309 | 6409 | ||
| 6310 | return 0; | 6410 | return 0; |
| 6311 | } | 6411 | } |
| @@ -6319,7 +6419,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
| 6319 | if (IPW2100_PM_DISABLED) | 6419 | if (IPW2100_PM_DISABLED) |
| 6320 | return 0; | 6420 | return 0; |
| 6321 | 6421 | ||
| 6322 | down(&priv->action_sem); | 6422 | mutex_lock(&priv->action_mutex); |
| 6323 | 6423 | ||
| 6324 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); | 6424 | IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); |
| 6325 | 6425 | ||
| @@ -6345,7 +6445,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev) | |||
| 6345 | if (!(priv->status & STATUS_RF_KILL_SW)) | 6445 | if (!(priv->status & STATUS_RF_KILL_SW)) |
| 6346 | ipw2100_up(priv, 0); | 6446 | ipw2100_up(priv, 0); |
| 6347 | 6447 | ||
| 6348 | up(&priv->action_sem); | 6448 | mutex_unlock(&priv->action_mutex); |
| 6349 | 6449 | ||
| 6350 | return 0; | 6450 | return 0; |
| 6351 | } | 6451 | } |
| @@ -6509,7 +6609,7 @@ static int ipw2100_wx_set_freq(struct net_device *dev, | |||
| 6509 | if (priv->ieee->iw_mode == IW_MODE_INFRA) | 6609 | if (priv->ieee->iw_mode == IW_MODE_INFRA) |
| 6510 | return -EOPNOTSUPP; | 6610 | return -EOPNOTSUPP; |
| 6511 | 6611 | ||
| 6512 | down(&priv->action_sem); | 6612 | mutex_lock(&priv->action_mutex); |
| 6513 | if (!(priv->status & STATUS_INITIALIZED)) { | 6613 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 6514 | err = -EIO; | 6614 | err = -EIO; |
| 6515 | goto done; | 6615 | goto done; |
| @@ -6540,7 +6640,7 @@ static int ipw2100_wx_set_freq(struct net_device *dev, | |||
| 6540 | } | 6640 | } |
| 6541 | 6641 | ||
| 6542 | done: | 6642 | done: |
| 6543 | up(&priv->action_sem); | 6643 | mutex_unlock(&priv->action_mutex); |
| 6544 | return err; | 6644 | return err; |
| 6545 | } | 6645 | } |
| 6546 | 6646 | ||
| @@ -6581,7 +6681,7 @@ static int ipw2100_wx_set_mode(struct net_device *dev, | |||
| 6581 | if (wrqu->mode == priv->ieee->iw_mode) | 6681 | if (wrqu->mode == priv->ieee->iw_mode) |
| 6582 | return 0; | 6682 | return 0; |
| 6583 | 6683 | ||
| 6584 | down(&priv->action_sem); | 6684 | mutex_lock(&priv->action_mutex); |
| 6585 | if (!(priv->status & STATUS_INITIALIZED)) { | 6685 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 6586 | err = -EIO; | 6686 | err = -EIO; |
| 6587 | goto done; | 6687 | goto done; |
| @@ -6604,7 +6704,7 @@ static int ipw2100_wx_set_mode(struct net_device *dev, | |||
| 6604 | } | 6704 | } |
| 6605 | 6705 | ||
| 6606 | done: | 6706 | done: |
| 6607 | up(&priv->action_sem); | 6707 | mutex_unlock(&priv->action_mutex); |
| 6608 | return err; | 6708 | return err; |
| 6609 | } | 6709 | } |
| 6610 | 6710 | ||
| @@ -6786,7 +6886,7 @@ static int ipw2100_wx_set_wap(struct net_device *dev, | |||
| 6786 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) | 6886 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) |
| 6787 | return -EINVAL; | 6887 | return -EINVAL; |
| 6788 | 6888 | ||
| 6789 | down(&priv->action_sem); | 6889 | mutex_lock(&priv->action_mutex); |
| 6790 | if (!(priv->status & STATUS_INITIALIZED)) { | 6890 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 6791 | err = -EIO; | 6891 | err = -EIO; |
| 6792 | goto done; | 6892 | goto done; |
| @@ -6815,7 +6915,7 @@ static int ipw2100_wx_set_wap(struct net_device *dev, | |||
| 6815 | wrqu->ap_addr.sa_data[5] & 0xff); | 6915 | wrqu->ap_addr.sa_data[5] & 0xff); |
| 6816 | 6916 | ||
| 6817 | done: | 6917 | done: |
| 6818 | up(&priv->action_sem); | 6918 | mutex_unlock(&priv->action_mutex); |
| 6819 | return err; | 6919 | return err; |
| 6820 | } | 6920 | } |
| 6821 | 6921 | ||
| @@ -6851,7 +6951,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, | |||
| 6851 | int length = 0; | 6951 | int length = 0; |
| 6852 | int err = 0; | 6952 | int err = 0; |
| 6853 | 6953 | ||
| 6854 | down(&priv->action_sem); | 6954 | mutex_lock(&priv->action_mutex); |
| 6855 | if (!(priv->status & STATUS_INITIALIZED)) { | 6955 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 6856 | err = -EIO; | 6956 | err = -EIO; |
| 6857 | goto done; | 6957 | goto done; |
| @@ -6888,7 +6988,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, | |||
| 6888 | err = ipw2100_set_essid(priv, essid, length, 0); | 6988 | err = ipw2100_set_essid(priv, essid, length, 0); |
| 6889 | 6989 | ||
| 6890 | done: | 6990 | done: |
| 6891 | up(&priv->action_sem); | 6991 | mutex_unlock(&priv->action_mutex); |
| 6892 | return err; | 6992 | return err; |
| 6893 | } | 6993 | } |
| 6894 | 6994 | ||
| @@ -6969,7 +7069,7 @@ static int ipw2100_wx_set_rate(struct net_device *dev, | |||
| 6969 | u32 rate; | 7069 | u32 rate; |
| 6970 | int err = 0; | 7070 | int err = 0; |
| 6971 | 7071 | ||
| 6972 | down(&priv->action_sem); | 7072 | mutex_lock(&priv->action_mutex); |
| 6973 | if (!(priv->status & STATUS_INITIALIZED)) { | 7073 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 6974 | err = -EIO; | 7074 | err = -EIO; |
| 6975 | goto done; | 7075 | goto done; |
| @@ -6996,7 +7096,7 @@ static int ipw2100_wx_set_rate(struct net_device *dev, | |||
| 6996 | 7096 | ||
| 6997 | IPW_DEBUG_WX("SET Rate -> %04X \n", rate); | 7097 | IPW_DEBUG_WX("SET Rate -> %04X \n", rate); |
| 6998 | done: | 7098 | done: |
| 6999 | up(&priv->action_sem); | 7099 | mutex_unlock(&priv->action_mutex); |
| 7000 | return err; | 7100 | return err; |
| 7001 | } | 7101 | } |
| 7002 | 7102 | ||
| @@ -7016,7 +7116,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev, | |||
| 7016 | return 0; | 7116 | return 0; |
| 7017 | } | 7117 | } |
| 7018 | 7118 | ||
| 7019 | down(&priv->action_sem); | 7119 | mutex_lock(&priv->action_mutex); |
| 7020 | if (!(priv->status & STATUS_INITIALIZED)) { | 7120 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7021 | err = -EIO; | 7121 | err = -EIO; |
| 7022 | goto done; | 7122 | goto done; |
| @@ -7048,7 +7148,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev, | |||
| 7048 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 7148 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
| 7049 | 7149 | ||
| 7050 | done: | 7150 | done: |
| 7051 | up(&priv->action_sem); | 7151 | mutex_unlock(&priv->action_mutex); |
| 7052 | return err; | 7152 | return err; |
| 7053 | } | 7153 | } |
| 7054 | 7154 | ||
| @@ -7063,7 +7163,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, | |||
| 7063 | if (wrqu->rts.fixed == 0) | 7163 | if (wrqu->rts.fixed == 0) |
| 7064 | return -EINVAL; | 7164 | return -EINVAL; |
| 7065 | 7165 | ||
| 7066 | down(&priv->action_sem); | 7166 | mutex_lock(&priv->action_mutex); |
| 7067 | if (!(priv->status & STATUS_INITIALIZED)) { | 7167 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7068 | err = -EIO; | 7168 | err = -EIO; |
| 7069 | goto done; | 7169 | goto done; |
| @@ -7083,7 +7183,7 @@ static int ipw2100_wx_set_rts(struct net_device *dev, | |||
| 7083 | 7183 | ||
| 7084 | IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); | 7184 | IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X \n", value); |
| 7085 | done: | 7185 | done: |
| 7086 | up(&priv->action_sem); | 7186 | mutex_unlock(&priv->action_mutex); |
| 7087 | return err; | 7187 | return err; |
| 7088 | } | 7188 | } |
| 7089 | 7189 | ||
| @@ -7134,7 +7234,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
| 7134 | value = wrqu->txpower.value; | 7234 | value = wrqu->txpower.value; |
| 7135 | } | 7235 | } |
| 7136 | 7236 | ||
| 7137 | down(&priv->action_sem); | 7237 | mutex_lock(&priv->action_mutex); |
| 7138 | if (!(priv->status & STATUS_INITIALIZED)) { | 7238 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7139 | err = -EIO; | 7239 | err = -EIO; |
| 7140 | goto done; | 7240 | goto done; |
| @@ -7145,7 +7245,7 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
| 7145 | IPW_DEBUG_WX("SET TX Power -> %d \n", value); | 7245 | IPW_DEBUG_WX("SET TX Power -> %d \n", value); |
| 7146 | 7246 | ||
| 7147 | done: | 7247 | done: |
| 7148 | up(&priv->action_sem); | 7248 | mutex_unlock(&priv->action_mutex); |
| 7149 | return err; | 7249 | return err; |
| 7150 | } | 7250 | } |
| 7151 | 7251 | ||
| @@ -7237,7 +7337,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
| 7237 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) | 7337 | if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) |
| 7238 | return 0; | 7338 | return 0; |
| 7239 | 7339 | ||
| 7240 | down(&priv->action_sem); | 7340 | mutex_lock(&priv->action_mutex); |
| 7241 | if (!(priv->status & STATUS_INITIALIZED)) { | 7341 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7242 | err = -EIO; | 7342 | err = -EIO; |
| 7243 | goto done; | 7343 | goto done; |
| @@ -7264,7 +7364,7 @@ static int ipw2100_wx_set_retry(struct net_device *dev, | |||
| 7264 | IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); | 7364 | IPW_DEBUG_WX("SET Both Retry Limits -> %d \n", wrqu->retry.value); |
| 7265 | 7365 | ||
| 7266 | done: | 7366 | done: |
| 7267 | up(&priv->action_sem); | 7367 | mutex_unlock(&priv->action_mutex); |
| 7268 | return err; | 7368 | return err; |
| 7269 | } | 7369 | } |
| 7270 | 7370 | ||
| @@ -7307,7 +7407,7 @@ static int ipw2100_wx_set_scan(struct net_device *dev, | |||
| 7307 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7407 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
| 7308 | int err = 0; | 7408 | int err = 0; |
| 7309 | 7409 | ||
| 7310 | down(&priv->action_sem); | 7410 | mutex_lock(&priv->action_mutex); |
| 7311 | if (!(priv->status & STATUS_INITIALIZED)) { | 7411 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7312 | err = -EIO; | 7412 | err = -EIO; |
| 7313 | goto done; | 7413 | goto done; |
| @@ -7322,7 +7422,7 @@ static int ipw2100_wx_set_scan(struct net_device *dev, | |||
| 7322 | } | 7422 | } |
| 7323 | 7423 | ||
| 7324 | done: | 7424 | done: |
| 7325 | up(&priv->action_sem); | 7425 | mutex_unlock(&priv->action_mutex); |
| 7326 | return err; | 7426 | return err; |
| 7327 | } | 7427 | } |
| 7328 | 7428 | ||
| @@ -7372,7 +7472,7 @@ static int ipw2100_wx_set_power(struct net_device *dev, | |||
| 7372 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7472 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
| 7373 | int err = 0; | 7473 | int err = 0; |
| 7374 | 7474 | ||
| 7375 | down(&priv->action_sem); | 7475 | mutex_lock(&priv->action_mutex); |
| 7376 | if (!(priv->status & STATUS_INITIALIZED)) { | 7476 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7377 | err = -EIO; | 7477 | err = -EIO; |
| 7378 | goto done; | 7478 | goto done; |
| @@ -7405,7 +7505,7 @@ static int ipw2100_wx_set_power(struct net_device *dev, | |||
| 7405 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); | 7505 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
| 7406 | 7506 | ||
| 7407 | done: | 7507 | done: |
| 7408 | up(&priv->action_sem); | 7508 | mutex_unlock(&priv->action_mutex); |
| 7409 | return err; | 7509 | return err; |
| 7410 | 7510 | ||
| 7411 | } | 7511 | } |
| @@ -7709,7 +7809,7 @@ static int ipw2100_wx_set_promisc(struct net_device *dev, | |||
| 7709 | int enable = (parms[0] > 0); | 7809 | int enable = (parms[0] > 0); |
| 7710 | int err = 0; | 7810 | int err = 0; |
| 7711 | 7811 | ||
| 7712 | down(&priv->action_sem); | 7812 | mutex_lock(&priv->action_mutex); |
| 7713 | if (!(priv->status & STATUS_INITIALIZED)) { | 7813 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7714 | err = -EIO; | 7814 | err = -EIO; |
| 7715 | goto done; | 7815 | goto done; |
| @@ -7727,7 +7827,7 @@ static int ipw2100_wx_set_promisc(struct net_device *dev, | |||
| 7727 | err = ipw2100_switch_mode(priv, priv->last_mode); | 7827 | err = ipw2100_switch_mode(priv, priv->last_mode); |
| 7728 | } | 7828 | } |
| 7729 | done: | 7829 | done: |
| 7730 | up(&priv->action_sem); | 7830 | mutex_unlock(&priv->action_mutex); |
| 7731 | return err; | 7831 | return err; |
| 7732 | } | 7832 | } |
| 7733 | 7833 | ||
| @@ -7750,7 +7850,7 @@ static int ipw2100_wx_set_powermode(struct net_device *dev, | |||
| 7750 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7850 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
| 7751 | int err = 0, mode = *(int *)extra; | 7851 | int err = 0, mode = *(int *)extra; |
| 7752 | 7852 | ||
| 7753 | down(&priv->action_sem); | 7853 | mutex_lock(&priv->action_mutex); |
| 7754 | if (!(priv->status & STATUS_INITIALIZED)) { | 7854 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7755 | err = -EIO; | 7855 | err = -EIO; |
| 7756 | goto done; | 7856 | goto done; |
| @@ -7762,7 +7862,7 @@ static int ipw2100_wx_set_powermode(struct net_device *dev, | |||
| 7762 | if (priv->power_mode != mode) | 7862 | if (priv->power_mode != mode) |
| 7763 | err = ipw2100_set_power_mode(priv, mode); | 7863 | err = ipw2100_set_power_mode(priv, mode); |
| 7764 | done: | 7864 | done: |
| 7765 | up(&priv->action_sem); | 7865 | mutex_unlock(&priv->action_mutex); |
| 7766 | return err; | 7866 | return err; |
| 7767 | } | 7867 | } |
| 7768 | 7868 | ||
| @@ -7814,7 +7914,7 @@ static int ipw2100_wx_set_preamble(struct net_device *dev, | |||
| 7814 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7914 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
| 7815 | int err, mode = *(int *)extra; | 7915 | int err, mode = *(int *)extra; |
| 7816 | 7916 | ||
| 7817 | down(&priv->action_sem); | 7917 | mutex_lock(&priv->action_mutex); |
| 7818 | if (!(priv->status & STATUS_INITIALIZED)) { | 7918 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7819 | err = -EIO; | 7919 | err = -EIO; |
| 7820 | goto done; | 7920 | goto done; |
| @@ -7832,7 +7932,7 @@ static int ipw2100_wx_set_preamble(struct net_device *dev, | |||
| 7832 | err = ipw2100_system_config(priv, 0); | 7932 | err = ipw2100_system_config(priv, 0); |
| 7833 | 7933 | ||
| 7834 | done: | 7934 | done: |
| 7835 | up(&priv->action_sem); | 7935 | mutex_unlock(&priv->action_mutex); |
| 7836 | return err; | 7936 | return err; |
| 7837 | } | 7937 | } |
| 7838 | 7938 | ||
| @@ -7862,7 +7962,7 @@ static int ipw2100_wx_set_crc_check(struct net_device *dev, | |||
| 7862 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7962 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
| 7863 | int err, mode = *(int *)extra; | 7963 | int err, mode = *(int *)extra; |
| 7864 | 7964 | ||
| 7865 | down(&priv->action_sem); | 7965 | mutex_lock(&priv->action_mutex); |
| 7866 | if (!(priv->status & STATUS_INITIALIZED)) { | 7966 | if (!(priv->status & STATUS_INITIALIZED)) { |
| 7867 | err = -EIO; | 7967 | err = -EIO; |
| 7868 | goto done; | 7968 | goto done; |
| @@ -7879,7 +7979,7 @@ static int ipw2100_wx_set_crc_check(struct net_device *dev, | |||
| 7879 | err = 0; | 7979 | err = 0; |
| 7880 | 7980 | ||
| 7881 | done: | 7981 | done: |
| 7882 | up(&priv->action_sem); | 7982 | mutex_unlock(&priv->action_mutex); |
| 7883 | return err; | 7983 | return err; |
| 7884 | } | 7984 | } |
| 7885 | 7985 | ||
| @@ -8184,11 +8284,11 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
| 8184 | if (priv->status & STATUS_STOPPING) | 8284 | if (priv->status & STATUS_STOPPING) |
| 8185 | return; | 8285 | return; |
| 8186 | 8286 | ||
| 8187 | down(&priv->action_sem); | 8287 | mutex_lock(&priv->action_mutex); |
| 8188 | 8288 | ||
| 8189 | IPW_DEBUG_WX("enter\n"); | 8289 | IPW_DEBUG_WX("enter\n"); |
| 8190 | 8290 | ||
| 8191 | up(&priv->action_sem); | 8291 | mutex_unlock(&priv->action_mutex); |
| 8192 | 8292 | ||
| 8193 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | 8293 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 8194 | 8294 | ||
| @@ -8211,7 +8311,7 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
| 8211 | 8311 | ||
| 8212 | if (!(priv->status & STATUS_ASSOCIATED)) { | 8312 | if (!(priv->status & STATUS_ASSOCIATED)) { |
| 8213 | IPW_DEBUG_WX("Configuring ESSID\n"); | 8313 | IPW_DEBUG_WX("Configuring ESSID\n"); |
| 8214 | down(&priv->action_sem); | 8314 | mutex_lock(&priv->action_mutex); |
| 8215 | /* This is a disassociation event, so kick the firmware to | 8315 | /* This is a disassociation event, so kick the firmware to |
| 8216 | * look for another AP */ | 8316 | * look for another AP */ |
| 8217 | if (priv->config & CFG_STATIC_ESSID) | 8317 | if (priv->config & CFG_STATIC_ESSID) |
| @@ -8219,7 +8319,7 @@ static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | |||
| 8219 | 0); | 8319 | 0); |
| 8220 | else | 8320 | else |
| 8221 | ipw2100_set_essid(priv, NULL, 0, 0); | 8321 | ipw2100_set_essid(priv, NULL, 0, 0); |
| 8222 | up(&priv->action_sem); | 8322 | mutex_unlock(&priv->action_mutex); |
| 8223 | } | 8323 | } |
| 8224 | 8324 | ||
| 8225 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); | 8325 | wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); |
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index f6c51441fa87..55b7227198df 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | ||
| 3 | Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify it | 5 | This program is free software; you can redistribute it and/or modify it |
| 6 | under the terms of version 2 of the GNU General Public License as | 6 | under the terms of version 2 of the GNU General Public License as |
| @@ -41,7 +41,12 @@ | |||
| 41 | 41 | ||
| 42 | #include <net/ieee80211.h> | 42 | #include <net/ieee80211.h> |
| 43 | 43 | ||
| 44 | #ifdef CONFIG_IPW2100_MONITOR | ||
| 45 | #include <net/ieee80211_radiotap.h> | ||
| 46 | #endif | ||
| 47 | |||
| 44 | #include <linux/workqueue.h> | 48 | #include <linux/workqueue.h> |
| 49 | #include <linux/mutex.h> | ||
| 45 | 50 | ||
| 46 | struct ipw2100_priv; | 51 | struct ipw2100_priv; |
| 47 | struct ipw2100_tx_packet; | 52 | struct ipw2100_tx_packet; |
| @@ -392,8 +397,10 @@ struct ipw2100_notification { | |||
| 392 | #define IPW_WEP104_CIPHER (1<<5) | 397 | #define IPW_WEP104_CIPHER (1<<5) |
| 393 | #define IPW_CKIP_CIPHER (1<<6) | 398 | #define IPW_CKIP_CIPHER (1<<6) |
| 394 | 399 | ||
| 395 | #define IPW_AUTH_OPEN 0 | 400 | #define IPW_AUTH_OPEN 0 |
| 396 | #define IPW_AUTH_SHARED 1 | 401 | #define IPW_AUTH_SHARED 1 |
| 402 | #define IPW_AUTH_LEAP 2 | ||
| 403 | #define IPW_AUTH_LEAP_CISCO_ID 0x80 | ||
| 397 | 404 | ||
| 398 | struct statistic { | 405 | struct statistic { |
| 399 | int value; | 406 | int value; |
| @@ -588,8 +595,8 @@ struct ipw2100_priv { | |||
| 588 | int inta_other; | 595 | int inta_other; |
| 589 | 596 | ||
| 590 | spinlock_t low_lock; | 597 | spinlock_t low_lock; |
| 591 | struct semaphore action_sem; | 598 | struct mutex action_mutex; |
| 592 | struct semaphore adapter_sem; | 599 | struct mutex adapter_mutex; |
| 593 | 600 | ||
| 594 | wait_queue_head_t wait_command_queue; | 601 | wait_queue_head_t wait_command_queue; |
| 595 | }; | 602 | }; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 287676ad80df..9dce522526c5 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | ||
| 3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. |
| 4 | 4 | ||
| 5 | 802.11 status code portion of this file from ethereal-0.10.6: | 5 | 802.11 status code portion of this file from ethereal-0.10.6: |
| 6 | Copyright 2000, Axis Communications AB | 6 | Copyright 2000, Axis Communications AB |
| @@ -33,9 +33,9 @@ | |||
| 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.1.1" |
| 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-2006 Intel Corporation" |
| 39 | #define DRV_VERSION IPW2200_VERSION | 39 | #define DRV_VERSION IPW2200_VERSION |
| 40 | 40 | ||
| 41 | #define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) | 41 | #define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) |
| @@ -55,7 +55,9 @@ static int associate = 1; | |||
| 55 | static int auto_create = 1; | 55 | static int auto_create = 1; |
| 56 | static int led = 0; | 56 | static int led = 0; |
| 57 | static int disable = 0; | 57 | static int disable = 0; |
| 58 | static int hwcrypto = 1; | 58 | static int bt_coexist = 0; |
| 59 | static int hwcrypto = 0; | ||
| 60 | static int roaming = 1; | ||
| 59 | static const char ipw_modes[] = { | 61 | static const char ipw_modes[] = { |
| 60 | 'a', 'b', 'g', '?' | 62 | 'a', 'b', 'g', '?' |
| 61 | }; | 63 | }; |
| @@ -151,12 +153,6 @@ static int init_supported_rates(struct ipw_priv *priv, | |||
| 151 | static void ipw_set_hwcrypto_keys(struct ipw_priv *); | 153 | static void ipw_set_hwcrypto_keys(struct ipw_priv *); |
| 152 | static void ipw_send_wep_keys(struct ipw_priv *, int); | 154 | static void ipw_send_wep_keys(struct ipw_priv *, int); |
| 153 | 155 | ||
| 154 | static int ipw_is_valid_channel(struct ieee80211_device *, u8); | ||
| 155 | static int ipw_channel_to_index(struct ieee80211_device *, u8); | ||
| 156 | static u8 ipw_freq_to_channel(struct ieee80211_device *, u32); | ||
| 157 | static int ipw_set_geo(struct ieee80211_device *, const struct ieee80211_geo *); | ||
| 158 | static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *); | ||
| 159 | |||
| 160 | static int snprint_line(char *buf, size_t count, | 156 | static int snprint_line(char *buf, size_t count, |
| 161 | const u8 * data, u32 len, u32 ofs) | 157 | const u8 * data, u32 len, u32 ofs) |
| 162 | { | 158 | { |
| @@ -227,12 +223,15 @@ static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) | |||
| 227 | return total; | 223 | return total; |
| 228 | } | 224 | } |
| 229 | 225 | ||
| 226 | /* alias for 32-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ | ||
| 230 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); | 227 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); |
| 231 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) | 228 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) |
| 232 | 229 | ||
| 230 | /* alias for 8-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ | ||
| 233 | static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); | 231 | static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); |
| 234 | #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) | 232 | #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) |
| 235 | 233 | ||
| 234 | /* 8-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
| 236 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); | 235 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); |
| 237 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | 236 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) |
| 238 | { | 237 | { |
| @@ -241,6 +240,7 @@ static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | |||
| 241 | _ipw_write_reg8(a, b, c); | 240 | _ipw_write_reg8(a, b, c); |
| 242 | } | 241 | } |
| 243 | 242 | ||
| 243 | /* 16-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
| 244 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); | 244 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); |
| 245 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | 245 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) |
| 246 | { | 246 | { |
| @@ -249,6 +249,7 @@ static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | |||
| 249 | _ipw_write_reg16(a, b, c); | 249 | _ipw_write_reg16(a, b, c); |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | /* 32-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
| 252 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); | 253 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); |
| 253 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | 254 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) |
| 254 | { | 255 | { |
| @@ -257,48 +258,70 @@ static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | |||
| 257 | _ipw_write_reg32(a, b, c); | 258 | _ipw_write_reg32(a, b, c); |
| 258 | } | 259 | } |
| 259 | 260 | ||
| 261 | /* 8-bit direct write (low 4K) */ | ||
| 260 | #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) | 262 | #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) |
| 263 | |||
| 264 | /* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
| 261 | #define ipw_write8(ipw, ofs, val) \ | 265 | #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)); \ | 266 | IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
| 263 | _ipw_write8(ipw, ofs, val) | 267 | _ipw_write8(ipw, ofs, val) |
| 264 | 268 | ||
| 269 | /* 16-bit direct write (low 4K) */ | ||
| 265 | #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) | 270 | #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) |
| 271 | |||
| 272 | /* 16-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
| 266 | #define ipw_write16(ipw, ofs, val) \ | 273 | #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)); \ | 274 | IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
| 268 | _ipw_write16(ipw, ofs, val) | 275 | _ipw_write16(ipw, ofs, val) |
| 269 | 276 | ||
| 277 | /* 32-bit direct write (low 4K) */ | ||
| 270 | #define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) | 278 | #define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) |
| 279 | |||
| 280 | /* 32-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
| 271 | #define ipw_write32(ipw, ofs, val) \ | 281 | #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)); \ | 282 | IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
| 273 | _ipw_write32(ipw, ofs, val) | 283 | _ipw_write32(ipw, ofs, val) |
| 274 | 284 | ||
| 285 | /* 8-bit direct read (low 4K) */ | ||
| 275 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) | 286 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) |
| 287 | |||
| 288 | /* 8-bit direct read (low 4K), with debug wrapper */ | ||
| 276 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 289 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
| 277 | { | 290 | { |
| 278 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); | 291 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); |
| 279 | return _ipw_read8(ipw, ofs); | 292 | return _ipw_read8(ipw, ofs); |
| 280 | } | 293 | } |
| 281 | 294 | ||
| 295 | /* 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) | 296 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) |
| 283 | 297 | ||
| 298 | /* 16-bit direct read (low 4K) */ | ||
| 284 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) | 299 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) |
| 300 | |||
| 301 | /* 16-bit direct read (low 4K), with debug wrapper */ | ||
| 285 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 302 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
| 286 | { | 303 | { |
| 287 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); | 304 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); |
| 288 | return _ipw_read16(ipw, ofs); | 305 | return _ipw_read16(ipw, ofs); |
| 289 | } | 306 | } |
| 290 | 307 | ||
| 308 | /* 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) | 309 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) |
| 292 | 310 | ||
| 311 | /* 32-bit direct read (low 4K) */ | ||
| 293 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) | 312 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) |
| 313 | |||
| 314 | /* 32-bit direct read (low 4K), with debug wrapper */ | ||
| 294 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 315 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
| 295 | { | 316 | { |
| 296 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); | 317 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); |
| 297 | return _ipw_read32(ipw, ofs); | 318 | return _ipw_read32(ipw, ofs); |
| 298 | } | 319 | } |
| 299 | 320 | ||
| 321 | /* 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) | 322 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) |
| 301 | 323 | ||
| 324 | /* multi-byte read (above 4K), with debug wrapper */ | ||
| 302 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | 325 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); |
| 303 | static inline void __ipw_read_indirect(const char *f, int l, | 326 | static inline void __ipw_read_indirect(const char *f, int l, |
| 304 | struct ipw_priv *a, u32 b, u8 * c, int d) | 327 | struct ipw_priv *a, u32 b, u8 * c, int d) |
| @@ -308,15 +331,17 @@ static inline void __ipw_read_indirect(const char *f, int l, | |||
| 308 | _ipw_read_indirect(a, b, c, d); | 331 | _ipw_read_indirect(a, b, c, d); |
| 309 | } | 332 | } |
| 310 | 333 | ||
| 334 | /* 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) | 335 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) |
| 312 | 336 | ||
| 337 | /* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ | ||
| 313 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, | 338 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, |
| 314 | int num); | 339 | int num); |
| 315 | #define ipw_write_indirect(a, b, c, d) \ | 340 | #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); \ | 341 | 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) | 342 | _ipw_write_indirect(a, b, c, d) |
| 318 | 343 | ||
| 319 | /* indirect write s */ | 344 | /* 32-bit indirect write (above 4K) */ |
| 320 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | 345 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) |
| 321 | { | 346 | { |
| 322 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); | 347 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); |
| @@ -324,22 +349,29 @@ static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | |||
| 324 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); | 349 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); |
| 325 | } | 350 | } |
| 326 | 351 | ||
| 352 | /* 8-bit indirect write (above 4K) */ | ||
| 327 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) | 353 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) |
| 328 | { | 354 | { |
| 355 | u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ | ||
| 356 | u32 dif_len = reg - aligned_addr; | ||
| 357 | |||
| 329 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 358 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
| 330 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); | 359 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
| 331 | _ipw_write8(priv, IPW_INDIRECT_DATA, value); | 360 | _ipw_write8(priv, IPW_INDIRECT_DATA + dif_len, value); |
| 332 | } | 361 | } |
| 333 | 362 | ||
| 363 | /* 16-bit indirect write (above 4K) */ | ||
| 334 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | 364 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) |
| 335 | { | 365 | { |
| 366 | u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ | ||
| 367 | u32 dif_len = (reg - aligned_addr) & (~0x1ul); | ||
| 368 | |||
| 336 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 369 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
| 337 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); | 370 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
| 338 | _ipw_write16(priv, IPW_INDIRECT_DATA, value); | 371 | _ipw_write16(priv, IPW_INDIRECT_DATA + dif_len, value); |
| 339 | } | 372 | } |
| 340 | 373 | ||
| 341 | /* indirect read s */ | 374 | /* 8-bit indirect read (above 4K) */ |
| 342 | |||
| 343 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | 375 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) |
| 344 | { | 376 | { |
| 345 | u32 word; | 377 | u32 word; |
| @@ -349,6 +381,7 @@ static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | |||
| 349 | return (word >> ((reg & 0x3) * 8)) & 0xff; | 381 | return (word >> ((reg & 0x3) * 8)) & 0xff; |
| 350 | } | 382 | } |
| 351 | 383 | ||
| 384 | /* 32-bit indirect read (above 4K) */ | ||
| 352 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | 385 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) |
| 353 | { | 386 | { |
| 354 | u32 value; | 387 | u32 value; |
| @@ -361,11 +394,12 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
| 361 | return value; | 394 | return value; |
| 362 | } | 395 | } |
| 363 | 396 | ||
| 364 | /* iterative/auto-increment 32 bit reads and writes */ | 397 | /* General purpose, no alignment requirement, iterative (multi-byte) read, */ |
| 398 | /* for area above 1st 4K of SRAM/reg space */ | ||
| 365 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 399 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
| 366 | int num) | 400 | int num) |
| 367 | { | 401 | { |
| 368 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; | 402 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ |
| 369 | u32 dif_len = addr - aligned_addr; | 403 | u32 dif_len = addr - aligned_addr; |
| 370 | u32 i; | 404 | u32 i; |
| 371 | 405 | ||
| @@ -375,7 +409,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
| 375 | return; | 409 | return; |
| 376 | } | 410 | } |
| 377 | 411 | ||
| 378 | /* Read the first nibble byte by byte */ | 412 | /* Read the first dword (or portion) byte by byte */ |
| 379 | if (unlikely(dif_len)) { | 413 | if (unlikely(dif_len)) { |
| 380 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 414 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
| 381 | /* Start reading at aligned_addr + dif_len */ | 415 | /* Start reading at aligned_addr + dif_len */ |
| @@ -384,11 +418,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
| 384 | aligned_addr += 4; | 418 | aligned_addr += 4; |
| 385 | } | 419 | } |
| 386 | 420 | ||
| 421 | /* Read all of the middle dwords as dwords, with auto-increment */ | ||
| 387 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); | 422 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
| 388 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) | 423 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
| 389 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); | 424 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); |
| 390 | 425 | ||
| 391 | /* Copy the last nibble */ | 426 | /* Read the last dword (or portion) byte by byte */ |
| 392 | if (unlikely(num)) { | 427 | if (unlikely(num)) { |
| 393 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 428 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
| 394 | for (i = 0; num > 0; i++, num--) | 429 | for (i = 0; num > 0; i++, num--) |
| @@ -396,10 +431,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
| 396 | } | 431 | } |
| 397 | } | 432 | } |
| 398 | 433 | ||
| 434 | /* General purpose, no alignment requirement, iterative (multi-byte) write, */ | ||
| 435 | /* for area above 1st 4K of SRAM/reg space */ | ||
| 399 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 436 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
| 400 | int num) | 437 | int num) |
| 401 | { | 438 | { |
| 402 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; | 439 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ |
| 403 | u32 dif_len = addr - aligned_addr; | 440 | u32 dif_len = addr - aligned_addr; |
| 404 | u32 i; | 441 | u32 i; |
| 405 | 442 | ||
| @@ -409,20 +446,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
| 409 | return; | 446 | return; |
| 410 | } | 447 | } |
| 411 | 448 | ||
| 412 | /* Write the first nibble byte by byte */ | 449 | /* Write the first dword (or portion) byte by byte */ |
| 413 | if (unlikely(dif_len)) { | 450 | if (unlikely(dif_len)) { |
| 414 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 451 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
| 415 | /* Start reading at aligned_addr + dif_len */ | 452 | /* Start writing at aligned_addr + dif_len */ |
| 416 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) | 453 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) |
| 417 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); | 454 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
| 418 | aligned_addr += 4; | 455 | aligned_addr += 4; |
| 419 | } | 456 | } |
| 420 | 457 | ||
| 458 | /* Write all of the middle dwords as dwords, with auto-increment */ | ||
| 421 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); | 459 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
| 422 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) | 460 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
| 423 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); | 461 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); |
| 424 | 462 | ||
| 425 | /* Copy the last nibble */ | 463 | /* Write the last dword (or portion) byte by byte */ |
| 426 | if (unlikely(num)) { | 464 | if (unlikely(num)) { |
| 427 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 465 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
| 428 | for (i = 0; num > 0; i++, num--, buf++) | 466 | for (i = 0; num > 0; i++, num--, buf++) |
| @@ -430,17 +468,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
| 430 | } | 468 | } |
| 431 | } | 469 | } |
| 432 | 470 | ||
| 471 | /* General purpose, no alignment requirement, iterative (multi-byte) write, */ | ||
| 472 | /* for 1st 4K of SRAM/regs space */ | ||
| 433 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, | 473 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, |
| 434 | int num) | 474 | int num) |
| 435 | { | 475 | { |
| 436 | memcpy_toio((priv->hw_base + addr), buf, num); | 476 | memcpy_toio((priv->hw_base + addr), buf, num); |
| 437 | } | 477 | } |
| 438 | 478 | ||
| 479 | /* Set bit(s) in low 4K of SRAM/regs */ | ||
| 439 | static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) | 480 | static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) |
| 440 | { | 481 | { |
| 441 | ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); | 482 | ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); |
| 442 | } | 483 | } |
| 443 | 484 | ||
| 485 | /* Clear bit(s) in low 4K of SRAM/regs */ | ||
| 444 | static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) | 486 | static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) |
| 445 | { | 487 | { |
| 446 | ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); | 488 | ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); |
| @@ -701,7 +743,7 @@ static void ipw_init_ordinals(struct ipw_priv *priv) | |||
| 701 | 743 | ||
| 702 | } | 744 | } |
| 703 | 745 | ||
| 704 | u32 ipw_register_toggle(u32 reg) | 746 | static u32 ipw_register_toggle(u32 reg) |
| 705 | { | 747 | { |
| 706 | reg &= ~IPW_START_STANDBY; | 748 | reg &= ~IPW_START_STANDBY; |
| 707 | if (reg & IPW_GATE_ODMA) | 749 | if (reg & IPW_GATE_ODMA) |
| @@ -722,11 +764,11 @@ u32 ipw_register_toggle(u32 reg) | |||
| 722 | * - On radio OFF, turn off any LEDs started during radio on | 764 | * - On radio OFF, turn off any LEDs started during radio on |
| 723 | * | 765 | * |
| 724 | */ | 766 | */ |
| 725 | #define LD_TIME_LINK_ON 300 | 767 | #define LD_TIME_LINK_ON msecs_to_jiffies(300) |
| 726 | #define LD_TIME_LINK_OFF 2700 | 768 | #define LD_TIME_LINK_OFF msecs_to_jiffies(2700) |
| 727 | #define LD_TIME_ACT_ON 250 | 769 | #define LD_TIME_ACT_ON msecs_to_jiffies(250) |
| 728 | 770 | ||
| 729 | void ipw_led_link_on(struct ipw_priv *priv) | 771 | static void ipw_led_link_on(struct ipw_priv *priv) |
| 730 | { | 772 | { |
| 731 | unsigned long flags; | 773 | unsigned long flags; |
| 732 | u32 led; | 774 | u32 led; |
| @@ -764,12 +806,12 @@ void ipw_led_link_on(struct ipw_priv *priv) | |||
| 764 | static void ipw_bg_led_link_on(void *data) | 806 | static void ipw_bg_led_link_on(void *data) |
| 765 | { | 807 | { |
| 766 | struct ipw_priv *priv = data; | 808 | struct ipw_priv *priv = data; |
| 767 | down(&priv->sem); | 809 | mutex_lock(&priv->mutex); |
| 768 | ipw_led_link_on(data); | 810 | ipw_led_link_on(data); |
| 769 | up(&priv->sem); | 811 | mutex_unlock(&priv->mutex); |
| 770 | } | 812 | } |
| 771 | 813 | ||
| 772 | void ipw_led_link_off(struct ipw_priv *priv) | 814 | static void ipw_led_link_off(struct ipw_priv *priv) |
| 773 | { | 815 | { |
| 774 | unsigned long flags; | 816 | unsigned long flags; |
| 775 | u32 led; | 817 | u32 led; |
| @@ -808,9 +850,9 @@ void ipw_led_link_off(struct ipw_priv *priv) | |||
| 808 | static void ipw_bg_led_link_off(void *data) | 850 | static void ipw_bg_led_link_off(void *data) |
| 809 | { | 851 | { |
| 810 | struct ipw_priv *priv = data; | 852 | struct ipw_priv *priv = data; |
| 811 | down(&priv->sem); | 853 | mutex_lock(&priv->mutex); |
| 812 | ipw_led_link_off(data); | 854 | ipw_led_link_off(data); |
| 813 | up(&priv->sem); | 855 | mutex_unlock(&priv->mutex); |
| 814 | } | 856 | } |
| 815 | 857 | ||
| 816 | static void __ipw_led_activity_on(struct ipw_priv *priv) | 858 | static void __ipw_led_activity_on(struct ipw_priv *priv) |
| @@ -847,6 +889,7 @@ static void __ipw_led_activity_on(struct ipw_priv *priv) | |||
| 847 | } | 889 | } |
| 848 | } | 890 | } |
| 849 | 891 | ||
| 892 | #if 0 | ||
| 850 | void ipw_led_activity_on(struct ipw_priv *priv) | 893 | void ipw_led_activity_on(struct ipw_priv *priv) |
| 851 | { | 894 | { |
| 852 | unsigned long flags; | 895 | unsigned long flags; |
| @@ -854,8 +897,9 @@ void ipw_led_activity_on(struct ipw_priv *priv) | |||
| 854 | __ipw_led_activity_on(priv); | 897 | __ipw_led_activity_on(priv); |
| 855 | spin_unlock_irqrestore(&priv->lock, flags); | 898 | spin_unlock_irqrestore(&priv->lock, flags); |
| 856 | } | 899 | } |
| 900 | #endif /* 0 */ | ||
| 857 | 901 | ||
| 858 | void ipw_led_activity_off(struct ipw_priv *priv) | 902 | static void ipw_led_activity_off(struct ipw_priv *priv) |
| 859 | { | 903 | { |
| 860 | unsigned long flags; | 904 | unsigned long flags; |
| 861 | u32 led; | 905 | u32 led; |
| @@ -885,12 +929,12 @@ void ipw_led_activity_off(struct ipw_priv *priv) | |||
| 885 | static void ipw_bg_led_activity_off(void *data) | 929 | static void ipw_bg_led_activity_off(void *data) |
| 886 | { | 930 | { |
| 887 | struct ipw_priv *priv = data; | 931 | struct ipw_priv *priv = data; |
| 888 | down(&priv->sem); | 932 | mutex_lock(&priv->mutex); |
| 889 | ipw_led_activity_off(data); | 933 | ipw_led_activity_off(data); |
| 890 | up(&priv->sem); | 934 | mutex_unlock(&priv->mutex); |
| 891 | } | 935 | } |
| 892 | 936 | ||
| 893 | void ipw_led_band_on(struct ipw_priv *priv) | 937 | static void ipw_led_band_on(struct ipw_priv *priv) |
| 894 | { | 938 | { |
| 895 | unsigned long flags; | 939 | unsigned long flags; |
| 896 | u32 led; | 940 | u32 led; |
| @@ -925,7 +969,7 @@ void ipw_led_band_on(struct ipw_priv *priv) | |||
| 925 | spin_unlock_irqrestore(&priv->lock, flags); | 969 | spin_unlock_irqrestore(&priv->lock, flags); |
| 926 | } | 970 | } |
| 927 | 971 | ||
| 928 | void ipw_led_band_off(struct ipw_priv *priv) | 972 | static void ipw_led_band_off(struct ipw_priv *priv) |
| 929 | { | 973 | { |
| 930 | unsigned long flags; | 974 | unsigned long flags; |
| 931 | u32 led; | 975 | u32 led; |
| @@ -948,24 +992,24 @@ void ipw_led_band_off(struct ipw_priv *priv) | |||
| 948 | spin_unlock_irqrestore(&priv->lock, flags); | 992 | spin_unlock_irqrestore(&priv->lock, flags); |
| 949 | } | 993 | } |
| 950 | 994 | ||
| 951 | void ipw_led_radio_on(struct ipw_priv *priv) | 995 | static void ipw_led_radio_on(struct ipw_priv *priv) |
| 952 | { | 996 | { |
| 953 | ipw_led_link_on(priv); | 997 | ipw_led_link_on(priv); |
| 954 | } | 998 | } |
| 955 | 999 | ||
| 956 | void ipw_led_radio_off(struct ipw_priv *priv) | 1000 | static void ipw_led_radio_off(struct ipw_priv *priv) |
| 957 | { | 1001 | { |
| 958 | ipw_led_activity_off(priv); | 1002 | ipw_led_activity_off(priv); |
| 959 | ipw_led_link_off(priv); | 1003 | ipw_led_link_off(priv); |
| 960 | } | 1004 | } |
| 961 | 1005 | ||
| 962 | void ipw_led_link_up(struct ipw_priv *priv) | 1006 | static void ipw_led_link_up(struct ipw_priv *priv) |
| 963 | { | 1007 | { |
| 964 | /* Set the Link Led on for all nic types */ | 1008 | /* Set the Link Led on for all nic types */ |
| 965 | ipw_led_link_on(priv); | 1009 | ipw_led_link_on(priv); |
| 966 | } | 1010 | } |
| 967 | 1011 | ||
| 968 | void ipw_led_link_down(struct ipw_priv *priv) | 1012 | static void ipw_led_link_down(struct ipw_priv *priv) |
| 969 | { | 1013 | { |
| 970 | ipw_led_activity_off(priv); | 1014 | ipw_led_activity_off(priv); |
| 971 | ipw_led_link_off(priv); | 1015 | ipw_led_link_off(priv); |
| @@ -974,7 +1018,7 @@ void ipw_led_link_down(struct ipw_priv *priv) | |||
| 974 | ipw_led_radio_off(priv); | 1018 | ipw_led_radio_off(priv); |
| 975 | } | 1019 | } |
| 976 | 1020 | ||
| 977 | void ipw_led_init(struct ipw_priv *priv) | 1021 | static void ipw_led_init(struct ipw_priv *priv) |
| 978 | { | 1022 | { |
| 979 | priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; | 1023 | priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; |
| 980 | 1024 | ||
| @@ -1025,7 +1069,7 @@ void ipw_led_init(struct ipw_priv *priv) | |||
| 1025 | } | 1069 | } |
| 1026 | } | 1070 | } |
| 1027 | 1071 | ||
| 1028 | void ipw_led_shutdown(struct ipw_priv *priv) | 1072 | static void ipw_led_shutdown(struct ipw_priv *priv) |
| 1029 | { | 1073 | { |
| 1030 | ipw_led_activity_off(priv); | 1074 | ipw_led_activity_off(priv); |
| 1031 | ipw_led_link_off(priv); | 1075 | ipw_led_link_off(priv); |
| @@ -1074,6 +1118,7 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | |||
| 1074 | 1118 | ||
| 1075 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) | 1119 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) |
| 1076 | { | 1120 | { |
| 1121 | /* length = 1st dword in log */ | ||
| 1077 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); | 1122 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); |
| 1078 | } | 1123 | } |
| 1079 | 1124 | ||
| @@ -1603,7 +1648,7 @@ static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, | |||
| 1603 | break; | 1648 | break; |
| 1604 | } | 1649 | } |
| 1605 | 1650 | ||
| 1606 | if (ipw_is_valid_channel(priv->ieee, channel)) | 1651 | if (ieee80211_is_valid_channel(priv->ieee, channel)) |
| 1607 | priv->speed_scan[pos++] = channel; | 1652 | priv->speed_scan[pos++] = channel; |
| 1608 | else | 1653 | else |
| 1609 | IPW_WARNING("Skipping invalid channel request: %d\n", | 1654 | IPW_WARNING("Skipping invalid channel request: %d\n", |
| @@ -1751,9 +1796,9 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
| 1751 | } | 1796 | } |
| 1752 | 1797 | ||
| 1753 | if (inta & IPW_INTA_BIT_FATAL_ERROR) { | 1798 | if (inta & IPW_INTA_BIT_FATAL_ERROR) { |
| 1754 | IPW_ERROR("Firmware error detected. Restarting.\n"); | 1799 | IPW_WARNING("Firmware error detected. Restarting.\n"); |
| 1755 | if (priv->error) { | 1800 | if (priv->error) { |
| 1756 | IPW_ERROR("Sysfs 'error' log already exists.\n"); | 1801 | IPW_DEBUG_FW("Sysfs 'error' log already exists.\n"); |
| 1757 | #ifdef CONFIG_IPW2200_DEBUG | 1802 | #ifdef CONFIG_IPW2200_DEBUG |
| 1758 | if (ipw_debug_level & IPW_DL_FW_ERRORS) { | 1803 | if (ipw_debug_level & IPW_DL_FW_ERRORS) { |
| 1759 | struct ipw_fw_error *error = | 1804 | struct ipw_fw_error *error = |
| @@ -1766,10 +1811,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
| 1766 | } else { | 1811 | } else { |
| 1767 | priv->error = ipw_alloc_error_log(priv); | 1812 | priv->error = ipw_alloc_error_log(priv); |
| 1768 | if (priv->error) | 1813 | if (priv->error) |
| 1769 | IPW_ERROR("Sysfs 'error' log captured.\n"); | 1814 | IPW_DEBUG_FW("Sysfs 'error' log captured.\n"); |
| 1770 | else | 1815 | else |
| 1771 | IPW_ERROR("Error allocating sysfs 'error' " | 1816 | IPW_DEBUG_FW("Error allocating sysfs 'error' " |
| 1772 | "log.\n"); | 1817 | "log.\n"); |
| 1773 | #ifdef CONFIG_IPW2200_DEBUG | 1818 | #ifdef CONFIG_IPW2200_DEBUG |
| 1774 | if (ipw_debug_level & IPW_DL_FW_ERRORS) | 1819 | if (ipw_debug_level & IPW_DL_FW_ERRORS) |
| 1775 | ipw_dump_error_log(priv, priv->error); | 1820 | ipw_dump_error_log(priv, priv->error); |
| @@ -1870,7 +1915,8 @@ static char *get_cmd_string(u8 cmd) | |||
| 1870 | } | 1915 | } |
| 1871 | 1916 | ||
| 1872 | #define HOST_COMPLETE_TIMEOUT HZ | 1917 | #define HOST_COMPLETE_TIMEOUT HZ |
| 1873 | static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | 1918 | |
| 1919 | static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | ||
| 1874 | { | 1920 | { |
| 1875 | int rc = 0; | 1921 | int rc = 0; |
| 1876 | unsigned long flags; | 1922 | unsigned long flags; |
| @@ -1897,9 +1943,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", | 1943 | IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", |
| 1898 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, | 1944 | get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, |
| 1899 | priv->status); | 1945 | priv->status); |
| 1900 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | ||
| 1901 | 1946 | ||
| 1902 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, &cmd->param, cmd->len, 0); | 1947 | #ifndef DEBUG_CMD_WEP_KEY |
| 1948 | if (cmd->cmd == IPW_CMD_WEP_KEY) | ||
| 1949 | IPW_DEBUG_HC("WEP_KEY command masked out for secure.\n"); | ||
| 1950 | else | ||
| 1951 | #endif | ||
| 1952 | printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); | ||
| 1953 | |||
| 1954 | rc = ipw_queue_tx_hcmd(priv, cmd->cmd, cmd->param, cmd->len, 0); | ||
| 1903 | if (rc) { | 1955 | if (rc) { |
| 1904 | priv->status &= ~STATUS_HCMD_ACTIVE; | 1956 | priv->status &= ~STATUS_HCMD_ACTIVE; |
| 1905 | IPW_ERROR("Failed to send %s: Reason %d\n", | 1957 | IPW_ERROR("Failed to send %s: Reason %d\n", |
| @@ -1942,61 +1994,62 @@ static int ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
| 1942 | return rc; | 1994 | return rc; |
| 1943 | } | 1995 | } |
| 1944 | 1996 | ||
| 1945 | static int ipw_send_host_complete(struct ipw_priv *priv) | 1997 | static int ipw_send_cmd_simple(struct ipw_priv *priv, u8 command) |
| 1998 | { | ||
| 1999 | struct host_cmd cmd = { | ||
| 2000 | .cmd = command, | ||
| 2001 | }; | ||
| 2002 | |||
| 2003 | return __ipw_send_cmd(priv, &cmd); | ||
| 2004 | } | ||
| 2005 | |||
| 2006 | static int ipw_send_cmd_pdu(struct ipw_priv *priv, u8 command, u8 len, | ||
| 2007 | void *data) | ||
| 1946 | { | 2008 | { |
| 1947 | struct host_cmd cmd = { | 2009 | struct host_cmd cmd = { |
| 1948 | .cmd = IPW_CMD_HOST_COMPLETE, | 2010 | .cmd = command, |
| 1949 | .len = 0 | 2011 | .len = len, |
| 2012 | .param = data, | ||
| 1950 | }; | 2013 | }; |
| 1951 | 2014 | ||
| 2015 | return __ipw_send_cmd(priv, &cmd); | ||
| 2016 | } | ||
| 2017 | |||
| 2018 | static int ipw_send_host_complete(struct ipw_priv *priv) | ||
| 2019 | { | ||
| 1952 | if (!priv) { | 2020 | if (!priv) { |
| 1953 | IPW_ERROR("Invalid args\n"); | 2021 | IPW_ERROR("Invalid args\n"); |
| 1954 | return -1; | 2022 | return -1; |
| 1955 | } | 2023 | } |
| 1956 | 2024 | ||
| 1957 | return ipw_send_cmd(priv, &cmd); | 2025 | return ipw_send_cmd_simple(priv, IPW_CMD_HOST_COMPLETE); |
| 1958 | } | 2026 | } |
| 1959 | 2027 | ||
| 1960 | static int ipw_send_system_config(struct ipw_priv *priv, | 2028 | static int ipw_send_system_config(struct ipw_priv *priv, |
| 1961 | struct ipw_sys_config *config) | 2029 | struct ipw_sys_config *config) |
| 1962 | { | 2030 | { |
| 1963 | struct host_cmd cmd = { | ||
| 1964 | .cmd = IPW_CMD_SYSTEM_CONFIG, | ||
| 1965 | .len = sizeof(*config) | ||
| 1966 | }; | ||
| 1967 | |||
| 1968 | if (!priv || !config) { | 2031 | if (!priv || !config) { |
| 1969 | IPW_ERROR("Invalid args\n"); | 2032 | IPW_ERROR("Invalid args\n"); |
| 1970 | return -1; | 2033 | return -1; |
| 1971 | } | 2034 | } |
| 1972 | 2035 | ||
| 1973 | memcpy(cmd.param, config, sizeof(*config)); | 2036 | return ipw_send_cmd_pdu(priv, IPW_CMD_SYSTEM_CONFIG, sizeof(*config), |
| 1974 | return ipw_send_cmd(priv, &cmd); | 2037 | config); |
| 1975 | } | 2038 | } |
| 1976 | 2039 | ||
| 1977 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) | 2040 | static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) |
| 1978 | { | 2041 | { |
| 1979 | struct host_cmd cmd = { | ||
| 1980 | .cmd = IPW_CMD_SSID, | ||
| 1981 | .len = min(len, IW_ESSID_MAX_SIZE) | ||
| 1982 | }; | ||
| 1983 | |||
| 1984 | if (!priv || !ssid) { | 2042 | if (!priv || !ssid) { |
| 1985 | IPW_ERROR("Invalid args\n"); | 2043 | IPW_ERROR("Invalid args\n"); |
| 1986 | return -1; | 2044 | return -1; |
| 1987 | } | 2045 | } |
| 1988 | 2046 | ||
| 1989 | memcpy(cmd.param, ssid, cmd.len); | 2047 | return ipw_send_cmd_pdu(priv, IPW_CMD_SSID, min(len, IW_ESSID_MAX_SIZE), |
| 1990 | return ipw_send_cmd(priv, &cmd); | 2048 | ssid); |
| 1991 | } | 2049 | } |
| 1992 | 2050 | ||
| 1993 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | 2051 | static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) |
| 1994 | { | 2052 | { |
| 1995 | struct host_cmd cmd = { | ||
| 1996 | .cmd = IPW_CMD_ADAPTER_ADDRESS, | ||
| 1997 | .len = ETH_ALEN | ||
| 1998 | }; | ||
| 1999 | |||
| 2000 | if (!priv || !mac) { | 2053 | if (!priv || !mac) { |
| 2001 | IPW_ERROR("Invalid args\n"); | 2054 | IPW_ERROR("Invalid args\n"); |
| 2002 | return -1; | 2055 | return -1; |
| @@ -2005,8 +2058,7 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) | |||
| 2005 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", | 2058 | IPW_DEBUG_INFO("%s: Setting MAC to " MAC_FMT "\n", |
| 2006 | priv->net_dev->name, MAC_ARG(mac)); | 2059 | priv->net_dev->name, MAC_ARG(mac)); |
| 2007 | 2060 | ||
| 2008 | memcpy(cmd.param, mac, ETH_ALEN); | 2061 | return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac); |
| 2009 | return ipw_send_cmd(priv, &cmd); | ||
| 2010 | } | 2062 | } |
| 2011 | 2063 | ||
| 2012 | /* | 2064 | /* |
| @@ -2036,9 +2088,9 @@ static void ipw_adapter_restart(void *adapter) | |||
| 2036 | static void ipw_bg_adapter_restart(void *data) | 2088 | static void ipw_bg_adapter_restart(void *data) |
| 2037 | { | 2089 | { |
| 2038 | struct ipw_priv *priv = data; | 2090 | struct ipw_priv *priv = data; |
| 2039 | down(&priv->sem); | 2091 | mutex_lock(&priv->mutex); |
| 2040 | ipw_adapter_restart(data); | 2092 | ipw_adapter_restart(data); |
| 2041 | up(&priv->sem); | 2093 | mutex_unlock(&priv->mutex); |
| 2042 | } | 2094 | } |
| 2043 | 2095 | ||
| 2044 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) | 2096 | #define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) |
| @@ -2048,8 +2100,8 @@ static void ipw_scan_check(void *data) | |||
| 2048 | struct ipw_priv *priv = data; | 2100 | struct ipw_priv *priv = data; |
| 2049 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { | 2101 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { |
| 2050 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " | 2102 | IPW_DEBUG_SCAN("Scan completion watchdog resetting " |
| 2051 | "adapter (%dms).\n", | 2103 | "adapter after (%dms).\n", |
| 2052 | IPW_SCAN_CHECK_WATCHDOG / 100); | 2104 | jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG)); |
| 2053 | queue_work(priv->workqueue, &priv->adapter_restart); | 2105 | queue_work(priv->workqueue, &priv->adapter_restart); |
| 2054 | } | 2106 | } |
| 2055 | } | 2107 | } |
| @@ -2057,59 +2109,48 @@ static void ipw_scan_check(void *data) | |||
| 2057 | static void ipw_bg_scan_check(void *data) | 2109 | static void ipw_bg_scan_check(void *data) |
| 2058 | { | 2110 | { |
| 2059 | struct ipw_priv *priv = data; | 2111 | struct ipw_priv *priv = data; |
| 2060 | down(&priv->sem); | 2112 | mutex_lock(&priv->mutex); |
| 2061 | ipw_scan_check(data); | 2113 | ipw_scan_check(data); |
| 2062 | up(&priv->sem); | 2114 | mutex_unlock(&priv->mutex); |
| 2063 | } | 2115 | } |
| 2064 | 2116 | ||
| 2065 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, | 2117 | static int ipw_send_scan_request_ext(struct ipw_priv *priv, |
| 2066 | struct ipw_scan_request_ext *request) | 2118 | struct ipw_scan_request_ext *request) |
| 2067 | { | 2119 | { |
| 2068 | struct host_cmd cmd = { | 2120 | return ipw_send_cmd_pdu(priv, IPW_CMD_SCAN_REQUEST_EXT, |
| 2069 | .cmd = IPW_CMD_SCAN_REQUEST_EXT, | 2121 | sizeof(*request), request); |
| 2070 | .len = sizeof(*request) | ||
| 2071 | }; | ||
| 2072 | |||
| 2073 | memcpy(cmd.param, request, sizeof(*request)); | ||
| 2074 | return ipw_send_cmd(priv, &cmd); | ||
| 2075 | } | 2122 | } |
| 2076 | 2123 | ||
| 2077 | static int ipw_send_scan_abort(struct ipw_priv *priv) | 2124 | static int ipw_send_scan_abort(struct ipw_priv *priv) |
| 2078 | { | 2125 | { |
| 2079 | struct host_cmd cmd = { | ||
| 2080 | .cmd = IPW_CMD_SCAN_ABORT, | ||
| 2081 | .len = 0 | ||
| 2082 | }; | ||
| 2083 | |||
| 2084 | if (!priv) { | 2126 | if (!priv) { |
| 2085 | IPW_ERROR("Invalid args\n"); | 2127 | IPW_ERROR("Invalid args\n"); |
| 2086 | return -1; | 2128 | return -1; |
| 2087 | } | 2129 | } |
| 2088 | 2130 | ||
| 2089 | return ipw_send_cmd(priv, &cmd); | 2131 | return ipw_send_cmd_simple(priv, IPW_CMD_SCAN_ABORT); |
| 2090 | } | 2132 | } |
| 2091 | 2133 | ||
| 2092 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) | 2134 | static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) |
| 2093 | { | 2135 | { |
| 2094 | struct host_cmd cmd = { | 2136 | struct ipw_sensitivity_calib calib = { |
| 2095 | .cmd = IPW_CMD_SENSITIVITY_CALIB, | 2137 | .beacon_rssi_raw = sens, |
| 2096 | .len = sizeof(struct ipw_sensitivity_calib) | ||
| 2097 | }; | 2138 | }; |
| 2098 | struct ipw_sensitivity_calib *calib = (struct ipw_sensitivity_calib *) | 2139 | |
| 2099 | &cmd.param; | 2140 | return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib), |
| 2100 | calib->beacon_rssi_raw = sens; | 2141 | &calib); |
| 2101 | return ipw_send_cmd(priv, &cmd); | ||
| 2102 | } | 2142 | } |
| 2103 | 2143 | ||
| 2104 | static int ipw_send_associate(struct ipw_priv *priv, | 2144 | static int ipw_send_associate(struct ipw_priv *priv, |
| 2105 | struct ipw_associate *associate) | 2145 | struct ipw_associate *associate) |
| 2106 | { | 2146 | { |
| 2107 | struct host_cmd cmd = { | ||
| 2108 | .cmd = IPW_CMD_ASSOCIATE, | ||
| 2109 | .len = sizeof(*associate) | ||
| 2110 | }; | ||
| 2111 | |||
| 2112 | struct ipw_associate tmp_associate; | 2147 | struct ipw_associate tmp_associate; |
| 2148 | |||
| 2149 | if (!priv || !associate) { | ||
| 2150 | IPW_ERROR("Invalid args\n"); | ||
| 2151 | return -1; | ||
| 2152 | } | ||
| 2153 | |||
| 2113 | memcpy(&tmp_associate, associate, sizeof(*associate)); | 2154 | memcpy(&tmp_associate, associate, sizeof(*associate)); |
| 2114 | tmp_associate.policy_support = | 2155 | tmp_associate.policy_support = |
| 2115 | cpu_to_le16(tmp_associate.policy_support); | 2156 | cpu_to_le16(tmp_associate.policy_support); |
| @@ -2122,85 +2163,60 @@ static int ipw_send_associate(struct ipw_priv *priv, | |||
| 2122 | cpu_to_le16(tmp_associate.beacon_interval); | 2163 | cpu_to_le16(tmp_associate.beacon_interval); |
| 2123 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); | 2164 | tmp_associate.atim_window = cpu_to_le16(tmp_associate.atim_window); |
| 2124 | 2165 | ||
| 2125 | if (!priv || !associate) { | 2166 | return ipw_send_cmd_pdu(priv, IPW_CMD_ASSOCIATE, sizeof(tmp_associate), |
| 2126 | IPW_ERROR("Invalid args\n"); | 2167 | &tmp_associate); |
| 2127 | return -1; | ||
| 2128 | } | ||
| 2129 | |||
| 2130 | memcpy(cmd.param, &tmp_associate, sizeof(*associate)); | ||
| 2131 | return ipw_send_cmd(priv, &cmd); | ||
| 2132 | } | 2168 | } |
| 2133 | 2169 | ||
| 2134 | static int ipw_send_supported_rates(struct ipw_priv *priv, | 2170 | static int ipw_send_supported_rates(struct ipw_priv *priv, |
| 2135 | struct ipw_supported_rates *rates) | 2171 | struct ipw_supported_rates *rates) |
| 2136 | { | 2172 | { |
| 2137 | struct host_cmd cmd = { | ||
| 2138 | .cmd = IPW_CMD_SUPPORTED_RATES, | ||
| 2139 | .len = sizeof(*rates) | ||
| 2140 | }; | ||
| 2141 | |||
| 2142 | if (!priv || !rates) { | 2173 | if (!priv || !rates) { |
| 2143 | IPW_ERROR("Invalid args\n"); | 2174 | IPW_ERROR("Invalid args\n"); |
| 2144 | return -1; | 2175 | return -1; |
| 2145 | } | 2176 | } |
| 2146 | 2177 | ||
| 2147 | memcpy(cmd.param, rates, sizeof(*rates)); | 2178 | return ipw_send_cmd_pdu(priv, IPW_CMD_SUPPORTED_RATES, sizeof(*rates), |
| 2148 | return ipw_send_cmd(priv, &cmd); | 2179 | rates); |
| 2149 | } | 2180 | } |
| 2150 | 2181 | ||
| 2151 | static int ipw_set_random_seed(struct ipw_priv *priv) | 2182 | static int ipw_set_random_seed(struct ipw_priv *priv) |
| 2152 | { | 2183 | { |
| 2153 | struct host_cmd cmd = { | 2184 | u32 val; |
| 2154 | .cmd = IPW_CMD_SEED_NUMBER, | ||
| 2155 | .len = sizeof(u32) | ||
| 2156 | }; | ||
| 2157 | 2185 | ||
| 2158 | if (!priv) { | 2186 | if (!priv) { |
| 2159 | IPW_ERROR("Invalid args\n"); | 2187 | IPW_ERROR("Invalid args\n"); |
| 2160 | return -1; | 2188 | return -1; |
| 2161 | } | 2189 | } |
| 2162 | 2190 | ||
| 2163 | get_random_bytes(&cmd.param, sizeof(u32)); | 2191 | get_random_bytes(&val, sizeof(val)); |
| 2164 | 2192 | ||
| 2165 | return ipw_send_cmd(priv, &cmd); | 2193 | return ipw_send_cmd_pdu(priv, IPW_CMD_SEED_NUMBER, sizeof(val), &val); |
| 2166 | } | 2194 | } |
| 2167 | 2195 | ||
| 2168 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) | 2196 | static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) |
| 2169 | { | 2197 | { |
| 2170 | struct host_cmd cmd = { | ||
| 2171 | .cmd = IPW_CMD_CARD_DISABLE, | ||
| 2172 | .len = sizeof(u32) | ||
| 2173 | }; | ||
| 2174 | |||
| 2175 | if (!priv) { | 2198 | if (!priv) { |
| 2176 | IPW_ERROR("Invalid args\n"); | 2199 | IPW_ERROR("Invalid args\n"); |
| 2177 | return -1; | 2200 | return -1; |
| 2178 | } | 2201 | } |
| 2179 | 2202 | ||
| 2180 | *((u32 *) & cmd.param) = phy_off; | 2203 | return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off), |
| 2181 | 2204 | &phy_off); | |
| 2182 | return ipw_send_cmd(priv, &cmd); | ||
| 2183 | } | 2205 | } |
| 2184 | 2206 | ||
| 2185 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) | 2207 | static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) |
| 2186 | { | 2208 | { |
| 2187 | struct host_cmd cmd = { | ||
| 2188 | .cmd = IPW_CMD_TX_POWER, | ||
| 2189 | .len = sizeof(*power) | ||
| 2190 | }; | ||
| 2191 | |||
| 2192 | if (!priv || !power) { | 2209 | if (!priv || !power) { |
| 2193 | IPW_ERROR("Invalid args\n"); | 2210 | IPW_ERROR("Invalid args\n"); |
| 2194 | return -1; | 2211 | return -1; |
| 2195 | } | 2212 | } |
| 2196 | 2213 | ||
| 2197 | memcpy(cmd.param, power, sizeof(*power)); | 2214 | return ipw_send_cmd_pdu(priv, IPW_CMD_TX_POWER, sizeof(*power), power); |
| 2198 | return ipw_send_cmd(priv, &cmd); | ||
| 2199 | } | 2215 | } |
| 2200 | 2216 | ||
| 2201 | static int ipw_set_tx_power(struct ipw_priv *priv) | 2217 | static int ipw_set_tx_power(struct ipw_priv *priv) |
| 2202 | { | 2218 | { |
| 2203 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | 2219 | const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); |
| 2204 | struct ipw_tx_power tx_power; | 2220 | struct ipw_tx_power tx_power; |
| 2205 | s8 max_power; | 2221 | s8 max_power; |
| 2206 | int i; | 2222 | int i; |
| @@ -2247,18 +2263,14 @@ static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) | |||
| 2247 | struct ipw_rts_threshold rts_threshold = { | 2263 | struct ipw_rts_threshold rts_threshold = { |
| 2248 | .rts_threshold = rts, | 2264 | .rts_threshold = rts, |
| 2249 | }; | 2265 | }; |
| 2250 | struct host_cmd cmd = { | ||
| 2251 | .cmd = IPW_CMD_RTS_THRESHOLD, | ||
| 2252 | .len = sizeof(rts_threshold) | ||
| 2253 | }; | ||
| 2254 | 2266 | ||
| 2255 | if (!priv) { | 2267 | if (!priv) { |
| 2256 | IPW_ERROR("Invalid args\n"); | 2268 | IPW_ERROR("Invalid args\n"); |
| 2257 | return -1; | 2269 | return -1; |
| 2258 | } | 2270 | } |
| 2259 | 2271 | ||
| 2260 | memcpy(cmd.param, &rts_threshold, sizeof(rts_threshold)); | 2272 | return ipw_send_cmd_pdu(priv, IPW_CMD_RTS_THRESHOLD, |
| 2261 | return ipw_send_cmd(priv, &cmd); | 2273 | sizeof(rts_threshold), &rts_threshold); |
| 2262 | } | 2274 | } |
| 2263 | 2275 | ||
| 2264 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | 2276 | static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) |
| @@ -2266,27 +2278,19 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) | |||
| 2266 | struct ipw_frag_threshold frag_threshold = { | 2278 | struct ipw_frag_threshold frag_threshold = { |
| 2267 | .frag_threshold = frag, | 2279 | .frag_threshold = frag, |
| 2268 | }; | 2280 | }; |
| 2269 | struct host_cmd cmd = { | ||
| 2270 | .cmd = IPW_CMD_FRAG_THRESHOLD, | ||
| 2271 | .len = sizeof(frag_threshold) | ||
| 2272 | }; | ||
| 2273 | 2281 | ||
| 2274 | if (!priv) { | 2282 | if (!priv) { |
| 2275 | IPW_ERROR("Invalid args\n"); | 2283 | IPW_ERROR("Invalid args\n"); |
| 2276 | return -1; | 2284 | return -1; |
| 2277 | } | 2285 | } |
| 2278 | 2286 | ||
| 2279 | memcpy(cmd.param, &frag_threshold, sizeof(frag_threshold)); | 2287 | return ipw_send_cmd_pdu(priv, IPW_CMD_FRAG_THRESHOLD, |
| 2280 | return ipw_send_cmd(priv, &cmd); | 2288 | sizeof(frag_threshold), &frag_threshold); |
| 2281 | } | 2289 | } |
| 2282 | 2290 | ||
| 2283 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | 2291 | static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) |
| 2284 | { | 2292 | { |
| 2285 | struct host_cmd cmd = { | 2293 | u32 param; |
| 2286 | .cmd = IPW_CMD_POWER_MODE, | ||
| 2287 | .len = sizeof(u32) | ||
| 2288 | }; | ||
| 2289 | u32 *param = (u32 *) (&cmd.param); | ||
| 2290 | 2294 | ||
| 2291 | if (!priv) { | 2295 | if (!priv) { |
| 2292 | IPW_ERROR("Invalid args\n"); | 2296 | IPW_ERROR("Invalid args\n"); |
| @@ -2297,17 +2301,18 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) | |||
| 2297 | * level */ | 2301 | * level */ |
| 2298 | switch (mode) { | 2302 | switch (mode) { |
| 2299 | case IPW_POWER_BATTERY: | 2303 | case IPW_POWER_BATTERY: |
| 2300 | *param = IPW_POWER_INDEX_3; | 2304 | param = IPW_POWER_INDEX_3; |
| 2301 | break; | 2305 | break; |
| 2302 | case IPW_POWER_AC: | 2306 | case IPW_POWER_AC: |
| 2303 | *param = IPW_POWER_MODE_CAM; | 2307 | param = IPW_POWER_MODE_CAM; |
| 2304 | break; | 2308 | break; |
| 2305 | default: | 2309 | default: |
| 2306 | *param = mode; | 2310 | param = mode; |
| 2307 | break; | 2311 | break; |
| 2308 | } | 2312 | } |
| 2309 | 2313 | ||
| 2310 | return ipw_send_cmd(priv, &cmd); | 2314 | return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), |
| 2315 | ¶m); | ||
| 2311 | } | 2316 | } |
| 2312 | 2317 | ||
| 2313 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | 2318 | static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) |
| @@ -2316,18 +2321,14 @@ static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) | |||
| 2316 | .short_retry_limit = slimit, | 2321 | .short_retry_limit = slimit, |
| 2317 | .long_retry_limit = llimit | 2322 | .long_retry_limit = llimit |
| 2318 | }; | 2323 | }; |
| 2319 | struct host_cmd cmd = { | ||
| 2320 | .cmd = IPW_CMD_RETRY_LIMIT, | ||
| 2321 | .len = sizeof(retry_limit) | ||
| 2322 | }; | ||
| 2323 | 2324 | ||
| 2324 | if (!priv) { | 2325 | if (!priv) { |
| 2325 | IPW_ERROR("Invalid args\n"); | 2326 | IPW_ERROR("Invalid args\n"); |
| 2326 | return -1; | 2327 | return -1; |
| 2327 | } | 2328 | } |
| 2328 | 2329 | ||
| 2329 | memcpy(cmd.param, &retry_limit, sizeof(retry_limit)); | 2330 | return ipw_send_cmd_pdu(priv, IPW_CMD_RETRY_LIMIT, sizeof(retry_limit), |
| 2330 | return ipw_send_cmd(priv, &cmd); | 2331 | &retry_limit); |
| 2331 | } | 2332 | } |
| 2332 | 2333 | ||
| 2333 | /* | 2334 | /* |
| @@ -2454,7 +2455,7 @@ static void ipw_eeprom_init_sram(struct ipw_priv *priv) | |||
| 2454 | /* | 2455 | /* |
| 2455 | If the data looks correct, then copy it to our private | 2456 | If the data looks correct, then copy it to our private |
| 2456 | copy. Otherwise let the firmware know to perform the operation | 2457 | copy. Otherwise let the firmware know to perform the operation |
| 2457 | on it's own | 2458 | on its own. |
| 2458 | */ | 2459 | */ |
| 2459 | if (priv->eeprom[EEPROM_VERSION] != 0) { | 2460 | if (priv->eeprom[EEPROM_VERSION] != 0) { |
| 2460 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); | 2461 | IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); |
| @@ -2707,22 +2708,25 @@ static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, | |||
| 2707 | 2708 | ||
| 2708 | static int ipw_fw_dma_wait(struct ipw_priv *priv) | 2709 | static int ipw_fw_dma_wait(struct ipw_priv *priv) |
| 2709 | { | 2710 | { |
| 2710 | u32 current_index = 0; | 2711 | u32 current_index = 0, previous_index; |
| 2711 | u32 watchdog = 0; | 2712 | u32 watchdog = 0; |
| 2712 | 2713 | ||
| 2713 | IPW_DEBUG_FW(">> : \n"); | 2714 | IPW_DEBUG_FW(">> : \n"); |
| 2714 | 2715 | ||
| 2715 | current_index = ipw_fw_dma_command_block_index(priv); | 2716 | current_index = ipw_fw_dma_command_block_index(priv); |
| 2716 | IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%8X\n", | 2717 | IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%08X\n", |
| 2717 | (int)priv->sram_desc.last_cb_index); | 2718 | (int)priv->sram_desc.last_cb_index); |
| 2718 | 2719 | ||
| 2719 | while (current_index < priv->sram_desc.last_cb_index) { | 2720 | while (current_index < priv->sram_desc.last_cb_index) { |
| 2720 | udelay(50); | 2721 | udelay(50); |
| 2722 | previous_index = current_index; | ||
| 2721 | current_index = ipw_fw_dma_command_block_index(priv); | 2723 | current_index = ipw_fw_dma_command_block_index(priv); |
| 2722 | 2724 | ||
| 2723 | watchdog++; | 2725 | if (previous_index < current_index) { |
| 2724 | 2726 | watchdog = 0; | |
| 2725 | if (watchdog > 400) { | 2727 | continue; |
| 2728 | } | ||
| 2729 | if (++watchdog > 400) { | ||
| 2726 | IPW_DEBUG_FW_INFO("Timeout\n"); | 2730 | IPW_DEBUG_FW_INFO("Timeout\n"); |
| 2727 | ipw_fw_dma_dump_command_block(priv); | 2731 | ipw_fw_dma_dump_command_block(priv); |
| 2728 | ipw_fw_dma_abort(priv); | 2732 | ipw_fw_dma_abort(priv); |
| @@ -2772,6 +2776,7 @@ static inline int ipw_alive(struct ipw_priv *priv) | |||
| 2772 | return ipw_read32(priv, 0x90) == 0xd55555d5; | 2776 | return ipw_read32(priv, 0x90) == 0xd55555d5; |
| 2773 | } | 2777 | } |
| 2774 | 2778 | ||
| 2779 | /* timeout in msec, attempted in 10-msec quanta */ | ||
| 2775 | static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, | 2780 | static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, |
| 2776 | int timeout) | 2781 | int timeout) |
| 2777 | { | 2782 | { |
| @@ -2800,10 +2805,11 @@ static int ipw_stop_master(struct ipw_priv *priv) | |||
| 2800 | /* stop master. typical delay - 0 */ | 2805 | /* stop master. typical delay - 0 */ |
| 2801 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); | 2806 | ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); |
| 2802 | 2807 | ||
| 2808 | /* timeout is in msec, polled in 10-msec quanta */ | ||
| 2803 | rc = ipw_poll_bit(priv, IPW_RESET_REG, | 2809 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
| 2804 | IPW_RESET_REG_MASTER_DISABLED, 100); | 2810 | IPW_RESET_REG_MASTER_DISABLED, 100); |
| 2805 | if (rc < 0) { | 2811 | if (rc < 0) { |
| 2806 | IPW_ERROR("stop master failed in 10ms\n"); | 2812 | IPW_ERROR("wait for stop master failed after 100ms\n"); |
| 2807 | return -1; | 2813 | return -1; |
| 2808 | } | 2814 | } |
| 2809 | 2815 | ||
| @@ -2823,33 +2829,11 @@ static void ipw_arc_release(struct ipw_priv *priv) | |||
| 2823 | mdelay(5); | 2829 | mdelay(5); |
| 2824 | } | 2830 | } |
| 2825 | 2831 | ||
| 2826 | struct fw_header { | ||
| 2827 | u32 version; | ||
| 2828 | u32 mode; | ||
| 2829 | }; | ||
| 2830 | |||
| 2831 | struct fw_chunk { | 2832 | struct fw_chunk { |
| 2832 | u32 address; | 2833 | u32 address; |
| 2833 | u32 length; | 2834 | u32 length; |
| 2834 | }; | 2835 | }; |
| 2835 | 2836 | ||
| 2836 | #define IPW_FW_MAJOR_VERSION 2 | ||
| 2837 | #define IPW_FW_MINOR_VERSION 4 | ||
| 2838 | |||
| 2839 | #define IPW_FW_MINOR(x) ((x & 0xff) >> 8) | ||
| 2840 | #define IPW_FW_MAJOR(x) (x & 0xff) | ||
| 2841 | |||
| 2842 | #define IPW_FW_VERSION ((IPW_FW_MINOR_VERSION << 8) | IPW_FW_MAJOR_VERSION) | ||
| 2843 | |||
| 2844 | #define IPW_FW_PREFIX "ipw-" __stringify(IPW_FW_MAJOR_VERSION) \ | ||
| 2845 | "." __stringify(IPW_FW_MINOR_VERSION) "-" | ||
| 2846 | |||
| 2847 | #if IPW_FW_MAJOR_VERSION >= 2 && IPW_FW_MINOR_VERSION > 0 | ||
| 2848 | #define IPW_FW_NAME(x) IPW_FW_PREFIX "" x ".fw" | ||
| 2849 | #else | ||
| 2850 | #define IPW_FW_NAME(x) "ipw2200_" x ".fw" | ||
| 2851 | #endif | ||
| 2852 | |||
| 2853 | static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | 2837 | static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) |
| 2854 | { | 2838 | { |
| 2855 | int rc = 0, i, addr; | 2839 | int rc = 0, i, addr; |
| @@ -2890,8 +2874,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
| 2890 | mdelay(1); | 2874 | mdelay(1); |
| 2891 | 2875 | ||
| 2892 | /* enable ucode store */ | 2876 | /* enable ucode store */ |
| 2893 | ipw_write_reg8(priv, DINO_CONTROL_REG, 0x0); | 2877 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0x0); |
| 2894 | ipw_write_reg8(priv, DINO_CONTROL_REG, DINO_ENABLE_CS); | 2878 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_CS); |
| 2895 | mdelay(1); | 2879 | mdelay(1); |
| 2896 | 2880 | ||
| 2897 | /* write ucode */ | 2881 | /* write ucode */ |
| @@ -3036,7 +3020,7 @@ static int ipw_stop_nic(struct ipw_priv *priv) | |||
| 3036 | rc = ipw_poll_bit(priv, IPW_RESET_REG, | 3020 | rc = ipw_poll_bit(priv, IPW_RESET_REG, |
| 3037 | IPW_RESET_REG_MASTER_DISABLED, 500); | 3021 | IPW_RESET_REG_MASTER_DISABLED, 500); |
| 3038 | if (rc < 0) { | 3022 | if (rc < 0) { |
| 3039 | IPW_ERROR("wait for reg master disabled failed\n"); | 3023 | IPW_ERROR("wait for reg master disabled failed after 500ms\n"); |
| 3040 | return rc; | 3024 | return rc; |
| 3041 | } | 3025 | } |
| 3042 | 3026 | ||
| @@ -3118,33 +3102,47 @@ static int ipw_reset_nic(struct ipw_priv *priv) | |||
| 3118 | return rc; | 3102 | return rc; |
| 3119 | } | 3103 | } |
| 3120 | 3104 | ||
| 3105 | |||
| 3106 | struct ipw_fw { | ||
| 3107 | u32 ver; | ||
| 3108 | u32 boot_size; | ||
| 3109 | u32 ucode_size; | ||
| 3110 | u32 fw_size; | ||
| 3111 | u8 data[0]; | ||
| 3112 | }; | ||
| 3113 | |||
| 3121 | static int ipw_get_fw(struct ipw_priv *priv, | 3114 | static int ipw_get_fw(struct ipw_priv *priv, |
| 3122 | const struct firmware **fw, const char *name) | 3115 | const struct firmware **raw, const char *name) |
| 3123 | { | 3116 | { |
| 3124 | struct fw_header *header; | 3117 | struct ipw_fw *fw; |
| 3125 | int rc; | 3118 | int rc; |
| 3126 | 3119 | ||
| 3127 | /* ask firmware_class module to get the boot firmware off disk */ | 3120 | /* ask firmware_class module to get the boot firmware off disk */ |
| 3128 | rc = request_firmware(fw, name, &priv->pci_dev->dev); | 3121 | rc = request_firmware(raw, name, &priv->pci_dev->dev); |
| 3129 | if (rc < 0) { | 3122 | if (rc < 0) { |
| 3130 | IPW_ERROR("%s load failed: Reason %d\n", name, rc); | 3123 | IPW_ERROR("%s request_firmware failed: Reason %d\n", name, rc); |
| 3131 | return rc; | 3124 | return rc; |
| 3132 | } | 3125 | } |
| 3133 | 3126 | ||
| 3134 | header = (struct fw_header *)(*fw)->data; | 3127 | if ((*raw)->size < sizeof(*fw)) { |
| 3135 | if (IPW_FW_MAJOR(le32_to_cpu(header->version)) != IPW_FW_MAJOR_VERSION) { | 3128 | IPW_ERROR("%s is too small (%zd)\n", name, (*raw)->size); |
| 3136 | IPW_ERROR("'%s' firmware version not compatible (%d != %d)\n", | 3129 | return -EINVAL; |
| 3137 | name, | 3130 | } |
| 3138 | IPW_FW_MAJOR(le32_to_cpu(header->version)), | 3131 | |
| 3139 | IPW_FW_MAJOR_VERSION); | 3132 | fw = (void *)(*raw)->data; |
| 3133 | |||
| 3134 | if ((*raw)->size < sizeof(*fw) + | ||
| 3135 | fw->boot_size + fw->ucode_size + fw->fw_size) { | ||
| 3136 | IPW_ERROR("%s is too small or corrupt (%zd)\n", | ||
| 3137 | name, (*raw)->size); | ||
| 3140 | return -EINVAL; | 3138 | return -EINVAL; |
| 3141 | } | 3139 | } |
| 3142 | 3140 | ||
| 3143 | IPW_DEBUG_INFO("Loading firmware '%s' file v%d.%d (%zd bytes)\n", | 3141 | IPW_DEBUG_INFO("Read firmware '%s' image v%d.%d (%zd bytes)\n", |
| 3144 | name, | 3142 | name, |
| 3145 | IPW_FW_MAJOR(le32_to_cpu(header->version)), | 3143 | le32_to_cpu(fw->ver) >> 16, |
| 3146 | IPW_FW_MINOR(le32_to_cpu(header->version)), | 3144 | le32_to_cpu(fw->ver) & 0xff, |
| 3147 | (*fw)->size - sizeof(struct fw_header)); | 3145 | (*raw)->size - sizeof(*fw)); |
| 3148 | return 0; | 3146 | return 0; |
| 3149 | } | 3147 | } |
| 3150 | 3148 | ||
| @@ -3184,17 +3182,13 @@ static void ipw_rx_queue_reset(struct ipw_priv *priv, | |||
| 3184 | 3182 | ||
| 3185 | #ifdef CONFIG_PM | 3183 | #ifdef CONFIG_PM |
| 3186 | static int fw_loaded = 0; | 3184 | static int fw_loaded = 0; |
| 3187 | static const struct firmware *bootfw = NULL; | 3185 | static const struct firmware *raw = NULL; |
| 3188 | static const struct firmware *firmware = NULL; | ||
| 3189 | static const struct firmware *ucode = NULL; | ||
| 3190 | 3186 | ||
| 3191 | static void free_firmware(void) | 3187 | static void free_firmware(void) |
| 3192 | { | 3188 | { |
| 3193 | if (fw_loaded) { | 3189 | if (fw_loaded) { |
| 3194 | release_firmware(bootfw); | 3190 | release_firmware(raw); |
| 3195 | release_firmware(ucode); | 3191 | raw = NULL; |
| 3196 | release_firmware(firmware); | ||
| 3197 | bootfw = ucode = firmware = NULL; | ||
| 3198 | fw_loaded = 0; | 3192 | fw_loaded = 0; |
| 3199 | } | 3193 | } |
| 3200 | } | 3194 | } |
| @@ -3205,60 +3199,50 @@ static void free_firmware(void) | |||
| 3205 | static int ipw_load(struct ipw_priv *priv) | 3199 | static int ipw_load(struct ipw_priv *priv) |
| 3206 | { | 3200 | { |
| 3207 | #ifndef CONFIG_PM | 3201 | #ifndef CONFIG_PM |
| 3208 | const struct firmware *bootfw = NULL; | 3202 | const struct firmware *raw = NULL; |
| 3209 | const struct firmware *firmware = NULL; | ||
| 3210 | const struct firmware *ucode = NULL; | ||
| 3211 | #endif | 3203 | #endif |
| 3204 | struct ipw_fw *fw; | ||
| 3205 | u8 *boot_img, *ucode_img, *fw_img; | ||
| 3206 | u8 *name = NULL; | ||
| 3212 | int rc = 0, retries = 3; | 3207 | int rc = 0, retries = 3; |
| 3213 | 3208 | ||
| 3214 | #ifdef CONFIG_PM | 3209 | switch (priv->ieee->iw_mode) { |
| 3215 | if (!fw_loaded) { | 3210 | case IW_MODE_ADHOC: |
| 3216 | #endif | 3211 | name = "ipw2200-ibss.fw"; |
| 3217 | rc = ipw_get_fw(priv, &bootfw, IPW_FW_NAME("boot")); | 3212 | break; |
| 3218 | if (rc) | ||
| 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 | 3213 | #ifdef CONFIG_IPW2200_MONITOR |
| 3232 | case IW_MODE_MONITOR: | 3214 | case IW_MODE_MONITOR: |
| 3233 | rc = ipw_get_fw(priv, &ucode, | 3215 | name = "ipw2200-sniffer.fw"; |
| 3234 | IPW_FW_NAME("sniffer_ucode")); | 3216 | break; |
| 3235 | if (rc) | ||
| 3236 | goto error; | ||
| 3237 | |||
| 3238 | rc = ipw_get_fw(priv, &firmware, | ||
| 3239 | IPW_FW_NAME("sniffer")); | ||
| 3240 | break; | ||
| 3241 | #endif | 3217 | #endif |
| 3242 | case IW_MODE_INFRA: | 3218 | case IW_MODE_INFRA: |
| 3243 | rc = ipw_get_fw(priv, &ucode, IPW_FW_NAME("bss_ucode")); | 3219 | name = "ipw2200-bss.fw"; |
| 3244 | if (rc) | 3220 | break; |
| 3245 | goto error; | 3221 | } |
| 3246 | |||
| 3247 | rc = ipw_get_fw(priv, &firmware, IPW_FW_NAME("bss")); | ||
| 3248 | break; | ||
| 3249 | 3222 | ||
| 3250 | default: | 3223 | if (!name) { |
| 3251 | rc = -EINVAL; | 3224 | rc = -EINVAL; |
| 3252 | } | 3225 | goto error; |
| 3226 | } | ||
| 3253 | 3227 | ||
| 3254 | if (rc) | 3228 | #ifdef CONFIG_PM |
| 3229 | if (!fw_loaded) { | ||
| 3230 | #endif | ||
| 3231 | rc = ipw_get_fw(priv, &raw, name); | ||
| 3232 | if (rc < 0) | ||
| 3255 | goto error; | 3233 | goto error; |
| 3256 | |||
| 3257 | #ifdef CONFIG_PM | 3234 | #ifdef CONFIG_PM |
| 3258 | fw_loaded = 1; | ||
| 3259 | } | 3235 | } |
| 3260 | #endif | 3236 | #endif |
| 3261 | 3237 | ||
| 3238 | fw = (void *)raw->data; | ||
| 3239 | boot_img = &fw->data[0]; | ||
| 3240 | ucode_img = &fw->data[fw->boot_size]; | ||
| 3241 | fw_img = &fw->data[fw->boot_size + fw->ucode_size]; | ||
| 3242 | |||
| 3243 | if (rc < 0) | ||
| 3244 | goto error; | ||
| 3245 | |||
| 3262 | if (!priv->rxq) | 3246 | if (!priv->rxq) |
| 3263 | priv->rxq = ipw_rx_queue_alloc(priv); | 3247 | priv->rxq = ipw_rx_queue_alloc(priv); |
| 3264 | else | 3248 | else |
| @@ -3279,7 +3263,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3279 | ipw_stop_nic(priv); | 3263 | ipw_stop_nic(priv); |
| 3280 | 3264 | ||
| 3281 | rc = ipw_reset_nic(priv); | 3265 | rc = ipw_reset_nic(priv); |
| 3282 | if (rc) { | 3266 | if (rc < 0) { |
| 3283 | IPW_ERROR("Unable to reset NIC\n"); | 3267 | IPW_ERROR("Unable to reset NIC\n"); |
| 3284 | goto error; | 3268 | goto error; |
| 3285 | } | 3269 | } |
| @@ -3288,8 +3272,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3288 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); | 3272 | IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); |
| 3289 | 3273 | ||
| 3290 | /* DMA the initial boot firmware into the device */ | 3274 | /* DMA the initial boot firmware into the device */ |
| 3291 | rc = ipw_load_firmware(priv, bootfw->data + sizeof(struct fw_header), | 3275 | rc = ipw_load_firmware(priv, boot_img, fw->boot_size); |
| 3292 | bootfw->size - sizeof(struct fw_header)); | ||
| 3293 | if (rc < 0) { | 3276 | if (rc < 0) { |
| 3294 | IPW_ERROR("Unable to load boot firmware: %d\n", rc); | 3277 | IPW_ERROR("Unable to load boot firmware: %d\n", rc); |
| 3295 | goto error; | 3278 | goto error; |
| @@ -3298,7 +3281,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3298 | /* kick start the device */ | 3281 | /* kick start the device */ |
| 3299 | ipw_start_nic(priv); | 3282 | ipw_start_nic(priv); |
| 3300 | 3283 | ||
| 3301 | /* wait for the device to finish it's initial startup sequence */ | 3284 | /* wait for the device to finish its initial startup sequence */ |
| 3302 | rc = ipw_poll_bit(priv, IPW_INTA_RW, | 3285 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
| 3303 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3286 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
| 3304 | if (rc < 0) { | 3287 | if (rc < 0) { |
| @@ -3311,8 +3294,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3311 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); | 3294 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); |
| 3312 | 3295 | ||
| 3313 | /* DMA the ucode into the device */ | 3296 | /* DMA the ucode into the device */ |
| 3314 | rc = ipw_load_ucode(priv, ucode->data + sizeof(struct fw_header), | 3297 | rc = ipw_load_ucode(priv, ucode_img, fw->ucode_size); |
| 3315 | ucode->size - sizeof(struct fw_header)); | ||
| 3316 | if (rc < 0) { | 3298 | if (rc < 0) { |
| 3317 | IPW_ERROR("Unable to load ucode: %d\n", rc); | 3299 | IPW_ERROR("Unable to load ucode: %d\n", rc); |
| 3318 | goto error; | 3300 | goto error; |
| @@ -3322,18 +3304,19 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3322 | ipw_stop_nic(priv); | 3304 | ipw_stop_nic(priv); |
| 3323 | 3305 | ||
| 3324 | /* DMA bss firmware into the device */ | 3306 | /* DMA bss firmware into the device */ |
| 3325 | rc = ipw_load_firmware(priv, firmware->data + | 3307 | rc = ipw_load_firmware(priv, fw_img, fw->fw_size); |
| 3326 | sizeof(struct fw_header), | ||
| 3327 | firmware->size - sizeof(struct fw_header)); | ||
| 3328 | if (rc < 0) { | 3308 | if (rc < 0) { |
| 3329 | IPW_ERROR("Unable to load firmware: %d\n", rc); | 3309 | IPW_ERROR("Unable to load firmware: %d\n", rc); |
| 3330 | goto error; | 3310 | goto error; |
| 3331 | } | 3311 | } |
| 3312 | #ifdef CONFIG_PM | ||
| 3313 | fw_loaded = 1; | ||
| 3314 | #endif | ||
| 3332 | 3315 | ||
| 3333 | ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); | 3316 | ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); |
| 3334 | 3317 | ||
| 3335 | rc = ipw_queue_reset(priv); | 3318 | rc = ipw_queue_reset(priv); |
| 3336 | if (rc) { | 3319 | if (rc < 0) { |
| 3337 | IPW_ERROR("Unable to initialize queues\n"); | 3320 | IPW_ERROR("Unable to initialize queues\n"); |
| 3338 | goto error; | 3321 | goto error; |
| 3339 | } | 3322 | } |
| @@ -3362,7 +3345,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3362 | rc = ipw_poll_bit(priv, IPW_INTA_RW, | 3345 | rc = ipw_poll_bit(priv, IPW_INTA_RW, |
| 3363 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); | 3346 | IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); |
| 3364 | if (rc < 0) { | 3347 | if (rc < 0) { |
| 3365 | IPW_ERROR("device failed to start after 500ms\n"); | 3348 | IPW_ERROR("device failed to start within 500ms\n"); |
| 3366 | goto error; | 3349 | goto error; |
| 3367 | } | 3350 | } |
| 3368 | IPW_DEBUG_INFO("device response after %dms\n", rc); | 3351 | IPW_DEBUG_INFO("device response after %dms\n", rc); |
| @@ -3386,9 +3369,7 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3386 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); | 3369 | ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); |
| 3387 | 3370 | ||
| 3388 | #ifndef CONFIG_PM | 3371 | #ifndef CONFIG_PM |
| 3389 | release_firmware(bootfw); | 3372 | release_firmware(raw); |
| 3390 | release_firmware(ucode); | ||
| 3391 | release_firmware(firmware); | ||
| 3392 | #endif | 3373 | #endif |
| 3393 | return 0; | 3374 | return 0; |
| 3394 | 3375 | ||
| @@ -3398,15 +3379,11 @@ static int ipw_load(struct ipw_priv *priv) | |||
| 3398 | priv->rxq = NULL; | 3379 | priv->rxq = NULL; |
| 3399 | } | 3380 | } |
| 3400 | ipw_tx_queue_free(priv); | 3381 | ipw_tx_queue_free(priv); |
| 3401 | if (bootfw) | 3382 | if (raw) |
| 3402 | release_firmware(bootfw); | 3383 | release_firmware(raw); |
| 3403 | if (ucode) | ||
| 3404 | release_firmware(ucode); | ||
| 3405 | if (firmware) | ||
| 3406 | release_firmware(firmware); | ||
| 3407 | #ifdef CONFIG_PM | 3384 | #ifdef CONFIG_PM |
| 3408 | fw_loaded = 0; | 3385 | fw_loaded = 0; |
| 3409 | bootfw = ucode = firmware = NULL; | 3386 | raw = NULL; |
| 3410 | #endif | 3387 | #endif |
| 3411 | 3388 | ||
| 3412 | return rc; | 3389 | return rc; |
| @@ -3715,9 +3692,9 @@ static int ipw_disassociate(void *data) | |||
| 3715 | static void ipw_bg_disassociate(void *data) | 3692 | static void ipw_bg_disassociate(void *data) |
| 3716 | { | 3693 | { |
| 3717 | struct ipw_priv *priv = data; | 3694 | struct ipw_priv *priv = data; |
| 3718 | down(&priv->sem); | 3695 | mutex_lock(&priv->mutex); |
| 3719 | ipw_disassociate(data); | 3696 | ipw_disassociate(data); |
| 3720 | up(&priv->sem); | 3697 | mutex_unlock(&priv->mutex); |
| 3721 | } | 3698 | } |
| 3722 | 3699 | ||
| 3723 | static void ipw_system_config(void *data) | 3700 | static void ipw_system_config(void *data) |
| @@ -4077,9 +4054,9 @@ static void ipw_gather_stats(struct ipw_priv *priv) | |||
| 4077 | static void ipw_bg_gather_stats(void *data) | 4054 | static void ipw_bg_gather_stats(void *data) |
| 4078 | { | 4055 | { |
| 4079 | struct ipw_priv *priv = data; | 4056 | struct ipw_priv *priv = data; |
| 4080 | down(&priv->sem); | 4057 | mutex_lock(&priv->mutex); |
| 4081 | ipw_gather_stats(data); | 4058 | ipw_gather_stats(data); |
| 4082 | up(&priv->sem); | 4059 | mutex_unlock(&priv->mutex); |
| 4083 | } | 4060 | } |
| 4084 | 4061 | ||
| 4085 | /* Missed beacon behavior: | 4062 | /* Missed beacon behavior: |
| @@ -4121,8 +4098,9 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv, | |||
| 4121 | return; | 4098 | return; |
| 4122 | } | 4099 | } |
| 4123 | 4100 | ||
| 4124 | if (missed_count > priv->roaming_threshold && | 4101 | if (roaming && |
| 4125 | missed_count <= priv->disassociate_threshold) { | 4102 | (missed_count > priv->roaming_threshold && |
| 4103 | missed_count <= priv->disassociate_threshold)) { | ||
| 4126 | /* If we are not already roaming, set the ROAM | 4104 | /* If we are not already roaming, set the ROAM |
| 4127 | * bit in the status and kick off a scan. | 4105 | * bit in the status and kick off a scan. |
| 4128 | * This can happen several times before we reach | 4106 | * This can happen several times before we reach |
| @@ -4150,7 +4128,6 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv, | |||
| 4150 | } | 4128 | } |
| 4151 | 4129 | ||
| 4152 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); | 4130 | IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); |
| 4153 | |||
| 4154 | } | 4131 | } |
| 4155 | 4132 | ||
| 4156 | /** | 4133 | /** |
| @@ -4527,10 +4504,9 @@ static void ipw_rx_notification(struct ipw_priv *priv, | |||
| 4527 | 4504 | ||
| 4528 | if (notif->size == sizeof(*x)) { | 4505 | if (notif->size == sizeof(*x)) { |
| 4529 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, | 4506 | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, |
| 4530 | "link deterioration: '%s' " MAC_FMT | 4507 | "link deterioration: type %d, cnt %d\n", |
| 4531 | " \n", escape_essid(priv->essid, | 4508 | x->silence_notification_type, |
| 4532 | priv->essid_len), | 4509 | x->silence_count); |
| 4533 | MAC_ARG(priv->bssid)); | ||
| 4534 | memcpy(&priv->last_link_deterioration, x, | 4510 | memcpy(&priv->last_link_deterioration, x, |
| 4535 | sizeof(*x)); | 4511 | sizeof(*x)); |
| 4536 | } else { | 4512 | } else { |
| @@ -4911,13 +4887,13 @@ static void ipw_rx_queue_replenish(void *data) | |||
| 4911 | static void ipw_bg_rx_queue_replenish(void *data) | 4887 | static void ipw_bg_rx_queue_replenish(void *data) |
| 4912 | { | 4888 | { |
| 4913 | struct ipw_priv *priv = data; | 4889 | struct ipw_priv *priv = data; |
| 4914 | down(&priv->sem); | 4890 | mutex_lock(&priv->mutex); |
| 4915 | ipw_rx_queue_replenish(data); | 4891 | ipw_rx_queue_replenish(data); |
| 4916 | up(&priv->sem); | 4892 | mutex_unlock(&priv->mutex); |
| 4917 | } | 4893 | } |
| 4918 | 4894 | ||
| 4919 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | 4895 | /* 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 | 4896 | * 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 | 4897 | * This free routine walks the list of POOL entries and if SKB is set to |
| 4922 | * non NULL it is unmapped and freed | 4898 | * non NULL it is unmapped and freed |
| 4923 | */ | 4899 | */ |
| @@ -5257,10 +5233,11 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, | |||
| 5257 | if (priv->ieee->scan_age != 0 && | 5233 | if (priv->ieee->scan_age != 0 && |
| 5258 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { | 5234 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { |
| 5259 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " | 5235 | IPW_DEBUG_MERGE("Network '%s (" MAC_FMT ")' excluded " |
| 5260 | "because of age: %lums.\n", | 5236 | "because of age: %ums.\n", |
| 5261 | escape_essid(network->ssid, network->ssid_len), | 5237 | escape_essid(network->ssid, network->ssid_len), |
| 5262 | MAC_ARG(network->bssid), | 5238 | MAC_ARG(network->bssid), |
| 5263 | 1000 * (jiffies - network->last_scanned) / HZ); | 5239 | jiffies_to_msecs(jiffies - |
| 5240 | network->last_scanned)); | ||
| 5264 | return 0; | 5241 | return 0; |
| 5265 | } | 5242 | } |
| 5266 | 5243 | ||
| @@ -5369,7 +5346,7 @@ static void ipw_merge_adhoc_network(void *data) | |||
| 5369 | return; | 5346 | return; |
| 5370 | } | 5347 | } |
| 5371 | 5348 | ||
| 5372 | down(&priv->sem); | 5349 | mutex_lock(&priv->mutex); |
| 5373 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { | 5350 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { |
| 5374 | IPW_DEBUG_MERGE("remove network %s\n", | 5351 | IPW_DEBUG_MERGE("remove network %s\n", |
| 5375 | escape_essid(priv->essid, | 5352 | escape_essid(priv->essid, |
| @@ -5379,7 +5356,7 @@ static void ipw_merge_adhoc_network(void *data) | |||
| 5379 | 5356 | ||
| 5380 | ipw_disassociate(priv); | 5357 | ipw_disassociate(priv); |
| 5381 | priv->assoc_network = match.network; | 5358 | priv->assoc_network = match.network; |
| 5382 | up(&priv->sem); | 5359 | mutex_unlock(&priv->mutex); |
| 5383 | return; | 5360 | return; |
| 5384 | } | 5361 | } |
| 5385 | } | 5362 | } |
| @@ -5467,11 +5444,12 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
| 5467 | if (network->last_associate && | 5444 | if (network->last_associate && |
| 5468 | time_after(network->last_associate + (HZ * 3UL), jiffies)) { | 5445 | time_after(network->last_associate + (HZ * 3UL), jiffies)) { |
| 5469 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5446 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
| 5470 | "because of storming (%lus since last " | 5447 | "because of storming (%ums since last " |
| 5471 | "assoc attempt).\n", | 5448 | "assoc attempt).\n", |
| 5472 | escape_essid(network->ssid, network->ssid_len), | 5449 | escape_essid(network->ssid, network->ssid_len), |
| 5473 | MAC_ARG(network->bssid), | 5450 | MAC_ARG(network->bssid), |
| 5474 | (jiffies - network->last_associate) / HZ); | 5451 | jiffies_to_msecs(jiffies - |
| 5452 | network->last_associate)); | ||
| 5475 | return 0; | 5453 | return 0; |
| 5476 | } | 5454 | } |
| 5477 | 5455 | ||
| @@ -5479,10 +5457,11 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
| 5479 | if (priv->ieee->scan_age != 0 && | 5457 | if (priv->ieee->scan_age != 0 && |
| 5480 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { | 5458 | time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { |
| 5481 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5459 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
| 5482 | "because of age: %lums.\n", | 5460 | "because of age: %ums.\n", |
| 5483 | escape_essid(network->ssid, network->ssid_len), | 5461 | escape_essid(network->ssid, network->ssid_len), |
| 5484 | MAC_ARG(network->bssid), | 5462 | MAC_ARG(network->bssid), |
| 5485 | 1000 * (jiffies - network->last_scanned) / HZ); | 5463 | jiffies_to_msecs(jiffies - |
| 5464 | network->last_scanned)); | ||
| 5486 | return 0; | 5465 | return 0; |
| 5487 | } | 5466 | } |
| 5488 | 5467 | ||
| @@ -5510,15 +5489,6 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
| 5510 | return 0; | 5489 | return 0; |
| 5511 | } | 5490 | } |
| 5512 | 5491 | ||
| 5513 | if (!priv->ieee->wpa_enabled && (network->wpa_ie_len > 0 || | ||
| 5514 | network->rsn_ie_len > 0)) { | ||
| 5515 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | ||
| 5516 | "because of WPA capability mismatch.\n", | ||
| 5517 | escape_essid(network->ssid, network->ssid_len), | ||
| 5518 | MAC_ARG(network->bssid)); | ||
| 5519 | return 0; | ||
| 5520 | } | ||
| 5521 | |||
| 5522 | if ((priv->config & CFG_STATIC_BSSID) && | 5492 | if ((priv->config & CFG_STATIC_BSSID) && |
| 5523 | memcmp(network->bssid, priv->bssid, ETH_ALEN)) { | 5493 | memcmp(network->bssid, priv->bssid, ETH_ALEN)) { |
| 5524 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5494 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
| @@ -5539,7 +5509,7 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
| 5539 | } | 5509 | } |
| 5540 | 5510 | ||
| 5541 | /* Filter out invalid channel in current GEO */ | 5511 | /* Filter out invalid channel in current GEO */ |
| 5542 | if (!ipw_is_valid_channel(priv->ieee, network->channel)) { | 5512 | if (!ieee80211_is_valid_channel(priv->ieee, network->channel)) { |
| 5543 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " | 5513 | IPW_DEBUG_ASSOC("Network '%s (" MAC_FMT ")' excluded " |
| 5544 | "because of invalid channel in current GEO\n", | 5514 | "because of invalid channel in current GEO\n", |
| 5545 | escape_essid(network->ssid, network->ssid_len), | 5515 | escape_essid(network->ssid, network->ssid_len), |
| @@ -5584,7 +5554,7 @@ static int ipw_best_network(struct ipw_priv *priv, | |||
| 5584 | static void ipw_adhoc_create(struct ipw_priv *priv, | 5554 | static void ipw_adhoc_create(struct ipw_priv *priv, |
| 5585 | struct ieee80211_network *network) | 5555 | struct ieee80211_network *network) |
| 5586 | { | 5556 | { |
| 5587 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | 5557 | const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); |
| 5588 | int i; | 5558 | int i; |
| 5589 | 5559 | ||
| 5590 | /* | 5560 | /* |
| @@ -5599,10 +5569,10 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
| 5599 | * FW fatal error. | 5569 | * FW fatal error. |
| 5600 | * | 5570 | * |
| 5601 | */ | 5571 | */ |
| 5602 | switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { | 5572 | switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { |
| 5603 | case IEEE80211_52GHZ_BAND: | 5573 | case IEEE80211_52GHZ_BAND: |
| 5604 | network->mode = IEEE_A; | 5574 | network->mode = IEEE_A; |
| 5605 | i = ipw_channel_to_index(priv->ieee, priv->channel); | 5575 | i = ieee80211_channel_to_index(priv->ieee, priv->channel); |
| 5606 | if (i == -1) | 5576 | if (i == -1) |
| 5607 | BUG(); | 5577 | BUG(); |
| 5608 | if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { | 5578 | if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) { |
| @@ -5616,7 +5586,7 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
| 5616 | network->mode = IEEE_G; | 5586 | network->mode = IEEE_G; |
| 5617 | else | 5587 | else |
| 5618 | network->mode = IEEE_B; | 5588 | network->mode = IEEE_B; |
| 5619 | i = ipw_channel_to_index(priv->ieee, priv->channel); | 5589 | i = ieee80211_channel_to_index(priv->ieee, priv->channel); |
| 5620 | if (i == -1) | 5590 | if (i == -1) |
| 5621 | BUG(); | 5591 | BUG(); |
| 5622 | if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) { | 5592 | if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) { |
| @@ -5671,54 +5641,44 @@ static void ipw_adhoc_create(struct ipw_priv *priv, | |||
| 5671 | 5641 | ||
| 5672 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) | 5642 | static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) |
| 5673 | { | 5643 | { |
| 5674 | struct ipw_tgi_tx_key *key; | 5644 | struct ipw_tgi_tx_key key; |
| 5675 | struct host_cmd cmd = { | ||
| 5676 | .cmd = IPW_CMD_TGI_TX_KEY, | ||
| 5677 | .len = sizeof(*key) | ||
| 5678 | }; | ||
| 5679 | 5645 | ||
| 5680 | if (!(priv->ieee->sec.flags & (1 << index))) | 5646 | if (!(priv->ieee->sec.flags & (1 << index))) |
| 5681 | return; | 5647 | return; |
| 5682 | 5648 | ||
| 5683 | key = (struct ipw_tgi_tx_key *)&cmd.param; | 5649 | key.key_id = index; |
| 5684 | key->key_id = index; | 5650 | 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); | 5651 | key.security_type = type; |
| 5686 | key->security_type = type; | 5652 | key.station_index = 0; /* always 0 for BSS */ |
| 5687 | key->station_index = 0; /* always 0 for BSS */ | 5653 | key.flags = 0; |
| 5688 | key->flags = 0; | ||
| 5689 | /* 0 for new key; previous value of counter (after fatal error) */ | 5654 | /* 0 for new key; previous value of counter (after fatal error) */ |
| 5690 | key->tx_counter[0] = 0; | 5655 | key.tx_counter[0] = 0; |
| 5691 | key->tx_counter[1] = 0; | 5656 | key.tx_counter[1] = 0; |
| 5692 | 5657 | ||
| 5693 | ipw_send_cmd(priv, &cmd); | 5658 | ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key); |
| 5694 | } | 5659 | } |
| 5695 | 5660 | ||
| 5696 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) | 5661 | static void ipw_send_wep_keys(struct ipw_priv *priv, int type) |
| 5697 | { | 5662 | { |
| 5698 | struct ipw_wep_key *key; | 5663 | struct ipw_wep_key key; |
| 5699 | int i; | 5664 | int i; |
| 5700 | struct host_cmd cmd = { | ||
| 5701 | .cmd = IPW_CMD_WEP_KEY, | ||
| 5702 | .len = sizeof(*key) | ||
| 5703 | }; | ||
| 5704 | 5665 | ||
| 5705 | key = (struct ipw_wep_key *)&cmd.param; | 5666 | key.cmd_id = DINO_CMD_WEP_KEY; |
| 5706 | key->cmd_id = DINO_CMD_WEP_KEY; | 5667 | key.seq_num = 0; |
| 5707 | key->seq_num = 0; | ||
| 5708 | 5668 | ||
| 5709 | /* Note: AES keys cannot be set for multiple times. | 5669 | /* Note: AES keys cannot be set for multiple times. |
| 5710 | * Only set it at the first time. */ | 5670 | * Only set it at the first time. */ |
| 5711 | for (i = 0; i < 4; i++) { | 5671 | for (i = 0; i < 4; i++) { |
| 5712 | key->key_index = i | type; | 5672 | key.key_index = i | type; |
| 5713 | if (!(priv->ieee->sec.flags & (1 << i))) { | 5673 | if (!(priv->ieee->sec.flags & (1 << i))) { |
| 5714 | key->key_size = 0; | 5674 | key.key_size = 0; |
| 5715 | continue; | 5675 | continue; |
| 5716 | } | 5676 | } |
| 5717 | 5677 | ||
| 5718 | key->key_size = priv->ieee->sec.key_sizes[i]; | 5678 | key.key_size = priv->ieee->sec.key_sizes[i]; |
| 5719 | memcpy(key->key, priv->ieee->sec.keys[i], key->key_size); | 5679 | memcpy(key.key, priv->ieee->sec.keys[i], key.key_size); |
| 5720 | 5680 | ||
| 5721 | ipw_send_cmd(priv, &cmd); | 5681 | ipw_send_cmd_pdu(priv, IPW_CMD_WEP_KEY, sizeof(key), &key); |
| 5722 | } | 5682 | } |
| 5723 | } | 5683 | } |
| 5724 | 5684 | ||
| @@ -5822,9 +5782,9 @@ static void ipw_adhoc_check(void *data) | |||
| 5822 | static void ipw_bg_adhoc_check(void *data) | 5782 | static void ipw_bg_adhoc_check(void *data) |
| 5823 | { | 5783 | { |
| 5824 | struct ipw_priv *priv = data; | 5784 | struct ipw_priv *priv = data; |
| 5825 | down(&priv->sem); | 5785 | mutex_lock(&priv->mutex); |
| 5826 | ipw_adhoc_check(data); | 5786 | ipw_adhoc_check(data); |
| 5827 | up(&priv->sem); | 5787 | mutex_unlock(&priv->mutex); |
| 5828 | } | 5788 | } |
| 5829 | 5789 | ||
| 5830 | #ifdef CONFIG_IPW2200_DEBUG | 5790 | #ifdef CONFIG_IPW2200_DEBUG |
| @@ -5950,7 +5910,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, | |||
| 5950 | const struct ieee80211_geo *geo; | 5910 | const struct ieee80211_geo *geo; |
| 5951 | int i; | 5911 | int i; |
| 5952 | 5912 | ||
| 5953 | geo = ipw_get_geo(priv->ieee); | 5913 | geo = ieee80211_get_geo(priv->ieee); |
| 5954 | 5914 | ||
| 5955 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { | 5915 | if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) { |
| 5956 | int start = channel_index; | 5916 | int start = channel_index; |
| @@ -6010,7 +5970,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, | |||
| 6010 | channel_index++; | 5970 | channel_index++; |
| 6011 | scan->channels_list[channel_index] = channel; | 5971 | scan->channels_list[channel_index] = channel; |
| 6012 | index = | 5972 | index = |
| 6013 | ipw_channel_to_index(priv->ieee, channel); | 5973 | ieee80211_channel_to_index(priv->ieee, channel); |
| 6014 | ipw_set_scan_type(scan, channel_index, | 5974 | ipw_set_scan_type(scan, channel_index, |
| 6015 | geo->bg[index]. | 5975 | geo->bg[index]. |
| 6016 | flags & | 5976 | flags & |
| @@ -6051,7 +6011,7 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
| 6051 | (priv->status & STATUS_EXIT_PENDING)) | 6011 | (priv->status & STATUS_EXIT_PENDING)) |
| 6052 | return 0; | 6012 | return 0; |
| 6053 | 6013 | ||
| 6054 | down(&priv->sem); | 6014 | mutex_lock(&priv->mutex); |
| 6055 | 6015 | ||
| 6056 | if (priv->status & STATUS_SCANNING) { | 6016 | if (priv->status & STATUS_SCANNING) { |
| 6057 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); | 6017 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); |
| @@ -6092,7 +6052,7 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
| 6092 | u8 channel; | 6052 | u8 channel; |
| 6093 | u8 band = 0; | 6053 | u8 band = 0; |
| 6094 | 6054 | ||
| 6095 | switch (ipw_is_valid_channel(priv->ieee, priv->channel)) { | 6055 | switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) { |
| 6096 | case IEEE80211_52GHZ_BAND: | 6056 | case IEEE80211_52GHZ_BAND: |
| 6097 | band = (u8) (IPW_A_MODE << 6) | 1; | 6057 | band = (u8) (IPW_A_MODE << 6) | 1; |
| 6098 | channel = priv->channel; | 6058 | channel = priv->channel; |
| @@ -6159,16 +6119,16 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
| 6159 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 6119 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
| 6160 | IPW_SCAN_CHECK_WATCHDOG); | 6120 | IPW_SCAN_CHECK_WATCHDOG); |
| 6161 | done: | 6121 | done: |
| 6162 | up(&priv->sem); | 6122 | mutex_unlock(&priv->mutex); |
| 6163 | return err; | 6123 | return err; |
| 6164 | } | 6124 | } |
| 6165 | 6125 | ||
| 6166 | static void ipw_bg_abort_scan(void *data) | 6126 | static void ipw_bg_abort_scan(void *data) |
| 6167 | { | 6127 | { |
| 6168 | struct ipw_priv *priv = data; | 6128 | struct ipw_priv *priv = data; |
| 6169 | down(&priv->sem); | 6129 | mutex_lock(&priv->mutex); |
| 6170 | ipw_abort_scan(data); | 6130 | ipw_abort_scan(data); |
| 6171 | up(&priv->sem); | 6131 | mutex_unlock(&priv->mutex); |
| 6172 | } | 6132 | } |
| 6173 | 6133 | ||
| 6174 | static int ipw_wpa_enable(struct ipw_priv *priv, int value) | 6134 | static int ipw_wpa_enable(struct ipw_priv *priv, int value) |
| @@ -6193,6 +6153,9 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) | |||
| 6193 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { | 6153 | } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { |
| 6194 | sec.auth_mode = WLAN_AUTH_OPEN; | 6154 | sec.auth_mode = WLAN_AUTH_OPEN; |
| 6195 | ieee->open_wep = 1; | 6155 | ieee->open_wep = 1; |
| 6156 | } else if (value & IW_AUTH_ALG_LEAP) { | ||
| 6157 | sec.auth_mode = WLAN_AUTH_LEAP; | ||
| 6158 | ieee->open_wep = 1; | ||
| 6196 | } else | 6159 | } else |
| 6197 | return -EINVAL; | 6160 | return -EINVAL; |
| 6198 | 6161 | ||
| @@ -6204,7 +6167,8 @@ static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) | |||
| 6204 | return ret; | 6167 | return ret; |
| 6205 | } | 6168 | } |
| 6206 | 6169 | ||
| 6207 | void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) | 6170 | static void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, |
| 6171 | int wpa_ie_len) | ||
| 6208 | { | 6172 | { |
| 6209 | /* make sure WPA is enabled */ | 6173 | /* make sure WPA is enabled */ |
| 6210 | ipw_wpa_enable(priv, 1); | 6174 | ipw_wpa_enable(priv, 1); |
| @@ -6215,15 +6179,10 @@ void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, int wpa_ie_len) | |||
| 6215 | static int ipw_set_rsn_capa(struct ipw_priv *priv, | 6179 | static int ipw_set_rsn_capa(struct ipw_priv *priv, |
| 6216 | char *capabilities, int length) | 6180 | char *capabilities, int length) |
| 6217 | { | 6181 | { |
| 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"); | 6182 | IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); |
| 6224 | 6183 | ||
| 6225 | memcpy(cmd.param, capabilities, length); | 6184 | return ipw_send_cmd_pdu(priv, IPW_CMD_RSN_CAPABILITIES, length, |
| 6226 | return ipw_send_cmd(priv, &cmd); | 6185 | capabilities); |
| 6227 | } | 6186 | } |
| 6228 | 6187 | ||
| 6229 | /* | 6188 | /* |
| @@ -6244,7 +6203,7 @@ static int ipw_wx_set_genie(struct net_device *dev, | |||
| 6244 | (wrqu->data.length && extra == NULL)) | 6203 | (wrqu->data.length && extra == NULL)) |
| 6245 | return -EINVAL; | 6204 | return -EINVAL; |
| 6246 | 6205 | ||
| 6247 | //down(&priv->sem); | 6206 | //mutex_lock(&priv->mutex); |
| 6248 | 6207 | ||
| 6249 | //if (!ieee->wpa_enabled) { | 6208 | //if (!ieee->wpa_enabled) { |
| 6250 | // err = -EOPNOTSUPP; | 6209 | // err = -EOPNOTSUPP; |
| @@ -6270,7 +6229,7 @@ static int ipw_wx_set_genie(struct net_device *dev, | |||
| 6270 | 6229 | ||
| 6271 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); | 6230 | ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); |
| 6272 | out: | 6231 | out: |
| 6273 | //up(&priv->sem); | 6232 | //mutex_unlock(&priv->mutex); |
| 6274 | return err; | 6233 | return err; |
| 6275 | } | 6234 | } |
| 6276 | 6235 | ||
| @@ -6283,7 +6242,7 @@ static int ipw_wx_get_genie(struct net_device *dev, | |||
| 6283 | struct ieee80211_device *ieee = priv->ieee; | 6242 | struct ieee80211_device *ieee = priv->ieee; |
| 6284 | int err = 0; | 6243 | int err = 0; |
| 6285 | 6244 | ||
| 6286 | //down(&priv->sem); | 6245 | //mutex_lock(&priv->mutex); |
| 6287 | 6246 | ||
| 6288 | //if (!ieee->wpa_enabled) { | 6247 | //if (!ieee->wpa_enabled) { |
| 6289 | // err = -EOPNOTSUPP; | 6248 | // err = -EOPNOTSUPP; |
| @@ -6304,7 +6263,7 @@ static int ipw_wx_get_genie(struct net_device *dev, | |||
| 6304 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); | 6263 | memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); |
| 6305 | 6264 | ||
| 6306 | out: | 6265 | out: |
| 6307 | //up(&priv->sem); | 6266 | //mutex_unlock(&priv->mutex); |
| 6308 | return err; | 6267 | return err; |
| 6309 | } | 6268 | } |
| 6310 | 6269 | ||
| @@ -6556,7 +6515,7 @@ static int ipw_wx_set_mlme(struct net_device *dev, | |||
| 6556 | * get the modulation type of the current network or | 6515 | * get the modulation type of the current network or |
| 6557 | * the card current mode | 6516 | * the card current mode |
| 6558 | */ | 6517 | */ |
| 6559 | u8 ipw_qos_current_mode(struct ipw_priv * priv) | 6518 | static u8 ipw_qos_current_mode(struct ipw_priv * priv) |
| 6560 | { | 6519 | { |
| 6561 | u8 mode = 0; | 6520 | u8 mode = 0; |
| 6562 | 6521 | ||
| @@ -6964,12 +6923,12 @@ static void ipw_bg_qos_activate(void *data) | |||
| 6964 | if (priv == NULL) | 6923 | if (priv == NULL) |
| 6965 | return; | 6924 | return; |
| 6966 | 6925 | ||
| 6967 | down(&priv->sem); | 6926 | mutex_lock(&priv->mutex); |
| 6968 | 6927 | ||
| 6969 | if (priv->status & STATUS_ASSOCIATED) | 6928 | if (priv->status & STATUS_ASSOCIATED) |
| 6970 | ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); | 6929 | ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); |
| 6971 | 6930 | ||
| 6972 | up(&priv->sem); | 6931 | mutex_unlock(&priv->mutex); |
| 6973 | } | 6932 | } |
| 6974 | 6933 | ||
| 6975 | static int ipw_handle_probe_response(struct net_device *dev, | 6934 | static int ipw_handle_probe_response(struct net_device *dev, |
| @@ -7010,25 +6969,15 @@ static int ipw_handle_assoc_response(struct net_device *dev, | |||
| 7010 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters | 6969 | static int ipw_send_qos_params_command(struct ipw_priv *priv, struct ieee80211_qos_parameters |
| 7011 | *qos_param) | 6970 | *qos_param) |
| 7012 | { | 6971 | { |
| 7013 | struct host_cmd cmd = { | 6972 | return ipw_send_cmd_pdu(priv, IPW_CMD_QOS_PARAMETERS, |
| 7014 | .cmd = IPW_CMD_QOS_PARAMETERS, | 6973 | 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 | } | 6974 | } |
| 7021 | 6975 | ||
| 7022 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element | 6976 | static int ipw_send_qos_info_command(struct ipw_priv *priv, struct ieee80211_qos_information_element |
| 7023 | *qos_param) | 6977 | *qos_param) |
| 7024 | { | 6978 | { |
| 7025 | struct host_cmd cmd = { | 6979 | return ipw_send_cmd_pdu(priv, IPW_CMD_WME_INFO, sizeof(*qos_param), |
| 7026 | .cmd = IPW_CMD_WME_INFO, | 6980 | 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 | } | 6981 | } |
| 7033 | 6982 | ||
| 7034 | #endif /* CONFIG_IPW_QOS */ | 6983 | #endif /* CONFIG_IPW_QOS */ |
| @@ -7052,19 +7001,21 @@ static int ipw_associate_network(struct ipw_priv *priv, | |||
| 7052 | 7001 | ||
| 7053 | memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); | 7002 | memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); |
| 7054 | priv->assoc_request.channel = network->channel; | 7003 | priv->assoc_request.channel = network->channel; |
| 7004 | priv->assoc_request.auth_key = 0; | ||
| 7005 | |||
| 7055 | if ((priv->capability & CAP_PRIVACY_ON) && | 7006 | if ((priv->capability & CAP_PRIVACY_ON) && |
| 7056 | (priv->capability & CAP_SHARED_KEY)) { | 7007 | (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) { |
| 7057 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; | 7008 | priv->assoc_request.auth_type = AUTH_SHARED_KEY; |
| 7058 | priv->assoc_request.auth_key = priv->ieee->sec.active_key; | 7009 | priv->assoc_request.auth_key = priv->ieee->sec.active_key; |
| 7059 | 7010 | ||
| 7060 | if ((priv->capability & CAP_PRIVACY_ON) && | 7011 | 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)) | ||
| 7063 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); | 7012 | ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); |
| 7064 | } else { | 7013 | |
| 7014 | } else if ((priv->capability & CAP_PRIVACY_ON) && | ||
| 7015 | (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP)) | ||
| 7016 | priv->assoc_request.auth_type = AUTH_LEAP; | ||
| 7017 | else | ||
| 7065 | priv->assoc_request.auth_type = AUTH_OPEN; | 7018 | priv->assoc_request.auth_type = AUTH_OPEN; |
| 7066 | priv->assoc_request.auth_key = 0; | ||
| 7067 | } | ||
| 7068 | 7019 | ||
| 7069 | if (priv->ieee->wpa_ie_len) { | 7020 | if (priv->ieee->wpa_ie_len) { |
| 7070 | priv->assoc_request.policy_support = 0x02; /* RSN active */ | 7021 | priv->assoc_request.policy_support = 0x02; /* RSN active */ |
| @@ -7278,9 +7229,9 @@ static void ipw_roam(void *data) | |||
| 7278 | static void ipw_bg_roam(void *data) | 7229 | static void ipw_bg_roam(void *data) |
| 7279 | { | 7230 | { |
| 7280 | struct ipw_priv *priv = data; | 7231 | struct ipw_priv *priv = data; |
| 7281 | down(&priv->sem); | 7232 | mutex_lock(&priv->mutex); |
| 7282 | ipw_roam(data); | 7233 | ipw_roam(data); |
| 7283 | up(&priv->sem); | 7234 | mutex_unlock(&priv->mutex); |
| 7284 | } | 7235 | } |
| 7285 | 7236 | ||
| 7286 | static int ipw_associate(void *data) | 7237 | static int ipw_associate(void *data) |
| @@ -7375,9 +7326,9 @@ static int ipw_associate(void *data) | |||
| 7375 | static void ipw_bg_associate(void *data) | 7326 | static void ipw_bg_associate(void *data) |
| 7376 | { | 7327 | { |
| 7377 | struct ipw_priv *priv = data; | 7328 | struct ipw_priv *priv = data; |
| 7378 | down(&priv->sem); | 7329 | mutex_lock(&priv->mutex); |
| 7379 | ipw_associate(data); | 7330 | ipw_associate(data); |
| 7380 | up(&priv->sem); | 7331 | mutex_unlock(&priv->mutex); |
| 7381 | } | 7332 | } |
| 7382 | 7333 | ||
| 7383 | static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, | 7334 | static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, |
| @@ -7811,12 +7762,10 @@ static void ipw_rx(struct ipw_priv *priv) | |||
| 7811 | 7762 | ||
| 7812 | while (i != r) { | 7763 | while (i != r) { |
| 7813 | rxb = priv->rxq->queue[i]; | 7764 | rxb = priv->rxq->queue[i]; |
| 7814 | #ifdef CONFIG_IPW2200_DEBUG | ||
| 7815 | if (unlikely(rxb == NULL)) { | 7765 | if (unlikely(rxb == NULL)) { |
| 7816 | printk(KERN_CRIT "Queue not allocated!\n"); | 7766 | printk(KERN_CRIT "Queue not allocated!\n"); |
| 7817 | break; | 7767 | break; |
| 7818 | } | 7768 | } |
| 7819 | #endif | ||
| 7820 | priv->rxq->queue[i] = NULL; | 7769 | priv->rxq->queue[i] = NULL; |
| 7821 | 7770 | ||
| 7822 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, | 7771 | pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, |
| @@ -7835,7 +7784,8 @@ static void ipw_rx(struct ipw_priv *priv) | |||
| 7835 | le16_to_cpu(pkt->u.frame.rssi_dbm) - | 7784 | le16_to_cpu(pkt->u.frame.rssi_dbm) - |
| 7836 | IPW_RSSI_TO_DBM, | 7785 | IPW_RSSI_TO_DBM, |
| 7837 | .signal = | 7786 | .signal = |
| 7838 | le16_to_cpu(pkt->u.frame.signal), | 7787 | le16_to_cpu(pkt->u.frame.rssi_dbm) - |
| 7788 | IPW_RSSI_TO_DBM + 0x100, | ||
| 7839 | .noise = | 7789 | .noise = |
| 7840 | le16_to_cpu(pkt->u.frame.noise), | 7790 | le16_to_cpu(pkt->u.frame.noise), |
| 7841 | .rate = pkt->u.frame.rate, | 7791 | .rate = pkt->u.frame.rate, |
| @@ -7899,7 +7849,8 @@ static void ipw_rx(struct ipw_priv *priv) | |||
| 7899 | le16_to_cpu(pkt->u.frame.length)); | 7849 | le16_to_cpu(pkt->u.frame.length)); |
| 7900 | 7850 | ||
| 7901 | if (le16_to_cpu(pkt->u.frame.length) < | 7851 | if (le16_to_cpu(pkt->u.frame.length) < |
| 7902 | frame_hdr_len(header)) { | 7852 | ieee80211_get_hdrlen(le16_to_cpu( |
| 7853 | header->frame_ctl))) { | ||
| 7903 | IPW_DEBUG_DROP | 7854 | IPW_DEBUG_DROP |
| 7904 | ("Received packet is too small. " | 7855 | ("Received packet is too small. " |
| 7905 | "Dropping.\n"); | 7856 | "Dropping.\n"); |
| @@ -7989,7 +7940,14 @@ static void ipw_rx(struct ipw_priv *priv) | |||
| 7989 | #define DEFAULT_SHORT_RETRY_LIMIT 7U | 7940 | #define DEFAULT_SHORT_RETRY_LIMIT 7U |
| 7990 | #define DEFAULT_LONG_RETRY_LIMIT 4U | 7941 | #define DEFAULT_LONG_RETRY_LIMIT 4U |
| 7991 | 7942 | ||
| 7992 | static int ipw_sw_reset(struct ipw_priv *priv, int init) | 7943 | /** |
| 7944 | * ipw_sw_reset | ||
| 7945 | * @option: options to control different reset behaviour | ||
| 7946 | * 0 = reset everything except the 'disable' module_param | ||
| 7947 | * 1 = reset everything and print out driver info (for probe only) | ||
| 7948 | * 2 = reset everything | ||
| 7949 | */ | ||
| 7950 | static int ipw_sw_reset(struct ipw_priv *priv, int option) | ||
| 7993 | { | 7951 | { |
| 7994 | int band, modulation; | 7952 | int band, modulation; |
| 7995 | int old_mode = priv->ieee->iw_mode; | 7953 | int old_mode = priv->ieee->iw_mode; |
| @@ -8016,7 +7974,7 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) | |||
| 8016 | priv->essid_len = 0; | 7974 | priv->essid_len = 0; |
| 8017 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | 7975 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); |
| 8018 | 7976 | ||
| 8019 | if (disable) { | 7977 | if (disable && option) { |
| 8020 | priv->status |= STATUS_RF_KILL_SW; | 7978 | priv->status |= STATUS_RF_KILL_SW; |
| 8021 | IPW_DEBUG_INFO("Radio disabled.\n"); | 7979 | IPW_DEBUG_INFO("Radio disabled.\n"); |
| 8022 | } | 7980 | } |
| @@ -8068,7 +8026,7 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) | |||
| 8068 | 8026 | ||
| 8069 | if ((priv->pci_dev->device == 0x4223) || | 8027 | if ((priv->pci_dev->device == 0x4223) || |
| 8070 | (priv->pci_dev->device == 0x4224)) { | 8028 | (priv->pci_dev->device == 0x4224)) { |
| 8071 | if (init) | 8029 | if (option == 1) |
| 8072 | printk(KERN_INFO DRV_NAME | 8030 | printk(KERN_INFO DRV_NAME |
| 8073 | ": Detected Intel PRO/Wireless 2915ABG Network " | 8031 | ": Detected Intel PRO/Wireless 2915ABG Network " |
| 8074 | "Connection\n"); | 8032 | "Connection\n"); |
| @@ -8079,7 +8037,7 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) | |||
| 8079 | priv->adapter = IPW_2915ABG; | 8037 | priv->adapter = IPW_2915ABG; |
| 8080 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; | 8038 | priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; |
| 8081 | } else { | 8039 | } else { |
| 8082 | if (init) | 8040 | if (option == 1) |
| 8083 | printk(KERN_INFO DRV_NAME | 8041 | printk(KERN_INFO DRV_NAME |
| 8084 | ": Detected Intel PRO/Wireless 2200BG Network " | 8042 | ": Detected Intel PRO/Wireless 2200BG Network " |
| 8085 | "Connection\n"); | 8043 | "Connection\n"); |
| @@ -8126,7 +8084,7 @@ static int ipw_wx_get_name(struct net_device *dev, | |||
| 8126 | union iwreq_data *wrqu, char *extra) | 8084 | union iwreq_data *wrqu, char *extra) |
| 8127 | { | 8085 | { |
| 8128 | struct ipw_priv *priv = ieee80211_priv(dev); | 8086 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8129 | down(&priv->sem); | 8087 | mutex_lock(&priv->mutex); |
| 8130 | if (priv->status & STATUS_RF_KILL_MASK) | 8088 | if (priv->status & STATUS_RF_KILL_MASK) |
| 8131 | strcpy(wrqu->name, "radio off"); | 8089 | strcpy(wrqu->name, "radio off"); |
| 8132 | else if (!(priv->status & STATUS_ASSOCIATED)) | 8090 | else if (!(priv->status & STATUS_ASSOCIATED)) |
| @@ -8135,7 +8093,7 @@ static int ipw_wx_get_name(struct net_device *dev, | |||
| 8135 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", | 8093 | snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11%c", |
| 8136 | ipw_modes[priv->assoc_request.ieee_mode]); | 8094 | ipw_modes[priv->assoc_request.ieee_mode]); |
| 8137 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); | 8095 | IPW_DEBUG_WX("Name: %s\n", wrqu->name); |
| 8138 | up(&priv->sem); | 8096 | mutex_unlock(&priv->mutex); |
| 8139 | return 0; | 8097 | return 0; |
| 8140 | } | 8098 | } |
| 8141 | 8099 | ||
| @@ -8196,7 +8154,7 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
| 8196 | union iwreq_data *wrqu, char *extra) | 8154 | union iwreq_data *wrqu, char *extra) |
| 8197 | { | 8155 | { |
| 8198 | struct ipw_priv *priv = ieee80211_priv(dev); | 8156 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8199 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | 8157 | const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); |
| 8200 | struct iw_freq *fwrq = &wrqu->freq; | 8158 | struct iw_freq *fwrq = &wrqu->freq; |
| 8201 | int ret = 0, i; | 8159 | int ret = 0, i; |
| 8202 | u8 channel, flags; | 8160 | u8 channel, flags; |
| @@ -8204,24 +8162,24 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
| 8204 | 8162 | ||
| 8205 | if (fwrq->m == 0) { | 8163 | if (fwrq->m == 0) { |
| 8206 | IPW_DEBUG_WX("SET Freq/Channel -> any\n"); | 8164 | IPW_DEBUG_WX("SET Freq/Channel -> any\n"); |
| 8207 | down(&priv->sem); | 8165 | mutex_lock(&priv->mutex); |
| 8208 | ret = ipw_set_channel(priv, 0); | 8166 | ret = ipw_set_channel(priv, 0); |
| 8209 | up(&priv->sem); | 8167 | mutex_unlock(&priv->mutex); |
| 8210 | return ret; | 8168 | return ret; |
| 8211 | } | 8169 | } |
| 8212 | /* if setting by freq convert to channel */ | 8170 | /* if setting by freq convert to channel */ |
| 8213 | if (fwrq->e == 1) { | 8171 | if (fwrq->e == 1) { |
| 8214 | channel = ipw_freq_to_channel(priv->ieee, fwrq->m); | 8172 | channel = ieee80211_freq_to_channel(priv->ieee, fwrq->m); |
| 8215 | if (channel == 0) | 8173 | if (channel == 0) |
| 8216 | return -EINVAL; | 8174 | return -EINVAL; |
| 8217 | } else | 8175 | } else |
| 8218 | channel = fwrq->m; | 8176 | channel = fwrq->m; |
| 8219 | 8177 | ||
| 8220 | if (!(band = ipw_is_valid_channel(priv->ieee, channel))) | 8178 | if (!(band = ieee80211_is_valid_channel(priv->ieee, channel))) |
| 8221 | return -EINVAL; | 8179 | return -EINVAL; |
| 8222 | 8180 | ||
| 8223 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { | 8181 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) { |
| 8224 | i = ipw_channel_to_index(priv->ieee, channel); | 8182 | i = ieee80211_channel_to_index(priv->ieee, channel); |
| 8225 | if (i == -1) | 8183 | if (i == -1) |
| 8226 | return -EINVAL; | 8184 | return -EINVAL; |
| 8227 | 8185 | ||
| @@ -8234,9 +8192,9 @@ static int ipw_wx_set_freq(struct net_device *dev, | |||
| 8234 | } | 8192 | } |
| 8235 | 8193 | ||
| 8236 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); | 8194 | IPW_DEBUG_WX("SET Freq/Channel -> %d \n", fwrq->m); |
| 8237 | down(&priv->sem); | 8195 | mutex_lock(&priv->mutex); |
| 8238 | ret = ipw_set_channel(priv, channel); | 8196 | ret = ipw_set_channel(priv, channel); |
| 8239 | up(&priv->sem); | 8197 | mutex_unlock(&priv->mutex); |
| 8240 | return ret; | 8198 | return ret; |
| 8241 | } | 8199 | } |
| 8242 | 8200 | ||
| @@ -8250,14 +8208,14 @@ static int ipw_wx_get_freq(struct net_device *dev, | |||
| 8250 | 8208 | ||
| 8251 | /* If we are associated, trying to associate, or have a statically | 8209 | /* If we are associated, trying to associate, or have a statically |
| 8252 | * configured CHANNEL then return that; otherwise return ANY */ | 8210 | * configured CHANNEL then return that; otherwise return ANY */ |
| 8253 | down(&priv->sem); | 8211 | mutex_lock(&priv->mutex); |
| 8254 | if (priv->config & CFG_STATIC_CHANNEL || | 8212 | if (priv->config & CFG_STATIC_CHANNEL || |
| 8255 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) | 8213 | priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) |
| 8256 | wrqu->freq.m = priv->channel; | 8214 | wrqu->freq.m = priv->channel; |
| 8257 | else | 8215 | else |
| 8258 | wrqu->freq.m = 0; | 8216 | wrqu->freq.m = 0; |
| 8259 | 8217 | ||
| 8260 | up(&priv->sem); | 8218 | mutex_unlock(&priv->mutex); |
| 8261 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); | 8219 | IPW_DEBUG_WX("GET Freq/Channel -> %d \n", priv->channel); |
| 8262 | return 0; | 8220 | return 0; |
| 8263 | } | 8221 | } |
| @@ -8287,7 +8245,7 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
| 8287 | if (wrqu->mode == priv->ieee->iw_mode) | 8245 | if (wrqu->mode == priv->ieee->iw_mode) |
| 8288 | return 0; | 8246 | return 0; |
| 8289 | 8247 | ||
| 8290 | down(&priv->sem); | 8248 | mutex_lock(&priv->mutex); |
| 8291 | 8249 | ||
| 8292 | ipw_sw_reset(priv, 0); | 8250 | ipw_sw_reset(priv, 0); |
| 8293 | 8251 | ||
| @@ -8310,7 +8268,7 @@ static int ipw_wx_set_mode(struct net_device *dev, | |||
| 8310 | priv->ieee->iw_mode = wrqu->mode; | 8268 | priv->ieee->iw_mode = wrqu->mode; |
| 8311 | 8269 | ||
| 8312 | queue_work(priv->workqueue, &priv->adapter_restart); | 8270 | queue_work(priv->workqueue, &priv->adapter_restart); |
| 8313 | up(&priv->sem); | 8271 | mutex_unlock(&priv->mutex); |
| 8314 | return err; | 8272 | return err; |
| 8315 | } | 8273 | } |
| 8316 | 8274 | ||
| @@ -8319,10 +8277,10 @@ static int ipw_wx_get_mode(struct net_device *dev, | |||
| 8319 | union iwreq_data *wrqu, char *extra) | 8277 | union iwreq_data *wrqu, char *extra) |
| 8320 | { | 8278 | { |
| 8321 | struct ipw_priv *priv = ieee80211_priv(dev); | 8279 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8322 | down(&priv->sem); | 8280 | mutex_lock(&priv->mutex); |
| 8323 | wrqu->mode = priv->ieee->iw_mode; | 8281 | wrqu->mode = priv->ieee->iw_mode; |
| 8324 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); | 8282 | IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); |
| 8325 | up(&priv->sem); | 8283 | mutex_unlock(&priv->mutex); |
| 8326 | return 0; | 8284 | return 0; |
| 8327 | } | 8285 | } |
| 8328 | 8286 | ||
| @@ -8349,7 +8307,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
| 8349 | { | 8307 | { |
| 8350 | struct ipw_priv *priv = ieee80211_priv(dev); | 8308 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8351 | struct iw_range *range = (struct iw_range *)extra; | 8309 | struct iw_range *range = (struct iw_range *)extra; |
| 8352 | const struct ieee80211_geo *geo = ipw_get_geo(priv->ieee); | 8310 | const struct ieee80211_geo *geo = ieee80211_get_geo(priv->ieee); |
| 8353 | int i = 0, j; | 8311 | int i = 0, j; |
| 8354 | 8312 | ||
| 8355 | wrqu->data.length = sizeof(*range); | 8313 | wrqu->data.length = sizeof(*range); |
| @@ -8361,7 +8319,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
| 8361 | range->max_qual.qual = 100; | 8319 | range->max_qual.qual = 100; |
| 8362 | /* TODO: Find real max RSSI and stick here */ | 8320 | /* TODO: Find real max RSSI and stick here */ |
| 8363 | range->max_qual.level = 0; | 8321 | range->max_qual.level = 0; |
| 8364 | range->max_qual.noise = priv->ieee->worst_rssi + 0x100; | 8322 | range->max_qual.noise = 0; |
| 8365 | range->max_qual.updated = 7; /* Updated all three */ | 8323 | range->max_qual.updated = 7; /* Updated all three */ |
| 8366 | 8324 | ||
| 8367 | range->avg_qual.qual = 70; | 8325 | range->avg_qual.qual = 70; |
| @@ -8369,7 +8327,7 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
| 8369 | range->avg_qual.level = 0; /* FIXME to real average level */ | 8327 | range->avg_qual.level = 0; /* FIXME to real average level */ |
| 8370 | range->avg_qual.noise = 0; | 8328 | range->avg_qual.noise = 0; |
| 8371 | range->avg_qual.updated = 7; /* Updated all three */ | 8329 | range->avg_qual.updated = 7; /* Updated all three */ |
| 8372 | down(&priv->sem); | 8330 | mutex_lock(&priv->mutex); |
| 8373 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); | 8331 | range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); |
| 8374 | 8332 | ||
| 8375 | for (i = 0; i < range->num_bitrates; i++) | 8333 | for (i = 0; i < range->num_bitrates; i++) |
| @@ -8387,31 +8345,39 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
| 8387 | 8345 | ||
| 8388 | /* Set the Wireless Extension versions */ | 8346 | /* Set the Wireless Extension versions */ |
| 8389 | range->we_version_compiled = WIRELESS_EXT; | 8347 | range->we_version_compiled = WIRELESS_EXT; |
| 8390 | range->we_version_source = 16; | 8348 | range->we_version_source = 18; |
| 8391 | 8349 | ||
| 8392 | i = 0; | 8350 | i = 0; |
| 8393 | if (priv->ieee->mode & (IEEE_B | IEEE_G)) { | 8351 | if (priv->ieee->mode & (IEEE_B | IEEE_G)) { |
| 8394 | for (j = 0; j < geo->bg_channels && i < IW_MAX_FREQUENCIES; | 8352 | for (j = 0; j < geo->bg_channels && i < IW_MAX_FREQUENCIES; j++) { |
| 8395 | i++, j++) { | 8353 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && |
| 8354 | (geo->bg[j].flags & IEEE80211_CH_PASSIVE_ONLY)) | ||
| 8355 | continue; | ||
| 8356 | |||
| 8396 | range->freq[i].i = geo->bg[j].channel; | 8357 | range->freq[i].i = geo->bg[j].channel; |
| 8397 | range->freq[i].m = geo->bg[j].freq * 100000; | 8358 | range->freq[i].m = geo->bg[j].freq * 100000; |
| 8398 | range->freq[i].e = 1; | 8359 | range->freq[i].e = 1; |
| 8360 | i++; | ||
| 8399 | } | 8361 | } |
| 8400 | } | 8362 | } |
| 8401 | 8363 | ||
| 8402 | if (priv->ieee->mode & IEEE_A) { | 8364 | if (priv->ieee->mode & IEEE_A) { |
| 8403 | for (j = 0; j < geo->a_channels && i < IW_MAX_FREQUENCIES; | 8365 | for (j = 0; j < geo->a_channels && i < IW_MAX_FREQUENCIES; j++) { |
| 8404 | i++, j++) { | 8366 | if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && |
| 8367 | (geo->a[j].flags & IEEE80211_CH_PASSIVE_ONLY)) | ||
| 8368 | continue; | ||
| 8369 | |||
| 8405 | range->freq[i].i = geo->a[j].channel; | 8370 | range->freq[i].i = geo->a[j].channel; |
| 8406 | range->freq[i].m = geo->a[j].freq * 100000; | 8371 | range->freq[i].m = geo->a[j].freq * 100000; |
| 8407 | range->freq[i].e = 1; | 8372 | range->freq[i].e = 1; |
| 8373 | i++; | ||
| 8408 | } | 8374 | } |
| 8409 | } | 8375 | } |
| 8410 | 8376 | ||
| 8411 | range->num_channels = i; | 8377 | range->num_channels = i; |
| 8412 | range->num_frequency = i; | 8378 | range->num_frequency = i; |
| 8413 | 8379 | ||
| 8414 | up(&priv->sem); | 8380 | mutex_unlock(&priv->mutex); |
| 8415 | 8381 | ||
| 8416 | /* Event capability (kernel + driver) */ | 8382 | /* Event capability (kernel + driver) */ |
| 8417 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | 8383 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| @@ -8419,6 +8385,9 @@ static int ipw_wx_get_range(struct net_device *dev, | |||
| 8419 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | 8385 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); |
| 8420 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | 8386 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 8421 | 8387 | ||
| 8388 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | | ||
| 8389 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; | ||
| 8390 | |||
| 8422 | IPW_DEBUG_WX("GET Range\n"); | 8391 | IPW_DEBUG_WX("GET Range\n"); |
| 8423 | return 0; | 8392 | return 0; |
| 8424 | } | 8393 | } |
| @@ -8438,7 +8407,7 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
| 8438 | 8407 | ||
| 8439 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) | 8408 | if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) |
| 8440 | return -EINVAL; | 8409 | return -EINVAL; |
| 8441 | down(&priv->sem); | 8410 | mutex_lock(&priv->mutex); |
| 8442 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || | 8411 | if (!memcmp(any, wrqu->ap_addr.sa_data, ETH_ALEN) || |
| 8443 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8412 | !memcmp(off, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
| 8444 | /* we disable mandatory BSSID association */ | 8413 | /* we disable mandatory BSSID association */ |
| @@ -8447,14 +8416,14 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
| 8447 | IPW_DEBUG_ASSOC("Attempting to associate with new " | 8416 | IPW_DEBUG_ASSOC("Attempting to associate with new " |
| 8448 | "parameters.\n"); | 8417 | "parameters.\n"); |
| 8449 | ipw_associate(priv); | 8418 | ipw_associate(priv); |
| 8450 | up(&priv->sem); | 8419 | mutex_unlock(&priv->mutex); |
| 8451 | return 0; | 8420 | return 0; |
| 8452 | } | 8421 | } |
| 8453 | 8422 | ||
| 8454 | priv->config |= CFG_STATIC_BSSID; | 8423 | priv->config |= CFG_STATIC_BSSID; |
| 8455 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { | 8424 | if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { |
| 8456 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); | 8425 | IPW_DEBUG_WX("BSSID set to current BSSID.\n"); |
| 8457 | up(&priv->sem); | 8426 | mutex_unlock(&priv->mutex); |
| 8458 | return 0; | 8427 | return 0; |
| 8459 | } | 8428 | } |
| 8460 | 8429 | ||
| @@ -8468,7 +8437,7 @@ static int ipw_wx_set_wap(struct net_device *dev, | |||
| 8468 | if (!ipw_disassociate(priv)) | 8437 | if (!ipw_disassociate(priv)) |
| 8469 | ipw_associate(priv); | 8438 | ipw_associate(priv); |
| 8470 | 8439 | ||
| 8471 | up(&priv->sem); | 8440 | mutex_unlock(&priv->mutex); |
| 8472 | return 0; | 8441 | return 0; |
| 8473 | } | 8442 | } |
| 8474 | 8443 | ||
| @@ -8479,7 +8448,7 @@ static int ipw_wx_get_wap(struct net_device *dev, | |||
| 8479 | struct ipw_priv *priv = ieee80211_priv(dev); | 8448 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8480 | /* If we are associated, trying to associate, or have a statically | 8449 | /* If we are associated, trying to associate, or have a statically |
| 8481 | * configured BSSID then return that; otherwise return ANY */ | 8450 | * configured BSSID then return that; otherwise return ANY */ |
| 8482 | down(&priv->sem); | 8451 | mutex_lock(&priv->mutex); |
| 8483 | if (priv->config & CFG_STATIC_BSSID || | 8452 | if (priv->config & CFG_STATIC_BSSID || |
| 8484 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8453 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
| 8485 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; | 8454 | wrqu->ap_addr.sa_family = ARPHRD_ETHER; |
| @@ -8489,7 +8458,7 @@ static int ipw_wx_get_wap(struct net_device *dev, | |||
| 8489 | 8458 | ||
| 8490 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", | 8459 | IPW_DEBUG_WX("Getting WAP BSSID: " MAC_FMT "\n", |
| 8491 | MAC_ARG(wrqu->ap_addr.sa_data)); | 8460 | MAC_ARG(wrqu->ap_addr.sa_data)); |
| 8492 | up(&priv->sem); | 8461 | mutex_unlock(&priv->mutex); |
| 8493 | return 0; | 8462 | return 0; |
| 8494 | } | 8463 | } |
| 8495 | 8464 | ||
| @@ -8500,7 +8469,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
| 8500 | struct ipw_priv *priv = ieee80211_priv(dev); | 8469 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8501 | char *essid = ""; /* ANY */ | 8470 | char *essid = ""; /* ANY */ |
| 8502 | int length = 0; | 8471 | int length = 0; |
| 8503 | down(&priv->sem); | 8472 | mutex_lock(&priv->mutex); |
| 8504 | if (wrqu->essid.flags && wrqu->essid.length) { | 8473 | if (wrqu->essid.flags && wrqu->essid.length) { |
| 8505 | length = wrqu->essid.length - 1; | 8474 | length = wrqu->essid.length - 1; |
| 8506 | essid = extra; | 8475 | essid = extra; |
| @@ -8515,7 +8484,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
| 8515 | priv->config &= ~CFG_STATIC_ESSID; | 8484 | priv->config &= ~CFG_STATIC_ESSID; |
| 8516 | ipw_associate(priv); | 8485 | ipw_associate(priv); |
| 8517 | } | 8486 | } |
| 8518 | up(&priv->sem); | 8487 | mutex_unlock(&priv->mutex); |
| 8519 | return 0; | 8488 | return 0; |
| 8520 | } | 8489 | } |
| 8521 | 8490 | ||
| @@ -8525,7 +8494,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
| 8525 | 8494 | ||
| 8526 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { | 8495 | if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { |
| 8527 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); | 8496 | IPW_DEBUG_WX("ESSID set to current ESSID.\n"); |
| 8528 | up(&priv->sem); | 8497 | mutex_unlock(&priv->mutex); |
| 8529 | return 0; | 8498 | return 0; |
| 8530 | } | 8499 | } |
| 8531 | 8500 | ||
| @@ -8540,7 +8509,7 @@ static int ipw_wx_set_essid(struct net_device *dev, | |||
| 8540 | if (!ipw_disassociate(priv)) | 8509 | if (!ipw_disassociate(priv)) |
| 8541 | ipw_associate(priv); | 8510 | ipw_associate(priv); |
| 8542 | 8511 | ||
| 8543 | up(&priv->sem); | 8512 | mutex_unlock(&priv->mutex); |
| 8544 | return 0; | 8513 | return 0; |
| 8545 | } | 8514 | } |
| 8546 | 8515 | ||
| @@ -8552,7 +8521,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
| 8552 | 8521 | ||
| 8553 | /* If we are associated, trying to associate, or have a statically | 8522 | /* If we are associated, trying to associate, or have a statically |
| 8554 | * configured ESSID then return that; otherwise return ANY */ | 8523 | * configured ESSID then return that; otherwise return ANY */ |
| 8555 | down(&priv->sem); | 8524 | mutex_lock(&priv->mutex); |
| 8556 | if (priv->config & CFG_STATIC_ESSID || | 8525 | if (priv->config & CFG_STATIC_ESSID || |
| 8557 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { | 8526 | priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { |
| 8558 | IPW_DEBUG_WX("Getting essid: '%s'\n", | 8527 | IPW_DEBUG_WX("Getting essid: '%s'\n", |
| @@ -8565,7 +8534,7 @@ static int ipw_wx_get_essid(struct net_device *dev, | |||
| 8565 | wrqu->essid.length = 0; | 8534 | wrqu->essid.length = 0; |
| 8566 | wrqu->essid.flags = 0; /* active */ | 8535 | wrqu->essid.flags = 0; /* active */ |
| 8567 | } | 8536 | } |
| 8568 | up(&priv->sem); | 8537 | mutex_unlock(&priv->mutex); |
| 8569 | return 0; | 8538 | return 0; |
| 8570 | } | 8539 | } |
| 8571 | 8540 | ||
| @@ -8578,12 +8547,12 @@ static int ipw_wx_set_nick(struct net_device *dev, | |||
| 8578 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); | 8547 | IPW_DEBUG_WX("Setting nick to '%s'\n", extra); |
| 8579 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) | 8548 | if (wrqu->data.length > IW_ESSID_MAX_SIZE) |
| 8580 | return -E2BIG; | 8549 | return -E2BIG; |
| 8581 | down(&priv->sem); | 8550 | mutex_lock(&priv->mutex); |
| 8582 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); | 8551 | wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); |
| 8583 | memset(priv->nick, 0, sizeof(priv->nick)); | 8552 | memset(priv->nick, 0, sizeof(priv->nick)); |
| 8584 | memcpy(priv->nick, extra, wrqu->data.length); | 8553 | memcpy(priv->nick, extra, wrqu->data.length); |
| 8585 | IPW_DEBUG_TRACE("<<\n"); | 8554 | IPW_DEBUG_TRACE("<<\n"); |
| 8586 | up(&priv->sem); | 8555 | mutex_unlock(&priv->mutex); |
| 8587 | return 0; | 8556 | return 0; |
| 8588 | 8557 | ||
| 8589 | } | 8558 | } |
| @@ -8594,11 +8563,57 @@ static int ipw_wx_get_nick(struct net_device *dev, | |||
| 8594 | { | 8563 | { |
| 8595 | struct ipw_priv *priv = ieee80211_priv(dev); | 8564 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8596 | IPW_DEBUG_WX("Getting nick\n"); | 8565 | IPW_DEBUG_WX("Getting nick\n"); |
| 8597 | down(&priv->sem); | 8566 | mutex_lock(&priv->mutex); |
| 8598 | wrqu->data.length = strlen(priv->nick) + 1; | 8567 | wrqu->data.length = strlen(priv->nick) + 1; |
| 8599 | memcpy(extra, priv->nick, wrqu->data.length); | 8568 | memcpy(extra, priv->nick, wrqu->data.length); |
| 8600 | wrqu->data.flags = 1; /* active */ | 8569 | wrqu->data.flags = 1; /* active */ |
| 8601 | up(&priv->sem); | 8570 | mutex_unlock(&priv->mutex); |
| 8571 | return 0; | ||
| 8572 | } | ||
| 8573 | |||
| 8574 | static int ipw_wx_set_sens(struct net_device *dev, | ||
| 8575 | struct iw_request_info *info, | ||
| 8576 | union iwreq_data *wrqu, char *extra) | ||
| 8577 | { | ||
| 8578 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
| 8579 | int err = 0; | ||
| 8580 | |||
| 8581 | IPW_DEBUG_WX("Setting roaming threshold to %d\n", wrqu->sens.value); | ||
| 8582 | IPW_DEBUG_WX("Setting disassociate threshold to %d\n", 3*wrqu->sens.value); | ||
| 8583 | mutex_lock(&priv->mutex); | ||
| 8584 | |||
| 8585 | if (wrqu->sens.fixed == 0) | ||
| 8586 | { | ||
| 8587 | priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; | ||
| 8588 | priv->disassociate_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; | ||
| 8589 | goto out; | ||
| 8590 | } | ||
| 8591 | if ((wrqu->sens.value > IPW_MB_ROAMING_THRESHOLD_MAX) || | ||
| 8592 | (wrqu->sens.value < IPW_MB_ROAMING_THRESHOLD_MIN)) { | ||
| 8593 | err = -EINVAL; | ||
| 8594 | goto out; | ||
| 8595 | } | ||
| 8596 | |||
| 8597 | priv->roaming_threshold = wrqu->sens.value; | ||
| 8598 | priv->disassociate_threshold = 3*wrqu->sens.value; | ||
| 8599 | out: | ||
| 8600 | mutex_unlock(&priv->mutex); | ||
| 8601 | return err; | ||
| 8602 | } | ||
| 8603 | |||
| 8604 | static int ipw_wx_get_sens(struct net_device *dev, | ||
| 8605 | struct iw_request_info *info, | ||
| 8606 | union iwreq_data *wrqu, char *extra) | ||
| 8607 | { | ||
| 8608 | struct ipw_priv *priv = ieee80211_priv(dev); | ||
| 8609 | mutex_lock(&priv->mutex); | ||
| 8610 | wrqu->sens.fixed = 1; | ||
| 8611 | wrqu->sens.value = priv->roaming_threshold; | ||
| 8612 | mutex_unlock(&priv->mutex); | ||
| 8613 | |||
| 8614 | IPW_DEBUG_WX("GET roaming threshold -> %s %d \n", | ||
| 8615 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); | ||
| 8616 | |||
| 8602 | return 0; | 8617 | return 0; |
| 8603 | } | 8618 | } |
| 8604 | 8619 | ||
| @@ -8691,7 +8706,7 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
| 8691 | apply: | 8706 | apply: |
| 8692 | IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", | 8707 | IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", |
| 8693 | mask, fixed ? "fixed" : "sub-rates"); | 8708 | mask, fixed ? "fixed" : "sub-rates"); |
| 8694 | down(&priv->sem); | 8709 | mutex_lock(&priv->mutex); |
| 8695 | if (mask == IEEE80211_DEFAULT_RATES_MASK) { | 8710 | if (mask == IEEE80211_DEFAULT_RATES_MASK) { |
| 8696 | priv->config &= ~CFG_FIXED_RATE; | 8711 | priv->config &= ~CFG_FIXED_RATE; |
| 8697 | ipw_set_fixed_rate(priv, priv->ieee->mode); | 8712 | ipw_set_fixed_rate(priv, priv->ieee->mode); |
| @@ -8700,7 +8715,7 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
| 8700 | 8715 | ||
| 8701 | if (priv->rates_mask == mask) { | 8716 | if (priv->rates_mask == mask) { |
| 8702 | IPW_DEBUG_WX("Mask set to current mask.\n"); | 8717 | IPW_DEBUG_WX("Mask set to current mask.\n"); |
| 8703 | up(&priv->sem); | 8718 | mutex_unlock(&priv->mutex); |
| 8704 | return 0; | 8719 | return 0; |
| 8705 | } | 8720 | } |
| 8706 | 8721 | ||
| @@ -8711,7 +8726,7 @@ static int ipw_wx_set_rate(struct net_device *dev, | |||
| 8711 | if (!ipw_disassociate(priv)) | 8726 | if (!ipw_disassociate(priv)) |
| 8712 | ipw_associate(priv); | 8727 | ipw_associate(priv); |
| 8713 | 8728 | ||
| 8714 | up(&priv->sem); | 8729 | mutex_unlock(&priv->mutex); |
| 8715 | return 0; | 8730 | return 0; |
| 8716 | } | 8731 | } |
| 8717 | 8732 | ||
| @@ -8720,9 +8735,9 @@ static int ipw_wx_get_rate(struct net_device *dev, | |||
| 8720 | union iwreq_data *wrqu, char *extra) | 8735 | union iwreq_data *wrqu, char *extra) |
| 8721 | { | 8736 | { |
| 8722 | struct ipw_priv *priv = ieee80211_priv(dev); | 8737 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8723 | down(&priv->sem); | 8738 | mutex_lock(&priv->mutex); |
| 8724 | wrqu->bitrate.value = priv->last_rate; | 8739 | wrqu->bitrate.value = priv->last_rate; |
| 8725 | up(&priv->sem); | 8740 | mutex_unlock(&priv->mutex); |
| 8726 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); | 8741 | IPW_DEBUG_WX("GET Rate -> %d \n", wrqu->bitrate.value); |
| 8727 | return 0; | 8742 | return 0; |
| 8728 | } | 8743 | } |
| @@ -8732,20 +8747,20 @@ static int ipw_wx_set_rts(struct net_device *dev, | |||
| 8732 | union iwreq_data *wrqu, char *extra) | 8747 | union iwreq_data *wrqu, char *extra) |
| 8733 | { | 8748 | { |
| 8734 | struct ipw_priv *priv = ieee80211_priv(dev); | 8749 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8735 | down(&priv->sem); | 8750 | mutex_lock(&priv->mutex); |
| 8736 | if (wrqu->rts.disabled) | 8751 | if (wrqu->rts.disabled) |
| 8737 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; | 8752 | priv->rts_threshold = DEFAULT_RTS_THRESHOLD; |
| 8738 | else { | 8753 | else { |
| 8739 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || | 8754 | if (wrqu->rts.value < MIN_RTS_THRESHOLD || |
| 8740 | wrqu->rts.value > MAX_RTS_THRESHOLD) { | 8755 | wrqu->rts.value > MAX_RTS_THRESHOLD) { |
| 8741 | up(&priv->sem); | 8756 | mutex_unlock(&priv->mutex); |
| 8742 | return -EINVAL; | 8757 | return -EINVAL; |
| 8743 | } | 8758 | } |
| 8744 | priv->rts_threshold = wrqu->rts.value; | 8759 | priv->rts_threshold = wrqu->rts.value; |
| 8745 | } | 8760 | } |
| 8746 | 8761 | ||
| 8747 | ipw_send_rts_threshold(priv, priv->rts_threshold); | 8762 | ipw_send_rts_threshold(priv, priv->rts_threshold); |
| 8748 | up(&priv->sem); | 8763 | mutex_unlock(&priv->mutex); |
| 8749 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); | 8764 | IPW_DEBUG_WX("SET RTS Threshold -> %d \n", priv->rts_threshold); |
| 8750 | return 0; | 8765 | return 0; |
| 8751 | } | 8766 | } |
| @@ -8755,11 +8770,11 @@ static int ipw_wx_get_rts(struct net_device *dev, | |||
| 8755 | union iwreq_data *wrqu, char *extra) | 8770 | union iwreq_data *wrqu, char *extra) |
| 8756 | { | 8771 | { |
| 8757 | struct ipw_priv *priv = ieee80211_priv(dev); | 8772 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8758 | down(&priv->sem); | 8773 | mutex_lock(&priv->mutex); |
| 8759 | wrqu->rts.value = priv->rts_threshold; | 8774 | wrqu->rts.value = priv->rts_threshold; |
| 8760 | wrqu->rts.fixed = 0; /* no auto select */ | 8775 | wrqu->rts.fixed = 0; /* no auto select */ |
| 8761 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); | 8776 | wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); |
| 8762 | up(&priv->sem); | 8777 | mutex_unlock(&priv->mutex); |
| 8763 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); | 8778 | IPW_DEBUG_WX("GET RTS Threshold -> %d \n", wrqu->rts.value); |
| 8764 | return 0; | 8779 | return 0; |
| 8765 | } | 8780 | } |
| @@ -8771,7 +8786,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
| 8771 | struct ipw_priv *priv = ieee80211_priv(dev); | 8786 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8772 | int err = 0; | 8787 | int err = 0; |
| 8773 | 8788 | ||
| 8774 | down(&priv->sem); | 8789 | mutex_lock(&priv->mutex); |
| 8775 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { | 8790 | if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { |
| 8776 | err = -EINPROGRESS; | 8791 | err = -EINPROGRESS; |
| 8777 | goto out; | 8792 | goto out; |
| @@ -8794,7 +8809,7 @@ static int ipw_wx_set_txpow(struct net_device *dev, | |||
| 8794 | priv->tx_power = wrqu->power.value; | 8809 | priv->tx_power = wrqu->power.value; |
| 8795 | err = ipw_set_tx_power(priv); | 8810 | err = ipw_set_tx_power(priv); |
| 8796 | out: | 8811 | out: |
| 8797 | up(&priv->sem); | 8812 | mutex_unlock(&priv->mutex); |
| 8798 | return err; | 8813 | return err; |
| 8799 | } | 8814 | } |
| 8800 | 8815 | ||
| @@ -8803,12 +8818,12 @@ static int ipw_wx_get_txpow(struct net_device *dev, | |||
| 8803 | union iwreq_data *wrqu, char *extra) | 8818 | union iwreq_data *wrqu, char *extra) |
| 8804 | { | 8819 | { |
| 8805 | struct ipw_priv *priv = ieee80211_priv(dev); | 8820 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8806 | down(&priv->sem); | 8821 | mutex_lock(&priv->mutex); |
| 8807 | wrqu->power.value = priv->tx_power; | 8822 | wrqu->power.value = priv->tx_power; |
| 8808 | wrqu->power.fixed = 1; | 8823 | wrqu->power.fixed = 1; |
| 8809 | wrqu->power.flags = IW_TXPOW_DBM; | 8824 | wrqu->power.flags = IW_TXPOW_DBM; |
| 8810 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; | 8825 | wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; |
| 8811 | up(&priv->sem); | 8826 | mutex_unlock(&priv->mutex); |
| 8812 | 8827 | ||
| 8813 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", | 8828 | IPW_DEBUG_WX("GET TX Power -> %s %d \n", |
| 8814 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); | 8829 | wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); |
| @@ -8821,13 +8836,13 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
| 8821 | union iwreq_data *wrqu, char *extra) | 8836 | union iwreq_data *wrqu, char *extra) |
| 8822 | { | 8837 | { |
| 8823 | struct ipw_priv *priv = ieee80211_priv(dev); | 8838 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8824 | down(&priv->sem); | 8839 | mutex_lock(&priv->mutex); |
| 8825 | if (wrqu->frag.disabled) | 8840 | if (wrqu->frag.disabled) |
| 8826 | priv->ieee->fts = DEFAULT_FTS; | 8841 | priv->ieee->fts = DEFAULT_FTS; |
| 8827 | else { | 8842 | else { |
| 8828 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || | 8843 | if (wrqu->frag.value < MIN_FRAG_THRESHOLD || |
| 8829 | wrqu->frag.value > MAX_FRAG_THRESHOLD) { | 8844 | wrqu->frag.value > MAX_FRAG_THRESHOLD) { |
| 8830 | up(&priv->sem); | 8845 | mutex_unlock(&priv->mutex); |
| 8831 | return -EINVAL; | 8846 | return -EINVAL; |
| 8832 | } | 8847 | } |
| 8833 | 8848 | ||
| @@ -8835,7 +8850,7 @@ static int ipw_wx_set_frag(struct net_device *dev, | |||
| 8835 | } | 8850 | } |
| 8836 | 8851 | ||
| 8837 | ipw_send_frag_threshold(priv, wrqu->frag.value); | 8852 | ipw_send_frag_threshold(priv, wrqu->frag.value); |
| 8838 | up(&priv->sem); | 8853 | mutex_unlock(&priv->mutex); |
| 8839 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); | 8854 | IPW_DEBUG_WX("SET Frag Threshold -> %d \n", wrqu->frag.value); |
| 8840 | return 0; | 8855 | return 0; |
| 8841 | } | 8856 | } |
| @@ -8845,11 +8860,11 @@ static int ipw_wx_get_frag(struct net_device *dev, | |||
| 8845 | union iwreq_data *wrqu, char *extra) | 8860 | union iwreq_data *wrqu, char *extra) |
| 8846 | { | 8861 | { |
| 8847 | struct ipw_priv *priv = ieee80211_priv(dev); | 8862 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8848 | down(&priv->sem); | 8863 | mutex_lock(&priv->mutex); |
| 8849 | wrqu->frag.value = priv->ieee->fts; | 8864 | wrqu->frag.value = priv->ieee->fts; |
| 8850 | wrqu->frag.fixed = 0; /* no auto select */ | 8865 | wrqu->frag.fixed = 0; /* no auto select */ |
| 8851 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); | 8866 | wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); |
| 8852 | up(&priv->sem); | 8867 | mutex_unlock(&priv->mutex); |
| 8853 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); | 8868 | IPW_DEBUG_WX("GET Frag Threshold -> %d \n", wrqu->frag.value); |
| 8854 | 8869 | ||
| 8855 | return 0; | 8870 | return 0; |
| @@ -8870,7 +8885,7 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
| 8870 | if (wrqu->retry.value < 0 || wrqu->retry.value > 255) | 8885 | if (wrqu->retry.value < 0 || wrqu->retry.value > 255) |
| 8871 | return -EINVAL; | 8886 | return -EINVAL; |
| 8872 | 8887 | ||
| 8873 | down(&priv->sem); | 8888 | mutex_lock(&priv->mutex); |
| 8874 | if (wrqu->retry.flags & IW_RETRY_MIN) | 8889 | if (wrqu->retry.flags & IW_RETRY_MIN) |
| 8875 | priv->short_retry_limit = (u8) wrqu->retry.value; | 8890 | priv->short_retry_limit = (u8) wrqu->retry.value; |
| 8876 | else if (wrqu->retry.flags & IW_RETRY_MAX) | 8891 | else if (wrqu->retry.flags & IW_RETRY_MAX) |
| @@ -8882,7 +8897,7 @@ static int ipw_wx_set_retry(struct net_device *dev, | |||
| 8882 | 8897 | ||
| 8883 | ipw_send_retry_limit(priv, priv->short_retry_limit, | 8898 | ipw_send_retry_limit(priv, priv->short_retry_limit, |
| 8884 | priv->long_retry_limit); | 8899 | priv->long_retry_limit); |
| 8885 | up(&priv->sem); | 8900 | mutex_unlock(&priv->mutex); |
| 8886 | IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", | 8901 | IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", |
| 8887 | priv->short_retry_limit, priv->long_retry_limit); | 8902 | priv->short_retry_limit, priv->long_retry_limit); |
| 8888 | return 0; | 8903 | return 0; |
| @@ -8894,11 +8909,11 @@ static int ipw_wx_get_retry(struct net_device *dev, | |||
| 8894 | { | 8909 | { |
| 8895 | struct ipw_priv *priv = ieee80211_priv(dev); | 8910 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 8896 | 8911 | ||
| 8897 | down(&priv->sem); | 8912 | mutex_lock(&priv->mutex); |
| 8898 | wrqu->retry.disabled = 0; | 8913 | wrqu->retry.disabled = 0; |
| 8899 | 8914 | ||
| 8900 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | 8915 | if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { |
| 8901 | up(&priv->sem); | 8916 | mutex_unlock(&priv->mutex); |
| 8902 | return -EINVAL; | 8917 | return -EINVAL; |
| 8903 | } | 8918 | } |
| 8904 | 8919 | ||
| @@ -8912,7 +8927,7 @@ static int ipw_wx_get_retry(struct net_device *dev, | |||
| 8912 | wrqu->retry.flags = IW_RETRY_LIMIT; | 8927 | wrqu->retry.flags = IW_RETRY_LIMIT; |
| 8913 | wrqu->retry.value = priv->short_retry_limit; | 8928 | wrqu->retry.value = priv->short_retry_limit; |
| 8914 | } | 8929 | } |
| 8915 | up(&priv->sem); | 8930 | mutex_unlock(&priv->mutex); |
| 8916 | 8931 | ||
| 8917 | IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); | 8932 | IPW_DEBUG_WX("GET retry -> %d \n", wrqu->retry.value); |
| 8918 | 8933 | ||
| @@ -8929,7 +8944,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | |||
| 8929 | (priv->status & STATUS_EXIT_PENDING)) | 8944 | (priv->status & STATUS_EXIT_PENDING)) |
| 8930 | return 0; | 8945 | return 0; |
| 8931 | 8946 | ||
| 8932 | down(&priv->sem); | 8947 | mutex_lock(&priv->mutex); |
| 8933 | 8948 | ||
| 8934 | if (priv->status & STATUS_RF_KILL_MASK) { | 8949 | if (priv->status & STATUS_RF_KILL_MASK) { |
| 8935 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); | 8950 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); |
| @@ -8981,7 +8996,7 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | |||
| 8981 | priv->status |= STATUS_SCANNING; | 8996 | priv->status |= STATUS_SCANNING; |
| 8982 | 8997 | ||
| 8983 | done: | 8998 | done: |
| 8984 | up(&priv->sem); | 8999 | mutex_unlock(&priv->mutex); |
| 8985 | return err; | 9000 | return err; |
| 8986 | } | 9001 | } |
| 8987 | 9002 | ||
| @@ -9024,7 +9039,7 @@ static int ipw_wx_set_encode(struct net_device *dev, | |||
| 9024 | int ret; | 9039 | int ret; |
| 9025 | u32 cap = priv->capability; | 9040 | u32 cap = priv->capability; |
| 9026 | 9041 | ||
| 9027 | down(&priv->sem); | 9042 | mutex_lock(&priv->mutex); |
| 9028 | ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); | 9043 | ret = ieee80211_wx_set_encode(priv->ieee, info, wrqu, key); |
| 9029 | 9044 | ||
| 9030 | /* In IBSS mode, we need to notify the firmware to update | 9045 | /* In IBSS mode, we need to notify the firmware to update |
| @@ -9034,7 +9049,7 @@ static int ipw_wx_set_encode(struct net_device *dev, | |||
| 9034 | priv->status & STATUS_ASSOCIATED) | 9049 | priv->status & STATUS_ASSOCIATED) |
| 9035 | ipw_disassociate(priv); | 9050 | ipw_disassociate(priv); |
| 9036 | 9051 | ||
| 9037 | up(&priv->sem); | 9052 | mutex_unlock(&priv->mutex); |
| 9038 | return ret; | 9053 | return ret; |
| 9039 | } | 9054 | } |
| 9040 | 9055 | ||
| @@ -9052,17 +9067,17 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
| 9052 | { | 9067 | { |
| 9053 | struct ipw_priv *priv = ieee80211_priv(dev); | 9068 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9054 | int err; | 9069 | int err; |
| 9055 | down(&priv->sem); | 9070 | mutex_lock(&priv->mutex); |
| 9056 | if (wrqu->power.disabled) { | 9071 | if (wrqu->power.disabled) { |
| 9057 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); | 9072 | priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); |
| 9058 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); | 9073 | err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); |
| 9059 | if (err) { | 9074 | if (err) { |
| 9060 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9075 | IPW_DEBUG_WX("failed setting power mode.\n"); |
| 9061 | up(&priv->sem); | 9076 | mutex_unlock(&priv->mutex); |
| 9062 | return err; | 9077 | return err; |
| 9063 | } | 9078 | } |
| 9064 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); | 9079 | IPW_DEBUG_WX("SET Power Management Mode -> off\n"); |
| 9065 | up(&priv->sem); | 9080 | mutex_unlock(&priv->mutex); |
| 9066 | return 0; | 9081 | return 0; |
| 9067 | } | 9082 | } |
| 9068 | 9083 | ||
| @@ -9074,7 +9089,7 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
| 9074 | default: /* Otherwise we don't support it */ | 9089 | default: /* Otherwise we don't support it */ |
| 9075 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", | 9090 | IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", |
| 9076 | wrqu->power.flags); | 9091 | wrqu->power.flags); |
| 9077 | up(&priv->sem); | 9092 | mutex_unlock(&priv->mutex); |
| 9078 | return -EOPNOTSUPP; | 9093 | return -EOPNOTSUPP; |
| 9079 | } | 9094 | } |
| 9080 | 9095 | ||
| @@ -9087,12 +9102,12 @@ static int ipw_wx_set_power(struct net_device *dev, | |||
| 9087 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); | 9102 | err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); |
| 9088 | if (err) { | 9103 | if (err) { |
| 9089 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9104 | IPW_DEBUG_WX("failed setting power mode.\n"); |
| 9090 | up(&priv->sem); | 9105 | mutex_unlock(&priv->mutex); |
| 9091 | return err; | 9106 | return err; |
| 9092 | } | 9107 | } |
| 9093 | 9108 | ||
| 9094 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); | 9109 | IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); |
| 9095 | up(&priv->sem); | 9110 | mutex_unlock(&priv->mutex); |
| 9096 | return 0; | 9111 | return 0; |
| 9097 | } | 9112 | } |
| 9098 | 9113 | ||
| @@ -9101,13 +9116,13 @@ static int ipw_wx_get_power(struct net_device *dev, | |||
| 9101 | union iwreq_data *wrqu, char *extra) | 9116 | union iwreq_data *wrqu, char *extra) |
| 9102 | { | 9117 | { |
| 9103 | struct ipw_priv *priv = ieee80211_priv(dev); | 9118 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9104 | down(&priv->sem); | 9119 | mutex_lock(&priv->mutex); |
| 9105 | if (!(priv->power_mode & IPW_POWER_ENABLED)) | 9120 | if (!(priv->power_mode & IPW_POWER_ENABLED)) |
| 9106 | wrqu->power.disabled = 1; | 9121 | wrqu->power.disabled = 1; |
| 9107 | else | 9122 | else |
| 9108 | wrqu->power.disabled = 0; | 9123 | wrqu->power.disabled = 0; |
| 9109 | 9124 | ||
| 9110 | up(&priv->sem); | 9125 | mutex_unlock(&priv->mutex); |
| 9111 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); | 9126 | IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); |
| 9112 | 9127 | ||
| 9113 | return 0; | 9128 | return 0; |
| @@ -9120,7 +9135,7 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
| 9120 | struct ipw_priv *priv = ieee80211_priv(dev); | 9135 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9121 | int mode = *(int *)extra; | 9136 | int mode = *(int *)extra; |
| 9122 | int err; | 9137 | int err; |
| 9123 | down(&priv->sem); | 9138 | mutex_lock(&priv->mutex); |
| 9124 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { | 9139 | if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { |
| 9125 | mode = IPW_POWER_AC; | 9140 | mode = IPW_POWER_AC; |
| 9126 | priv->power_mode = mode; | 9141 | priv->power_mode = mode; |
| @@ -9133,11 +9148,11 @@ static int ipw_wx_set_powermode(struct net_device *dev, | |||
| 9133 | 9148 | ||
| 9134 | if (err) { | 9149 | if (err) { |
| 9135 | IPW_DEBUG_WX("failed setting power mode.\n"); | 9150 | IPW_DEBUG_WX("failed setting power mode.\n"); |
| 9136 | up(&priv->sem); | 9151 | mutex_unlock(&priv->mutex); |
| 9137 | return err; | 9152 | return err; |
| 9138 | } | 9153 | } |
| 9139 | } | 9154 | } |
| 9140 | up(&priv->sem); | 9155 | mutex_unlock(&priv->mutex); |
| 9141 | return 0; | 9156 | return 0; |
| 9142 | } | 9157 | } |
| 9143 | 9158 | ||
| @@ -9186,7 +9201,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
| 9186 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); | 9201 | IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); |
| 9187 | return -EINVAL; | 9202 | return -EINVAL; |
| 9188 | } | 9203 | } |
| 9189 | down(&priv->sem); | 9204 | mutex_lock(&priv->mutex); |
| 9190 | if (priv->adapter == IPW_2915ABG) { | 9205 | if (priv->adapter == IPW_2915ABG) { |
| 9191 | priv->ieee->abg_true = 1; | 9206 | priv->ieee->abg_true = 1; |
| 9192 | if (mode & IEEE_A) { | 9207 | if (mode & IEEE_A) { |
| @@ -9198,7 +9213,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
| 9198 | if (mode & IEEE_A) { | 9213 | if (mode & IEEE_A) { |
| 9199 | IPW_WARNING("Attempt to set 2200BG into " | 9214 | IPW_WARNING("Attempt to set 2200BG into " |
| 9200 | "802.11a mode\n"); | 9215 | "802.11a mode\n"); |
| 9201 | up(&priv->sem); | 9216 | mutex_unlock(&priv->mutex); |
| 9202 | return -EINVAL; | 9217 | return -EINVAL; |
| 9203 | } | 9218 | } |
| 9204 | 9219 | ||
| @@ -9235,7 +9250,7 @@ static int ipw_wx_set_wireless_mode(struct net_device *dev, | |||
| 9235 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", | 9250 | IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", |
| 9236 | mode & IEEE_A ? 'a' : '.', | 9251 | mode & IEEE_A ? 'a' : '.', |
| 9237 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); | 9252 | mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); |
| 9238 | up(&priv->sem); | 9253 | mutex_unlock(&priv->mutex); |
| 9239 | return 0; | 9254 | return 0; |
| 9240 | } | 9255 | } |
| 9241 | 9256 | ||
| @@ -9244,7 +9259,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
| 9244 | union iwreq_data *wrqu, char *extra) | 9259 | union iwreq_data *wrqu, char *extra) |
| 9245 | { | 9260 | { |
| 9246 | struct ipw_priv *priv = ieee80211_priv(dev); | 9261 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9247 | down(&priv->sem); | 9262 | mutex_lock(&priv->mutex); |
| 9248 | switch (priv->ieee->mode) { | 9263 | switch (priv->ieee->mode) { |
| 9249 | case IEEE_A: | 9264 | case IEEE_A: |
| 9250 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); | 9265 | strncpy(extra, "802.11a (1)", MAX_WX_STRING); |
| @@ -9275,7 +9290,7 @@ static int ipw_wx_get_wireless_mode(struct net_device *dev, | |||
| 9275 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); | 9290 | IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); |
| 9276 | 9291 | ||
| 9277 | wrqu->data.length = strlen(extra) + 1; | 9292 | wrqu->data.length = strlen(extra) + 1; |
| 9278 | up(&priv->sem); | 9293 | mutex_unlock(&priv->mutex); |
| 9279 | 9294 | ||
| 9280 | return 0; | 9295 | return 0; |
| 9281 | } | 9296 | } |
| @@ -9286,7 +9301,7 @@ static int ipw_wx_set_preamble(struct net_device *dev, | |||
| 9286 | { | 9301 | { |
| 9287 | struct ipw_priv *priv = ieee80211_priv(dev); | 9302 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9288 | int mode = *(int *)extra; | 9303 | int mode = *(int *)extra; |
| 9289 | down(&priv->sem); | 9304 | mutex_lock(&priv->mutex); |
| 9290 | /* Switching from SHORT -> LONG requires a disassociation */ | 9305 | /* Switching from SHORT -> LONG requires a disassociation */ |
| 9291 | if (mode == 1) { | 9306 | if (mode == 1) { |
| 9292 | if (!(priv->config & CFG_PREAMBLE_LONG)) { | 9307 | if (!(priv->config & CFG_PREAMBLE_LONG)) { |
| @@ -9305,11 +9320,11 @@ static int ipw_wx_set_preamble(struct net_device *dev, | |||
| 9305 | priv->config &= ~CFG_PREAMBLE_LONG; | 9320 | priv->config &= ~CFG_PREAMBLE_LONG; |
| 9306 | goto done; | 9321 | goto done; |
| 9307 | } | 9322 | } |
| 9308 | up(&priv->sem); | 9323 | mutex_unlock(&priv->mutex); |
| 9309 | return -EINVAL; | 9324 | return -EINVAL; |
| 9310 | 9325 | ||
| 9311 | done: | 9326 | done: |
| 9312 | up(&priv->sem); | 9327 | mutex_unlock(&priv->mutex); |
| 9313 | return 0; | 9328 | return 0; |
| 9314 | } | 9329 | } |
| 9315 | 9330 | ||
| @@ -9318,12 +9333,12 @@ static int ipw_wx_get_preamble(struct net_device *dev, | |||
| 9318 | union iwreq_data *wrqu, char *extra) | 9333 | union iwreq_data *wrqu, char *extra) |
| 9319 | { | 9334 | { |
| 9320 | struct ipw_priv *priv = ieee80211_priv(dev); | 9335 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9321 | down(&priv->sem); | 9336 | mutex_lock(&priv->mutex); |
| 9322 | if (priv->config & CFG_PREAMBLE_LONG) | 9337 | if (priv->config & CFG_PREAMBLE_LONG) |
| 9323 | snprintf(wrqu->name, IFNAMSIZ, "long (1)"); | 9338 | snprintf(wrqu->name, IFNAMSIZ, "long (1)"); |
| 9324 | else | 9339 | else |
| 9325 | snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); | 9340 | snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); |
| 9326 | up(&priv->sem); | 9341 | mutex_unlock(&priv->mutex); |
| 9327 | return 0; | 9342 | return 0; |
| 9328 | } | 9343 | } |
| 9329 | 9344 | ||
| @@ -9335,7 +9350,7 @@ static int ipw_wx_set_monitor(struct net_device *dev, | |||
| 9335 | struct ipw_priv *priv = ieee80211_priv(dev); | 9350 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9336 | int *parms = (int *)extra; | 9351 | int *parms = (int *)extra; |
| 9337 | int enable = (parms[0] > 0); | 9352 | int enable = (parms[0] > 0); |
| 9338 | down(&priv->sem); | 9353 | mutex_lock(&priv->mutex); |
| 9339 | IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); | 9354 | IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); |
| 9340 | if (enable) { | 9355 | if (enable) { |
| 9341 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { | 9356 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
| @@ -9350,13 +9365,13 @@ static int ipw_wx_set_monitor(struct net_device *dev, | |||
| 9350 | ipw_set_channel(priv, parms[1]); | 9365 | ipw_set_channel(priv, parms[1]); |
| 9351 | } else { | 9366 | } else { |
| 9352 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { | 9367 | if (priv->ieee->iw_mode != IW_MODE_MONITOR) { |
| 9353 | up(&priv->sem); | 9368 | mutex_unlock(&priv->mutex); |
| 9354 | return 0; | 9369 | return 0; |
| 9355 | } | 9370 | } |
| 9356 | priv->net_dev->type = ARPHRD_ETHER; | 9371 | priv->net_dev->type = ARPHRD_ETHER; |
| 9357 | queue_work(priv->workqueue, &priv->adapter_restart); | 9372 | queue_work(priv->workqueue, &priv->adapter_restart); |
| 9358 | } | 9373 | } |
| 9359 | up(&priv->sem); | 9374 | mutex_unlock(&priv->mutex); |
| 9360 | return 0; | 9375 | return 0; |
| 9361 | } | 9376 | } |
| 9362 | 9377 | ||
| @@ -9386,9 +9401,9 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
| 9386 | 9401 | ||
| 9387 | IPW_DEBUG_WX("SW_RESET\n"); | 9402 | IPW_DEBUG_WX("SW_RESET\n"); |
| 9388 | 9403 | ||
| 9389 | down(&priv->sem); | 9404 | mutex_lock(&priv->mutex); |
| 9390 | 9405 | ||
| 9391 | ret = ipw_sw_reset(priv, 0); | 9406 | ret = ipw_sw_reset(priv, 2); |
| 9392 | if (!ret) { | 9407 | if (!ret) { |
| 9393 | free_firmware(); | 9408 | free_firmware(); |
| 9394 | ipw_adapter_restart(priv); | 9409 | ipw_adapter_restart(priv); |
| @@ -9398,9 +9413,9 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
| 9398 | * module parameter, so take appropriate action */ | 9413 | * module parameter, so take appropriate action */ |
| 9399 | ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); | 9414 | ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); |
| 9400 | 9415 | ||
| 9401 | up(&priv->sem); | 9416 | mutex_unlock(&priv->mutex); |
| 9402 | ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); | 9417 | ieee80211_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); |
| 9403 | down(&priv->sem); | 9418 | mutex_lock(&priv->mutex); |
| 9404 | 9419 | ||
| 9405 | if (!(priv->status & STATUS_RF_KILL_MASK)) { | 9420 | if (!(priv->status & STATUS_RF_KILL_MASK)) { |
| 9406 | /* Configuration likely changed -- force [re]association */ | 9421 | /* Configuration likely changed -- force [re]association */ |
| @@ -9410,7 +9425,7 @@ static int ipw_wx_sw_reset(struct net_device *dev, | |||
| 9410 | ipw_associate(priv); | 9425 | ipw_associate(priv); |
| 9411 | } | 9426 | } |
| 9412 | 9427 | ||
| 9413 | up(&priv->sem); | 9428 | mutex_unlock(&priv->mutex); |
| 9414 | 9429 | ||
| 9415 | return 0; | 9430 | return 0; |
| 9416 | } | 9431 | } |
| @@ -9423,6 +9438,8 @@ static iw_handler ipw_wx_handlers[] = { | |||
| 9423 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, | 9438 | IW_IOCTL(SIOCGIWFREQ) = ipw_wx_get_freq, |
| 9424 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, | 9439 | IW_IOCTL(SIOCSIWMODE) = ipw_wx_set_mode, |
| 9425 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, | 9440 | IW_IOCTL(SIOCGIWMODE) = ipw_wx_get_mode, |
| 9441 | IW_IOCTL(SIOCSIWSENS) = ipw_wx_set_sens, | ||
| 9442 | IW_IOCTL(SIOCGIWSENS) = ipw_wx_get_sens, | ||
| 9426 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, | 9443 | IW_IOCTL(SIOCGIWRANGE) = ipw_wx_get_range, |
| 9427 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, | 9444 | IW_IOCTL(SIOCSIWAP) = ipw_wx_set_wap, |
| 9428 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, | 9445 | IW_IOCTL(SIOCGIWAP) = ipw_wx_get_wap, |
| @@ -9568,7 +9585,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) | |||
| 9568 | wstats->qual.level = average_value(&priv->average_rssi); | 9585 | wstats->qual.level = average_value(&priv->average_rssi); |
| 9569 | wstats->qual.noise = average_value(&priv->average_noise); | 9586 | wstats->qual.noise = average_value(&priv->average_noise); |
| 9570 | wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | | 9587 | wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | |
| 9571 | IW_QUAL_NOISE_UPDATED; | 9588 | IW_QUAL_NOISE_UPDATED | IW_QUAL_DBM; |
| 9572 | 9589 | ||
| 9573 | wstats->miss.beacon = average_value(&priv->average_missed_beacons); | 9590 | wstats->miss.beacon = average_value(&priv->average_missed_beacons); |
| 9574 | wstats->discard.retries = priv->last_tx_failures; | 9591 | wstats->discard.retries = priv->last_tx_failures; |
| @@ -9586,7 +9603,7 @@ static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) | |||
| 9586 | static void init_sys_config(struct ipw_sys_config *sys_config) | 9603 | static void init_sys_config(struct ipw_sys_config *sys_config) |
| 9587 | { | 9604 | { |
| 9588 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); | 9605 | memset(sys_config, 0, sizeof(struct ipw_sys_config)); |
| 9589 | sys_config->bt_coexistence = 1; /* We may need to look into prvStaBtConfig */ | 9606 | sys_config->bt_coexistence = 0; |
| 9590 | sys_config->answer_broadcast_ssid_probe = 0; | 9607 | sys_config->answer_broadcast_ssid_probe = 0; |
| 9591 | sys_config->accept_all_data_frames = 0; | 9608 | sys_config->accept_all_data_frames = 0; |
| 9592 | sys_config->accept_non_directed_frames = 1; | 9609 | sys_config->accept_non_directed_frames = 1; |
| @@ -9594,12 +9611,13 @@ static void init_sys_config(struct ipw_sys_config *sys_config) | |||
| 9594 | sys_config->disable_unicast_decryption = 1; | 9611 | sys_config->disable_unicast_decryption = 1; |
| 9595 | sys_config->exclude_multicast_unencrypted = 0; | 9612 | sys_config->exclude_multicast_unencrypted = 0; |
| 9596 | sys_config->disable_multicast_decryption = 1; | 9613 | sys_config->disable_multicast_decryption = 1; |
| 9597 | sys_config->antenna_diversity = CFG_SYS_ANTENNA_BOTH; | 9614 | sys_config->antenna_diversity = CFG_SYS_ANTENNA_SLOW_DIV; |
| 9598 | sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */ | 9615 | sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */ |
| 9599 | sys_config->dot11g_auto_detection = 0; | 9616 | sys_config->dot11g_auto_detection = 0; |
| 9600 | sys_config->enable_cts_to_self = 0; | 9617 | sys_config->enable_cts_to_self = 0; |
| 9601 | sys_config->bt_coexist_collision_thr = 0; | 9618 | sys_config->bt_coexist_collision_thr = 0; |
| 9602 | sys_config->pass_noise_stats_to_host = 1; //1 -- fix for 256 | 9619 | sys_config->pass_noise_stats_to_host = 1; //1 -- fix for 256 |
| 9620 | sys_config->silence_threshold = 0x1e; | ||
| 9603 | } | 9621 | } |
| 9604 | 9622 | ||
| 9605 | static int ipw_net_open(struct net_device *dev) | 9623 | static int ipw_net_open(struct net_device *dev) |
| @@ -9607,11 +9625,11 @@ static int ipw_net_open(struct net_device *dev) | |||
| 9607 | struct ipw_priv *priv = ieee80211_priv(dev); | 9625 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 9608 | IPW_DEBUG_INFO("dev->open\n"); | 9626 | IPW_DEBUG_INFO("dev->open\n"); |
| 9609 | /* we should be verifying the device is ready to be opened */ | 9627 | /* we should be verifying the device is ready to be opened */ |
| 9610 | down(&priv->sem); | 9628 | mutex_lock(&priv->mutex); |
| 9611 | if (!(priv->status & STATUS_RF_KILL_MASK) && | 9629 | if (!(priv->status & STATUS_RF_KILL_MASK) && |
| 9612 | (priv->status & STATUS_ASSOCIATED)) | 9630 | (priv->status & STATUS_ASSOCIATED)) |
| 9613 | netif_start_queue(dev); | 9631 | netif_start_queue(dev); |
| 9614 | up(&priv->sem); | 9632 | mutex_unlock(&priv->mutex); |
| 9615 | return 0; | 9633 | return 0; |
| 9616 | } | 9634 | } |
| 9617 | 9635 | ||
| @@ -9647,11 +9665,6 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, | |||
| 9647 | u16 remaining_bytes; | 9665 | u16 remaining_bytes; |
| 9648 | int fc; | 9666 | int fc; |
| 9649 | 9667 | ||
| 9650 | /* If there isn't room in the queue, we return busy and let the | ||
| 9651 | * network stack requeue the packet for us */ | ||
| 9652 | if (ipw_queue_space(q) < q->high_mark) | ||
| 9653 | return NETDEV_TX_BUSY; | ||
| 9654 | |||
| 9655 | switch (priv->ieee->iw_mode) { | 9668 | switch (priv->ieee->iw_mode) { |
| 9656 | case IW_MODE_ADHOC: | 9669 | case IW_MODE_ADHOC: |
| 9657 | hdr_len = IEEE80211_3ADDR_LEN; | 9670 | hdr_len = IEEE80211_3ADDR_LEN; |
| @@ -9817,6 +9830,9 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, | |||
| 9817 | q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); | 9830 | q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); |
| 9818 | ipw_write32(priv, q->reg_w, q->first_empty); | 9831 | ipw_write32(priv, q->reg_w, q->first_empty); |
| 9819 | 9832 | ||
| 9833 | if (ipw_queue_space(q) < q->high_mark) | ||
| 9834 | netif_stop_queue(priv->net_dev); | ||
| 9835 | |||
| 9820 | return NETDEV_TX_OK; | 9836 | return NETDEV_TX_OK; |
| 9821 | 9837 | ||
| 9822 | drop: | 9838 | drop: |
| @@ -9890,13 +9906,13 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p) | |||
| 9890 | struct sockaddr *addr = p; | 9906 | struct sockaddr *addr = p; |
| 9891 | if (!is_valid_ether_addr(addr->sa_data)) | 9907 | if (!is_valid_ether_addr(addr->sa_data)) |
| 9892 | return -EADDRNOTAVAIL; | 9908 | return -EADDRNOTAVAIL; |
| 9893 | down(&priv->sem); | 9909 | mutex_lock(&priv->mutex); |
| 9894 | priv->config |= CFG_CUSTOM_MAC; | 9910 | priv->config |= CFG_CUSTOM_MAC; |
| 9895 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); | 9911 | memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); |
| 9896 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", | 9912 | printk(KERN_INFO "%s: Setting MAC to " MAC_FMT "\n", |
| 9897 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); | 9913 | priv->net_dev->name, MAC_ARG(priv->mac_addr)); |
| 9898 | queue_work(priv->workqueue, &priv->adapter_restart); | 9914 | queue_work(priv->workqueue, &priv->adapter_restart); |
| 9899 | up(&priv->sem); | 9915 | mutex_unlock(&priv->mutex); |
| 9900 | return 0; | 9916 | return 0; |
| 9901 | } | 9917 | } |
| 9902 | 9918 | ||
| @@ -9940,9 +9956,9 @@ static int ipw_ethtool_get_eeprom(struct net_device *dev, | |||
| 9940 | 9956 | ||
| 9941 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) | 9957 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
| 9942 | return -EINVAL; | 9958 | return -EINVAL; |
| 9943 | down(&p->sem); | 9959 | mutex_lock(&p->mutex); |
| 9944 | memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); | 9960 | memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); |
| 9945 | up(&p->sem); | 9961 | mutex_unlock(&p->mutex); |
| 9946 | return 0; | 9962 | return 0; |
| 9947 | } | 9963 | } |
| 9948 | 9964 | ||
| @@ -9954,12 +9970,11 @@ static int ipw_ethtool_set_eeprom(struct net_device *dev, | |||
| 9954 | 9970 | ||
| 9955 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) | 9971 | if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) |
| 9956 | return -EINVAL; | 9972 | return -EINVAL; |
| 9957 | down(&p->sem); | 9973 | mutex_lock(&p->mutex); |
| 9958 | memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); | 9974 | memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); |
| 9959 | for (i = IPW_EEPROM_DATA; | 9975 | for (i = 0; i < IPW_EEPROM_IMAGE_SIZE; i++) |
| 9960 | i < IPW_EEPROM_DATA + IPW_EEPROM_IMAGE_SIZE; i++) | 9976 | ipw_write8(p, i + IPW_EEPROM_DATA, p->eeprom[i]); |
| 9961 | ipw_write8(p, i, p->eeprom[i]); | 9977 | mutex_unlock(&p->mutex); |
| 9962 | up(&p->sem); | ||
| 9963 | return 0; | 9978 | return 0; |
| 9964 | } | 9979 | } |
| 9965 | 9980 | ||
| @@ -10054,12 +10069,12 @@ static void ipw_rf_kill(void *adapter) | |||
| 10054 | static void ipw_bg_rf_kill(void *data) | 10069 | static void ipw_bg_rf_kill(void *data) |
| 10055 | { | 10070 | { |
| 10056 | struct ipw_priv *priv = data; | 10071 | struct ipw_priv *priv = data; |
| 10057 | down(&priv->sem); | 10072 | mutex_lock(&priv->mutex); |
| 10058 | ipw_rf_kill(data); | 10073 | ipw_rf_kill(data); |
| 10059 | up(&priv->sem); | 10074 | mutex_unlock(&priv->mutex); |
| 10060 | } | 10075 | } |
| 10061 | 10076 | ||
| 10062 | void ipw_link_up(struct ipw_priv *priv) | 10077 | static void ipw_link_up(struct ipw_priv *priv) |
| 10063 | { | 10078 | { |
| 10064 | priv->last_seq_num = -1; | 10079 | priv->last_seq_num = -1; |
| 10065 | priv->last_frag_num = -1; | 10080 | priv->last_frag_num = -1; |
| @@ -10089,12 +10104,12 @@ void ipw_link_up(struct ipw_priv *priv) | |||
| 10089 | static void ipw_bg_link_up(void *data) | 10104 | static void ipw_bg_link_up(void *data) |
| 10090 | { | 10105 | { |
| 10091 | struct ipw_priv *priv = data; | 10106 | struct ipw_priv *priv = data; |
| 10092 | down(&priv->sem); | 10107 | mutex_lock(&priv->mutex); |
| 10093 | ipw_link_up(data); | 10108 | ipw_link_up(data); |
| 10094 | up(&priv->sem); | 10109 | mutex_unlock(&priv->mutex); |
| 10095 | } | 10110 | } |
| 10096 | 10111 | ||
| 10097 | void ipw_link_down(struct ipw_priv *priv) | 10112 | static void ipw_link_down(struct ipw_priv *priv) |
| 10098 | { | 10113 | { |
| 10099 | ipw_led_link_down(priv); | 10114 | ipw_led_link_down(priv); |
| 10100 | netif_carrier_off(priv->net_dev); | 10115 | netif_carrier_off(priv->net_dev); |
| @@ -10117,9 +10132,9 @@ void ipw_link_down(struct ipw_priv *priv) | |||
| 10117 | static void ipw_bg_link_down(void *data) | 10132 | static void ipw_bg_link_down(void *data) |
| 10118 | { | 10133 | { |
| 10119 | struct ipw_priv *priv = data; | 10134 | struct ipw_priv *priv = data; |
| 10120 | down(&priv->sem); | 10135 | mutex_lock(&priv->mutex); |
| 10121 | ipw_link_down(data); | 10136 | ipw_link_down(data); |
| 10122 | up(&priv->sem); | 10137 | mutex_unlock(&priv->mutex); |
| 10123 | } | 10138 | } |
| 10124 | 10139 | ||
| 10125 | static int ipw_setup_deferred_work(struct ipw_priv *priv) | 10140 | static int ipw_setup_deferred_work(struct ipw_priv *priv) |
| @@ -10292,6 +10307,20 @@ static int ipw_config(struct ipw_priv *priv) | |||
| 10292 | 10307 | ||
| 10293 | /* set basic system config settings */ | 10308 | /* set basic system config settings */ |
| 10294 | init_sys_config(&priv->sys_config); | 10309 | init_sys_config(&priv->sys_config); |
| 10310 | |||
| 10311 | /* Support Bluetooth if we have BT h/w on board, and user wants to. | ||
| 10312 | * Does not support BT priority yet (don't abort or defer our Tx) */ | ||
| 10313 | if (bt_coexist) { | ||
| 10314 | unsigned char bt_caps = priv->eeprom[EEPROM_SKU_CAPABILITY]; | ||
| 10315 | |||
| 10316 | if (bt_caps & EEPROM_SKU_CAP_BT_CHANNEL_SIG) | ||
| 10317 | priv->sys_config.bt_coexistence | ||
| 10318 | |= CFG_BT_COEXISTENCE_SIGNAL_CHNL; | ||
| 10319 | if (bt_caps & EEPROM_SKU_CAP_BT_OOB) | ||
| 10320 | priv->sys_config.bt_coexistence | ||
| 10321 | |= CFG_BT_COEXISTENCE_OOB; | ||
| 10322 | } | ||
| 10323 | |||
| 10295 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) | 10324 | if (priv->ieee->iw_mode == IW_MODE_ADHOC) |
| 10296 | priv->sys_config.answer_broadcast_ssid_probe = 1; | 10325 | priv->sys_config.answer_broadcast_ssid_probe = 1; |
| 10297 | else | 10326 | else |
| @@ -10349,6 +10378,9 @@ static int ipw_config(struct ipw_priv *priv) | |||
| 10349 | * not intended for resale of the above mentioned Intel adapters has | 10378 | * not intended for resale of the above mentioned Intel adapters has |
| 10350 | * not been tested. | 10379 | * not been tested. |
| 10351 | * | 10380 | * |
| 10381 | * Remember to update the table in README.ipw2200 when changing this | ||
| 10382 | * table. | ||
| 10383 | * | ||
| 10352 | */ | 10384 | */ |
| 10353 | static const struct ieee80211_geo ipw_geos[] = { | 10385 | static const struct ieee80211_geo ipw_geos[] = { |
| 10354 | { /* Restricted */ | 10386 | { /* Restricted */ |
| @@ -10596,96 +10628,6 @@ static const struct ieee80211_geo ipw_geos[] = { | |||
| 10596 | } | 10628 | } |
| 10597 | }; | 10629 | }; |
| 10598 | 10630 | ||
| 10599 | /* GEO code borrowed from ieee80211_geo.c */ | ||
| 10600 | static int ipw_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | ||
| 10601 | { | ||
| 10602 | int i; | ||
| 10603 | |||
| 10604 | /* Driver needs to initialize the geography map before using | ||
| 10605 | * these helper functions */ | ||
| 10606 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
| 10607 | |||
| 10608 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
| 10609 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
| 10610 | /* NOTE: If G mode is currently supported but | ||
| 10611 | * this is a B only channel, we don't see it | ||
| 10612 | * as valid. */ | ||
| 10613 | if ((ieee->geo.bg[i].channel == channel) && | ||
| 10614 | (!(ieee->mode & IEEE_G) || | ||
| 10615 | !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | ||
| 10616 | return IEEE80211_24GHZ_BAND; | ||
| 10617 | |||
| 10618 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
| 10619 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
| 10620 | if (ieee->geo.a[i].channel == channel) | ||
| 10621 | return IEEE80211_52GHZ_BAND; | ||
| 10622 | |||
| 10623 | return 0; | ||
| 10624 | } | ||
| 10625 | |||
| 10626 | static int ipw_channel_to_index(struct ieee80211_device *ieee, u8 channel) | ||
| 10627 | { | ||
| 10628 | int i; | ||
| 10629 | |||
| 10630 | /* Driver needs to initialize the geography map before using | ||
| 10631 | * these helper functions */ | ||
| 10632 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
| 10633 | |||
| 10634 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
| 10635 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
| 10636 | if (ieee->geo.bg[i].channel == channel) | ||
| 10637 | return i; | ||
| 10638 | |||
| 10639 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
| 10640 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
| 10641 | if (ieee->geo.a[i].channel == channel) | ||
| 10642 | return i; | ||
| 10643 | |||
| 10644 | return -1; | ||
| 10645 | } | ||
| 10646 | |||
| 10647 | static u8 ipw_freq_to_channel(struct ieee80211_device *ieee, u32 freq) | ||
| 10648 | { | ||
| 10649 | int i; | ||
| 10650 | |||
| 10651 | /* Driver needs to initialize the geography map before using | ||
| 10652 | * these helper functions */ | ||
| 10653 | BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
| 10654 | |||
| 10655 | freq /= 100000; | ||
| 10656 | |||
| 10657 | if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
| 10658 | for (i = 0; i < ieee->geo.bg_channels; i++) | ||
| 10659 | if (ieee->geo.bg[i].freq == freq) | ||
| 10660 | return ieee->geo.bg[i].channel; | ||
| 10661 | |||
| 10662 | if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
| 10663 | for (i = 0; i < ieee->geo.a_channels; i++) | ||
| 10664 | if (ieee->geo.a[i].freq == freq) | ||
| 10665 | return ieee->geo.a[i].channel; | ||
| 10666 | |||
| 10667 | return 0; | ||
| 10668 | } | ||
| 10669 | |||
| 10670 | static int ipw_set_geo(struct ieee80211_device *ieee, | ||
| 10671 | const struct ieee80211_geo *geo) | ||
| 10672 | { | ||
| 10673 | memcpy(ieee->geo.name, geo->name, 3); | ||
| 10674 | ieee->geo.name[3] = '\0'; | ||
| 10675 | ieee->geo.bg_channels = geo->bg_channels; | ||
| 10676 | ieee->geo.a_channels = geo->a_channels; | ||
| 10677 | memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * | ||
| 10678 | sizeof(struct ieee80211_channel)); | ||
| 10679 | memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * | ||
| 10680 | sizeof(struct ieee80211_channel)); | ||
| 10681 | return 0; | ||
| 10682 | } | ||
| 10683 | |||
| 10684 | static const struct ieee80211_geo *ipw_get_geo(struct ieee80211_device *ieee) | ||
| 10685 | { | ||
| 10686 | return &ieee->geo; | ||
| 10687 | } | ||
| 10688 | |||
| 10689 | #define MAX_HW_RESTARTS 5 | 10631 | #define MAX_HW_RESTARTS 5 |
| 10690 | static int ipw_up(struct ipw_priv *priv) | 10632 | static int ipw_up(struct ipw_priv *priv) |
| 10691 | { | 10633 | { |
| @@ -10732,14 +10674,11 @@ static int ipw_up(struct ipw_priv *priv) | |||
| 10732 | priv->eeprom[EEPROM_COUNTRY_CODE + 2]); | 10674 | priv->eeprom[EEPROM_COUNTRY_CODE + 2]); |
| 10733 | j = 0; | 10675 | j = 0; |
| 10734 | } | 10676 | } |
| 10735 | if (ipw_set_geo(priv->ieee, &ipw_geos[j])) { | 10677 | if (ieee80211_set_geo(priv->ieee, &ipw_geos[j])) { |
| 10736 | IPW_WARNING("Could not set geography."); | 10678 | IPW_WARNING("Could not set geography."); |
| 10737 | return 0; | 10679 | return 0; |
| 10738 | } | 10680 | } |
| 10739 | 10681 | ||
| 10740 | IPW_DEBUG_INFO("Geography %03d [%s] detected.\n", | ||
| 10741 | j, priv->ieee->geo.name); | ||
| 10742 | |||
| 10743 | if (priv->status & STATUS_RF_KILL_SW) { | 10682 | if (priv->status & STATUS_RF_KILL_SW) { |
| 10744 | IPW_WARNING("Radio disabled by module parameter.\n"); | 10683 | IPW_WARNING("Radio disabled by module parameter.\n"); |
| 10745 | return 0; | 10684 | return 0; |
| @@ -10782,9 +10721,9 @@ static int ipw_up(struct ipw_priv *priv) | |||
| 10782 | static void ipw_bg_up(void *data) | 10721 | static void ipw_bg_up(void *data) |
| 10783 | { | 10722 | { |
| 10784 | struct ipw_priv *priv = data; | 10723 | struct ipw_priv *priv = data; |
| 10785 | down(&priv->sem); | 10724 | mutex_lock(&priv->mutex); |
| 10786 | ipw_up(data); | 10725 | ipw_up(data); |
| 10787 | up(&priv->sem); | 10726 | mutex_unlock(&priv->mutex); |
| 10788 | } | 10727 | } |
| 10789 | 10728 | ||
| 10790 | static void ipw_deinit(struct ipw_priv *priv) | 10729 | static void ipw_deinit(struct ipw_priv *priv) |
| @@ -10853,23 +10792,23 @@ static void ipw_down(struct ipw_priv *priv) | |||
| 10853 | static void ipw_bg_down(void *data) | 10792 | static void ipw_bg_down(void *data) |
| 10854 | { | 10793 | { |
| 10855 | struct ipw_priv *priv = data; | 10794 | struct ipw_priv *priv = data; |
| 10856 | down(&priv->sem); | 10795 | mutex_lock(&priv->mutex); |
| 10857 | ipw_down(data); | 10796 | ipw_down(data); |
| 10858 | up(&priv->sem); | 10797 | mutex_unlock(&priv->mutex); |
| 10859 | } | 10798 | } |
| 10860 | 10799 | ||
| 10861 | /* Called by register_netdev() */ | 10800 | /* Called by register_netdev() */ |
| 10862 | static int ipw_net_init(struct net_device *dev) | 10801 | static int ipw_net_init(struct net_device *dev) |
| 10863 | { | 10802 | { |
| 10864 | struct ipw_priv *priv = ieee80211_priv(dev); | 10803 | struct ipw_priv *priv = ieee80211_priv(dev); |
| 10865 | down(&priv->sem); | 10804 | mutex_lock(&priv->mutex); |
| 10866 | 10805 | ||
| 10867 | if (ipw_up(priv)) { | 10806 | if (ipw_up(priv)) { |
| 10868 | up(&priv->sem); | 10807 | mutex_unlock(&priv->mutex); |
| 10869 | return -EIO; | 10808 | return -EIO; |
| 10870 | } | 10809 | } |
| 10871 | 10810 | ||
| 10872 | up(&priv->sem); | 10811 | mutex_unlock(&priv->mutex); |
| 10873 | return 0; | 10812 | return 0; |
| 10874 | } | 10813 | } |
| 10875 | 10814 | ||
| @@ -10959,7 +10898,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++) | 10898 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) |
| 10960 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); | 10899 | INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); |
| 10961 | 10900 | ||
| 10962 | init_MUTEX(&priv->sem); | 10901 | mutex_init(&priv->mutex); |
| 10963 | if (pci_enable_device(pdev)) { | 10902 | if (pci_enable_device(pdev)) { |
| 10964 | err = -ENODEV; | 10903 | err = -ENODEV; |
| 10965 | goto out_free_ieee80211; | 10904 | goto out_free_ieee80211; |
| @@ -11017,7 +10956,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 11017 | SET_MODULE_OWNER(net_dev); | 10956 | SET_MODULE_OWNER(net_dev); |
| 11018 | SET_NETDEV_DEV(net_dev, &pdev->dev); | 10957 | SET_NETDEV_DEV(net_dev, &pdev->dev); |
| 11019 | 10958 | ||
| 11020 | down(&priv->sem); | 10959 | mutex_lock(&priv->mutex); |
| 11021 | 10960 | ||
| 11022 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; | 10961 | priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; |
| 11023 | priv->ieee->set_security = shim__set_security; | 10962 | priv->ieee->set_security = shim__set_security; |
| @@ -11050,16 +10989,22 @@ 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); | 10989 | err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); |
| 11051 | if (err) { | 10990 | if (err) { |
| 11052 | IPW_ERROR("failed to create sysfs device attributes\n"); | 10991 | IPW_ERROR("failed to create sysfs device attributes\n"); |
| 11053 | up(&priv->sem); | 10992 | mutex_unlock(&priv->mutex); |
| 11054 | goto out_release_irq; | 10993 | goto out_release_irq; |
| 11055 | } | 10994 | } |
| 11056 | 10995 | ||
| 11057 | up(&priv->sem); | 10996 | mutex_unlock(&priv->mutex); |
| 11058 | err = register_netdev(net_dev); | 10997 | err = register_netdev(net_dev); |
| 11059 | if (err) { | 10998 | if (err) { |
| 11060 | IPW_ERROR("failed to register network device\n"); | 10999 | IPW_ERROR("failed to register network device\n"); |
| 11061 | goto out_remove_sysfs; | 11000 | goto out_remove_sysfs; |
| 11062 | } | 11001 | } |
| 11002 | |||
| 11003 | printk(KERN_INFO DRV_NAME ": Detected geography %s (%d 802.11bg " | ||
| 11004 | "channels, %d 802.11a channels)\n", | ||
| 11005 | priv->ieee->geo.name, priv->ieee->geo.bg_channels, | ||
| 11006 | priv->ieee->geo.a_channels); | ||
| 11007 | |||
| 11063 | return 0; | 11008 | return 0; |
| 11064 | 11009 | ||
| 11065 | out_remove_sysfs: | 11010 | out_remove_sysfs: |
| @@ -11091,13 +11036,13 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
| 11091 | if (!priv) | 11036 | if (!priv) |
| 11092 | return; | 11037 | return; |
| 11093 | 11038 | ||
| 11094 | down(&priv->sem); | 11039 | mutex_lock(&priv->mutex); |
| 11095 | 11040 | ||
| 11096 | priv->status |= STATUS_EXIT_PENDING; | 11041 | priv->status |= STATUS_EXIT_PENDING; |
| 11097 | ipw_down(priv); | 11042 | ipw_down(priv); |
| 11098 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); | 11043 | sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); |
| 11099 | 11044 | ||
| 11100 | up(&priv->sem); | 11045 | mutex_unlock(&priv->mutex); |
| 11101 | 11046 | ||
| 11102 | unregister_netdev(priv->net_dev); | 11047 | unregister_netdev(priv->net_dev); |
| 11103 | 11048 | ||
| @@ -11250,8 +11195,10 @@ MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); | |||
| 11250 | module_param(led, int, 0444); | 11195 | module_param(led, int, 0444); |
| 11251 | MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)\n"); | 11196 | MODULE_PARM_DESC(led, "enable led control on some systems (default 0 off)\n"); |
| 11252 | 11197 | ||
| 11198 | #ifdef CONFIG_IPW2200_DEBUG | ||
| 11253 | module_param(debug, int, 0444); | 11199 | module_param(debug, int, 0444); |
| 11254 | MODULE_PARM_DESC(debug, "debug output mask"); | 11200 | MODULE_PARM_DESC(debug, "debug output mask"); |
| 11201 | #endif | ||
| 11255 | 11202 | ||
| 11256 | module_param(channel, int, 0444); | 11203 | module_param(channel, int, 0444); |
| 11257 | MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); | 11204 | MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); |
| @@ -11281,12 +11228,18 @@ module_param(mode, int, 0444); | |||
| 11281 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); | 11228 | MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); |
| 11282 | #endif | 11229 | #endif |
| 11283 | 11230 | ||
| 11231 | module_param(bt_coexist, int, 0444); | ||
| 11232 | MODULE_PARM_DESC(bt_coexist, "enable bluetooth coexistence (default off)"); | ||
| 11233 | |||
| 11284 | module_param(hwcrypto, int, 0444); | 11234 | module_param(hwcrypto, int, 0444); |
| 11285 | MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default on)"); | 11235 | MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default off)"); |
| 11286 | 11236 | ||
| 11287 | module_param(cmdlog, int, 0444); | 11237 | module_param(cmdlog, int, 0444); |
| 11288 | MODULE_PARM_DESC(cmdlog, | 11238 | MODULE_PARM_DESC(cmdlog, |
| 11289 | "allocate a ring buffer for logging firmware commands"); | 11239 | "allocate a ring buffer for logging firmware commands"); |
| 11290 | 11240 | ||
| 11241 | module_param(roaming, int, 0444); | ||
| 11242 | MODULE_PARM_DESC(roaming, "enable roaming support (default on)"); | ||
| 11243 | |||
| 11291 | module_exit(ipw_exit); | 11244 | module_exit(ipw_exit); |
| 11292 | module_init(ipw_init); | 11245 | module_init(ipw_init); |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index e65620a4d79e..4b9804900702 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | ||
| 3 | Copyright(c) 2003 - 2005 Intel Corporation. All rights reserved. | 3 | Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify it | 5 | This program is free software; you can redistribute it and/or modify it |
| 6 | under the terms of version 2 of the GNU General Public License as | 6 | under the terms of version 2 of the GNU General Public License as |
| @@ -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> |
| @@ -244,8 +246,10 @@ enum connection_manager_assoc_states { | |||
| 244 | #define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31 | 246 | #define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31 |
| 245 | 247 | ||
| 246 | #define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1 | 248 | #define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1 |
| 247 | #define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24 | 249 | #define IPW_MB_ROAMING_THRESHOLD_MIN 1 |
| 248 | #define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8 | 250 | #define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8 |
| 251 | #define IPW_MB_ROAMING_THRESHOLD_MAX 30 | ||
| 252 | #define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 3*IPW_MB_ROAMING_THRESHOLD_DEFAULT | ||
| 249 | #define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300 | 253 | #define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300 |
| 250 | 254 | ||
| 251 | #define MACADRR_BYTE_LEN 6 | 255 | #define MACADRR_BYTE_LEN 6 |
| @@ -616,13 +620,16 @@ struct notif_tgi_tx_key { | |||
| 616 | u8 reserved; | 620 | u8 reserved; |
| 617 | } __attribute__ ((packed)); | 621 | } __attribute__ ((packed)); |
| 618 | 622 | ||
| 623 | #define SILENCE_OVER_THRESH (1) | ||
| 624 | #define SILENCE_UNDER_THRESH (2) | ||
| 625 | |||
| 619 | struct notif_link_deterioration { | 626 | struct notif_link_deterioration { |
| 620 | struct ipw_cmd_stats stats; | 627 | struct ipw_cmd_stats stats; |
| 621 | u8 rate; | 628 | u8 rate; |
| 622 | u8 modulation; | 629 | u8 modulation; |
| 623 | struct rate_histogram histogram; | 630 | struct rate_histogram histogram; |
| 624 | u8 reserved1; | 631 | u8 silence_notification_type; /* SILENCE_OVER/UNDER_THRESH */ |
| 625 | u16 reserved2; | 632 | u16 silence_count; |
| 626 | } __attribute__ ((packed)); | 633 | } __attribute__ ((packed)); |
| 627 | 634 | ||
| 628 | struct notif_association { | 635 | struct notif_association { |
| @@ -780,7 +787,7 @@ struct ipw_sys_config { | |||
| 780 | u8 enable_cts_to_self; | 787 | u8 enable_cts_to_self; |
| 781 | u8 enable_multicast_filtering; | 788 | u8 enable_multicast_filtering; |
| 782 | u8 bt_coexist_collision_thr; | 789 | u8 bt_coexist_collision_thr; |
| 783 | u8 reserved2; | 790 | u8 silence_threshold; |
| 784 | u8 accept_all_mgmt_bcpr; | 791 | u8 accept_all_mgmt_bcpr; |
| 785 | u8 accept_all_mgtm_frames; | 792 | u8 accept_all_mgtm_frames; |
| 786 | u8 pass_noise_stats_to_host; | 793 | u8 pass_noise_stats_to_host; |
| @@ -852,7 +859,7 @@ struct ipw_scan_request_ext { | |||
| 852 | u16 dwell_time[IPW_SCAN_TYPES]; | 859 | u16 dwell_time[IPW_SCAN_TYPES]; |
| 853 | } __attribute__ ((packed)); | 860 | } __attribute__ ((packed)); |
| 854 | 861 | ||
| 855 | extern inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) | 862 | static inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) |
| 856 | { | 863 | { |
| 857 | if (index % 2) | 864 | if (index % 2) |
| 858 | return scan->scan_type[index / 2] & 0x0F; | 865 | return scan->scan_type[index / 2] & 0x0F; |
| @@ -860,7 +867,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; | 867 | return (scan->scan_type[index / 2] & 0xF0) >> 4; |
| 861 | } | 868 | } |
| 862 | 869 | ||
| 863 | extern inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, | 870 | static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, |
| 864 | u8 index, u8 scan_type) | 871 | u8 index, u8 scan_type) |
| 865 | { | 872 | { |
| 866 | if (index % 2) | 873 | if (index % 2) |
| @@ -1120,7 +1127,7 @@ struct ipw_priv { | |||
| 1120 | struct ieee80211_device *ieee; | 1127 | struct ieee80211_device *ieee; |
| 1121 | 1128 | ||
| 1122 | spinlock_t lock; | 1129 | spinlock_t lock; |
| 1123 | struct semaphore sem; | 1130 | struct mutex mutex; |
| 1124 | 1131 | ||
| 1125 | /* basic pci-network driver stuff */ | 1132 | /* basic pci-network driver stuff */ |
| 1126 | struct pci_dev *pci_dev; | 1133 | struct pci_dev *pci_dev; |
| @@ -1406,13 +1413,6 @@ do { if (ipw_debug_level & (level)) \ | |||
| 1406 | * Register bit definitions | 1413 | * Register bit definitions |
| 1407 | */ | 1414 | */ |
| 1408 | 1415 | ||
| 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 | 1416 | #define IPW_INTA_RW 0x00000008 |
| 1417 | #define IPW_INTA_MASK_R 0x0000000C | 1417 | #define IPW_INTA_MASK_R 0x0000000C |
| 1418 | #define IPW_INDIRECT_ADDR 0x00000010 | 1418 | #define IPW_INDIRECT_ADDR 0x00000010 |
| @@ -1459,6 +1459,11 @@ do { if (ipw_debug_level & (level)) \ | |||
| 1459 | #define IPW_DOMAIN_0_END 0x1000 | 1459 | #define IPW_DOMAIN_0_END 0x1000 |
| 1460 | #define CLX_MEM_BAR_SIZE 0x1000 | 1460 | #define CLX_MEM_BAR_SIZE 0x1000 |
| 1461 | 1461 | ||
| 1462 | /* Dino/baseband control registers bits */ | ||
| 1463 | |||
| 1464 | #define DINO_ENABLE_SYSTEM 0x80 /* 1 = baseband processor on, 0 = reset */ | ||
| 1465 | #define DINO_ENABLE_CS 0x40 /* 1 = enable ucode load */ | ||
| 1466 | #define DINO_RXFIFO_DATA 0x01 /* 1 = data available */ | ||
| 1462 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 | 1467 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 |
| 1463 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 | 1468 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 |
| 1464 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 | 1469 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 |
| @@ -1567,13 +1572,18 @@ do { if (ipw_debug_level & (level)) \ | |||
| 1567 | #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ | 1572 | #define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ |
| 1568 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ | 1573 | #define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ |
| 1569 | 1574 | ||
| 1570 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset*/ | 1575 | /* NIC type as found in the one byte EEPROM_NIC_TYPE offset */ |
| 1571 | #define EEPROM_NIC_TYPE_0 0 | 1576 | #define EEPROM_NIC_TYPE_0 0 |
| 1572 | #define EEPROM_NIC_TYPE_1 1 | 1577 | #define EEPROM_NIC_TYPE_1 1 |
| 1573 | #define EEPROM_NIC_TYPE_2 2 | 1578 | #define EEPROM_NIC_TYPE_2 2 |
| 1574 | #define EEPROM_NIC_TYPE_3 3 | 1579 | #define EEPROM_NIC_TYPE_3 3 |
| 1575 | #define EEPROM_NIC_TYPE_4 4 | 1580 | #define EEPROM_NIC_TYPE_4 4 |
| 1576 | 1581 | ||
| 1582 | /* Bluetooth Coexistence capabilities as found in EEPROM_SKU_CAPABILITY */ | ||
| 1583 | #define EEPROM_SKU_CAP_BT_CHANNEL_SIG 0x01 /* we can tell BT our channel # */ | ||
| 1584 | #define EEPROM_SKU_CAP_BT_PRIORITY 0x02 /* BT can take priority over us */ | ||
| 1585 | #define EEPROM_SKU_CAP_BT_OOB 0x04 /* we can signal BT out-of-band */ | ||
| 1586 | |||
| 1577 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 | 1587 | #define FW_MEM_REG_LOWER_BOUND 0x00300000 |
| 1578 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) | 1588 | #define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) |
| 1579 | #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) | 1589 | #define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) |
| @@ -1658,9 +1668,10 @@ enum { | |||
| 1658 | IPW_FW_ERROR_FATAL_ERROR | 1668 | IPW_FW_ERROR_FATAL_ERROR |
| 1659 | }; | 1669 | }; |
| 1660 | 1670 | ||
| 1661 | #define AUTH_OPEN 0 | 1671 | #define AUTH_OPEN 0 |
| 1662 | #define AUTH_SHARED_KEY 1 | 1672 | #define AUTH_SHARED_KEY 1 |
| 1663 | #define AUTH_IGNORE 3 | 1673 | #define AUTH_LEAP 2 |
| 1674 | #define AUTH_IGNORE 3 | ||
| 1664 | 1675 | ||
| 1665 | #define HC_ASSOCIATE 0 | 1676 | #define HC_ASSOCIATE 0 |
| 1666 | #define HC_REASSOCIATE 1 | 1677 | #define HC_REASSOCIATE 1 |
| @@ -1860,7 +1871,7 @@ struct host_cmd { | |||
| 1860 | u8 cmd; | 1871 | u8 cmd; |
| 1861 | u8 len; | 1872 | u8 len; |
| 1862 | u16 reserved; | 1873 | u16 reserved; |
| 1863 | u32 param[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; | 1874 | u32 *param; |
| 1864 | } __attribute__ ((packed)); | 1875 | } __attribute__ ((packed)); |
| 1865 | 1876 | ||
| 1866 | struct ipw_cmd_log { | 1877 | struct ipw_cmd_log { |
| @@ -1869,21 +1880,24 @@ struct ipw_cmd_log { | |||
| 1869 | struct host_cmd cmd; | 1880 | struct host_cmd cmd; |
| 1870 | }; | 1881 | }; |
| 1871 | 1882 | ||
| 1872 | #define CFG_BT_COEXISTENCE_MIN 0x00 | 1883 | /* SysConfig command parameters ... */ |
| 1873 | #define CFG_BT_COEXISTENCE_DEFER 0x02 | 1884 | /* bt_coexistence param */ |
| 1874 | #define CFG_BT_COEXISTENCE_KILL 0x04 | 1885 | #define CFG_BT_COEXISTENCE_SIGNAL_CHNL 0x01 /* tell BT our chnl # */ |
| 1875 | #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 | 1886 | #define CFG_BT_COEXISTENCE_DEFER 0x02 /* defer our Tx if BT traffic */ |
| 1876 | #define CFG_BT_COEXISTENCE_OOB 0x10 | 1887 | #define CFG_BT_COEXISTENCE_KILL 0x04 /* kill our Tx if BT traffic */ |
| 1877 | #define CFG_BT_COEXISTENCE_MAX 0xFF | 1888 | #define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 /* multimedia extensions */ |
| 1878 | #define CFG_BT_COEXISTENCE_DEF 0x80 /* read Bt from EEPROM */ | 1889 | #define CFG_BT_COEXISTENCE_OOB 0x10 /* signal BT via out-of-band */ |
| 1879 | 1890 | ||
| 1880 | #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x0 | 1891 | /* clear-to-send to self param */ |
| 1881 | #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x1 | 1892 | #define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x00 |
| 1893 | #define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x01 | ||
| 1882 | #define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN | 1894 | #define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN |
| 1883 | 1895 | ||
| 1884 | #define CFG_SYS_ANTENNA_BOTH 0x000 | 1896 | /* Antenna diversity param (h/w can select best antenna, based on signal) */ |
| 1885 | #define CFG_SYS_ANTENNA_A 0x001 | 1897 | #define CFG_SYS_ANTENNA_BOTH 0x00 /* NIC selects best antenna */ |
| 1886 | #define CFG_SYS_ANTENNA_B 0x003 | 1898 | #define CFG_SYS_ANTENNA_A 0x01 /* force antenna A */ |
| 1899 | #define CFG_SYS_ANTENNA_B 0x03 /* force antenna B */ | ||
| 1900 | #define CFG_SYS_ANTENNA_SLOW_DIV 0x02 /* consider background noise */ | ||
| 1887 | 1901 | ||
| 1888 | /* | 1902 | /* |
| 1889 | * The definitions below were lifted off the ipw2100 driver, which only | 1903 | * The definitions below were lifted off the ipw2100 driver, which only |
| @@ -1899,27 +1913,4 @@ struct ipw_cmd_log { | |||
| 1899 | 1913 | ||
| 1900 | #define IPW_MAX_CONFIG_RETRIES 10 | 1914 | #define IPW_MAX_CONFIG_RETRIES 10 |
| 1901 | 1915 | ||
| 1902 | static inline u32 frame_hdr_len(struct ieee80211_hdr_4addr *hdr) | ||
| 1903 | { | ||
| 1904 | u32 retval; | ||
| 1905 | u16 fc; | ||
| 1906 | |||
| 1907 | retval = sizeof(struct ieee80211_hdr_3addr); | ||
| 1908 | fc = le16_to_cpu(hdr->frame_ctl); | ||
| 1909 | |||
| 1910 | /* | ||
| 1911 | * Function ToDS FromDS | ||
| 1912 | * IBSS 0 0 | ||
| 1913 | * To AP 1 0 | ||
| 1914 | * From AP 0 1 | ||
| 1915 | * WDS (bridge) 1 1 | ||
| 1916 | * | ||
| 1917 | * Only WDS frames use Address4 among them. --YZ | ||
| 1918 | */ | ||
| 1919 | if (!(fc & IEEE80211_FCTL_TODS) || !(fc & IEEE80211_FCTL_FROMDS)) | ||
| 1920 | retval -= ETH_ALEN; | ||
| 1921 | |||
| 1922 | return retval; | ||
| 1923 | } | ||
| 1924 | |||
| 1925 | #endif /* __ipw2200_h__ */ | 1916 | #endif /* __ipw2200_h__ */ |
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> |
