iPXE
ath9k.h File Reference
#include "common.h"

Go to the source code of this file.

Data Structures

struct  ath_config
struct  ath_descdma
struct  ath_txq
struct  ath_atx_ac
struct  ath_frame_info
struct  ath_buf_state
struct  ath_buf
struct  ath_atx_tid
struct  ath_node
struct  ath_tx_control
struct  ath_tx
 @txq_map: Index is mac80211 queue number. More...
struct  ath_rx_edma
struct  ath_rx
struct  ath9k_legacy_rate
struct  survey_info
struct  ath9k_vif_iter_data
struct  ath_softc

Macros

#define ito64(x)
#define INCR(_l, _sz)
#define DECR(_l, _sz)
#define A_MAX(a, b)
#define TSF_TO_TU(_h, _l)
#define ATH_TXQ_SETUP(sc, i)
#define ATH_TXBUF_RESET(_bf)
#define ATH_RXBUF_RESET(_bf)
#define bf_isampdu(bf)
#define bf_isaggr(bf)
#define bf_isxretried(bf)
#define ATH_TXSTATUS_RING_SIZE   64
#define ATH_RXBUF   16
#define ATH_TXBUF   16
#define ATH_TXBUF_RESERVE   5
#define ATH_MAX_QDEPTH   (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
#define ATH_TXMAXTRY   13
#define TID_TO_WME_AC(_tid)
#define ATH_AGGR_DELIM_SZ   4
#define ATH_AGGR_MINPLEN   256 /* in bytes, minimum packet length */
#define ATH_AGGR_ENCRYPTDELIM   10
#define ATH_AGGR_MIN_QDEPTH   2
#define ATH_AMPDU_SUBFRAME_DEFAULT   32
#define FCS_LEN   4
#define IEEE80211_SEQ_SEQ_SHIFT   4
#define IEEE80211_SEQ_MAX   4096
#define IEEE80211_WEP_IVLEN   3
#define IEEE80211_WEP_KIDLEN   1
#define IEEE80211_WEP_CRCLEN   4
#define IEEE80211_MAX_MPDU_LEN
#define ATH_BA_ISSET(_bm, _n)
#define ATH_BA_INDEX(_st, _seq)
#define ATH_AGGR_GET_NDELIM(_len)
#define BAW_WITHIN(_start, _bawsz, _seqno)
#define ATH_AN_2_TID(_an, _tidno)
#define ATH_TX_COMPLETE_POLL_INT   1000
#define ATH_TXFIFO_DEPTH   8
#define AGGR_CLEANUP   BIT(1)
#define AGGR_ADDBA_COMPLETE   BIT(2)
#define AGGR_ADDBA_PROGRESS   BIT(3)
#define ATH_TX_ERROR   0x01
#define ATH_TX_XRETRY   0x02
#define ATH_TX_BAR   0x04
#define ATH_STA_SHORT_CALINTERVAL   1000 /* 1 second */
#define ATH_AP_SHORT_CALINTERVAL   100 /* 100 ms */
#define ATH_ANI_POLLINTERVAL_OLD   100 /* 100 ms */
#define ATH_ANI_POLLINTERVAL_NEW   1000 /* 1000 ms */
#define ATH_LONG_CALINTERVAL_INT   1000 /* 1000 ms */
#define ATH_LONG_CALINTERVAL   30000 /* 30 seconds */
#define ATH_RESTART_CALINTERVAL   1200000 /* 20 minutes */
#define DEFAULT_CACHELINE   32
#define ATH_REGCLASSIDS_MAX   10
#define ATH_CABQ_READY_TIME   80 /* % of beacon interval */
#define ATH_MAX_SW_RETRIES   10
#define ATH_CHAN_MAX   255
#define ATH_TXPOWER_MAX   100 /* .5 dBm units */
#define ATH_RATE_DUMMY_MARKER   0
#define SC_OP_INVALID   BIT(0)
#define SC_OP_BEACONS   BIT(1)
#define SC_OP_RXAGGR   BIT(2)
#define SC_OP_TXAGGR   BIT(3)
#define SC_OP_OFFCHANNEL   BIT(4)
#define SC_OP_PREAMBLE_SHORT   BIT(5)
#define SC_OP_PROTECT_ENABLE   BIT(6)
#define SC_OP_RXFLUSH   BIT(7)
#define SC_OP_LED_ASSOCIATED   BIT(8)
#define SC_OP_LED_ON   BIT(9)
#define SC_OP_TSF_RESET   BIT(11)
#define SC_OP_BT_PRIORITY_DETECTED   BIT(12)
#define SC_OP_BT_SCAN   BIT(13)
#define SC_OP_ANI_RUN   BIT(14)
#define SC_OP_ENABLE_APM   BIT(15)
#define SC_OP_PRIM_STA_VIF   BIT(16)
#define PS_WAIT_FOR_BEACON   BIT(0)
#define PS_WAIT_FOR_CAB   BIT(1)
#define PS_WAIT_FOR_PSPOLL_DATA   BIT(2)
#define PS_WAIT_FOR_TX_ACK   BIT(3)
#define PS_BEACON_SYNC   BIT(4)
#define PS_TSFOOR_SYNC   BIT(5)

Enumerations

enum  buffer_type { BUF_AMPDU = BIT(0) , BUF_AGGR = BIT(1) , BUF_XRETRY = BIT(2) }
 enum buffer_type - Buffer type flags More...
enum  ATH_AGGR_STATUS { ATH_AGGR_DONE , ATH_AGGR_BAW_CLOSED , ATH_AGGR_LIMITED }
enum  ath9k_rate_control_flags {
  IEEE80211_TX_RC_USE_RTS_CTS = BIT(0) , IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1) , IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2) , IEEE80211_TX_RC_MCS = BIT(3) ,
  IEEE80211_TX_RC_GREEN_FIELD = BIT(4) , IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5) , IEEE80211_TX_RC_DUP_DATA = BIT(6) , IEEE80211_TX_RC_SHORT_GI = BIT(7)
}
enum  survey_info_flags {
  SURVEY_INFO_NOISE_DBM = 1<<0 , SURVEY_INFO_IN_USE = 1<<1 , SURVEY_INFO_CHANNEL_TIME = 1<<2 , SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3 ,
  SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4 , SURVEY_INFO_CHANNEL_TIME_RX = 1<<5 , SURVEY_INFO_CHANNEL_TIME_TX = 1<<6
}

Functions

 FILE_LICENCE (BSD2)
 FILE_SECBOOT (FORBIDDEN)
int ath_descdma_setup (struct ath_softc *sc, struct ath_descdma *dd, struct list_head *head, const char *name, int nbuf, int ndesc, int is_tx)
void ath_descdma_cleanup (struct ath_softc *sc, struct ath_descdma *dd, struct list_head *head)
int ath_startrecv (struct ath_softc *sc)
int ath_stoprecv (struct ath_softc *sc)
void ath_flushrecv (struct ath_softc *sc)
u32 ath_calcrxfilter (struct ath_softc *sc)
int ath_rx_init (struct ath_softc *sc, int nbufs)
void ath_rx_cleanup (struct ath_softc *sc)
int ath_rx_tasklet (struct ath_softc *sc, int flush, int hp)
struct ath_txqath_txq_setup (struct ath_softc *sc, int qtype, int subtype)
void ath_tx_cleanupq (struct ath_softc *sc, struct ath_txq *txq)
int ath_drain_all_txq (struct ath_softc *sc, int retry_tx)
void ath_draintxq (struct ath_softc *sc, struct ath_txq *txq, int retry_tx)
void ath_txq_schedule (struct ath_softc *sc, struct ath_txq *txq)
int ath_tx_init (struct ath_softc *sc, int nbufs)
void ath_tx_cleanup (struct ath_softc *sc)
int ath_txq_update (struct ath_softc *sc, int qnum, struct ath9k_tx_queue_info *q)
int ath_tx_start (struct net80211_device *dev, struct io_buffer *iob, struct ath_tx_control *txctl)
void ath_tx_tasklet (struct ath_softc *sc)
void ath_hw_pll_work (struct ath_softc *sc)
void ath_ani_calibrate (struct ath_softc *sc)
void ath9k_tasklet (struct ath_softc *sc)
int ath_reset (struct ath_softc *sc, int retry_tx)
static void ath_read_cachesize (struct ath_common *common, int *csz)
void ath_isr (struct net80211_device *dev)
void ath9k_init_crypto (struct ath_softc *sc)
int ath9k_init_device (u16 devid, struct ath_softc *sc, u16 subsysid, const struct ath_bus_ops *bus_ops)
void ath9k_deinit_device (struct ath_softc *sc)
void ath9k_set_hw_capab (struct ath_softc *sc, struct net80211_device *dev)
int ath_set_channel (struct ath_softc *sc, struct net80211_device *dev, struct ath9k_channel *hchan)
void ath_radio_enable (struct ath_softc *sc, struct net80211_device *dev)
void ath_radio_disable (struct ath_softc *sc, struct net80211_device *dev)
int ath9k_setpower (struct ath_softc *sc, enum ath9k_power_mode mode)
int ath9k_uses_beacons (int type)
u8 ath_txchainmask_reduction (struct ath_softc *sc, u8 chainmask, u32 rate)
void ath_start_rfkill_poll (struct ath_softc *sc)
void ath9k_rfkill_poll_state (struct net80211_device *dev)

Variables

struct net80211_device_operations ath9k_ops
int ath9k_modparam_nohwcrypt
int is_ath9k_unloaded

Macro Definition Documentation

◆ ito64

#define ito64 ( x)
Value:
(sizeof(x) == 1) ? \
(((unsigned long long int)(x)) & (0xff)) : \
(sizeof(x) == 2) ? \
(((unsigned long long int)(x)) & 0xffff) : \
((sizeof(x) == 4) ? \
(((unsigned long long int)(x)) & 0xffffffff) : \
(unsigned long long int)(x))
static unsigned int x
Definition pixbuf.h:63

Definition at line 38 of file ath9k.h.

38#define ito64(x) (sizeof(x) == 1) ? \
39 (((unsigned long long int)(x)) & (0xff)) : \
40 (sizeof(x) == 2) ? \
41 (((unsigned long long int)(x)) & 0xffff) : \
42 ((sizeof(x) == 4) ? \
43 (((unsigned long long int)(x)) & 0xffffffff) : \
44 (unsigned long long int)(x))

Referenced by ath_descdma_setup(), and ath_tx_txqaddbuf().

◆ INCR

#define INCR ( _l,
_sz )
Value:
do { \
(_l)++; \
(_l) &= ((_sz) - 1); \
} while (0)

Definition at line 47 of file ath9k.h.

47#define INCR(_l, _sz) do { \
48 (_l)++; \
49 (_l) &= ((_sz) - 1); \
50 } while (0)

Referenced by ath_tx_send_normal().

◆ DECR

#define DECR ( _l,
_sz )
Value:
do { \
(_l)--; \
(_l) &= ((_sz) - 1); \
} while (0)

Definition at line 53 of file ath9k.h.

53#define DECR(_l, _sz) do { \
54 (_l)--; \
55 (_l) &= ((_sz) - 1); \
56 } while (0)

◆ A_MAX

#define A_MAX ( a,
b )
Value:
((a) > (b) ? (a) : (b))

Definition at line 58 of file ath9k.h.

◆ TSF_TO_TU

#define TSF_TO_TU ( _h,
_l )
Value:
((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
#define u32
Definition vga.h:21

Definition at line 60 of file ath9k.h.

60#define TSF_TO_TU(_h,_l) \
61 ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))

◆ ATH_TXQ_SETUP

#define ATH_TXQ_SETUP ( sc,
i )
Value:
((sc)->tx.txqsetup & (1<<i))

Definition at line 63 of file ath9k.h.

Referenced by ath9k_deinit_softc(), ath9k_init_softc(), ath_drain_all_txq(), ath_reset(), ath_tx_complete_poll_work(), ath_tx_tasklet(), and ath_txq_setup().

◆ ATH_TXBUF_RESET

#define ATH_TXBUF_RESET ( _bf)
Value:
do { \
(_bf)->bf_stale = 0; \
(_bf)->bf_lastbf = NULL; \
(_bf)->bf_next = NULL; \
memset(&((_bf)->bf_state), 0, \
sizeof(struct ath_buf_state)); \
} while (0)
#define NULL
NULL pointer (VOID *)
Definition Base.h:322

Definition at line 74 of file ath9k.h.

74#define ATH_TXBUF_RESET(_bf) do { \
75 (_bf)->bf_stale = 0; \
76 (_bf)->bf_lastbf = NULL; \
77 (_bf)->bf_next = NULL; \
78 memset(&((_bf)->bf_state), 0, \
79 sizeof(struct ath_buf_state)); \
80 } while (0)

Referenced by ath_tx_setup_buffer().

◆ ATH_RXBUF_RESET

#define ATH_RXBUF_RESET ( _bf)
Value:
do { \
(_bf)->bf_stale = 0; \
} while (0)

Definition at line 82 of file ath9k.h.

82#define ATH_RXBUF_RESET(_bf) do { \
83 (_bf)->bf_stale = 0; \
84 } while (0)

Referenced by ath_rx_buf_link().

◆ bf_isampdu

#define bf_isampdu ( bf)
Value:
(bf->bf_state.bf_type & BUF_AMPDU)
@ BUF_AMPDU
Definition ath9k.h:95

Definition at line 100 of file ath9k.h.

◆ bf_isaggr

#define bf_isaggr ( bf)
Value:
(bf->bf_state.bf_type & BUF_AGGR)
@ BUF_AGGR
Definition ath9k.h:96

Definition at line 101 of file ath9k.h.

Referenced by ath_buf_set_rate().

◆ bf_isxretried

#define bf_isxretried ( bf)
Value:
(bf->bf_state.bf_type & BUF_XRETRY)
@ BUF_XRETRY
Definition ath9k.h:97

Definition at line 102 of file ath9k.h.

Referenced by ath_tx_complete_buf().

◆ ATH_TXSTATUS_RING_SIZE

#define ATH_TXSTATUS_RING_SIZE   64

Definition at line 104 of file ath9k.h.

◆ ATH_RXBUF

#define ATH_RXBUF   16

Definition at line 123 of file ath9k.h.

◆ ATH_TXBUF

#define ATH_TXBUF   16

Definition at line 124 of file ath9k.h.

◆ ATH_TXBUF_RESERVE

#define ATH_TXBUF_RESERVE   5

Definition at line 125 of file ath9k.h.

◆ ATH_MAX_QDEPTH

#define ATH_MAX_QDEPTH   (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)

Definition at line 126 of file ath9k.h.

Referenced by ath_tx_complete(), and ath_tx_start().

◆ ATH_TXMAXTRY

#define ATH_TXMAXTRY   13

Definition at line 127 of file ath9k.h.

Referenced by ath_buf_set_rate().

◆ TID_TO_WME_AC

#define TID_TO_WME_AC ( _tid)
Value:
((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
(((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
(((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
WME_AC_VO)
#define WME_AC_BE
Definition common.h:35

Definition at line 129 of file ath9k.h.

129#define TID_TO_WME_AC(_tid) \
130 ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
131 (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
132 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
133 WME_AC_VO)

◆ ATH_AGGR_DELIM_SZ

#define ATH_AGGR_DELIM_SZ   4

Definition at line 135 of file ath9k.h.

◆ ATH_AGGR_MINPLEN

#define ATH_AGGR_MINPLEN   256 /* in bytes, minimum packet length */

Definition at line 136 of file ath9k.h.

◆ ATH_AGGR_ENCRYPTDELIM

#define ATH_AGGR_ENCRYPTDELIM   10

Definition at line 138 of file ath9k.h.

◆ ATH_AGGR_MIN_QDEPTH

#define ATH_AGGR_MIN_QDEPTH   2

Definition at line 140 of file ath9k.h.

Referenced by ath_txq_schedule().

◆ ATH_AMPDU_SUBFRAME_DEFAULT

#define ATH_AMPDU_SUBFRAME_DEFAULT   32

Definition at line 141 of file ath9k.h.

◆ FCS_LEN

#define FCS_LEN   4

Definition at line 143 of file ath9k.h.

◆ IEEE80211_SEQ_SEQ_SHIFT

#define IEEE80211_SEQ_SEQ_SHIFT   4

Definition at line 144 of file ath9k.h.

◆ IEEE80211_SEQ_MAX

#define IEEE80211_SEQ_MAX   4096

Definition at line 145 of file ath9k.h.

Referenced by ath_tx_send_normal().

◆ IEEE80211_WEP_IVLEN

#define IEEE80211_WEP_IVLEN   3

Definition at line 146 of file ath9k.h.

◆ IEEE80211_WEP_KIDLEN

#define IEEE80211_WEP_KIDLEN   1

Definition at line 147 of file ath9k.h.

◆ IEEE80211_WEP_CRCLEN

#define IEEE80211_WEP_CRCLEN   4

Definition at line 148 of file ath9k.h.

◆ IEEE80211_MAX_MPDU_LEN

#define IEEE80211_MAX_MPDU_LEN
Value:
(3840 + FCS_LEN + \
#define FCS_LEN
Definition ath5k_desc.c:37
#define IEEE80211_WEP_KIDLEN
Definition ath9k.h:147
#define IEEE80211_WEP_IVLEN
Definition ath9k.h:146
#define IEEE80211_WEP_CRCLEN
Definition ath9k.h:148

Definition at line 149 of file ath9k.h.

149#define IEEE80211_MAX_MPDU_LEN (3840 + FCS_LEN + \
150 (IEEE80211_WEP_IVLEN + \
151 IEEE80211_WEP_KIDLEN + \
152 IEEE80211_WEP_CRCLEN))

Referenced by ath_rx_init().

◆ ATH_BA_ISSET

#define ATH_BA_ISSET ( _bm,
_n )
Value:
(((_n) < (WME_BA_BMP_SIZE)) && \
((_bm)[(_n) >> 5] & (1 << ((_n) & 31))))
#define WME_BA_BMP_SIZE
Definition common.h:31

Definition at line 156 of file ath9k.h.

156#define ATH_BA_ISSET(_bm, _n) (((_n) < (WME_BA_BMP_SIZE)) && \
157 ((_bm)[(_n) >> 5] & (1 << ((_n) & 31))))

◆ ATH_BA_INDEX

#define ATH_BA_INDEX ( _st,
_seq )
Value:
(((_seq) - (_st)) & (IEEE80211_SEQ_MAX - 1))
#define IEEE80211_SEQ_MAX
Definition ath9k.h:145

Definition at line 160 of file ath9k.h.

◆ ATH_AGGR_GET_NDELIM

#define ATH_AGGR_GET_NDELIM ( _len)
Value:
(((_len) >= ATH_AGGR_MINPLEN) ? 0 : \
DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ))
#define ATH_AGGR_MINPLEN
Definition ath9k.h:136
#define ATH_AGGR_DELIM_SZ
Definition ath9k.h:135

Definition at line 163 of file ath9k.h.

163#define ATH_AGGR_GET_NDELIM(_len) \
164 (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \
165 DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ))

◆ BAW_WITHIN

#define BAW_WITHIN ( _start,
_bawsz,
_seqno )
Value:
((((_seqno) - (_start)) & 4095) < (_bawsz))

Definition at line 167 of file ath9k.h.

167#define BAW_WITHIN(_start, _bawsz, _seqno) \
168 ((((_seqno) - (_start)) & 4095) < (_bawsz))

◆ ATH_AN_2_TID

#define ATH_AN_2_TID ( _an,
_tidno )
Value:
(&(_an)->tid[(_tidno)])

Definition at line 170 of file ath9k.h.

◆ ATH_TX_COMPLETE_POLL_INT

#define ATH_TX_COMPLETE_POLL_INT   1000

Definition at line 172 of file ath9k.h.

Referenced by ath_tx_complete_poll_work().

◆ ATH_TXFIFO_DEPTH

#define ATH_TXFIFO_DEPTH   8

Definition at line 180 of file ath9k.h.

Referenced by ath_txq_setup().

◆ AGGR_CLEANUP

#define AGGR_CLEANUP   BIT(1)

Definition at line 262 of file ath9k.h.

◆ AGGR_ADDBA_COMPLETE

#define AGGR_ADDBA_COMPLETE   BIT(2)

Definition at line 263 of file ath9k.h.

◆ AGGR_ADDBA_PROGRESS

#define AGGR_ADDBA_PROGRESS   BIT(3)

Definition at line 264 of file ath9k.h.

◆ ATH_TX_ERROR

#define ATH_TX_ERROR   0x01

Definition at line 273 of file ath9k.h.

Referenced by ath_tx_complete_buf().

◆ ATH_TX_XRETRY

#define ATH_TX_XRETRY   0x02

Definition at line 274 of file ath9k.h.

Referenced by ath_tx_complete_buf().

◆ ATH_TX_BAR

#define ATH_TX_BAR   0x04

Definition at line 275 of file ath9k.h.

Referenced by ath_tx_complete_buf().

◆ ATH_STA_SHORT_CALINTERVAL

#define ATH_STA_SHORT_CALINTERVAL   1000 /* 1 second */

Definition at line 335 of file ath9k.h.

Referenced by ath_ani_calibrate().

◆ ATH_AP_SHORT_CALINTERVAL

#define ATH_AP_SHORT_CALINTERVAL   100 /* 100 ms */

Definition at line 336 of file ath9k.h.

◆ ATH_ANI_POLLINTERVAL_OLD

#define ATH_ANI_POLLINTERVAL_OLD   100 /* 100 ms */

Definition at line 337 of file ath9k.h.

◆ ATH_ANI_POLLINTERVAL_NEW

#define ATH_ANI_POLLINTERVAL_NEW   1000 /* 1000 ms */

Definition at line 338 of file ath9k.h.

◆ ATH_LONG_CALINTERVAL_INT

#define ATH_LONG_CALINTERVAL_INT   1000 /* 1000 ms */

Definition at line 339 of file ath9k.h.

Referenced by ath_ani_calibrate().

◆ ATH_LONG_CALINTERVAL

#define ATH_LONG_CALINTERVAL   30000 /* 30 seconds */

Definition at line 340 of file ath9k.h.

Referenced by ath_ani_calibrate().

◆ ATH_RESTART_CALINTERVAL

#define ATH_RESTART_CALINTERVAL   1200000 /* 20 minutes */

Definition at line 341 of file ath9k.h.

Referenced by ath_ani_calibrate().

◆ DEFAULT_CACHELINE

#define DEFAULT_CACHELINE   32

Definition at line 354 of file ath9k.h.

Referenced by ath_pci_read_cachesize().

◆ ATH_REGCLASSIDS_MAX

#define ATH_REGCLASSIDS_MAX   10

Definition at line 355 of file ath9k.h.

◆ ATH_CABQ_READY_TIME

#define ATH_CABQ_READY_TIME   80 /* % of beacon interval */

Definition at line 356 of file ath9k.h.

◆ ATH_MAX_SW_RETRIES

#define ATH_MAX_SW_RETRIES   10

Definition at line 357 of file ath9k.h.

◆ ATH_CHAN_MAX

#define ATH_CHAN_MAX   255

Definition at line 358 of file ath9k.h.

◆ ATH_TXPOWER_MAX

#define ATH_TXPOWER_MAX   100 /* .5 dBm units */

Definition at line 360 of file ath9k.h.

Referenced by ath9k_init_misc().

◆ ATH_RATE_DUMMY_MARKER

#define ATH_RATE_DUMMY_MARKER   0

Definition at line 361 of file ath9k.h.

◆ SC_OP_INVALID

#define SC_OP_INVALID   BIT(0)

◆ SC_OP_BEACONS

#define SC_OP_BEACONS   BIT(1)

Definition at line 364 of file ath9k.h.

Referenced by ath9k_config_bss().

◆ SC_OP_RXAGGR

#define SC_OP_RXAGGR   BIT(2)

Definition at line 365 of file ath9k.h.

◆ SC_OP_TXAGGR

#define SC_OP_TXAGGR   BIT(3)

Definition at line 366 of file ath9k.h.

Referenced by ath_tx_processq().

◆ SC_OP_OFFCHANNEL

#define SC_OP_OFFCHANNEL   BIT(4)

Definition at line 367 of file ath9k.h.

Referenced by ath9k_config(), ath_set_channel(), ath_start_ani(), and ath_startrecv().

◆ SC_OP_PREAMBLE_SHORT

#define SC_OP_PREAMBLE_SHORT   BIT(5)

Definition at line 368 of file ath9k.h.

Referenced by ath9k_bss_info_changed(), ath9k_config(), and ath_buf_set_rate().

◆ SC_OP_PROTECT_ENABLE

#define SC_OP_PROTECT_ENABLE   BIT(6)

Definition at line 369 of file ath9k.h.

Referenced by ath9k_bss_info_changed(), and ath_buf_set_rate().

◆ SC_OP_RXFLUSH

#define SC_OP_RXFLUSH   BIT(7)

Definition at line 370 of file ath9k.h.

Referenced by ath_flushrecv(), ath_rx_init(), and ath_rx_tasklet().

◆ SC_OP_LED_ASSOCIATED

#define SC_OP_LED_ASSOCIATED   BIT(8)

Definition at line 371 of file ath9k.h.

◆ SC_OP_LED_ON

#define SC_OP_LED_ON   BIT(9)

Definition at line 372 of file ath9k.h.

◆ SC_OP_TSF_RESET

#define SC_OP_TSF_RESET   BIT(11)

Definition at line 373 of file ath9k.h.

◆ SC_OP_BT_PRIORITY_DETECTED

#define SC_OP_BT_PRIORITY_DETECTED   BIT(12)

Definition at line 374 of file ath9k.h.

◆ SC_OP_BT_SCAN

#define SC_OP_BT_SCAN   BIT(13)

Definition at line 375 of file ath9k.h.

◆ SC_OP_ANI_RUN

#define SC_OP_ANI_RUN   BIT(14)

Definition at line 376 of file ath9k.h.

Referenced by ath9k_bss_iter(), ath9k_config_bss(), and ath_start_ani().

◆ SC_OP_ENABLE_APM

#define SC_OP_ENABLE_APM   BIT(15)

Definition at line 377 of file ath9k.h.

Referenced by ath_txchainmask_reduction().

◆ SC_OP_PRIM_STA_VIF

#define SC_OP_PRIM_STA_VIF   BIT(16)

Definition at line 378 of file ath9k.h.

Referenced by ath9k_bss_iter(), and ath9k_config_bss().

◆ PS_WAIT_FOR_BEACON

#define PS_WAIT_FOR_BEACON   BIT(0)

Definition at line 381 of file ath9k.h.

Referenced by ath9k_bss_iter(), and ath_isr().

◆ PS_WAIT_FOR_CAB

#define PS_WAIT_FOR_CAB   BIT(1)

Definition at line 382 of file ath9k.h.

◆ PS_WAIT_FOR_PSPOLL_DATA

#define PS_WAIT_FOR_PSPOLL_DATA   BIT(2)

Definition at line 383 of file ath9k.h.

◆ PS_WAIT_FOR_TX_ACK

#define PS_WAIT_FOR_TX_ACK   BIT(3)

Definition at line 384 of file ath9k.h.

◆ PS_BEACON_SYNC

#define PS_BEACON_SYNC   BIT(4)

Definition at line 385 of file ath9k.h.

Referenced by ath9k_bss_iter().

◆ PS_TSFOOR_SYNC

#define PS_TSFOOR_SYNC   BIT(5)

Definition at line 386 of file ath9k.h.

Enumeration Type Documentation

◆ buffer_type

enum buffer_type - Buffer type flags

@BUF_AMPDU: This buffer is an ampdu, as part of an aggregate (during TX) @BUF_AGGR: Indicates whether the buffer can be aggregated (used in aggregation scheduling) @BUF_XRETRY: To denote excessive retries of the buffer

Enumerator
BUF_AMPDU 
BUF_AGGR 
BUF_XRETRY 

Definition at line 94 of file ath9k.h.

94 {
95 BUF_AMPDU = BIT(0),
96 BUF_AGGR = BIT(1),
97 BUF_XRETRY = BIT(2),
98};
#define BIT(nr)
Definition ath.h:34

◆ ATH_AGGR_STATUS

Enumerator
ATH_AGGR_DONE 
ATH_AGGR_BAW_CLOSED 
ATH_AGGR_LIMITED 

Definition at line 174 of file ath9k.h.

174 {
178};
@ ATH_AGGR_BAW_CLOSED
Definition ath9k.h:176
@ ATH_AGGR_LIMITED
Definition ath9k.h:177
@ ATH_AGGR_DONE
Definition ath9k.h:175

◆ ath9k_rate_control_flags

Enumerator
IEEE80211_TX_RC_USE_RTS_CTS 
IEEE80211_TX_RC_USE_CTS_PROTECT 
IEEE80211_TX_RC_USE_SHORT_PREAMBLE 
IEEE80211_TX_RC_MCS 
IEEE80211_TX_RC_GREEN_FIELD 
IEEE80211_TX_RC_40_MHZ_WIDTH 
IEEE80211_TX_RC_DUP_DATA 
IEEE80211_TX_RC_SHORT_GI 

Definition at line 397 of file ath9k.h.

397 {
401
402 /* rate index is an MCS rate number instead of an index */
408};
@ IEEE80211_TX_RC_SHORT_GI
Definition ath9k.h:407
@ IEEE80211_TX_RC_40_MHZ_WIDTH
Definition ath9k.h:405
@ IEEE80211_TX_RC_USE_RTS_CTS
Definition ath9k.h:398
@ IEEE80211_TX_RC_MCS
Definition ath9k.h:403
@ IEEE80211_TX_RC_USE_CTS_PROTECT
Definition ath9k.h:399
@ IEEE80211_TX_RC_GREEN_FIELD
Definition ath9k.h:404
@ IEEE80211_TX_RC_DUP_DATA
Definition ath9k.h:406
@ IEEE80211_TX_RC_USE_SHORT_PREAMBLE
Definition ath9k.h:400

◆ survey_info_flags

Enumerator
SURVEY_INFO_NOISE_DBM 
SURVEY_INFO_IN_USE 
SURVEY_INFO_CHANNEL_TIME 
SURVEY_INFO_CHANNEL_TIME_BUSY 
SURVEY_INFO_CHANNEL_TIME_EXT_BUSY 
SURVEY_INFO_CHANNEL_TIME_RX 
SURVEY_INFO_CHANNEL_TIME_TX 

Definition at line 421 of file ath9k.h.

421 {
423 SURVEY_INFO_IN_USE = 1<<1,
429};
@ SURVEY_INFO_CHANNEL_TIME_BUSY
Definition ath9k.h:425
@ SURVEY_INFO_IN_USE
Definition ath9k.h:423
@ SURVEY_INFO_CHANNEL_TIME_RX
Definition ath9k.h:427
@ SURVEY_INFO_CHANNEL_TIME
Definition ath9k.h:424
@ SURVEY_INFO_NOISE_DBM
Definition ath9k.h:422
@ SURVEY_INFO_CHANNEL_TIME_TX
Definition ath9k.h:428
@ SURVEY_INFO_CHANNEL_TIME_EXT_BUSY
Definition ath9k.h:426

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2 )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

◆ ath_descdma_setup()

int ath_descdma_setup ( struct ath_softc * sc,
struct ath_descdma * dd,
struct list_head * head,
const char * name,
int nbuf,
int ndesc,
int is_tx )

Definition at line 181 of file ath9k_init.c.

184{
185#define DS2PHYS(_dd, _ds) \
186 ((_dd)->dd_desc_paddr + ((char *)(_ds) - (char *)(_dd)->dd_desc))
187#define ATH_DESC_4KB_BOUND_CHECK(_daddr) ((((_daddr) & 0xFFF) > 0xF9F) ? 1 : 0)
188 u8 *ds;
189 struct ath_buf *bf;
190 int i, bsize, error, desc_len;
191
192 DBG2("ath9k: %s DMA: %d buffers %d desc/buf\n",
193 name, nbuf, ndesc);
194
196
197 if (is_tx)
198 desc_len = sc->sc_ah->caps.tx_desc_len;
199 else
200 desc_len = sizeof(struct ath_desc);
201
202 /* ath_desc must be a multiple of DWORDs */
203 if ((desc_len % 4) != 0) {
204 DBG("ath9k: ath_desc not DWORD aligned\n");
205 error = -ENOMEM;
206 goto fail;
207 }
208
209 dd->dd_desc_len = desc_len * nbuf * ndesc;
210
211 /*
212 * Need additional DMA memory because we can't use
213 * descriptors that cross the 4K page boundary.
214 * However, iPXE only utilizes 16 buffers, which
215 * will never make up more than half of one page,
216 * so we will only ever skip 1 descriptor, if that.
217 */
219 u32 ndesc_skipped = 1;
220 u32 dma_len;
221
222 dma_len = ndesc_skipped * desc_len;
223 dd->dd_desc_len += dma_len;
224 }
225
226 /* allocate descriptors */
227 dd->dd_desc = malloc_phys(dd->dd_desc_len, 16);
228 if (dd->dd_desc == NULL) {
229 error = -ENOMEM;
230 goto fail;
231 }
233 ds = (u8 *) dd->dd_desc;
234 DBG2("ath9k: %s DMA map: %p (%d) -> %llx (%d)\n",
235 name, ds, (u32) dd->dd_desc_len,
236 ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len);
237
238 /* allocate buffers */
239 bsize = sizeof(struct ath_buf) * nbuf;
240 bf = zalloc(bsize);
241 if (bf == NULL) {
242 error = -ENOMEM;
243 goto fail2;
244 }
245 dd->dd_bufptr = bf;
246
247 for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) {
248 bf->bf_desc = ds;
249 bf->bf_daddr = DS2PHYS(dd, ds);
250
251 if (!(sc->sc_ah->caps.hw_caps &
253 /*
254 * Skip descriptor addresses which can cause 4KB
255 * boundary crossing (addr + length) with a 32 dword
256 * descriptor fetch.
257 */
258 while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) {
259 ds += (desc_len * ndesc);
260 bf->bf_desc = ds;
261 bf->bf_daddr = DS2PHYS(dd, ds);
262 }
263 }
264 list_add_tail(&bf->list, head);
265 }
266 return 0;
267fail2:
268 free_phys(dd->dd_desc, dd->dd_desc_len);
269fail:
270 memset(dd, 0, sizeof(*dd));
271 return error;
272#undef ATH_DESC_4KB_BOUND_CHECK
273#undef DS2PHYS
274}
struct arbelprm_completion_with_error error
Definition arbel.h:1
#define ito64(x)
Definition ath9k.h:38
const char * name
Definition ath9k_hw.c:1986
#define DS2PHYS(_dd, _ds)
#define ATH_DESC_4KB_BOUND_CHECK(_daddr)
#define DBG2(...)
Definition compiler.h:515
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
uint8_t head
Head number.
Definition int13.h:23
#define ENOMEM
Not enough space.
Definition errno.h:535
@ ATH9K_HW_CAP_4KB_SPLITTRANS
Definition hw.h:186
#define u8
Definition igbvf_osdep.h:40
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
Definition io.h:184
void * memset(void *dest, int character, size_t len) __nonnull
uint32_t ds
Definition librm.h:5
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition list.h:94
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition list.h:46
void * zalloc(size_t size)
Allocate cleared memory.
Definition malloc.c:662
void * malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
Definition malloc.c:707
void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
Definition malloc.c:723
if(natsemi->flags &NATSEMI_64BIT) return 1
void * dd_desc
Definition ath9k.h:107
u32 dd_desc_len
Definition ath9k.h:109
u32 dd_desc_paddr
Definition ath9k.h:108
struct ath_buf * dd_bufptr
Definition ath9k.h:110
struct ath9k_hw_capabilities caps
Definition hw.h:664
struct ath_hw * sc_ah
Definition ath9k.h:455

References ATH9K_HW_CAP_4KB_SPLITTRANS, ATH_DESC_4KB_BOUND_CHECK, ath_buf::bf_daddr, ath_buf::bf_desc, ath_hw::caps, DBG, DBG2, ath_descdma::dd_bufptr, ath_descdma::dd_desc, ath_descdma::dd_desc_len, ath_descdma::dd_desc_paddr, ds, DS2PHYS, ENOMEM, error, free_phys(), head, ath9k_hw_capabilities::hw_caps, if(), INIT_LIST_HEAD, ito64, ath_buf::list, list_add_tail, malloc_phys(), memset(), name, NULL, ath_softc::sc_ah, ath9k_hw_capabilities::tx_desc_len, u32, u8, virt_to_bus(), and zalloc().

Referenced by ath_rx_init(), and ath_tx_init().

◆ ath_descdma_cleanup()

void ath_descdma_cleanup ( struct ath_softc * sc,
struct ath_descdma * dd,
struct list_head * head )

References head.

Referenced by ath_rx_cleanup(), and ath_tx_cleanup().

◆ ath_startrecv()

int ath_startrecv ( struct ath_softc * sc)

Definition at line 196 of file ath9k_recv.c.

197{
198 struct ath_hw *ah = sc->sc_ah;
199 struct ath_buf *bf, *tbf;
200
201 if (list_empty(&sc->rx.rxbuf))
202 goto start_recv;
203
204 sc->rx.rxlink = NULL;
205 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
206 ath_rx_buf_link(sc, bf);
207 }
208
209 /* We could have deleted elements so the list may be empty now */
210 if (list_empty(&sc->rx.rxbuf))
211 goto start_recv;
212
213 bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list);
216
217start_recv:
218 ath_opmode_init(sc);
220
221 return 0;
222}
#define SC_OP_OFFCHANNEL
Definition ath9k.h:367
void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp)
Definition ath9k_mac.c:521
void ath9k_hw_startpcureceive(struct ath_hw *ah, int is_scanning)
Definition ath9k_mac.c:526
static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf)
Definition ath9k_recv.c:35
static void ath_opmode_init(struct ath_softc *sc)
Definition ath9k_recv.c:77
static void ath9k_hw_rxena(struct ath_hw *ah)
Definition hw-ops.h:34
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
Definition list.h:334
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
Definition list.h:459
#define list_empty(list)
Test whether a list is empty.
Definition list.h:137
uint8_t ah
Definition registers.h:1
struct list_head list
Definition ath9k.h:221
u32 bf_daddr
Definition ath9k.h:227
Definition hw.h:657
struct list_head rxbuf
Definition ath9k.h:302
u32 * rxlink
Definition ath9k.h:300
u32 sc_flags
Definition ath9k.h:466
struct ath_rx rx
Definition ath9k.h:476

References ah, ath9k_hw_putrxbuf(), ath9k_hw_rxena(), ath9k_hw_startpcureceive(), ath_opmode_init(), ath_rx_buf_link(), ath_buf::bf_daddr, ath_buf::list, list_empty, list_first_entry, list_for_each_entry_safe, NULL, ath_softc::rx, ath_rx::rxbuf, ath_rx::rxlink, ath_softc::sc_ah, ath_softc::sc_flags, and SC_OP_OFFCHANNEL.

Referenced by ath9k_start(), ath_reset(), and ath_set_channel().

◆ ath_stoprecv()

int ath_stoprecv ( struct ath_softc * sc)

Definition at line 224 of file ath9k_recv.c.

225{
226 struct ath_hw *ah = sc->sc_ah;
227 int stopped, reset = 0;
228
231 stopped = ath9k_hw_stopdmarecv(ah, &reset);
232
233 sc->rx.rxlink = NULL;
234
235 if (!(ah->ah_flags & AH_UNPLUGGED) &&
236 !stopped) {
237 DBG("ath9k: "
238 "Could not stop RX, we could be "
239 "confusing the DMA engine when we start RX up\n");
240 }
241 return stopped && !reset;
242}
void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits)
Definition ath9k_hw.c:1895
void ath9k_hw_abortpcurecv(struct ath_hw *ah)
Definition ath9k_mac.c:533
int ath9k_hw_stopdmarecv(struct ath_hw *ah, int *reset)
Definition ath9k_mac.c:538
#define AH_UNPLUGGED
Definition hw.h:655

References ah, AH_UNPLUGGED, ath9k_hw_abortpcurecv(), ath9k_hw_setrxfilter(), ath9k_hw_stopdmarecv(), DBG, NULL, ath_softc::rx, ath_rx::rxlink, and ath_softc::sc_ah.

Referenced by ath9k_stop(), ath_radio_disable(), ath_reset(), and ath_set_channel().

◆ ath_flushrecv()

void ath_flushrecv ( struct ath_softc * sc)

Definition at line 244 of file ath9k_recv.c.

245{
246 sc->sc_flags |= SC_OP_RXFLUSH;
247 ath_rx_tasklet(sc, 1, 0);
249}
#define SC_OP_RXFLUSH
Definition ath9k.h:370
int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)
Definition ath9k_recv.c:432

References ath_rx_tasklet(), ath_softc::sc_flags, and SC_OP_RXFLUSH.

Referenced by ath_radio_disable(), and ath_reset().

◆ ath_calcrxfilter()

u32 ath_calcrxfilter ( struct ath_softc * sc)

Definition at line 181 of file ath9k_recv.c.

182{
183#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
184
185 u32 rfilt;
186
190
191 return rfilt;
192
193#undef RX_FILTER_PRESERVE
194}
u32 ath9k_hw_getrxfilter(struct ath_hw *ah)
Definition ath9k_hw.c:1882
#define RX_FILTER_PRESERVE
@ ATH9K_RX_FILTER_BCAST
Definition mac.h:637
@ ATH9K_RX_FILTER_MCAST
Definition mac.h:636
@ ATH9K_RX_FILTER_UCAST
Definition mac.h:635
@ ATH9K_RX_FILTER_BEACON
Definition mac.h:639

References ath9k_hw_getrxfilter(), ATH9K_RX_FILTER_BCAST, ATH9K_RX_FILTER_BEACON, ATH9K_RX_FILTER_MCAST, ATH9K_RX_FILTER_UCAST, RX_FILTER_PRESERVE, ath_softc::sc_ah, and u32.

Referenced by ath_opmode_init().

◆ ath_rx_init()

int ath_rx_init ( struct ath_softc * sc,
int nbufs )

Definition at line 99 of file ath9k_recv.c.

100{
101 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
102 struct io_buffer *iob;
103 struct ath_buf *bf;
104 int error = 0;
105
107
108 common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 +
110
111 DBG2("ath9k: cachelsz %d rxbufsize %d\n",
112 common->cachelsz, common->rx_bufsize);
113
114 /* Initialize rx descriptors */
115
116 error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf,
117 "rx", nbufs, 1, 0);
118 if (error != 0) {
119 DBG("ath9k: "
120 "failed to allocate rx descriptors: %d\n",
121 error);
122 goto err;
123 }
124
125 list_for_each_entry(bf, &sc->rx.rxbuf, list) {
126 iob = alloc_iob_raw ( common->rx_bufsize, common->cachelsz, 0 );
127 if (iob == NULL) {
128 error = -ENOMEM;
129 goto err;
130 }
131
132 bf->bf_mpdu = iob;
133 bf->bf_buf_addr = virt_to_bus ( iob->data );
134 }
135 sc->rx.rxlink = NULL;
136
137err:
138 if (error)
139 ath_rx_cleanup(sc);
140
141 return error;
142}
#define IEEE80211_MAX_MPDU_LEN
Definition ath9k.h:149
int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, struct list_head *head, const char *name, int nbuf, int ndesc, int is_tx)
Definition ath9k_init.c:181
void ath_rx_cleanup(struct ath_softc *sc)
Definition ath9k_recv.c:144
static struct ath_common * ath9k_hw_common(struct ath_hw *ah)
Definition hw.h:870
struct ib_cm_common common
Definition ib_mad.h:0
struct io_buffer * alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
Definition iobuf.c:49
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition list.h:432
struct io_buffer * bf_mpdu
Definition ath9k.h:225
u32 bf_buf_addr
Definition ath9k.h:228
struct ath_descdma rxdma
Definition ath9k.h:303
A persistent I/O buffer.
Definition iobuf.h:38
void * data
Start of data.
Definition iobuf.h:53

References alloc_iob_raw(), ath9k_hw_common(), ath_descdma_setup(), ath_rx_cleanup(), ath_buf::bf_buf_addr, ath_buf::bf_mpdu, ath_hw::caps, common, io_buffer::data, DBG, DBG2, ENOMEM, error, IEEE80211_MAX_MPDU_LEN, ath_buf::list, list_for_each_entry, NULL, ath_softc::rx, ath9k_hw_capabilities::rx_status_len, ath_rx::rxbuf, ath_rx::rxdma, ath_rx::rxlink, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_RXFLUSH, and virt_to_bus().

Referenced by ath9k_init_device().

◆ ath_rx_cleanup()

void ath_rx_cleanup ( struct ath_softc * sc)

Definition at line 144 of file ath9k_recv.c.

145{
146 struct io_buffer *iob;
147 struct ath_buf *bf;
148
149 list_for_each_entry(bf, &sc->rx.rxbuf, list) {
150 iob = bf->bf_mpdu;
151 if (iob) {
152 free_iob(iob);
153 bf->bf_buf_addr = 0;
154 bf->bf_mpdu = NULL;
155 }
156 }
157
158 if (sc->rx.rxdma.dd_desc_len != 0)
159 ath_descdma_cleanup(sc, &sc->rx.rxdma, &sc->rx.rxbuf);
160}
void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd, struct list_head *head)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition iobuf.c:153

References ath_descdma_cleanup(), ath_buf::bf_buf_addr, ath_buf::bf_mpdu, ath_descdma::dd_desc_len, free_iob(), ath_buf::list, list_for_each_entry, NULL, ath_softc::rx, ath_rx::rxbuf, and ath_rx::rxdma.

Referenced by ath9k_deinit_device(), ath9k_init_device(), and ath_rx_init().

◆ ath_rx_tasklet()

int ath_rx_tasklet ( struct ath_softc * sc,
int flush,
int hp )

Definition at line 432 of file ath9k_recv.c.

433{
434 struct ath_buf *bf;
435 struct io_buffer *iob = NULL, *requeue_iob;
436 struct ath_hw *ah = sc->sc_ah;
438 /*
439 * The hw can technically differ from common->hw when using ath9k
440 * virtual wiphy so to account for that we iterate over the active
441 * wiphys and find the appropriate wiphy and therefore hw.
442 */
443 struct net80211_device *dev = sc->dev;
444 int retval;
445 int decrypt_error = 0;
446 struct ath_rx_status rs;
447 int rix = 0;
448
449 do {
450 /* If handling rx interrupt and flush is in progress => exit */
451 if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0))
452 break;
453
454 memset(&rs, 0, sizeof(rs));
455 bf = ath_get_next_rx_buf(sc, &rs);
456
457 if (!bf)
458 break;
459
460 iob = bf->bf_mpdu;
461 if (!iob)
462 continue;
463
464 /*
465 * If we're asked to flush receive queue, directly
466 * chain it back at the queue without processing it.
467 */
468 if (flush)
469 goto requeue_drop_frag;
470
472 &rix, &decrypt_error);
473 if (retval)
474 goto requeue_drop_frag;
475
476 /* Ensure we always have an iob to requeue once we are done
477 * processing the current buffer's iob */
478 requeue_iob = alloc_iob_raw ( common->rx_bufsize,
479 common->cachelsz, 0 );
480
481 /* If there is no memory we ignore the current RX'd frame,
482 * tell hardware it can give us a new frame using the old
483 * iob and put it at the tail of the sc->rx.rxbuf list for
484 * processing. */
485 if (!requeue_iob)
486 goto requeue_drop_frag;
487
488 iob_put(iob, rs.rs_datalen + ah->caps.rx_status_len);
489 if (ah->caps.rx_status_len)
490 iob_pull(iob, ah->caps.rx_status_len);
491
492 /* We will now give hardware our shiny new allocated iob */
493 bf->bf_mpdu = requeue_iob;
494 bf->bf_buf_addr = virt_to_bus ( requeue_iob->data );
495
496 /*
497 * change the default rx antenna if rx diversity chooses the
498 * other antenna 3 times in a row.
499 */
500 if (sc->rx.defant != rs.rs_antenna) {
501 if (++sc->rx.rxotherant >= 3)
502 ath_setdefantenna(sc, rs.rs_antenna);
503 } else {
504 sc->rx.rxotherant = 0;
505 }
506
507 DBGIO("ath9k: rx %d bytes, signal %d, bitrate %d, hw_value %d\n", rs.rs_datalen,
508 rs.rs_rssi, sc->rates[rix].bitrate, rs.rs_rate);
509
510 net80211_rx(dev, iob, rs.rs_rssi,
511 sc->rates[rix].bitrate);
512
513requeue_drop_frag:
514 list_del(&bf->list);
515 list_add_tail(&bf->list, &sc->rx.rxbuf);
516 ath_rx_buf_link(sc, bf);
518 } while (1);
519
520 return 0;
521}
unsigned long retval
Definition xen.h:46
static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
Definition ath9k_recv.c:69
static struct ath_buf * ath_get_next_rx_buf(struct ath_softc *sc, struct ath_rx_status *rs)
Definition ath9k_recv.c:251
static int ath9k_rx_iob_preprocess(struct ath_common *common, struct net80211_device *dev, struct ath_rx_status *rx_stats, int *rix, int *decrypt_error)
Definition ath9k_recv.c:409
#define DBGIO(...)
Definition compiler.h:549
void net80211_rx(struct net80211_device *dev, struct io_buffer *iob, int signal, u16 rate)
Handle receipt of 802.11 frame.
Definition net80211.c:2690
#define iob_put(iobuf, len)
Definition iobuf.h:125
#define iob_pull(iobuf, len)
Definition iobuf.h:107
#define list_del(list)
Delete an entry from a list.
Definition list.h:120
u8 rxotherant
Definition ath9k.h:299
u8 defant
Definition ath9k.h:298
struct net80211_device * dev
Definition ath9k.h:446
struct ath9k_legacy_rate rates[NET80211_MAX_RATES]
Definition ath9k.h:479
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787

References __unused, ah, alloc_iob_raw(), ath9k_hw_common(), ath9k_hw_rxena(), ath9k_rx_iob_preprocess(), ath_get_next_rx_buf(), ath_rx_buf_link(), ath_setdefantenna(), ath_buf::bf_buf_addr, ath_buf::bf_mpdu, ath9k_legacy_rate::bitrate, common, DBGIO, ath_rx::defant, ath_softc::dev, iob_pull, iob_put, ath_buf::list, list_add_tail, list_del, memset(), net80211_rx(), NULL, ath_softc::rates, retval, ath_rx_status::rs_antenna, ath_rx_status::rs_datalen, ath_rx_status::rs_rate, ath_rx_status::rs_rssi, ath_softc::rx, ath_rx::rxbuf, ath_rx::rxotherant, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_RXFLUSH, and virt_to_bus().

Referenced by ath9k_tasklet(), and ath_flushrecv().

◆ ath_txq_setup()

struct ath_txq * ath_txq_setup ( struct ath_softc * sc,
int qtype,
int subtype )

Definition at line 108 of file ath9k_xmit.c.

109{
110 struct ath_hw *ah = sc->sc_ah;
111 struct ath9k_tx_queue_info qi;
112 static const int subtype_txq_to_hwq[] = {
114 };
115 int axq_qnum, i;
116
117 memset(&qi, 0, sizeof(qi));
118 qi.tqi_subtype = subtype_txq_to_hwq[subtype];
119 qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT;
120 qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT;
121 qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT;
122 qi.tqi_physCompBuf = 0;
123
124 /*
125 * Enable interrupts only for EOL and DESC conditions.
126 * We mark tx descriptors to receive a DESC interrupt
127 * when a tx queue gets deep; otherwise waiting for the
128 * EOL to reap descriptors. Note that this is done to
129 * reduce interrupt load and this only defers reaping
130 * descriptors, never transmitting frames. Aside from
131 * reducing interrupts this also permits more concurrency.
132 * The only potential downside is if the tx queue backs
133 * up in which case the top half of the kernel may backup
134 * due to a lack of tx descriptors.
135 *
136 * The UAPSD queue is an exception, since we take a desc-
137 * based intr on the EOSP frames.
138 */
139 qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE |
141
142 axq_qnum = ath9k_hw_setuptxqueue(ah, qtype, &qi);
143 if (axq_qnum == -1) {
144 /*
145 * NB: don't print a message, this happens
146 * normally on parts with too few tx queues
147 */
148 return NULL;
149 }
150 if ((unsigned int)axq_qnum >= ARRAY_SIZE(sc->tx.txq)) {
151 DBG("ath9k: qnum %d out of range, max %zd!\n",
152 axq_qnum, ARRAY_SIZE(sc->tx.txq));
153 ath9k_hw_releasetxqueue(ah, axq_qnum);
154 return NULL;
155 }
156 if (!ATH_TXQ_SETUP(sc, axq_qnum)) {
157 struct ath_txq *txq = &sc->tx.txq[axq_qnum];
158
159 txq->axq_qnum = axq_qnum;
160 txq->mac80211_qnum = -1;
161 txq->axq_link = NULL;
162 INIT_LIST_HEAD(&txq->axq_q);
163 INIT_LIST_HEAD(&txq->axq_acq);
164 txq->axq_depth = 0;
165 txq->axq_ampdu_depth = 0;
166 txq->axq_tx_inprogress = 0;
167 sc->tx.txqsetup |= 1<<axq_qnum;
168
169 txq->txq_headidx = txq->txq_tailidx = 0;
170 for (i = 0; i < ATH_TXFIFO_DEPTH; i++)
171 INIT_LIST_HEAD(&txq->txq_fifo[i]);
173 }
174 return &sc->tx.txq[axq_qnum];
175}
#define ATH_TXFIFO_DEPTH
Definition ath9k.h:180
#define ATH_TXQ_SETUP(sc, i)
Definition ath9k.h:63
int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, const struct ath9k_tx_queue_info *qinfo)
Definition ath9k_mac.c:218
int ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
Definition ath9k_mac.c:261
#define ARRAY_SIZE(x)
Definition efx_common.h:43
uint8_t subtype
Slow protocols subtype.
Definition eth_slow.h:1
@ ATH_TXQ_AC_BE
Definition hw.h:171
#define ATH9K_TXQ_USEDEFAULT
Definition mac.h:598
@ TXQ_FLAG_TXDESCINT_ENABLE
Definition mac.h:589
@ TXQ_FLAG_TXEOLINT_ENABLE
Definition mac.h:590
struct ath_tx tx
Definition ath9k.h:477
struct ath_txq txq[ATH9K_NUM_TX_QUEUES]
Definition ath9k.h:286
u32 txqsetup
Definition ath9k.h:284
struct list_head axq_q
Definition ath9k.h:185
struct list_head axq_acq
Definition ath9k.h:190
u32 * axq_link
Definition ath9k.h:184
u32 axq_ampdu_depth
Definition ath9k.h:187
u8 txq_headidx
Definition ath9k.h:193
u8 txq_tailidx
Definition ath9k.h:194
u32 axq_depth
Definition ath9k.h:186
struct list_head txq_fifo[ATH_TXFIFO_DEPTH]
Definition ath9k.h:191
int mac80211_qnum
Definition ath9k.h:182
struct list_head txq_fifo_pending
Definition ath9k.h:192
u32 axq_qnum
Definition ath9k.h:183
int axq_tx_inprogress
Definition ath9k.h:189

References ah, ARRAY_SIZE, ath9k_hw_releasetxqueue(), ath9k_hw_setuptxqueue(), ATH9K_TXQ_USEDEFAULT, ATH_TXFIFO_DEPTH, ATH_TXQ_AC_BE, ATH_TXQ_SETUP, ath_txq::axq_acq, ath_txq::axq_ampdu_depth, ath_txq::axq_depth, ath_txq::axq_link, ath_txq::axq_q, ath_txq::axq_qnum, ath_txq::axq_tx_inprogress, DBG, INIT_LIST_HEAD, ath_txq::mac80211_qnum, memset(), NULL, ath_softc::sc_ah, subtype, ath9k_tx_queue_info::tqi_aifs, ath9k_tx_queue_info::tqi_cwmax, ath9k_tx_queue_info::tqi_cwmin, ath9k_tx_queue_info::tqi_physCompBuf, ath9k_tx_queue_info::tqi_qflags, ath9k_tx_queue_info::tqi_subtype, ath_softc::tx, ath_tx::txq, ath_txq::txq_fifo, ath_txq::txq_fifo_pending, TXQ_FLAG_TXDESCINT_ENABLE, TXQ_FLAG_TXEOLINT_ENABLE, ath_txq::txq_headidx, ath_txq::txq_tailidx, ath_tx::txqsetup, and WME_AC_BE.

Referenced by ath9k_init_queues().

◆ ath_tx_cleanupq()

void ath_tx_cleanupq ( struct ath_softc * sc,
struct ath_txq * txq )

Definition at line 257 of file ath9k_xmit.c.

258{
260 sc->tx.txqsetup &= ~(1<<txq->axq_qnum);
261}

References ath9k_hw_releasetxqueue(), ath_txq::axq_qnum, ath_softc::sc_ah, ath_softc::tx, and ath_tx::txqsetup.

Referenced by ath9k_deinit_softc(), and ath9k_init_softc().

◆ ath_drain_all_txq()

int ath_drain_all_txq ( struct ath_softc * sc,
int retry_tx )

Definition at line 218 of file ath9k_xmit.c.

219{
220 struct ath_hw *ah = sc->sc_ah;
221 struct ath_txq *txq;
222 int i, npend = 0;
223
224 if (sc->sc_flags & SC_OP_INVALID)
225 return 1;
226
228
229 /* Check if any queue remains active */
230 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
231 if (!ATH_TXQ_SETUP(sc, i))
232 continue;
233
234 npend += ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum);
235 }
236
237 if (npend)
238 DBG("ath9k: Failed to stop TX DMA!\n");
239
240 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
241 if (!ATH_TXQ_SETUP(sc, i))
242 continue;
243
244 /*
245 * The caller will resume queues with ieee80211_wake_queues.
246 * Mark the queue as not stopped to prevent ath_tx_complete
247 * from waking the queue too early.
248 */
249 txq = &sc->tx.txq[i];
250 txq->stopped = 0;
251 ath_draintxq(sc, txq, retry_tx);
252 }
253
254 return !npend;
255}
#define SC_OP_INVALID
Definition ath9k.h:363
u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
Definition ath9k_mac.c:64
void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
Definition ath9k_mac.c:131
void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, int retry_tx __unused)
Definition ath9k_xmit.c:183
#define ATH9K_NUM_TX_QUEUES
Definition mac.h:581
int stopped
Definition ath9k.h:188

References ah, ath9k_hw_abort_tx_dma(), ath9k_hw_numtxpending(), ATH9K_NUM_TX_QUEUES, ath_draintxq(), ATH_TXQ_SETUP, ath_txq::axq_qnum, DBG, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_INVALID, ath_txq::stopped, ath_softc::tx, and ath_tx::txq.

Referenced by ath9k_stop(), ath_radio_disable(), ath_reset(), and ath_set_channel().

◆ ath_draintxq()

void ath_draintxq ( struct ath_softc * sc,
struct ath_txq * txq,
int retry_tx )

Definition at line 183 of file ath9k_xmit.c.

184{
185 struct ath_buf *bf, *lastbf __unused;
186 struct list_head bf_head;
187 struct ath_tx_status ts;
188
189 memset(&ts, 0, sizeof(ts));
190 INIT_LIST_HEAD(&bf_head);
191
192 for (;;) {
193 if (list_empty(&txq->axq_q)) {
194 txq->axq_link = NULL;
195 break;
196 }
197 bf = list_first_entry(&txq->axq_q, struct ath_buf,
198 list);
199
200 if (bf->bf_stale) {
201 list_del(&bf->list);
202
203 ath_tx_return_buffer(sc, bf);
204 continue;
205 }
206
207 lastbf = bf->bf_lastbf;
208
209 list_cut_position(&bf_head, &txq->axq_q, &lastbf->list);
210
211 txq->axq_depth--;
212 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
213 }
214
215 txq->axq_tx_inprogress = 0;
216}
static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, struct ath_txq *txq, struct list_head *bf_q, struct ath_tx_status *ts, int txok, int sendbar)
Definition ath9k_xmit.c:625
static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
Definition ath9k_xmit.c:99
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define list_cut_position(new, list, entry)
Cut a list into two.
Definition list.h:186
int bf_stale
Definition ath9k.h:229
struct ath_buf * bf_lastbf
Definition ath9k.h:222
A doubly-linked list entry (or list head)
Definition list.h:19

References __unused, ath_tx_complete_buf(), ath_tx_return_buffer(), ath_txq::axq_depth, ath_txq::axq_link, ath_txq::axq_q, ath_txq::axq_tx_inprogress, ath_buf::bf_lastbf, ath_buf::bf_stale, INIT_LIST_HEAD, ath_buf::list, list_cut_position, list_del, list_empty, list_first_entry, memset(), and NULL.

Referenced by ath_drain_all_txq().

◆ ath_txq_schedule()

void ath_txq_schedule ( struct ath_softc * sc,
struct ath_txq * txq )

Referenced by ath_reset().

◆ ath_tx_init()

int ath_tx_init ( struct ath_softc * sc,
int nbufs )

Definition at line 790 of file ath9k_xmit.c.

791{
792 int error = 0;
793
794 error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf,
795 "tx", nbufs, 1, 1);
796 if (error != 0) {
797 DBG("ath9k: "
798 "Failed to allocate tx descriptors: %d\n", error);
799 goto err;
800 }
801
803
804err:
805 if (error != 0)
806 ath_tx_cleanup(sc);
807
808 return error;
809}
void ath_tx_cleanup(struct ath_softc *sc)
Definition ath9k_xmit.c:811
static void ath_tx_complete_poll_work(struct ath_softc *sc)
Definition ath9k_xmit.c:743
void(* tx_complete_work)(struct ath_softc *sc)
Definition ath9k.h:485
struct ath_descdma txdma
Definition ath9k.h:287
struct list_head txbuf
Definition ath9k.h:285

References ath_descdma_setup(), ath_tx_cleanup(), ath_tx_complete_poll_work(), DBG, error, ath_softc::tx, ath_softc::tx_complete_work, ath_tx::txbuf, and ath_tx::txdma.

Referenced by ath9k_init_device().

◆ ath_tx_cleanup()

void ath_tx_cleanup ( struct ath_softc * sc)

Definition at line 811 of file ath9k_xmit.c.

812{
813 if (sc->tx.txdma.dd_desc_len != 0)
814 ath_descdma_cleanup(sc, &sc->tx.txdma, &sc->tx.txbuf);
815}

References ath_descdma_cleanup(), ath_descdma::dd_desc_len, ath_softc::tx, ath_tx::txbuf, and ath_tx::txdma.

Referenced by ath9k_deinit_device(), ath9k_init_device(), and ath_tx_init().

◆ ath_txq_update()

int ath_txq_update ( struct ath_softc * sc,
int qnum,
struct ath9k_tx_queue_info * q )

◆ ath_tx_start()

int ath_tx_start ( struct net80211_device * dev,
struct io_buffer * iob,
struct ath_tx_control * txctl )

Definition at line 571 of file ath9k_xmit.c.

573{
574 struct ath_softc *sc = dev->priv;
575 struct ath_txq *txq = txctl->txq;
576 struct ath_buf *bf;
577 int q;
578
579 /*
580 * At this point, the vif, hw_key and sta pointers in the tx control
581 * info are no longer valid (overwritten by the ath_frame_info data.
582 */
583
584 bf = ath_tx_setup_buffer(dev, txctl->txq, iob);
585 if (!bf)
586 return -ENOMEM;
587
588 q = 0;
589 if (txq == sc->tx.txq_map[q] &&
590 ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
591 txq->stopped = 1;
592 }
593
594 ath_tx_start_dma(sc, bf, txctl);
595
596 return 0;
597}
#define ATH_MAX_QDEPTH
Definition ath9k.h:126
static struct ath_buf * ath_tx_setup_buffer(struct net80211_device *dev, struct ath_txq *txq, struct io_buffer *iob)
Definition ath9k_xmit.c:500
static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, struct ath_tx_control *txctl)
Definition ath9k_xmit.c:551
struct ath_txq * txq
Definition ath9k.h:267
struct ath_txq * txq_map[WME_NUM_AC]
Definition ath9k.h:288
int pending_frames
Definition ath9k.h:195
void * priv
Driver private data.
Definition net80211.h:798

References ATH_MAX_QDEPTH, ath_tx_setup_buffer(), ath_tx_start_dma(), ath_softc::dev, ENOMEM, ath_txq::pending_frames, net80211_device::priv, ath_txq::stopped, ath_softc::tx, ath_tx_control::txq, and ath_tx::txq_map.

Referenced by ath9k_tx().

◆ ath_tx_tasklet()

void ath_tx_tasklet ( struct ath_softc * sc)

Definition at line 773 of file ath9k_xmit.c.

774{
775 int i;
776 u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1);
777
778 ath9k_hw_gettxintrtxqs(sc->sc_ah, &qcumask);
779
780 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
781 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
782 ath_tx_processq(sc, &sc->tx.txq[i]);
783 }
784}
void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs)
Definition ath9k_mac.c:158
static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
Definition ath9k_xmit.c:658

References ath9k_hw_gettxintrtxqs(), ATH9K_NUM_TX_QUEUES, ath_tx_processq(), ATH_TXQ_SETUP, ath_softc::sc_ah, ath_softc::tx, ath_tx::txq, and u32.

Referenced by ath9k_tasklet().

◆ ath_hw_pll_work()

void ath_hw_pll_work ( struct ath_softc * sc)

Definition at line 327 of file ath9k_main.c.

328{
329 u32 pll_sqsum;
330
331 if (AR_SREV_9485(sc->sc_ah)) {
332 pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah);
333
334 ath_hw_pll_rx_hang_check(sc, pll_sqsum);
335
336 sc->hw_pll_work_timer = (currticks() * 1000 ) / TICKS_PER_SEC + 200;
337 }
338}
#define AR_SREV_9485(_ah)
Definition reg.h:868
u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah)
Definition ath9k_hw.c:611
static void ath_hw_pll_rx_hang_check(struct ath_softc *sc, u32 pll_sqsum)
Definition ath9k_main.c:310
#define TICKS_PER_SEC
Number of ticks per second.
Definition timer.h:16
unsigned long hw_pll_work_timer
Definition ath9k.h:488
unsigned long currticks(void)
Get current system time in ticks.
Definition timer.c:43

References ar9003_get_pll_sqsum_dvc(), AR_SREV_9485, ath_hw_pll_rx_hang_check(), currticks(), ath_softc::hw_pll_work_timer, ath_softc::sc_ah, TICKS_PER_SEC, and u32.

Referenced by ath9k_init_device().

◆ ath_ani_calibrate()

void ath_ani_calibrate ( struct ath_softc * sc)

Definition at line 202 of file ath9k_main.c.

203{
204 struct ath_hw *ah = sc->sc_ah;
206 int longcal = 0;
207 int shortcal = 0;
208 int aniflag = 0;
209 unsigned int timestamp = (currticks() * 1000 ) / TICKS_PER_SEC;
210 u32 cal_interval, short_cal_interval, long_cal_interval;
211
212 if (ah->caldata && ah->caldata->nfcal_interference)
213 long_cal_interval = ATH_LONG_CALINTERVAL_INT;
214 else
215 long_cal_interval = ATH_LONG_CALINTERVAL;
216
217 short_cal_interval = ATH_STA_SHORT_CALINTERVAL;
218
219 /* Only calibrate if awake */
220 if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE)
221 goto set_timer;
222
223 /* Long calibration runs independently of short calibration. */
224 if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) {
225 longcal = 1;
226 DBG2("ath9k: longcal @%d\n", timestamp);
227 common->ani.longcal_timer = timestamp;
228 }
229
230 /* Short calibration applies only while caldone is false */
231 if (!common->ani.caldone) {
232 if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) {
233 shortcal = 1;
234 DBG2("ath9k: "
235 "shortcal @%d\n", timestamp);
236 common->ani.shortcal_timer = timestamp;
237 common->ani.resetcal_timer = timestamp;
238 }
239 } else {
240 if ((timestamp - common->ani.resetcal_timer) >=
242 common->ani.caldone = ath9k_hw_reset_calvalid(ah);
243 if (common->ani.caldone)
244 common->ani.resetcal_timer = timestamp;
245 }
246 }
247
248 /* Verify whether we must check ANI */
249 if ((timestamp - common->ani.checkani_timer) >=
250 ah->config.ani_poll_interval) {
251 aniflag = 1;
252 common->ani.checkani_timer = timestamp;
253 }
254
255 /* Skip all processing if there's nothing to do. */
256 if (longcal || shortcal || aniflag) {
257 /* Call ANI routine if necessary */
258 if (aniflag) {
259 ath9k_hw_ani_monitor(ah, ah->curchan);
261 }
262
263 /* Perform calibration if necessary */
264 if (longcal || shortcal) {
265 common->ani.caldone =
267 ah->curchan,
268 common->rx_chainmask,
269 longcal);
270 }
271 }
272
273set_timer:
274 /*
275 * Set timer interval based on previous results.
276 * The interval must be the shortest necessary to satisfy ANI,
277 * short calibration and long calibration.
278 */
279 cal_interval = ATH_LONG_CALINTERVAL;
280 if (sc->sc_ah->config.enable_ani)
281 cal_interval = min(cal_interval,
282 (u32)ah->config.ani_poll_interval);
283 if (!common->ani.caldone)
284 cal_interval = min(cal_interval, (u32)short_cal_interval);
285
286 common->ani.timer = timestamp + cal_interval;
287}
#define ATH_STA_SHORT_CALINTERVAL
Definition ath9k.h:335
#define ATH_LONG_CALINTERVAL
Definition ath9k.h:340
#define ATH_RESTART_CALINTERVAL
Definition ath9k.h:341
#define ATH_LONG_CALINTERVAL_INT
Definition ath9k.h:339
void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan __unused)
Definition ath9k_ani.c:599
int ath9k_hw_reset_calvalid(struct ath_hw *ah)
static int ath_update_survey_stats(struct ath_softc *sc)
Definition ath9k_main.c:73
#define min(x, y)
Definition ath.h:36
uint64_t timestamp
Timestamp.
Definition ena.h:9
static int ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, u8 rxchainmask, int longcal)
Definition hw-ops.h:50
@ ATH9K_PM_AWAKE
Definition hw.h:380
u32 enable_ani
Definition hw.h:232
struct ath9k_ops_config config
Definition hw.h:663
enum ath9k_power_mode power_mode
Definition hw.h:692

References ah, ath9k_hw_ani_monitor(), ath9k_hw_calibrate(), ath9k_hw_common(), ath9k_hw_reset_calvalid(), ATH9K_PM_AWAKE, ATH_LONG_CALINTERVAL, ATH_LONG_CALINTERVAL_INT, ATH_RESTART_CALINTERVAL, ATH_STA_SHORT_CALINTERVAL, ath_update_survey_stats(), common, ath_hw::config, currticks(), DBG2, ath9k_ops_config::enable_ani, min, ath_hw::power_mode, ath_softc::sc_ah, TICKS_PER_SEC, timestamp, and u32.

Referenced by ath_isr().

◆ ath9k_tasklet()

void ath9k_tasklet ( struct ath_softc * sc)

Definition at line 341 of file ath9k_main.c.

342{
343 struct ath_hw *ah = sc->sc_ah;
344
345 u32 status = sc->intrstatus;
346 u32 rxmask;
347
348 if ((status & ATH9K_INT_FATAL) ||
350 ath_reset(sc, 1);
351 return;
352 }
353
355
356 if (status & rxmask) {
357 ath_rx_tasklet(sc, 0, 0);
358 }
359
360 if (status & ATH9K_INT_TX) {
361 ath_tx_tasklet(sc);
362 }
363
364 /* re-enable hardware interrupt */
366}
void ath_tx_tasklet(struct ath_softc *sc)
Definition ath9k_xmit.c:773
int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp)
Definition ath9k_recv.c:432
void ath9k_hw_enable_interrupts(struct ath_hw *ah)
Definition ath9k_mac.c:618
int ath_reset(struct ath_softc *sc, int retry_tx)
Definition ath9k_main.c:513
uint8_t status
Status.
Definition ena.h:5
@ ATH9K_INT_RX
Definition hw.h:253
@ ATH9K_INT_TX
Definition hw.h:260
@ ATH9K_INT_RXEOL
Definition hw.h:258
@ ATH9K_INT_BB_WATCHDOG
Definition hw.h:263
@ ATH9K_INT_RXORN
Definition hw.h:259
@ ATH9K_INT_FATAL
Definition hw.h:280
u32 intrstatus
Definition ath9k.h:465

References ah, ath9k_hw_enable_interrupts(), ATH9K_INT_BB_WATCHDOG, ATH9K_INT_FATAL, ATH9K_INT_RX, ATH9K_INT_RXEOL, ATH9K_INT_RXORN, ATH9K_INT_TX, ath_reset(), ath_rx_tasklet(), ath_tx_tasklet(), ath_softc::intrstatus, ath_softc::sc_ah, status, and u32.

Referenced by ath9k_init_softc().

◆ ath_reset()

int ath_reset ( struct ath_softc * sc,
int retry_tx )

Definition at line 513 of file ath9k_main.c.

514{
515 struct ath_hw *ah = sc->sc_ah;
517 int r;
518
519 sc->hw_busy_count = 0;
520
521 /* Stop ANI */
522 common->ani.timer = 0;
523
525 ath_drain_all_txq(sc, retry_tx);
526
527 ath_stoprecv(sc);
528 ath_flushrecv(sc);
529
530 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, 0);
531 if (r)
532 DBG("ath9k: "
533 "Unable to reset hardware; reset status %d\n", r);
534
535 if (ath_startrecv(sc) != 0)
536 DBG("ath9k: Unable to start recv logic\n");
537
538 /*
539 * We may be doing a reset in response to a request
540 * that changes the channel so update any state that
541 * might change as a result.
542 */
544 sc->config.txpowlimit, &sc->curtxpow);
545
547
548 if (retry_tx) {
549 int i;
550 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
551 if (ATH_TXQ_SETUP(sc, i)) {
552 ath_txq_schedule(sc, &sc->tx.txq[i]);
553 }
554 }
555 }
556
557 /* Start ANI */
559
560 return r;
561}
int ath_stoprecv(struct ath_softc *sc)
Definition ath9k_recv.c:224
int ath_drain_all_txq(struct ath_softc *sc, int retry_tx)
Definition ath9k_xmit.c:218
void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
void ath_flushrecv(struct ath_softc *sc)
Definition ath9k_recv.c:244
int ath_startrecv(struct ath_softc *sc)
Definition ath9k_recv.c:196
void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, u16 new_txpow, u16 *txpower)
int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, struct ath9k_hw_cal_data *caldata, int bChannelChange)
Definition ath9k_hw.c:1218
void ath9k_hw_set_interrupts(struct ath_hw *ah, unsigned int ints)
Definition ath9k_mac.c:643
void ath9k_hw_disable_interrupts(struct ath_hw *ah)
Definition ath9k_mac.c:604
static void ath_start_ani(struct ath_common *common)
Definition ath9k_main.c:37
static const uint8_t r[3][4]
MD4 shift amounts.
Definition md4.c:54
u16 txpowlimit
Definition ath9k.h:66
struct ath9k_channel * curchan
Definition hw.h:666
u16 curtxpow
Definition ath9k.h:468
unsigned int hw_busy_count
Definition ath9k.h:463
struct ath_config config
Definition ath9k.h:475

References ah, ath9k_cmn_update_txpow(), ath9k_hw_common(), ath9k_hw_disable_interrupts(), ath9k_hw_reset(), ath9k_hw_set_interrupts(), ATH9K_NUM_TX_QUEUES, ath_drain_all_txq(), ath_flushrecv(), ath_start_ani(), ath_startrecv(), ath_stoprecv(), ath_txq_schedule(), ATH_TXQ_SETUP, common, ath_softc::config, ath_hw::curchan, ath_softc::curtxpow, DBG, ath_softc::hw_busy_count, r, ath_softc::sc_ah, ath_softc::tx, ath_config::txpowlimit, and ath_tx::txq.

Referenced by ath9k_tasklet(), ath_hw_check(), ath_hw_pll_rx_hang_check(), and ath_tx_complete_poll_work().

◆ ath_read_cachesize()

void ath_read_cachesize ( struct ath_common * common,
int * csz )
inlinestatic

Definition at line 496 of file ath9k.h.

497{
498 common->bus_ops->read_cachesize(common, csz);
499}

References common.

Referenced by ath9k_init_softc().

◆ ath_isr()

void ath_isr ( struct net80211_device * dev)

Definition at line 368 of file ath9k_main.c.

369{
370#define SCHED_INTR ( \
371 ATH9K_INT_FATAL | \
372 ATH9K_INT_BB_WATCHDOG | \
373 ATH9K_INT_RXORN | \
374 ATH9K_INT_RXEOL | \
375 ATH9K_INT_RX | \
376 ATH9K_INT_RXLP | \
377 ATH9K_INT_RXHP | \
378 ATH9K_INT_TX | \
379 ATH9K_INT_BMISS | \
380 ATH9K_INT_CST | \
381 ATH9K_INT_TSFOOR | \
382 ATH9K_INT_GENTIMER)
383
384 struct ath_softc *sc = dev->priv;
385 struct ath_hw *ah = sc->sc_ah;
387 enum ath9k_int status;
388 unsigned long timestamp = (currticks() * 1000 ) / TICKS_PER_SEC;
389 int sched = 0;
390
391 /*
392 * The hardware is not ready/present, don't
393 * touch anything. Note this can happen early
394 * on if the IRQ is shared.
395 */
396 if (sc->sc_flags & SC_OP_INVALID)
397 return;
398
399
400 /* Check calibration */
401 if(timestamp >= (unsigned int)common->ani.timer && common->ani.timer)
403
404 /* Check tx_complete_work */
405 if(timestamp >= (unsigned int)sc->tx_complete_work_timer && sc->tx_complete_work_timer)
406 sc->tx_complete_work(sc);
407
408 /* Check hw_pll_work */
409 if(timestamp >= (unsigned int)sc->hw_pll_work_timer && sc->hw_pll_work_timer)
410 sc->hw_pll_work(sc);
411
412 /* shared irq, not for us */
413
414 if (!ath9k_hw_intrpend(ah))
415 return;
416
417 /*
418 * Figure out the reason(s) for the interrupt. Note
419 * that the hal returns a pseudo-ISR that may include
420 * bits we haven't explicitly enabled so we mask the
421 * value to insure we only process bits we requested.
422 */
423 ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */
424 status &= ah->imask; /* discard unasked-for bits */
425
426 /*
427 * If there are no status bits set, then this interrupt was not
428 * for me (should have been caught above).
429 */
430 if (!status)
431 return;
432
433 /* Cache the status */
434 sc->intrstatus = status;
435
436 if (status & SCHED_INTR)
437 sched = 1;
438
439 /*
440 * If a FATAL or RXORN interrupt is received, we have to reset the
441 * chip immediately.
442 */
444 goto chip_reset;
445
448
449 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP))
451 if (sc->ps_idle)
452 goto chip_reset;
453 /* Clear RxAbort bit so that we can
454 * receive frames */
458 }
459
460chip_reset:
461
462 if (sched) {
463 /* turn off every interrupt */
465 sc->intr_tq(sc);
466 }
467
468 return;
469
470#undef SCHED_INTR
471}
#define PS_WAIT_FOR_BEACON
Definition ath9k.h:381
int ath9k_hw_intrpend(struct ath_hw *ah)
Definition ath9k_mac.c:585
int ath9k_hw_updatetxtriglevel(struct ath_hw *ah, int bIncTrigLevel)
ath9k_hw_updatetxtriglevel - adjusts the frame trigger level
Definition ath9k_mac.c:103
int ath9k_hw_setrxabort(struct ath_hw *ah, int set)
Definition ath9k_mac.c:492
int ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode)
Definition ath9k_main.c:28
#define SCHED_INTR
void ath_ani_calibrate(struct ath_softc *sc)
Definition ath9k_main.c:202
static int ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
Definition hw-ops.h:58
@ ATH9K_HW_CAP_AUTOSLEEP
Definition hw.h:185
ath9k_int
Definition hw.h:252
@ ATH9K_INT_TXURN
Definition hw.h:264
@ ATH9K_INT_TIM_TIMER
Definition hw.h:262
void(* intr_tq)(struct ath_softc *sc)
Definition ath9k.h:454
void(* hw_pll_work)(struct ath_softc *sc)
Definition ath9k.h:487
int ps_idle
Definition ath9k.h:470
unsigned long tx_complete_work_timer
Definition ath9k.h:486
u16 ps_flags
Definition ath9k.h:467

References ah, ATH9K_HW_CAP_AUTOSLEEP, ath9k_hw_common(), ath9k_hw_disable_interrupts(), ath9k_hw_getisr(), ath9k_hw_intrpend(), ath9k_hw_setrxabort(), ath9k_hw_updatetxtriglevel(), ATH9K_INT_FATAL, ATH9K_INT_RXORN, ATH9K_INT_TIM_TIMER, ATH9K_INT_TXURN, ATH9K_PM_AWAKE, ath9k_setpower(), ath_ani_calibrate(), common, currticks(), ath_softc::dev, ath_softc::hw_pll_work, ath_softc::hw_pll_work_timer, ath_softc::intr_tq, ath_softc::intrstatus, net80211_device::priv, ath_softc::ps_flags, ath_softc::ps_idle, PS_WAIT_FOR_BEACON, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_INVALID, SCHED_INTR, status, TICKS_PER_SEC, timestamp, ath_softc::tx_complete_work, and ath_softc::tx_complete_work_timer.

Referenced by ath9k_poll().

◆ ath9k_init_crypto()

void ath9k_init_crypto ( struct ath_softc * sc)

Definition at line 276 of file ath9k_init.c.

277{
278 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
279 unsigned int i = 0;
280
281 /* Get the hardware key cache size. */
282 common->keymax = AR_KEYTABLE_SIZE;
283
284 /*
285 * Reset the key cache since some parts do not
286 * reset the contents on initial power up.
287 */
288 for (i = 0; i < common->keymax; i++)
290
291 /*
292 * Check whether the separate key cache entries
293 * are required to handle both tx+rx MIC keys.
294 * With split mic keys the number of stations is limited
295 * to 27 otherwise 59.
296 */
298 common->crypt_caps |= ATH_CRYPT_CAP_MIC_COMBINED;
299}
#define AR_PCU_MIC_NEW_LOC_ENA
Definition reg.h:1643
int ath_hw_keyreset(struct ath_common *common, u16 entry)
Definition ath_key.c:43
@ ATH_CRYPT_CAP_MIC_COMBINED
Definition ath.h:151
#define AR_KEYTABLE_SIZE
Definition hw.h:149
u32 misc_mode
Definition hw.h:750
#define u16
Definition vga.h:20

References AR_KEYTABLE_SIZE, AR_PCU_MIC_NEW_LOC_ENA, ath9k_hw_common(), ATH_CRYPT_CAP_MIC_COMBINED, ath_hw_keyreset(), common, ath_hw::misc_mode, ath_softc::sc_ah, and u16.

Referenced by ath9k_init_softc().

◆ ath9k_init_device()

int ath9k_init_device ( u16 devid,
struct ath_softc * sc,
u16 subsysid,
const struct ath_bus_ops * bus_ops )

Definition at line 487 of file ath9k_init.c.

489{
490 struct net80211_device *dev = sc->dev;
491 /*struct ath_common *common;
492 struct ath_hw *ah;*/
493 int error = 0;
494 /*struct ath_regulatory *reg;*/
495
496 /* Bring up device */
497 error = ath9k_init_softc(devid, sc, subsysid, bus_ops);
498 if (error != 0)
499 goto error_init;
500
501 /*ah = sc->sc_ah;
502 common = ath9k_hw_common(ah);*/
503 ath9k_set_hw_capab(sc, dev);
504 /* TODO Cottsay: reg */
505 /* Initialize regulatory */
506 /*error = ath_regd_init(&common->regulatory, sc->dev->wiphy,
507 ath9k_reg_notifier);
508 if (error)
509 goto error_regd;
510
511 reg = &common->regulatory;*/
512
513 /* Setup TX DMA */
515 if (error != 0)
516 goto error_tx;
517
518 /* Setup RX DMA */
520 if (error != 0)
521 goto error_rx;
522
524
525 /* Register with mac80211 */
527 if (error)
528 goto error_register;
529
530 /* TODO Cottsay: reg */
531 /* Handle world regulatory */
532 /*if (!ath_is_world_regd(reg)) {
533 error = regulatory_hint(hw->wiphy, reg->alpha2);
534 if (error)
535 goto error_world;
536 }*/
537
540
541 /* TODO Cottsay: rfkill */
542 /*ath_start_rfkill_poll(sc);*/
543
544 return 0;
545
546//error_world:
547// net80211_unregister(dev);
548error_register:
549 ath_rx_cleanup(sc);
550error_rx:
551 ath_tx_cleanup(sc);
552error_tx:
554error_init:
555 return error;
556}
int ath_tx_init(struct ath_softc *sc, int nbufs)
Definition ath9k_xmit.c:790
int ath_rx_init(struct ath_softc *sc, int nbufs)
Definition ath9k_recv.c:99
void ath_hw_pll_work(struct ath_softc *sc)
Definition ath9k_main.c:327
void ath_tx_cleanup(struct ath_softc *sc)
Definition ath9k_xmit.c:811
struct net80211_device_operations ath9k_ops
Definition ath9k_main.c:911
void ath_rx_cleanup(struct ath_softc *sc)
Definition ath9k_recv.c:144
static void ath9k_init_txpower_limits(struct ath_softc *sc)
Definition ath9k_init.c:455
void ath9k_set_hw_capab(struct ath_softc *sc, struct net80211_device *dev __unused)
Definition ath9k_init.c:468
static void ath9k_deinit_softc(struct ath_softc *sc)
Definition ath9k_init.c:562
static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, const struct ath_bus_ops *bus_ops)
Definition ath9k_init.c:357
#define ATH_TXBUF
Definition base.h:54
#define ATH_RXBUF
Definition base.h:53
#define ATH_RSSI_DUMMY_MARKER
Definition common.h:38
int net80211_register(struct net80211_device *dev, struct net80211_device_operations *ops, struct net80211_hw_info *hw)
Register 802.11 device with network stack.
Definition net80211.c:792
int last_rssi
Definition ath9k.h:483
struct net80211_hw_info * hwinfo
Definition ath9k.h:478

References ath9k_deinit_softc(), ath9k_init_softc(), ath9k_init_txpower_limits(), ath9k_ops, ath9k_set_hw_capab(), ath_hw_pll_work(), ATH_RSSI_DUMMY_MARKER, ath_rx_cleanup(), ath_rx_init(), ATH_RXBUF, ath_tx_cleanup(), ath_tx_init(), ATH_TXBUF, ath_softc::dev, error, ath_softc::hw_pll_work, ath_softc::hwinfo, ath_softc::last_rssi, net80211_register(), and u16.

Referenced by ath_pci_probe().

◆ ath9k_deinit_device()

void ath9k_deinit_device ( struct ath_softc * sc)

Definition at line 578 of file ath9k_init.c.

579{
580 struct net80211_device *dev = sc->dev;
581
583 ath_rx_cleanup(sc);
584 ath_tx_cleanup(sc);
586}
void net80211_unregister(struct net80211_device *dev)
Unregister 802.11 device from network stack.
Definition net80211.c:825

References ath9k_deinit_softc(), ath_rx_cleanup(), ath_tx_cleanup(), ath_softc::dev, and net80211_unregister().

Referenced by ath_pci_remove().

◆ ath9k_set_hw_capab()

void ath9k_set_hw_capab ( struct ath_softc * sc,
struct net80211_device * dev )

◆ ath_set_channel()

int ath_set_channel ( struct ath_softc * sc,
struct net80211_device * dev,
struct ath9k_channel * hchan )

Definition at line 118 of file ath9k_main.c.

120{
121 struct ath_hw *ah = sc->sc_ah;
123 int fastcc __unused = 1, stopped __unused;
124 struct net80211_channel *channel = dev->channels + dev->channel;
125 struct ath9k_hw_cal_data *caldata = NULL;
126 int r;
127
128 if (sc->sc_flags & SC_OP_INVALID)
129 return -EIO;
130
131 sc->hw_busy_count = 0;
132
133 common->ani.timer = 0;
135 sc->hw_pll_work_timer = 0;
136
137 /*
138 * This is only performed if the channel settings have
139 * actually changed.
140 *
141 * To switch channels clear any pending DMA operations;
142 * wait long enough for the RX fifo to drain, reset the
143 * hardware at the new frequency, and then re-enable
144 * the relevant bits of the h/w.
145 */
147 stopped = ath_drain_all_txq(sc, 0);
148
149 if (!ath_stoprecv(sc))
150 stopped = 0;
151
153 stopped = 0;
154
155 /* XXX: do not flush receive queue here. We don't want
156 * to flush data frames already in queue because of
157 * changing channel. */
158
159 if (!(sc->sc_flags & SC_OP_OFFCHANNEL))
160 caldata = &sc->caldata;
161
162 DBG2("ath9k: "
163 "(%d MHz) -> (%d MHz)\n",
164 sc->sc_ah->curchan->channel,
165 channel->center_freq);
166
167 r = ath9k_hw_reset(ah, hchan, caldata, fastcc);
168 if (r) {
169 DBG("ath9k: "
170 "Unable to reset channel (%d MHz), reset status %d\n",
171 channel->center_freq, r);
172 goto ps_restore;
173 }
174
175 if (ath_startrecv(sc) != 0) {
176 DBG("ath9k: Unable to restart recv logic\n");
177 r = -EIO;
178 goto ps_restore;
179 }
180
182 sc->config.txpowlimit, &sc->curtxpow);
184
185 if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) {
186 sc->tx_complete_work(sc);
187 sc->hw_pll_work_timer = (currticks() * 1000 ) / TICKS_PER_SEC + 500;
189 }
190
191 ps_restore:
192 return r;
193}
int ath9k_hw_check_alive(struct ath_hw *ah)
Definition ath9k_hw.c:1191
#define EIO
Input/output error.
Definition errno.h:434
uint32_t channel
RNDIS channel.
Definition netvsc.h:3
u16 channel
Definition hw.h:350
struct ath9k_hw_cal_data caldata
Definition ath9k.h:482
An 802.11 RF channel.
Definition net80211.h:386
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition net80211.h:806
u8 channel
The channel currently in use, as an index into the channels array.
Definition net80211.h:812

References __unused, ah, ath9k_cmn_update_txpow(), ath9k_hw_check_alive(), ath9k_hw_common(), ath9k_hw_disable_interrupts(), ath9k_hw_reset(), ath9k_hw_set_interrupts(), ath_drain_all_txq(), ath_start_ani(), ath_startrecv(), ath_stoprecv(), ath_softc::caldata, ath9k_channel::channel, channel, net80211_device::channel, net80211_device::channels, common, ath_softc::config, ath_hw::curchan, currticks(), ath_softc::curtxpow, DBG, DBG2, EIO, ath_softc::hw_busy_count, ath_softc::hw_pll_work_timer, NULL, r, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_INVALID, SC_OP_OFFCHANNEL, TICKS_PER_SEC, ath_softc::tx_complete_work, ath_softc::tx_complete_work_timer, and ath_config::txpowlimit.

Referenced by ath9k_config().

◆ ath_radio_enable()

void ath_radio_enable ( struct ath_softc * sc,
struct net80211_device * dev )

References mode.

◆ ath_radio_disable()

void ath_radio_disable ( struct ath_softc * sc,
struct net80211_device * dev )

Definition at line 473 of file ath9k_main.c.

474{
475 struct ath_hw *ah = sc->sc_ah;
476 struct net80211_channel *channel = dev->channels + dev->channel;
477 int r;
478
479 sc->hw_pll_work_timer = 0;
480
481 /*
482 * Keep the LED on when the radio is disabled
483 * during idle unassociated state.
484 */
485 if (!sc->ps_idle) {
486 ath9k_hw_set_gpio(ah, ah->led_pin, 1);
487 ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
488 }
489
490 /* Disable interrupts */
492
493 ath_drain_all_txq(sc, 0); /* clear pending tx frames */
494
495 ath_stoprecv(sc); /* turn off frame recv */
496 ath_flushrecv(sc); /* flush recv queue */
497
498 if (!ah->curchan)
499 ah->curchan = ath9k_cmn_get_curchannel(dev, ah);
500
501 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, 0);
502 if (r) {
503 DBG("ath9k: "
504 "Unable to reset channel (%d MHz), reset status %d\n",
505 channel->center_freq, r);
506 }
507
509
511}
struct ath9k_channel * ath9k_cmn_get_curchannel(struct net80211_device *dev, struct ath_hw *ah)
int ath9k_hw_phy_disable(struct ath_hw *ah)
Definition ath9k_hw.c:1918
void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio)
Definition ath9k_hw.c:1785
void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
Definition ath9k_hw.c:1852
static void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off)
Definition hw-ops.h:27

References ah, ath9k_cmn_get_curchannel(), ath9k_hw_cfg_gpio_input(), ath9k_hw_configpcipowersave(), ath9k_hw_disable_interrupts(), ath9k_hw_phy_disable(), ath9k_hw_reset(), ath9k_hw_set_gpio(), ath_drain_all_txq(), ath_flushrecv(), ath_stoprecv(), channel, net80211_device::channel, net80211_device::channels, DBG, ath_softc::hw_pll_work_timer, ath_softc::ps_idle, r, and ath_softc::sc_ah.

Referenced by ath9k_stop().

◆ ath9k_setpower()

int ath9k_setpower ( struct ath_softc * sc,
enum ath9k_power_mode mode )

Definition at line 28 of file ath9k_main.c.

29{
30 int ret;
31
32 ret = ath9k_hw_setpower(sc->sc_ah, mode);
33
34 return ret;
35}
int ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
Definition ath9k_hw.c:1534
uint16_t mode
Acceleration mode.
Definition ena.h:15

References ath9k_hw_setpower(), mode, and ath_softc::sc_ah.

Referenced by ath_isr().

◆ ath9k_uses_beacons()

int ath9k_uses_beacons ( int type)

References type, u32, and u8.

◆ ath_txchainmask_reduction()

u8 ath_txchainmask_reduction ( struct ath_softc * sc,
u8 chainmask,
u32 rate )

Definition at line 411 of file ath9k_xmit.c.

412{
413 struct ath_hw *ah = sc->sc_ah;
414 struct ath9k_channel *curchan = ah->curchan;
415 if ((sc->sc_flags & SC_OP_ENABLE_APM) &&
416 (curchan->channelFlags & CHANNEL_5GHZ) &&
417 (chainmask == 0x7) && (rate < 0x90))
418 return 0x3;
419 else
420 return chainmask;
421}
#define CHANNEL_5GHZ
Definition ath5k.h:635
#define SC_OP_ENABLE_APM
Definition ath9k.h:377
u32 channelFlags
Definition hw.h:351

References ah, CHANNEL_5GHZ, ath9k_channel::channelFlags, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_ENABLE_APM, u32, and u8.

Referenced by ath_buf_set_rate().

◆ ath_start_rfkill_poll()

void ath_start_rfkill_poll ( struct ath_softc * sc)

◆ ath9k_rfkill_poll_state()

void ath9k_rfkill_poll_state ( struct net80211_device * dev)
extern

Variable Documentation

◆ ath9k_ops

struct net80211_device_operations ath9k_ops
extern

Definition at line 911 of file ath9k_main.c.

911 {
912 .transmit = ath9k_tx,
913 .open = ath9k_start,
914 .close = ath9k_stop,
915 .config = ath9k_config,
916 .poll = ath9k_poll,
917 .irq = ath9k_irq,
918};
static void ath9k_poll(struct net80211_device *dev)
Definition ath9k_main.c:896
static int ath9k_start(struct net80211_device *dev)
Definition ath9k_main.c:567
static int ath9k_config(struct net80211_device *dev, int changed)
Definition ath9k_main.c:710
static void ath9k_irq(struct net80211_device *dev, int enable)
Definition ath9k_main.c:901
static int ath9k_tx(struct net80211_device *dev, struct io_buffer *iob)
Definition ath9k_main.c:644
static void ath9k_stop(struct net80211_device *dev)
Definition ath9k_main.c:667

Referenced by ath9k_init_device().

◆ ath9k_modparam_nohwcrypt

int ath9k_modparam_nohwcrypt
extern

◆ is_ath9k_unloaded

int is_ath9k_unloaded
extern

Definition at line 30 of file ath9k_init.c.

Referenced by ath_pci_remove().