if_athvar.h

来自「madwifi上的atheros无线网卡驱动源码」· C头文件 代码 · 共 1,040 行 · 第 1/3 页

H
1,040
字号
/*- * 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 3352 2008-02-12 06:05:28Z mrenzmann $ *//* * Defintions for the Atheros Wireless LAN controller driver. */#ifndef _DEV_ATH_ATHVAR_H#define _DEV_ATH_ATHVAR_H#include "ah.h"#include "ah_os.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 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#ifndef	NETDEV_TX_OK#define	NETDEV_TX_OK	0#define	NETDEV_TX_BUSY	1#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 *) kmalloc (alloc_size, GFP_KERNEL);	if (dev == NULL)	{		printk(KERN_ERR "alloc_dev: Unable to allocate device memory.\n");		return NULL;	}	memset(dev, 0, alloc_size);	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/* * 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_MAXVAPS_MIN 	2	/* minimum number of beacon buffers */#define ATH_MAXVAPS_MAX 	64	/* maximum number of beacon buffers */#define ATH_MAXVAPS_DEFAULT 	4	/* default 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 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 */#define	ATH_MIN_FF_RATE	12000		/* min rate for ff aggregation in kbps */#define	ATH_MIN_FF_RATE	12000		/* min rate for ff aggregation 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;			/* min rate in kbps for ff to aggregate */	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 delivery queue lock */	/* variable-length rate control state follows */};#define	ATH_NODE(_n)			((struct ath_node *)(_n))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?