xref: /illumos-gate/usr/src/uts/common/io/ath/ath_impl.h (revision 129d67ac)
17a1306a7Sxc /*
23caf1114Sxc  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
37a1306a7Sxc  * Use is subject to license terms.
47a1306a7Sxc  */
57a1306a7Sxc 
67a1306a7Sxc /*
77a1306a7Sxc  * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
87a1306a7Sxc  * All rights reserved.
97a1306a7Sxc  *
107a1306a7Sxc  * Redistribution and use in source and binary forms, with or without
117a1306a7Sxc  * modification, are permitted provided that the following conditions
127a1306a7Sxc  * are met:
137a1306a7Sxc  * 1. Redistributions of source code must retain the above copyright
147a1306a7Sxc  *    notice, this list of conditions and the following disclaimer,
157a1306a7Sxc  *    without modification.
167a1306a7Sxc  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
177a1306a7Sxc  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
187a1306a7Sxc  *    redistribution must be conditioned upon including a substantially
197a1306a7Sxc  *    similar Disclaimer requirement for further binary redistribution.
207a1306a7Sxc  * 3. Neither the names of the above-listed copyright holders nor the names
217a1306a7Sxc  *    of any contributors may be used to endorse or promote products derived
227a1306a7Sxc  *    from this software without specific prior written permission.
237a1306a7Sxc  *
247a1306a7Sxc  * NO WARRANTY
257a1306a7Sxc  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
267a1306a7Sxc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
277a1306a7Sxc  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
287a1306a7Sxc  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
297a1306a7Sxc  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
307a1306a7Sxc  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
317a1306a7Sxc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
327a1306a7Sxc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
337a1306a7Sxc  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
347a1306a7Sxc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
357a1306a7Sxc  * THE POSSIBILITY OF SUCH DAMAGES.
367a1306a7Sxc  *
377a1306a7Sxc  */
387a1306a7Sxc 
397a1306a7Sxc /*
407a1306a7Sxc  * ath_impl.h is a bridge between the HAL and the driver. It
417a1306a7Sxc  * defines some data structures encapsulating the HAL interface
427a1306a7Sxc  * and communicating with the IEEE80211 MAC layer and other
437a1306a7Sxc  * driver components.
447a1306a7Sxc  */
457a1306a7Sxc 
467a1306a7Sxc #ifndef	_ATH_IMPL_H
477a1306a7Sxc #define	_ATH_IMPL_H
487a1306a7Sxc 
497a1306a7Sxc #ifdef __cplusplus
507a1306a7Sxc extern "C" {
517a1306a7Sxc #endif
527a1306a7Sxc 
537a1306a7Sxc /*
547a1306a7Sxc  * Defintions for the Atheros Wireless LAN controller driver.
557a1306a7Sxc  */
567a1306a7Sxc 
570ba2cbe9Sxc #include <sys/note.h>
587a1306a7Sxc #include <sys/list.h>
590ba2cbe9Sxc #include <sys/net80211.h>
607a1306a7Sxc #include "ath_hal.h"
617a1306a7Sxc 
62a399b765Szf /* Bit map related macros. */
63a399b765Szf #define	setbit(a, i)		((a)[(i)/NBBY] |= (1 << ((i)%NBBY)))
64a399b765Szf #define	clrbit(a, i)		((a)[(i)/NBBY] &= ~(1 << ((i)%NBBY)))
65a399b765Szf #define	isset(a, i)		((a)[(i)/NBBY] & (1 << ((i)%NBBY)))
66a399b765Szf #define	isclr(a, i)		(!((a)[(i)/NBBY] & (1 << ((i)%NBBY))))
67a399b765Szf 
687a1306a7Sxc /*
697a1306a7Sxc  * Bit flags in the ath_dbg_flags
707a1306a7Sxc  */
717a1306a7Sxc #define	ATH_DBG_INIT		0x00000001	/* initialisation	*/
727a1306a7Sxc #define	ATH_DBG_GLD		0x00000002	/* GLD entry points	*/
737a1306a7Sxc #define	ATH_DBG_HAL		0x00000004	/* HAL related code	*/
747a1306a7Sxc #define	ATH_DBG_INT		0x00000008	/* interrupt handler	*/
757a1306a7Sxc #define	ATH_DBG_RECV		0x00000010	/* receive-side code	*/
767a1306a7Sxc #define	ATH_DBG_SEND		0x00000020	/* packet-send code	*/
777a1306a7Sxc #define	ATH_DBG_80211		0x00000040	/* 80211 state machine	*/
787a1306a7Sxc #define	ATH_DBG_IOCTL		0x00000080	/* ioctl code		*/
797a1306a7Sxc #define	ATH_DBG_STATS		0x00000100	/* statistics		*/
807a1306a7Sxc #define	ATH_DBG_RATE		0x00000200	/* rate control		*/
817a1306a7Sxc #define	ATH_DBG_AUX		0x00000400	/* for ath_aux.c	*/
827a1306a7Sxc #define	ATH_DBG_WIFICFG		0x00000800	/* wificonfig		*/
837a1306a7Sxc #define	ATH_DBG_OSDEP		0x00001000	/* osdep		*/
847a1306a7Sxc #define	ATH_DBG_ATTACH		0x00002000	/* attach		*/
857a1306a7Sxc #define	ATH_DBG_DETACH		0x00004000	/* detach		*/
86f11a3086Sxc #define	ATH_DBG_SUSPEND		0x00008000	/* suspend/resume	*/
87f11a3086Sxc #define	ATH_DBG_ALL		0x0000ffff	/* all			*/
887a1306a7Sxc 
897a1306a7Sxc #ifdef DEBUG
907a1306a7Sxc #define	ATH_DDB(command)	do {				\
917a1306a7Sxc 					{ command; }		\
927a1306a7Sxc 					_NOTE(CONSTANTCONDITION)\
937a1306a7Sxc 				} while (0)
947a1306a7Sxc #else
957a1306a7Sxc #define	ATH_DDB(command)
967a1306a7Sxc #endif /* DEBUG */
977a1306a7Sxc 
987a1306a7Sxc /*
997a1306a7Sxc  * Node type of wifi device
1007a1306a7Sxc  */
1017a1306a7Sxc #ifndef DDI_NT_NET_WIFI
1027a1306a7Sxc #define	DDI_NT_NET_WIFI	"ddi_network:wifi"
1037a1306a7Sxc #endif
1047a1306a7Sxc #define	ATH_NODENAME	"ath"
1057a1306a7Sxc 
1067a1306a7Sxc #define	ATH_DEBUG(args)		ATH_DDB(ath_dbg args)
1077a1306a7Sxc 
1087a1306a7Sxc #define	list_empty(a) ((a)->list_head.list_next == &(a)->list_head)
1097a1306a7Sxc #define	ATH_LE_READ_4(p)						\
1107a1306a7Sxc 	((uint32_t)							\
1117a1306a7Sxc 	((((uint8_t *)(p))[0]) | (((uint8_t *)(p))[1] <<  8) |		\
1127a1306a7Sxc 	(((uint8_t *)(p))[2] << 16) | (((uint8_t *)(p))[3] << 24)))
1137a1306a7Sxc #define	ATH_N(a)	(sizeof (a) / sizeof (a[0]))
1147a1306a7Sxc #define	ATH_TXQ_SETUP(asc, i)	((asc)->asc_txqsetup & (1<<i))
1157a1306a7Sxc #define	ATH_PA2DESC(_asc, _pa) \
1167a1306a7Sxc 	((struct ath_desc *)((caddr_t)(_asc)->asc_desc + \
1177a1306a7Sxc 	((_pa) - (_asc)->asc_desc_dma.cookie.dmac_address)))
1187a1306a7Sxc /*
1197a1306a7Sxc  * Sync a DMA area described by a dma_area_t
1207a1306a7Sxc  */
1217a1306a7Sxc #define	ATH_DMA_SYNC(area, flag)    ((void) ddi_dma_sync((area).dma_hdl,    \
1227a1306a7Sxc 				(area).offset, (area).alength, (flag)))
1237a1306a7Sxc 
1247a1306a7Sxc #define	ATH_TXINTR_PERIOD 5
1257a1306a7Sxc #define	ATH_TIMEOUT	1000
1267a1306a7Sxc #define	ATH_RXBUF	80		/* number of RX buffers */
1277a1306a7Sxc #define	ATH_TXBUF	200		/* number of TX buffers */
1287a1306a7Sxc #define	ATH_TXDESC	1		/* number of descriptors per buffer */
1297a1306a7Sxc #define	ATH_TXMAXTRY	11		/* max number of transmit attempts */
1303caf1114Sxc #define	ATH_MCHASH	64		/* multicast hash table size */
1317a1306a7Sxc 
1321f156c6aSxc #define	ATH_DEF_CACHE_BYTES	32	/* default cache line size */
1331f156c6aSxc 
1347a1306a7Sxc /* driver-specific node state */
1357a1306a7Sxc struct ath_node {
1367a1306a7Sxc 	struct ieee80211_node an_node;	/* base class */
1377a1306a7Sxc 	uint32_t	an_tx_times;	/* rate ctl times on one rate */
1387a1306a7Sxc 	uint32_t	an_tx_ok;	/* tx ok pkt */
1397a1306a7Sxc 	uint32_t	an_tx_err;	/* tx !ok pkt */
1407a1306a7Sxc 	uint32_t	an_tx_retr;	/* tx retry count */
1417a1306a7Sxc 	int32_t		an_tx_upper;	/* tx upper rate req cnt */
1427a1306a7Sxc 	uint32_t	an_tx_antenna;	/* antenna for last good frame */
1437a1306a7Sxc 	uint8_t		an_tx_rix0;	/* series 0 rate index */
1447a1306a7Sxc 	uint8_t		an_tx_try0;	/* series 0 try count */
1457a1306a7Sxc 	uint8_t		an_tx_mgtrate;	/* h/w rate for management/ctl frames */
1467a1306a7Sxc 	uint8_t		an_tx_mgtratesp; /* short preamble h/w rate for " " */
1477a1306a7Sxc 	uint8_t		an_tx_rate0;	/* series 0 h/w rate */
1487a1306a7Sxc 	uint8_t		an_tx_rate1;	/* series 1 h/w rate */
1497a1306a7Sxc 	uint8_t		an_tx_rate2;	/* series 2 h/w rate */
1507a1306a7Sxc 	uint8_t		an_tx_rate3;	/* series 3 h/w rate */
1517a1306a7Sxc 	uint8_t		an_tx_rate0sp;	/* series 0 short preamble h/w rate */
1527a1306a7Sxc 	uint8_t		an_tx_rate1sp;	/* series 1 short preamble h/w rate */
1537a1306a7Sxc 	uint8_t		an_tx_rate2sp;	/* series 2 short preamble h/w rate */
1547a1306a7Sxc 	uint8_t		an_tx_rate3sp;	/* series 3 short preamble h/w rate */
1557a1306a7Sxc };
1567a1306a7Sxc #define	ATH_NODE(_n)	((struct ath_node *)(_n))
1577a1306a7Sxc 
1587a1306a7Sxc 
1597a1306a7Sxc struct ath_stats {
1607a1306a7Sxc 	uint32_t	ast_hardware;	/* fatal hardware error interrupts */
1617a1306a7Sxc 	uint32_t	ast_rxorn;	/* rx overrun interrupts */
1627a1306a7Sxc 	uint32_t	ast_rxeol;	/* rx eol interrupts */
1637a1306a7Sxc 	uint32_t	ast_txurn;	/* tx underrun interrupts */
1647a1306a7Sxc 	uint32_t	ast_tx_mgmt;	/* management frames transmitted */
1657a1306a7Sxc 	uint32_t	ast_tx_discard;	/* frames discarded prior to assoc */
1667a1306a7Sxc 	uint32_t	ast_tx_invalid; /* frames discarded 'cuz device gone */
1677a1306a7Sxc 	uint32_t	ast_tx_qstop;	/* tx queue stopped 'cuz full */
1687a1306a7Sxc 	uint32_t	ast_tx_nobuf;	/* tx failed 'cuz no tx buffer (data) */
1697a1306a7Sxc 	uint32_t	ast_tx_nobufmgt; /* tx failed 'cuz no tx buffer(mgmt) */
1707a1306a7Sxc 	uint32_t	ast_tx_xretries; /* tx failed 'cuz too many retries */
1717a1306a7Sxc 	uint32_t	ast_tx_fifoerr;	/* tx failed 'cuz FIFO underrun */
1727a1306a7Sxc 	uint32_t	ast_tx_filtered; /* tx failed 'cuz xmit filtered */
1737a1306a7Sxc 	uint32_t	ast_tx_shortretry; /* tx on-chip retries (short) */
1747a1306a7Sxc 	uint32_t	ast_tx_longretry; /* tx on-chip retries (long) */
1757a1306a7Sxc 	uint32_t	ast_tx_noack;	/* tx frames with no ack marked */
1767a1306a7Sxc 	uint32_t	ast_tx_rts;	/* tx frames with rts enabled */
1777a1306a7Sxc 	uint32_t	ast_tx_shortpre; /* tx frames with short preamble */
1787a1306a7Sxc 	uint32_t	ast_tx_altrate;	/* tx frames with alternate rate */
179*129d67acSlin wang - Sun Microsystems - Beijing China 	uint32_t	ast_tx_protect;	/* tx frames with protection */
1807a1306a7Sxc 	int16_t		ast_tx_rssi;	/* tx rssi of last ack */
1817a1306a7Sxc 	int16_t		ast_tx_rssidelta; /* tx rssi delta */
1827a1306a7Sxc 	uint32_t	ast_rx_crcerr;	/* rx failed 'cuz of bad CRC */
1837a1306a7Sxc 	uint32_t	ast_rx_fifoerr;	/* rx failed 'cuz of FIFO overrun */
1847a1306a7Sxc 	uint32_t	ast_rx_badcrypt; /* rx failed 'cuz decryption */
1857a1306a7Sxc 	uint32_t	ast_rx_phyerr;	/* rx PHY error summary count */
1867a1306a7Sxc 	uint32_t	ast_rx_phy[32];	/* rx PHY error per-code counts */
1877a1306a7Sxc 	uint32_t	ast_rx_tooshort; /* rx discarded 'cuz frame too short */
1887a1306a7Sxc 	uint32_t	ast_per_cal;	/* periodic calibration calls */
1897a1306a7Sxc 	uint32_t	ast_per_calfail; /* periodic calibration failed */
1907a1306a7Sxc 	uint32_t	ast_per_rfgain;	/* periodic calibration rfgain reset */
1917a1306a7Sxc 	uint32_t	ast_rate_calls;	/* rate control checks */
1927a1306a7Sxc 	uint32_t	ast_rate_raise;	/* rate control raised xmit rate */
1937a1306a7Sxc 	uint32_t	ast_rate_drop;	/* rate control dropped xmit rate */
1947a1306a7Sxc };
1957a1306a7Sxc 
1967a1306a7Sxc 
1977a1306a7Sxc /*
1987a1306a7Sxc  * Describes one chunk of allocated DMA-able memory
1997a1306a7Sxc  *
2007a1306a7Sxc  * In some cases, this is a single chunk as allocated from the system;
2017a1306a7Sxc  * but we also use this structure to represent slices carved off such
2027a1306a7Sxc  * a chunk.  Even when we don't really need all the information, we
2037a1306a7Sxc  * use this structure as a convenient way of correlating the various
2047a1306a7Sxc  * ways of looking at a piece of memory (kernel VA, IO space DVMA,
2057a1306a7Sxc  * handle+offset, etc).
2067a1306a7Sxc  */
2077a1306a7Sxc struct dma_area {
2087a1306a7Sxc 	ddi_acc_handle_t	acc_hdl;	/* handle for memory */
2097a1306a7Sxc 	caddr_t			mem_va;		/* CPU VA of memory */
2107a1306a7Sxc 	uint32_t		nslots;		/* number of slots */
2117a1306a7Sxc 	uint32_t		size;		/* size per slot */
2127a1306a7Sxc 	size_t			alength;	/* allocated size */
2137a1306a7Sxc 						/* >= product of above */
2147a1306a7Sxc 
2157a1306a7Sxc 	ddi_dma_handle_t	dma_hdl;	/* DMA handle */
2167a1306a7Sxc 	offset_t		offset;		/* relative to handle */
2177a1306a7Sxc 	ddi_dma_cookie_t	cookie;		/* associated cookie */
2187a1306a7Sxc 	uint32_t		ncookies;	/* must be 1 */
2197a1306a7Sxc 	uint32_t		token;		/* arbitrary identifier */
2207a1306a7Sxc };						/* 0x50 (80) bytes */
2217a1306a7Sxc typedef struct dma_area dma_area_t;
2227a1306a7Sxc 
2237a1306a7Sxc struct ath_buf {
2240ba2cbe9Sxc 	int			bf_flags;	/* tx descriptor flags */
2257a1306a7Sxc 	struct ath_desc		*bf_desc;	/* virtual addr of desc */
226*129d67acSlin wang - Sun Microsystems - Beijing China 	struct ath_desc_status	bf_status;	/* tx/rx status */
2277a1306a7Sxc 	uint32_t		bf_daddr;	/* physical addr of desc */
2287a1306a7Sxc 	dma_area_t		bf_dma;		/* dma area for buf */
229*129d67acSlin wang - Sun Microsystems - Beijing China 	mblk_t			*bf_m;		/* message for buf */
2307a1306a7Sxc 	struct ieee80211_node	*bf_in;		/* pointer to the node */
2317a1306a7Sxc 
2327a1306a7Sxc 	/* we're in list of asc->asc_txbuf_list or asc->asc_rxbuf_list */
2337a1306a7Sxc 	list_node_t		bf_node;
2347a1306a7Sxc };
2357a1306a7Sxc 
2367a1306a7Sxc 
2377a1306a7Sxc /*
2387a1306a7Sxc  * Data transmit queue state.  One of these exists for each
2397a1306a7Sxc  * hardware transmit queue.  Packets sent to us from above
2407a1306a7Sxc  * are assigned to queues based on their priority.  Not all
2417a1306a7Sxc  * devices support a complete set of hardware transmit queues.
2427a1306a7Sxc  * For those devices the array sc_ac2q will map multiple
2437a1306a7Sxc  * priorities to fewer hardware queues (typically all to one
2447a1306a7Sxc  * hardware queue).
2457a1306a7Sxc  */
2467a1306a7Sxc struct ath_txq {
2477a1306a7Sxc 	uint_t		axq_qnum;	/* hardware q number */
2487a1306a7Sxc 	uint_t		axq_depth;	/* queue depth (stat only) */
2497a1306a7Sxc 	uint_t		axq_intrcnt;	/* interrupt count */
2507a1306a7Sxc 	uint32_t	*axq_link;	/* link ptr in last TX desc */
2517a1306a7Sxc 	list_t		axq_list;	/* transmit queue */
2527a1306a7Sxc 	kmutex_t	axq_lock;	/* lock on q and link */
2537a1306a7Sxc };
2547a1306a7Sxc 
2557a1306a7Sxc 
2567a1306a7Sxc /*
2577a1306a7Sxc  * asc_isc must be the first element, for convience of
2587a1306a7Sxc  * casting between iee80211com and ath
2597a1306a7Sxc  */
2607a1306a7Sxc typedef struct ath {
2617a1306a7Sxc 	ieee80211com_t		asc_isc;	/* IEEE 802.11 common */
2627a1306a7Sxc 	dev_info_t		*asc_dev;	/* back pointer to dev_info_t */
263*129d67acSlin wang - Sun Microsystems - Beijing China 	ddi_taskq_t		*asc_tq;	/* private task queue */
2647a1306a7Sxc 	struct ath_hal		*asc_ah;	/* Atheros HAL */
2657a1306a7Sxc 	uint32_t		asc_invalid : 1, /* being detached */
266f11a3086Sxc 				asc_isrunning : 1, /* device is operational */
2677a1306a7Sxc 				asc_mrretry : 1, /* multi-rate retry support */
2687a1306a7Sxc 				asc_have11g : 1, /* have 11g support */
2690ba2cbe9Sxc 				asc_splitmic : 1, /* Split TKIP mic keys */
2700ba2cbe9Sxc 				asc_hasclrkey: 1; /* CLR key supported */
2717a1306a7Sxc 	const HAL_RATE_TABLE	*asc_rates[IEEE80211_MODE_MAX]; /* h/w rate */
272*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t			asc_protrix;	/* protect rate index */
273*129d67acSlin wang - Sun Microsystems - Beijing China 	uint8_t			asc_mcastantenna; /* Multicast antenna number */
2747a1306a7Sxc 
2757a1306a7Sxc 	ddi_acc_handle_t	asc_cfg_handle;	/* DDI I/O handle */
2767a1306a7Sxc 	ddi_acc_handle_t	asc_io_handle;	/* DDI I/O handle */
2777a1306a7Sxc 	uint16_t		asc_cachelsz;	/* cache line size */
2787a1306a7Sxc 	ddi_iblock_cookie_t	asc_iblock;
2797a1306a7Sxc 	ddi_softintr_t		asc_softint_id;
2807a1306a7Sxc 
2817a1306a7Sxc 	struct ath_desc		*asc_desc;	/* TX/RX descriptors */
2827a1306a7Sxc 	dma_area_t		asc_desc_dma;	/* descriptor structure */
2837a1306a7Sxc 	/* pointer to the first "struct ath_buf" */
2847a1306a7Sxc 	struct ath_buf		*asc_vbufptr;
2857a1306a7Sxc 	/* length of all allocated "struct ath_buf" */
2867a1306a7Sxc 	uint32_t		asc_vbuflen;
2877a1306a7Sxc 	/* size of one DMA TX/RX buffer based on 802.11 MTU */
2887a1306a7Sxc 	int32_t			asc_dmabuf_size;
2897a1306a7Sxc 
2907a1306a7Sxc 	list_t			asc_rxbuf_list;
2917a1306a7Sxc 	kmutex_t		asc_rxbuflock;	/* recv lock for above data */
2927a1306a7Sxc 	uint32_t		*asc_rxlink;	/* link ptr in last RX desc */
2937a1306a7Sxc 	uint32_t		asc_rx_pend;
294*129d67acSlin wang - Sun Microsystems - Beijing China 	uint64_t		asc_lastrx;	/* tsf at last rx'd frame */
2957a1306a7Sxc 
2967a1306a7Sxc 	list_t			asc_txbuf_list;
2977a1306a7Sxc 	kmutex_t		asc_txbuflock;	/* txbuf lock */
2987a1306a7Sxc 
2997a1306a7Sxc 	uint_t			asc_txqsetup;	/* h/w queues setup */
3007a1306a7Sxc 	struct ath_txq		asc_txq[HAL_NUM_TX_QUEUES]; /* tx queues */
3017a1306a7Sxc 	struct ath_txq		*asc_ac2q[5];	/* WME AC -> h/w qnum */
3027a1306a7Sxc 
3037a1306a7Sxc 	const HAL_RATE_TABLE	*asc_currates;	/* current rate table */
3047a1306a7Sxc 	enum ieee80211_phymode	asc_curmode;	/* current phy mode */
3050ba2cbe9Sxc 	HAL_CHANNEL		asc_curchan;	/* current h/w channel */
3067a1306a7Sxc 	uint8_t			asc_rixmap[256]; /* IEEE to h/w rate table ix */
3077a1306a7Sxc 	HAL_INT			asc_imask;	/* interrupt mask copy */
3087a1306a7Sxc 	struct ath_stats	asc_stats;	/* interface statistics */
3093caf1114Sxc 	boolean_t		asc_promisc;	/* Promiscuous mode enabled */
3103caf1114Sxc 	uint8_t			asc_mcast_refs[ATH_MCHASH]; /* refer count */
3113caf1114Sxc 	uint32_t		asc_mcast_hash[2]; /* multicast hash table */
3127a1306a7Sxc 	kmutex_t		asc_genlock;
3137a1306a7Sxc 
3140ba2cbe9Sxc 	boolean_t		asc_resched_needed;
3150ba2cbe9Sxc 	kmutex_t		asc_resched_lock;
3160ba2cbe9Sxc 
317a399b765Szf 	uint32_t		asc_keymax;	/* size of key cache */
318a399b765Szf 	uint8_t			asc_keymap[16];	/* bit map of key cache use */
319a399b765Szf 
3200ba2cbe9Sxc 	timeout_id_t		asc_scan_timer;
3210ba2cbe9Sxc 	int			(*asc_newstate)(ieee80211com_t *,
3220ba2cbe9Sxc 					enum ieee80211_state, int);
3237a1306a7Sxc } ath_t;
3247a1306a7Sxc 
3257a1306a7Sxc #define	ATH_STATE(macinfo)	((ath_t *)((macinfo)->gldm_private))
3267a1306a7Sxc 
3270ba2cbe9Sxc #define	ATH_LOCK(_asc)		mutex_enter(&(_asc)->asc_genlock)
3280ba2cbe9Sxc #define	ATH_UNLOCK(_asc)	mutex_exit(&(_asc)->asc_genlock)
3290ba2cbe9Sxc #define	ATH_LOCK_ASSERT(_asc)	ASSERT(mutex_owned(&(_asc)->asc_genlock))
3300ba2cbe9Sxc 
331f11a3086Sxc #define	ATH_IS_RUNNING(_asc)	\
332f11a3086Sxc 	(((_asc)->asc_invalid == 0) && ((_asc)->asc_isrunning == 1))
3330ba2cbe9Sxc 
3347a1306a7Sxc /* Debug and log functions */
3357a1306a7Sxc void ath_dbg(uint32_t dbg_flags, const char *fmt, ...);	/* debug function */
3367a1306a7Sxc void ath_log(const char *fmt, ...);	/* event log function */
3377a1306a7Sxc void ath_problem(const char *fmt, ...);	/* run-time problem function */
3387a1306a7Sxc 
3397a1306a7Sxc #ifdef __cplusplus
3407a1306a7Sxc }
3417a1306a7Sxc #endif
3427a1306a7Sxc 
3437a1306a7Sxc #endif /* _ATH_IMPL_H */
344