aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ath9k.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ath9k.h')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h130
1 files changed, 14 insertions, 116 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 13dd0202d6b5..d9bcc3abb425 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -19,14 +19,16 @@
19 19
20#include <linux/etherdevice.h> 20#include <linux/etherdevice.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <net/mac80211.h>
23#include <linux/leds.h> 22#include <linux/leds.h>
24 23
25#include "hw.h"
26#include "rc.h" 24#include "rc.h"
27#include "debug.h" 25#include "debug.h"
28#include "../ath.h" 26#include "common.h"
29#include "../debug.h" 27
28/*
29 * Header for the ath9k.ko driver core *only* -- hw code nor any other driver
30 * should rely on this file or its contents.
31 */
30 32
31struct ath_node; 33struct ath_node;
32 34
@@ -99,18 +101,6 @@ enum buffer_type {
99 BUF_XRETRY = BIT(5), 101 BUF_XRETRY = BIT(5),
100}; 102};
101 103
102struct ath_buf_state {
103 int bfs_nframes;
104 u16 bfs_al;
105 u16 bfs_frmlen;
106 int bfs_seqno;
107 int bfs_tidno;
108 int bfs_retries;
109 u8 bf_type;
110 u32 bfs_keyix;
111 enum ath9k_key_type bfs_keytype;
112};
113
114#define bf_nframes bf_state.bfs_nframes 104#define bf_nframes bf_state.bfs_nframes
115#define bf_al bf_state.bfs_al 105#define bf_al bf_state.bfs_al
116#define bf_frmlen bf_state.bfs_frmlen 106#define bf_frmlen bf_state.bfs_frmlen
@@ -125,21 +115,6 @@ struct ath_buf_state {
125#define bf_isretried(bf) (bf->bf_state.bf_type & BUF_RETRY) 115#define bf_isretried(bf) (bf->bf_state.bf_type & BUF_RETRY)
126#define bf_isxretried(bf) (bf->bf_state.bf_type & BUF_XRETRY) 116#define bf_isxretried(bf) (bf->bf_state.bf_type & BUF_XRETRY)
127 117
128struct ath_buf {
129 struct list_head list;
130 struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or
131 an aggregate) */
132 struct ath_buf *bf_next; /* next subframe in the aggregate */
133 struct sk_buff *bf_mpdu; /* enclosing frame structure */
134 struct ath_desc *bf_desc; /* virtual addr of desc */
135 dma_addr_t bf_daddr; /* physical addr of desc */
136 dma_addr_t bf_buf_addr; /* physical addr of data buffer */
137 bool bf_stale;
138 u16 bf_flags;
139 struct ath_buf_state bf_state;
140 dma_addr_t bf_dmacontext;
141};
142
143struct ath_descdma { 118struct ath_descdma {
144 struct ath_desc *dd_desc; 119 struct ath_desc *dd_desc;
145 dma_addr_t dd_desc_paddr; 120 dma_addr_t dd_desc_paddr;
@@ -159,13 +134,9 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
159 134
160#define ATH_MAX_ANTENNA 3 135#define ATH_MAX_ANTENNA 3
161#define ATH_RXBUF 512 136#define ATH_RXBUF 512
162#define WME_NUM_TID 16
163#define ATH_TXBUF 512 137#define ATH_TXBUF 512
164#define ATH_TXMAXTRY 13 138#define ATH_TXMAXTRY 13
165#define ATH_MGT_TXMAXTRY 4 139#define ATH_MGT_TXMAXTRY 4
166#define WME_BA_BMP_SIZE 64
167#define WME_MAX_BA WME_BA_BMP_SIZE
168#define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
169 140
170#define TID_TO_WME_AC(_tid) \ 141#define TID_TO_WME_AC(_tid) \
171 ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \ 142 ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
@@ -173,12 +144,6 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
173 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \ 144 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
174 WME_AC_VO) 145 WME_AC_VO)
175 146
176#define WME_AC_BE 0
177#define WME_AC_BK 1
178#define WME_AC_VI 2
179#define WME_AC_VO 3
180#define WME_NUM_AC 4
181
182#define ADDBA_EXCHANGE_ATTEMPTS 10 147#define ADDBA_EXCHANGE_ATTEMPTS 10
183#define ATH_AGGR_DELIM_SZ 4 148#define ATH_AGGR_DELIM_SZ 4
184#define ATH_AGGR_MINPLEN 256 /* in bytes, minimum packet length */ 149#define ATH_AGGR_MINPLEN 256 /* in bytes, minimum packet length */
@@ -252,30 +217,6 @@ struct ath_txq {
252#define AGGR_ADDBA_COMPLETE BIT(2) 217#define AGGR_ADDBA_COMPLETE BIT(2)
253#define AGGR_ADDBA_PROGRESS BIT(3) 218#define AGGR_ADDBA_PROGRESS BIT(3)
254 219
255struct ath_atx_tid {
256 struct list_head list;
257 struct list_head buf_q;
258 struct ath_node *an;
259 struct ath_atx_ac *ac;
260 struct ath_buf *tx_buf[ATH_TID_MAX_BUFS];
261 u16 seq_start;
262 u16 seq_next;
263 u16 baw_size;
264 int tidno;
265 int baw_head; /* first un-acked tx buffer */
266 int baw_tail; /* next unused tx buffer slot */
267 int sched;
268 int paused;
269 u8 state;
270};
271
272struct ath_atx_ac {
273 int sched;
274 int qnum;
275 struct list_head list;
276 struct list_head tid_q;
277};
278
279struct ath_tx_control { 220struct ath_tx_control {
280 struct ath_txq *txq; 221 struct ath_txq *txq;
281 int if_id; 222 int if_id;
@@ -286,29 +227,6 @@ struct ath_tx_control {
286#define ATH_TX_XRETRY 0x02 227#define ATH_TX_XRETRY 0x02
287#define ATH_TX_BAR 0x04 228#define ATH_TX_BAR 0x04
288 229
289#define ATH_RSSI_LPF_LEN 10
290#define RSSI_LPF_THRESHOLD -20
291#define ATH_RSSI_EP_MULTIPLIER (1<<7)
292#define ATH_EP_MUL(x, mul) ((x) * (mul))
293#define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
294#define ATH_LPF_RSSI(x, y, len) \
295 ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
296#define ATH_RSSI_LPF(x, y) do { \
297 if ((y) >= RSSI_LPF_THRESHOLD) \
298 x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \
299} while (0)
300#define ATH_EP_RND(x, mul) \
301 ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
302
303struct ath_node {
304 struct ath_softc *an_sc;
305 struct ath_atx_tid tid[WME_NUM_TID];
306 struct ath_atx_ac ac[WME_NUM_AC];
307 u16 maxampdu;
308 u8 mpdudensity;
309 int last_rssi;
310};
311
312struct ath_tx { 230struct ath_tx {
313 u16 seq_no; 231 u16 seq_no;
314 u32 txqsetup; 232 u32 txqsetup;
@@ -323,7 +241,6 @@ struct ath_rx {
323 u8 defant; 241 u8 defant;
324 u8 rxotherant; 242 u8 rxotherant;
325 u32 *rxlink; 243 u32 *rxlink;
326 int bufsize;
327 unsigned int rxfilter; 244 unsigned int rxfilter;
328 spinlock_t rxflushlock; 245 spinlock_t rxflushlock;
329 spinlock_t rxbuflock; 246 spinlock_t rxbuflock;
@@ -434,16 +351,6 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);
434#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */ 351#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
435#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */ 352#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
436 353
437struct ath_ani {
438 bool caldone;
439 int16_t noise_floor;
440 unsigned int longcal_timer;
441 unsigned int shortcal_timer;
442 unsigned int resetcal_timer;
443 unsigned int checkani_timer;
444 struct timer_list timer;
445};
446
447/* Defines the BT AR_BT_COEX_WGHT used */ 354/* Defines the BT AR_BT_COEX_WGHT used */
448enum ath_stomp_type { 355enum ath_stomp_type {
449 ATH_BTCOEX_NO_STOMP, 356 ATH_BTCOEX_NO_STOMP,
@@ -503,18 +410,7 @@ struct ath_led {
503#define ATH_CHAN_MAX 255 410#define ATH_CHAN_MAX 255
504#define IEEE80211_WEP_NKID 4 /* number of key ids */ 411#define IEEE80211_WEP_NKID 4 /* number of key ids */
505 412
506/*
507 * The key cache is used for h/w cipher state and also for
508 * tracking station state such as the current tx antenna.
509 * We also setup a mapping table between key cache slot indices
510 * and station state to short-circuit node lookups on rx.
511 * Different parts have different size key caches. We handle
512 * up to ATH_KEYMAX entries (could dynamically allocate state).
513 */
514#define ATH_KEYMAX 128 /* max key cache size we handle */
515
516#define ATH_TXPOWER_MAX 100 /* .5 dBm units */ 413#define ATH_TXPOWER_MAX 100 /* .5 dBm units */
517#define ATH_RSSI_DUMMY_MARKER 0x127
518#define ATH_RATE_DUMMY_MARKER 0 414#define ATH_RATE_DUMMY_MARKER 0
519 415
520#define SC_OP_INVALID BIT(0) 416#define SC_OP_INVALID BIT(0)
@@ -573,9 +469,6 @@ struct ath_softc {
573 u16 curtxpow; 469 u16 curtxpow;
574 u8 nbcnvifs; 470 u8 nbcnvifs;
575 u16 nvifs; 471 u16 nvifs;
576 u32 keymax;
577 DECLARE_BITMAP(keymap, ATH_KEYMAX);
578 u8 splitmic;
579 bool ps_enabled; 472 bool ps_enabled;
580 unsigned long ps_usecount; 473 unsigned long ps_usecount;
581 enum ath9k_int imask; 474 enum ath9k_int imask;
@@ -601,7 +494,6 @@ struct ath_softc {
601 494
602 int beacon_interval; 495 int beacon_interval;
603 496
604 struct ath_ani ani;
605#ifdef CONFIG_ATH9K_DEBUG 497#ifdef CONFIG_ATH9K_DEBUG
606 struct ath9k_debug debug; 498 struct ath9k_debug debug;
607#endif 499#endif
@@ -620,6 +512,7 @@ struct ath_wiphy {
620 ATH_WIPHY_PAUSED, 512 ATH_WIPHY_PAUSED,
621 ATH_WIPHY_SCAN, 513 ATH_WIPHY_SCAN,
622 } state; 514 } state;
515 bool idle;
623 int chan_idx; 516 int chan_idx;
624 int chan_is_ht; 517 int chan_is_ht;
625}; 518};
@@ -654,8 +547,9 @@ void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw,
654void ath_update_chainmask(struct ath_softc *sc, int is_ht); 547void ath_update_chainmask(struct ath_softc *sc, int is_ht);
655int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, 548int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
656 struct ath9k_channel *hchan); 549 struct ath9k_channel *hchan);
657void ath_radio_enable(struct ath_softc *sc); 550
658void ath_radio_disable(struct ath_softc *sc); 551void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw);
552void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw);
659 553
660#ifdef CONFIG_PCI 554#ifdef CONFIG_PCI
661int ath_pci_init(void); 555int ath_pci_init(void);
@@ -691,6 +585,10 @@ void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
691bool ath9k_wiphy_scanning(struct ath_softc *sc); 585bool ath9k_wiphy_scanning(struct ath_softc *sc);
692void ath9k_wiphy_work(struct work_struct *work); 586void ath9k_wiphy_work(struct work_struct *work);
693bool ath9k_all_wiphys_idle(struct ath_softc *sc); 587bool ath9k_all_wiphys_idle(struct ath_softc *sc);
588void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle);
589
590void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue);
591void ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue);
694 592
695int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype); 593int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype);
696#endif /* ATH9K_H */ 594#endif /* ATH9K_H */