📄 if_athvar.h
字号:
/*- * 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: if_athvar.h 1657 2006-06-28 06:45:43Z proski $ *//* * Defintions for the Atheros Wireless LAN controller driver. */#ifndef _DEV_ATH_ATHVAR_H#define _DEV_ATH_ATHVAR_H#include "ah.h"#include "if_athioctl.h"#include "net80211/ieee80211.h" /* XXX for WME_NUM_AC *//* * 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 ATH_WORK_THREAD tq_struct#define ATH_SCHEDULE_TASK(t) schedule_task((t))#define ATH_INIT_SCHED_TASK(t, f, d) do { \ memset((t),0,sizeof(struct tq_struct)); \ (t)->routine = (void (*)(void*)) (f); \ (t)->data=(void *) (d); \} while (0)#define ATH_FLUSH_TASKS flush_scheduled_tasks#else#include <linux/workqueue.h>#define ATH_SCHEDULE_TASK(t) schedule_work((t))#define ATH_INIT_SCHED_TASK(_t, _f, _d) INIT_WORK((_t), (void (*)(void *))(_f), (void *)(_d));#define ATH_WORK_THREAD work_struct#define ATH_FLUSH_TASKS flush_scheduled_work#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#define SET_MODULE_OWNER(dev) do { \ dev->owner = THIS_MODULE; \} while (0)#endif#ifndef SET_NETDEV_DEV#define SET_NETDEV_DEV(ndev, pdev)#endif/* * Macro to expand scalars to 64-bit objects */#define ito64(x) (sizeof(x)==8) ? (((unsigned long long int)(x)) & (0xff)) : \ (sizeof(x)==16) ? (((unsigned long long int)(x)) & 0xffff) : \ ((sizeof(x)==32) ? (((unsigned long long int)(x)) & 0xffffffff): (unsigned long long int)(x))/* * 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_POLL_PERIOD 2 /* 2 seconds */#define ATH_DFS_TEST_RETURN_PERIOD 15 /* 15 seconds */#define ATH_LONG_CALINTERVAL 30 /* 30 seconds between calibrations */#define ATH_SHORT_CALINTERVAL 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 #define ATH_RXBUF 40 /* number of RX buffers */#define ATH_TXBUF 200 /* number of TX buffers */#define ATH_BCBUF 4 /* number of beacon buffers *//* free buffer threshold to restart net dev */#define ATH_TXBUF_FREE_THRESHOLD (ATH_TXBUF / 20) #define TAIL_DROP_COUNT 50 /* maximum number of queued frames allowed *//* * 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 *//* 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 30 /* * 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 Periodicty 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 */#define ATH_MIN_FF_RATE 12000 /* min rate fof ff aggragattion.in Kbps */#define ATH_MIN_FF_RATE 12000 /* min rate fof ff aggragattion.in Kbps */struct ath_buf;typedef STAILQ_HEAD(, ath_buf) ath_bufhead;/* driver-specific node state */struct ath_node { struct ieee80211_node an_node; /* base class */ u_int16_t an_decomp_index; /* decompression mask index */ u_int32_t an_avgrssi; /* average rssi over all rx frames */ u_int8_t an_prevdatarix; /* rate ix of last data frame */ u_int16_t an_minffrate; /* mimum rate in kbps for ff to aggragate */ HAL_NODE_STATS an_halstats; /* rssi statistics used by hal */ struct ath_buf *an_tx_ffbuf[WME_NUM_AC]; /* ff staging area */ ath_bufhead an_uapsd_q; /* U-APSD delivery queue */ int an_uapsd_qdepth; /* U-APSD delivery queue depth */ ath_bufhead an_uapsd_overflowq; /* U-APSD overflow queue (for > MaxSp frames) */ int an_uapsd_overflowqdepth; /* U-APSD overflow queue depth */ spinlock_t an_uapsd_lock; /* U-APSD deleivery queue lock */ /* variable-length rate control state follows */};#define ATH_NODE(_n) ((struct ath_node *)(_n))#define ATH_NODE_CONST(ni) ((const struct ath_node *)(ni))#define ATH_NODE_UAPSD_LOCK_INIT(_an) spin_lock_init(&(_an)->an_uapsd_lock)#define ATH_NODE_UAPSD_LOCK(_an) spin_lock(&(_an)->an_uapsd_lock)#define ATH_NODE_UAPSD_UNLOCK(_an) spin_unlock(&(_an)->an_uapsd_lock)#define ATH_NODE_UAPSD_LOCK_IRQ(_an) do { \ unsigned long __an_uapsd_lockflags; \ spin_lock_irqsave(&(_an)->an_uapsd_lock, __an_uapsd_lockflags);#define ATH_NODE_UAPSD_UNLOCK_IRQ(_an) \ spin_unlock_irqrestore(&(_an)->an_uapsd_lock, __an_uapsd_lockflags); \} while (0)#define ATH_NODE_UAPSD_UNLOCK_IRQ_EARLY(_an) \ spin_unlock_irqrestore(&(_an)->an_uapsd_lock, __an_uapsd_lockflags);#define ATH_RSSI_LPF_LEN 10#define ATH_RSSI_DUMMY_MARKER 0x127#define ATH_EP_MUL(x, mul) ((x) * (mul))#define ATH_RSSI_IN(x) (ATH_EP_MUL((x), HAL_RSSI_EP_MULTIPLIER))#define ATH_LPF_RSSI(x, y, len) \ ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))#define ATH_RSSI_LPF(x, y) do { \ if ((y) >= -20) \ x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \} while (0)#define ATH_ANTENNA_DIFF 2 /* Num frames difference in * tx to flip default recv * antenna */struct ath_buf { /* FFXXX: convert both list types to TAILQ to save a field? */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -