core.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. /*
  2. * Copyright (c) 2008 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef CORE_H
  17. #define CORE_H
  18. #include <linux/version.h>
  19. #include <linux/autoconf.h>
  20. #include <linux/kernel.h>
  21. #include <linux/module.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/errno.h>
  24. #include <linux/skbuff.h>
  25. #include <linux/netdevice.h>
  26. #include <linux/etherdevice.h>
  27. #include <linux/ip.h>
  28. #include <linux/tcp.h>
  29. #include <linux/in.h>
  30. #include <linux/delay.h>
  31. #include <linux/wait.h>
  32. #include <linux/pci.h>
  33. #include <linux/interrupt.h>
  34. #include <linux/sched.h>
  35. #include <linux/list.h>
  36. #include <asm/byteorder.h>
  37. #include <linux/scatterlist.h>
  38. #include <asm/page.h>
  39. #include <net/mac80211.h>
  40. #include <linux/leds.h>
  41. #include "ath9k.h"
  42. #include "rc.h"
  43. struct ath_node;
  44. /******************/
  45. /* Utility macros */
  46. /******************/
  47. /* Macro to expand scalars to 64-bit objects */
  48. #define ito64(x) (sizeof(x) == 8) ? \
  49. (((unsigned long long int)(x)) & (0xff)) : \
  50. (sizeof(x) == 16) ? \
  51. (((unsigned long long int)(x)) & 0xffff) : \
  52. ((sizeof(x) == 32) ? \
  53. (((unsigned long long int)(x)) & 0xffffffff) : \
  54. (unsigned long long int)(x))
  55. /* increment with wrap-around */
  56. #define INCR(_l, _sz) do { \
  57. (_l)++; \
  58. (_l) &= ((_sz) - 1); \
  59. } while (0)
  60. /* decrement with wrap-around */
  61. #define DECR(_l, _sz) do { \
  62. (_l)--; \
  63. (_l) &= ((_sz) - 1); \
  64. } while (0)
  65. #define A_MAX(a, b) ((a) > (b) ? (a) : (b))
  66. #define ASSERT(exp) do { \
  67. if (unlikely(!(exp))) { \
  68. BUG(); \
  69. } \
  70. } while (0)
  71. #define TSF_TO_TU(_h,_l) \
  72. ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
  73. /* XXX: remove */
  74. #define memzero(_buf, _len) memset(_buf, 0, _len)
  75. #define ATH9K_BH_STATUS_INTACT 0
  76. #define ATH9K_BH_STATUS_CHANGE 1
  77. #define ATH_TXQ_SETUP(sc, i) ((sc)->sc_txqsetup & (1<<i))
  78. static inline unsigned long get_timestamp(void)
  79. {
  80. return ((jiffies / HZ) * 1000) + (jiffies % HZ) * (1000 / HZ);
  81. }
  82. static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  83. /*************/
  84. /* Debugging */
  85. /*************/
  86. enum ATH_DEBUG {
  87. ATH_DBG_RESET = 0x00000001,
  88. ATH_DBG_PHY_IO = 0x00000002,
  89. ATH_DBG_REG_IO = 0x00000004,
  90. ATH_DBG_QUEUE = 0x00000008,
  91. ATH_DBG_EEPROM = 0x00000010,
  92. ATH_DBG_NF_CAL = 0x00000020,
  93. ATH_DBG_CALIBRATE = 0x00000040,
  94. ATH_DBG_CHANNEL = 0x00000080,
  95. ATH_DBG_INTERRUPT = 0x00000100,
  96. ATH_DBG_REGULATORY = 0x00000200,
  97. ATH_DBG_ANI = 0x00000400,
  98. ATH_DBG_POWER_MGMT = 0x00000800,
  99. ATH_DBG_XMIT = 0x00001000,
  100. ATH_DBG_BEACON = 0x00002000,
  101. ATH_DBG_RATE = 0x00004000,
  102. ATH_DBG_CONFIG = 0x00008000,
  103. ATH_DBG_KEYCACHE = 0x00010000,
  104. ATH_DBG_AGGR = 0x00020000,
  105. ATH_DBG_FATAL = 0x00040000,
  106. ATH_DBG_ANY = 0xffffffff
  107. };
  108. #define DBG_DEFAULT (ATH_DBG_FATAL)
  109. #define DPRINTF(sc, _m, _fmt, ...) do { \
  110. if (sc->sc_debug & (_m)) \
  111. printk(_fmt , ##__VA_ARGS__); \
  112. } while (0)
  113. /***************************/
  114. /* Load-time Configuration */
  115. /***************************/
  116. /* Per-instance load-time (note: NOT run-time) configurations
  117. * for Atheros Device */
  118. struct ath_config {
  119. u32 ath_aggr_prot;
  120. u16 txpowlimit;
  121. u16 txpowlimit_override;
  122. u8 cabqReadytime; /* Cabq Readytime % */
  123. u8 swBeaconProcess; /* Process received beacons in SW (vs HW) */
  124. };
  125. /***********************/
  126. /* Chainmask Selection */
  127. /***********************/
  128. #define ATH_CHAINMASK_SEL_TIMEOUT 6000
  129. /* Default - Number of last RSSI values that is used for
  130. * chainmask selection */
  131. #define ATH_CHAINMASK_SEL_RSSI_CNT 10
  132. /* Means use 3x3 chainmask instead of configured chainmask */
  133. #define ATH_CHAINMASK_SEL_3X3 7
  134. /* Default - Rssi threshold below which we have to switch to 3x3 */
  135. #define ATH_CHAINMASK_SEL_UP_RSSI_THRES 20
  136. /* Default - Rssi threshold above which we have to switch to
  137. * user configured values */
  138. #define ATH_CHAINMASK_SEL_DOWN_RSSI_THRES 35
  139. /* Struct to store the chainmask select related info */
  140. struct ath_chainmask_sel {
  141. struct timer_list timer;
  142. int cur_tx_mask; /* user configured or 3x3 */
  143. int cur_rx_mask; /* user configured or 3x3 */
  144. int tx_avgrssi;
  145. u8 switch_allowed:1, /* timer will set this */
  146. cm_sel_enabled : 1;
  147. };
  148. int ath_chainmask_sel_logic(struct ath_softc *sc, struct ath_node *an);
  149. void ath_update_chainmask(struct ath_softc *sc, int is_ht);
  150. /*************************/
  151. /* Descriptor Management */
  152. /*************************/
  153. #define ATH_TXBUF_RESET(_bf) do { \
  154. (_bf)->bf_status = 0; \
  155. (_bf)->bf_lastbf = NULL; \
  156. (_bf)->bf_lastfrm = NULL; \
  157. (_bf)->bf_next = NULL; \
  158. memzero(&((_bf)->bf_state), \
  159. sizeof(struct ath_buf_state)); \
  160. } while (0)
  161. enum buffer_type {
  162. BUF_DATA = BIT(0),
  163. BUF_AGGR = BIT(1),
  164. BUF_AMPDU = BIT(2),
  165. BUF_HT = BIT(3),
  166. BUF_RETRY = BIT(4),
  167. BUF_XRETRY = BIT(5),
  168. BUF_SHORT_PREAMBLE = BIT(6),
  169. BUF_BAR = BIT(7),
  170. BUF_PSPOLL = BIT(8),
  171. BUF_AGGR_BURST = BIT(9),
  172. BUF_CALC_AIRTIME = BIT(10),
  173. };
  174. struct ath_buf_state {
  175. int bfs_nframes; /* # frames in aggregate */
  176. u16 bfs_al; /* length of aggregate */
  177. u16 bfs_frmlen; /* length of frame */
  178. int bfs_seqno; /* sequence number */
  179. int bfs_tidno; /* tid of this frame */
  180. int bfs_retries; /* current retries */
  181. struct ath_rc_series bfs_rcs[4]; /* rate series */
  182. u32 bf_type; /* BUF_* (enum buffer_type) */
  183. /* key type use to encrypt this frame */
  184. enum ath9k_key_type bfs_keytype;
  185. };
  186. #define bf_nframes bf_state.bfs_nframes
  187. #define bf_al bf_state.bfs_al
  188. #define bf_frmlen bf_state.bfs_frmlen
  189. #define bf_retries bf_state.bfs_retries
  190. #define bf_seqno bf_state.bfs_seqno
  191. #define bf_tidno bf_state.bfs_tidno
  192. #define bf_rcs bf_state.bfs_rcs
  193. #define bf_keytype bf_state.bfs_keytype
  194. #define bf_isdata(bf) (bf->bf_state.bf_type & BUF_DATA)
  195. #define bf_isaggr(bf) (bf->bf_state.bf_type & BUF_AGGR)
  196. #define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU)
  197. #define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT)
  198. #define bf_isretried(bf) (bf->bf_state.bf_type & BUF_RETRY)
  199. #define bf_isxretried(bf) (bf->bf_state.bf_type & BUF_XRETRY)
  200. #define bf_isshpreamble(bf) (bf->bf_state.bf_type & BUF_SHORT_PREAMBLE)
  201. #define bf_isbar(bf) (bf->bf_state.bf_type & BUF_BAR)
  202. #define bf_ispspoll(bf) (bf->bf_state.bf_type & BUF_PSPOLL)
  203. #define bf_isaggrburst(bf) (bf->bf_state.bf_type & BUF_AGGR_BURST)
  204. /*
  205. * Abstraction of a contiguous buffer to transmit/receive. There is only
  206. * a single hw descriptor encapsulated here.
  207. */
  208. struct ath_buf {
  209. struct list_head list;
  210. struct list_head *last;
  211. struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or
  212. an aggregate) */
  213. struct ath_buf *bf_lastfrm; /* last buf of this frame */
  214. struct ath_buf *bf_next; /* next subframe in the aggregate */
  215. struct ath_buf *bf_rifslast; /* last buf for RIFS burst */
  216. void *bf_mpdu; /* enclosing frame structure */
  217. void *bf_node; /* pointer to the node */
  218. struct ath_desc *bf_desc; /* virtual addr of desc */
  219. dma_addr_t bf_daddr; /* physical addr of desc */
  220. dma_addr_t bf_buf_addr; /* physical addr of data buffer */
  221. u32 bf_status;
  222. u16 bf_flags; /* tx descriptor flags */
  223. struct ath_buf_state bf_state; /* buffer state */
  224. dma_addr_t bf_dmacontext;
  225. };
  226. /*
  227. * reset the rx buffer.
  228. * any new fields added to the athbuf and require
  229. * reset need to be added to this macro.
  230. * currently bf_status is the only one requires that
  231. * requires reset.
  232. */
  233. #define ATH_RXBUF_RESET(_bf) ((_bf)->bf_status = 0)
  234. /* hw processing complete, desc processed by hal */
  235. #define ATH_BUFSTATUS_DONE 0x00000001
  236. /* hw processing complete, desc hold for hw */
  237. #define ATH_BUFSTATUS_STALE 0x00000002
  238. /* Rx-only: OS is done with this packet and it's ok to queued it to hw */
  239. #define ATH_BUFSTATUS_FREE 0x00000004
  240. /* DMA state for tx/rx descriptors */
  241. struct ath_descdma {
  242. const char *dd_name;
  243. struct ath_desc *dd_desc; /* descriptors */
  244. dma_addr_t dd_desc_paddr; /* physical addr of dd_desc */
  245. u32 dd_desc_len; /* size of dd_desc */
  246. struct ath_buf *dd_bufptr; /* associated buffers */
  247. dma_addr_t dd_dmacontext;
  248. };
  249. /* Abstraction of a received RX MPDU/MMPDU, or a RX fragment */
  250. struct ath_rx_context {
  251. struct ath_buf *ctx_rxbuf; /* associated ath_buf for rx */
  252. };
  253. #define ATH_RX_CONTEXT(skb) ((struct ath_rx_context *)skb->cb)
  254. int ath_descdma_setup(struct ath_softc *sc,
  255. struct ath_descdma *dd,
  256. struct list_head *head,
  257. const char *name,
  258. int nbuf,
  259. int ndesc);
  260. int ath_desc_alloc(struct ath_softc *sc);
  261. void ath_desc_free(struct ath_softc *sc);
  262. void ath_descdma_cleanup(struct ath_softc *sc,
  263. struct ath_descdma *dd,
  264. struct list_head *head);
  265. /******/
  266. /* RX */
  267. /******/
  268. #define ATH_MAX_ANTENNA 3
  269. #define ATH_RXBUF 512
  270. #define ATH_RX_TIMEOUT 40 /* 40 milliseconds */
  271. #define WME_NUM_TID 16
  272. #define IEEE80211_BAR_CTL_TID_M 0xF000 /* tid mask */
  273. #define IEEE80211_BAR_CTL_TID_S 2 /* tid shift */
  274. enum ATH_RX_TYPE {
  275. ATH_RX_NON_CONSUMED = 0,
  276. ATH_RX_CONSUMED
  277. };
  278. /* per frame rx status block */
  279. struct ath_recv_status {
  280. u64 tsf; /* mac tsf */
  281. int8_t rssi; /* RSSI (noise floor ajusted) */
  282. int8_t rssictl[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */
  283. int8_t rssiextn[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */
  284. int8_t abs_rssi; /* absolute RSSI */
  285. u8 rateieee; /* data rate received (IEEE rate code) */
  286. u8 ratecode; /* phy rate code */
  287. int rateKbps; /* data rate received (Kbps) */
  288. int antenna; /* rx antenna */
  289. int flags; /* status of associated skb */
  290. #define ATH_RX_FCS_ERROR 0x01
  291. #define ATH_RX_MIC_ERROR 0x02
  292. #define ATH_RX_DECRYPT_ERROR 0x04
  293. #define ATH_RX_RSSI_VALID 0x08
  294. /* if any of ctl,extn chainrssis are valid */
  295. #define ATH_RX_CHAIN_RSSI_VALID 0x10
  296. /* if extn chain rssis are valid */
  297. #define ATH_RX_RSSI_EXTN_VALID 0x20
  298. /* set if 40Mhz, clear if 20Mhz */
  299. #define ATH_RX_40MHZ 0x40
  300. /* set if short GI, clear if full GI */
  301. #define ATH_RX_SHORT_GI 0x80
  302. };
  303. struct ath_rxbuf {
  304. struct sk_buff *rx_wbuf;
  305. unsigned long rx_time; /* system time when received */
  306. struct ath_recv_status rx_status; /* cached rx status */
  307. };
  308. /* Per-TID aggregate receiver state for a node */
  309. struct ath_arx_tid {
  310. struct ath_node *an;
  311. struct ath_rxbuf *rxbuf; /* re-ordering buffer */
  312. struct timer_list timer;
  313. spinlock_t tidlock;
  314. int baw_head; /* seq_next at head */
  315. int baw_tail; /* tail of block-ack window */
  316. int seq_reset; /* need to reset start sequence */
  317. int addba_exchangecomplete;
  318. u16 seq_next; /* next expected sequence */
  319. u16 baw_size; /* block-ack window size */
  320. };
  321. /* Per-node receiver aggregate state */
  322. struct ath_arx {
  323. struct ath_arx_tid tid[WME_NUM_TID];
  324. };
  325. int ath_startrecv(struct ath_softc *sc);
  326. bool ath_stoprecv(struct ath_softc *sc);
  327. void ath_flushrecv(struct ath_softc *sc);
  328. u32 ath_calcrxfilter(struct ath_softc *sc);
  329. void ath_rx_node_init(struct ath_softc *sc, struct ath_node *an);
  330. void ath_rx_node_free(struct ath_softc *sc, struct ath_node *an);
  331. void ath_rx_node_cleanup(struct ath_softc *sc, struct ath_node *an);
  332. void ath_handle_rx_intr(struct ath_softc *sc);
  333. int ath_rx_init(struct ath_softc *sc, int nbufs);
  334. void ath_rx_cleanup(struct ath_softc *sc);
  335. int ath_rx_tasklet(struct ath_softc *sc, int flush);
  336. int ath_rx_input(struct ath_softc *sc,
  337. struct ath_node *node,
  338. int is_ampdu,
  339. struct sk_buff *skb,
  340. struct ath_recv_status *rx_status,
  341. enum ATH_RX_TYPE *status);
  342. int _ath_rx_indicate(struct ath_softc *sc,
  343. struct sk_buff *skb,
  344. struct ath_recv_status *status,
  345. u16 keyix);
  346. int ath_rx_subframe(struct ath_node *an, struct sk_buff *skb,
  347. struct ath_recv_status *status);
  348. /******/
  349. /* TX */
  350. /******/
  351. #define ATH_TXBUF 512
  352. /* max number of transmit attempts (tries) */
  353. #define ATH_TXMAXTRY 13
  354. /* max number of 11n transmit attempts (tries) */
  355. #define ATH_11N_TXMAXTRY 10
  356. /* max number of tries for management and control frames */
  357. #define ATH_MGT_TXMAXTRY 4
  358. #define WME_BA_BMP_SIZE 64
  359. #define WME_MAX_BA WME_BA_BMP_SIZE
  360. #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
  361. #define TID_TO_WME_AC(_tid) \
  362. ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
  363. (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
  364. (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
  365. WME_AC_VO)
  366. /* Wireless Multimedia Extension Defines */
  367. #define WME_AC_BE 0 /* best effort */
  368. #define WME_AC_BK 1 /* background */
  369. #define WME_AC_VI 2 /* video */
  370. #define WME_AC_VO 3 /* voice */
  371. #define WME_NUM_AC 4
  372. enum ATH_SM_PWRSAV{
  373. ATH_SM_ENABLE,
  374. ATH_SM_PWRSAV_STATIC,
  375. ATH_SM_PWRSAV_DYNAMIC,
  376. };
  377. /*
  378. * Data transmit queue state. One of these exists for each
  379. * hardware transmit queue. Packets sent to us from above
  380. * are assigned to queues based on their priority. Not all
  381. * devices support a complete set of hardware transmit queues.
  382. * For those devices the array sc_ac2q will map multiple
  383. * priorities to fewer hardware queues (typically all to one
  384. * hardware queue).
  385. */
  386. struct ath_txq {
  387. u32 axq_qnum; /* hardware q number */
  388. u32 *axq_link; /* link ptr in last TX desc */
  389. struct list_head axq_q; /* transmit queue */
  390. spinlock_t axq_lock;
  391. unsigned long axq_lockflags; /* intr state when must cli */
  392. u32 axq_depth; /* queue depth */
  393. u8 axq_aggr_depth; /* aggregates queued */
  394. u32 axq_totalqueued; /* total ever queued */
  395. /* count to determine if descriptor should generate int on this txq. */
  396. u32 axq_intrcnt;
  397. bool stopped; /* Is mac80211 queue stopped ? */
  398. struct ath_buf *axq_linkbuf; /* virtual addr of last buffer*/
  399. /* first desc of the last descriptor that contains CTS */
  400. struct ath_desc *axq_lastdsWithCTS;
  401. /* final desc of the gating desc that determines whether
  402. lastdsWithCTS has been DMA'ed or not */
  403. struct ath_desc *axq_gatingds;
  404. struct list_head axq_acq;
  405. };
  406. /* per TID aggregate tx state for a destination */
  407. struct ath_atx_tid {
  408. struct list_head list; /* round-robin tid entry */
  409. struct list_head buf_q; /* pending buffers */
  410. struct ath_node *an;
  411. struct ath_atx_ac *ac;
  412. struct ath_buf *tx_buf[ATH_TID_MAX_BUFS]; /* active tx frames */
  413. u16 seq_start;
  414. u16 seq_next;
  415. u16 baw_size;
  416. int tidno;
  417. int baw_head; /* first un-acked tx buffer */
  418. int baw_tail; /* next unused tx buffer slot */
  419. int sched;
  420. int paused;
  421. int cleanup_inprogress;
  422. u32 addba_exchangecomplete:1;
  423. int32_t addba_exchangeinprogress;
  424. int addba_exchangeattempts;
  425. };
  426. /* per access-category aggregate tx state for a destination */
  427. struct ath_atx_ac {
  428. int sched; /* dest-ac is scheduled */
  429. int qnum; /* H/W queue number associated
  430. with this AC */
  431. struct list_head list; /* round-robin txq entry */
  432. struct list_head tid_q; /* queue of TIDs with buffers */
  433. };
  434. /* per dest tx state */
  435. struct ath_atx {
  436. struct ath_atx_tid tid[WME_NUM_TID];
  437. struct ath_atx_ac ac[WME_NUM_AC];
  438. };
  439. /* per-frame tx control block */
  440. struct ath_tx_control {
  441. struct ath_node *an;
  442. int if_id;
  443. int qnum;
  444. u32 ht:1;
  445. u32 ps:1;
  446. u32 use_minrate:1;
  447. enum ath9k_pkt_type atype;
  448. enum ath9k_key_type keytype;
  449. u32 flags;
  450. u16 seqno;
  451. u16 tidno;
  452. u16 txpower;
  453. u16 frmlen;
  454. u32 keyix;
  455. int min_rate;
  456. int mcast_rate;
  457. u16 nextfraglen;
  458. struct ath_softc *dev;
  459. dma_addr_t dmacontext;
  460. };
  461. /* per frame tx status block */
  462. struct ath_xmit_status {
  463. int retries; /* number of retries to successufully
  464. transmit this frame */
  465. int flags; /* status of transmit */
  466. #define ATH_TX_ERROR 0x01
  467. #define ATH_TX_XRETRY 0x02
  468. #define ATH_TX_BAR 0x04
  469. };
  470. struct ath_tx_stat {
  471. int rssi; /* RSSI (noise floor ajusted) */
  472. int rssictl[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */
  473. int rssiextn[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */
  474. int rateieee; /* data rate xmitted (IEEE rate code) */
  475. int rateKbps; /* data rate xmitted (Kbps) */
  476. int ratecode; /* phy rate code */
  477. int flags; /* validity flags */
  478. /* if any of ctl,extn chain rssis are valid */
  479. #define ATH_TX_CHAIN_RSSI_VALID 0x01
  480. /* if extn chain rssis are valid */
  481. #define ATH_TX_RSSI_EXTN_VALID 0x02
  482. u32 airtime; /* time on air per final tx rate */
  483. };
  484. struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype);
  485. void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq);
  486. int ath_tx_setup(struct ath_softc *sc, int haltype);
  487. void ath_draintxq(struct ath_softc *sc, bool retry_tx);
  488. void ath_tx_draintxq(struct ath_softc *sc,
  489. struct ath_txq *txq, bool retry_tx);
  490. void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an);
  491. void ath_tx_node_cleanup(struct ath_softc *sc,
  492. struct ath_node *an, bool bh_flag);
  493. void ath_tx_node_free(struct ath_softc *sc, struct ath_node *an);
  494. void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq);
  495. int ath_tx_init(struct ath_softc *sc, int nbufs);
  496. int ath_tx_cleanup(struct ath_softc *sc);
  497. int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype);
  498. int ath_txq_update(struct ath_softc *sc, int qnum,
  499. struct ath9k_tx_queue_info *q);
  500. int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb);
  501. void ath_tx_tasklet(struct ath_softc *sc);
  502. u32 ath_txq_depth(struct ath_softc *sc, int qnum);
  503. u32 ath_txq_aggr_depth(struct ath_softc *sc, int qnum);
  504. void ath_notify_txq_status(struct ath_softc *sc, u16 queue_depth);
  505. void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  506. struct ath_xmit_status *tx_status, struct ath_node *an);
  507. void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb);
  508. /**********************/
  509. /* Node / Aggregation */
  510. /**********************/
  511. /* indicates the node is clened up */
  512. #define ATH_NODE_CLEAN 0x1
  513. /* indicates the node is 80211 power save */
  514. #define ATH_NODE_PWRSAVE 0x2
  515. #define ADDBA_EXCHANGE_ATTEMPTS 10
  516. #define ATH_AGGR_DELIM_SZ 4 /* delimiter size */
  517. #define ATH_AGGR_MINPLEN 256 /* in bytes, minimum packet length */
  518. /* number of delimiters for encryption padding */
  519. #define ATH_AGGR_ENCRYPTDELIM 10
  520. /* minimum h/w qdepth to be sustained to maximize aggregation */
  521. #define ATH_AGGR_MIN_QDEPTH 2
  522. #define ATH_AMPDU_SUBFRAME_DEFAULT 32
  523. #define IEEE80211_SEQ_SEQ_SHIFT 4
  524. #define IEEE80211_SEQ_MAX 4096
  525. #define IEEE80211_MIN_AMPDU_BUF 0x8
  526. /* return whether a bit at index _n in bitmap _bm is set
  527. * _sz is the size of the bitmap */
  528. #define ATH_BA_ISSET(_bm, _n) (((_n) < (WME_BA_BMP_SIZE)) && \
  529. ((_bm)[(_n) >> 5] & (1 << ((_n) & 31))))
  530. /* return block-ack bitmap index given sequence and starting sequence */
  531. #define ATH_BA_INDEX(_st, _seq) (((_seq) - (_st)) & (IEEE80211_SEQ_MAX - 1))
  532. /* returns delimiter padding required given the packet length */
  533. #define ATH_AGGR_GET_NDELIM(_len) \
  534. (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ? \
  535. (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2)
  536. #define BAW_WITHIN(_start, _bawsz, _seqno) \
  537. ((((_seqno) - (_start)) & 4095) < (_bawsz))
  538. #define ATH_DS_BA_SEQ(_ds) ((_ds)->ds_us.tx.ts_seqnum)
  539. #define ATH_DS_BA_BITMAP(_ds) (&(_ds)->ds_us.tx.ba_low)
  540. #define ATH_DS_TX_BA(_ds) ((_ds)->ds_us.tx.ts_flags & ATH9K_TX_BA)
  541. #define ATH_AN_2_TID(_an, _tidno) (&(_an)->an_aggr.tx.tid[(_tidno)])
  542. enum ATH_AGGR_STATUS {
  543. ATH_AGGR_DONE,
  544. ATH_AGGR_BAW_CLOSED,
  545. ATH_AGGR_LIMITED,
  546. ATH_AGGR_SHORTPKT,
  547. ATH_AGGR_8K_LIMITED,
  548. };
  549. enum ATH_AGGR_CHECK {
  550. AGGR_NOT_REQUIRED,
  551. AGGR_REQUIRED,
  552. AGGR_CLEANUP_PROGRESS,
  553. AGGR_EXCHANGE_PROGRESS,
  554. AGGR_EXCHANGE_DONE
  555. };
  556. struct aggr_rifs_param {
  557. int param_max_frames;
  558. int param_max_len;
  559. int param_rl;
  560. int param_al;
  561. struct ath_rc_series *param_rcs;
  562. };
  563. /* Per-node aggregation state */
  564. struct ath_node_aggr {
  565. struct ath_atx tx; /* node transmit state */
  566. struct ath_arx rx; /* node receive state */
  567. };
  568. /* driver-specific node state */
  569. struct ath_node {
  570. struct list_head list;
  571. struct ath_softc *an_sc;
  572. atomic_t an_refcnt;
  573. struct ath_chainmask_sel an_chainmask_sel;
  574. struct ath_node_aggr an_aggr;
  575. u8 an_smmode; /* SM Power save mode */
  576. u8 an_flags;
  577. u8 an_addr[ETH_ALEN];
  578. };
  579. void ath_tx_resume_tid(struct ath_softc *sc,
  580. struct ath_atx_tid *tid);
  581. enum ATH_AGGR_CHECK ath_tx_aggr_check(struct ath_softc *sc,
  582. struct ath_node *an, u8 tidno);
  583. void ath_tx_aggr_teardown(struct ath_softc *sc,
  584. struct ath_node *an, u8 tidno);
  585. void ath_rx_aggr_teardown(struct ath_softc *sc,
  586. struct ath_node *an, u8 tidno);
  587. int ath_rx_aggr_start(struct ath_softc *sc,
  588. const u8 *addr,
  589. u16 tid,
  590. u16 *ssn);
  591. int ath_rx_aggr_stop(struct ath_softc *sc,
  592. const u8 *addr,
  593. u16 tid);
  594. int ath_tx_aggr_start(struct ath_softc *sc,
  595. const u8 *addr,
  596. u16 tid,
  597. u16 *ssn);
  598. int ath_tx_aggr_stop(struct ath_softc *sc,
  599. const u8 *addr,
  600. u16 tid);
  601. void ath_newassoc(struct ath_softc *sc,
  602. struct ath_node *node, int isnew, int isuapsd);
  603. struct ath_node *ath_node_attach(struct ath_softc *sc,
  604. u8 addr[ETH_ALEN], int if_id);
  605. void ath_node_detach(struct ath_softc *sc, struct ath_node *an, bool bh_flag);
  606. struct ath_node *ath_node_get(struct ath_softc *sc, u8 addr[ETH_ALEN]);
  607. void ath_node_put(struct ath_softc *sc, struct ath_node *an, bool bh_flag);
  608. struct ath_node *ath_node_find(struct ath_softc *sc, u8 *addr);
  609. /*******************/
  610. /* Beacon Handling */
  611. /*******************/
  612. /*
  613. * Regardless of the number of beacons we stagger, (i.e. regardless of the
  614. * number of BSSIDs) if a given beacon does not go out even after waiting this
  615. * number of beacon intervals, the game's up.
  616. */
  617. #define BSTUCK_THRESH (9 * ATH_BCBUF)
  618. #define ATH_BCBUF 4 /* number of beacon buffers */
  619. #define ATH_DEFAULT_BINTVAL 100 /* default beacon interval in TU */
  620. #define ATH_DEFAULT_BMISS_LIMIT 10
  621. #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  622. /* beacon configuration */
  623. struct ath_beacon_config {
  624. u16 beacon_interval;
  625. u16 listen_interval;
  626. u16 dtim_period;
  627. u16 bmiss_timeout;
  628. u8 dtim_count;
  629. u8 tim_offset;
  630. union {
  631. u64 last_tsf;
  632. u8 last_tstamp[8];
  633. } u; /* last received beacon/probe response timestamp of this BSS. */
  634. };
  635. void ath9k_beacon_tasklet(unsigned long data);
  636. void ath_beacon_config(struct ath_softc *sc, int if_id);
  637. int ath_beaconq_setup(struct ath_hal *ah);
  638. int ath_beacon_alloc(struct ath_softc *sc, int if_id);
  639. void ath_bstuck_process(struct ath_softc *sc);
  640. void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp);
  641. void ath_beacon_sync(struct ath_softc *sc, int if_id);
  642. void ath_get_beaconconfig(struct ath_softc *sc,
  643. int if_id,
  644. struct ath_beacon_config *conf);
  645. /********/
  646. /* VAPs */
  647. /********/
  648. /*
  649. * Define the scheme that we select MAC address for multiple
  650. * BSS on the same radio. The very first VAP will just use the MAC
  651. * address from the EEPROM. For the next 3 VAPs, we set the
  652. * U/L bit (bit 1) in MAC address, and use the next two bits as the
  653. * index of the VAP.
  654. */
  655. #define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
  656. ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
  657. /* VAP configuration (from protocol layer) */
  658. struct ath_vap_config {
  659. u32 av_fixed_rateset;
  660. u32 av_fixed_retryset;
  661. };
  662. /* driver-specific vap state */
  663. struct ath_vap {
  664. struct ieee80211_vif *av_if_data;
  665. enum ath9k_opmode av_opmode; /* VAP operational mode */
  666. struct ath_buf *av_bcbuf; /* beacon buffer */
  667. struct ath_tx_control av_btxctl; /* txctl information for beacon */
  668. int av_bslot; /* beacon slot index */
  669. struct ath_vap_config av_config;/* vap configuration parameters*/
  670. struct ath_rate_node *rc_node;
  671. };
  672. int ath_vap_attach(struct ath_softc *sc,
  673. int if_id,
  674. struct ieee80211_vif *if_data,
  675. enum ath9k_opmode opmode);
  676. int ath_vap_detach(struct ath_softc *sc, int if_id);
  677. int ath_vap_config(struct ath_softc *sc,
  678. int if_id, struct ath_vap_config *if_config);
  679. /*********************/
  680. /* Antenna diversity */
  681. /*********************/
  682. #define ATH_ANT_DIV_MAX_CFG 2
  683. #define ATH_ANT_DIV_MIN_IDLE_US 1000000 /* us */
  684. #define ATH_ANT_DIV_MIN_SCAN_US 50000 /* us */
  685. enum ATH_ANT_DIV_STATE{
  686. ATH_ANT_DIV_IDLE,
  687. ATH_ANT_DIV_SCAN, /* evaluating antenna */
  688. };
  689. struct ath_antdiv {
  690. struct ath_softc *antdiv_sc;
  691. u8 antdiv_start;
  692. enum ATH_ANT_DIV_STATE antdiv_state;
  693. u8 antdiv_num_antcfg;
  694. u8 antdiv_curcfg;
  695. u8 antdiv_bestcfg;
  696. int32_t antdivf_rssitrig;
  697. int32_t antdiv_lastbrssi[ATH_ANT_DIV_MAX_CFG];
  698. u64 antdiv_lastbtsf[ATH_ANT_DIV_MAX_CFG];
  699. u64 antdiv_laststatetsf;
  700. u8 antdiv_bssid[ETH_ALEN];
  701. };
  702. void ath_slow_ant_div_init(struct ath_antdiv *antdiv,
  703. struct ath_softc *sc, int32_t rssitrig);
  704. void ath_slow_ant_div_start(struct ath_antdiv *antdiv,
  705. u8 num_antcfg,
  706. const u8 *bssid);
  707. void ath_slow_ant_div_stop(struct ath_antdiv *antdiv);
  708. void ath_slow_ant_div(struct ath_antdiv *antdiv,
  709. struct ieee80211_hdr *wh,
  710. struct ath_rx_status *rx_stats);
  711. void ath_setdefantenna(void *sc, u32 antenna);
  712. /********************/
  713. /* LED Control */
  714. /********************/
  715. #define ATH_LED_PIN 1
  716. enum ath_led_type {
  717. ATH_LED_RADIO,
  718. ATH_LED_ASSOC,
  719. ATH_LED_TX,
  720. ATH_LED_RX
  721. };
  722. struct ath_led {
  723. struct ath_softc *sc;
  724. struct led_classdev led_cdev;
  725. enum ath_led_type led_type;
  726. char name[32];
  727. bool registered;
  728. };
  729. /********************/
  730. /* Main driver core */
  731. /********************/
  732. /*
  733. * Default cache line size, in bytes.
  734. * Used when PCI device not fully initialized by bootrom/BIOS
  735. */
  736. #define DEFAULT_CACHELINE 32
  737. #define ATH_DEFAULT_NOISE_FLOOR -95
  738. #define ATH_REGCLASSIDS_MAX 10
  739. #define ATH_CABQ_READY_TIME 80 /* % of beacon interval */
  740. #define ATH_MAX_SW_RETRIES 10
  741. #define ATH_CHAN_MAX 255
  742. #define IEEE80211_WEP_NKID 4 /* number of key ids */
  743. #define IEEE80211_RATE_VAL 0x7f
  744. /*
  745. * The key cache is used for h/w cipher state and also for
  746. * tracking station state such as the current tx antenna.
  747. * We also setup a mapping table between key cache slot indices
  748. * and station state to short-circuit node lookups on rx.
  749. * Different parts have different size key caches. We handle
  750. * up to ATH_KEYMAX entries (could dynamically allocate state).
  751. */
  752. #define ATH_KEYMAX 128 /* max key cache size we handle */
  753. #define ATH_IF_ID_ANY 0xff
  754. #define ATH_TXPOWER_MAX 100 /* .5 dBm units */
  755. #define RSSI_LPF_THRESHOLD -20
  756. #define ATH_RSSI_EP_MULTIPLIER (1<<7) /* pow2 to optimize out * and / */
  757. #define ATH_RATE_DUMMY_MARKER 0
  758. #define ATH_RSSI_LPF_LEN 10
  759. #define ATH_RSSI_DUMMY_MARKER 0x127
  760. #define ATH_EP_MUL(x, mul) ((x) * (mul))
  761. #define ATH_EP_RND(x, mul) \
  762. ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
  763. #define ATH_RSSI_OUT(x) \
  764. (((x) != ATH_RSSI_DUMMY_MARKER) ? \
  765. (ATH_EP_RND((x), ATH_RSSI_EP_MULTIPLIER)) : ATH_RSSI_DUMMY_MARKER)
  766. #define ATH_RSSI_IN(x) \
  767. (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
  768. #define ATH_LPF_RSSI(x, y, len) \
  769. ((x != ATH_RSSI_DUMMY_MARKER) ? \
  770. (((x) * ((len) - 1) + (y)) / (len)) : (y))
  771. #define ATH_RSSI_LPF(x, y) do { \
  772. if ((y) >= RSSI_LPF_THRESHOLD) \
  773. x = ATH_LPF_RSSI((x), \
  774. ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \
  775. } while (0)
  776. enum PROT_MODE {
  777. PROT_M_NONE = 0,
  778. PROT_M_RTSCTS,
  779. PROT_M_CTSONLY
  780. };
  781. enum RATE_TYPE {
  782. NORMAL_RATE = 0,
  783. HALF_RATE,
  784. QUARTER_RATE
  785. };
  786. struct ath_ht_info {
  787. enum ath9k_ht_macmode tx_chan_width;
  788. u16 maxampdu;
  789. u8 mpdudensity;
  790. u8 ext_chan_offset;
  791. };
  792. #define SC_OP_INVALID BIT(0)
  793. #define SC_OP_BEACONS BIT(1)
  794. #define SC_OP_RXAGGR BIT(2)
  795. #define SC_OP_TXAGGR BIT(3)
  796. #define SC_OP_CHAINMASK_UPDATE BIT(4)
  797. #define SC_OP_FULL_RESET BIT(5)
  798. #define SC_OP_NO_RESET BIT(6)
  799. #define SC_OP_PREAMBLE_SHORT BIT(7)
  800. #define SC_OP_PROTECT_ENABLE BIT(8)
  801. #define SC_OP_RXFLUSH BIT(9)
  802. #define SC_OP_LED_ASSOCIATED BIT(10)
  803. struct ath_softc {
  804. struct ieee80211_hw *hw;
  805. struct pci_dev *pdev;
  806. struct tasklet_struct intr_tq;
  807. struct tasklet_struct bcon_tasklet;
  808. struct ath_config sc_config;
  809. struct ath_hal *sc_ah;
  810. struct ath_rate_softc *sc_rc;
  811. void __iomem *mem;
  812. u8 sc_curbssid[ETH_ALEN];
  813. u8 sc_myaddr[ETH_ALEN];
  814. u8 sc_bssidmask[ETH_ALEN];
  815. int sc_debug;
  816. u32 sc_intrstatus;
  817. u32 sc_flags; /* SC_OP_* */
  818. unsigned int rx_filter;
  819. u16 sc_curtxpow;
  820. u16 sc_curaid;
  821. u16 sc_cachelsz;
  822. int sc_slotupdate; /* slot to next advance fsm */
  823. int sc_slottime;
  824. int sc_bslot[ATH_BCBUF];
  825. u8 sc_tx_chainmask;
  826. u8 sc_rx_chainmask;
  827. enum ath9k_int sc_imask;
  828. enum wireless_mode sc_curmode; /* current phy mode */
  829. enum PROT_MODE sc_protmode;
  830. u8 sc_nbcnvaps; /* # of vaps sending beacons */
  831. u16 sc_nvaps; /* # of active virtual ap's */
  832. struct ath_vap *sc_vaps[ATH_BCBUF];
  833. u8 sc_mcastantenna;
  834. u8 sc_defant; /* current default antenna */
  835. u8 sc_rxotherant; /* rx's on non-default antenna */
  836. struct ath9k_node_stats sc_halstats; /* station-mode rssi stats */
  837. struct list_head node_list;
  838. struct ath_ht_info sc_ht_info;
  839. enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
  840. #ifdef CONFIG_SLOW_ANT_DIV
  841. struct ath_antdiv sc_antdiv;
  842. #endif
  843. enum {
  844. OK, /* no change needed */
  845. UPDATE, /* update pending */
  846. COMMIT /* beacon sent, commit change */
  847. } sc_updateslot; /* slot time update fsm */
  848. /* Crypto */
  849. u32 sc_keymax; /* size of key cache */
  850. DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); /* key use bit map */
  851. u8 sc_splitmic; /* split TKIP MIC keys */
  852. int sc_keytype;
  853. /* RX */
  854. struct list_head sc_rxbuf;
  855. struct ath_descdma sc_rxdma;
  856. int sc_rxbufsize; /* rx size based on mtu */
  857. u32 *sc_rxlink; /* link ptr in last RX desc */
  858. u64 sc_lastrx; /* tsf of last rx'd frame */
  859. /* TX */
  860. struct list_head sc_txbuf;
  861. struct ath_txq sc_txq[ATH9K_NUM_TX_QUEUES];
  862. struct ath_descdma sc_txdma;
  863. u32 sc_txqsetup;
  864. u32 sc_txintrperiod; /* tx interrupt batching */
  865. int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */
  866. u16 seq_no; /* TX sequence number */
  867. /* Beacon */
  868. struct ath9k_tx_queue_info sc_beacon_qi;
  869. struct ath_descdma sc_bdma;
  870. struct ath_txq *sc_cabq;
  871. struct list_head sc_bbuf;
  872. u32 sc_bhalq;
  873. u32 sc_bmisscount;
  874. u32 ast_be_xmit; /* beacons transmitted */
  875. /* Rate */
  876. struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
  877. const struct ath9k_rate_table *sc_currates;
  878. u8 sc_rixmap[256]; /* IEEE to h/w rate table ix */
  879. u8 sc_protrix; /* protection rate index */
  880. struct {
  881. u32 rateKbps; /* transfer rate in kbs */
  882. u8 ieeerate; /* IEEE rate */
  883. } sc_hwmap[256]; /* h/w rate ix mappings */
  884. /* Channel, Band */
  885. struct ieee80211_channel channels[IEEE80211_NUM_BANDS][ATH_CHAN_MAX];
  886. struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
  887. /* Locks */
  888. spinlock_t sc_rxflushlock;
  889. spinlock_t sc_rxbuflock;
  890. spinlock_t sc_txbuflock;
  891. spinlock_t sc_resetlock;
  892. spinlock_t node_lock;
  893. /* LEDs */
  894. struct ath_led radio_led;
  895. struct ath_led assoc_led;
  896. struct ath_led tx_led;
  897. struct ath_led rx_led;
  898. };
  899. int ath_init(u16 devid, struct ath_softc *sc);
  900. void ath_deinit(struct ath_softc *sc);
  901. int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan);
  902. int ath_suspend(struct ath_softc *sc);
  903. irqreturn_t ath_isr(int irq, void *dev);
  904. int ath_reset(struct ath_softc *sc, bool retry_tx);
  905. int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan);
  906. /*********************/
  907. /* Utility Functions */
  908. /*********************/
  909. void ath_key_reset(struct ath_softc *sc, u16 keyix, int freeslot);
  910. int ath_keyset(struct ath_softc *sc,
  911. u16 keyix,
  912. struct ath9k_keyval *hk,
  913. const u8 mac[ETH_ALEN]);
  914. int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
  915. int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
  916. void ath_setslottime(struct ath_softc *sc);
  917. void ath_update_txpow(struct ath_softc *sc);
  918. int ath_cabq_update(struct ath_softc *);
  919. void ath_get_currentCountry(struct ath_softc *sc,
  920. struct ath9k_country_entry *ctry);
  921. u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp);
  922. #endif /* CORE_H */