aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
authorJouni Malinen <jkmaline@cc.hut.fi>2005-05-12 22:54:16 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-05-12 22:54:16 -0400
commitff1d2767d5a43c85f944e86a45284b721f66196c (patch)
tree91c1b6dd20bd772bc112c0012830678b46b69604 /drivers/net/wireless/airo.c
parent88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff)
Add HostAP wireless driver.
Includes minor cleanups from Adrian Bunk <bunk@stusta.de>.
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 463c789cdc77..e3168a13b786 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -1040,7 +1040,7 @@ typedef struct {
1040 u16 status; 1040 u16 status;
1041} WifiCtlHdr; 1041} WifiCtlHdr;
1042 1042
1043WifiCtlHdr wifictlhdr8023 = { 1043static WifiCtlHdr wifictlhdr8023 = {
1044 .ctlhdr = { 1044 .ctlhdr = {
1045 .ctl = HOST_DONT_RLSE, 1045 .ctl = HOST_DONT_RLSE,
1046 } 1046 }
@@ -1111,13 +1111,13 @@ static int airo_thread(void *data);
1111static void timer_func( struct net_device *dev ); 1111static void timer_func( struct net_device *dev );
1112static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 1112static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
1113#ifdef WIRELESS_EXT 1113#ifdef WIRELESS_EXT
1114struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); 1114static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev);
1115static void airo_read_wireless_stats (struct airo_info *local); 1115static void airo_read_wireless_stats (struct airo_info *local);
1116#endif /* WIRELESS_EXT */ 1116#endif /* WIRELESS_EXT */
1117#ifdef CISCO_EXT 1117#ifdef CISCO_EXT
1118static int readrids(struct net_device *dev, aironet_ioctl *comp); 1118static int readrids(struct net_device *dev, aironet_ioctl *comp);
1119static int writerids(struct net_device *dev, aironet_ioctl *comp); 1119static int writerids(struct net_device *dev, aironet_ioctl *comp);
1120int flashcard(struct net_device *dev, aironet_ioctl *comp); 1120static int flashcard(struct net_device *dev, aironet_ioctl *comp);
1121#endif /* CISCO_EXT */ 1121#endif /* CISCO_EXT */
1122#ifdef MICSUPPORT 1122#ifdef MICSUPPORT
1123static void micinit(struct airo_info *ai); 1123static void micinit(struct airo_info *ai);
@@ -1223,6 +1223,12 @@ static int setup_proc_entry( struct net_device *dev,
1223static int takedown_proc_entry( struct net_device *dev, 1223static int takedown_proc_entry( struct net_device *dev,
1224 struct airo_info *apriv ); 1224 struct airo_info *apriv );
1225 1225
1226static int cmdreset(struct airo_info *ai);
1227static int setflashmode (struct airo_info *ai);
1228static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime);
1229static int flashputbuf(struct airo_info *ai);
1230static int flashrestart(struct airo_info *ai,struct net_device *dev);
1231
1226#ifdef MICSUPPORT 1232#ifdef MICSUPPORT
1227/*********************************************************************** 1233/***********************************************************************
1228 * MIC ROUTINES * 1234 * MIC ROUTINES *
@@ -1231,10 +1237,11 @@ static int takedown_proc_entry( struct net_device *dev,
1231 1237
1232static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq); 1238static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq);
1233static void MoveWindow(miccntx *context, u32 micSeq); 1239static void MoveWindow(miccntx *context, u32 micSeq);
1234void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *); 1240static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *);
1235void emmh32_init(emmh32_context *context); 1241static void emmh32_init(emmh32_context *context);
1236void emmh32_update(emmh32_context *context, u8 *pOctets, int len); 1242static void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
1237void emmh32_final(emmh32_context *context, u8 digest[4]); 1243static void emmh32_final(emmh32_context *context, u8 digest[4]);
1244static int flashpchar(struct airo_info *ai,int byte,int dwelltime);
1238 1245
1239/* micinit - Initialize mic seed */ 1246/* micinit - Initialize mic seed */
1240 1247
@@ -1312,7 +1319,7 @@ static int micsetup(struct airo_info *ai) {
1312 return SUCCESS; 1319 return SUCCESS;
1313} 1320}
1314 1321
1315char micsnap[]= {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02}; 1322static char micsnap[] = {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02};
1316 1323
1317/*=========================================================================== 1324/*===========================================================================
1318 * Description: Mic a packet 1325 * Description: Mic a packet
@@ -1567,7 +1574,7 @@ static void MoveWindow(miccntx *context, u32 micSeq)
1567static unsigned char aes_counter[16]; 1574static unsigned char aes_counter[16];
1568 1575
1569/* expand the key to fill the MMH coefficient array */ 1576/* expand the key to fill the MMH coefficient array */
1570void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *tfm) 1577static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto_tfm *tfm)
1571{ 1578{
1572 /* take the keying material, expand if necessary, truncate at 16-bytes */ 1579 /* take the keying material, expand if necessary, truncate at 16-bytes */
1573 /* run through AES counter mode to generate context->coeff[] */ 1580 /* run through AES counter mode to generate context->coeff[] */
@@ -1599,7 +1606,7 @@ void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, struct crypto
1599} 1606}
1600 1607
1601/* prepare for calculation of a new mic */ 1608/* prepare for calculation of a new mic */
1602void emmh32_init(emmh32_context *context) 1609static void emmh32_init(emmh32_context *context)
1603{ 1610{
1604 /* prepare for new mic calculation */ 1611 /* prepare for new mic calculation */
1605 context->accum = 0; 1612 context->accum = 0;
@@ -1607,7 +1614,7 @@ void emmh32_init(emmh32_context *context)
1607} 1614}
1608 1615
1609/* add some bytes to the mic calculation */ 1616/* add some bytes to the mic calculation */
1610void emmh32_update(emmh32_context *context, u8 *pOctets, int len) 1617static void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
1611{ 1618{
1612 int coeff_position, byte_position; 1619 int coeff_position, byte_position;
1613 1620
@@ -1649,7 +1656,7 @@ void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
1649static u32 mask32[4] = { 0x00000000L, 0xFF000000L, 0xFFFF0000L, 0xFFFFFF00L }; 1656static u32 mask32[4] = { 0x00000000L, 0xFF000000L, 0xFFFF0000L, 0xFFFFFF00L };
1650 1657
1651/* calculate the mic */ 1658/* calculate the mic */
1652void emmh32_final(emmh32_context *context, u8 digest[4]) 1659static void emmh32_final(emmh32_context *context, u8 digest[4])
1653{ 1660{
1654 int coeff_position, byte_position; 1661 int coeff_position, byte_position;
1655 u32 val; 1662 u32 val;
@@ -2251,7 +2258,7 @@ static void airo_read_stats(struct airo_info *ai) {
2251 ai->stats.rx_fifo_errors = vals[0]; 2258 ai->stats.rx_fifo_errors = vals[0];
2252} 2259}
2253 2260
2254struct net_device_stats *airo_get_stats(struct net_device *dev) 2261static struct net_device_stats *airo_get_stats(struct net_device *dev)
2255{ 2262{
2256 struct airo_info *local = dev->priv; 2263 struct airo_info *local = dev->priv;
2257 2264
@@ -2410,7 +2417,7 @@ EXPORT_SYMBOL(stop_airo_card);
2410 2417
2411static int add_airo_dev( struct net_device *dev ); 2418static int add_airo_dev( struct net_device *dev );
2412 2419
2413int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) 2420static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr)
2414{ 2421{
2415 memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); 2422 memcpy(haddr, skb->mac.raw + 10, ETH_ALEN);
2416 return ETH_ALEN; 2423 return ETH_ALEN;
@@ -2677,7 +2684,7 @@ static struct net_device *init_wifidev(struct airo_info *ai,
2677 return dev; 2684 return dev;
2678} 2685}
2679 2686
2680int reset_card( struct net_device *dev , int lock) { 2687static int reset_card( struct net_device *dev , int lock) {
2681 struct airo_info *ai = dev->priv; 2688 struct airo_info *ai = dev->priv;
2682 2689
2683 if (lock && down_interruptible(&ai->sem)) 2690 if (lock && down_interruptible(&ai->sem))
@@ -2692,9 +2699,9 @@ int reset_card( struct net_device *dev , int lock) {
2692 return 0; 2699 return 0;
2693} 2700}
2694 2701
2695struct net_device *_init_airo_card( unsigned short irq, int port, 2702static struct net_device *_init_airo_card( unsigned short irq, int port,
2696 int is_pcmcia, struct pci_dev *pci, 2703 int is_pcmcia, struct pci_dev *pci,
2697 struct device *dmdev ) 2704 struct device *dmdev )
2698{ 2705{
2699 struct net_device *dev; 2706 struct net_device *dev;
2700 struct airo_info *ai; 2707 struct airo_info *ai;
@@ -7177,7 +7184,7 @@ static void airo_read_wireless_stats(struct airo_info *local)
7177 local->wstats.miss.beacon = vals[34]; 7184 local->wstats.miss.beacon = vals[34];
7178} 7185}
7179 7186
7180struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) 7187static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev)
7181{ 7188{
7182 struct airo_info *local = dev->priv; 7189 struct airo_info *local = dev->priv;
7183 7190
@@ -7392,14 +7399,8 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7392 * Flash command switch table 7399 * Flash command switch table
7393 */ 7400 */
7394 7401
7395int flashcard(struct net_device *dev, aironet_ioctl *comp) { 7402static int flashcard(struct net_device *dev, aironet_ioctl *comp) {
7396 int z; 7403 int z;
7397 int cmdreset(struct airo_info *);
7398 int setflashmode(struct airo_info *);
7399 int flashgchar(struct airo_info *,int,int);
7400 int flashpchar(struct airo_info *,int,int);
7401 int flashputbuf(struct airo_info *);
7402 int flashrestart(struct airo_info *,struct net_device *);
7403 7404
7404 /* Only super-user can modify flash */ 7405 /* Only super-user can modify flash */
7405 if (!capable(CAP_NET_ADMIN)) 7406 if (!capable(CAP_NET_ADMIN))
@@ -7457,7 +7458,7 @@ int flashcard(struct net_device *dev, aironet_ioctl *comp) {
7457 * card. 7458 * card.
7458 */ 7459 */
7459 7460
7460int cmdreset(struct airo_info *ai) { 7461static int cmdreset(struct airo_info *ai) {
7461 disable_MAC(ai, 1); 7462 disable_MAC(ai, 1);
7462 7463
7463 if(!waitbusy (ai)){ 7464 if(!waitbusy (ai)){
@@ -7481,7 +7482,7 @@ int cmdreset(struct airo_info *ai) {
7481 * mode 7482 * mode
7482 */ 7483 */
7483 7484
7484int setflashmode (struct airo_info *ai) { 7485static int setflashmode (struct airo_info *ai) {
7485 set_bit (FLAG_FLASHING, &ai->flags); 7486 set_bit (FLAG_FLASHING, &ai->flags);
7486 7487
7487 OUT4500(ai, SWS0, FLASH_COMMAND); 7488 OUT4500(ai, SWS0, FLASH_COMMAND);
@@ -7508,7 +7509,7 @@ int setflashmode (struct airo_info *ai) {
7508 * x 50us for echo . 7509 * x 50us for echo .
7509 */ 7510 */
7510 7511
7511int flashpchar(struct airo_info *ai,int byte,int dwelltime) { 7512static int flashpchar(struct airo_info *ai,int byte,int dwelltime) {
7512 int echo; 7513 int echo;
7513 int waittime; 7514 int waittime;
7514 7515
@@ -7548,7 +7549,7 @@ int flashpchar(struct airo_info *ai,int byte,int dwelltime) {
7548 * Get a character from the card matching matchbyte 7549 * Get a character from the card matching matchbyte
7549 * Step 3) 7550 * Step 3)
7550 */ 7551 */
7551int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){ 7552static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){
7552 int rchar; 7553 int rchar;
7553 unsigned char rbyte=0; 7554 unsigned char rbyte=0;
7554 7555
@@ -7579,7 +7580,7 @@ int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){
7579 * send to the card 7580 * send to the card
7580 */ 7581 */
7581 7582
7582int flashputbuf(struct airo_info *ai){ 7583static int flashputbuf(struct airo_info *ai){
7583 int nwords; 7584 int nwords;
7584 7585
7585 /* Write stuff */ 7586 /* Write stuff */
@@ -7601,7 +7602,7 @@ int flashputbuf(struct airo_info *ai){
7601/* 7602/*
7602 * 7603 *
7603 */ 7604 */
7604int flashrestart(struct airo_info *ai,struct net_device *dev){ 7605static int flashrestart(struct airo_info *ai,struct net_device *dev){
7605 int i,status; 7606 int i,status;
7606 7607
7607 ssleep(1); /* Added 12/7/00 */ 7608 ssleep(1); /* Added 12/7/00 */