📄 if_athvar.h.svn-base
字号:
/*- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * All rights reserved. * * 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, this list of conditions and the following disclaimer, without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any * redistribution must be conditioned upon including a substantially * similar Disclaimer requirement for further binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names * of any contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. * * $Id$ *//* * Definitions for the Atheros Wireless LAN controller driver. */#ifndef _DEV_ATH_ATHVAR_H#define _DEV_ATH_ATHVAR_H#include "ah.h"#include "ah_desc.h"#include "ah_os.h"#include "if_athioctl.h"#include <net80211/ieee80211.h> /* XXX for WME_NUM_AC */#include <sys/queue.h>#include <asm/io.h>#include <linux/list.h>#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)# include <asm/bitops.h>#endif/* * Deduce if tasklets are available. If not then * fall back to using the immediate work queue. */#include <linux/interrupt.h>#ifdef DECLARE_TASKLET /* native tasklets */#define ATH_TQ_STRUCT tasklet_struct#define ATH_INIT_TQUEUE(a,b,c) tasklet_init((a), (b), (unsigned long)(c))#define ATH_SCHEDULE_TQUEUE(a,b) tasklet_schedule((a))typedef unsigned long TQUEUE_ARG;#define mark_bh(a) do {} while (0)#else /* immediate work queue */#define ATH_TQ_STRUCT tq_struct#define ATH_INIT_TQUEUE(a,b,c) INIT_TQUEUE(a,b,c)#define ATH_SCHEDULE_TQUEUE(a,b) do { \ *(b) |= queue_task((a), &tq_immediate); \} while (0)typedef void *TQUEUE_ARG;#define tasklet_disable(t) do { (void) t; local_bh_disable(); } while (0)#define tasklet_enable(t) do { (void) t; local_bh_enable(); } while (0)#endif /* !DECLARE_TASKLET */#include <linux/sched.h>#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)#include <linux/tqueue.h>#define work_struct tq_struct#define schedule_work(t) schedule_task((t))#define flush_scheduled_work() flush_scheduled_tasks()#define ATH_INIT_WORK(t, f) do { \ memset((t), 0, sizeof(struct tq_struct)); \ (t)->routine = (void (*)(void *)) (f); \ (t)->data = (void *)(t); \} while (0)#else#include <linux/workqueue.h>#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (void (*)(void *))(_f), (_t));#else#define ATH_INIT_WORK(_t, _f) INIT_WORK((_t), (_f));#endif#endif /* KERNEL_VERSION < 2.5.41 *//* * Guess how the interrupt handler should work. */#if !defined(IRQ_NONE)typedef void irqreturn_t;#define IRQ_NONE#define IRQ_HANDLED#endif /* !defined(IRQ_NONE) */#ifndef SET_MODULE_OWNER#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)#define SET_MODULE_OWNER(dev) do { \ dev->owner = THIS_MODULE; \} while (0)#else#define SET_MODULE_OWNER(dev) do { } while (0)#endif#endif#ifndef SET_NETDEV_DEV#define SET_NETDEV_DEV(ndev, pdev)#endif#ifdef to_net_dev#define ATH_GET_NETDEV_DEV(ndev) ((ndev)->dev.parent)#else#define ATH_GET_NETDEV_DEV(ndev) ((ndev)->class_dev.dev)#endif#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)static inline struct net_device *_alloc_netdev(int sizeof_priv, const char *mask, void (*setup)(struct net_device *)){ struct net_device *dev; int alloc_size; /* ensure 32-byte alignment of the private area */ alloc_size = sizeof (*dev) + sizeof_priv + 31; dev = (struct net_device *)kzalloc(alloc_size, GFP_KERNEL); if (dev == NULL) { printk(KERN_ERR "alloc_dev: Unable to allocate device memory.\n"); return NULL; } if (sizeof_priv) dev->priv = (void *)(((long)(dev + 1) + 31) & ~31); setup(dev); strcpy(dev->name, mask); return dev;}/* Avoid name collision - some vendor kernels backport alloc_netdev() */#undef alloc_netdev#define alloc_netdev(s,m,d) _alloc_netdev(s, m, d)/* Some vendors backport PDE, so make it a macro here */#undef PDE#define PDE(inode) ((struct proc_dir_entry *)(inode)->u.generic_ip)#endif/* * Deal with the sysctl handler api changing. */#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)#define ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ f(ctl_table *ctl, int write, struct file *filp, \ void __user *buffer, size_t *lenp)#define ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ proc_dointvec(ctl, write, filp, buffer, lenp)#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) */#define ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ f(ctl_table *ctl, int write, struct file *filp, \ void __user *buffer, size_t *lenp, loff_t *ppos)#define ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ proc_dointvec(ctl, write, filp, buffer, lenp, ppos)#endif#define ATH_TIMEOUT 1000#define ATH_DFS_WAIT_MIN_PERIOD 60 /* DFS wait is 60 seconds, per * FCC/ETSI regulations. */#define ATH_DFS_WAIT_SHORT_POLL_PERIOD 2 /* 2 seconds, for consecutive * waits if not done yet. */#define ATH_DFS_AVOID_MIN_PERIOD 1800 /* 30 minutes, per FCC/ETSI * regulations */#define ATH_DFS_TEST_RETURN_PERIOD 15 /* 15 seconds -- for mute test * only */#define ATH_LONG_CALINTERVAL_SECS 30 /* 30 seconds between calibrations */#define ATH_SHORT_CALINTERVAL_SECS 1 /* 1 second between calibrations *//* * Maximum acceptable MTU * MAXFRAMEBODY - WEP - QOS - RSN/WPA: * 2312 - 8 - 2 - 12 = 2290 */#define ATH_MAX_MTU 2290#define ATH_MIN_MTU 32/* number of RX buffers */#define ATH_RXBUF 100/* number of TX buffers */#define ATH_TXBUF 300/* minimum number of beacon buffers */#define ATH_MAXVAPS_MIN 2/* maximum number of beacon buffers */#define ATH_MAXVAPS_MAX 64/* default number of beacon buffers */#define ATH_MAXVAPS_DEFAULT 4/* number of TX buffers reserved for mgt frames */#define ATH_TXBUF_MGT_RESERVED 20/* maximum number of queued frames allowed per WME queue */#define ATH_QUEUE_DROP_COUNT 150/* * dynamic turbo specific macros. */#define ATH_TURBO_UP_THRESH 750000 /* bytes/sec */#define ATH_TURBO_DN_THRESH 1000000 /* bytes/sec */#define ATH_TURBO_PERIOD_HOLD 1 /* in seconds *//* * The only case where we see skbuff chains is due to FF aggregation in * the driver. */#ifdef ATH_SUPERG_FF#define ATH_TXDESC 2 /* number of descriptors per buffer */#else#define ATH_TXDESC 1 /* number of descriptors per buffer */#endif#define ATH_TXMAXTRY 11 /* max number of transmit attempts *//* Compress settings */#define ATH_COMP_THRESHOLD 256 /* no compression for frames longer than this threshold */#define ATH_COMP_PROC_NO_COMP_NO_CCS 3#define ATH_COMP_PROC_NO_COMP_ADD_CCS 2#define ATH_COMP_PROC_COMP_NO_OPTIAML 1#define ATH_COMP_PROC_COMP_OPTIMAL 0#define ATH_DEFAULT_COMP_PROC ATH_COMP_PROC_COMP_OPTIMAL#define INVALID_DECOMP_INDEX 0xFFFF#define WEP_IV_FIELD_SIZE 4 /* wep IV field size */#define WEP_ICV_FIELD_SIZE 4 /* wep ICV field size */#define AES_ICV_FIELD_SIZE 8 /* AES ICV field size */#define EXT_IV_FIELD_SIZE 4 /* ext IV field size *//* This is what the HAL uses by default for 11a+g */#define ATH_DEFAULT_CWMIN 15#define ATH_DEFAULT_CWMAX 1023/* XR specific macros */#define XR_DEFAULT_GRPPOLL_RATE_STR "0.25 1 1 3 3 6 6 20"#define GRPPOLL_RATE_STR_LEN 64#define XR_SLOT_DELAY 30 /* in usec */#define XR_AIFS 0#define XR_NUM_RATES 5#define XR_NUM_SUP_RATES 8/* XR uplink should have same cwmin/cwmax value */#define XR_CWMIN_CWMAX 7#define XR_DATA_AIFS 3#define XR_DATA_CWMIN 31#define XR_DATA_CWMAX 1023/* pick the threshold so that we meet most of the regulatory constraints */#define XR_FRAGMENTATION_THRESHOLD 540#define XR_TELEC_FRAGMENTATION_THRESHOLD 442#define XR_MAX_GRP_POLL_PERIOD 1000 /* Maximum Group Poll Periodicity */#define XR_DEFAULT_POLL_INTERVAL 100#define XR_MIN_POLL_INTERVAL 30#define XR_MAX_POLL_INTERVAL 1000#define XR_DEFAULT_POLL_COUNT 32#define XR_MIN_POLL_COUNT 16#define XR_MAX_POLL_COUNT 64#define XR_POLL_UPDATE_PERIOD 10 /* number of XR beacons */#define XR_GRPPOLL_PERIOD_FACTOR 5 /* factor used in calculating grp poll interval */#define XR_4MS_FRAG_THRESHOLD 128 /* fragmentation threshold for 4msec frame limit *//* * Maximum Values in ms for group poll periodicty */#define GRP_POLL_PERIOD_NO_XR_STA_MAX 100#define GRP_POLL_PERIOD_XR_STA_MAX 30enum { CCA_BG = 15, CCA_A = 4, CCA_PUREG = 4, /* pure G */}; /* * Percentage of the configured poll periodicity */#define GRP_POLL_PERIOD_FACTOR_XR_STA 30 /* When XR Stations associated freq is 30% higher */#define A_MAX(a,b) ((a) > (b) ? (a) : (b))/* * Macros to obtain the Group Poll Periodicity in various situations * * Curerntly there are the two cases * (a) When there are no XR STAs associated * (b) When there is atleast one XR STA associated */#define GRP_POLL_PERIOD_NO_XR_STA(sc) (sc->sc_xrpollint)#define GRP_POLL_PERIOD_XR_STA(sc) \ A_MAX(GRP_POLL_PERIOD_FACTOR_XR_STA * (sc->sc_xrpollint / 100), GRP_POLL_PERIOD_XR_STA_MAX)/* * When there are no XR STAs and a valid double chirp is received then the Group Polls are * transmitted for 10 seconds from the time of the last valid double double-chirp */#define NO_XR_STA_GRPPOLL_TX_DUR 10000/* * The key cache is used for h/w cipher state and also for * tracking station state such as the current tx antenna. * We also setup a mapping table between key cache slot indices * and station state to short-circuit node lookups on rx. * Different parts have different size key caches. We handle * up to ATH_KEYMAX entries (could dynamically allocate state). */#define ATH_KEYMAX 128 /* max key cache size we handle */#define ATH_KEYBYTES (ATH_KEYMAX / NBBY) /* storage space in bytes */#ifdef ATH_REVERSE_ENGINEERING#define MIN_REGISTER_ADDRESS 0x0000 /* PCI register addresses are taken as releative to the appropriate BAR */#define MAX_REGISTER_ADDRESS 0xc000 /* AR5212/AR5213 seems to have a 48k address range */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -