aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2006-01-20 19:35:15 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-01-30 20:35:30 -0500
commita39d3e796cd2df8576c0418faa2c3833153bb3a9 (patch)
tree6427f50efb949d7cd9a96a39183d643ccf111768
parentd86b5e0e6bf5980d3136ab4a855522143f2dcb5d (diff)
[PATCH] AIRO{,_CS} <-> CRYPTO fixes
CRYPTO is a helper variable, and to make it easier for users, it should therefore select'ed and not be listed in the dependencies. drivers/net/wireless/airo.c requires CONFIG_CRYPTO for compilations. Therefore, AIRO_CS also has to CRYPTO. Additionally, this patch removes the #ifdef's for the non-compiling CRYPTO=n case from drivers/net/wireless/airo.c. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/Kconfig4
-rw-r--r--drivers/net/wireless/airo.c55
2 files changed, 5 insertions, 54 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 9ccfec50f733..3de5f1d0fbac 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -240,7 +240,8 @@ config IPW2200_DEBUG
240 240
241config AIRO 241config AIRO
242 tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" 242 tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
243 depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN) 243 depends on NET_RADIO && ISA_DMA_API && (PCI || BROKEN)
244 select CRYPTO
244 ---help--- 245 ---help---
245 This is the standard Linux driver to support Cisco/Aironet ISA and 246 This is the standard Linux driver to support Cisco/Aironet ISA and
246 PCI 802.11 wireless cards. 247 PCI 802.11 wireless cards.
@@ -388,6 +389,7 @@ config PCMCIA_SPECTRUM
388config AIRO_CS 389config AIRO_CS
389 tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" 390 tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards"
390 depends on NET_RADIO && PCMCIA && (BROKEN || !M32R) 391 depends on NET_RADIO && PCMCIA && (BROKEN || !M32R)
392 select CRYPTO
391 ---help--- 393 ---help---
392 This is the standard Linux driver to support Cisco/Aironet PCMCIA 394 This is the standard Linux driver to support Cisco/Aironet PCMCIA
393 802.11 wireless cards. This driver is the same as the Aironet 395 802.11 wireless cards. This driver is the same as the Aironet
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index a4c7ae94614d..9c577f7b6e58 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -36,6 +36,7 @@
36#include <linux/in.h> 36#include <linux/in.h>
37#include <linux/bitops.h> 37#include <linux/bitops.h>
38#include <linux/scatterlist.h> 38#include <linux/scatterlist.h>
39#include <linux/crypto.h>
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/system.h> 41#include <asm/system.h>
41 42
@@ -87,14 +88,6 @@ static struct pci_driver airo_driver = {
87#include <linux/delay.h> 88#include <linux/delay.h>
88#endif 89#endif
89 90
90/* Support Cisco MIC feature */
91#define MICSUPPORT
92
93#if defined(MICSUPPORT) && !defined(CONFIG_CRYPTO)
94#warning MIC support requires Crypto API
95#undef MICSUPPORT
96#endif
97
98/* Hack to do some power saving */ 91/* Hack to do some power saving */
99#define POWER_ON_DOWN 92#define POWER_ON_DOWN
100 93
@@ -1118,7 +1111,6 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp);
1118static int writerids(struct net_device *dev, aironet_ioctl *comp); 1111static int writerids(struct net_device *dev, aironet_ioctl *comp);
1119static int flashcard(struct net_device *dev, aironet_ioctl *comp); 1112static int flashcard(struct net_device *dev, aironet_ioctl *comp);
1120#endif /* CISCO_EXT */ 1113#endif /* CISCO_EXT */
1121#ifdef MICSUPPORT
1122static void micinit(struct airo_info *ai); 1114static void micinit(struct airo_info *ai);
1123static int micsetup(struct airo_info *ai); 1115static int micsetup(struct airo_info *ai);
1124static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len); 1116static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len);
@@ -1127,9 +1119,6 @@ static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket,
1127static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); 1119static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi);
1128static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); 1120static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm);
1129 1121
1130#include <linux/crypto.h>
1131#endif
1132
1133struct airo_info { 1122struct airo_info {
1134 struct net_device_stats stats; 1123 struct net_device_stats stats;
1135 struct net_device *dev; 1124 struct net_device *dev;
@@ -1190,12 +1179,10 @@ struct airo_info {
1190 unsigned long scan_timestamp; /* Time started to scan */ 1179 unsigned long scan_timestamp; /* Time started to scan */
1191 struct iw_spy_data spy_data; 1180 struct iw_spy_data spy_data;
1192 struct iw_public_data wireless_data; 1181 struct iw_public_data wireless_data;
1193#ifdef MICSUPPORT
1194 /* MIC stuff */ 1182 /* MIC stuff */
1195 struct crypto_tfm *tfm; 1183 struct crypto_tfm *tfm;
1196 mic_module mod[2]; 1184 mic_module mod[2];
1197 mic_statistics micstats; 1185 mic_statistics micstats;
1198#endif
1199 HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors 1186 HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors
1200 HostTxDesc txfids[MPI_MAX_FIDS]; 1187 HostTxDesc txfids[MPI_MAX_FIDS];
1201 HostRidDesc config_desc; 1188 HostRidDesc config_desc;
@@ -1229,7 +1216,6 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime);
1229static int flashputbuf(struct airo_info *ai); 1216static int flashputbuf(struct airo_info *ai);
1230static int flashrestart(struct airo_info *ai,struct net_device *dev); 1217static int flashrestart(struct airo_info *ai,struct net_device *dev);
1231 1218
1232#ifdef MICSUPPORT
1233/*********************************************************************** 1219/***********************************************************************
1234 * MIC ROUTINES * 1220 * MIC ROUTINES *
1235 *********************************************************************** 1221 ***********************************************************************
@@ -1686,7 +1672,6 @@ static void emmh32_final(emmh32_context *context, u8 digest[4])
1686 digest[2] = (val>>8) & 0xFF; 1672 digest[2] = (val>>8) & 0xFF;
1687 digest[3] = val & 0xFF; 1673 digest[3] = val & 0xFF;
1688} 1674}
1689#endif
1690 1675
1691static int readBSSListRid(struct airo_info *ai, int first, 1676static int readBSSListRid(struct airo_info *ai, int first,
1692 BSSListRid *list) { 1677 BSSListRid *list) {
@@ -2005,7 +1990,6 @@ static int mpi_send_packet (struct net_device *dev)
2005 * Firmware automaticly puts 802 header on so 1990 * Firmware automaticly puts 802 header on so
2006 * we don't need to account for it in the length 1991 * we don't need to account for it in the length
2007 */ 1992 */
2008#ifdef MICSUPPORT
2009 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && 1993 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
2010 (ntohs(((u16 *)buffer)[6]) != 0x888E)) { 1994 (ntohs(((u16 *)buffer)[6]) != 0x888E)) {
2011 MICBuffer pMic; 1995 MICBuffer pMic;
@@ -2022,9 +2006,7 @@ static int mpi_send_packet (struct net_device *dev)
2022 memcpy (sendbuf, &pMic, sizeof(pMic)); 2006 memcpy (sendbuf, &pMic, sizeof(pMic));
2023 sendbuf += sizeof(pMic); 2007 sendbuf += sizeof(pMic);
2024 memcpy (sendbuf, buffer, len - sizeof(etherHead)); 2008 memcpy (sendbuf, buffer, len - sizeof(etherHead));
2025 } else 2009 } else {
2026#endif
2027 {
2028 *payloadLen = cpu_to_le16(len - sizeof(etherHead)); 2010 *payloadLen = cpu_to_le16(len - sizeof(etherHead));
2029 2011
2030 dev->trans_start = jiffies; 2012 dev->trans_start = jiffies;
@@ -2400,9 +2382,7 @@ void stop_airo_card( struct net_device *dev, int freeres )
2400 ai->shared, ai->shared_dma); 2382 ai->shared, ai->shared_dma);
2401 } 2383 }
2402 } 2384 }
2403#ifdef MICSUPPORT
2404 crypto_free_tfm(ai->tfm); 2385 crypto_free_tfm(ai->tfm);
2405#endif
2406 del_airo_dev( dev ); 2386 del_airo_dev( dev );
2407 free_netdev( dev ); 2387 free_netdev( dev );
2408} 2388}
@@ -2726,9 +2706,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2726 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES); 2706 ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES);
2727 if (ai->thr_pid < 0) 2707 if (ai->thr_pid < 0)
2728 goto err_out_free; 2708 goto err_out_free;
2729#ifdef MICSUPPORT
2730 ai->tfm = NULL; 2709 ai->tfm = NULL;
2731#endif
2732 rc = add_airo_dev( dev ); 2710 rc = add_airo_dev( dev );
2733 if (rc) 2711 if (rc)
2734 goto err_out_thr; 2712 goto err_out_thr;
@@ -2969,10 +2947,8 @@ static int airo_thread(void *data) {
2969 airo_read_wireless_stats(ai); 2947 airo_read_wireless_stats(ai);
2970 else if (test_bit(JOB_PROMISC, &ai->flags)) 2948 else if (test_bit(JOB_PROMISC, &ai->flags))
2971 airo_set_promisc(ai); 2949 airo_set_promisc(ai);
2972#ifdef MICSUPPORT
2973 else if (test_bit(JOB_MIC, &ai->flags)) 2950 else if (test_bit(JOB_MIC, &ai->flags))
2974 micinit(ai); 2951 micinit(ai);
2975#endif
2976 else if (test_bit(JOB_EVENT, &ai->flags)) 2952 else if (test_bit(JOB_EVENT, &ai->flags))
2977 airo_send_event(dev); 2953 airo_send_event(dev);
2978 else if (test_bit(JOB_AUTOWEP, &ai->flags)) 2954 else if (test_bit(JOB_AUTOWEP, &ai->flags))
@@ -3010,12 +2986,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3010 2986
3011 if ( status & EV_MIC ) { 2987 if ( status & EV_MIC ) {
3012 OUT4500( apriv, EVACK, EV_MIC ); 2988 OUT4500( apriv, EVACK, EV_MIC );
3013#ifdef MICSUPPORT
3014 if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) { 2989 if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) {
3015 set_bit(JOB_MIC, &apriv->flags); 2990 set_bit(JOB_MIC, &apriv->flags);
3016 wake_up_interruptible(&apriv->thr_wait); 2991 wake_up_interruptible(&apriv->thr_wait);
3017 } 2992 }
3018#endif
3019 } 2993 }
3020 if ( status & EV_LINK ) { 2994 if ( status & EV_LINK ) {
3021 union iwreq_data wrqu; 2995 union iwreq_data wrqu;
@@ -3194,11 +3168,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3194 } 3168 }
3195 bap_read (apriv, buffer + hdrlen/2, len, BAP0); 3169 bap_read (apriv, buffer + hdrlen/2, len, BAP0);
3196 } else { 3170 } else {
3197#ifdef MICSUPPORT
3198 MICBuffer micbuf; 3171 MICBuffer micbuf;
3199#endif
3200 bap_read (apriv, buffer, ETH_ALEN*2, BAP0); 3172 bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
3201#ifdef MICSUPPORT
3202 if (apriv->micstats.enabled) { 3173 if (apriv->micstats.enabled) {
3203 bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0); 3174 bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
3204 if (ntohs(micbuf.typelen) > 0x05DC) 3175 if (ntohs(micbuf.typelen) > 0x05DC)
@@ -3211,15 +3182,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3211 skb_trim (skb, len + hdrlen); 3182 skb_trim (skb, len + hdrlen);
3212 } 3183 }
3213 } 3184 }
3214#endif
3215 bap_read(apriv,buffer+ETH_ALEN,len,BAP0); 3185 bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
3216#ifdef MICSUPPORT
3217 if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) { 3186 if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
3218badmic: 3187badmic:
3219 dev_kfree_skb_irq (skb); 3188 dev_kfree_skb_irq (skb);
3220#else
3221 if (0) {
3222#endif
3223badrx: 3189badrx:
3224 OUT4500( apriv, EVACK, EV_RX); 3190 OUT4500( apriv, EVACK, EV_RX);
3225 goto exitrx; 3191 goto exitrx;
@@ -3430,10 +3396,8 @@ static void mpi_receive_802_3(struct airo_info *ai)
3430 int len = 0; 3396 int len = 0;
3431 struct sk_buff *skb; 3397 struct sk_buff *skb;
3432 char *buffer; 3398 char *buffer;
3433#ifdef MICSUPPORT
3434 int off = 0; 3399 int off = 0;
3435 MICBuffer micbuf; 3400 MICBuffer micbuf;
3436#endif
3437 3401
3438 memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); 3402 memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd));
3439 /* Make sure we got something */ 3403 /* Make sure we got something */
@@ -3448,7 +3412,6 @@ static void mpi_receive_802_3(struct airo_info *ai)
3448 goto badrx; 3412 goto badrx;
3449 } 3413 }
3450 buffer = skb_put(skb,len); 3414 buffer = skb_put(skb,len);
3451#ifdef MICSUPPORT
3452 memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2); 3415 memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2);
3453 if (ai->micstats.enabled) { 3416 if (ai->micstats.enabled) {
3454 memcpy(&micbuf, 3417 memcpy(&micbuf,
@@ -3470,9 +3433,6 @@ badmic:
3470 dev_kfree_skb_irq (skb); 3433 dev_kfree_skb_irq (skb);
3471 goto badrx; 3434 goto badrx;
3472 } 3435 }
3473#else
3474 memcpy(buffer, ai->rxfids[0].virtual_host_addr, len);
3475#endif
3476#ifdef WIRELESS_SPY 3436#ifdef WIRELESS_SPY
3477 if (ai->spy_data.spy_number > 0) { 3437 if (ai->spy_data.spy_number > 0) {
3478 char *sa; 3438 char *sa;
@@ -3689,13 +3649,11 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3689 ai->config.authType = AUTH_OPEN; 3649 ai->config.authType = AUTH_OPEN;
3690 ai->config.modulation = MOD_CCK; 3650 ai->config.modulation = MOD_CCK;
3691 3651
3692#ifdef MICSUPPORT
3693 if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) && 3652 if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&
3694 (micsetup(ai) == SUCCESS)) { 3653 (micsetup(ai) == SUCCESS)) {
3695 ai->config.opmode |= MODE_MIC; 3654 ai->config.opmode |= MODE_MIC;
3696 set_bit(FLAG_MIC_CAPABLE, &ai->flags); 3655 set_bit(FLAG_MIC_CAPABLE, &ai->flags);
3697 } 3656 }
3698#endif
3699 3657
3700 /* Save off the MAC */ 3658 /* Save off the MAC */
3701 for( i = 0; i < ETH_ALEN; i++ ) { 3659 for( i = 0; i < ETH_ALEN; i++ ) {
@@ -4170,15 +4128,12 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
4170 } 4128 }
4171 len -= ETH_ALEN * 2; 4129 len -= ETH_ALEN * 2;
4172 4130
4173#ifdef MICSUPPORT
4174 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && 4131 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
4175 (ntohs(((u16 *)pPacket)[6]) != 0x888E)) { 4132 (ntohs(((u16 *)pPacket)[6]) != 0x888E)) {
4176 if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) 4133 if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS)
4177 return ERROR; 4134 return ERROR;
4178 miclen = sizeof(pMic); 4135 miclen = sizeof(pMic);
4179 } 4136 }
4180#endif
4181
4182 // packet is destination[6], source[6], payload[len-12] 4137 // packet is destination[6], source[6], payload[len-12]
4183 // write the payload length and dst/src/payload 4138 // write the payload length and dst/src/payload
4184 if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR; 4139 if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR;
@@ -7270,13 +7225,11 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
7270 case AIROGSTAT: ridcode = RID_STATUS; break; 7225 case AIROGSTAT: ridcode = RID_STATUS; break;
7271 case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; 7226 case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
7272 case AIROGSTATSC32: ridcode = RID_STATS; break; 7227 case AIROGSTATSC32: ridcode = RID_STATS; break;
7273#ifdef MICSUPPORT
7274 case AIROGMICSTATS: 7228 case AIROGMICSTATS:
7275 if (copy_to_user(comp->data, &ai->micstats, 7229 if (copy_to_user(comp->data, &ai->micstats,
7276 min((int)comp->len,(int)sizeof(ai->micstats)))) 7230 min((int)comp->len,(int)sizeof(ai->micstats))))
7277 return -EFAULT; 7231 return -EFAULT;
7278 return 0; 7232 return 0;
7279#endif
7280 case AIRORRID: ridcode = comp->ridnum; break; 7233 case AIRORRID: ridcode = comp->ridnum; break;
7281 default: 7234 default:
7282 return -EINVAL; 7235 return -EINVAL;
@@ -7308,9 +7261,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
7308static int writerids(struct net_device *dev, aironet_ioctl *comp) { 7261static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7309 struct airo_info *ai = dev->priv; 7262 struct airo_info *ai = dev->priv;
7310 int ridcode; 7263 int ridcode;
7311#ifdef MICSUPPORT
7312 int enabled; 7264 int enabled;
7313#endif
7314 Resp rsp; 7265 Resp rsp;
7315 static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); 7266 static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
7316 unsigned char *iobuf; 7267 unsigned char *iobuf;
@@ -7367,11 +7318,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7367 7318
7368 PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); 7319 PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1);
7369 7320
7370#ifdef MICSUPPORT
7371 enabled = ai->micstats.enabled; 7321 enabled = ai->micstats.enabled;
7372 memset(&ai->micstats,0,sizeof(ai->micstats)); 7322 memset(&ai->micstats,0,sizeof(ai->micstats));
7373 ai->micstats.enabled = enabled; 7323 ai->micstats.enabled = enabled;
7374#endif
7375 7324
7376 if (copy_to_user(comp->data, iobuf, 7325 if (copy_to_user(comp->data, iobuf,
7377 min((int)comp->len, (int)RIDSIZE))) { 7326 min((int)comp->len, (int)RIDSIZE))) {