|
@@ -36,6 +36,7 @@
|
|
#include <linux/in.h>
|
|
#include <linux/in.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/scatterlist.h>
|
|
#include <linux/scatterlist.h>
|
|
|
|
+#include <linux/crypto.h>
|
|
#include <asm/io.h>
|
|
#include <asm/io.h>
|
|
#include <asm/system.h>
|
|
#include <asm/system.h>
|
|
|
|
|
|
@@ -87,14 +88,6 @@ static struct pci_driver airo_driver = {
|
|
#include <linux/delay.h>
|
|
#include <linux/delay.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-/* Support Cisco MIC feature */
|
|
|
|
-#define MICSUPPORT
|
|
|
|
-
|
|
|
|
-#if defined(MICSUPPORT) && !defined(CONFIG_CRYPTO)
|
|
|
|
-#warning MIC support requires Crypto API
|
|
|
|
-#undef MICSUPPORT
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
/* Hack to do some power saving */
|
|
/* Hack to do some power saving */
|
|
#define POWER_ON_DOWN
|
|
#define POWER_ON_DOWN
|
|
|
|
|
|
@@ -1118,7 +1111,6 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp);
|
|
static int writerids(struct net_device *dev, aironet_ioctl *comp);
|
|
static int writerids(struct net_device *dev, aironet_ioctl *comp);
|
|
static int flashcard(struct net_device *dev, aironet_ioctl *comp);
|
|
static int flashcard(struct net_device *dev, aironet_ioctl *comp);
|
|
#endif /* CISCO_EXT */
|
|
#endif /* CISCO_EXT */
|
|
-#ifdef MICSUPPORT
|
|
|
|
static void micinit(struct airo_info *ai);
|
|
static void micinit(struct airo_info *ai);
|
|
static int micsetup(struct airo_info *ai);
|
|
static int micsetup(struct airo_info *ai);
|
|
static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len);
|
|
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,
|
|
static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi);
|
|
static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi);
|
|
static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm);
|
|
static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm);
|
|
|
|
|
|
-#include <linux/crypto.h>
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
struct airo_info {
|
|
struct airo_info {
|
|
struct net_device_stats stats;
|
|
struct net_device_stats stats;
|
|
struct net_device *dev;
|
|
struct net_device *dev;
|
|
@@ -1190,12 +1179,10 @@ struct airo_info {
|
|
unsigned long scan_timestamp; /* Time started to scan */
|
|
unsigned long scan_timestamp; /* Time started to scan */
|
|
struct iw_spy_data spy_data;
|
|
struct iw_spy_data spy_data;
|
|
struct iw_public_data wireless_data;
|
|
struct iw_public_data wireless_data;
|
|
-#ifdef MICSUPPORT
|
|
|
|
/* MIC stuff */
|
|
/* MIC stuff */
|
|
struct crypto_tfm *tfm;
|
|
struct crypto_tfm *tfm;
|
|
mic_module mod[2];
|
|
mic_module mod[2];
|
|
mic_statistics micstats;
|
|
mic_statistics micstats;
|
|
-#endif
|
|
|
|
HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors
|
|
HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors
|
|
HostTxDesc txfids[MPI_MAX_FIDS];
|
|
HostTxDesc txfids[MPI_MAX_FIDS];
|
|
HostRidDesc config_desc;
|
|
HostRidDesc config_desc;
|
|
@@ -1229,7 +1216,6 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime);
|
|
static int flashputbuf(struct airo_info *ai);
|
|
static int flashputbuf(struct airo_info *ai);
|
|
static int flashrestart(struct airo_info *ai,struct net_device *dev);
|
|
static int flashrestart(struct airo_info *ai,struct net_device *dev);
|
|
|
|
|
|
-#ifdef MICSUPPORT
|
|
|
|
/***********************************************************************
|
|
/***********************************************************************
|
|
* MIC ROUTINES *
|
|
* MIC ROUTINES *
|
|
***********************************************************************
|
|
***********************************************************************
|
|
@@ -1686,7 +1672,6 @@ static void emmh32_final(emmh32_context *context, u8 digest[4])
|
|
digest[2] = (val>>8) & 0xFF;
|
|
digest[2] = (val>>8) & 0xFF;
|
|
digest[3] = val & 0xFF;
|
|
digest[3] = val & 0xFF;
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
|
|
|
|
static int readBSSListRid(struct airo_info *ai, int first,
|
|
static int readBSSListRid(struct airo_info *ai, int first,
|
|
BSSListRid *list) {
|
|
BSSListRid *list) {
|
|
@@ -2005,7 +1990,6 @@ static int mpi_send_packet (struct net_device *dev)
|
|
* Firmware automaticly puts 802 header on so
|
|
* Firmware automaticly puts 802 header on so
|
|
* we don't need to account for it in the length
|
|
* we don't need to account for it in the length
|
|
*/
|
|
*/
|
|
-#ifdef MICSUPPORT
|
|
|
|
if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
|
|
if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
|
|
(ntohs(((u16 *)buffer)[6]) != 0x888E)) {
|
|
(ntohs(((u16 *)buffer)[6]) != 0x888E)) {
|
|
MICBuffer pMic;
|
|
MICBuffer pMic;
|
|
@@ -2022,9 +2006,7 @@ static int mpi_send_packet (struct net_device *dev)
|
|
memcpy (sendbuf, &pMic, sizeof(pMic));
|
|
memcpy (sendbuf, &pMic, sizeof(pMic));
|
|
sendbuf += sizeof(pMic);
|
|
sendbuf += sizeof(pMic);
|
|
memcpy (sendbuf, buffer, len - sizeof(etherHead));
|
|
memcpy (sendbuf, buffer, len - sizeof(etherHead));
|
|
- } else
|
|
|
|
-#endif
|
|
|
|
- {
|
|
|
|
|
|
+ } else {
|
|
*payloadLen = cpu_to_le16(len - sizeof(etherHead));
|
|
*payloadLen = cpu_to_le16(len - sizeof(etherHead));
|
|
|
|
|
|
dev->trans_start = jiffies;
|
|
dev->trans_start = jiffies;
|
|
@@ -2400,9 +2382,7 @@ void stop_airo_card( struct net_device *dev, int freeres )
|
|
ai->shared, ai->shared_dma);
|
|
ai->shared, ai->shared_dma);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-#ifdef MICSUPPORT
|
|
|
|
crypto_free_tfm(ai->tfm);
|
|
crypto_free_tfm(ai->tfm);
|
|
-#endif
|
|
|
|
del_airo_dev( dev );
|
|
del_airo_dev( dev );
|
|
free_netdev( dev );
|
|
free_netdev( dev );
|
|
}
|
|
}
|
|
@@ -2726,9 +2706,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
|
|
ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES);
|
|
ai->thr_pid = kernel_thread(airo_thread, dev, CLONE_FS | CLONE_FILES);
|
|
if (ai->thr_pid < 0)
|
|
if (ai->thr_pid < 0)
|
|
goto err_out_free;
|
|
goto err_out_free;
|
|
-#ifdef MICSUPPORT
|
|
|
|
ai->tfm = NULL;
|
|
ai->tfm = NULL;
|
|
-#endif
|
|
|
|
rc = add_airo_dev( dev );
|
|
rc = add_airo_dev( dev );
|
|
if (rc)
|
|
if (rc)
|
|
goto err_out_thr;
|
|
goto err_out_thr;
|
|
@@ -2969,10 +2947,8 @@ static int airo_thread(void *data) {
|
|
airo_read_wireless_stats(ai);
|
|
airo_read_wireless_stats(ai);
|
|
else if (test_bit(JOB_PROMISC, &ai->flags))
|
|
else if (test_bit(JOB_PROMISC, &ai->flags))
|
|
airo_set_promisc(ai);
|
|
airo_set_promisc(ai);
|
|
-#ifdef MICSUPPORT
|
|
|
|
else if (test_bit(JOB_MIC, &ai->flags))
|
|
else if (test_bit(JOB_MIC, &ai->flags))
|
|
micinit(ai);
|
|
micinit(ai);
|
|
-#endif
|
|
|
|
else if (test_bit(JOB_EVENT, &ai->flags))
|
|
else if (test_bit(JOB_EVENT, &ai->flags))
|
|
airo_send_event(dev);
|
|
airo_send_event(dev);
|
|
else if (test_bit(JOB_AUTOWEP, &ai->flags))
|
|
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)
|
|
|
|
|
|
if ( status & EV_MIC ) {
|
|
if ( status & EV_MIC ) {
|
|
OUT4500( apriv, EVACK, EV_MIC );
|
|
OUT4500( apriv, EVACK, EV_MIC );
|
|
-#ifdef MICSUPPORT
|
|
|
|
if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) {
|
|
if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) {
|
|
set_bit(JOB_MIC, &apriv->flags);
|
|
set_bit(JOB_MIC, &apriv->flags);
|
|
wake_up_interruptible(&apriv->thr_wait);
|
|
wake_up_interruptible(&apriv->thr_wait);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
if ( status & EV_LINK ) {
|
|
if ( status & EV_LINK ) {
|
|
union iwreq_data wrqu;
|
|
union iwreq_data wrqu;
|
|
@@ -3194,11 +3168,8 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
|
|
}
|
|
}
|
|
bap_read (apriv, buffer + hdrlen/2, len, BAP0);
|
|
bap_read (apriv, buffer + hdrlen/2, len, BAP0);
|
|
} else {
|
|
} else {
|
|
-#ifdef MICSUPPORT
|
|
|
|
MICBuffer micbuf;
|
|
MICBuffer micbuf;
|
|
-#endif
|
|
|
|
bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
|
|
bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
|
|
-#ifdef MICSUPPORT
|
|
|
|
if (apriv->micstats.enabled) {
|
|
if (apriv->micstats.enabled) {
|
|
bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
|
|
bap_read (apriv,(u16*)&micbuf,sizeof(micbuf),BAP0);
|
|
if (ntohs(micbuf.typelen) > 0x05DC)
|
|
if (ntohs(micbuf.typelen) > 0x05DC)
|
|
@@ -3211,15 +3182,10 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
|
|
skb_trim (skb, len + hdrlen);
|
|
skb_trim (skb, len + hdrlen);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
|
|
bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
|
|
-#ifdef MICSUPPORT
|
|
|
|
if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
|
|
if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
|
|
badmic:
|
|
badmic:
|
|
dev_kfree_skb_irq (skb);
|
|
dev_kfree_skb_irq (skb);
|
|
-#else
|
|
|
|
- if (0) {
|
|
|
|
-#endif
|
|
|
|
badrx:
|
|
badrx:
|
|
OUT4500( apriv, EVACK, EV_RX);
|
|
OUT4500( apriv, EVACK, EV_RX);
|
|
goto exitrx;
|
|
goto exitrx;
|
|
@@ -3430,10 +3396,8 @@ static void mpi_receive_802_3(struct airo_info *ai)
|
|
int len = 0;
|
|
int len = 0;
|
|
struct sk_buff *skb;
|
|
struct sk_buff *skb;
|
|
char *buffer;
|
|
char *buffer;
|
|
-#ifdef MICSUPPORT
|
|
|
|
int off = 0;
|
|
int off = 0;
|
|
MICBuffer micbuf;
|
|
MICBuffer micbuf;
|
|
-#endif
|
|
|
|
|
|
|
|
memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd));
|
|
memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd));
|
|
/* Make sure we got something */
|
|
/* Make sure we got something */
|
|
@@ -3448,7 +3412,6 @@ static void mpi_receive_802_3(struct airo_info *ai)
|
|
goto badrx;
|
|
goto badrx;
|
|
}
|
|
}
|
|
buffer = skb_put(skb,len);
|
|
buffer = skb_put(skb,len);
|
|
-#ifdef MICSUPPORT
|
|
|
|
memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2);
|
|
memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2);
|
|
if (ai->micstats.enabled) {
|
|
if (ai->micstats.enabled) {
|
|
memcpy(&micbuf,
|
|
memcpy(&micbuf,
|
|
@@ -3470,9 +3433,6 @@ badmic:
|
|
dev_kfree_skb_irq (skb);
|
|
dev_kfree_skb_irq (skb);
|
|
goto badrx;
|
|
goto badrx;
|
|
}
|
|
}
|
|
-#else
|
|
|
|
- memcpy(buffer, ai->rxfids[0].virtual_host_addr, len);
|
|
|
|
-#endif
|
|
|
|
#ifdef WIRELESS_SPY
|
|
#ifdef WIRELESS_SPY
|
|
if (ai->spy_data.spy_number > 0) {
|
|
if (ai->spy_data.spy_number > 0) {
|
|
char *sa;
|
|
char *sa;
|
|
@@ -3689,13 +3649,11 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
|
|
ai->config.authType = AUTH_OPEN;
|
|
ai->config.authType = AUTH_OPEN;
|
|
ai->config.modulation = MOD_CCK;
|
|
ai->config.modulation = MOD_CCK;
|
|
|
|
|
|
-#ifdef MICSUPPORT
|
|
|
|
if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&
|
|
if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&
|
|
(micsetup(ai) == SUCCESS)) {
|
|
(micsetup(ai) == SUCCESS)) {
|
|
ai->config.opmode |= MODE_MIC;
|
|
ai->config.opmode |= MODE_MIC;
|
|
set_bit(FLAG_MIC_CAPABLE, &ai->flags);
|
|
set_bit(FLAG_MIC_CAPABLE, &ai->flags);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
|
|
|
|
/* Save off the MAC */
|
|
/* Save off the MAC */
|
|
for( i = 0; i < ETH_ALEN; i++ ) {
|
|
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)
|
|
}
|
|
}
|
|
len -= ETH_ALEN * 2;
|
|
len -= ETH_ALEN * 2;
|
|
|
|
|
|
-#ifdef MICSUPPORT
|
|
|
|
if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
|
|
if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled &&
|
|
(ntohs(((u16 *)pPacket)[6]) != 0x888E)) {
|
|
(ntohs(((u16 *)pPacket)[6]) != 0x888E)) {
|
|
if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS)
|
|
if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS)
|
|
return ERROR;
|
|
return ERROR;
|
|
miclen = sizeof(pMic);
|
|
miclen = sizeof(pMic);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
-
|
|
|
|
// packet is destination[6], source[6], payload[len-12]
|
|
// packet is destination[6], source[6], payload[len-12]
|
|
// write the payload length and dst/src/payload
|
|
// write the payload length and dst/src/payload
|
|
if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR;
|
|
if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR;
|
|
@@ -7270,13 +7225,11 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
|
|
case AIROGSTAT: ridcode = RID_STATUS; break;
|
|
case AIROGSTAT: ridcode = RID_STATUS; break;
|
|
case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
|
|
case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
|
|
case AIROGSTATSC32: ridcode = RID_STATS; break;
|
|
case AIROGSTATSC32: ridcode = RID_STATS; break;
|
|
-#ifdef MICSUPPORT
|
|
|
|
case AIROGMICSTATS:
|
|
case AIROGMICSTATS:
|
|
if (copy_to_user(comp->data, &ai->micstats,
|
|
if (copy_to_user(comp->data, &ai->micstats,
|
|
min((int)comp->len,(int)sizeof(ai->micstats))))
|
|
min((int)comp->len,(int)sizeof(ai->micstats))))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
return 0;
|
|
return 0;
|
|
-#endif
|
|
|
|
case AIRORRID: ridcode = comp->ridnum; break;
|
|
case AIRORRID: ridcode = comp->ridnum; break;
|
|
default:
|
|
default:
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
@@ -7308,9 +7261,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
|
|
static int writerids(struct net_device *dev, aironet_ioctl *comp) {
|
|
static int writerids(struct net_device *dev, aironet_ioctl *comp) {
|
|
struct airo_info *ai = dev->priv;
|
|
struct airo_info *ai = dev->priv;
|
|
int ridcode;
|
|
int ridcode;
|
|
-#ifdef MICSUPPORT
|
|
|
|
int enabled;
|
|
int enabled;
|
|
-#endif
|
|
|
|
Resp rsp;
|
|
Resp rsp;
|
|
static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
|
|
static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
|
|
unsigned char *iobuf;
|
|
unsigned char *iobuf;
|
|
@@ -7367,11 +7318,9 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
|
|
|
|
|
|
PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1);
|
|
PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1);
|
|
|
|
|
|
-#ifdef MICSUPPORT
|
|
|
|
enabled = ai->micstats.enabled;
|
|
enabled = ai->micstats.enabled;
|
|
memset(&ai->micstats,0,sizeof(ai->micstats));
|
|
memset(&ai->micstats,0,sizeof(ai->micstats));
|
|
ai->micstats.enabled = enabled;
|
|
ai->micstats.enabled = enabled;
|
|
-#endif
|
|
|
|
|
|
|
|
if (copy_to_user(comp->data, iobuf,
|
|
if (copy_to_user(comp->data, iobuf,
|
|
min((int)comp->len, (int)RIDSIZE))) {
|
|
min((int)comp->len, (int)RIDSIZE))) {
|