Lines Matching +full:eoc +full:- +full:level
93 /* Include Wireless Extension definition and check version - Jean II */
146 "LostSync-MaxRetry",
147 "LostSync-MissedBeacons",
148 "LostSync-ArlExceeded",
149 "LostSync-Deauth",
150 "LostSync-Disassoced",
151 "LostSync-TsfTiming",
203 "LostSync-HostReq",
213 (char*)-1 };
261 …"If non-zero, the driver will keep looping through the authentication options until an association…
266 …"If non-zero, the driver will switch into a mode that seems to work better for older cards with so…
275 MODULE_PARM_DESC(adhoc, "If non-zero, the card will start in adhoc mode.");
295 #define ERROR -1
296 #define NO_PACKET -2
500 * Rids and endian-ness: The Rids will always be in cpu endian, since
501 * this all the patches from the big-endian guys end up doing that.
562 #define RXMODE_LANMON cpu_to_le16(5) /* lan style monitor -- data packets only */
581 /*---------- Scanning/Associating ----------*/
606 /*---------- Power save operation ----------*/
617 /*---------- Ap/Ibss config items ----------*/
626 /*---------- Radio configuration ----------*/
644 /*---------- Aironet Extensions ----------*/
650 /*---------- Aironet Extensions ----------*/
869 /* Warning : SIOCDEVPRIVATE may disapear during 2.5.X - Jean II */
881 * is usually a problem. - Jean II */
937 unsigned char __user *data; // d-data
970 emmh32_context seed; // Context - the seed
992 unsigned int eoc: 1; member
1097 #define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP
1100 u8 key[16]; /* 40-bit and 104-bit keys */
1166 /* Note, we can have MAX_FIDS outstanding. FIDs are 16-bits, so we
1185 #define FLAG_PROMISC 8 /* IFF_PROMISC 0x100 - include/linux/if.h */
1248 /* WPA-related stuff */
1261 return ai->bap_read(ai, pu16Dst, bytelen, whichbap); in bap_read()
1290 #define AIRO_FLASH(dev) (((struct airo_info *)dev->ml_priv)->flash)
1312 if (cur->valid && (memcmp(cur->key, key, key_len) == 0)) in age_mic_context()
1319 memcpy(cur->key, key, key_len); in age_mic_context()
1320 cur->window = 33; /* Window always points to the middle */ in age_mic_context()
1321 cur->rx = 0; /* Rx Sequence numbers */ in age_mic_context()
1322 cur->tx = 0; /* Tx sequence numbers */ in age_mic_context()
1323 cur->valid = 1; /* Key is now valid */ in age_mic_context()
1326 emmh32_setseed(&cur->seed, key, key_len, tfm); in age_mic_context()
1329 /* micinit - Initialize mic seed */
1335 clear_bit(JOB_MIC, &ai->jobs); in micinit()
1337 up(&ai->sem); in micinit()
1339 ai->micstats.enabled = (le16_to_cpu(mic_rid.state) & 0x00FF) ? 1 : 0; in micinit()
1340 if (!ai->micstats.enabled) { in micinit()
1344 ai->mod[0].uCtx.valid = 0; in micinit()
1345 ai->mod[0].mCtx.valid = 0; in micinit()
1350 age_mic_context(&ai->mod[0].mCtx, &ai->mod[1].mCtx, in micinit()
1352 ai->tfm); in micinit()
1356 age_mic_context(&ai->mod[0].uCtx, &ai->mod[1].uCtx, in micinit()
1358 ai->tfm); in micinit()
1362 /* micsetup - Get ready for business */
1368 if (ai->tfm == NULL) in micsetup()
1369 ai->tfm = crypto_alloc_sync_skcipher("ctr(aes)", 0, 0); in micsetup()
1371 if (IS_ERR(ai->tfm)) { in micsetup()
1372 airo_print_err(ai->dev->name, "failed to load transform for AES"); in micsetup()
1373 ai->tfm = NULL; in micsetup()
1378 memset(&ai->mod[i].mCtx, 0, sizeof(miccntx)); in micsetup()
1379 memset(&ai->mod[i].uCtx, 0, sizeof(miccntx)); in micsetup()
1409 if (test_bit(FLAG_ADHOC, &ai->flags) && (frame->da[0] & 0x1)) in encapsulate()
1410 context = &ai->mod[0].mCtx; in encapsulate()
1412 context = &ai->mod[0].uCtx; in encapsulate()
1414 if (!context->valid) in encapsulate()
1417 mic->typelen = htons(payLen + 16); //Length of Mic'd packet in encapsulate()
1419 memcpy(&mic->u.snap, micsnap, sizeof(micsnap)); // Add Snap in encapsulate()
1422 mic->seq = htonl(context->tx); in encapsulate()
1423 context->tx += 2; in encapsulate()
1425 emmh32_init(&context->seed); // Mic the packet in encapsulate()
1426 emmh32_update(&context->seed, frame->da, ETH_ALEN * 2); // DA, SA in encapsulate()
1427 emmh32_update(&context->seed, (u8*)&mic->typelen, 10); // Type/Length and Snap in encapsulate()
1428 emmh32_update(&context->seed, (u8*)&mic->seq, sizeof(mic->seq)); //SEQ in encapsulate()
1429 emmh32_update(&context->seed, (u8*)(frame + 1), payLen); //payload in encapsulate()
1430 emmh32_final(&context->seed, (u8*)&mic->mic); in encapsulate()
1433 mic->typelen = 0; //Let NIC know it could be an oversized packet in encapsulate()
1451 * Returns: BOOLEAN - TRUE if packet should be dropped otherwise FALSE
1455 *---------------------------------------------------------------------------
1468 if (!ai->micstats.enabled) { in decapsulate()
1471 ai->micstats.rxMICPlummed++; in decapsulate()
1477 if (ntohs(mic->typelen) == 0x888E) in decapsulate()
1480 if (memcmp (mic->u.snap, micsnap, sizeof(micsnap)) != 0) { in decapsulate()
1482 ai->micstats.rxMICPlummed++; in decapsulate()
1486 micSEQ = ntohl(mic->seq); //store SEQ as CPU order in decapsulate()
1493 ai->micstats.rxWrongSequence++; in decapsulate()
1498 int mcast = eth->da[0] & 1; in decapsulate()
1500 context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx; in decapsulate()
1503 if (!context->valid) { in decapsulate()
1510 if (!mic->typelen) in decapsulate()
1511 mic->typelen = htons(payLen + sizeof(MICBuffer) - 2); in decapsulate()
1513 emmh32_init(&context->seed); in decapsulate()
1514 emmh32_update(&context->seed, eth->da, ETH_ALEN*2); in decapsulate()
1515 emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap)); in decapsulate()
1516 emmh32_update(&context->seed, (u8 *)&mic->seq, sizeof(mic->seq)); in decapsulate()
1517 emmh32_update(&context->seed, (u8 *)(eth + 1), payLen); in decapsulate()
1519 emmh32_final(&context->seed, digest); in decapsulate()
1521 if (memcmp(digest, &mic->mic, 4)) { //Make sure the mics match in decapsulate()
1530 ai->micstats.rxSuccess++; in decapsulate()
1539 case NOMICPLUMMED: ai->micstats.rxMICPlummed++; break; in decapsulate()
1540 case SEQUENCE: ai->micstats.rxWrongSequence++; break; in decapsulate()
1541 case INCORRECTMIC: ai->micstats.rxIncorrectMIC++; break; in decapsulate()
1552 * Inputs: miccntx - mic context to check seq against
1553 * micSeq - the Mic seq number
1559 *---------------------------------------------------------------------------
1566 //Allow for the ap being rebooted - if it is then use the next in RxSeqValid()
1567 //sequence number of the current sequence number - might go backwards in RxSeqValid()
1570 if (test_bit(FLAG_UPDATE_MULTI, &ai->flags)) { in RxSeqValid()
1571 clear_bit (FLAG_UPDATE_MULTI, &ai->flags); in RxSeqValid()
1572 context->window = (micSeq > 33) ? micSeq : 33; in RxSeqValid()
1573 context->rx = 0; // Reset rx in RxSeqValid()
1575 } else if (test_bit(FLAG_UPDATE_UNI, &ai->flags)) { in RxSeqValid()
1576 clear_bit (FLAG_UPDATE_UNI, &ai->flags); in RxSeqValid()
1577 context->window = (micSeq > 33) ? micSeq : 33; // Move window in RxSeqValid()
1578 context->rx = 0; // Reset rx in RxSeqValid()
1582 seq = micSeq - (context->window - 33); in RxSeqValid()
1598 if (!(context->rx & index)) { in RxSeqValid()
1601 context->rx |= index; in RxSeqValid()
1615 if (micSeq > context->window) { in MoveWindow()
1616 shift = (micSeq - context->window) >> 1; in MoveWindow()
1620 context->rx >>= shift; in MoveWindow()
1622 context->rx = 0; in MoveWindow()
1624 context->window = micSeq; //Move window in MoveWindow()
1634 context->accum += (u64)(val) * be32_to_cpu(context->coeff[coeff_position++]);
1640 /* take the keying material, expand if necessary, truncate at 16-bytes */ in emmh32_setseed()
1641 /* run through AES counter mode to generate context->coeff[] */ in emmh32_setseed()
1650 memset(context->coeff, 0, sizeof(context->coeff)); in emmh32_setseed()
1651 sg_init_one(&sg, context->coeff, sizeof(context->coeff)); in emmh32_setseed()
1655 skcipher_request_set_crypt(req, &sg, &sg, sizeof(context->coeff), iv); in emmh32_setseed()
1665 context->accum = 0; in emmh32_init()
1666 context->position = 0; in emmh32_init()
1676 coeff_position = context->position >> 2; in emmh32_update()
1678 /* deal with partial 32-bit word left over from last update */ in emmh32_update()
1679 byte_position = context->position & 3; in emmh32_update()
1684 context->part.d8[byte_position++] = *pOctets++; in emmh32_update()
1685 context->position++; in emmh32_update()
1686 len--; in emmh32_update()
1688 MIC_ACCUM(ntohl(context->part.d32)); in emmh32_update()
1691 /* deal with full 32-bit words */ in emmh32_update()
1694 context->position += 4; in emmh32_update()
1696 len -= 4; in emmh32_update()
1699 /* deal with partial 32-bit word that will be left over from this update */ in emmh32_update()
1702 context->part.d8[byte_position++] = *pOctets++; in emmh32_update()
1703 context->position++; in emmh32_update()
1704 len--; in emmh32_update()
1720 coeff_position = context->position >> 2; in emmh32_final()
1722 /* deal with partial 32-bit word left over from last update */ in emmh32_final()
1723 byte_position = context->position & 3; in emmh32_final()
1726 val = ntohl(context->part.d32); in emmh32_final()
1730 /* reduce the accumulated u64 to a 32-bit MIC */ in emmh32_final()
1731 sum = context->accum; in emmh32_final()
1732 stmp = (sum & 0xffffffffLL) - ((sum >> 32) * 15); in emmh32_final()
1733 utmp = (stmp & 0xffffffffLL) - ((stmp >> 32) * 15); in emmh32_final()
1736 sum -= 15; in emmh32_final()
1752 if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; in readBSSListRid()
1755 if (down_interruptible(&ai->sem)) in readBSSListRid()
1756 return -ERESTARTSYS; in readBSSListRid()
1757 ai->list_bss_task = current; in readBSSListRid()
1759 up(&ai->sem); in readBSSListRid()
1762 ai->list_bss_task = NULL; in readBSSListRid()
1764 return PC4500_readrid(ai, first ? ai->bssListFirst : ai->bssListNext, in readBSSListRid()
1765 list, ai->bssListRidLen, 1); in readBSSListRid()
1779 airo_print_err(ai->dev->name, "WEP_TEMP set %x", rc); in writeWepKeyRid()
1783 airo_print_err(ai->dev->name, "WEP_PERM set %x", rc); in writeWepKeyRid()
1803 if (ai->config.len) in readConfigRid()
1810 ai->config = cfg; in readConfigRid()
1818 if (ai->config.authType != AUTH_OPEN && maxencrypt) { in checkThrottle()
1820 if (ai->config.rates[i] > maxencrypt) { in checkThrottle()
1821 ai->config.rates[i] = 0; in checkThrottle()
1831 if (!test_bit (FLAG_COMMIT, &ai->flags)) in writeConfigRid()
1834 clear_bit (FLAG_COMMIT, &ai->flags); in writeConfigRid()
1835 clear_bit (FLAG_RESET, &ai->flags); in writeConfigRid()
1837 cfgr = ai->config; in writeConfigRid()
1840 set_bit(FLAG_ADHOC, &ai->flags); in writeConfigRid()
1842 clear_bit(FLAG_ADHOC, &ai->flags); in writeConfigRid()
1869 if (auto_wep && !test_bit(FLAG_RADIO_DOWN, &ai->flags)) { in try_auto_wep()
1870 ai->expires = RUN_AT(3*HZ); in try_auto_wep()
1871 wake_up_interruptible(&ai->thr_wait); in try_auto_wep()
1877 struct airo_info *ai = dev->ml_priv; in airo_open()
1880 if (test_bit(FLAG_FLASHING, &ai->flags)) in airo_open()
1881 return -EIO; in airo_open()
1885 * is open (to pipeline changes and speed-up card setup). If in airo_open()
1886 * those changes are not yet committed, do it now - Jean II */ in airo_open()
1887 if (test_bit(FLAG_COMMIT, &ai->flags)) { in airo_open()
1892 if (ai->wifidev != dev) { in airo_open()
1893 clear_bit(JOB_DIE, &ai->jobs); in airo_open()
1894 ai->airo_thread_task = kthread_run(airo_thread, dev, "%s", in airo_open()
1895 dev->name); in airo_open()
1896 if (IS_ERR(ai->airo_thread_task)) in airo_open()
1897 return (int)PTR_ERR(ai->airo_thread_task); in airo_open()
1899 rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED, in airo_open()
1900 dev->name, dev); in airo_open()
1902 airo_print_err(dev->name, in airo_open()
1904 dev->irq, rc); in airo_open()
1905 set_bit(JOB_DIE, &ai->jobs); in airo_open()
1906 kthread_stop(ai->airo_thread_task); in airo_open()
1911 clear_bit(FLAG_RADIO_DOWN, &ai->flags); in airo_open()
1927 struct airo_info *ai = dev->ml_priv; in mpi_start_xmit()
1930 airo_print_err(dev->name, "%s: skb == NULL!",__func__); in mpi_start_xmit()
1934 dev->stats.tx_dropped++; in mpi_start_xmit()
1937 npacks = skb_queue_len (&ai->txq); in mpi_start_xmit()
1939 if (npacks >= MAXTXQ - 1) { in mpi_start_xmit()
1942 dev->stats.tx_fifo_errors++; in mpi_start_xmit()
1945 skb_queue_tail (&ai->txq, skb); in mpi_start_xmit()
1949 spin_lock_irqsave(&ai->aux_lock, flags); in mpi_start_xmit()
1950 skb_queue_tail (&ai->txq, skb); in mpi_start_xmit()
1951 pending = test_bit(FLAG_PENDING_XMIT, &ai->flags); in mpi_start_xmit()
1952 spin_unlock_irqrestore(&ai->aux_lock, flags); in mpi_start_xmit()
1956 set_bit(FLAG_PENDING_XMIT, &ai->flags); in mpi_start_xmit()
1975 struct airo_info *ai = dev->ml_priv; in mpi_send_packet()
1980 if ((skb = skb_dequeue(&ai->txq)) == NULL) { in mpi_send_packet()
1981 airo_print_err(dev->name, in mpi_send_packet()
1988 len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; in mpi_send_packet()
1989 buffer = skb->data; in mpi_send_packet()
1991 ai->txfids[0].tx_desc.offset = 0; in mpi_send_packet()
1992 ai->txfids[0].tx_desc.valid = 1; in mpi_send_packet()
1993 ai->txfids[0].tx_desc.eoc = 1; in mpi_send_packet()
1994 ai->txfids[0].tx_desc.len =len+sizeof(WifiHdr); in mpi_send_packet()
1999 * is immediately after it. ------------------------------------------------ in mpi_send_packet()
2001 * ------------------------------------------------ in mpi_send_packet()
2004 memcpy(ai->txfids[0].virtual_host_addr, in mpi_send_packet()
2007 payloadLen = (__le16 *)(ai->txfids[0].virtual_host_addr + in mpi_send_packet()
2009 sendbuf = ai->txfids[0].virtual_host_addr + in mpi_send_packet()
2016 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && in mpi_send_packet()
2020 if (encapsulate(ai, (etherHead *)buffer, &pMic, len - sizeof(etherHead)) != SUCCESS) in mpi_send_packet()
2023 *payloadLen = cpu_to_le16(len-sizeof(etherHead)+sizeof(pMic)); in mpi_send_packet()
2024 ai->txfids[0].tx_desc.len += sizeof(pMic); in mpi_send_packet()
2031 memcpy (sendbuf, buffer, len - sizeof(etherHead)); in mpi_send_packet()
2033 *payloadLen = cpu_to_le16(len - sizeof(etherHead)); in mpi_send_packet()
2041 memcpy_toio(ai->txfids[0].card_ram_off, in mpi_send_packet()
2042 &ai->txfids[0].tx_desc, sizeof(TxFid)); in mpi_send_packet()
2055 status = ((WifiCtlHdr *)ai->txfids[0].virtual_host_addr)->ctlhdr.status; in get_tx_error()
2057 if (bap_setup(ai, ai->fids[fid] & 0xffff, 4, BAP0) != SUCCESS) in get_tx_error()
2062 ai->dev->stats.tx_aborted_errors++; in get_tx_error()
2064 ai->dev->stats.tx_heartbeat_errors++; in get_tx_error()
2068 ai->dev->stats.tx_carrier_errors++; in get_tx_error()
2074 * Other errors means that *we* screwed up. - Jean II */ in get_tx_error()
2082 * need to go to 0x18 and read 6 bytes - Jean II */ in get_tx_error()
2088 * In Ad-Hoc mode, it will be the node address. in get_tx_error()
2092 * - Jean II */ in get_tx_error()
2097 wireless_send_event(ai->dev, IWEVTXDROP, &wrqu, NULL); in get_tx_error()
2105 struct airo_info *priv = dev->ml_priv; in airo_end_xmit()
2106 struct sk_buff *skb = priv->xmit.skb; in airo_end_xmit()
2107 int fid = priv->xmit.fid; in airo_end_xmit()
2108 u32 *fids = priv->fids; in airo_end_xmit()
2110 clear_bit(JOB_XMIT, &priv->jobs); in airo_end_xmit()
2111 clear_bit(FLAG_PENDING_XMIT, &priv->flags); in airo_end_xmit()
2112 status = transmit_802_3_packet (priv, fids[fid], skb->data); in airo_end_xmit()
2113 up(&priv->sem); in airo_end_xmit()
2118 for (; i < MAX_FIDS / 2 && (priv->fids[i] & 0xffff0000); i++); in airo_end_xmit()
2120 priv->fids[fid] &= 0xffff; in airo_end_xmit()
2121 dev->stats.tx_window_errors++; in airo_end_xmit()
2133 struct airo_info *priv = dev->ml_priv; in airo_start_xmit()
2134 u32 *fids = priv->fids; in airo_start_xmit()
2137 airo_print_err(dev->name, "%s: skb == NULL!", __func__); in airo_start_xmit()
2141 dev->stats.tx_dropped++; in airo_start_xmit()
2153 dev->stats.tx_fifo_errors++; in airo_start_xmit()
2158 len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; in airo_start_xmit()
2161 priv->xmit.skb = skb; in airo_start_xmit()
2162 priv->xmit.fid = i; in airo_start_xmit()
2163 if (down_trylock(&priv->sem) != 0) { in airo_start_xmit()
2164 set_bit(FLAG_PENDING_XMIT, &priv->flags); in airo_start_xmit()
2166 set_bit(JOB_XMIT, &priv->jobs); in airo_start_xmit()
2167 wake_up_interruptible(&priv->thr_wait); in airo_start_xmit()
2177 struct airo_info *priv = dev->ml_priv; in airo_end_xmit11()
2178 struct sk_buff *skb = priv->xmit11.skb; in airo_end_xmit11()
2179 int fid = priv->xmit11.fid; in airo_end_xmit11()
2180 u32 *fids = priv->fids; in airo_end_xmit11()
2182 clear_bit(JOB_XMIT11, &priv->jobs); in airo_end_xmit11()
2183 clear_bit(FLAG_PENDING_XMIT11, &priv->flags); in airo_end_xmit11()
2184 status = transmit_802_11_packet (priv, fids[fid], skb->data); in airo_end_xmit11()
2185 up(&priv->sem); in airo_end_xmit11()
2190 for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); in airo_end_xmit11()
2192 priv->fids[fid] &= 0xffff; in airo_end_xmit11()
2193 dev->stats.tx_window_errors++; in airo_end_xmit11()
2205 struct airo_info *priv = dev->ml_priv; in airo_start_xmit11()
2206 u32 *fids = priv->fids; in airo_start_xmit11()
2208 if (test_bit(FLAG_MPI, &priv->flags)) { in airo_start_xmit11()
2216 airo_print_err(dev->name, "%s: skb == NULL!", __func__); in airo_start_xmit11()
2220 dev->stats.tx_dropped++; in airo_start_xmit11()
2232 dev->stats.tx_fifo_errors++; in airo_start_xmit11()
2237 len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; in airo_start_xmit11()
2240 priv->xmit11.skb = skb; in airo_start_xmit11()
2241 priv->xmit11.fid = i; in airo_start_xmit11()
2242 if (down_trylock(&priv->sem) != 0) { in airo_start_xmit11()
2243 set_bit(FLAG_PENDING_XMIT11, &priv->flags); in airo_start_xmit11()
2245 set_bit(JOB_XMIT11, &priv->jobs); in airo_start_xmit11()
2246 wake_up_interruptible(&priv->thr_wait); in airo_start_xmit11()
2254 struct airo_info *ai = dev->ml_priv; in airo_read_stats()
2258 clear_bit(JOB_STATS, &ai->jobs); in airo_read_stats()
2259 if (ai->power.event) { in airo_read_stats()
2260 up(&ai->sem); in airo_read_stats()
2264 up(&ai->sem); in airo_read_stats()
2266 dev->stats.rx_packets = le32_to_cpu(vals[43]) + le32_to_cpu(vals[44]) + in airo_read_stats()
2268 dev->stats.tx_packets = le32_to_cpu(vals[39]) + le32_to_cpu(vals[40]) + in airo_read_stats()
2270 dev->stats.rx_bytes = le32_to_cpu(vals[92]); in airo_read_stats()
2271 dev->stats.tx_bytes = le32_to_cpu(vals[91]); in airo_read_stats()
2272 dev->stats.rx_errors = le32_to_cpu(vals[0]) + le32_to_cpu(vals[2]) + in airo_read_stats()
2274 dev->stats.tx_errors = le32_to_cpu(vals[42]) + in airo_read_stats()
2275 dev->stats.tx_fifo_errors; in airo_read_stats()
2276 dev->stats.multicast = le32_to_cpu(vals[43]); in airo_read_stats()
2277 dev->stats.collisions = le32_to_cpu(vals[89]); in airo_read_stats()
2280 dev->stats.rx_length_errors = le32_to_cpu(vals[3]); in airo_read_stats()
2281 dev->stats.rx_crc_errors = le32_to_cpu(vals[4]); in airo_read_stats()
2282 dev->stats.rx_frame_errors = le32_to_cpu(vals[2]); in airo_read_stats()
2283 dev->stats.rx_fifo_errors = le32_to_cpu(vals[0]); in airo_read_stats()
2288 struct airo_info *local = dev->ml_priv; in airo_get_stats()
2290 if (!test_bit(JOB_STATS, &local->jobs)) { in airo_get_stats()
2292 if (down_trylock(&local->sem) != 0) { in airo_get_stats()
2293 set_bit(JOB_STATS, &local->jobs); in airo_get_stats()
2294 wake_up_interruptible(&local->thr_wait); in airo_get_stats()
2299 return &dev->stats; in airo_get_stats()
2309 clear_bit(JOB_PROMISC, &ai->jobs); in airo_set_promisc()
2310 cmd.parm0=(ai->flags&IFF_PROMISC) ? PROMISC : NOPROMISC; in airo_set_promisc()
2312 up(&ai->sem); in airo_set_promisc()
2317 struct airo_info *ai = dev->ml_priv; in airo_set_multicast_list()
2319 if ((dev->flags ^ ai->flags) & IFF_PROMISC) { in airo_set_multicast_list()
2320 change_bit(FLAG_PROMISC, &ai->flags); in airo_set_multicast_list()
2321 if (down_trylock(&ai->sem) != 0) { in airo_set_multicast_list()
2322 set_bit(JOB_PROMISC, &ai->jobs); in airo_set_multicast_list()
2323 wake_up_interruptible(&ai->thr_wait); in airo_set_multicast_list()
2328 if ((dev->flags&IFF_ALLMULTI) || !netdev_mc_empty(dev)) { in airo_set_multicast_list()
2335 struct airo_info *ai = dev->ml_priv; in airo_set_mac_address()
2339 memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len); in airo_set_mac_address()
2340 set_bit (FLAG_COMMIT, &ai->flags); in airo_set_mac_address()
2344 memcpy (ai->dev->dev_addr, addr->sa_data, dev->addr_len); in airo_set_mac_address()
2345 if (ai->wifidev) in airo_set_mac_address()
2346 memcpy (ai->wifidev->dev_addr, addr->sa_data, dev->addr_len); in airo_set_mac_address()
2355 * so we only need to remember our non-PCI cards. */ in add_airo_dev()
2356 if (!ai->pci) in add_airo_dev()
2357 list_add_tail(&ai->dev_list, &airo_devices); in add_airo_dev()
2362 if (!ai->pci) in del_airo_dev()
2363 list_del(&ai->dev_list); in del_airo_dev()
2368 struct airo_info *ai = dev->ml_priv; in airo_close()
2372 if (ai->wifidev != dev) { in airo_close()
2379 set_bit(FLAG_RADIO_DOWN, &ai->flags); in airo_close()
2384 free_irq(dev->irq, dev); in airo_close()
2386 set_bit(JOB_DIE, &ai->jobs); in airo_close()
2387 kthread_stop(ai->airo_thread_task); in airo_close()
2394 struct airo_info *ai = dev->ml_priv; in stop_airo_card()
2396 set_bit(FLAG_RADIO_DOWN, &ai->flags); in stop_airo_card()
2400 if (test_bit(FLAG_REGISTERED, &ai->flags)) { in stop_airo_card()
2402 if (ai->wifidev) { in stop_airo_card()
2403 unregister_netdev(ai->wifidev); in stop_airo_card()
2404 free_netdev(ai->wifidev); in stop_airo_card()
2405 ai->wifidev = NULL; in stop_airo_card()
2407 clear_bit(FLAG_REGISTERED, &ai->flags); in stop_airo_card()
2412 if (test_bit(FLAG_MPI, &ai->flags) && !skb_queue_empty(&ai->txq)) { in stop_airo_card()
2414 for (;(skb = skb_dequeue(&ai->txq));) in stop_airo_card()
2420 kfree(ai->flash); in stop_airo_card()
2421 kfree(ai->rssi); in stop_airo_card()
2422 kfree(ai->SSID); in stop_airo_card()
2425 release_region(dev->base_addr, 64); in stop_airo_card()
2426 if (test_bit(FLAG_MPI, &ai->flags)) { in stop_airo_card()
2427 if (ai->pci) in stop_airo_card()
2428 mpi_unmap_card(ai->pci); in stop_airo_card()
2429 if (ai->pcimem) in stop_airo_card()
2430 iounmap(ai->pcimem); in stop_airo_card()
2431 if (ai->pciaux) in stop_airo_card()
2432 iounmap(ai->pciaux); in stop_airo_card()
2433 dma_free_coherent(&ai->pci->dev, PCI_SHARED_LEN, in stop_airo_card()
2434 ai->shared, ai->shared_dma); in stop_airo_card()
2437 crypto_free_sync_skcipher(ai->tfm); in stop_airo_card()
2476 netif_stop_queue(ai->dev); in mpi_init_descriptors()
2483 cmd.parm1 = (ai->rxfids[0].card_ram_off - ai->pciaux); in mpi_init_descriptors()
2487 airo_print_err(ai->dev->name, "Couldn't allocate RX FID"); in mpi_init_descriptors()
2492 memcpy_toio(ai->rxfids[i].card_ram_off, in mpi_init_descriptors()
2493 &ai->rxfids[i].rx_desc, sizeof(RxFid)); in mpi_init_descriptors()
2503 cmd.parm1 = (ai->txfids[0].card_ram_off - ai->pciaux); in mpi_init_descriptors()
2507 ai->txfids[i].tx_desc.valid = 1; in mpi_init_descriptors()
2508 memcpy_toio(ai->txfids[i].card_ram_off, in mpi_init_descriptors()
2509 &ai->txfids[i].tx_desc, sizeof(TxFid)); in mpi_init_descriptors()
2511 ai->txfids[i-1].tx_desc.eoc = 1; /* Last descriptor has EOC set */ in mpi_init_descriptors()
2515 airo_print_err(ai->dev->name, "Couldn't allocate TX FID"); in mpi_init_descriptors()
2525 cmd.parm1 = (ai->config_desc.card_ram_off - ai->pciaux); in mpi_init_descriptors()
2529 airo_print_err(ai->dev->name, "Couldn't allocate RID"); in mpi_init_descriptors()
2533 memcpy_toio(ai->config_desc.card_ram_off, in mpi_init_descriptors()
2534 &ai->config_desc.rid_desc, sizeof(Rid)); in mpi_init_descriptors()
2548 int rc = -1; in mpi_map_card()
2570 ai->pcimem = ioremap(mem_start, mem_len); in mpi_map_card()
2571 if (!ai->pcimem) { in mpi_map_card()
2576 ai->pciaux = ioremap(aux_start, aux_len); in mpi_map_card()
2577 if (!ai->pciaux) { in mpi_map_card()
2584 ai->shared = dma_alloc_coherent(&pci->dev, PCI_SHARED_LEN, in mpi_map_card()
2585 &ai->shared_dma, GFP_KERNEL); in mpi_map_card()
2586 if (!ai->shared) { in mpi_map_card()
2595 busaddroff = ai->shared_dma; in mpi_map_card()
2596 pciaddroff = ai->pciaux + AUX_OFFSET; in mpi_map_card()
2597 vpackoff = ai->shared; in mpi_map_card()
2601 ai->rxfids[i].pending = 0; in mpi_map_card()
2602 ai->rxfids[i].card_ram_off = pciaddroff; in mpi_map_card()
2603 ai->rxfids[i].virtual_host_addr = vpackoff; in mpi_map_card()
2604 ai->rxfids[i].rx_desc.host_addr = busaddroff; in mpi_map_card()
2605 ai->rxfids[i].rx_desc.valid = 1; in mpi_map_card()
2606 ai->rxfids[i].rx_desc.len = PKTSIZE; in mpi_map_card()
2607 ai->rxfids[i].rx_desc.rdy = 0; in mpi_map_card()
2616 ai->txfids[i].card_ram_off = pciaddroff; in mpi_map_card()
2617 ai->txfids[i].virtual_host_addr = vpackoff; in mpi_map_card()
2618 ai->txfids[i].tx_desc.valid = 1; in mpi_map_card()
2619 ai->txfids[i].tx_desc.host_addr = busaddroff; in mpi_map_card()
2620 memcpy(ai->txfids[i].virtual_host_addr, in mpi_map_card()
2627 ai->txfids[i-1].tx_desc.eoc = 1; /* Last descriptor has EOC set */ in mpi_map_card()
2630 ai->config_desc.card_ram_off = pciaddroff; in mpi_map_card()
2631 ai->config_desc.virtual_host_addr = vpackoff; in mpi_map_card()
2632 ai->config_desc.rid_desc.host_addr = busaddroff; in mpi_map_card()
2633 ai->ridbus = busaddroff; in mpi_map_card()
2634 ai->config_desc.rid_desc.rid = 0; in mpi_map_card()
2635 ai->config_desc.rid_desc.len = RIDSIZE; in mpi_map_card()
2636 ai->config_desc.rid_desc.valid = 1; in mpi_map_card()
2647 dma_free_coherent(&pci->dev, PCI_SHARED_LEN, ai->shared, in mpi_map_card()
2648 ai->shared_dma); in mpi_map_card()
2650 iounmap(ai->pciaux); in mpi_map_card()
2652 iounmap(ai->pcimem); in mpi_map_card()
2676 dev->netdev_ops = &airo11_netdev_ops; in wifi_setup()
2677 dev->header_ops = &airo_header_ops; in wifi_setup()
2678 dev->wireless_handlers = &airo_handler_def; in wifi_setup()
2680 dev->type = ARPHRD_IEEE80211; in wifi_setup()
2681 dev->hard_header_len = ETH_HLEN; in wifi_setup()
2682 dev->mtu = AIRO_DEF_MTU; in wifi_setup()
2683 dev->min_mtu = 68; in wifi_setup()
2684 dev->max_mtu = MIC_MSGLEN_MAX; in wifi_setup()
2685 dev->addr_len = ETH_ALEN; in wifi_setup()
2686 dev->tx_queue_len = 100; in wifi_setup()
2688 eth_broadcast_addr(dev->broadcast); in wifi_setup()
2690 dev->flags = IFF_BROADCAST|IFF_MULTICAST; in wifi_setup()
2701 dev->ml_priv = ethdev->ml_priv; in init_wifidev()
2702 dev->irq = ethdev->irq; in init_wifidev()
2703 dev->base_addr = ethdev->base_addr; in init_wifidev()
2704 dev->wireless_data = ethdev->wireless_data; in init_wifidev()
2705 SET_NETDEV_DEV(dev, ethdev->dev.parent); in init_wifidev()
2717 struct airo_info *ai = dev->ml_priv; in reset_card()
2719 if (lock && down_interruptible(&ai->sem)) in reset_card()
2720 return -1; in reset_card()
2727 up(&ai->sem); in reset_card()
2734 if (ai->networks) in airo_networks_allocate()
2737 ai->networks = kcalloc(AIRO_MAX_NETWORK_COUNT, sizeof(BSSListElement), in airo_networks_allocate()
2739 if (!ai->networks) { in airo_networks_allocate()
2741 return -ENOMEM; in airo_networks_allocate()
2749 kfree(ai->networks); in airo_networks_free()
2750 ai->networks = NULL; in airo_networks_free()
2757 INIT_LIST_HEAD(&ai->network_free_list); in airo_networks_initialize()
2758 INIT_LIST_HEAD(&ai->network_list); in airo_networks_initialize()
2760 list_add_tail(&ai->networks[i].list, in airo_networks_initialize()
2761 &ai->network_free_list); in airo_networks_initialize()
2803 ai = dev->ml_priv = netdev_priv(dev); in _init_airo_card()
2804 ai->wifidev = NULL; in _init_airo_card()
2805 ai->flags = 1 << FLAG_RADIO_DOWN; in _init_airo_card()
2806 ai->jobs = 0; in _init_airo_card()
2807 ai->dev = dev; in _init_airo_card()
2808 if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) { in _init_airo_card()
2810 set_bit(FLAG_MPI, &ai->flags); in _init_airo_card()
2812 spin_lock_init(&ai->aux_lock); in _init_airo_card()
2813 sema_init(&ai->sem, 1); in _init_airo_card()
2814 ai->config.len = 0; in _init_airo_card()
2815 ai->pci = pci; in _init_airo_card()
2816 init_waitqueue_head (&ai->thr_wait); in _init_airo_card()
2817 ai->tfm = NULL; in _init_airo_card()
2819 ai->APList.len = cpu_to_le16(sizeof(struct APListRid)); in _init_airo_card()
2825 skb_queue_head_init (&ai->txq); in _init_airo_card()
2827 /* The Airo-specific entries in the device structure. */ in _init_airo_card()
2828 if (test_bit(FLAG_MPI,&ai->flags)) in _init_airo_card()
2829 dev->netdev_ops = &mpi_netdev_ops; in _init_airo_card()
2831 dev->netdev_ops = &airo_netdev_ops; in _init_airo_card()
2832 dev->wireless_handlers = &airo_handler_def; in _init_airo_card()
2833 ai->wireless_data.spy_data = &ai->spy_data; in _init_airo_card()
2834 dev->wireless_data = &ai->wireless_data; in _init_airo_card()
2835 dev->irq = irq; in _init_airo_card()
2836 dev->base_addr = port; in _init_airo_card()
2837 dev->priv_flags &= ~IFF_TX_SKB_SHARING; in _init_airo_card()
2838 dev->max_mtu = MIC_MSGLEN_MAX; in _init_airo_card()
2846 if (!request_region(dev->base_addr, 64, DRV_NAME)) { in _init_airo_card()
2847 rc = -EBUSY; in _init_airo_card()
2848 airo_print_err(dev->name, "Couldn't request region"); in _init_airo_card()
2853 if (test_bit(FLAG_MPI,&ai->flags)) { in _init_airo_card()
2861 if (setup_card(ai, dev->dev_addr, 1) != SUCCESS) { in _init_airo_card()
2862 airo_print_err(dev->name, "MAC could not be enabled"); in _init_airo_card()
2863 rc = -EIO; in _init_airo_card()
2866 } else if (!test_bit(FLAG_MPI,&ai->flags)) { in _init_airo_card()
2867 ai->bap_read = fast_bap_read; in _init_airo_card()
2868 set_bit(FLAG_FLASHING, &ai->flags); in _init_airo_card()
2871 strcpy(dev->name, "eth%d"); in _init_airo_card()
2874 airo_print_err(dev->name, "Couldn't register_netdev"); in _init_airo_card()
2877 ai->wifidev = init_wifidev(ai, dev); in _init_airo_card()
2878 if (!ai->wifidev) in _init_airo_card()
2883 rc = -EIO; in _init_airo_card()
2887 ai->wep_capable = (cap_rid.softCap & cpu_to_le16(0x02)) ? 1 : 0; in _init_airo_card()
2888 ai->max_wep_idx = (cap_rid.softCap & cpu_to_le16(0x80)) ? 3 : 0; in _init_airo_card()
2890 airo_print_info(dev->name, "Firmware version %x.%x.%02d", in _init_airo_card()
2900 airo_print_info(ai->dev->name, "WPA supported."); in _init_airo_card()
2902 set_bit(FLAG_WPA_CAPABLE, &ai->flags); in _init_airo_card()
2903 ai->bssListFirst = RID_WPA_BSSLISTFIRST; in _init_airo_card()
2904 ai->bssListNext = RID_WPA_BSSLISTNEXT; in _init_airo_card()
2905 ai->bssListRidLen = sizeof(BSSListRid); in _init_airo_card()
2907 airo_print_info(ai->dev->name, "WPA unsupported with firmware " in _init_airo_card()
2910 ai->bssListFirst = RID_BSSLISTFIRST; in _init_airo_card()
2911 ai->bssListNext = RID_BSSLISTNEXT; in _init_airo_card()
2912 ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra); in _init_airo_card()
2915 set_bit(FLAG_REGISTERED,&ai->flags); in _init_airo_card()
2916 airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr); in _init_airo_card()
2919 if (probe && !test_bit(FLAG_MPI,&ai->flags)) in _init_airo_card()
2921 ai->fids[i] = transmit_allocate(ai, AIRO_DEF_MTU, i>=MAX_FIDS/2); in _init_airo_card()
2923 if (setup_proc_entry(dev, dev->ml_priv) < 0) in _init_airo_card()
2929 unregister_netdev(ai->wifidev); in _init_airo_card()
2930 free_netdev(ai->wifidev); in _init_airo_card()
2934 if (test_bit(FLAG_MPI,&ai->flags) && pci) { in _init_airo_card()
2935 dma_free_coherent(&pci->dev, PCI_SHARED_LEN, ai->shared, in _init_airo_card()
2936 ai->shared_dma); in _init_airo_card()
2937 iounmap(ai->pciaux); in _init_airo_card()
2938 iounmap(ai->pcimem); in _init_airo_card()
2939 mpi_unmap_card(ai->pci); in _init_airo_card()
2943 release_region(dev->base_addr, 64); in _init_airo_card()
2974 struct airo_info *ai = dev->ml_priv; in reset_airo_card()
2977 return -1; in reset_airo_card()
2979 if (setup_card(ai, dev->dev_addr, 1) != SUCCESS) { in reset_airo_card()
2980 airo_print_err(dev->name, "MAC could not be enabled"); in reset_airo_card()
2981 return -1; in reset_airo_card()
2983 airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr); in reset_airo_card()
2985 if (!test_bit(FLAG_MPI,&ai->flags)) in reset_airo_card()
2987 ai->fids[i] = transmit_allocate (ai, AIRO_DEF_MTU, i>=MAX_FIDS/2); in reset_airo_card()
2998 struct airo_info *ai = dev->ml_priv; in airo_send_event()
3002 clear_bit(JOB_EVENT, &ai->jobs); in airo_send_event()
3004 up(&ai->sem); in airo_send_event()
3023 list_for_each_entry_safe (loop_net, tmp_net, &ai->network_list, list) { in airo_process_scan_results()
3024 list_move_tail (&loop_net->list, &ai->network_free_list); in airo_process_scan_results()
3025 /* Don't blow away ->list, just BSS data */ in airo_process_scan_results()
3026 memset (loop_net, 0, sizeof (loop_net->bss)); in airo_process_scan_results()
3030 rc = PC4500_readrid(ai, ai->bssListFirst, &bss, ai->bssListRidLen, 0); in airo_process_scan_results()
3040 if (!list_empty(&ai->network_free_list)) { in airo_process_scan_results()
3041 tmp_net = list_entry(ai->network_free_list.next, in airo_process_scan_results()
3043 list_del(ai->network_free_list.next); in airo_process_scan_results()
3047 memcpy(tmp_net, &bss, sizeof(tmp_net->bss)); in airo_process_scan_results()
3048 list_add_tail(&tmp_net->list, &ai->network_list); in airo_process_scan_results()
3053 rc = PC4500_readrid(ai, ai->bssListNext, in airo_process_scan_results()
3054 &bss, ai->bssListRidLen, 0); in airo_process_scan_results()
3060 writeAPListRid(ai, &ai->APList, 0); in airo_process_scan_results()
3063 ai->scan_timeout = 0; in airo_process_scan_results()
3064 clear_bit(JOB_SCAN_RESULTS, &ai->jobs); in airo_process_scan_results()
3065 up(&ai->sem); in airo_process_scan_results()
3073 * extract the data - Jean II */ in airo_process_scan_results()
3076 wireless_send_event(ai->dev, SIOCGIWSCAN, &wrqu, NULL); in airo_process_scan_results()
3082 struct airo_info *ai = dev->ml_priv; in airo_thread()
3090 if (test_bit(JOB_DIE, &ai->jobs)) in airo_thread()
3093 if (ai->jobs) { in airo_thread()
3094 locked = down_interruptible(&ai->sem); in airo_thread()
3099 add_wait_queue(&ai->thr_wait, &wait); in airo_thread()
3102 if (ai->jobs) in airo_thread()
3104 if (ai->expires || ai->scan_timeout) { in airo_thread()
3105 if (ai->scan_timeout && in airo_thread()
3106 time_after_eq(jiffies, ai->scan_timeout)) { in airo_thread()
3107 set_bit(JOB_SCAN_RESULTS, &ai->jobs); in airo_thread()
3109 } else if (ai->expires && in airo_thread()
3110 time_after_eq(jiffies, ai->expires)) { in airo_thread()
3111 set_bit(JOB_AUTOWEP, &ai->jobs); in airo_thread()
3117 if (!ai->expires || !ai->scan_timeout) { in airo_thread()
3118 wake_at = max(ai->expires, in airo_thread()
3119 ai->scan_timeout); in airo_thread()
3121 wake_at = min(ai->expires, in airo_thread()
3122 ai->scan_timeout); in airo_thread()
3124 schedule_timeout(wake_at - jiffies); in airo_thread()
3135 remove_wait_queue(&ai->thr_wait, &wait); in airo_thread()
3142 if (test_bit(JOB_DIE, &ai->jobs)) { in airo_thread()
3143 up(&ai->sem); in airo_thread()
3147 if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) { in airo_thread()
3148 up(&ai->sem); in airo_thread()
3152 if (test_bit(JOB_XMIT, &ai->jobs)) in airo_thread()
3154 else if (test_bit(JOB_XMIT11, &ai->jobs)) in airo_thread()
3156 else if (test_bit(JOB_STATS, &ai->jobs)) in airo_thread()
3158 else if (test_bit(JOB_WSTATS, &ai->jobs)) in airo_thread()
3160 else if (test_bit(JOB_PROMISC, &ai->jobs)) in airo_thread()
3162 else if (test_bit(JOB_MIC, &ai->jobs)) in airo_thread()
3164 else if (test_bit(JOB_EVENT, &ai->jobs)) in airo_thread()
3166 else if (test_bit(JOB_AUTOWEP, &ai->jobs)) in airo_thread()
3168 else if (test_bit(JOB_SCAN_RESULTS, &ai->jobs)) in airo_thread()
3171 up(&ai->sem); in airo_thread()
3183 return 10; /* one-address control packet */ in header_len()
3184 return 16; /* two-address control packet */ in header_len()
3194 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) { in airo_handle_cisco_mic()
3195 set_bit(JOB_MIC, &ai->jobs); in airo_handle_cisco_mic()
3196 wake_up_interruptible(&ai->thr_wait); in airo_handle_cisco_mic()
3201 #define STAT_NOBEACON 0x8000 /* Loss of sync - missed beacons */
3202 #define STAT_MAXRETRIES 0x8001 /* Loss of sync - max retries */
3203 #define STAT_MAXARL 0x8002 /* Loss of sync - average retry level exceeded*/
3204 #define STAT_FORCELOSS 0x8003 /* Loss of sync - host request */
3205 #define STAT_TSFSYNC 0x8004 /* Loss of sync - TSF synchronization */
3271 if ((status == STAT_FORCELOSS) && (ai->scan_timeout > 0)) in airo_handle_link()
3274 airo_print_status(ai->dev->name, status); in airo_handle_link()
3278 ai->expires = 0; in airo_handle_link()
3279 if (ai->list_bss_task) in airo_handle_link()
3280 wake_up_process(ai->list_bss_task); in airo_handle_link()
3281 set_bit(FLAG_UPDATE_UNI, &ai->flags); in airo_handle_link()
3282 set_bit(FLAG_UPDATE_MULTI, &ai->flags); in airo_handle_link()
3284 if (down_trylock(&ai->sem) != 0) { in airo_handle_link()
3285 set_bit(JOB_EVENT, &ai->jobs); in airo_handle_link()
3286 wake_up_interruptible(&ai->thr_wait); in airo_handle_link()
3288 airo_send_event(ai->dev); in airo_handle_link()
3289 netif_carrier_on(ai->dev); in airo_handle_link()
3291 if (auto_wep && !ai->expires) { in airo_handle_link()
3292 ai->expires = RUN_AT(3*HZ); in airo_handle_link()
3293 wake_up_interruptible(&ai->thr_wait); in airo_handle_link()
3299 wireless_send_event(ai->dev, SIOCGIWAP, &wrqu, NULL); in airo_handle_link()
3300 netif_carrier_off(ai->dev); in airo_handle_link()
3302 netif_carrier_off(ai->dev); in airo_handle_link()
3314 if (test_bit(FLAG_MPI, &ai->flags)) { in airo_handle_rx()
3315 if (test_bit(FLAG_802_11, &ai->flags)) in airo_handle_rx()
3326 if (test_bit(FLAG_802_11, &ai->flags)) { in airo_handle_rx()
3332 if (ai->wifidev == NULL) in airo_handle_rx()
3341 airo_print_err(ai->dev->name, "Bad size %d", len); in airo_handle_rx()
3347 if (test_bit(FLAG_802_11, &ai->flags)) { in airo_handle_rx()
3355 ai->dev->stats.rx_dropped++; in airo_handle_rx()
3361 if (test_bit(FLAG_802_11, &ai->flags)) { in airo_handle_rx()
3363 bap_read(ai, buffer + 1, hdrlen - 2, BAP0); in airo_handle_rx()
3373 airo_print_err(ai->dev->name, "gaplen too " in airo_handle_rx()
3382 if (ai->micstats.enabled) { in airo_handle_rx()
3392 len -= sizeof(micbuf); in airo_handle_rx()
3405 if (success && (ai->spy_data.spy_number > 0)) { in airo_handle_rx()
3410 if (!test_bit(FLAG_802_11, &ai->flags)) { in airo_handle_rx()
3417 if (ai->rssi) in airo_handle_rx()
3418 wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; in airo_handle_rx()
3420 wstats.level = (hdr.rssi[1] + 321) / 2; in airo_handle_rx()
3421 wstats.noise = ai->wstats.qual.noise; in airo_handle_rx()
3426 wireless_spy_update(ai->dev, sa, &wstats); in airo_handle_rx()
3434 if (test_bit(FLAG_802_11, &ai->flags)) { in airo_handle_rx()
3436 skb->pkt_type = PACKET_OTHERHOST; in airo_handle_rx()
3437 skb->dev = ai->wifidev; in airo_handle_rx()
3438 skb->protocol = htons(ETH_P_802_2); in airo_handle_rx()
3440 skb->protocol = eth_type_trans(skb, ai->dev); in airo_handle_rx()
3441 skb->ip_summed = CHECKSUM_NONE; in airo_handle_rx()
3449 int i, index = -1; in airo_handle_tx()
3452 if (test_bit(FLAG_MPI, &ai->flags)) { in airo_handle_tx()
3456 get_tx_error(ai, -1); in airo_handle_tx()
3458 spin_lock_irqsave(&ai->aux_lock, flags); in airo_handle_tx()
3459 if (!skb_queue_empty(&ai->txq)) { in airo_handle_tx()
3460 spin_unlock_irqrestore(&ai->aux_lock, flags); in airo_handle_tx()
3461 mpi_send_packet(ai->dev); in airo_handle_tx()
3463 clear_bit(FLAG_PENDING_XMIT, &ai->flags); in airo_handle_tx()
3464 spin_unlock_irqrestore(&ai->aux_lock, flags); in airo_handle_tx()
3465 netif_wake_queue(ai->dev); in airo_handle_tx()
3474 if ((ai->fids[i] & 0xffff) == fid) in airo_handle_tx()
3478 if (index != -1) { in airo_handle_tx()
3485 ai->fids[index] &= 0xffff; in airo_handle_tx()
3487 if (!test_bit(FLAG_PENDING_XMIT, &ai->flags)) in airo_handle_tx()
3488 netif_wake_queue(ai->dev); in airo_handle_tx()
3490 if (!test_bit(FLAG_PENDING_XMIT11, &ai->flags)) in airo_handle_tx()
3491 netif_wake_queue(ai->wifidev); in airo_handle_tx()
3495 airo_print_err(ai->dev->name, "Unallocated FID was used to xmit"); in airo_handle_tx()
3503 struct airo_info *ai = dev->ml_priv; in airo_interrupt()
3545 airo_print_warn(ai->dev->name, "Got weird status %x", in airo_interrupt()
3567 if (test_bit(FLAG_MPI,&ai->flags)) in OUT4500()
3570 outw(val, ai->dev->base_addr + reg); in OUT4500()
3572 outb(val & 0xff, ai->dev->base_addr + reg); in OUT4500()
3573 outb(val >> 8, ai->dev->base_addr + reg + 1); in OUT4500()
3581 if (test_bit(FLAG_MPI,&ai->flags)) in IN4500()
3584 rc = inw(ai->dev->base_addr + reg); in IN4500()
3586 rc = inb(ai->dev->base_addr + reg); in IN4500()
3587 rc += ((int)inb(ai->dev->base_addr + reg + 1)) << 8; in IN4500()
3603 * "cheaper" - Jean II */ in enable_MAC()
3604 if (ai->flags & FLAG_RADIO_MASK) return SUCCESS; in enable_MAC()
3606 if (lock && down_interruptible(&ai->sem)) in enable_MAC()
3607 return -ERESTARTSYS; in enable_MAC()
3609 if (!test_bit(FLAG_ENABLED, &ai->flags)) { in enable_MAC()
3614 set_bit(FLAG_ENABLED, &ai->flags); in enable_MAC()
3619 up(&ai->sem); in enable_MAC()
3622 airo_print_err(ai->dev->name, "Cannot enable MAC"); in enable_MAC()
3624 airo_print_err(ai->dev->name, "Bad MAC enable reason=%x, " in enable_MAC()
3636 if (lock == 1 && down_interruptible(&ai->sem)) in disable_MAC()
3639 if (test_bit(FLAG_ENABLED, &ai->flags)) { in disable_MAC()
3641 netif_carrier_off(ai->dev); in disable_MAC()
3645 clear_bit(FLAG_ENABLED, &ai->flags); in disable_MAC()
3648 up(&ai->sem); in disable_MAC()
3671 memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); in mpi_receive_802_3()
3680 ai->dev->stats.rx_dropped++; in mpi_receive_802_3()
3684 memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2); in mpi_receive_802_3()
3685 if (ai->micstats.enabled) { in mpi_receive_802_3()
3687 ai->rxfids[0].virtual_host_addr + ETH_ALEN * 2, in mpi_receive_802_3()
3694 skb_trim (skb, len - off); in mpi_receive_802_3()
3698 ai->rxfids[0].virtual_host_addr + ETH_ALEN * 2 + off, in mpi_receive_802_3()
3699 len - ETH_ALEN * 2 - off); in mpi_receive_802_3()
3700 if (decapsulate (ai, &micbuf, (etherHead*)buffer, len - off - ETH_ALEN * 2)) { in mpi_receive_802_3()
3706 if (ai->spy_data.spy_number > 0) { in mpi_receive_802_3()
3712 wstats.level = 0; in mpi_receive_802_3()
3715 wireless_spy_update(ai->dev, sa, &wstats); in mpi_receive_802_3()
3719 skb->ip_summed = CHECKSUM_NONE; in mpi_receive_802_3()
3720 skb->protocol = eth_type_trans(skb, ai->dev); in mpi_receive_802_3()
3728 memcpy_toio(ai->rxfids[0].card_ram_off, &rxd, sizeof(rxd)); in mpi_receive_802_3()
3741 char *ptr = ai->rxfids[0].virtual_host_addr + 4; in mpi_receive_802_11()
3743 memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); in mpi_receive_802_11()
3749 if (ai->wifidev == NULL) in mpi_receive_802_11()
3753 airo_print_err(ai->dev->name, "Bad size %d", len); in mpi_receive_802_11()
3764 ai->dev->stats.rx_dropped++; in mpi_receive_802_11()
3778 airo_print_err(ai->dev->name, in mpi_receive_802_11()
3784 if (ai->spy_data.spy_number > 0) { in mpi_receive_802_11()
3790 if (ai->rssi) in mpi_receive_802_11()
3791 wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; in mpi_receive_802_11()
3793 wstats.level = (hdr.rssi[1] + 321) / 2; in mpi_receive_802_11()
3794 wstats.noise = ai->wstats.qual.noise; in mpi_receive_802_11()
3799 wireless_spy_update(ai->dev, sa, &wstats); in mpi_receive_802_11()
3803 skb->pkt_type = PACKET_OTHERHOST; in mpi_receive_802_11()
3804 skb->dev = ai->wifidev; in mpi_receive_802_11()
3805 skb->protocol = htons(ETH_P_802_2); in mpi_receive_802_11()
3806 skb->ip_summed = CHECKSUM_NONE; in mpi_receive_802_11()
3814 memcpy_toio(ai->rxfids[0].card_ram_off, &rxd, sizeof(rxd)); in mpi_receive_802_11()
3820 local->config.authType = auth_type; in set_auth_type()
3825 local->last_auth = auth_type; in set_auth_type()
3837 kfree(ai->SSID); in airo_readconfig()
3838 ai->SSID = NULL; in airo_readconfig()
3848 if (ai->rssi || (ai->rssi = kmalloc(512, GFP_KERNEL)) != NULL) in airo_readconfig()
3849 memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */ in airo_readconfig()
3852 kfree(ai->rssi); in airo_readconfig()
3853 ai->rssi = NULL; in airo_readconfig()
3855 ai->config.rmode |= RXMODE_NORMALIZED_RSSI; in airo_readconfig()
3857 airo_print_warn(ai->dev->name, "unknown received signal " in airo_readconfig()
3858 "level scale"); in airo_readconfig()
3860 ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS; in airo_readconfig()
3862 ai->config.modulation = MOD_CCK; in airo_readconfig()
3867 ai->config.opmode |= MODE_MIC; in airo_readconfig()
3868 set_bit(FLAG_MIC_CAPABLE, &ai->flags); in airo_readconfig()
3873 mac[i] = ai->config.macAddr[i]; in airo_readconfig()
3879 memset(ai->config.rates, 0, sizeof(ai->config.rates)); in airo_readconfig()
3881 ai->config.rates[i] = rates[i]; in airo_readconfig()
3884 set_bit (FLAG_COMMIT, &ai->flags); in airo_readconfig()
3901 kfree (ai->flash); in setup_card()
3902 ai->flash = NULL; in setup_card()
3907 if (lock && down_interruptible(&ai->sem)) in setup_card()
3911 up(&ai->sem); in setup_card()
3917 if (!test_bit(FLAG_MPI,&ai->flags)) { in setup_card()
3921 up(&ai->sem); in setup_card()
3922 airo_print_err(ai->dev->name, "Error checking for AUX port"); in setup_card()
3926 ai->bap_read = fast_bap_read; in setup_card()
3927 airo_print_dbg(ai->dev->name, "Doing fast bap_reads"); in setup_card()
3929 ai->bap_read = aux_bap_read; in setup_card()
3930 airo_print_dbg(ai->dev->name, "Doing AUX bap_reads"); in setup_card()
3934 up(&ai->sem); in setup_card()
3935 if (ai->config.len == 0) { in setup_card()
3972 ai->defindex = wkr.mac[0]; in setup_card()
3990 OUT4500(ai, PARAM0, pCmd->parm0); in issuecommand()
3991 OUT4500(ai, PARAM1, pCmd->parm1); in issuecommand()
3992 OUT4500(ai, PARAM2, pCmd->parm2); in issuecommand()
3993 OUT4500(ai, COMMAND, pCmd->cmd); in issuecommand()
3995 while (max_tries-- && (IN4500(ai, EVSTAT) & EV_CMD) == 0) { in issuecommand()
3996 if ((IN4500(ai, COMMAND)) == pCmd->cmd) in issuecommand()
3998 OUT4500(ai, COMMAND, pCmd->cmd); in issuecommand()
4003 if (max_tries == -1) { in issuecommand()
4004 airo_print_err(ai->dev->name, in issuecommand()
4012 pRsp->status = IN4500(ai, STATUS); in issuecommand()
4013 pRsp->rsp0 = IN4500(ai, RESP0); in issuecommand()
4014 pRsp->rsp1 = IN4500(ai, RESP1); in issuecommand()
4015 pRsp->rsp2 = IN4500(ai, RESP2); in issuecommand()
4016 if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) in issuecommand()
4017 airo_print_err(ai->dev->name, in issuecommand()
4019 pCmd->cmd, pRsp->status, pRsp->rsp0, pRsp->rsp1, in issuecommand()
4020 pRsp->rsp2); in issuecommand()
4047 if (timeout--) { in bap_setup()
4052 airo_print_err(ai->dev->name, "BAP error %x %d", in bap_setup()
4058 if (!(max_tries--)) { in bap_setup()
4059 airo_print_err(ai->dev->name, in bap_setup()
4063 // -- PC4500 missed it, try again in bap_setup()
4098 spin_lock_irqsave(&ai->aux_lock, flags); in aux_bap_read()
4106 count = (len>>1) < (words-i) ? (len>>1) : (words-i); in aux_bap_read()
4108 insw(ai->dev->base_addr+DATA0+whichbap, in aux_bap_read()
4111 insb(ai->dev->base_addr+DATA0+whichbap, in aux_bap_read()
4118 spin_unlock_irqrestore(&ai->aux_lock, flags); in aux_bap_read()
4129 insw(ai->dev->base_addr+DATA0+whichbap, pu16Dst, bytelen>>1); in fast_bap_read()
4131 insb(ai->dev->base_addr+DATA0+whichbap, pu16Dst, bytelen); in fast_bap_read()
4141 outsw(ai->dev->base_addr+DATA0+whichbap, in bap_write()
4144 outsb(ai->dev->base_addr+DATA0+whichbap, pu16Src, bytelen); in bap_write()
4173 if (down_interruptible(&ai->sem)) in PC4500_readrid()
4176 if (test_bit(FLAG_MPI,&ai->flags)) { in PC4500_readrid()
4182 ai->config_desc.rid_desc.valid = 1; in PC4500_readrid()
4183 ai->config_desc.rid_desc.len = RIDSIZE; in PC4500_readrid()
4184 ai->config_desc.rid_desc.rid = 0; in PC4500_readrid()
4185 ai->config_desc.rid_desc.host_addr = ai->ridbus; in PC4500_readrid()
4190 memcpy_toio(ai->config_desc.card_ram_off, in PC4500_readrid()
4191 &ai->config_desc.rid_desc, sizeof(Rid)); in PC4500_readrid()
4198 memcpy(pBuf, ai->config_desc.virtual_host_addr, len); in PC4500_readrid()
4212 len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2; in PC4500_readrid()
4215 airo_print_err(ai->dev->name, in PC4500_readrid()
4226 up(&ai->sem); in PC4500_readrid()
4241 if (down_interruptible(&ai->sem)) in PC4500_writerid()
4244 if (test_bit(FLAG_MPI,&ai->flags)) { in PC4500_writerid()
4248 if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) in PC4500_writerid()
4249 airo_print_err(ai->dev->name, in PC4500_writerid()
4255 ai->config_desc.rid_desc.valid = 1; in PC4500_writerid()
4256 ai->config_desc.rid_desc.len = *((u16 *)pBuf); in PC4500_writerid()
4257 ai->config_desc.rid_desc.rid = 0; in PC4500_writerid()
4262 memcpy_toio(ai->config_desc.card_ram_off, in PC4500_writerid()
4263 &ai->config_desc.rid_desc, sizeof(Rid)); in PC4500_writerid()
4266 airo_print_err(ai->dev->name, "%s: len=%d", __func__, len); in PC4500_writerid()
4267 rc = -1; in PC4500_writerid()
4269 memcpy(ai->config_desc.virtual_host_addr, in PC4500_writerid()
4274 airo_print_err(ai->dev->name, "%s: Write rid Error %d", in PC4500_writerid()
4276 airo_print_err(ai->dev->name, "%s: Cmd=%04x", in PC4500_writerid()
4284 // --- first access so that we can write the rid data in PC4500_writerid()
4289 // --- now write the rid data in PC4500_writerid()
4295 // ---now commit the rid data in PC4500_writerid()
4300 up(&ai->sem); in PC4500_writerid()
4316 if (down_interruptible(&ai->sem)) in transmit_allocate()
4329 while (((IN4500(ai, EVSTAT) & EV_ALLOC) == 0) && --loop); in transmit_allocate()
4356 up(&ai->sem); in transmit_allocate()
4376 airo_print_warn(ai->dev->name, "Short packet %d", len); in transmit_802_3_packet()
4379 len -= ETH_ALEN * 2; in transmit_802_3_packet()
4381 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && in transmit_802_3_packet()
4387 // packet is destination[6], source[6], payload[len-12] in transmit_802_3_packet()
4413 static u8 tail[(30-10) + 2 + 6] = {[30-10] = 6}; in transmit_802_11_packet()
4422 airo_print_warn(ai->dev->name, "Short packet %d", len); in transmit_802_11_packet()
4431 payloadLen = cpu_to_le16(len-hdrlen); in transmit_802_11_packet()
4435 bap_write(ai, (__le16 *)(tail + (hdrlen - 10)), 38 - hdrlen, BAP1); in transmit_802_11_packet()
4437 bap_write(ai, (__le16 *)(pPacket + hdrlen), len - hdrlen, BAP1); in transmit_802_11_packet()
4551 strcpy(apriv->proc_name, dev->name); in setup_proc_entry()
4552 apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, in setup_proc_entry()
4554 if (!apriv->proc_entry) in setup_proc_entry()
4555 return -ENOMEM; in setup_proc_entry()
4556 proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid); in setup_proc_entry()
4560 apriv->proc_entry, &proc_statsdelta_ops, dev); in setup_proc_entry()
4567 apriv->proc_entry, &proc_stats_ops, dev); in setup_proc_entry()
4574 apriv->proc_entry, &proc_status_ops, dev); in setup_proc_entry()
4581 apriv->proc_entry, &proc_config_ops, dev); in setup_proc_entry()
4588 apriv->proc_entry, &proc_SSID_ops, dev); in setup_proc_entry()
4595 apriv->proc_entry, &proc_APList_ops, dev); in setup_proc_entry()
4602 apriv->proc_entry, &proc_BSSList_ops, dev); in setup_proc_entry()
4609 apriv->proc_entry, &proc_wepkey_ops, dev); in setup_proc_entry()
4616 remove_proc_subtree(apriv->proc_name, airo_entry); in setup_proc_entry()
4617 return -ENOMEM; in setup_proc_entry()
4623 remove_proc_subtree(apriv->proc_name, airo_entry); in takedown_proc_entry()
4644 struct proc_data *priv = file->private_data; in proc_read()
4646 if (!priv->rbuffer) in proc_read()
4647 return -EINVAL; in proc_read()
4649 return simple_read_from_buffer(buffer, len, offset, priv->rbuffer, in proc_read()
4650 priv->readlen); in proc_read()
4663 struct proc_data *priv = file->private_data; in proc_write()
4665 if (!priv->wbuffer) in proc_write()
4666 return -EINVAL; in proc_write()
4668 ret = simple_write_to_buffer(priv->wbuffer, priv->maxwritelen, offset, in proc_write()
4671 priv->writelen = max_t(int, priv->writelen, *offset); in proc_write()
4680 struct airo_info *apriv = dev->ml_priv; in proc_status_open()
4686 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_status_open()
4687 return -ENOMEM; in proc_status_open()
4688 data = file->private_data; in proc_status_open()
4689 if ((data->rbuffer = kmalloc(2048, GFP_KERNEL)) == NULL) { in proc_status_open()
4690 kfree (file->private_data); in proc_status_open()
4691 return -ENOMEM; in proc_status_open()
4699 i = sprintf(data->rbuffer, "Status: %s%s%s%s%s%s%s%s%s\n", in proc_status_open()
4709 sprintf(data->rbuffer+i, "Mode: %x\n" in proc_status_open()
4712 "SSID: %-.*s\n" in proc_status_open()
4713 "AP: %-.16s\n" in proc_status_open()
4739 data->readlen = strlen(data->rbuffer); in proc_status_open()
4747 if (file->f_mode&FMODE_WRITE) { in proc_statsdelta_open()
4764 struct airo_info *apriv = dev->ml_priv; in proc_stats_rid_open()
4770 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_stats_rid_open()
4771 return -ENOMEM; in proc_stats_rid_open()
4772 data = file->private_data; in proc_stats_rid_open()
4773 if ((data->rbuffer = kmalloc(4096, GFP_KERNEL)) == NULL) { in proc_stats_rid_open()
4774 kfree (file->private_data); in proc_stats_rid_open()
4775 return -ENOMEM; in proc_stats_rid_open()
4782 for (i = 0; statsLabels[i]!=(char *)-1 && i*4<len; i++) { in proc_stats_rid_open()
4785 airo_print_warn(apriv->dev->name, in proc_stats_rid_open()
4789 j+=sprintf(data->rbuffer+j, "%s: %u\n", statsLabels[i], in proc_stats_rid_open()
4793 airo_print_warn(apriv->dev->name, "Got a short rid"); in proc_stats_rid_open()
4795 data->readlen = j; in proc_stats_rid_open()
4807 value += buffer[*start] - '0'; in get_dec_u16()
4809 if (!valid) return -1; in get_dec_u16()
4819 return (le16_to_cpu(ai->config.rmode) & le16_to_cpu(RXMODE_MASK)) >= in sniffing_mode()
4825 struct proc_data *data = file->private_data; in proc_config_on_close()
4827 struct airo_info *ai = dev->ml_priv; in proc_config_on_close()
4830 if (!data->writelen) return; in proc_config_on_close()
4833 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4835 line = data->wbuffer; in proc_config_on_close()
4841 set_bit (FLAG_RESET, &ai->flags); in proc_config_on_close()
4842 ai->config.rmode &= ~RXMODE_FULL_MASK; in proc_config_on_close()
4843 clear_bit (FLAG_802_11, &ai->flags); in proc_config_on_close()
4844 ai->config.opmode &= ~MODE_CFG_MASK; in proc_config_on_close()
4845 ai->config.scanMode = SCANMODE_ACTIVE; in proc_config_on_close()
4847 ai->config.opmode |= MODE_STA_IBSS; in proc_config_on_close()
4849 ai->config.opmode |= MODE_STA_ESS; in proc_config_on_close()
4851 ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; in proc_config_on_close()
4852 ai->config.scanMode = SCANMODE_PASSIVE; in proc_config_on_close()
4853 set_bit (FLAG_802_11, &ai->flags); in proc_config_on_close()
4855 ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER; in proc_config_on_close()
4856 ai->config.scanMode = SCANMODE_PASSIVE; in proc_config_on_close()
4857 set_bit (FLAG_802_11, &ai->flags); in proc_config_on_close()
4859 ai->config.rmode |= RXMODE_LANMON; in proc_config_on_close()
4861 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4868 set_bit (FLAG_RADIO_OFF, &ai->flags); in proc_config_on_close()
4870 clear_bit (FLAG_RADIO_OFF, &ai->flags); in proc_config_on_close()
4878 memset(ai->config.nodeName, 0, 16); in proc_config_on_close()
4881 ai->config.nodeName[j] = line[j]; in proc_config_on_close()
4883 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4890 ai->config.powerSaveMode = POWERSAVE_PSPCAM; in proc_config_on_close()
4891 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4893 ai->config.powerSaveMode = POWERSAVE_PSP; in proc_config_on_close()
4894 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4896 ai->config.powerSaveMode = POWERSAVE_CAM; in proc_config_on_close()
4897 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4904 while ((v = get_dec_u16(line, &i, 3))!=-1) { in proc_config_on_close()
4905 ai->config.rates[k++] = (u8)v; in proc_config_on_close()
4909 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4914 if (v != -1) { in proc_config_on_close()
4915 ai->config.channelSet = cpu_to_le16(v); in proc_config_on_close()
4916 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4922 if (v != -1) { in proc_config_on_close()
4923 ai->config.txPower = cpu_to_le16(v); in proc_config_on_close()
4924 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4939 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4946 ai->config.longRetryLimit = cpu_to_le16(v); in proc_config_on_close()
4947 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4954 ai->config.shortRetryLimit = cpu_to_le16(v); in proc_config_on_close()
4955 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4962 ai->config.rtsThres = cpu_to_le16(v); in proc_config_on_close()
4963 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4970 ai->config.txLifetime = cpu_to_le16(v); in proc_config_on_close()
4971 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4978 ai->config.rxLifetime = cpu_to_le16(v); in proc_config_on_close()
4979 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4981 ai->config.txDiversity = in proc_config_on_close()
4984 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4986 ai->config.rxDiversity = in proc_config_on_close()
4989 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
4997 ai->config.fragThresh = cpu_to_le16(v); in proc_config_on_close()
4998 set_bit (FLAG_COMMIT, &ai->flags); in proc_config_on_close()
5002 case 'd': ai->config.modulation = MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break; in proc_config_on_close()
5003 case 'c': ai->config.modulation = MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break; in proc_config_on_close()
5004 case 'm': ai->config.modulation = MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break; in proc_config_on_close()
5005 default: airo_print_warn(ai->dev->name, "Unknown modulation"); in proc_config_on_close()
5010 case 'a': ai->config.preamble = PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break; in proc_config_on_close()
5011 case 'l': ai->config.preamble = PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break; in proc_config_on_close()
5012 case 's': ai->config.preamble = PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break; in proc_config_on_close()
5013 default: airo_print_warn(ai->dev->name, "Unknown preamble"); in proc_config_on_close()
5016 airo_print_warn(ai->dev->name, "Couldn't figure out %s", line); in proc_config_on_close()
5038 struct airo_info *ai = dev->ml_priv; in proc_config_open()
5042 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_config_open()
5043 return -ENOMEM; in proc_config_open()
5044 data = file->private_data; in proc_config_open()
5045 if ((data->rbuffer = kmalloc(2048, GFP_KERNEL)) == NULL) { in proc_config_open()
5046 kfree (file->private_data); in proc_config_open()
5047 return -ENOMEM; in proc_config_open()
5049 if ((data->wbuffer = kzalloc(2048, GFP_KERNEL)) == NULL) { in proc_config_open()
5050 kfree (data->rbuffer); in proc_config_open()
5051 kfree (file->private_data); in proc_config_open()
5052 return -ENOMEM; in proc_config_open()
5054 data->maxwritelen = 2048; in proc_config_open()
5055 data->on_close = proc_config_on_close; in proc_config_open()
5059 mode = ai->config.opmode & MODE_CFG_MASK; in proc_config_open()
5060 i = sprintf(data->rbuffer, in proc_config_open()
5063 "NodeName: %-16s\n" in proc_config_open()
5069 mode == MODE_STA_ESS ? get_rmode(ai->config.rmode): in proc_config_open()
5072 test_bit(FLAG_RADIO_OFF, &ai->flags) ? "off" : "on", in proc_config_open()
5073 ai->config.nodeName, in proc_config_open()
5074 ai->config.powerSaveMode == POWERSAVE_CAM ? "CAM" : in proc_config_open()
5075 ai->config.powerSaveMode == POWERSAVE_PSP ? "PSP" : in proc_config_open()
5076 ai->config.powerSaveMode == POWERSAVE_PSPCAM ? "PSPCAM" : in proc_config_open()
5078 (int)ai->config.rates[0], in proc_config_open()
5079 (int)ai->config.rates[1], in proc_config_open()
5080 (int)ai->config.rates[2], in proc_config_open()
5081 (int)ai->config.rates[3], in proc_config_open()
5082 (int)ai->config.rates[4], in proc_config_open()
5083 (int)ai->config.rates[5], in proc_config_open()
5084 (int)ai->config.rates[6], in proc_config_open()
5085 (int)ai->config.rates[7], in proc_config_open()
5086 le16_to_cpu(ai->config.channelSet), in proc_config_open()
5087 le16_to_cpu(ai->config.txPower) in proc_config_open()
5089 sprintf(data->rbuffer + i, in proc_config_open()
5101 le16_to_cpu(ai->config.longRetryLimit), in proc_config_open()
5102 le16_to_cpu(ai->config.shortRetryLimit), in proc_config_open()
5103 le16_to_cpu(ai->config.rtsThres), in proc_config_open()
5104 le16_to_cpu(ai->config.txLifetime), in proc_config_open()
5105 le16_to_cpu(ai->config.rxLifetime), in proc_config_open()
5106 ai->config.txDiversity == 1 ? "left" : in proc_config_open()
5107 ai->config.txDiversity == 2 ? "right" : "both", in proc_config_open()
5108 ai->config.rxDiversity == 1 ? "left" : in proc_config_open()
5109 ai->config.rxDiversity == 2 ? "right" : "both", in proc_config_open()
5110 le16_to_cpu(ai->config.fragThresh), in proc_config_open()
5111 ai->config.authType == AUTH_ENCRYPT ? "encrypt" : in proc_config_open()
5112 ai->config.authType == AUTH_SHAREDKEY ? "shared" : "open", in proc_config_open()
5113 ai->config.modulation == MOD_DEFAULT ? "default" : in proc_config_open()
5114 ai->config.modulation == MOD_CCK ? "cck" : in proc_config_open()
5115 ai->config.modulation == MOD_MOK ? "mok" : "error", in proc_config_open()
5116 ai->config.preamble == PREAMBLE_AUTO ? "auto" : in proc_config_open()
5117 ai->config.preamble == PREAMBLE_LONG ? "long" : in proc_config_open()
5118 ai->config.preamble == PREAMBLE_SHORT ? "short" : "error" in proc_config_open()
5120 data->readlen = strlen(data->rbuffer); in proc_config_open()
5126 struct proc_data *data = file->private_data; in proc_SSID_on_close()
5128 struct airo_info *ai = dev->ml_priv; in proc_SSID_on_close()
5131 char *p = data->wbuffer; in proc_SSID_on_close()
5132 char *end = p + data->writelen; in proc_SSID_on_close()
5134 if (!data->writelen) in proc_SSID_on_close()
5162 struct proc_data *data = file->private_data; in proc_APList_on_close()
5164 struct airo_info *ai = dev->ml_priv; in proc_APList_on_close()
5165 APListRid *APList_rid = &ai->APList; in proc_APList_on_close()
5168 if (!data->writelen) return; in proc_APList_on_close()
5171 APList_rid->len = cpu_to_le16(sizeof(*APList_rid)); in proc_APList_on_close()
5173 for (i = 0; i < 4 && data->writelen >= (i + 1) * 6 * 3; i++) in proc_APList_on_close()
5174 mac_pton(data->wbuffer + i * 6 * 3, APList_rid->ap[i]); in proc_APList_on_close()
5193 /* Returns the WEP key at the specified index, or -1 if that key does
5204 return -1; in get_wep_key()
5214 return -1; in get_wep_key()
5216 return -1; in get_wep_key()
5227 return -1; in get_wep_tx_idx()
5234 return -1; in get_wep_tx_idx()
5236 return -1; in get_wep_tx_idx()
5247 return -1; in set_wep_key()
5273 ai->defindex = (char)index; in set_wep_tx_idx()
5288 struct airo_info *ai = dev->ml_priv; in proc_wepkey_on_close()
5296 data = file->private_data; in proc_wepkey_on_close()
5297 if (!data->writelen) return; in proc_wepkey_on_close()
5299 if (data->wbuffer[0] >= '0' && data->wbuffer[0] <= '3' && in proc_wepkey_on_close()
5300 (data->wbuffer[1] == ' ' || data->wbuffer[1] == '\n')) { in proc_wepkey_on_close()
5301 index = data->wbuffer[0] - '0'; in proc_wepkey_on_close()
5302 if (data->wbuffer[1] == '\n') { in proc_wepkey_on_close()
5305 airo_print_err(ai->dev->name, "failed to set " in proc_wepkey_on_close()
5313 airo_print_err(ai->dev->name, "WepKey passed invalid key index"); in proc_wepkey_on_close()
5317 for (i = 0; i < 16*3 && data->wbuffer[i+j]; i++) { in proc_wepkey_on_close()
5323 val = hex_to_bin(data->wbuffer[i+j]); in proc_wepkey_on_close()
5325 airo_print_err(ai->dev->name, "WebKey passed invalid key hex"); in proc_wepkey_on_close()
5340 airo_print_err(ai->dev->name, "failed to set WEP key at index " in proc_wepkey_on_close()
5349 struct airo_info *ai = dev->ml_priv; in proc_wepkey_open()
5356 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_wepkey_open()
5357 return -ENOMEM; in proc_wepkey_open()
5359 data = file->private_data; in proc_wepkey_open()
5360 if ((data->rbuffer = kzalloc(180, GFP_KERNEL)) == NULL) { in proc_wepkey_open()
5361 kfree (file->private_data); in proc_wepkey_open()
5362 return -ENOMEM; in proc_wepkey_open()
5364 data->writelen = 0; in proc_wepkey_open()
5365 data->maxwritelen = 80; in proc_wepkey_open()
5366 if ((data->wbuffer = kzalloc(80, GFP_KERNEL)) == NULL) { in proc_wepkey_open()
5367 kfree (data->rbuffer); in proc_wepkey_open()
5368 kfree (file->private_data); in proc_wepkey_open()
5369 return -ENOMEM; in proc_wepkey_open()
5371 data->on_close = proc_wepkey_on_close; in proc_wepkey_open()
5373 ptr = data->rbuffer; in proc_wepkey_open()
5387 } while ((lastindex != wkr.kindex) && (j < 180-30)); in proc_wepkey_open()
5389 data->readlen = strlen(data->rbuffer); in proc_wepkey_open()
5397 struct airo_info *ai = dev->ml_priv; in proc_SSID_open()
5402 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_SSID_open()
5403 return -ENOMEM; in proc_SSID_open()
5404 data = file->private_data; in proc_SSID_open()
5405 if ((data->rbuffer = kmalloc(104, GFP_KERNEL)) == NULL) { in proc_SSID_open()
5406 kfree (file->private_data); in proc_SSID_open()
5407 return -ENOMEM; in proc_SSID_open()
5409 data->writelen = 0; in proc_SSID_open()
5410 data->maxwritelen = 33*3; in proc_SSID_open()
5412 if ((data->wbuffer = kzalloc(33*3 + 1, GFP_KERNEL)) == NULL) { in proc_SSID_open()
5413 kfree (data->rbuffer); in proc_SSID_open()
5414 kfree (file->private_data); in proc_SSID_open()
5415 return -ENOMEM; in proc_SSID_open()
5417 data->on_close = proc_SSID_on_close; in proc_SSID_open()
5420 ptr = data->rbuffer; in proc_SSID_open()
5433 data->readlen = strlen(data->rbuffer); in proc_SSID_open()
5441 struct airo_info *ai = dev->ml_priv; in proc_APList_open()
5444 APListRid *APList_rid = &ai->APList; in proc_APList_open()
5446 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_APList_open()
5447 return -ENOMEM; in proc_APList_open()
5448 data = file->private_data; in proc_APList_open()
5449 if ((data->rbuffer = kmalloc(104, GFP_KERNEL)) == NULL) { in proc_APList_open()
5450 kfree (file->private_data); in proc_APList_open()
5451 return -ENOMEM; in proc_APList_open()
5453 data->writelen = 0; in proc_APList_open()
5454 data->maxwritelen = 4*6*3; in proc_APList_open()
5455 if ((data->wbuffer = kzalloc(data->maxwritelen, GFP_KERNEL)) == NULL) { in proc_APList_open()
5456 kfree (data->rbuffer); in proc_APList_open()
5457 kfree (file->private_data); in proc_APList_open()
5458 return -ENOMEM; in proc_APList_open()
5460 data->on_close = proc_APList_on_close; in proc_APList_open()
5462 ptr = data->rbuffer; in proc_APList_open()
5465 if (!*(int*)APList_rid->ap[i] && in proc_APList_open()
5466 !*(int*)&APList_rid->ap[i][2]) break; in proc_APList_open()
5467 ptr += sprintf(ptr, "%pM\n", APList_rid->ap[i]); in proc_APList_open()
5472 data->readlen = strlen(data->rbuffer); in proc_APList_open()
5480 struct airo_info *ai = dev->ml_priv; in proc_BSSList_open()
5485 int doLoseSync = -1; in proc_BSSList_open()
5487 if ((file->private_data = kzalloc(sizeof(struct proc_data), GFP_KERNEL)) == NULL) in proc_BSSList_open()
5488 return -ENOMEM; in proc_BSSList_open()
5489 data = file->private_data; in proc_BSSList_open()
5490 if ((data->rbuffer = kmalloc(1024, GFP_KERNEL)) == NULL) { in proc_BSSList_open()
5491 kfree (file->private_data); in proc_BSSList_open()
5492 return -ENOMEM; in proc_BSSList_open()
5494 data->writelen = 0; in proc_BSSList_open()
5495 data->maxwritelen = 0; in proc_BSSList_open()
5496 data->wbuffer = NULL; in proc_BSSList_open()
5497 data->on_close = NULL; in proc_BSSList_open()
5499 if (file->f_mode & FMODE_WRITE) { in proc_BSSList_open()
5500 if (!(file->f_mode & FMODE_READ)) { in proc_BSSList_open()
5504 if (ai->flags & FLAG_RADIO_MASK) { in proc_BSSList_open()
5505 kfree(data->rbuffer); in proc_BSSList_open()
5506 kfree(file->private_data); in proc_BSSList_open()
5507 return -ENETDOWN; in proc_BSSList_open()
5511 if (down_interruptible(&ai->sem)) { in proc_BSSList_open()
5512 kfree(data->rbuffer); in proc_BSSList_open()
5513 kfree(file->private_data); in proc_BSSList_open()
5514 return -ERESTARTSYS; in proc_BSSList_open()
5517 up(&ai->sem); in proc_BSSList_open()
5518 data->readlen = 0; in proc_BSSList_open()
5523 ptr = data->rbuffer; in proc_BSSList_open()
5543 data->readlen = strlen(data->rbuffer); in proc_BSSList_open()
5549 struct proc_data *data = file->private_data; in proc_close()
5551 if (data->on_close != NULL) in proc_close()
5552 data->on_close(inode, file); in proc_close()
5553 kfree(data->rbuffer); in proc_close()
5554 kfree(data->wbuffer); in proc_close()
5566 struct airo_info *apriv = dev->ml_priv; in timer_func()
5571 switch(apriv->config.authType) { in timer_func()
5574 apriv->config.authType = AUTH_OPEN; in timer_func()
5577 if (apriv->keyindex < auto_wep) { in timer_func()
5578 set_wep_tx_idx(apriv, apriv->keyindex, 0, 0); in timer_func()
5579 apriv->config.authType = AUTH_SHAREDKEY; in timer_func()
5580 apriv->keyindex++; in timer_func()
5583 apriv->keyindex = 0; in timer_func()
5584 set_wep_tx_idx(apriv, apriv->defindex, 0, 0); in timer_func()
5585 apriv->config.authType = AUTH_ENCRYPT; in timer_func()
5589 apriv->config.authType = AUTH_SHAREDKEY; in timer_func()
5591 set_bit (FLAG_COMMIT, &apriv->flags); in timer_func()
5594 up(&apriv->sem); in timer_func()
5597 clear_bit(JOB_AUTOWEP, &apriv->jobs); in timer_func()
5598 apriv->expires = RUN_AT(HZ*3); in timer_func()
5608 return -ENODEV; in airo_pci_probe()
5611 if (pdev->device == 0x5000 || pdev->device == 0xa504) in airo_pci_probe()
5612 dev = _init_airo_card(pdev->irq, pdev->resource[0].start, 0, pdev, &pdev->dev); in airo_pci_probe()
5614 dev = _init_airo_card(pdev->irq, pdev->resource[2].start, 0, pdev, &pdev->dev); in airo_pci_probe()
5617 return -ENODEV; in airo_pci_probe()
5628 airo_print_info(dev->name, "Unregistering..."); in airo_pci_remove()
5636 struct airo_info *ai = dev->ml_priv; in airo_pci_suspend()
5640 if (!ai->SSID) in airo_pci_suspend()
5641 ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL); in airo_pci_suspend()
5642 if (!ai->SSID) in airo_pci_suspend()
5643 return -ENOMEM; in airo_pci_suspend()
5644 readSsidRid(ai, ai->SSID); in airo_pci_suspend()
5647 if (down_interruptible(&ai->sem)) in airo_pci_suspend()
5648 return -EAGAIN; in airo_pci_suspend()
5651 ai->power = PMSG_SUSPEND; in airo_pci_suspend()
5662 struct airo_info *ai = dev->ml_priv; in airo_pci_resume()
5663 pci_power_t prev_state = to_pci_dev(dev_d)->current_state; in airo_pci_resume()
5670 setup_card(ai, dev->dev_addr, 0); in airo_pci_resume()
5671 clear_bit(FLAG_RADIO_OFF, &ai->flags); in airo_pci_resume()
5672 clear_bit(FLAG_PENDING_XMIT, &ai->flags); in airo_pci_resume()
5679 set_bit(FLAG_COMMIT, &ai->flags); in airo_pci_resume()
5682 if (ai->SSID) { in airo_pci_resume()
5683 writeSsidRid(ai, ai->SSID, 0); in airo_pci_resume()
5684 kfree(ai->SSID); in airo_pci_resume()
5685 ai->SSID = NULL; in airo_pci_resume()
5687 writeAPListRid(ai, &ai->APList, 0); in airo_pci_resume()
5690 ai->power = PMSG_ON; in airo_pci_resume()
5694 up(&ai->sem); in airo_pci_resume()
5706 return -EINVAL; in airo_init_module()
5743 airo_print_info(ai->dev->name, "Unregistering..."); in airo_cleanup_module()
5744 stop_airo_card(ai->dev, 1); in airo_cleanup_module()
5754 * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00
5756 * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 26 March 02
5759 * would not work at all... - Jean II
5767 return (0x100 - rssi_rid[rssi].rssidBm); in airo_rssi_to_dbm()
5790 if ((status_rid->mode & cpu_to_le16(0x3f)) != cpu_to_le16(0x3f)) in airo_get_quality()
5793 if (!(cap_rid->hardCap & cpu_to_le16(8))) in airo_get_quality()
5796 sq = le16_to_cpu(status_rid->signalQuality); in airo_get_quality()
5797 if (memcmp(cap_rid->prodName, "350", 3)) in airo_get_quality()
5801 quality = 0x20 - sq; in airo_get_quality()
5808 quality = 0xb0 - sq; in airo_get_quality()
5812 #define airo_get_max_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x20 : 0xa0)
5813 #define airo_get_avg_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x10 : 0x50);
5815 /*------------------------------------------------------------------*/
5824 strcpy(cwrq, "IEEE 802.11-DS"); in airo_get_name()
5828 /*------------------------------------------------------------------*/
5837 struct airo_info *local = dev->ml_priv; in airo_set_freq()
5838 int rc = -EINPROGRESS; /* Call commit handler */ in airo_set_freq()
5841 if (fwrq->e == 1) { in airo_set_freq()
5842 int f = fwrq->m / 100000; in airo_set_freq()
5845 fwrq->e = 0; in airo_set_freq()
5846 fwrq->m = ieee80211_frequency_to_channel(f); in airo_set_freq()
5849 if (fwrq->m < 0 || fwrq->m > 1000 || fwrq->e > 0) in airo_set_freq()
5850 rc = -EOPNOTSUPP; in airo_set_freq()
5852 int channel = fwrq->m; in airo_set_freq()
5856 airo_print_dbg(dev->name, "New channel value of %d is invalid!", in airo_set_freq()
5857 fwrq->m); in airo_set_freq()
5858 rc = -EINVAL; in airo_set_freq()
5862 local->config.channelSet = cpu_to_le16(channel); in airo_set_freq()
5863 set_bit (FLAG_COMMIT, &local->flags); in airo_set_freq()
5869 /*------------------------------------------------------------------*/
5878 struct airo_info *local = dev->ml_priv; in airo_get_freq()
5883 if ((local->config.opmode & MODE_CFG_MASK) == MODE_STA_ESS) in airo_get_freq()
5884 status_rid.channel = local->config.channelSet; in airo_get_freq()
5890 fwrq->m = 100000 * in airo_get_freq()
5892 fwrq->e = 1; in airo_get_freq()
5894 fwrq->m = ch; in airo_get_freq()
5895 fwrq->e = 0; in airo_get_freq()
5901 /*------------------------------------------------------------------*/
5910 struct airo_info *local = dev->ml_priv; in airo_set_essid()
5917 if (dwrq->flags == 0) { in airo_set_essid()
5921 unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in airo_set_essid()
5924 if (dwrq->length > IW_ESSID_MAX_SIZE) in airo_set_essid()
5925 return -E2BIG ; in airo_set_essid()
5929 return -EINVAL; in airo_set_essid()
5934 memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length); in airo_set_essid()
5935 SSID_rid.ssids[index].len = cpu_to_le16(dwrq->length); in airo_set_essid()
5946 /*------------------------------------------------------------------*/
5955 struct airo_info *local = dev->ml_priv; in airo_get_essid()
5960 /* Note : if dwrq->flags != 0, we should in airo_get_essid()
5968 dwrq->length = le16_to_cpu(status_rid.SSIDlen); in airo_get_essid()
5969 dwrq->flags = 1; /* active */ in airo_get_essid()
5974 /*------------------------------------------------------------------*/
5983 struct airo_info *local = dev->ml_priv; in airo_set_wap()
5986 APListRid *APList_rid = &local->APList; in airo_set_wap()
5988 if (awrq->sa_family != ARPHRD_ETHER) in airo_set_wap()
5989 return -EINVAL; in airo_set_wap()
5990 else if (is_broadcast_ether_addr(awrq->sa_data) || in airo_set_wap()
5991 is_zero_ether_addr(awrq->sa_data)) { in airo_set_wap()
5994 if (down_interruptible(&local->sem)) in airo_set_wap()
5995 return -ERESTARTSYS; in airo_set_wap()
5997 up(&local->sem); in airo_set_wap()
6000 APList_rid->len = cpu_to_le16(sizeof(*APList_rid)); in airo_set_wap()
6001 memcpy(APList_rid->ap[0], awrq->sa_data, ETH_ALEN); in airo_set_wap()
6009 /*------------------------------------------------------------------*/
6018 struct airo_info *local = dev->ml_priv; in airo_get_wap()
6024 memcpy(awrq->sa_data, status_rid.bssid[0], ETH_ALEN); in airo_get_wap()
6025 awrq->sa_family = ARPHRD_ETHER; in airo_get_wap()
6030 /*------------------------------------------------------------------*/
6039 struct airo_info *local = dev->ml_priv; in airo_set_nick()
6042 if (dwrq->length > 16) { in airo_set_nick()
6043 return -E2BIG; in airo_set_nick()
6046 memset(local->config.nodeName, 0, sizeof(local->config.nodeName)); in airo_set_nick()
6047 memcpy(local->config.nodeName, extra, dwrq->length); in airo_set_nick()
6048 set_bit (FLAG_COMMIT, &local->flags); in airo_set_nick()
6050 return -EINPROGRESS; /* Call commit handler */ in airo_set_nick()
6053 /*------------------------------------------------------------------*/
6062 struct airo_info *local = dev->ml_priv; in airo_get_nick()
6065 strncpy(extra, local->config.nodeName, 16); in airo_get_nick()
6067 dwrq->length = strlen(extra); in airo_get_nick()
6072 /*------------------------------------------------------------------*/
6074 * Wireless Handler : set Bit-Rate
6081 struct airo_info *local = dev->ml_priv; in airo_set_rate()
6090 if ((vwrq->value < 8) && (vwrq->value >= 0)) { in airo_set_rate()
6093 brate = cap_rid.supportedRates[vwrq->value]; in airo_set_rate()
6096 u8 normvalue = (u8) (vwrq->value/500000); in airo_set_rate()
6106 /* -1 designed the max rate (mostly auto mode) */ in airo_set_rate()
6107 if (vwrq->value == -1) { in airo_set_rate()
6114 brate = cap_rid.supportedRates[i - 1]; in airo_set_rate()
6118 return -EINVAL; in airo_set_rate()
6123 if (vwrq->fixed == 0) { in airo_set_rate()
6125 memset(local->config.rates, 0, 8); in airo_set_rate()
6127 local->config.rates[i] = cap_rid.supportedRates[i]; in airo_set_rate()
6128 if (local->config.rates[i] == brate) in airo_set_rate()
6134 memset(local->config.rates, 0, 8); in airo_set_rate()
6135 local->config.rates[0] = brate; in airo_set_rate()
6137 set_bit (FLAG_COMMIT, &local->flags); in airo_set_rate()
6139 return -EINPROGRESS; /* Call commit handler */ in airo_set_rate()
6142 /*------------------------------------------------------------------*/
6144 * Wireless Handler : get Bit-Rate
6151 struct airo_info *local = dev->ml_priv; in airo_get_rate()
6157 return -EBUSY; in airo_get_rate()
6159 vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000; in airo_get_rate()
6162 vwrq->fixed = (local->config.rates[1] == 0); in airo_get_rate()
6167 /*------------------------------------------------------------------*/
6176 struct airo_info *local = dev->ml_priv; in airo_set_rts()
6177 int rthr = vwrq->value; in airo_set_rts()
6179 if (vwrq->disabled) in airo_set_rts()
6182 return -EINVAL; in airo_set_rts()
6185 local->config.rtsThres = cpu_to_le16(rthr); in airo_set_rts()
6186 set_bit (FLAG_COMMIT, &local->flags); in airo_set_rts()
6188 return -EINPROGRESS; /* Call commit handler */ in airo_set_rts()
6191 /*------------------------------------------------------------------*/
6200 struct airo_info *local = dev->ml_priv; in airo_get_rts()
6203 vwrq->value = le16_to_cpu(local->config.rtsThres); in airo_get_rts()
6204 vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); in airo_get_rts()
6205 vwrq->fixed = 1; in airo_get_rts()
6210 /*------------------------------------------------------------------*/
6219 struct airo_info *local = dev->ml_priv; in airo_set_frag()
6220 int fthr = vwrq->value; in airo_set_frag()
6222 if (vwrq->disabled) in airo_set_frag()
6225 return -EINVAL; in airo_set_frag()
6227 fthr &= ~0x1; /* Get an even value - is it really needed ??? */ in airo_set_frag()
6229 local->config.fragThresh = cpu_to_le16(fthr); in airo_set_frag()
6230 set_bit (FLAG_COMMIT, &local->flags); in airo_set_frag()
6232 return -EINPROGRESS; /* Call commit handler */ in airo_set_frag()
6235 /*------------------------------------------------------------------*/
6244 struct airo_info *local = dev->ml_priv; in airo_get_frag()
6247 vwrq->value = le16_to_cpu(local->config.fragThresh); in airo_get_frag()
6248 vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); in airo_get_frag()
6249 vwrq->fixed = 1; in airo_get_frag()
6254 /*------------------------------------------------------------------*/
6263 struct airo_info *local = dev->ml_priv; in airo_set_mode()
6272 local->config.opmode &= ~MODE_CFG_MASK; in airo_set_mode()
6273 local->config.opmode |= MODE_STA_IBSS; in airo_set_mode()
6274 local->config.rmode &= ~RXMODE_FULL_MASK; in airo_set_mode()
6275 local->config.scanMode = SCANMODE_ACTIVE; in airo_set_mode()
6276 clear_bit (FLAG_802_11, &local->flags); in airo_set_mode()
6279 local->config.opmode &= ~MODE_CFG_MASK; in airo_set_mode()
6280 local->config.opmode |= MODE_STA_ESS; in airo_set_mode()
6281 local->config.rmode &= ~RXMODE_FULL_MASK; in airo_set_mode()
6282 local->config.scanMode = SCANMODE_ACTIVE; in airo_set_mode()
6283 clear_bit (FLAG_802_11, &local->flags); in airo_set_mode()
6286 local->config.opmode &= ~MODE_CFG_MASK; in airo_set_mode()
6287 local->config.opmode |= MODE_AP; in airo_set_mode()
6288 local->config.rmode &= ~RXMODE_FULL_MASK; in airo_set_mode()
6289 local->config.scanMode = SCANMODE_ACTIVE; in airo_set_mode()
6290 clear_bit (FLAG_802_11, &local->flags); in airo_set_mode()
6293 local->config.opmode &= ~MODE_CFG_MASK; in airo_set_mode()
6294 local->config.opmode |= MODE_AP_RPTR; in airo_set_mode()
6295 local->config.rmode &= ~RXMODE_FULL_MASK; in airo_set_mode()
6296 local->config.scanMode = SCANMODE_ACTIVE; in airo_set_mode()
6297 clear_bit (FLAG_802_11, &local->flags); in airo_set_mode()
6300 local->config.opmode &= ~MODE_CFG_MASK; in airo_set_mode()
6301 local->config.opmode |= MODE_STA_ESS; in airo_set_mode()
6302 local->config.rmode &= ~RXMODE_FULL_MASK; in airo_set_mode()
6303 local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; in airo_set_mode()
6304 local->config.scanMode = SCANMODE_PASSIVE; in airo_set_mode()
6305 set_bit (FLAG_802_11, &local->flags); in airo_set_mode()
6308 return -EINVAL; in airo_set_mode()
6311 set_bit (FLAG_RESET, &local->flags); in airo_set_mode()
6312 set_bit (FLAG_COMMIT, &local->flags); in airo_set_mode()
6314 return -EINPROGRESS; /* Call commit handler */ in airo_set_mode()
6317 /*------------------------------------------------------------------*/
6326 struct airo_info *local = dev->ml_priv; in airo_get_mode()
6329 /* If not managed, assume it's ad-hoc */ in airo_get_mode()
6330 switch (local->config.opmode & MODE_CFG_MASK) { in airo_get_mode()
6349 return (index >= 0) && (index <= ai->max_wep_idx); in valid_index()
6352 /*------------------------------------------------------------------*/
6361 struct airo_info *local = dev->ml_priv; in airo_set_encode()
6362 int perm = (dwrq->flags & IW_ENCODE_TEMP ? 0 : 1); in airo_set_encode()
6363 __le16 currentAuthType = local->config.authType; in airo_set_encode()
6366 if (!local->wep_capable) in airo_set_encode()
6367 return -EOPNOTSUPP; in airo_set_encode()
6376 * don't do it. - Jean II */ in airo_set_encode()
6377 if (dwrq->length > 0) { in airo_set_encode()
6379 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in airo_set_encode()
6383 if (dwrq->length > MAX_KEY_SIZE) { in airo_set_encode()
6384 return -EINVAL; in airo_set_encode()
6391 /* Check the index (none -> use current) */ in airo_set_encode()
6396 if (dwrq->length > MIN_KEY_SIZE) in airo_set_encode()
6401 if (!(dwrq->flags & IW_ENCODE_NOKEY)) { in airo_set_encode()
6405 memcpy(key.key, extra, dwrq->length); in airo_set_encode()
6409 airo_print_err(local->dev->name, "failed to set" in airo_set_encode()
6419 (local->config.authType == AUTH_OPEN)) in airo_set_encode()
6423 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in airo_set_encode()
6427 airo_print_err(local->dev->name, "failed to set" in airo_set_encode()
6434 if (!(dwrq->flags & IW_ENCODE_MODE)) in airo_set_encode()
6435 return -EINVAL; in airo_set_encode()
6439 if (dwrq->flags & IW_ENCODE_DISABLED) in airo_set_encode()
6441 if (dwrq->flags & IW_ENCODE_RESTRICTED) in airo_set_encode()
6443 if (dwrq->flags & IW_ENCODE_OPEN) in airo_set_encode()
6446 if (local->config.authType != currentAuthType) in airo_set_encode()
6447 set_bit (FLAG_COMMIT, &local->flags); in airo_set_encode()
6448 return -EINPROGRESS; /* Call commit handler */ in airo_set_encode()
6451 /*------------------------------------------------------------------*/
6460 struct airo_info *local = dev->ml_priv; in airo_get_encode()
6461 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; in airo_get_encode()
6465 if (!local->wep_capable) in airo_get_encode()
6466 return -EOPNOTSUPP; in airo_get_encode()
6471 switch(local->config.authType) { in airo_get_encode()
6473 dwrq->flags = IW_ENCODE_OPEN; in airo_get_encode()
6476 dwrq->flags = IW_ENCODE_RESTRICTED; in airo_get_encode()
6480 dwrq->flags = IW_ENCODE_DISABLED; in airo_get_encode()
6484 dwrq->flags |= IW_ENCODE_NOKEY; in airo_get_encode()
6487 /* Which key do we want ? -1 -> tx index */ in airo_get_encode()
6493 dwrq->flags |= index + 1; in airo_get_encode()
6498 dwrq->length = 0; in airo_get_encode()
6500 dwrq->length = wep_key_len; in airo_get_encode()
6501 memcpy(extra, buf, dwrq->length); in airo_get_encode()
6507 /*------------------------------------------------------------------*/
6516 struct airo_info *local = dev->ml_priv; in airo_set_encodeext()
6517 struct iw_point *encoding = &wrqu->encoding; in airo_set_encodeext()
6519 int perm = (encoding->flags & IW_ENCODE_TEMP ? 0 : 1); in airo_set_encodeext()
6520 __le16 currentAuthType = local->config.authType; in airo_set_encodeext()
6521 int idx, key_len, alg = ext->alg, set_key = 1, rc; in airo_set_encodeext()
6524 if (!local->wep_capable) in airo_set_encodeext()
6525 return -EOPNOTSUPP; in airo_set_encodeext()
6530 idx = encoding->flags & IW_ENCODE_INDEX; in airo_set_encodeext()
6532 if (!valid_index(local, idx - 1)) in airo_set_encodeext()
6533 return -EINVAL; in airo_set_encodeext()
6534 idx--; in airo_set_encodeext()
6541 if (encoding->flags & IW_ENCODE_DISABLED) in airo_set_encodeext()
6544 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { in airo_set_encodeext()
6550 airo_print_err(local->dev->name, "failed to set " in airo_set_encodeext()
6555 set_key = ext->key_len > 0 ? 1 : 0; in airo_set_encodeext()
6566 if (ext->key_len > MIN_KEY_SIZE) { in airo_set_encodeext()
6568 } else if (ext->key_len > 0) { in airo_set_encodeext()
6571 return -EINVAL; in airo_set_encodeext()
6573 key_len = min (ext->key_len, key.len); in airo_set_encodeext()
6574 memcpy(key.key, ext->key, key_len); in airo_set_encodeext()
6577 return -EINVAL; in airo_set_encodeext()
6582 airo_print_err(local->dev->name, in airo_set_encodeext()
6590 airo_print_err(local->dev->name, in airo_set_encodeext()
6599 if (encoding->flags & IW_ENCODE_DISABLED) in airo_set_encodeext()
6601 if (encoding->flags & IW_ENCODE_RESTRICTED) in airo_set_encodeext()
6603 if (encoding->flags & IW_ENCODE_OPEN) in airo_set_encodeext()
6606 if (local->config.authType != currentAuthType) in airo_set_encodeext()
6607 set_bit (FLAG_COMMIT, &local->flags); in airo_set_encodeext()
6609 return -EINPROGRESS; in airo_set_encodeext()
6613 /*------------------------------------------------------------------*/
6622 struct airo_info *local = dev->ml_priv; in airo_get_encodeext()
6623 struct iw_point *encoding = &wrqu->encoding; in airo_get_encodeext()
6628 if (!local->wep_capable) in airo_get_encodeext()
6629 return -EOPNOTSUPP; in airo_get_encodeext()
6633 max_key_len = encoding->length - sizeof(*ext); in airo_get_encodeext()
6635 return -EINVAL; in airo_get_encodeext()
6637 idx = encoding->flags & IW_ENCODE_INDEX; in airo_get_encodeext()
6639 if (!valid_index(local, idx - 1)) in airo_get_encodeext()
6640 return -EINVAL; in airo_get_encodeext()
6641 idx--; in airo_get_encodeext()
6648 encoding->flags = idx + 1; in airo_get_encodeext()
6652 switch(local->config.authType) { in airo_get_encodeext()
6654 encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; in airo_get_encodeext()
6657 encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; in airo_get_encodeext()
6661 encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED; in airo_get_encodeext()
6665 encoding->flags |= IW_ENCODE_NOKEY; in airo_get_encodeext()
6671 ext->key_len = 0; in airo_get_encodeext()
6673 ext->key_len = wep_key_len; in airo_get_encodeext()
6674 memcpy(extra, buf, ext->key_len); in airo_get_encodeext()
6681 /*------------------------------------------------------------------*/
6689 struct airo_info *local = dev->ml_priv; in airo_set_auth()
6690 struct iw_param *param = &wrqu->param; in airo_set_auth()
6691 __le16 currentAuthType = local->config.authType; in airo_set_auth()
6693 switch (param->flags & IW_AUTH_INDEX) { in airo_set_auth()
6706 if (param->value) { in airo_set_auth()
6715 if (local->config.authType != currentAuthType) in airo_set_auth()
6716 set_bit (FLAG_COMMIT, &local->flags); in airo_set_auth()
6720 if (param->value & IW_AUTH_ALG_SHARED_KEY) { in airo_set_auth()
6722 } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { in airo_set_auth()
6724 * unencrypted mode was requested - so use the in airo_set_auth()
6727 set_auth_type(local, local->last_auth); in airo_set_auth()
6729 return -EINVAL; in airo_set_auth()
6732 if (local->config.authType != currentAuthType) in airo_set_auth()
6733 set_bit (FLAG_COMMIT, &local->flags); in airo_set_auth()
6739 if (param->value > 0) in airo_set_auth()
6740 return -EOPNOTSUPP; in airo_set_auth()
6744 return -EOPNOTSUPP; in airo_set_auth()
6746 return -EINPROGRESS; in airo_set_auth()
6750 /*------------------------------------------------------------------*/
6758 struct airo_info *local = dev->ml_priv; in airo_get_auth()
6759 struct iw_param *param = &wrqu->param; in airo_get_auth()
6760 __le16 currentAuthType = local->config.authType; in airo_get_auth()
6762 switch (param->flags & IW_AUTH_INDEX) { in airo_get_auth()
6767 param->value = 1; in airo_get_auth()
6770 param->value = 0; in airo_get_auth()
6778 param->value = IW_AUTH_ALG_SHARED_KEY; in airo_get_auth()
6782 param->value = IW_AUTH_ALG_OPEN_SYSTEM; in airo_get_auth()
6788 param->value = 0; in airo_get_auth()
6792 return -EOPNOTSUPP; in airo_get_auth()
6798 /*------------------------------------------------------------------*/
6800 * Wireless Handler : set Tx-Power
6807 struct airo_info *local = dev->ml_priv; in airo_set_txpow()
6810 int rc = -EINVAL; in airo_set_txpow()
6811 __le16 v = cpu_to_le16(vwrq->value); in airo_set_txpow()
6815 if (vwrq->disabled) { in airo_set_txpow()
6816 set_bit (FLAG_RADIO_OFF, &local->flags); in airo_set_txpow()
6817 set_bit (FLAG_COMMIT, &local->flags); in airo_set_txpow()
6818 return -EINPROGRESS; /* Call commit handler */ in airo_set_txpow()
6820 if (vwrq->flags != IW_TXPOW_MWATT) { in airo_set_txpow()
6821 return -EINVAL; in airo_set_txpow()
6823 clear_bit (FLAG_RADIO_OFF, &local->flags); in airo_set_txpow()
6827 local->config.txPower = v; in airo_set_txpow()
6828 set_bit (FLAG_COMMIT, &local->flags); in airo_set_txpow()
6829 rc = -EINPROGRESS; /* Call commit handler */ in airo_set_txpow()
6835 /*------------------------------------------------------------------*/
6837 * Wireless Handler : get Tx-Power
6844 struct airo_info *local = dev->ml_priv; in airo_get_txpow()
6847 vwrq->value = le16_to_cpu(local->config.txPower); in airo_get_txpow()
6848 vwrq->fixed = 1; /* No power control */ in airo_get_txpow()
6849 vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags); in airo_get_txpow()
6850 vwrq->flags = IW_TXPOW_MWATT; in airo_get_txpow()
6855 /*------------------------------------------------------------------*/
6864 struct airo_info *local = dev->ml_priv; in airo_set_retry()
6865 int rc = -EINVAL; in airo_set_retry()
6867 if (vwrq->disabled) { in airo_set_retry()
6868 return -EINVAL; in airo_set_retry()
6871 if (vwrq->flags & IW_RETRY_LIMIT) { in airo_set_retry()
6872 __le16 v = cpu_to_le16(vwrq->value); in airo_set_retry()
6873 if (vwrq->flags & IW_RETRY_LONG) in airo_set_retry()
6874 local->config.longRetryLimit = v; in airo_set_retry()
6875 else if (vwrq->flags & IW_RETRY_SHORT) in airo_set_retry()
6876 local->config.shortRetryLimit = v; in airo_set_retry()
6879 local->config.longRetryLimit = v; in airo_set_retry()
6880 local->config.shortRetryLimit = v; in airo_set_retry()
6882 set_bit (FLAG_COMMIT, &local->flags); in airo_set_retry()
6883 rc = -EINPROGRESS; /* Call commit handler */ in airo_set_retry()
6885 if (vwrq->flags & IW_RETRY_LIFETIME) { in airo_set_retry()
6886 local->config.txLifetime = cpu_to_le16(vwrq->value / 1024); in airo_set_retry()
6887 set_bit (FLAG_COMMIT, &local->flags); in airo_set_retry()
6888 rc = -EINPROGRESS; /* Call commit handler */ in airo_set_retry()
6893 /*------------------------------------------------------------------*/
6902 struct airo_info *local = dev->ml_priv; in airo_get_retry()
6904 vwrq->disabled = 0; /* Can't be disabled */ in airo_get_retry()
6908 if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { in airo_get_retry()
6909 vwrq->flags = IW_RETRY_LIFETIME; in airo_get_retry()
6910 vwrq->value = le16_to_cpu(local->config.txLifetime) * 1024; in airo_get_retry()
6911 } else if ((vwrq->flags & IW_RETRY_LONG)) { in airo_get_retry()
6912 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; in airo_get_retry()
6913 vwrq->value = le16_to_cpu(local->config.longRetryLimit); in airo_get_retry()
6915 vwrq->flags = IW_RETRY_LIMIT; in airo_get_retry()
6916 vwrq->value = le16_to_cpu(local->config.shortRetryLimit); in airo_get_retry()
6917 if (local->config.shortRetryLimit != local->config.longRetryLimit) in airo_get_retry()
6918 vwrq->flags |= IW_RETRY_SHORT; in airo_get_retry()
6924 /*------------------------------------------------------------------*/
6933 struct airo_info *local = dev->ml_priv; in airo_get_range()
6941 dwrq->length = sizeof(struct iw_range); in airo_get_range()
6943 range->min_nwid = 0x0000; in airo_get_range()
6944 range->max_nwid = 0x0000; in airo_get_range()
6945 range->num_channels = 14; in airo_get_range()
6950 range->freq[k].i = i + 1; /* List index */ in airo_get_range()
6951 range->freq[k].m = 100000 * in airo_get_range()
6953 range->freq[k++].e = 1; /* Values in MHz -> * 10^5 * 10 */ in airo_get_range()
6955 range->num_frequency = k; in airo_get_range()
6957 range->sensitivity = 65535; in airo_get_range()
6960 if (local->rssi) in airo_get_range()
6961 range->max_qual.qual = 100; /* % */ in airo_get_range()
6963 range->max_qual.qual = airo_get_max_quality(&cap_rid); in airo_get_range()
6964 range->max_qual.level = 0x100 - 120; /* -120 dBm */ in airo_get_range()
6965 range->max_qual.noise = 0x100 - 120; /* -120 dBm */ in airo_get_range()
6967 /* Experimental measurements - boundary 11/5.5 Mb/s */ in airo_get_range()
6968 /* Note : with or without the (local->rssi), results in airo_get_range()
6969 * are somewhat different. - Jean II */ in airo_get_range()
6970 if (local->rssi) { in airo_get_range()
6971 range->avg_qual.qual = 50; /* % */ in airo_get_range()
6972 range->avg_qual.level = 0x100 - 70; /* -70 dBm */ in airo_get_range()
6974 range->avg_qual.qual = airo_get_avg_quality(&cap_rid); in airo_get_range()
6975 range->avg_qual.level = 0x100 - 80; /* -80 dBm */ in airo_get_range()
6977 range->avg_qual.noise = 0x100 - 85; /* -85 dBm */ in airo_get_range()
6980 range->bitrate[i] = cap_rid.supportedRates[i] * 500000; in airo_get_range()
6981 if (range->bitrate[i] == 0) in airo_get_range()
6984 range->num_bitrates = i; in airo_get_range()
6990 range->throughput = 5000 * 1000; in airo_get_range()
6992 range->throughput = 1500 * 1000; in airo_get_range()
6994 range->min_rts = 0; in airo_get_range()
6995 range->max_rts = AIRO_DEF_MTU; in airo_get_range()
6996 range->min_frag = 256; in airo_get_range()
6997 range->max_frag = AIRO_DEF_MTU; in airo_get_range()
7001 range->encoding_size[0] = 5; in airo_get_range()
7004 range->encoding_size[1] = 13; in airo_get_range()
7005 range->num_encoding_sizes = 2; in airo_get_range()
7007 range->num_encoding_sizes = 1; in airo_get_range()
7008 range->max_encoding_tokens = in airo_get_range()
7011 range->num_encoding_sizes = 0; in airo_get_range()
7012 range->max_encoding_tokens = 0; in airo_get_range()
7014 range->min_pmp = 0; in airo_get_range()
7015 range->max_pmp = 5000000; /* 5 secs */ in airo_get_range()
7016 range->min_pmt = 0; in airo_get_range()
7017 range->max_pmt = 65535 * 1024; /* ??? */ in airo_get_range()
7018 range->pmp_flags = IW_POWER_PERIOD; in airo_get_range()
7019 range->pmt_flags = IW_POWER_TIMEOUT; in airo_get_range()
7020 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; in airo_get_range()
7022 /* Transmit Power - values are in mW */ in airo_get_range()
7024 range->txpower[i] = le16_to_cpu(cap_rid.txPowerLevels[i]); in airo_get_range()
7025 if (range->txpower[i] == 0) in airo_get_range()
7028 range->num_txpower = i; in airo_get_range()
7029 range->txpower_capa = IW_TXPOW_MWATT; in airo_get_range()
7030 range->we_version_source = 19; in airo_get_range()
7031 range->we_version_compiled = WIRELESS_EXT; in airo_get_range()
7032 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME; in airo_get_range()
7033 range->retry_flags = IW_RETRY_LIMIT; in airo_get_range()
7034 range->r_time_flags = IW_RETRY_LIFETIME; in airo_get_range()
7035 range->min_retry = 1; in airo_get_range()
7036 range->max_retry = 65535; in airo_get_range()
7037 range->min_r_time = 1024; in airo_get_range()
7038 range->max_r_time = 65535 * 1024; in airo_get_range()
7041 range->event_capa[0] = (IW_EVENT_CAPA_K_0 | in airo_get_range()
7045 range->event_capa[1] = IW_EVENT_CAPA_K_1; in airo_get_range()
7046 range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVTXDROP); in airo_get_range()
7050 /*------------------------------------------------------------------*/
7059 struct airo_info *local = dev->ml_priv; in airo_set_power()
7062 if (vwrq->disabled) { in airo_set_power()
7064 return -EINVAL; in airo_set_power()
7065 local->config.powerSaveMode = POWERSAVE_CAM; in airo_set_power()
7066 local->config.rmode &= ~RXMODE_MASK; in airo_set_power()
7067 local->config.rmode |= RXMODE_BC_MC_ADDR; in airo_set_power()
7068 set_bit (FLAG_COMMIT, &local->flags); in airo_set_power()
7069 return -EINPROGRESS; /* Call commit handler */ in airo_set_power()
7071 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { in airo_set_power()
7072 local->config.fastListenDelay = cpu_to_le16((vwrq->value + 500) / 1024); in airo_set_power()
7073 local->config.powerSaveMode = POWERSAVE_PSPCAM; in airo_set_power()
7074 set_bit (FLAG_COMMIT, &local->flags); in airo_set_power()
7075 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { in airo_set_power()
7076 local->config.fastListenInterval = in airo_set_power()
7077 local->config.listenInterval = in airo_set_power()
7078 cpu_to_le16((vwrq->value + 500) / 1024); in airo_set_power()
7079 local->config.powerSaveMode = POWERSAVE_PSPCAM; in airo_set_power()
7080 set_bit (FLAG_COMMIT, &local->flags); in airo_set_power()
7082 switch (vwrq->flags & IW_POWER_MODE) { in airo_set_power()
7085 return -EINVAL; in airo_set_power()
7086 local->config.rmode &= ~RXMODE_MASK; in airo_set_power()
7087 local->config.rmode |= RXMODE_ADDR; in airo_set_power()
7088 set_bit (FLAG_COMMIT, &local->flags); in airo_set_power()
7092 return -EINVAL; in airo_set_power()
7093 local->config.rmode &= ~RXMODE_MASK; in airo_set_power()
7094 local->config.rmode |= RXMODE_BC_MC_ADDR; in airo_set_power()
7095 set_bit (FLAG_COMMIT, &local->flags); in airo_set_power()
7097 /* This is broken, fixme ;-) */ in airo_set_power()
7100 return -EINVAL; in airo_set_power()
7102 // Note : we may want to factor local->need_commit here in airo_set_power()
7104 return -EINPROGRESS; /* Call commit handler */ in airo_set_power()
7107 /*------------------------------------------------------------------*/
7116 struct airo_info *local = dev->ml_priv; in airo_get_power()
7120 mode = local->config.powerSaveMode; in airo_get_power()
7121 if ((vwrq->disabled = (mode == POWERSAVE_CAM))) in airo_get_power()
7123 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { in airo_get_power()
7124 vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024; in airo_get_power()
7125 vwrq->flags = IW_POWER_TIMEOUT; in airo_get_power()
7127 vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024; in airo_get_power()
7128 vwrq->flags = IW_POWER_PERIOD; in airo_get_power()
7130 if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR) in airo_get_power()
7131 vwrq->flags |= IW_POWER_UNICAST_R; in airo_get_power()
7133 vwrq->flags |= IW_POWER_ALL_R; in airo_get_power()
7138 /*------------------------------------------------------------------*/
7147 struct airo_info *local = dev->ml_priv; in airo_set_sens()
7150 local->config.rssiThreshold = in airo_set_sens()
7151 cpu_to_le16(vwrq->disabled ? RSSI_DEFAULT : vwrq->value); in airo_set_sens()
7152 set_bit (FLAG_COMMIT, &local->flags); in airo_set_sens()
7154 return -EINPROGRESS; /* Call commit handler */ in airo_set_sens()
7157 /*------------------------------------------------------------------*/
7166 struct airo_info *local = dev->ml_priv; in airo_get_sens()
7169 vwrq->value = le16_to_cpu(local->config.rssiThreshold); in airo_get_sens()
7170 vwrq->disabled = (vwrq->value == 0); in airo_get_sens()
7171 vwrq->fixed = 1; in airo_get_sens()
7176 /*------------------------------------------------------------------*/
7186 struct airo_info *local = dev->ml_priv; in airo_get_aplist()
7191 int loseSync = capable(CAP_NET_ADMIN) ? 1: -1; in airo_get_aplist()
7195 return -ENOMEM; in airo_get_aplist()
7205 if (local->rssi) { in airo_get_aplist()
7206 qual[i].level = 0x100 - dBm; in airo_get_aplist()
7207 qual[i].qual = airo_dbm_to_pct(local->rssi, dBm); in airo_get_aplist()
7212 qual[i].level = (dBm + 321) / 2; in airo_get_aplist()
7218 qual[i].noise = local->wstats.qual.noise; in airo_get_aplist()
7245 dwrq->flags = 1; /* Should be define'd */ in airo_get_aplist()
7249 dwrq->length = i; in airo_get_aplist()
7255 /*------------------------------------------------------------------*/
7264 struct airo_info *ai = dev->ml_priv; in airo_set_scan()
7276 if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; in airo_set_scan()
7278 if (down_interruptible(&ai->sem)) in airo_set_scan()
7279 return -ERESTARTSYS; in airo_set_scan()
7283 if (ai->scan_timeout > 0) in airo_set_scan()
7294 ai->scan_timeout = RUN_AT(3*HZ); in airo_set_scan()
7301 up(&ai->sem); in airo_set_scan()
7303 wake_up_interruptible(&ai->thr_wait); in airo_set_scan()
7307 /*------------------------------------------------------------------*/
7310 * format that the Wireless Tools will understand - Jean II
7318 struct airo_info *ai = dev->ml_priv; in airo_translate_scan()
7329 memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); in airo_translate_scan()
7336 iwe.u.data.length = bss->ssidLen; in airo_translate_scan()
7342 &iwe, bss->ssid); in airo_translate_scan()
7346 capabilities = bss->cap; in airo_translate_scan()
7358 iwe.u.freq.m = le16_to_cpu(bss->dsChannel); in airo_translate_scan()
7365 dBm = le16_to_cpu(bss->dBm); in airo_translate_scan()
7369 if (ai->rssi) { in airo_translate_scan()
7370 iwe.u.qual.level = 0x100 - dBm; in airo_translate_scan()
7371 iwe.u.qual.qual = airo_dbm_to_pct(ai->rssi, dBm); in airo_translate_scan()
7376 iwe.u.qual.level = (dBm + 321) / 2; in airo_translate_scan()
7382 iwe.u.qual.noise = ai->wstats.qual.noise; in airo_translate_scan()
7394 &iwe, bss->ssid); in airo_translate_scan()
7397 * more of magic - Jean II */ in airo_translate_scan()
7406 if (bss->rates[i] == 0) in airo_translate_scan()
7409 iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); in airo_translate_scan()
7416 if ((current_val - current_ev) > iwe_stream_lcp_len(info)) in airo_translate_scan()
7423 sprintf(buf, "bcn_int=%d", bss->beaconInterval); in airo_translate_scan()
7431 if (test_bit(FLAG_WPA_CAPABLE, &ai->flags)) { in airo_translate_scan()
7433 u16 length = sizeof (bss->extra.iep); in airo_translate_scan()
7434 u8 *ie = (void *)&bss->extra.iep; in airo_translate_scan()
7444 /* Two zero-length SSID elements in airo_translate_scan()
7457 /* 64 is an arbitrary cut-off */ in airo_translate_scan()
7468 /* 64 is an arbitrary cut-off */ in airo_translate_scan()
7479 length -= 2 + ie[1]; in airo_translate_scan()
7486 /*------------------------------------------------------------------*/
7495 struct airo_info *ai = dev->ml_priv; in airo_get_scan()
7500 /* If a scan is in-progress, return -EAGAIN */ in airo_get_scan()
7501 if (ai->scan_timeout > 0) in airo_get_scan()
7502 return -EAGAIN; in airo_get_scan()
7504 if (down_interruptible(&ai->sem)) in airo_get_scan()
7505 return -EAGAIN; in airo_get_scan()
7507 list_for_each_entry (net, &ai->network_list, list) { in airo_get_scan()
7510 extra + dwrq->length, in airo_get_scan()
7511 &net->bss); in airo_get_scan()
7514 if ((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { in airo_get_scan()
7516 err = -E2BIG; in airo_get_scan()
7522 dwrq->length = (current_ev - extra); in airo_get_scan()
7523 dwrq->flags = 0; /* todo */ in airo_get_scan()
7526 up(&ai->sem); in airo_get_scan()
7530 /*------------------------------------------------------------------*/
7539 struct airo_info *local = dev->ml_priv; in airo_config_commit()
7541 if (!test_bit (FLAG_COMMIT, &local->flags)) in airo_config_commit()
7547 if (test_bit (FLAG_RESET, &local->flags)) { in airo_config_commit()
7551 if (test_bit(FLAG_MPI,&local->flags)) in airo_config_commit()
7552 setup_card(local, dev->dev_addr, 1); in airo_config_commit()
7557 writeAPListRid(local, &local->APList, 1); in airo_config_commit()
7559 if (down_interruptible(&local->sem)) in airo_config_commit()
7560 return -ERESTARTSYS; in airo_config_commit()
7563 if (test_bit (FLAG_RESET, &local->flags)) in airo_config_commit()
7566 up(&local->sem); in airo_config_commit()
7571 /*------------------------------------------------------------------*/
7608 (iw_handler) NULL, /* -- hole -- */
7616 (iw_handler) NULL, /* -- hole -- */
7617 (iw_handler) NULL, /* -- hole -- */
7632 (iw_handler) NULL, /* -- hole -- */
7633 (iw_handler) NULL, /* -- hole -- */
7682 struct airo_info *ai = dev->ml_priv; in airo_ioctl()
7684 if (ai->power.event) in airo_ioctl()
7696 if (copy_from_user(&com, rq->ifr_data, sizeof(com))) in airo_ioctl()
7697 rc = -EFAULT; in airo_ioctl()
7699 rc = -EFAULT; in airo_ioctl()
7712 if (copy_from_user(&com, rq->ifr_data, sizeof(com))) { in airo_ioctl()
7713 rc = -EFAULT; in airo_ioctl()
7721 rc = -EFAULT; in airo_ioctl()
7732 rc = -EINVAL; /* Bad command in ioctl */ in airo_ioctl()
7739 rc = -EOPNOTSUPP; in airo_ioctl()
7749 * o Check if work in Ad-Hoc mode (otherwise, use SPY, as in wvlan_cs)
7761 clear_bit(JOB_WSTATS, &local->jobs); in airo_read_wireless_stats()
7762 if (local->power.event) { in airo_read_wireless_stats()
7763 up(&local->sem); in airo_read_wireless_stats()
7769 up(&local->sem); in airo_read_wireless_stats()
7772 local->wstats.status = le16_to_cpu(status_rid.mode); in airo_read_wireless_stats()
7775 if (local->rssi) { in airo_read_wireless_stats()
7776 local->wstats.qual.level = in airo_read_wireless_stats()
7777 airo_rssi_to_dbm(local->rssi, in airo_read_wireless_stats()
7780 local->wstats.qual.qual = in airo_read_wireless_stats()
7783 local->wstats.qual.level = in airo_read_wireless_stats()
7785 local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid); in airo_read_wireless_stats()
7788 local->wstats.qual.noise = 0x100 - status_rid.noisedBm; in airo_read_wireless_stats()
7789 local->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; in airo_read_wireless_stats()
7791 local->wstats.qual.noise = 0; in airo_read_wireless_stats()
7792 …local->wstats.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID … in airo_read_wireless_stats()
7797 local->wstats.discard.nwid = le32_to_cpu(vals[56]) + in airo_read_wireless_stats()
7800 local->wstats.discard.code = le32_to_cpu(vals[6]);/* RxWepErr */ in airo_read_wireless_stats()
7801 local->wstats.discard.fragment = le32_to_cpu(vals[30]); in airo_read_wireless_stats()
7802 local->wstats.discard.retries = le32_to_cpu(vals[10]); in airo_read_wireless_stats()
7803 local->wstats.discard.misc = le32_to_cpu(vals[1]) + in airo_read_wireless_stats()
7805 local->wstats.miss.beacon = le32_to_cpu(vals[34]); in airo_read_wireless_stats()
7810 struct airo_info *local = dev->ml_priv; in airo_get_wireless_stats()
7812 if (!test_bit(JOB_WSTATS, &local->jobs)) { in airo_get_wireless_stats()
7814 if (down_trylock(&local->sem) != 0) { in airo_get_wireless_stats()
7815 set_bit(JOB_WSTATS, &local->jobs); in airo_get_wireless_stats()
7816 wake_up_interruptible(&local->thr_wait); in airo_get_wireless_stats()
7821 return &local->wstats; in airo_get_wireless_stats()
7836 struct airo_info *ai = dev->ml_priv; in readrids()
7838 if (test_bit(FLAG_FLASHING, &ai->flags)) in readrids()
7839 return -EIO; in readrids()
7841 switch(comp->command) in readrids()
7845 if (test_bit(FLAG_COMMIT, &ai->flags)) { in readrids()
7861 if (copy_to_user(comp->data, &ai->micstats, in readrids()
7862 min((int)comp->len, (int)sizeof(ai->micstats)))) in readrids()
7863 return -EFAULT; in readrids()
7865 case AIRORRID: ridcode = comp->ridnum; break; in readrids()
7867 return -EINVAL; in readrids()
7871 /* Only super-user can read WEP keys */ in readrids()
7873 return -EPERM; in readrids()
7877 return -ENOMEM; in readrids()
7884 len = comp->len; in readrids()
7886 if (copy_to_user(comp->data, iobuf, min(len, (int)RIDSIZE))) { in readrids()
7888 return -EFAULT; in readrids()
7900 struct airo_info *ai = dev->ml_priv; in writerids()
7906 /* Only super-user can write RIDs */ in writerids()
7908 return -EPERM; in writerids()
7910 if (test_bit(FLAG_FLASHING, &ai->flags)) in writerids()
7911 return -EIO; in writerids()
7916 switch(comp->command) in writerids()
7921 case AIROPCFG: ai->config.len = 0; in writerids()
7922 clear_bit(FLAG_COMMIT, &ai->flags); in writerids()
7937 return -EIO; in writerids()
7954 return -ENOMEM; in writerids()
7958 enabled = ai->micstats.enabled; in writerids()
7959 memset(&ai->micstats, 0, sizeof(ai->micstats)); in writerids()
7960 ai->micstats.enabled = enabled; in writerids()
7962 if (copy_to_user(comp->data, iobuf, in writerids()
7963 min((int)comp->len, (int)RIDSIZE))) { in writerids()
7965 return -EFAULT; in writerids()
7971 return -EOPNOTSUPP; /* Blarg! */ in writerids()
7973 if (comp->len > RIDSIZE) in writerids()
7974 return -EINVAL; in writerids()
7977 return -ENOMEM; in writerids()
7979 if (copy_from_user(iobuf, comp->data, comp->len)) { in writerids()
7981 return -EFAULT; in writerids()
7984 if (comp->command == AIROPCFG) { in writerids()
7987 if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) in writerids()
7988 cfg->opmode |= MODE_MIC; in writerids()
7990 if ((cfg->opmode & MODE_CFG_MASK) == MODE_STA_IBSS) in writerids()
7991 set_bit (FLAG_ADHOC, &ai->flags); in writerids()
7993 clear_bit (FLAG_ADHOC, &ai->flags); in writerids()
7996 if ((*writer)(ai, ridcode, iobuf, comp->len, 1)) { in writerids()
7998 return -EIO; in writerids()
8017 /* Only super-user can modify flash */ in flashcard()
8019 return -EPERM; in flashcard()
8021 switch(comp->command) in flashcard()
8024 return cmdreset((struct airo_info *)dev->ml_priv); in flashcard()
8029 return -ENOMEM; in flashcard()
8030 return setflashmode((struct airo_info *)dev->ml_priv); in flashcard()
8033 if (comp->len != sizeof(int)) in flashcard()
8034 return -EINVAL; in flashcard()
8035 if (copy_from_user(&z, comp->data, comp->len)) in flashcard()
8036 return -EFAULT; in flashcard()
8037 return flashgchar((struct airo_info *)dev->ml_priv, z, 8000); in flashcard()
8040 if (comp->len != sizeof(int)) in flashcard()
8041 return -EINVAL; in flashcard()
8042 if (copy_from_user(&z, comp->data, comp->len)) in flashcard()
8043 return -EFAULT; in flashcard()
8044 return flashpchar((struct airo_info *)dev->ml_priv, z, 8000); in flashcard()
8048 return -ENOMEM; in flashcard()
8049 if (comp->len > FLASHSIZE) in flashcard()
8050 return -EINVAL; in flashcard()
8051 if (copy_from_user(AIRO_FLASH(dev), comp->data, comp->len)) in flashcard()
8052 return -EFAULT; in flashcard()
8054 flashputbuf((struct airo_info *)dev->ml_priv); in flashcard()
8058 if (flashrestart((struct airo_info *)dev->ml_priv, dev)) in flashcard()
8059 return -EIO; in flashcard()
8062 return -EINVAL; in flashcard()
8078 airo_print_info(ai->dev->name, "Waitbusy hang before RESET"); in cmdreset()
8079 return -EBUSY; in cmdreset()
8087 airo_print_info(ai->dev->name, "Waitbusy hang AFTER RESET"); in cmdreset()
8088 return -EBUSY; in cmdreset()
8100 set_bit (FLAG_FLASHING, &ai->flags); in setflashmode()
8115 clear_bit (FLAG_FLASHING, &ai->flags); in setflashmode()
8116 airo_print_info(ai->dev->name, "Waitbusy hang after setflash mode"); in setflashmode()
8117 return -EIO; in setflashmode()
8141 waittime -= 50; in flashpchar()
8146 airo_print_info(ai->dev->name, "flash putchar busywait timeout!"); in flashpchar()
8147 return -EBUSY; in flashpchar()
8154 dwelltime -= 50; in flashpchar()
8160 return (echo == byte) ? 0 : -EIO; in flashpchar()
8176 dwelltime -= 10; in flashgchar()
8191 return -EIO; in flashgchar()
8204 if (test_bit(FLAG_MPI,&ai->flags)) in flashputbuf()
8205 memcpy_toio(ai->pciaux + 0x8000, ai->flash, FLASHSIZE); in flashputbuf()
8211 OUT4500(ai, AUXDATA, ai->flash[nwords] & 0xffff); in flashputbuf()
8227 clear_bit (FLAG_FLASHING, &ai->flags); in flashrestart()
8228 if (test_bit(FLAG_MPI, &ai->flags)) { in flashrestart()
8233 status = setup_card(ai, dev->dev_addr, 1); in flashrestart()
8235 if (!test_bit(FLAG_MPI,&ai->flags)) in flashrestart()
8237 ai->fids[i] = transmit_allocate in flashrestart()