/***************************************************************************
* ORiNOCO PCMCIA device driver for Linux (MWVLAN_CS)
* Copyright (c) 2001 By Moustafa A. Youssef (moustafa@cs.umd.edu)
* MIND Lab
* http://www.cs.umd.edu/users/moustafa/mwvlan/mwvlan.html
*
* Please send comments/bugfixes/patches to the above address.
*
* The driver supports all open source driver wvlan_cs plus:
* - Provide all the information available from the Lucent Client
* Manager for Windows (e.g. Signal Level, Noise Level, ...)
* from all access points using active scanning- see IEEE802.11 standard.)
* - The driver implements the 'iwspy' option 'ap' which returns
* the list of access points reached from the card.
* - Added 'iwpriv' command to enable/disable automatic active scanning.
* - Added 'iwpriv' command to do issue an active scanning command.
* - There is a general API that can interface with the driver to get
* this information to user applications (www.cs.umd.edu/users/moustafa/mapi).
*
*---------------------------------------------------------------------------
* MWVLAN_CS License agreement:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ALTERNATIVELY, this driver may be distributed under the terms of
* the following license, in which case the provisions of this license
* are required INSTEAD OF the GNU General Public License. (This clause
* is necessary due to a potential bad interaction between the GPL and
* the restrictions contained in a BSD-style copyright.)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*---------------------------------------------------------------------------
*___________________________________________________________________________
* This driver is based on the open source driver wvlan_cs:
*
* WaveLAN/IEEE PCMCIA Linux network device driver
*
* by Andreas Neuhaus <andy@fasta.fh-dortmund.de>
* http://www.fasta.fh-dortmund.de/users/andy/wvlan/
*
* This driver is free software; you can redistribute and/or
* modify it under the terms of the GNU General Public License;
* either version 2 of the license, or (at your option) any
* later version.
* Please send comments/bugfixes/patches to the above address.
*
* Based on the Linux PCMCIA Programmer's Guide
* and Lucent Technologies' HCF-Light library (wvlan47).
*
* See 'man 4 wvlan_cs' for more information.
*
* TODO
* We should use multiple Tx buffers to gain performance.
* Have a closer look to the endianess (PPC problems).
*
* HISTORY
* v1.0.7 11/01/2000 - Jean II and Anton Blanchard
* Dont hold spinlock during copy_{to,from}_user, we might
* sleep. (brought to my attention by Dave Gibson)
* New Ad-Hoc mode accepts ESSID=any (Jean II)
* Support new wireless extension - Transmit Power (Jean II)
* Added support for 3.3V cards, fixed IPv6 (David)
*
* v1.0.6 7/12/2000 - David Hinds, Anton Blanchard, Jean II and others
* Endianess fix for PPC users, first try (David)
* Fix some ranges (power management, key size, ...) (me)
* Auto rate up to a maximum (for ex. up to 5.5) (me)
* Remove error on IW_ENCODE_RESTRICTED (me)
* Better error messages to catch stupid users (me)
* ---
* Oups ! Firmware 6.06 *do* support port3 (me)
* Oups ! ibss mode is not fully functional in firmware 6.04 (me)
* Match Windows driver for selecting Ad-Hoc mode (me)
* Get MAC address earlier, so that if module parameters are
* invalid, we can still use wireless.opts... (me)
* Use ethX and not wvlanX by default (me)
* Minimal support for some PrismII cards (me)
* Check out of bound in getratelist (Paul Mackerras)
* Finish up the endianess fix for PPC and test it
* (Paul Mackerras and Hugh Blemings)
* Check Cabletron Firmware 4.32 support (Anton)
*
* v1.0.5 19/10/2000 - David Hinds, Jean II and others
* Support for 6.00 firmware (remove fragmentation - ? + me)
* Add Microwave Oven Robustness support (me)
* Fix a bug preventing RARP from working (?)
* ---
* Fix SMP support (fix all those spinlocks - me)
* Add IBSS support, to enable 802.11 ad-hoc mode (Ross Finlayson)
* Integrate IBSS support with Wireless Extensions (me)
* Clean-up Wireless Extensions (#define and other stuff - me)
* Multi-card support for Wireless Extensions (me)
* Firmware madness support - Arghhhhh !!!!!! (me)
* ---
* Proper firmware detection routines (me)
* Aggregate configuration change when closed (me)
* wireless.opts now works on old firmware (me)
* Integrate MWO robust to frag setting (me)
* copy_to/from in ioctl with irq on (me, requested by Alan)
* Add a few "static" and "inline" there and there (me)
* Update to new module init/cleanup procedures (me)
*
* v1.0.4 2000/02/26
* Some changes to fit into kernel 2.3.x.
* Some changes to better fit into the new net API.
* Use of spinlocks for disabling interrupts.
* Conditional to allow ignoring tx timeouts.
* Disable interrupts during config/shutdown/reset.
* Credits go to Jean Tourrilhes for all the following:
* Promiscuous mode (tcpdump now work correctly).
* Set multicast Rx list (RTP now work correctly).
* Hook up watchdog timer in new net API.
* Update frag/rts to new W-Ext.
* Operating mode support + W-Ext (Neat...).
* Power Saving support + W-Ext (useless...).
* WEP (Privacy - Silver+Gold) support + W-Ext (yeah !!!).
* Disable interupts during reading wireless stats.
* (New quality indicator not included, need more work)
* Plus a few cleanups, comments and fixes...
*
* v1.0.3 Skipped to not confuse with kernel 2.3.x driver
*
* v1.0.2 2000/01/07
* Merged driver into the PCMCIA Card Services package
* (thanks to David Hinds).
* Removed README, added man page (man 4 wvlan_cs).
*
* v1.0.1 1999/09/02
* Interrupts are now disabled during ioctl to prevent being
* disturbed during our fiddling with the NIC (occurred
* when using wireless tools while heavy loaded link).
* Fixed a problem with more than 6 spy addresses (thanks to
* Thomas Ekstrom).
* Hopefully fixed problems with bigger packet sizes than 1500.
* When you changed parameters that were specified a