/drivers/net/wireless/ipw2x00/ipw2100.h
C++ Header | 1165 lines | 877 code | 185 blank | 103 comment | 10 complexity | f69c1456c1bcd86f54e7fd9ae785b52e MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
- /******************************************************************************
- Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
- This program is free software; you can redistribute it and/or modify it
- under the terms of version 2 of the GNU General Public License as
- published by the Free Software Foundation.
- 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.
- You should have received a copy of the GNU General Public License along with
- this program; if not, write to the Free Software Foundation, Inc., 59
- Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- The full GNU General Public License is included in this distribution in the
- file called LICENSE.
- Contact Information:
- Intel Linux Wireless <ilw@linux.intel.com>
- Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- ******************************************************************************/
- #ifndef _IPW2100_H
- #define _IPW2100_H
- #include <linux/sched.h>
- #include <linux/interrupt.h>
- #include <linux/netdevice.h>
- #include <linux/etherdevice.h>
- #include <linux/list.h>
- #include <linux/delay.h>
- #include <linux/skbuff.h>
- #include <asm/io.h>
- #include <linux/socket.h>
- #include <linux/if_arp.h>
- #include <linux/wireless.h>
- #include <net/iw_handler.h> // new driver API
- #ifdef CONFIG_IPW2100_MONITOR
- #include <net/ieee80211_radiotap.h>
- #endif
- #include <linux/workqueue.h>
- #include <linux/mutex.h>
- #include "libipw.h"
- struct ipw2100_priv;
- struct ipw2100_tx_packet;
- struct ipw2100_rx_packet;
- #define IPW_DL_UNINIT 0x80000000
- #define IPW_DL_NONE 0x00000000
- #define IPW_DL_ALL 0x7FFFFFFF
- /*
- * To use the debug system;
- *
- * If you are defining a new debug classification, simply add it to the #define
- * list here in the form of:
- *
- * #define IPW_DL_xxxx VALUE
- *
- * shifting value to the left one bit from the previous entry. xxxx should be
- * the name of the classification (for example, WEP)
- *
- * You then need to either add a IPW2100_xxxx_DEBUG() macro definition for your
- * classification, or use IPW_DEBUG(IPW_DL_xxxx, ...) whenever you want
- * to send output to that classification.
- *
- * To add your debug level to the list of levels seen when you perform
- *
- * % cat /proc/net/ipw2100/debug_level
- *
- * you simply need to add your entry to the ipw2100_debug_levels array.
- *
- * If you do not see debug_level in /proc/net/ipw2100 then you do not have
- * CONFIG_IPW2100_DEBUG defined in your kernel configuration
- *
- */
- #define IPW_DL_ERROR (1<<0)
- #define IPW_DL_WARNING (1<<1)
- #define IPW_DL_INFO (1<<2)
- #define IPW_DL_WX (1<<3)
- #define IPW_DL_HC (1<<5)
- #define IPW_DL_STATE (1<<6)
- #define IPW_DL_NOTIF (1<<10)
- #define IPW_DL_SCAN (1<<11)
- #define IPW_DL_ASSOC (1<<12)
- #define IPW_DL_DROP (1<<13)
- #define IPW_DL_IOCTL (1<<14)
- #define IPW_DL_RF_KILL (1<<17)
- #define IPW_DL_MANAGE (1<<15)
- #define IPW_DL_FW (1<<16)
- #define IPW_DL_FRAG (1<<21)
- #define IPW_DL_WEP (1<<22)
- #define IPW_DL_TX (1<<23)
- #define IPW_DL_RX (1<<24)
- #define IPW_DL_ISR (1<<25)
- #define IPW_DL_IO (1<<26)
- #define IPW_DL_TRACE (1<<28)
- #define IPW_DEBUG_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
- #define IPW_DEBUG_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
- #define IPW_DEBUG_INFO(f...) IPW_DEBUG(IPW_DL_INFO, ## f)
- #define IPW_DEBUG_WX(f...) IPW_DEBUG(IPW_DL_WX, ## f)
- #define IPW_DEBUG_SCAN(f...) IPW_DEBUG(IPW_DL_SCAN, ## f)
- #define IPW_DEBUG_NOTIF(f...) IPW_DEBUG(IPW_DL_NOTIF, ## f)
- #define IPW_DEBUG_TRACE(f...) IPW_DEBUG(IPW_DL_TRACE, ## f)
- #define IPW_DEBUG_RX(f...) IPW_DEBUG(IPW_DL_RX, ## f)
- #define IPW_DEBUG_TX(f...) IPW_DEBUG(IPW_DL_TX, ## f)
- #define IPW_DEBUG_ISR(f...) IPW_DEBUG(IPW_DL_ISR, ## f)
- #define IPW_DEBUG_MANAGEMENT(f...) IPW_DEBUG(IPW_DL_MANAGE, ## f)
- #define IPW_DEBUG_WEP(f...) IPW_DEBUG(IPW_DL_WEP, ## f)
- #define IPW_DEBUG_HC(f...) IPW_DEBUG(IPW_DL_HC, ## f)
- #define IPW_DEBUG_FRAG(f...) IPW_DEBUG(IPW_DL_FRAG, ## f)
- #define IPW_DEBUG_FW(f...) IPW_DEBUG(IPW_DL_FW, ## f)
- #define IPW_DEBUG_RF_KILL(f...) IPW_DEBUG(IPW_DL_RF_KILL, ## f)
- #define IPW_DEBUG_DROP(f...) IPW_DEBUG(IPW_DL_DROP, ## f)
- #define IPW_DEBUG_IO(f...) IPW_DEBUG(IPW_DL_IO, ## f)
- #define IPW_DEBUG_IOCTL(f...) IPW_DEBUG(IPW_DL_IOCTL, ## f)
- #define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)
- #define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)
- enum {
- IPW_HW_STATE_DISABLED = 1,
- IPW_HW_STATE_ENABLED = 0
- };
- struct ssid_context {
- char ssid[IW_ESSID_MAX_SIZE + 1];
- int ssid_len;
- unsigned char bssid[ETH_ALEN];
- int port_type;
- int channel;
- };
- extern const char *port_type_str[];
- extern const char *band_str[];
- #define NUMBER_OF_BD_PER_COMMAND_PACKET 1
- #define NUMBER_OF_BD_PER_DATA_PACKET 2
- #define IPW_MAX_BDS 6
- #define NUMBER_OF_OVERHEAD_BDS_PER_PACKETR 2
- #define NUMBER_OF_BDS_TO_LEAVE_FOR_COMMANDS 1
- #define REQUIRED_SPACE_IN_RING_FOR_COMMAND_PACKET \
- (IPW_BD_QUEUE_W_R_MIN_SPARE + NUMBER_OF_BD_PER_COMMAND_PACKET)
- struct bd_status {
- union {
- struct {
- u8 nlf:1, txType:2, intEnabled:1, reserved:4;
- } fields;
- u8 field;
- } info;
- } __packed;
- struct ipw2100_bd {
- u32 host_addr;
- u32 buf_length;
- struct bd_status status;
- /* number of fragments for frame (should be set only for
- * 1st TBD) */
- u8 num_fragments;
- u8 reserved[6];
- } __packed;
- #define IPW_BD_QUEUE_LENGTH(n) (1<<n)
- #define IPW_BD_ALIGNMENT(L) (L*sizeof(struct ipw2100_bd))
- #define IPW_BD_STATUS_TX_FRAME_802_3 0x00
- #define IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT 0x01
- #define IPW_BD_STATUS_TX_FRAME_COMMAND 0x02
- #define IPW_BD_STATUS_TX_FRAME_802_11 0x04
- #define IPW_BD_STATUS_TX_INTERRUPT_ENABLE 0x08
- struct ipw2100_bd_queue {
- /* driver (virtual) pointer to queue */
- struct ipw2100_bd *drv;
- /* firmware (physical) pointer to queue */
- dma_addr_t nic;
- /* Length of phy memory allocated for BDs */
- u32 size;
- /* Number of BDs in queue (and in array) */
- u32 entries;
- /* Number of available BDs (invalid for NIC BDs) */
- u32 available;
- /* Offset of oldest used BD in array (next one to
- * check for completion) */
- u32 oldest;
- /* Offset of next available (unused) BD */
- u32 next;
- };
- #define RX_QUEUE_LENGTH 256
- #define TX_QUEUE_LENGTH 256
- #define HW_QUEUE_LENGTH 256
- #define TX_PENDED_QUEUE_LENGTH (TX_QUEUE_LENGTH / NUMBER_OF_BD_PER_DATA_PACKET)
- #define STATUS_TYPE_MASK 0x0000000f
- #define COMMAND_STATUS_VAL 0
- #define STATUS_CHANGE_VAL 1
- #define P80211_DATA_VAL 2
- #define P8023_DATA_VAL 3
- #define HOST_NOTIFICATION_VAL 4
- #define IPW2100_RSSI_TO_DBM (-98)
- struct ipw2100_status {
- u32 frame_size;
- u16 status_fields;
- u8 flags;
- #define IPW_STATUS_FLAG_DECRYPTED (1<<0)
- #define IPW_STATUS_FLAG_WEP_ENCRYPTED (1<<1)
- #define IPW_STATUS_FLAG_CRC_ERROR (1<<2)
- u8 rssi;
- } __packed;
- struct ipw2100_status_queue {
- /* driver (virtual) pointer to queue */
- struct ipw2100_status *drv;
- /* firmware (physical) pointer to queue */
- dma_addr_t nic;
- /* Length of phy memory allocated for BDs */
- u32 size;
- };