aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath9k/core.h275
1 files changed, 130 insertions, 145 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 903bd4624c6e..e294c1b8ddb5 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -51,24 +51,24 @@ struct ath_node;
51 51
52/* Macro to expand scalars to 64-bit objects */ 52/* Macro to expand scalars to 64-bit objects */
53 53
54#define ito64(x) (sizeof(x) == 8) ? \ 54#define ito64(x) (sizeof(x) == 8) ? \
55 (((unsigned long long int)(x)) & (0xff)) : \ 55 (((unsigned long long int)(x)) & (0xff)) : \
56 (sizeof(x) == 16) ? \ 56 (sizeof(x) == 16) ? \
57 (((unsigned long long int)(x)) & 0xffff) : \ 57 (((unsigned long long int)(x)) & 0xffff) : \
58 ((sizeof(x) == 32) ? \ 58 ((sizeof(x) == 32) ? \
59 (((unsigned long long int)(x)) & 0xffffffff) : \ 59 (((unsigned long long int)(x)) & 0xffffffff) : \
60 (unsigned long long int)(x)) 60 (unsigned long long int)(x))
61 61
62/* increment with wrap-around */ 62/* increment with wrap-around */
63#define INCR(_l, _sz) do { \ 63#define INCR(_l, _sz) do { \
64 (_l)++; \ 64 (_l)++; \
65 (_l) &= ((_sz) - 1); \ 65 (_l) &= ((_sz) - 1); \
66 } while (0) 66 } while (0)
67 67
68/* decrement with wrap-around */ 68/* decrement with wrap-around */
69#define DECR(_l, _sz) do { \ 69#define DECR(_l, _sz) do { \
70 (_l)--; \ 70 (_l)--; \
71 (_l) &= ((_sz) - 1); \ 71 (_l) &= ((_sz) - 1); \
72 } while (0) 72 } while (0)
73 73
74#define A_MAX(a, b) ((a) > (b) ? (a) : (b)) 74#define A_MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -136,12 +136,11 @@ enum ATH_DEBUG {
136/* Per-instance load-time (note: NOT run-time) configurations 136/* Per-instance load-time (note: NOT run-time) configurations
137 * for Atheros Device */ 137 * for Atheros Device */
138struct ath_config { 138struct ath_config {
139 u32 ath_aggr_prot; 139 u32 ath_aggr_prot;
140 u16 txpowlimit; 140 u16 txpowlimit;
141 u16 txpowlimit_override; 141 u16 txpowlimit_override;
142 u8 cabqReadytime; /* Cabq Readytime % */ 142 u8 cabqReadytime; /* Cabq Readytime % */
143 u8 swBeaconProcess; /* Process received beacons 143 u8 swBeaconProcess; /* Process received beacons in SW (vs HW) */
144 in SW (vs HW) */
145}; 144};
146 145
147/***********************/ 146/***********************/
@@ -161,12 +160,12 @@ struct ath_config {
161#define ATH_CHAINMASK_SEL_DOWN_RSSI_THRES 35 160#define ATH_CHAINMASK_SEL_DOWN_RSSI_THRES 35
162/* Struct to store the chainmask select related info */ 161/* Struct to store the chainmask select related info */
163struct ath_chainmask_sel { 162struct ath_chainmask_sel {
164 struct timer_list timer; 163 struct timer_list timer;
165 int cur_tx_mask; /* user configured or 3x3 */ 164 int cur_tx_mask; /* user configured or 3x3 */
166 int cur_rx_mask; /* user configured or 3x3 */ 165 int cur_rx_mask; /* user configured or 3x3 */
167 int tx_avgrssi; 166 int tx_avgrssi;
168 u8 switch_allowed:1, /* timer will set this */ 167 u8 switch_allowed:1, /* timer will set this */
169 cm_sel_enabled:1; 168 cm_sel_enabled : 1;
170}; 169};
171 170
172int ath_chainmask_sel_logic(struct ath_softc *sc, struct ath_node *an); 171int ath_chainmask_sel_logic(struct ath_softc *sc, struct ath_node *an);
@@ -192,8 +191,8 @@ chains is due to FF aggregation in the driver. */
192 191
193struct ath_buf_state { 192struct ath_buf_state {
194 int bfs_nframes; /* # frames in aggregate */ 193 int bfs_nframes; /* # frames in aggregate */
195 u16 bfs_al; /* length of aggregate */ 194 u16 bfs_al; /* length of aggregate */
196 u16 bfs_frmlen; /* length of frame */ 195 u16 bfs_frmlen; /* length of frame */
197 int bfs_seqno; /* sequence number */ 196 int bfs_seqno; /* sequence number */
198 int bfs_tidno; /* tid of this frame */ 197 int bfs_tidno; /* tid of this frame */
199 int bfs_retries; /* current retries */ 198 int bfs_retries; /* current retries */
@@ -205,7 +204,7 @@ struct ath_buf_state {
205 u8 bfs_isretried:1; /* is retried */ 204 u8 bfs_isretried:1; /* is retried */
206 u8 bfs_isxretried:1; /* is excessive retried */ 205 u8 bfs_isxretried:1; /* is excessive retried */
207 u8 bfs_shpreamble:1; /* is short preamble */ 206 u8 bfs_shpreamble:1; /* is short preamble */
208 u8 bfs_isbar:1; /* is a BAR */ 207 u8 bfs_isbar:1; /* is a BAR */
209 u8 bfs_ispspoll:1; /* is a PS-Poll */ 208 u8 bfs_ispspoll:1; /* is a PS-Poll */
210 u8 bfs_aggrburst:1; /* is a aggr burst */ 209 u8 bfs_aggrburst:1; /* is a aggr burst */
211 u8 bfs_calcairtime:1; /* requests airtime be calculated 210 u8 bfs_calcairtime:1; /* requests airtime be calculated
@@ -247,7 +246,7 @@ struct ath_buf {
247 struct list_head list; 246 struct list_head list;
248 struct list_head *last; 247 struct list_head *last;
249 struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or 248 struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or
250 an aggregate) */ 249 an aggregate) */
251 struct ath_buf *bf_lastfrm; /* last buf of this frame */ 250 struct ath_buf *bf_lastfrm; /* last buf of this frame */
252 struct ath_buf *bf_next; /* next subframe in the aggregate */ 251 struct ath_buf *bf_next; /* next subframe in the aggregate */
253 struct ath_buf *bf_rifslast; /* last buf for RIFS burst */ 252 struct ath_buf *bf_rifslast; /* last buf for RIFS burst */
@@ -257,7 +256,7 @@ struct ath_buf {
257 dma_addr_t bf_daddr; /* physical addr of desc */ 256 dma_addr_t bf_daddr; /* physical addr of desc */
258 dma_addr_t bf_buf_addr; /* physical addr of data buffer */ 257 dma_addr_t bf_buf_addr; /* physical addr of data buffer */
259 u32 bf_status; 258 u32 bf_status;
260 u16 bf_flags; /* tx descriptor flags */ 259 u16 bf_flags; /* tx descriptor flags */
261 struct ath_buf_state bf_state; /* buffer state */ 260 struct ath_buf_state bf_state; /* buffer state */
262 dma_addr_t bf_dmacontext; 261 dma_addr_t bf_dmacontext;
263}; 262};
@@ -331,8 +330,8 @@ struct ath_recv_status {
331 int8_t rssictl[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */ 330 int8_t rssictl[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */
332 int8_t rssiextn[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */ 331 int8_t rssiextn[ATH_MAX_ANTENNA]; /* RSSI (noise floor ajusted) */
333 int8_t abs_rssi; /* absolute RSSI */ 332 int8_t abs_rssi; /* absolute RSSI */
334 u8 rateieee; /* data rate received (IEEE rate code) */ 333 u8 rateieee; /* data rate received (IEEE rate code) */
335 u8 ratecode; /* phy rate code */ 334 u8 ratecode; /* phy rate code */
336 int rateKbps; /* data rate received (Kbps) */ 335 int rateKbps; /* data rate received (Kbps) */
337 int antenna; /* rx antenna */ 336 int antenna; /* rx antenna */
338 int flags; /* status of associated skb */ 337 int flags; /* status of associated skb */
@@ -351,28 +350,28 @@ struct ath_recv_status {
351}; 350};
352 351
353struct ath_rxbuf { 352struct ath_rxbuf {
354 struct sk_buff *rx_wbuf; /* buffer */ 353 struct sk_buff *rx_wbuf;
355 unsigned long rx_time; /* system time when received */ 354 unsigned long rx_time; /* system time when received */
356 struct ath_recv_status rx_status; /* cached rx status */ 355 struct ath_recv_status rx_status; /* cached rx status */
357}; 356};
358 357
359/* Per-TID aggregate receiver state for a node */ 358/* Per-TID aggregate receiver state for a node */
360struct ath_arx_tid { 359struct ath_arx_tid {
361 struct ath_node *an; /* parent ath node */ 360 struct ath_node *an;
362 struct ath_rxbuf *rxbuf; /* re-ordering buffer */ 361 struct ath_rxbuf *rxbuf; /* re-ordering buffer */
363 struct timer_list timer; 362 struct timer_list timer;
364 spinlock_t tidlock; /* lock to protect this TID structure */ 363 spinlock_t tidlock;
365 int baw_head; /* seq_next at head */ 364 int baw_head; /* seq_next at head */
366 int baw_tail; /* tail of block-ack window */ 365 int baw_tail; /* tail of block-ack window */
367 int seq_reset; /* need to reset start sequence */ 366 int seq_reset; /* need to reset start sequence */
368 int addba_exchangecomplete; 367 int addba_exchangecomplete;
369 u16 seq_next; /* next expected sequence */ 368 u16 seq_next; /* next expected sequence */
370 u16 baw_size; /* block-ack window size */ 369 u16 baw_size; /* block-ack window size */
371}; 370};
372 371
373/* Per-node receiver aggregate state */ 372/* Per-node receiver aggregate state */
374struct ath_arx { 373struct ath_arx {
375 struct ath_arx_tid tid[WME_NUM_TID]; 374 struct ath_arx_tid tid[WME_NUM_TID];
376}; 375};
377 376
378int ath_startrecv(struct ath_softc *sc); 377int ath_startrecv(struct ath_softc *sc);
@@ -444,96 +443,95 @@ enum ATH_SM_PWRSAV{
444 * hardware queue). 443 * hardware queue).
445 */ 444 */
446struct ath_txq { 445struct ath_txq {
447 u32 axq_qnum; /* hardware q number */ 446 u32 axq_qnum; /* hardware q number */
448 u32 *axq_link; /* link ptr in last TX desc */ 447 u32 *axq_link; /* link ptr in last TX desc */
449 struct list_head axq_q; /* transmit queue */ 448 struct list_head axq_q; /* transmit queue */
450 spinlock_t axq_lock; /* lock on q and link */ 449 spinlock_t axq_lock;
451 unsigned long axq_lockflags; /* intr state when must cli */ 450 unsigned long axq_lockflags; /* intr state when must cli */
452 u32 axq_depth; /* queue depth */ 451 u32 axq_depth; /* queue depth */
453 u8 axq_aggr_depth; /* aggregates queued */ 452 u8 axq_aggr_depth; /* aggregates queued */
454 u32 axq_totalqueued;/* total ever queued */ 453 u32 axq_totalqueued; /* total ever queued */
455 u32 axq_intrcnt; /* count to determine 454
456 if descriptor should generate 455 /* count to determine if descriptor should generate int on this txq. */
457 int on this txq. */ 456 u32 axq_intrcnt;
458 bool stopped; /* Is mac80211 queue 457
459 stopped ? */ 458 bool stopped; /* Is mac80211 queue stopped ? */
460 /* State for patching up CTS when bursting */ 459 struct ath_buf *axq_linkbuf; /* virtual addr of last buffer*/
461 struct ath_buf *axq_linkbuf; /* virtual addr of last buffer*/ 460
462 struct ath_desc *axq_lastdsWithCTS; /* first desc of the 461 /* first desc of the last descriptor that contains CTS */
463 last descriptor that contains CTS */ 462 struct ath_desc *axq_lastdsWithCTS;
464 struct ath_desc *axq_gatingds; /* final desc of the gating desc 463
465 * that determines whether lastdsWithCTS has 464 /* final desc of the gating desc that determines whether
466 * been DMA'ed or not */ 465 lastdsWithCTS has been DMA'ed or not */
467 struct list_head axq_acq; 466 struct ath_desc *axq_gatingds;
467
468 struct list_head axq_acq;
468}; 469};
469 470
470/* per TID aggregate tx state for a destination */ 471/* per TID aggregate tx state for a destination */
471struct ath_atx_tid { 472struct ath_atx_tid {
472 struct list_head list; /* round-robin tid entry */ 473 struct list_head list; /* round-robin tid entry */
473 struct list_head buf_q; /* pending buffers */ 474 struct list_head buf_q; /* pending buffers */
474 struct ath_node *an; /* parent node structure */ 475 struct ath_node *an;
475 struct ath_atx_ac *ac; /* parent access category */ 476 struct ath_atx_ac *ac;
476 struct ath_buf *tx_buf[ATH_TID_MAX_BUFS];/* active tx frames */ 477 struct ath_buf *tx_buf[ATH_TID_MAX_BUFS]; /* active tx frames */
477 u16 seq_start; /* starting seq of BA window */ 478 u16 seq_start;
478 u16 seq_next; /* next seq to be used */ 479 u16 seq_next;
479 u16 baw_size; /* BA window size */ 480 u16 baw_size;
480 int tidno; /* TID number */ 481 int tidno;
481 int baw_head; /* first un-acked tx buffer */ 482 int baw_head; /* first un-acked tx buffer */
482 int baw_tail; /* next unused tx buffer slot */ 483 int baw_tail; /* next unused tx buffer slot */
483 int sched; /* TID is scheduled */ 484 int sched;
484 int paused; /* TID is paused */ 485 int paused;
485 int cleanup_inprogress; /* aggr of this TID is 486 int cleanup_inprogress;
486 being teared down */ 487 u32 addba_exchangecomplete:1;
487 u32 addba_exchangecomplete:1; /* ADDBA state */ 488 int32_t addba_exchangeinprogress;
488 int32_t addba_exchangeinprogress; 489 int addba_exchangeattempts;
489 int addba_exchangeattempts;
490}; 490};
491 491
492/* per access-category aggregate tx state for a destination */ 492/* per access-category aggregate tx state for a destination */
493struct ath_atx_ac { 493struct ath_atx_ac {
494 int sched; /* dest-ac is scheduled */ 494 int sched; /* dest-ac is scheduled */
495 int qnum; /* H/W queue number associated 495 int qnum; /* H/W queue number associated
496 with this AC */ 496 with this AC */
497 struct list_head list; /* round-robin txq entry */ 497 struct list_head list; /* round-robin txq entry */
498 struct list_head tid_q; /* queue of TIDs with buffers */ 498 struct list_head tid_q; /* queue of TIDs with buffers */
499}; 499};
500 500
501/* per dest tx state */ 501/* per dest tx state */
502struct ath_atx { 502struct ath_atx {
503 struct ath_atx_tid tid[WME_NUM_TID]; 503 struct ath_atx_tid tid[WME_NUM_TID];
504 struct ath_atx_ac ac[WME_NUM_AC]; 504 struct ath_atx_ac ac[WME_NUM_AC];
505}; 505};
506 506
507/* per-frame tx control block */ 507/* per-frame tx control block */
508struct ath_tx_control { 508struct ath_tx_control {
509 struct ath_node *an; /* destination to sent to */ 509 struct ath_node *an;
510 int if_id; /* only valid for cab traffic */ 510 int if_id;
511 int qnum; /* h/w queue number */ 511 int qnum;
512 u32 ht:1; /* if it can be transmitted using HT */ 512 u32 ht:1;
513 u32 ps:1; /* if one or more stations are in PS mode */ 513 u32 ps:1;
514 u32 use_minrate:1; /* if this frame should transmitted using 514 u32 use_minrate:1;
515 minimum rate */ 515 enum ath9k_pkt_type atype;
516 enum ath9k_pkt_type atype; /* Atheros packet type */ 516 enum ath9k_key_type keytype;
517 enum ath9k_key_type keytype; /* key type */ 517 u32 flags;
518 u32 flags; /* HAL flags */ 518 u16 seqno;
519 u16 seqno; /* sequence number */ 519 u16 tidno;
520 u16 tidno; /* tid number */ 520 u16 txpower;
521 u16 txpower; /* transmit power */ 521 u16 frmlen;
522 u16 frmlen; /* frame length */ 522 u32 keyix;
523 u32 keyix; /* key index */ 523 int min_rate;
524 int min_rate; /* minimum rate */ 524 int mcast_rate;
525 int mcast_rate; /* multicast rate */ 525 u16 nextfraglen;
526 u16 nextfraglen; /* next fragment length */ 526 struct ath_softc *dev;
527 /* below is set only by ath_dev */
528 struct ath_softc *dev; /* device handle */
529 dma_addr_t dmacontext; 527 dma_addr_t dmacontext;
530}; 528};
531 529
532/* per frame tx status block */ 530/* per frame tx status block */
533struct ath_xmit_status { 531struct ath_xmit_status {
534 int retries; /* number of retries to successufully 532 int retries; /* number of retries to successufully
535 transmit this frame */ 533 transmit this frame */
536 int flags; /* status of transmit */ 534 int flags; /* status of transmit */
537#define ATH_TX_ERROR 0x01 535#define ATH_TX_ERROR 0x01
538#define ATH_TX_XRETRY 0x02 536#define ATH_TX_XRETRY 0x02
539#define ATH_TX_BAR 0x04 537#define ATH_TX_BAR 0x04
@@ -647,20 +645,20 @@ struct aggr_rifs_param {
647 645
648/* Per-node aggregation state */ 646/* Per-node aggregation state */
649struct ath_node_aggr { 647struct ath_node_aggr {
650 struct ath_atx tx; /* node transmit state */ 648 struct ath_atx tx; /* node transmit state */
651 struct ath_arx rx; /* node receive state */ 649 struct ath_arx rx; /* node receive state */
652}; 650};
653 651
654/* driver-specific node state */ 652/* driver-specific node state */
655struct ath_node { 653struct ath_node {
656 struct list_head list; 654 struct list_head list;
657 struct ath_softc *an_sc; /* back pointer */ 655 struct ath_softc *an_sc;
658 atomic_t an_refcnt; 656 atomic_t an_refcnt;
659 struct ath_chainmask_sel an_chainmask_sel; 657 struct ath_chainmask_sel an_chainmask_sel;
660 struct ath_node_aggr an_aggr; /* A-MPDU aggregation state */ 658 struct ath_node_aggr an_aggr;
661 u8 an_smmode; /* SM Power save mode */ 659 u8 an_smmode; /* SM Power save mode */
662 u8 an_flags; 660 u8 an_flags;
663 u8 an_addr[ETH_ALEN]; 661 u8 an_addr[ETH_ALEN];
664}; 662};
665 663
666void ath_tx_resume_tid(struct ath_softc *sc, 664void ath_tx_resume_tid(struct ath_softc *sc,
@@ -754,15 +752,6 @@ int ath_update_beacon(struct ath_softc *sc,
754/* VAPs */ 752/* VAPs */
755/********/ 753/********/
756 754
757#define ATH_IF_HW_OFF 0x0001 /* hardware state needs to turn off */
758#define ATH_IF_HW_ON 0x0002 /* hardware state needs to turn on */
759/* STA only: the associated AP is HT capable */
760#define ATH_IF_HT 0x0004
761/* AP/IBSS only: current BSS has privacy on */
762#define ATH_IF_PRIVACY 0x0008
763#define ATH_IF_BEACON_ENABLE 0x0010 /* AP/IBSS only: enable beacon */
764#define ATH_IF_BEACON_SYNC 0x0020 /* IBSS only: need to sync beacon */
765
766/* 755/*
767 * Define the scheme that we select MAC address for multiple 756 * Define the scheme that we select MAC address for multiple
768 * BSS on the same radio. The very first VAP will just use the MAC 757 * BSS on the same radio. The very first VAP will just use the MAC
@@ -782,19 +771,15 @@ struct ath_vap_config {
782 771
783/* driver-specific vap state */ 772/* driver-specific vap state */
784struct ath_vap { 773struct ath_vap {
785 struct ieee80211_vif *av_if_data; /* interface(vap) 774 struct ieee80211_vif *av_if_data;
786 instance from 802.11 protocal layer */ 775 enum ath9k_opmode av_opmode; /* VAP operational mode */
787 enum ath9k_opmode av_opmode; /* VAP operational mode */ 776 struct ath_buf *av_bcbuf; /* beacon buffer */
788 struct ath_buf *av_bcbuf; /* beacon buffer */ 777 struct ath_beacon_offset av_boff; /* dynamic update state */
789 struct ath_beacon_offset av_boff; /* dynamic update state */ 778 struct ath_tx_control av_btxctl; /* txctl information for beacon */
790 struct ath_tx_control av_btxctl; /* tx control information 779 int av_bslot; /* beacon slot index */
791 for beacon */ 780 struct ath_txq av_mcastq; /* multicast transmit queue */
792 int av_bslot; /* beacon slot index */ 781 struct ath_vap_config av_config;/* vap configuration parameters*/
793 struct ath_txq av_mcastq; /* multicast 782 struct ath_rate_node *rc_node;
794 transmit queue */
795 struct ath_vap_config av_config; /* vap configuration
796 parameters from 802.11 protocol layer*/
797 struct ath_rate_node *rc_node;
798}; 783};
799 784
800int ath_vap_attach(struct ath_softc *sc, 785int ath_vap_attach(struct ath_softc *sc,