iPXE
ath9k_main.c File Reference
#include <ipxe/io.h>
#include "ath9k.h"

Go to the source code of this file.

Macros

#define SCHED_INTR

Functions

 FILE_SECBOOT (FORBIDDEN)
static void ath9k_bss_info_changed (struct net80211_device *dev, u32 changed)
int ath9k_setpower (struct ath_softc *sc, enum ath9k_power_mode mode)
static void ath_start_ani (struct ath_common *common)
static void ath_update_survey_nf (struct ath_softc *sc, int channel)
static int ath_update_survey_stats (struct ath_softc *sc)
int ath_set_channel (struct ath_softc *sc, struct net80211_device *dev, struct ath9k_channel *hchan)
void ath_ani_calibrate (struct ath_softc *sc)
void ath_hw_check (struct ath_softc *sc)
static void ath_hw_pll_rx_hang_check (struct ath_softc *sc, u32 pll_sqsum)
void ath_hw_pll_work (struct ath_softc *sc)
void ath9k_tasklet (struct ath_softc *sc)
void ath_isr (struct net80211_device *dev)
void ath_radio_disable (struct ath_softc *sc, struct net80211_device *dev)
int ath_reset (struct ath_softc *sc, int retry_tx)
static int ath9k_start (struct net80211_device *dev)
static int ath9k_tx (struct net80211_device *dev, struct io_buffer *iob)
static void ath9k_stop (struct net80211_device *dev)
static int ath9k_config (struct net80211_device *dev, int changed)
static void ath9k_bss_iter (struct ath_softc *sc)
static void ath9k_config_bss (struct ath_softc *sc)
static void ath9k_poll (struct net80211_device *dev)
static void ath9k_irq (struct net80211_device *dev, int enable)

Variables

struct net80211_device_operations ath9k_ops

Macro Definition Documentation

◆ SCHED_INTR

#define SCHED_INTR
Value:
( \
@ ATH9K_INT_RXLP
Definition hw.h:256
@ ATH9K_INT_CST
Definition hw.h:278
@ ATH9K_INT_GENTIMER
Definition hw.h:277
@ ATH9K_INT_BMISS
Definition hw.h:269
@ ATH9K_INT_RX
Definition hw.h:253
@ ATH9K_INT_TX
Definition hw.h:260
@ ATH9K_INT_RXEOL
Definition hw.h:258
@ ATH9K_INT_RXHP
Definition hw.h:255
@ ATH9K_INT_TSFOOR
Definition hw.h:276
@ ATH9K_INT_BB_WATCHDOG
Definition hw.h:263
@ ATH9K_INT_RXORN
Definition hw.h:259
@ ATH9K_INT_FATAL
Definition hw.h:280

Referenced by ath_isr().

Function Documentation

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

References u32.

◆ ath9k_bss_info_changed()

void ath9k_bss_info_changed ( struct net80211_device * dev,
u32 changed )
static

Definition at line 856 of file ath9k_main.c.

858{
859 struct ath_softc *sc = dev->priv;
860 struct ath_hw *ah = sc->sc_ah;
862 int slottime;
863
864 if (changed & NET80211_CFG_ASSOC) {
866
867 DBG2("ath9k: BSSID: %pM aid: 0x%x\n",
868 common->curbssid, common->curaid);
869 }
870
871 if (changed & NET80211_CFG_PHY_PARAMS) {
873 slottime = 9;
874 else
875 slottime = 20;
876 ah->slottime = slottime;
878
879 DBG2("ath9k: BSS Changed PREAMBLE %d\n",
883 else
885
886 DBG2("ath9k: BSS Changed CTS PROT %d\n",
891 else
893 }
894}
#define SC_OP_PREAMBLE_SHORT
Definition ath9k.h:368
#define SC_OP_PROTECT_ENABLE
Definition ath9k.h:369
void ath9k_hw_init_global_settings(struct ath_hw *ah)
Definition ath9k_hw.c:814
static void ath9k_config_bss(struct ath_softc *sc)
Definition ath9k_main.c:827
#define DBG2(...)
Definition compiler.h:515
#define NET80211_BAND_5GHZ
The band from 4.9 GHz to 5.7 GHz, which tends to be more restricted.
Definition net80211.h:47
#define NET80211_CFG_ASSOC
Association has been established with a new BSS (dev->bssid)
Definition net80211.h:87
#define NET80211_CFG_PHY_PARAMS
Low-level link parameters (short preamble, protection, etc) have changed.
Definition net80211.h:90
#define NET80211_PHY_USE_PROTECTION
Whether to use RTS/CTS or CTS-to-self protection for transmissions.
Definition net80211.h:251
#define NET80211_PHY_USE_SHORT_PREAMBLE
Whether to use 802.11b short preamble operation.
Definition net80211.h:260
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
uint8_t ah
Definition registers.h:1
struct net80211_device * dev
Definition ath.h:199
Definition hw.h:657
struct net80211_device * dev
Definition ath9k.h:446
u32 sc_flags
Definition ath9k.h:466
struct ath_hw * sc_ah
Definition ath9k.h:455
struct net80211_channel channels[NET80211_MAX_CHANNELS]
A list of all possible channels we might use.
Definition net80211.h:806
void * priv
Driver private data.
Definition net80211.h:798
u8 channel
The channel currently in use, as an index into the channels array.
Definition net80211.h:812
int phy_flags
Physical layer options.
Definition net80211.h:983

References ah, ath9k_config_bss(), ath9k_hw_common(), ath9k_hw_init_global_settings(), net80211_device::channel, net80211_device::channels, common, DBG2, ath_common::dev, ath_softc::dev, NET80211_BAND_5GHZ, NET80211_CFG_ASSOC, NET80211_CFG_PHY_PARAMS, NET80211_PHY_USE_PROTECTION, NET80211_PHY_USE_SHORT_PREAMBLE, net80211_device::phy_flags, net80211_device::priv, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_PREAMBLE_SHORT, SC_OP_PROTECT_ENABLE, and u32.

Referenced by ath9k_config().

◆ 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().

◆ ath_start_ani()

void ath_start_ani ( struct ath_common * common)
static

Definition at line 37 of file ath9k_main.c.

38{
39 struct ath_hw *ah = common->ah;
40 unsigned long timestamp = ( currticks() * 1000 ) / TICKS_PER_SEC;
41 struct ath_softc *sc = (struct ath_softc *) common->priv;
42
43 if (!(sc->sc_flags & SC_OP_ANI_RUN))
44 return;
45
46 if (sc->sc_flags & SC_OP_OFFCHANNEL)
47 return;
48
49 common->ani.longcal_timer = timestamp;
50 common->ani.shortcal_timer = timestamp;
51 common->ani.checkani_timer = timestamp;
52
53 common->ani.timer = timestamp + ah->config.ani_poll_interval;
54}
#define SC_OP_ANI_RUN
Definition ath9k.h:376
#define SC_OP_OFFCHANNEL
Definition ath9k.h:367
uint64_t timestamp
Timestamp.
Definition ena.h:9
#define TICKS_PER_SEC
Number of ticks per second.
Definition timer.h:16
unsigned long currticks(void)
Get current system time in ticks.
Definition timer.c:43

References ah, common, currticks(), ath_softc::sc_flags, SC_OP_ANI_RUN, SC_OP_OFFCHANNEL, TICKS_PER_SEC, and timestamp.

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

◆ ath_update_survey_nf()

void ath_update_survey_nf ( struct ath_softc * sc,
int channel )
static

Definition at line 56 of file ath9k_main.c.

57{
58 struct ath_hw *ah = sc->sc_ah;
59 struct ath9k_channel *chan = &ah->channels[channel];
60 struct survey_info *survey = &sc->survey[channel];
61
62 if (chan->noisefloor) {
64 survey->noise = chan->noisefloor;
65 }
66}
@ SURVEY_INFO_NOISE_DBM
Definition ath9k.h:422
uint32_t channel
RNDIS channel.
Definition netvsc.h:3
struct net80211_channel * chan
Definition hw.h:348
s16 noisefloor
Definition hw.h:353
struct survey_info survey[ATH9K_NUM_CHANNELS]
Definition ath9k.h:452
u32 filled
Definition ath9k.h:417

References ah, ath9k_channel::chan, channel, survey_info::filled, survey_info::noise, ath9k_channel::noisefloor, ath_softc::sc_ah, ath_softc::survey, and SURVEY_INFO_NOISE_DBM.

Referenced by ath9k_config(), and ath_update_survey_stats().

◆ ath_update_survey_stats()

int ath_update_survey_stats ( struct ath_softc * sc)
static

Definition at line 73 of file ath9k_main.c.

74{
75 struct ath_hw *ah = sc->sc_ah;
77 int pos = ah->curchan - &ah->channels[0];
78 struct survey_info *survey = &sc->survey[pos];
79 struct ath_cycle_counters *cc = &common->cc_survey;
80 unsigned int div = common->clockrate * 1000;
81 int ret = 0;
82
83 if (!ah->curchan)
84 return -1;
85
86 if (ah->power_mode == ATH9K_PM_AWAKE)
88
89 if (cc->cycles > 0) {
94 survey->channel_time += cc->cycles / div;
95 survey->channel_time_busy += cc->rx_busy / div;
96 survey->channel_time_rx += cc->rx_frame / div;
97 survey->channel_time_tx += cc->tx_frame / div;
98 }
99
100 if (cc->cycles < div)
101 return -1;
102
103 if (cc->cycles > 0)
104 ret = cc->rx_busy * 100 / cc->cycles;
105
106 memset(cc, 0, sizeof(*cc));
107
108 ath_update_survey_nf(sc, pos);
109
110 return ret;
111}
@ SURVEY_INFO_CHANNEL_TIME_BUSY
Definition ath9k.h:425
@ SURVEY_INFO_CHANNEL_TIME_RX
Definition ath9k.h:427
@ SURVEY_INFO_CHANNEL_TIME
Definition ath9k.h:424
@ SURVEY_INFO_CHANNEL_TIME_TX
Definition ath9k.h:428
static void ath_update_survey_nf(struct ath_softc *sc, int channel)
Definition ath9k_main.c:56
void ath_hw_cycle_counters_update(struct ath_common *common)
ath_hw_cycle_counters_update - common function to update cycle counters
Definition ath_hw.c:139
@ ATH9K_PM_AWAKE
Definition hw.h:380
void * memset(void *dest, int character, size_t len) __nonnull
u64 channel_time
Definition ath9k.h:412
u64 channel_time_rx
Definition ath9k.h:415
u64 channel_time_busy
Definition ath9k.h:413
u64 channel_time_tx
Definition ath9k.h:416

References ah, ath9k_hw_common(), ATH9K_PM_AWAKE, ath_hw_cycle_counters_update(), ath_update_survey_nf(), survey_info::channel_time, survey_info::channel_time_busy, survey_info::channel_time_rx, survey_info::channel_time_tx, common, ath_cycle_counters::cycles, survey_info::filled, memset(), ath_cycle_counters::rx_busy, ath_cycle_counters::rx_frame, ath_softc::sc_ah, ath_softc::survey, SURVEY_INFO_CHANNEL_TIME, SURVEY_INFO_CHANNEL_TIME_BUSY, SURVEY_INFO_CHANNEL_TIME_RX, SURVEY_INFO_CHANNEL_TIME_TX, and ath_cycle_counters::tx_frame.

Referenced by ath9k_config(), ath_ani_calibrate(), and ath_hw_check().

◆ 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}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
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
#define SC_OP_INVALID
Definition ath9k.h:363
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
int ath9k_hw_check_alive(struct ath_hw *ah)
Definition ath9k_hw.c:1191
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
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBG(...)
Print a debugging message.
Definition compiler.h:498
#define EIO
Input/output error.
Definition errno.h:434
static const uint8_t r[3][4]
MD4 shift amounts.
Definition md4.c:54
u16 channel
Definition hw.h:350
u16 txpowlimit
Definition ath9k.h:66
struct ath9k_channel * curchan
Definition hw.h:666
void(* tx_complete_work)(struct ath_softc *sc)
Definition ath9k.h:485
struct ath9k_hw_cal_data caldata
Definition ath9k.h:482
unsigned long hw_pll_work_timer
Definition ath9k.h:488
u16 curtxpow
Definition ath9k.h:468
unsigned int hw_busy_count
Definition ath9k.h:463
struct ath_config config
Definition ath9k.h:475
unsigned long tx_complete_work_timer
Definition ath9k.h:486
An 802.11 RF channel.
Definition net80211.h:386

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_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
static int ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, u8 rxchainmask, int longcal)
Definition hw-ops.h:50
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
#define u32
Definition vga.h:21

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().

◆ ath_hw_check()

void ath_hw_check ( struct ath_softc * sc)

Definition at line 289 of file ath9k_main.c.

290{
291 int busy;
292
294 goto out;
295
296 busy = ath_update_survey_stats(sc);
297
298 DBG("ath9k: Possible baseband hang, "
299 "busy=%d (try %d)\n", busy, sc->hw_busy_count + 1);
300 if (busy >= 99) {
301 if (++sc->hw_busy_count >= 3)
302 ath_reset(sc, 1);
303 } else if (busy >= 0)
304 sc->hw_busy_count = 0;
305
306out:
307 return;
308}
__be32 out[4]
Definition CIB_PRM.h:8
int ath_reset(struct ath_softc *sc, int retry_tx)
Definition ath9k_main.c:513

References ath9k_hw_check_alive(), ath_reset(), ath_update_survey_stats(), DBG, ath_softc::hw_busy_count, out, and ath_softc::sc_ah.

◆ ath_hw_pll_rx_hang_check()

void ath_hw_pll_rx_hang_check ( struct ath_softc * sc,
u32 pll_sqsum )
static

Definition at line 310 of file ath9k_main.c.

311{
312 static int count;
313
314 if (pll_sqsum >= 0x40000) {
315 count++;
316 if (count == 3) {
317 /* Rx is hung for more than 500ms. Reset it */
318 DBG("ath9k: "
319 "Possible RX hang, resetting");
320 ath_reset(sc, 1);
321 count = 0;
322 }
323 } else
324 count = 0;
325}
static unsigned int count
Number of entries.
Definition dwmac.h:220

References ath_reset(), count, DBG, and u32.

Referenced by ath_hw_pll_work().

◆ 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

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().

◆ 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
uint8_t status
Status.
Definition ena.h:5
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_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
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().

◆ 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}
void ath_flushrecv(struct ath_softc *sc)
Definition ath9k_recv.c:244
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().

◆ 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}
#define ATH_TXQ_SETUP(sc, i)
Definition ath9k.h:63
void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
#define ATH9K_NUM_TX_QUEUES
Definition mac.h:581
struct ath_tx tx
Definition ath9k.h:477
struct ath_txq txq[ATH9K_NUM_TX_QUEUES]
Definition ath9k.h:286

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().

◆ ath9k_start()

int ath9k_start ( struct net80211_device * dev)
static

Definition at line 567 of file ath9k_main.c.

568{
569 struct ath_softc *sc = dev->priv;
570 struct ath_hw *ah = sc->sc_ah;
572 struct net80211_channel *curchan = dev->channels + dev->channel;
573 struct ath9k_channel *init_channel;
574 int r;
575
576 DBG("ath9k: "
577 "Starting driver with initial channel: %d MHz\n",
578 curchan->center_freq);
579
580 /* setup initial channel */
581 sc->chan_idx = curchan->hw_value;
582
583 init_channel = ath9k_cmn_get_curchannel(dev, ah);
584
585 /* Reset SERDES registers */
587
588 /*
589 * The basic interface to setting the hardware in a good
590 * state is ``reset''. On return the hardware is known to
591 * be powered up and with interrupts disabled. This must
592 * be followed by initialization of the appropriate bits
593 * and then setup of the interrupt mask.
594 */
595 r = ath9k_hw_reset(ah, init_channel, ah->caldata, 0);
596 if (r) {
597 DBG("ath9k: "
598 "Unable to reset hardware; reset status %d (freq %d MHz)\n",
599 r, curchan->center_freq);
600 goto mutex_unlock;
601 }
602
603 /*
604 * This is needed only to setup initial state
605 * but it's best done after a reset.
606 */
608 sc->config.txpowlimit, &sc->curtxpow);
609
610 /*
611 * Setup the hardware after reset:
612 * The receive engine is set going.
613 * Frame transmit is handled entirely
614 * in the frame output path; there's nothing to do
615 * here except setup the interrupt mask.
616 */
617 if (ath_startrecv(sc) != 0) {
618 DBG("ath9k: Unable to start recv logic\n");
619 r = -EIO;
620 goto mutex_unlock;
621 }
622
623 /* Setup our intr mask. */
624 ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL |
627
628 ah->imask |= ATH9K_INT_RX;
629
631 sc->sc_ah->is_monitoring = 0;
632
634
635 sc->tx_complete_work(sc);
636
637 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en)
638 common->bus_ops->extn_synch_en(common);
639
640mutex_unlock:
641 return r;
642}
@ ATH9K_INT_GLOBAL
Definition hw.h:281
int is_monitoring
Definition hw.h:678
int chan_idx
Definition ath9k.h:449
u16 hw_value
Hardware channel value.
Definition net80211.h:414
u16 center_freq
The center frequency for this channel.
Definition net80211.h:411

References ah, ath9k_cmn_get_curchannel(), ath9k_cmn_update_txpow(), ath9k_hw_common(), ath9k_hw_configpcipowersave(), ath9k_hw_reset(), ath9k_hw_set_interrupts(), ATH9K_INT_FATAL, ATH9K_INT_GLOBAL, ATH9K_INT_RX, ATH9K_INT_RXEOL, ATH9K_INT_RXORN, ATH9K_INT_TX, ath_startrecv(), net80211_channel::center_freq, ath_softc::chan_idx, net80211_device::channel, net80211_device::channels, common, ath_softc::config, ath_softc::curtxpow, DBG, ath_softc::dev, EIO, net80211_channel::hw_value, ath_hw::is_monitoring, net80211_device::priv, r, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_INVALID, ath_softc::tx_complete_work, and ath_config::txpowlimit.

◆ ath9k_tx()

int ath9k_tx ( struct net80211_device * dev,
struct io_buffer * iob )
static

Definition at line 644 of file ath9k_main.c.

645{
646 struct ath_softc *sc = dev->priv;
647 struct ath_tx_control txctl;
648 int ret = 0;
649
650 memset(&txctl, 0, sizeof(struct ath_tx_control));
651 txctl.txq = sc->tx.txq_map[0];
652
653 DBGIO("ath9k: transmitting packet, iob: %p\n", iob);
654
655 ret = ath_tx_start(dev, iob, &txctl);
656 if (ret) {
657 DBG("ath9k: TX failed\n");
658 goto exit;
659 }
660
661 return ret;
662exit:
663 free_iob(iob);
664 return ret;
665}
int ath_tx_start(struct net80211_device *dev, struct io_buffer *iob, struct ath_tx_control *txctl)
Definition ath9k_xmit.c:571
#define DBGIO(...)
Definition compiler.h:549
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition iobuf.c:153
struct ath_txq * txq_map[WME_NUM_AC]
Definition ath9k.h:288

References ath_tx_start(), DBG, DBGIO, ath_softc::dev, free_iob(), memset(), net80211_device::priv, ath_softc::tx, ath_tx_control::txq, and ath_tx::txq_map.

◆ ath9k_stop()

void ath9k_stop ( struct net80211_device * dev)
static

Definition at line 667 of file ath9k_main.c.

668{
669 struct ath_softc *sc = dev->priv;
670 struct ath_hw *ah = sc->sc_ah;
671
673 sc->hw_pll_work_timer = 0;
674
675 if (sc->sc_flags & SC_OP_INVALID) {
676 DBG("ath9k: Device not present\n");
677 return;
678 }
679
680 /* prevent tasklets to enable interrupts once we disable them */
681 ah->imask &= ~ATH9K_INT_GLOBAL;
682
683 /* make sure h/w will not generate any interrupt
684 * before setting the invalid flag. */
686
687 if (!(sc->sc_flags & SC_OP_INVALID)) {
688 ath_drain_all_txq(sc, 0);
689 ath_stoprecv(sc);
691 } else
692 sc->rx.rxlink = NULL;
693
694 if (sc->rx.frag) {
695 free_iob(sc->rx.frag);
696 sc->rx.frag = NULL;
697 }
698
699 /* disable HAL and put h/w to sleep */
702
704
705 sc->sc_flags |= SC_OP_INVALID;
706
707 DBG("ath9k: Driver halt\n");
708}
int ath9k_hw_disable(struct ath_hw *ah)
Definition ath9k_hw.c:1927
void ath_radio_disable(struct ath_softc *sc, struct net80211_device *dev)
Definition ath9k_main.c:473
struct net80211_device * dev
Definition hw.h:660
u32 * rxlink
Definition ath9k.h:300
struct io_buffer * frag
Definition ath9k.h:307
struct ath_rx rx
Definition ath9k.h:476

References ah, ath9k_hw_configpcipowersave(), ath9k_hw_disable(), ath9k_hw_disable_interrupts(), ath9k_hw_phy_disable(), ATH9K_INT_GLOBAL, ath_drain_all_txq(), ath_radio_disable(), ath_stoprecv(), DBG, ath_hw::dev, ath_softc::dev, ath_rx::frag, free_iob(), ath_softc::hw_pll_work_timer, NULL, net80211_device::priv, ath_softc::rx, ath_rx::rxlink, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_INVALID, and ath_softc::tx_complete_work_timer.

◆ ath9k_config()

int ath9k_config ( struct net80211_device * dev,
int changed )
static

Definition at line 710 of file ath9k_main.c.

711{
712 struct ath_softc *sc = dev->priv;
713 struct ath_hw *ah = sc->sc_ah;
714
715 if ((changed & NET80211_CFG_RATE) ||
716 (changed & NET80211_CFG_PHY_PARAMS)) {
718 u16 rate = dev->rates[dev->rate];
719 u16 slowrate = dev->rates[dev->rtscts_rate];
720 int i;
721
722 for (i = 0; i < NET80211_MAX_RATES; i++) {
723 if (sc->rates[i].bitrate == rate &&
724 (sc->rates[i].flags & spmbl))
725 sc->hw_rix = i;
726
727 if (sc->rates[i].bitrate == slowrate &&
728 (sc->rates[i].flags & spmbl))
729 sc->hw_rix = i;
730 }
731 }
732
733 ath9k_bss_info_changed(dev, changed);
734
735 if (changed & NET80211_CFG_CHANNEL) {
736 struct net80211_channel *curchan = dev->channels + dev->channel;
737 int pos = curchan->hw_value;
738 int old_pos = -1;
739
740 if (ah->curchan)
741 old_pos = ah->curchan - &ah->channels[0];
742
744
745 DBG2("ath9k: "
746 "Set channel: %d MHz\n",
747 curchan->center_freq);
748
750 curchan);
751
752 /* update survey stats for the old channel before switching */
754
755 /*
756 * If the operating channel changes, change the survey in-use flags
757 * along with it.
758 * Reset the survey data for the new channel, unless we're switching
759 * back to the operating channel from an off-channel operation.
760 */
761 if (sc->cur_survey != &sc->survey[pos]) {
762
763 if (sc->cur_survey)
765
766 sc->cur_survey = &sc->survey[pos];
767
768 memset(sc->cur_survey, 0, sizeof(struct survey_info));
770 } else if (!(sc->survey[pos].filled & SURVEY_INFO_IN_USE)) {
771 memset(&sc->survey[pos], 0, sizeof(struct survey_info));
772 }
773
774 if (ath_set_channel(sc, dev, &sc->sc_ah->channels[pos]) < 0) {
775 DBG("ath9k: Unable to set channel\n");
776 return -EINVAL;
777 }
778
779 /*
780 * The most recent snapshot of channel->noisefloor for the old
781 * channel is only available after the hardware reset. Copy it to
782 * the survey stats now.
783 */
784 if (old_pos >= 0)
785 ath_update_survey_nf(sc, old_pos);
786 }
787
788 if (changed & NET80211_CFG_CHANNEL) {
789 DBG2("ath9k: "
790 "Set power: %d\n", (dev->channels + dev->channel)->maxpower);
791 sc->config.txpowlimit = 2 * (dev->channels + dev->channel)->maxpower;
793 sc->config.txpowlimit, &sc->curtxpow);
794 }
795
796 return 0;
797}
@ SURVEY_INFO_IN_USE
Definition ath9k.h:423
@ IEEE80211_TX_RC_USE_SHORT_PREAMBLE
Definition ath9k.h:400
void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, struct net80211_channel *chan)
static void ath9k_bss_info_changed(struct net80211_device *dev, u32 changed)
Definition ath9k_main.c:856
int ath_set_channel(struct ath_softc *sc, struct net80211_device *dev, struct ath9k_channel *hchan)
Definition ath9k_main.c:118
#define NET80211_CFG_CHANNEL
Channel choice (dev->channel) or regulatory parameters have changed.
Definition net80211.h:81
#define NET80211_CFG_RATE
Requested transmission rate (dev->rate) has changed.
Definition net80211.h:84
#define EINVAL
Invalid argument.
Definition errno.h:429
#define NET80211_MAX_RATES
The maximum number of TX rates we allow to be configured simultaneously.
Definition net80211.h:272
struct ath9k_channel channels[ATH9K_NUM_CHANNELS]
Definition hw.h:665
int hw_rix
Definition ath9k.h:480
struct ath9k_legacy_rate rates[NET80211_MAX_RATES]
Definition ath9k.h:479
struct survey_info * cur_survey
Definition ath9k.h:451
u8 maxpower
Maximum allowable transmit power, in dBm.
Definition net80211.h:425
u16 rates[NET80211_MAX_RATES]
A list of all possible TX rates we might use.
Definition net80211.h:818
u8 rtscts_rate
The rate to use for RTS/CTS transmissions.
Definition net80211.h:831
u8 rate
The rate currently in use, as an index into the rates array.
Definition net80211.h:824
#define u16
Definition vga.h:20

References ah, ath9k_bss_info_changed(), ath9k_cmn_update_ichannel(), ath9k_cmn_update_txpow(), ath_set_channel(), ath_update_survey_nf(), ath_update_survey_stats(), ath9k_legacy_rate::bitrate, net80211_channel::center_freq, net80211_device::channel, ath_hw::channels, net80211_device::channels, ath_softc::config, ath_softc::cur_survey, ath_softc::curtxpow, DBG, DBG2, ath_hw::dev, ath_softc::dev, EINVAL, survey_info::filled, ath9k_legacy_rate::flags, ath_softc::hw_rix, net80211_channel::hw_value, IEEE80211_TX_RC_USE_SHORT_PREAMBLE, net80211_channel::maxpower, memset(), NET80211_CFG_CHANNEL, NET80211_CFG_PHY_PARAMS, NET80211_CFG_RATE, NET80211_MAX_RATES, net80211_device::priv, net80211_device::rate, ath_softc::rates, net80211_device::rates, net80211_device::rtscts_rate, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_OFFCHANNEL, SC_OP_PREAMBLE_SHORT, ath_softc::survey, SURVEY_INFO_IN_USE, ath_config::txpowlimit, and u16.

◆ ath9k_bss_iter()

void ath9k_bss_iter ( struct ath_softc * sc)
static

Definition at line 799 of file ath9k_main.c.

800{
801 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
802
803 if (common->dev->state & NET80211_ASSOCIATED) {
805 memcpy(common->curbssid, common->dev->bssid, ETH_ALEN);
806 common->curaid = common->dev->aid;
808 DBG("ath9k: "
809 "Bss Info ASSOC %d, bssid: %pM\n",
810 common->dev->aid, common->curbssid);
811
812 /*
813 * Request a re-configuration of Beacon related timers
814 * on the receipt of the first Beacon frame (i.e.,
815 * after time sync with the AP).
816 */
818 /* Reset rssi stats */
821
822 sc->sc_flags |= SC_OP_ANI_RUN;
824 }
825}
#define SC_OP_PRIM_STA_VIF
Definition ath9k.h:378
#define PS_BEACON_SYNC
Definition ath9k.h:385
void ath9k_hw_write_associd(struct ath_hw *ah)
Definition ath9k_hw.c:1966
#define ATH_RSSI_DUMMY_MARKER
Definition common.h:38
#define NET80211_ASSOCIATED
Whether we have successfully associated with the network.
Definition net80211.h:201
#define ETH_ALEN
Definition if_ether.h:9
void * memcpy(void *dest, const void *src, size_t len) __nonnull
u32 avgbrssi
Definition ani.h:159
struct ar5416Stats stats
Definition hw.h:696
int last_rssi
Definition ath9k.h:483

References ath9k_hw_common(), ath9k_hw_write_associd(), ATH_RSSI_DUMMY_MARKER, ath_start_ani(), ar5416Stats::avgbrssi, common, DBG, ETH_ALEN, ath_softc::last_rssi, memcpy(), NET80211_ASSOCIATED, PS_BEACON_SYNC, ath_softc::ps_flags, PS_WAIT_FOR_BEACON, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_ANI_RUN, SC_OP_PRIM_STA_VIF, and ath_hw::stats.

Referenced by ath9k_config_bss().

◆ ath9k_config_bss()

void ath9k_config_bss ( struct ath_softc * sc)
static

Definition at line 827 of file ath9k_main.c.

828{
829 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
830 struct net80211_device *dev = common->dev;
831
832 /* Reconfigure bss info */
833 if (!(dev->state & NET80211_ASSOCIATED)) {
834 DBG2("ath9k: "
835 "ath9k: Bss Info DISASSOC %d, bssid %pM\n",
836 common->curaid, common->curbssid);
838 memset(common->curbssid, 0, ETH_ALEN);
839 common->curaid = 0;
840 }
841
842 ath9k_bss_iter(sc);
843
844 /*
845 * None of station vifs are associated.
846 * Clear bssid & aid
847 */
848 if (!(sc->sc_flags & SC_OP_PRIM_STA_VIF)) {
850 /* Stop ANI */
852 common->ani.timer = 0;
853 }
854}
#define SC_OP_BEACONS
Definition ath9k.h:364
static void ath9k_bss_iter(struct ath_softc *sc)
Definition ath9k_main.c:799
Structure encapsulating the complete state of an 802.11 device.
Definition net80211.h:787
u16 state
State of our association to the network.
Definition net80211.h:921

References ath9k_bss_iter(), ath9k_hw_common(), ath9k_hw_write_associd(), common, DBG2, ETH_ALEN, memset(), NET80211_ASSOCIATED, ath_softc::sc_ah, ath_softc::sc_flags, SC_OP_ANI_RUN, SC_OP_BEACONS, SC_OP_PRIM_STA_VIF, and net80211_device::state.

Referenced by ath9k_bss_info_changed().

◆ ath9k_poll()

void ath9k_poll ( struct net80211_device * dev)
static

Definition at line 896 of file ath9k_main.c.

897{
898 ath_isr(dev);
899}
void ath_isr(struct net80211_device *dev)
Definition ath9k_main.c:368

References ath_isr(), and ath_common::dev.

◆ ath9k_irq()

void ath9k_irq ( struct net80211_device * dev,
int enable )
static

Definition at line 901 of file ath9k_main.c.

902{
903 struct ath_softc *sc = dev->priv;
904 struct ath_hw *ah = sc->sc_ah;
905
906 ah->ah_ier = enable ? AR_IER_ENABLE : AR_IER_DISABLE;
907
909}
#define AR_IER_ENABLE
Definition reg.h:56
#define AR_IER_DISABLE
Definition reg.h:57

References ah, AR_IER_DISABLE, AR_IER_ENABLE, ath9k_hw_set_interrupts(), ath_softc::dev, net80211_device::priv, and ath_softc::sc_ah.

Variable Documentation

◆ ath9k_ops

struct net80211_device_operations ath9k_ops
Initial value:
= {
.transmit = ath9k_tx,
.open = ath9k_start,
.close = ath9k_stop,
.config = ath9k_config,
.poll = ath9k_poll,
.irq = ath9k_irq,
}
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

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};

Referenced by ath9k_init_device().