xref: /openbmc/linux/drivers/net/wireless/ath/ath.h (revision 946a635b)
1d15dd3e5SLuis R. Rodriguez /*
2d15dd3e5SLuis R. Rodriguez  * Copyright (c) 2008-2009 Atheros Communications Inc.
3d15dd3e5SLuis R. Rodriguez  *
4d15dd3e5SLuis R. Rodriguez  * Permission to use, copy, modify, and/or distribute this software for any
5d15dd3e5SLuis R. Rodriguez  * purpose with or without fee is hereby granted, provided that the above
6d15dd3e5SLuis R. Rodriguez  * copyright notice and this permission notice appear in all copies.
7d15dd3e5SLuis R. Rodriguez  *
8d15dd3e5SLuis R. Rodriguez  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9d15dd3e5SLuis R. Rodriguez  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10d15dd3e5SLuis R. Rodriguez  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11d15dd3e5SLuis R. Rodriguez  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12d15dd3e5SLuis R. Rodriguez  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13d15dd3e5SLuis R. Rodriguez  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14d15dd3e5SLuis R. Rodriguez  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15d15dd3e5SLuis R. Rodriguez  */
16d15dd3e5SLuis R. Rodriguez 
17d15dd3e5SLuis R. Rodriguez #ifndef ATH_H
18d15dd3e5SLuis R. Rodriguez #define ATH_H
19d15dd3e5SLuis R. Rodriguez 
20f1d267caSOleksij Rempel #include <linux/etherdevice.h>
21d15dd3e5SLuis R. Rodriguez #include <linux/skbuff.h>
22bcd8f54aSLuis R. Rodriguez #include <linux/if_ether.h>
23b5bfc568SFelix Fietkau #include <linux/spinlock.h>
24b002a4a9SLuis R. Rodriguez #include <net/mac80211.h>
25d15dd3e5SLuis R. Rodriguez 
267e86c104SLuis R. Rodriguez /*
277e86c104SLuis R. Rodriguez  * The key cache is used for h/w cipher state and also for
287e86c104SLuis R. Rodriguez  * tracking station state such as the current tx antenna.
297e86c104SLuis R. Rodriguez  * We also setup a mapping table between key cache slot indices
307e86c104SLuis R. Rodriguez  * and station state to short-circuit node lookups on rx.
317e86c104SLuis R. Rodriguez  * Different parts have different size key caches.  We handle
327e86c104SLuis R. Rodriguez  * up to ATH_KEYMAX entries (could dynamically allocate state).
337e86c104SLuis R. Rodriguez  */
347e86c104SLuis R. Rodriguez #define	ATH_KEYMAX	        128     /* max key cache size we handle */
357e86c104SLuis R. Rodriguez 
363d536acfSLuis R. Rodriguez struct ath_ani {
373d536acfSLuis R. Rodriguez 	bool caldone;
383d536acfSLuis R. Rodriguez 	unsigned int longcal_timer;
393d536acfSLuis R. Rodriguez 	unsigned int shortcal_timer;
403d536acfSLuis R. Rodriguez 	unsigned int resetcal_timer;
413d536acfSLuis R. Rodriguez 	unsigned int checkani_timer;
423d536acfSLuis R. Rodriguez 	struct timer_list timer;
433d536acfSLuis R. Rodriguez };
443d536acfSLuis R. Rodriguez 
45b5bfc568SFelix Fietkau struct ath_cycle_counters {
46b5bfc568SFelix Fietkau 	u32 cycles;
47b5bfc568SFelix Fietkau 	u32 rx_busy;
48b5bfc568SFelix Fietkau 	u32 rx_frame;
49b5bfc568SFelix Fietkau 	u32 tx_frame;
50b5bfc568SFelix Fietkau };
51b5bfc568SFelix Fietkau 
52211f5859SLuis R. Rodriguez enum ath_device_state {
53211f5859SLuis R. Rodriguez 	ATH_HW_UNAVAILABLE,
54211f5859SLuis R. Rodriguez 	ATH_HW_INITIALIZED,
55211f5859SLuis R. Rodriguez };
56211f5859SLuis R. Rodriguez 
57eefa01ddSOleksij Rempel enum ath_op_flags {
58eefa01ddSOleksij Rempel 	ATH_OP_INVALID,
59eefa01ddSOleksij Rempel 	ATH_OP_BEACONS,
60eefa01ddSOleksij Rempel 	ATH_OP_ANI_RUN,
61eefa01ddSOleksij Rempel 	ATH_OP_PRIM_STA_VIF,
62eefa01ddSOleksij Rempel 	ATH_OP_HW_RESET,
63eefa01ddSOleksij Rempel 	ATH_OP_SCANNING,
6426f16c24SFelix Fietkau 	ATH_OP_MULTI_CHANNEL,
65249943a2SSujith Manoharan 	ATH_OP_WOW_ENABLED,
66eefa01ddSOleksij Rempel };
67eefa01ddSOleksij Rempel 
68497ad9adSSujith enum ath_bus_type {
69497ad9adSSujith 	ATH_PCI,
70497ad9adSSujith 	ATH_AHB,
71497ad9adSSujith 	ATH_USB,
72497ad9adSSujith };
73497ad9adSSujith 
74608b88cbSLuis R. Rodriguez struct reg_dmn_pair_mapping {
75ef8c0017SKalle Valo 	u16 reg_domain;
76608b88cbSLuis R. Rodriguez 	u16 reg_5ghz_ctl;
77608b88cbSLuis R. Rodriguez 	u16 reg_2ghz_ctl;
78608b88cbSLuis R. Rodriguez };
79608b88cbSLuis R. Rodriguez 
80608b88cbSLuis R. Rodriguez struct ath_regulatory {
81608b88cbSLuis R. Rodriguez 	char alpha2[2];
8294e05900SFelix Fietkau 	enum nl80211_dfs_regions region;
83608b88cbSLuis R. Rodriguez 	u16 country_code;
84608b88cbSLuis R. Rodriguez 	u16 max_power_level;
85608b88cbSLuis R. Rodriguez 	u16 current_rd;
86608b88cbSLuis R. Rodriguez 	int16_t power_limit;
87608b88cbSLuis R. Rodriguez 	struct reg_dmn_pair_mapping *regpair;
88608b88cbSLuis R. Rodriguez };
89608b88cbSLuis R. Rodriguez 
9034a13051SBruno Randolf enum ath_crypt_caps {
91ce2220d1SBruno Randolf 	ATH_CRYPT_CAP_CIPHER_AESCCM		= BIT(0),
92ce2220d1SBruno Randolf 	ATH_CRYPT_CAP_MIC_COMBINED		= BIT(1),
9334a13051SBruno Randolf };
9434a13051SBruno Randolf 
951bba5b73SBruno Randolf struct ath_keyval {
961bba5b73SBruno Randolf 	u8 kv_type;
971bba5b73SBruno Randolf 	u8 kv_pad;
981bba5b73SBruno Randolf 	u16 kv_len;
99bfcc8ba4SKees Cook 	struct_group(kv_values,
1001bba5b73SBruno Randolf 		u8 kv_val[16]; /* TK */
1011bba5b73SBruno Randolf 		u8 kv_mic[8]; /* Michael MIC key */
1021bba5b73SBruno Randolf 		u8 kv_txmic[8]; /* Michael MIC TX key (used only if the hardware
1031bba5b73SBruno Randolf 				 * supports both MIC keys in the same key cache entry;
1041bba5b73SBruno Randolf 				 * in that case, kv_mic is the RX key) */
105bfcc8ba4SKees Cook 	);
1061bba5b73SBruno Randolf };
1071bba5b73SBruno Randolf 
1081bba5b73SBruno Randolf enum ath_cipher {
1091bba5b73SBruno Randolf 	ATH_CIPHER_WEP = 0,
1101bba5b73SBruno Randolf 	ATH_CIPHER_AES_OCB = 1,
1111bba5b73SBruno Randolf 	ATH_CIPHER_AES_CCM = 2,
1121bba5b73SBruno Randolf 	ATH_CIPHER_CKIP = 3,
1131bba5b73SBruno Randolf 	ATH_CIPHER_TKIP = 4,
1141bba5b73SBruno Randolf 	ATH_CIPHER_CLR = 5,
1151bba5b73SBruno Randolf 	ATH_CIPHER_MIC = 127
1161bba5b73SBruno Randolf };
1171bba5b73SBruno Randolf 
11850f56316SSujith /**
11950f56316SSujith  * struct ath_ops - Register read/write operations
12050f56316SSujith  *
12150f56316SSujith  * @read: Register read
12209a525d3SSujith Manoharan  * @multi_read: Multiple register read
12350f56316SSujith  * @write: Register write
12450f56316SSujith  * @enable_write_buffer: Enable multiple register writes
125435c1610SFelix Fietkau  * @write_flush: flush buffered register writes and disable buffering
12650f56316SSujith  */
1279e4bffd2SLuis R. Rodriguez struct ath_ops {
1289e4bffd2SLuis R. Rodriguez 	unsigned int (*read)(void *, u32 reg_offset);
12909a525d3SSujith Manoharan 	void (*multi_read)(void *, u32 *addr, u32 *val, u16 count);
1309e4bffd2SLuis R. Rodriguez 	void (*write)(void *, u32 val, u32 reg_offset);
13150f56316SSujith 	void (*enable_write_buffer)(void *);
13250f56316SSujith 	void (*write_flush) (void *);
133845e03c9SFelix Fietkau 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
1348badb50cSOleksij Rempel 	void (*enable_rmw_buffer)(void *);
1358badb50cSOleksij Rempel 	void (*rmw_flush) (void *);
1368badb50cSOleksij Rempel 
1379e4bffd2SLuis R. Rodriguez };
1389e4bffd2SLuis R. Rodriguez 
1395bb12791SLuis R. Rodriguez struct ath_common;
1400cb9e06bSFelix Fietkau struct ath_bus_ops;
1415bb12791SLuis R. Rodriguez 
1420198c2e2SOleksij Rempel struct ath_ps_ops {
1430198c2e2SOleksij Rempel 	void (*wakeup)(struct ath_common *common);
1440198c2e2SOleksij Rempel 	void (*restore)(struct ath_common *common);
1450198c2e2SOleksij Rempel };
1460198c2e2SOleksij Rempel 
147d15dd3e5SLuis R. Rodriguez struct ath_common {
14813b81559SLuis R. Rodriguez 	void *ah;
149bc974f4aSLuis R. Rodriguez 	void *priv;
150b002a4a9SLuis R. Rodriguez 	struct ieee80211_hw *hw;
151c46917bbSLuis R. Rodriguez 	int debug_mask;
152211f5859SLuis R. Rodriguez 	enum ath_device_state state;
153eefa01ddSOleksij Rempel 	unsigned long op_flags;
154c46917bbSLuis R. Rodriguez 
1553d536acfSLuis R. Rodriguez 	struct ath_ani ani;
1563d536acfSLuis R. Rodriguez 
157d15dd3e5SLuis R. Rodriguez 	u16 cachelsz;
1581510718dSLuis R. Rodriguez 	u16 curaid;
1591510718dSLuis R. Rodriguez 	u8 macaddr[ETH_ALEN];
16062ae1aefSSujith Manoharan 	u8 curbssid[ETH_ALEN] __aligned(2);
1611510718dSLuis R. Rodriguez 	u8 bssidmask[ETH_ALEN];
162c46917bbSLuis R. Rodriguez 
163cc861f74SLuis R. Rodriguez 	u32 rx_bufsize;
164cc861f74SLuis R. Rodriguez 
1657e86c104SLuis R. Rodriguez 	u32 keymax;
1667e86c104SLuis R. Rodriguez 	DECLARE_BITMAP(keymap, ATH_KEYMAX);
16756363ddeSFelix Fietkau 	DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
168bed3d9c0SFelix Fietkau 	DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX);
16934a13051SBruno Randolf 	enum ath_crypt_caps crypt_caps;
1707e86c104SLuis R. Rodriguez 
171dfdac8acSFelix Fietkau 	unsigned int clockrate;
172dfdac8acSFelix Fietkau 
173b5bfc568SFelix Fietkau 	spinlock_t cc_lock;
174*946a635bSArnd Bergmann 	struct_group(cc,
175b5bfc568SFelix Fietkau 		struct ath_cycle_counters cc_ani;
176b5bfc568SFelix Fietkau 		struct ath_cycle_counters cc_survey;
177*946a635bSArnd Bergmann 	);
178b5bfc568SFelix Fietkau 
179608b88cbSLuis R. Rodriguez 	struct ath_regulatory regulatory;
180de1c732bSLuis R. Rodriguez 	struct ath_regulatory reg_world_copy;
1819adca126SLuis R. Rodriguez 	const struct ath_ops *ops;
1825bb12791SLuis R. Rodriguez 	const struct ath_bus_ops *bus_ops;
1830198c2e2SOleksij Rempel 	const struct ath_ps_ops *ps_ops;
1848f5dcb1cSVasanthakumar Thiagarajan 
1858f5dcb1cSVasanthakumar Thiagarajan 	bool btcoex_enabled;
18605c0be2fSMohammed Shafi Shajakhan 	bool disable_ani;
18763081305SSujith Manoharan 	bool bt_ant_diversity;
1882f2cb326SOleksij Rempel 
1892f2cb326SOleksij Rempel 	int last_rssi;
19057fbcce3SJohannes Berg 	struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
191d15dd3e5SLuis R. Rodriguez };
192d15dd3e5SLuis R. Rodriguez 
ath_ps_ops(struct ath_common * common)1930198c2e2SOleksij Rempel static inline const struct ath_ps_ops *ath_ps_ops(struct ath_common *common)
1940198c2e2SOleksij Rempel {
1950198c2e2SOleksij Rempel 	return common->ps_ops;
1960198c2e2SOleksij Rempel }
1970198c2e2SOleksij Rempel 
198d15dd3e5SLuis R. Rodriguez struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
199d15dd3e5SLuis R. Rodriguez 				u32 len,
200d15dd3e5SLuis R. Rodriguez 				gfp_t gfp_mask);
201f1d267caSOleksij Rempel bool ath_is_mybeacon(struct ath_common *common, struct ieee80211_hdr *hdr);
202d15dd3e5SLuis R. Rodriguez 
20313b81559SLuis R. Rodriguez void ath_hw_setbssidmask(struct ath_common *common);
204144cd24dSJouni Malinen void ath_key_delete(struct ath_common *common, u8 hw_key_idx);
2051bba5b73SBruno Randolf int ath_key_config(struct ath_common *common,
2061bba5b73SBruno Randolf 			  struct ieee80211_vif *vif,
2071bba5b73SBruno Randolf 			  struct ieee80211_sta *sta,
2081bba5b73SBruno Randolf 			  struct ieee80211_key_conf *key);
2091bba5b73SBruno Randolf bool ath_hw_keyreset(struct ath_common *common, u16 entry);
210d2d3e364SJouni Malinen bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac);
211b5bfc568SFelix Fietkau void ath_hw_cycle_counters_update(struct ath_common *common);
212b5bfc568SFelix Fietkau int32_t ath_hw_get_listen_time(struct ath_common *common);
21313b81559SLuis R. Rodriguez 
21498b36a02SBen Greear __printf(3, 4)
21598b36a02SBen Greear void ath_printk(const char *level, const struct ath_common *common,
21698b36a02SBen Greear 		const char *fmt, ...);
21721a99f93SJoe Perches 
21821a99f93SJoe Perches #define ath_emerg(common, fmt, ...)				\
21998b36a02SBen Greear 	ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__)
22021a99f93SJoe Perches #define ath_alert(common, fmt, ...)				\
22198b36a02SBen Greear 	ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__)
22221a99f93SJoe Perches #define ath_crit(common, fmt, ...)				\
22398b36a02SBen Greear 	ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__)
22421a99f93SJoe Perches #define ath_err(common, fmt, ...)				\
22598b36a02SBen Greear 	ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__)
22621a99f93SJoe Perches #define ath_warn(common, fmt, ...)				\
22798b36a02SBen Greear 	ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__)
22821a99f93SJoe Perches #define ath_notice(common, fmt, ...)				\
22998b36a02SBen Greear 	ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__)
23021a99f93SJoe Perches #define ath_info(common, fmt, ...)				\
23198b36a02SBen Greear 	ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__)
23221a99f93SJoe Perches 
23321a99f93SJoe Perches /**
23421a99f93SJoe Perches  * enum ath_debug_level - atheros wireless debug level
23521a99f93SJoe Perches  *
23621a99f93SJoe Perches  * @ATH_DBG_RESET: reset processing
23721a99f93SJoe Perches  * @ATH_DBG_QUEUE: hardware queue management
23821a99f93SJoe Perches  * @ATH_DBG_EEPROM: eeprom processing
23921a99f93SJoe Perches  * @ATH_DBG_CALIBRATE: periodic calibration
24021a99f93SJoe Perches  * @ATH_DBG_INTERRUPT: interrupt processing
24121a99f93SJoe Perches  * @ATH_DBG_REGULATORY: regulatory processing
24221a99f93SJoe Perches  * @ATH_DBG_ANI: adaptive noise immunitive processing
24321a99f93SJoe Perches  * @ATH_DBG_XMIT: basic xmit operation
24421a99f93SJoe Perches  * @ATH_DBG_BEACON: beacon handling
24521a99f93SJoe Perches  * @ATH_DBG_CONFIG: configuration of the hardware
24621a99f93SJoe Perches  * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT
24721a99f93SJoe Perches  * @ATH_DBG_PS: power save processing
24821a99f93SJoe Perches  * @ATH_DBG_HWTIMER: hardware timer handling
24921a99f93SJoe Perches  * @ATH_DBG_BTCOEX: bluetooth coexistance
25021a99f93SJoe Perches  * @ATH_DBG_BSTUCK: stuck beacons
25155e435deSLuis R. Rodriguez  * @ATH_DBG_MCI: Message Coexistence Interface, a private protocol
25255e435deSLuis R. Rodriguez  *	used exclusively for WLAN-BT coexistence starting from
25355e435deSLuis R. Rodriguez  *	AR9462.
2549b203c8fSZefir Kurtisi  * @ATH_DBG_DFS: radar datection
255b3ba6c52SMohammed Shafi Shajakhan  * @ATH_DBG_WOW: Wake on Wireless
256c774d57fSLorenzo Bianconi  * @ATH_DBG_DYNACK: dynack handling
25704a81e18SNick Kossifidis  * @ATH_DBG_SPECTRAL_SCAN: FFT spectral scan
25821a99f93SJoe Perches  * @ATH_DBG_ANY: enable all debugging
25921a99f93SJoe Perches  *
26021a99f93SJoe Perches  * The debug level is used to control the amount and type of debugging output
26121a99f93SJoe Perches  * we want to see. Each driver has its own method for enabling debugging and
26221a99f93SJoe Perches  * modifying debug level states -- but this is typically done through a
26321a99f93SJoe Perches  * module parameter 'debug' along with a respective 'debug' debugfs file
26421a99f93SJoe Perches  * entry.
26521a99f93SJoe Perches  */
26621a99f93SJoe Perches enum ATH_DEBUG {
26721a99f93SJoe Perches 	ATH_DBG_RESET		= 0x00000001,
26821a99f93SJoe Perches 	ATH_DBG_QUEUE		= 0x00000002,
26921a99f93SJoe Perches 	ATH_DBG_EEPROM		= 0x00000004,
27021a99f93SJoe Perches 	ATH_DBG_CALIBRATE	= 0x00000008,
27121a99f93SJoe Perches 	ATH_DBG_INTERRUPT	= 0x00000010,
27221a99f93SJoe Perches 	ATH_DBG_REGULATORY	= 0x00000020,
27321a99f93SJoe Perches 	ATH_DBG_ANI		= 0x00000040,
27421a99f93SJoe Perches 	ATH_DBG_XMIT		= 0x00000080,
27521a99f93SJoe Perches 	ATH_DBG_BEACON		= 0x00000100,
27621a99f93SJoe Perches 	ATH_DBG_CONFIG		= 0x00000200,
27721a99f93SJoe Perches 	ATH_DBG_FATAL		= 0x00000400,
27821a99f93SJoe Perches 	ATH_DBG_PS		= 0x00000800,
27914335310SSujith Manoharan 	ATH_DBG_BTCOEX		= 0x00001000,
28014335310SSujith Manoharan 	ATH_DBG_WMI		= 0x00002000,
28114335310SSujith Manoharan 	ATH_DBG_BSTUCK		= 0x00004000,
28214335310SSujith Manoharan 	ATH_DBG_MCI		= 0x00008000,
28314335310SSujith Manoharan 	ATH_DBG_DFS		= 0x00010000,
28414335310SSujith Manoharan 	ATH_DBG_WOW		= 0x00020000,
28527328a75SSujith Manoharan 	ATH_DBG_CHAN_CTX	= 0x00040000,
286c774d57fSLorenzo Bianconi 	ATH_DBG_DYNACK		= 0x00080000,
28704a81e18SNick Kossifidis 	ATH_DBG_SPECTRAL_SCAN	= 0x00100000,
28821a99f93SJoe Perches 	ATH_DBG_ANY		= 0xffffffff
28921a99f93SJoe Perches };
29021a99f93SJoe Perches 
29121a99f93SJoe Perches #define ATH_DBG_DEFAULT (ATH_DBG_FATAL)
292e6664dffSSujith Manoharan #define ATH_DBG_MAX_LEN 512
29321a99f93SJoe Perches 
29421a99f93SJoe Perches #ifdef CONFIG_ATH_DEBUG
29521a99f93SJoe Perches 
29621a99f93SJoe Perches #define ath_dbg(common, dbg_mask, fmt, ...)				\
2977b8112d6SJoe Perches do {									\
298d2182b69SJoe Perches 	if ((common)->debug_mask & ATH_DBG_##dbg_mask)			\
29998b36a02SBen Greear 		ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__);	\
3007b8112d6SJoe Perches } while (0)
3017b8112d6SJoe Perches 
30221a99f93SJoe Perches #define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
303d7fd1b50SBen Greear #define ATH_DBG_WARN_ON_ONCE(foo) WARN_ON_ONCE(foo)
30421a99f93SJoe Perches 
30521a99f93SJoe Perches #else
30621a99f93SJoe Perches 
3077b8112d6SJoe Perches static inline  __attribute__ ((format (printf, 3, 4)))
_ath_dbg(struct ath_common * common,enum ATH_DEBUG dbg_mask,const char * fmt,...)308d2182b69SJoe Perches void _ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask,
30921a99f93SJoe Perches 	     const char *fmt, ...)
31021a99f93SJoe Perches {
31121a99f93SJoe Perches }
312d2182b69SJoe Perches #define ath_dbg(common, dbg_mask, fmt, ...)				\
313d2182b69SJoe Perches 	_ath_dbg(common, ATH_DBG_##dbg_mask, fmt, ##__VA_ARGS__)
314d2182b69SJoe Perches 
31521a99f93SJoe Perches #define ATH_DBG_WARN(foo, arg...) do {} while (0)
316b7613370SJohn W. Linville #define ATH_DBG_WARN_ON_ONCE(foo) ({				\
317b7613370SJohn W. Linville 	int __ret_warn_once = !!(foo);				\
318b7613370SJohn W. Linville 	unlikely(__ret_warn_once);				\
319b7613370SJohn W. Linville })
32021a99f93SJoe Perches 
32121a99f93SJoe Perches #endif /* CONFIG_ATH_DEBUG */
32221a99f93SJoe Perches 
32321a99f93SJoe Perches /** Returns string describing opmode, or NULL if unknown mode. */
32421a99f93SJoe Perches #ifdef CONFIG_ATH_DEBUG
32521a99f93SJoe Perches const char *ath_opmode_to_string(enum nl80211_iftype opmode);
32621a99f93SJoe Perches #else
ath_opmode_to_string(enum nl80211_iftype opmode)32721a99f93SJoe Perches static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode)
32821a99f93SJoe Perches {
32921a99f93SJoe Perches 	return "UNKNOWN";
33021a99f93SJoe Perches }
33121a99f93SJoe Perches #endif
33221a99f93SJoe Perches 
333b40ded2aSMartin Blumenstingl extern const char *ath_bus_type_strings[];
ath_bus_type_to_string(enum ath_bus_type bustype)334b40ded2aSMartin Blumenstingl static inline const char *ath_bus_type_to_string(enum ath_bus_type bustype)
335b40ded2aSMartin Blumenstingl {
336b40ded2aSMartin Blumenstingl 	return ath_bus_type_strings[bustype];
337b40ded2aSMartin Blumenstingl }
338b40ded2aSMartin Blumenstingl 
339d15dd3e5SLuis R. Rodriguez #endif /* ATH_H */
340