Commit | Line | Data |
---|---|---|
a9533e7e HP |
1 | /* |
2 | * Copyright (c) 2010 Broadcom Corporation | |
3 | * | |
4 | * Permission to use, copy, modify, and/or distribute this software for any | |
5 | * purpose with or without fee is hereby granted, provided that the above | |
6 | * copyright notice and this permission notice appear in all copies. | |
7 | * | |
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
15 | */ | |
16 | ||
17 | #ifndef _wlc_h_ | |
18 | #define _wlc_h_ | |
19 | ||
a9533e7e HP |
20 | #define MA_WINDOW_SZ 8 /* moving average window size */ |
21 | #define WL_HWRXOFF 38 /* chip rx buffer offset */ | |
22 | #define INVCHANNEL 255 /* invalid channel */ | |
23 | #define MAXCOREREV 28 /* max # supported core revisions (0 .. MAXCOREREV - 1) */ | |
24 | #define WLC_MAXMODULES 22 /* max # wlc_module_register() calls */ | |
25 | ||
41feb5ed | 26 | #define WLC_BITSCNT(x) bcm_bitcount((u8 *)&(x), sizeof(u8)) |
a9533e7e HP |
27 | |
28 | /* Maximum wait time for a MAC suspend */ | |
29 | #define WLC_MAX_MAC_SUSPEND 83000 /* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */ | |
30 | ||
31 | /* Probe Response timeout - responses for probe requests older that this are tossed, zero to disable | |
32 | */ | |
33 | #define WLC_PRB_RESP_TIMEOUT 0 /* Disable probe response timeout */ | |
34 | ||
35 | /* transmit buffer max headroom for protocol headers */ | |
36 | #define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN) | |
37 | ||
38 | /* For managing scan result lists */ | |
12bacc1b | 39 | struct wlc_bss_list { |
a9533e7e HP |
40 | uint count; |
41 | bool beacon; /* set for beacon, cleared for probe response */ | |
42 | wlc_bss_info_t *ptrs[MAXBSS]; | |
12bacc1b | 43 | }; |
a9533e7e HP |
44 | |
45 | #define SW_TIMER_MAC_STAT_UPD 30 /* periodic MAC stats update */ | |
46 | ||
47 | /* Double check that unsupported cores are not enabled */ | |
48 | #if CONF_MSK(D11CONF, 0x4f) || CONF_GE(D11CONF, MAXCOREREV) | |
49 | #error "Configuration for D11CONF includes unsupported versions." | |
50 | #endif /* Bad versions */ | |
51 | ||
52 | #define VALID_COREREV(corerev) CONF_HAS(D11CONF, corerev) | |
53 | ||
54 | /* values for shortslot_override */ | |
55 | #define WLC_SHORTSLOT_AUTO -1 /* Driver will manage Shortslot setting */ | |
56 | #define WLC_SHORTSLOT_OFF 0 /* Turn off short slot */ | |
57 | #define WLC_SHORTSLOT_ON 1 /* Turn on short slot */ | |
58 | ||
59 | /* value for short/long and mixmode/greenfield preamble */ | |
60 | ||
61 | #define WLC_LONG_PREAMBLE (0) | |
62 | #define WLC_SHORT_PREAMBLE (1 << 0) | |
63 | #define WLC_GF_PREAMBLE (1 << 1) | |
64 | #define WLC_MM_PREAMBLE (1 << 2) | |
65 | #define WLC_IS_MIMO_PREAMBLE(_pre) (((_pre) == WLC_GF_PREAMBLE) || ((_pre) == WLC_MM_PREAMBLE)) | |
66 | ||
67 | /* values for barker_preamble */ | |
68 | #define WLC_BARKER_SHORT_ALLOWED 0 /* Short pre-amble allowed */ | |
69 | ||
70 | /* A fifo is full. Clear precedences related to that FIFO */ | |
71 | #define WLC_TX_FIFO_CLEAR(wlc, fifo) ((wlc)->tx_prec_map &= ~(wlc)->fifo2prec_map[fifo]) | |
72 | ||
73 | /* Fifo is NOT full. Enable precedences for that FIFO */ | |
74 | #define WLC_TX_FIFO_ENAB(wlc, fifo) ((wlc)->tx_prec_map |= (wlc)->fifo2prec_map[fifo]) | |
75 | ||
76 | /* TxFrameID */ | |
77 | /* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */ | |
78 | /* rate epoch bits: TXFID_RATE_SHIFT, TXFID_RATE_MASK ((wlc_rate.c) */ | |
79 | #define TXFID_QUEUE_MASK 0x0007 /* Bits 0-2 */ | |
80 | #define TXFID_SEQ_MASK 0x7FE0 /* Bits 5-15 */ | |
81 | #define TXFID_SEQ_SHIFT 5 /* Number of bit shifts */ | |
82 | #define TXFID_RATE_PROBE_MASK 0x8000 /* Bit 15 for rate probe */ | |
83 | #define TXFID_RATE_MASK 0x0018 /* Mask for bits 3 and 4 */ | |
84 | #define TXFID_RATE_SHIFT 3 /* Shift 3 bits for rate mask */ | |
85 | ||
86 | /* promote boardrev */ | |
87 | #define BOARDREV_PROMOTABLE 0xFF /* from */ | |
88 | #define BOARDREV_PROMOTED 1 /* to */ | |
89 | ||
90 | /* if wpa is in use then portopen is true when the group key is plumbed otherwise it is always true | |
91 | */ | |
4c71ebf4 BR |
92 | #define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)) |
93 | #define WLC_SW_KEYS(wlc, bsscfg) ((((wlc)->wsec_swkeys) || \ | |
94 | ((bsscfg)->wsec & WSEC_SWFLAG))) | |
95 | ||
a9533e7e HP |
96 | #define WLC_PORTOPEN(cfg) \ |
97 | (((cfg)->WPA_auth != WPA_AUTH_DISABLED && WSEC_ENABLED((cfg)->wsec)) ? \ | |
0f0881b0 | 98 | (cfg)->wsec_portopen : true) |
a9533e7e HP |
99 | |
100 | #define PS_ALLOWED(wlc) wlc_ps_allowed(wlc) | |
101 | #define STAY_AWAKE(wlc) wlc_stay_awake(wlc) | |
102 | ||
103 | #define DATA_BLOCK_TX_SUPR (1 << 4) | |
104 | ||
105 | /* 802.1D Priority to TX FIFO number for wme */ | |
41feb5ed | 106 | extern const u8 prio2fifo[]; |
a9533e7e HP |
107 | |
108 | /* Ucode MCTL_WAKE override bits */ | |
109 | #define WLC_WAKE_OVERRIDE_CLKCTL 0x01 | |
110 | #define WLC_WAKE_OVERRIDE_PHYREG 0x02 | |
111 | #define WLC_WAKE_OVERRIDE_MACSUSPEND 0x04 | |
112 | #define WLC_WAKE_OVERRIDE_TXFIFO 0x08 | |
113 | #define WLC_WAKE_OVERRIDE_FORCEFAST 0x10 | |
114 | ||
115 | /* stuff pulled in from wlc.c */ | |
116 | ||
117 | /* Interrupt bit error summary. Don't include I_RU: we refill DMA at other | |
118 | * times; and if we run out, constant I_RU interrupts may cause lockup. We | |
119 | * will still get error counts from rx0ovfl. | |
120 | */ | |
121 | #define I_ERRORS (I_PC | I_PD | I_DE | I_RO | I_XU) | |
122 | /* default software intmasks */ | |
123 | #define DEF_RXINTMASK (I_RI) /* enable rx int on rxfifo only */ | |
124 | #define DEF_MACINTMASK (MI_TXSTOP | MI_TBTT | MI_ATIMWINEND | MI_PMQ | \ | |
125 | MI_PHYTXERR | MI_DMAINT | MI_TFS | MI_BG_NOISE | \ | |
126 | MI_CCA | MI_TO | MI_GP0 | MI_RFDISABLE | MI_PWRUP) | |
127 | ||
128 | #define RETRY_SHORT_DEF 7 /* Default Short retry Limit */ | |
129 | #define RETRY_SHORT_MAX 255 /* Maximum Short retry Limit */ | |
130 | #define RETRY_LONG_DEF 4 /* Default Long retry count */ | |
131 | #define RETRY_SHORT_FB 3 /* Short retry count for fallback rate */ | |
132 | #define RETRY_LONG_FB 2 /* Long retry count for fallback rate */ | |
133 | ||
134 | #define MAXTXPKTS 6 /* max # pkts pending */ | |
135 | ||
136 | /* frameburst */ | |
137 | #define MAXTXFRAMEBURST 8 /* vanilla xpress mode: max frames/burst */ | |
138 | #define MAXFRAMEBURST_TXOP 10000 /* Frameburst TXOP in usec */ | |
139 | ||
140 | /* Per-AC retry limit register definitions; uses bcmdefs.h bitfield macros */ | |
141 | #define EDCF_SHORT_S 0 | |
142 | #define EDCF_SFB_S 4 | |
143 | #define EDCF_LONG_S 8 | |
144 | #define EDCF_LFB_S 12 | |
145 | #define EDCF_SHORT_M BITFIELD_MASK(4) | |
146 | #define EDCF_SFB_M BITFIELD_MASK(4) | |
147 | #define EDCF_LONG_M BITFIELD_MASK(4) | |
148 | #define EDCF_LFB_M BITFIELD_MASK(4) | |
149 | ||
150 | #define WLC_WME_RETRY_SHORT_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_SHORT) | |
151 | #define WLC_WME_RETRY_SFB_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_SFB) | |
152 | #define WLC_WME_RETRY_LONG_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_LONG) | |
153 | #define WLC_WME_RETRY_LFB_GET(wlc, ac) GFIELD(wlc->wme_retries[ac], EDCF_LFB) | |
154 | ||
155 | #define WLC_WME_RETRY_SHORT_SET(wlc, ac, val) \ | |
0d706ef4 | 156 | (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_SHORT, val)) |
a9533e7e | 157 | #define WLC_WME_RETRY_SFB_SET(wlc, ac, val) \ |
0d706ef4 | 158 | (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_SFB, val)) |
a9533e7e | 159 | #define WLC_WME_RETRY_LONG_SET(wlc, ac, val) \ |
0d706ef4 | 160 | (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_LONG, val)) |
a9533e7e | 161 | #define WLC_WME_RETRY_LFB_SET(wlc, ac, val) \ |
0d706ef4 | 162 | (wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], EDCF_LFB, val)) |
a9533e7e HP |
163 | |
164 | /* PLL requests */ | |
165 | #define WLC_PLLREQ_SHARED 0x1 /* pll is shared on old chips */ | |
166 | #define WLC_PLLREQ_RADIO_MON 0x2 /* hold pll for radio monitor register checking */ | |
167 | #define WLC_PLLREQ_FLIP 0x4 /* hold/release pll for some short operation */ | |
168 | ||
169 | /* Do we support this rate? */ | |
0f0881b0 | 170 | #define VALID_RATE_DBG(wlc, rspec) wlc_valid_rate(wlc, rspec, WLC_BAND_AUTO, true) |
a9533e7e HP |
171 | |
172 | /* | |
173 | * Macros to check if AP or STA is active. | |
174 | * AP Active means more than just configured: driver and BSS are "up"; | |
175 | * that is, we are beaconing/responding as an AP (aps_associated). | |
176 | * STA Active similarly means the driver is up and a configured STA BSS | |
177 | * is up: either associated (stas_associated) or trying. | |
178 | * | |
179 | * Macro definitions vary as per AP/STA ifdefs, allowing references to | |
180 | * ifdef'd structure fields and constant values (0) for optimization. | |
181 | * Make sure to enclose blocks of code such that any routines they | |
182 | * reference can also be unused and optimized out by the linker. | |
183 | */ | |
184 | /* NOTE: References structure fields defined in wlc.h */ | |
185 | #define AP_ACTIVE(wlc) (0) | |
186 | ||
187 | /* | |
188 | * Detect Card removed. | |
189 | * Even checking an sbconfig register read will not false trigger when the core is in reset. | |
190 | * it breaks CF address mechanism. Accessing gphy phyversion will cause SB error if aphy | |
191 | * is in reset on 4306B0-DB. Need a simple accessible reg with fixed 0/1 pattern | |
192 | * (some platforms return all 0). | |
193 | * If clocks are present, call the sb routine which will figure out if the device is removed. | |
194 | */ | |
a9533e7e HP |
195 | #define DEVICEREMOVED(wlc) \ |
196 | ((wlc->hw->clk) ? \ | |
ff31c54c | 197 | ((R_REG(&wlc->hw->regs->maccontrol) & \ |
a9533e7e HP |
198 | (MCTL_PSM_JMP_0 | MCTL_IHR_EN)) != MCTL_IHR_EN) : \ |
199 | (si_deviceremoved(wlc->hw->sih))) | |
a9533e7e HP |
200 | |
201 | #define WLCWLUNIT(wlc) ((wlc)->pub->unit) | |
202 | ||
12bacc1b | 203 | struct wlc_protection { |
a9533e7e | 204 | bool _g; /* use g spec protection, driver internal */ |
562c8850 | 205 | s8 g_override; /* override for use of g spec protection */ |
41feb5ed | 206 | u8 gmode_user; /* user config gmode, operating band->gmode is different */ |
562c8850 GKH |
207 | s8 overlap; /* Overlap BSS/IBSS protection for both 11g and 11n */ |
208 | s8 nmode_user; /* user config nmode, operating pub->nmode is different */ | |
209 | s8 n_cfg; /* use OFDM protection on MIMO frames */ | |
210 | s8 n_cfg_override; /* override for use of N protection */ | |
a9533e7e | 211 | bool nongf; /* non-GF present protection */ |
562c8850 GKH |
212 | s8 nongf_override; /* override for use of GF protection */ |
213 | s8 n_pam_override; /* override for preamble: MM or GF */ | |
a9533e7e HP |
214 | bool n_obss; /* indicated OBSS Non-HT STA present */ |
215 | ||
216 | uint longpre_detect_timeout; /* #sec until long preamble bcns gone */ | |
217 | uint barker_detect_timeout; /* #sec until bcns signaling Barker long preamble */ | |
218 | /* only is gone */ | |
219 | uint ofdm_ibss_timeout; /* #sec until ofdm IBSS beacons gone */ | |
220 | uint ofdm_ovlp_timeout; /* #sec until ofdm overlapping BSS bcns gone */ | |
221 | uint nonerp_ibss_timeout; /* #sec until nonerp IBSS beacons gone */ | |
222 | uint nonerp_ovlp_timeout; /* #sec until nonerp overlapping BSS bcns gone */ | |
223 | uint g_ibss_timeout; /* #sec until bcns signaling Use_Protection gone */ | |
224 | uint n_ibss_timeout; /* #sec until bcns signaling Use_OFDM_Protection gone */ | |
225 | uint ht20in40_ovlp_timeout; /* #sec until 20MHz overlapping OPMODE gone */ | |
226 | uint ht20in40_ibss_timeout; /* #sec until 20MHz-only HT station bcns gone */ | |
227 | uint non_gf_ibss_timeout; /* #sec until non-GF bcns gone */ | |
12bacc1b | 228 | }; |
a9533e7e HP |
229 | |
230 | /* anything affects the single/dual streams/antenna operation */ | |
12bacc1b | 231 | struct wlc_stf { |
41feb5ed GKH |
232 | u8 hw_txchain; /* HW txchain bitmap cfg */ |
233 | u8 txchain; /* txchain bitmap being used */ | |
234 | u8 txstreams; /* number of txchains being used */ | |
a9533e7e | 235 | |
41feb5ed GKH |
236 | u8 hw_rxchain; /* HW rxchain bitmap cfg */ |
237 | u8 rxchain; /* rxchain bitmap being used */ | |
238 | u8 rxstreams; /* number of rxchains being used */ | |
a9533e7e | 239 | |
41feb5ed | 240 | u8 ant_rx_ovr; /* rx antenna override */ |
562c8850 | 241 | s8 txant; /* userTx antenna setting */ |
7d4df48e | 242 | u16 phytxant; /* phyTx antenna setting in txheader */ |
a9533e7e | 243 | |
41feb5ed | 244 | u8 ss_opmode; /* singlestream Operational mode, 0:siso; 1:cdd */ |
0f0881b0 | 245 | bool ss_algosel_auto; /* if true, use wlc->stf->ss_algo_channel; */ |
a9533e7e | 246 | /* else use wlc->band->stf->ss_mode_band; */ |
7d4df48e | 247 | u16 ss_algo_channel; /* ss based on per-channel algo: 0: SISO, 1: CDD 2: STBC */ |
41feb5ed | 248 | u8 no_cddstbc; /* stf override, 1: no CDD (or STBC) allowed */ |
a9533e7e | 249 | |
41feb5ed | 250 | u8 rxchain_restore_delay; /* delay time to restore default rxchain */ |
a9533e7e | 251 | |
562c8850 | 252 | s8 ldpc; /* AUTO/ON/OFF ldpc cap supported */ |
41feb5ed | 253 | u8 txcore[MAX_STREAMS_SUPPORTED + 1]; /* bitmap of selected core for each Nsts */ |
562c8850 | 254 | s8 spatial_policy; |
12bacc1b | 255 | }; |
a9533e7e HP |
256 | |
257 | #define WLC_STF_SS_STBC_TX(wlc, scb) \ | |
258 | (((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) || \ | |
259 | (SCB_STBC_CAP((scb)) && \ | |
260 | (wlc)->band->band_stf_stbc_tx == AUTO && \ | |
261 | isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC)))) | |
262 | ||
263 | #define WLC_STBC_CAP_PHY(wlc) (WLCISNPHY(wlc->band) && NREV_GE(wlc->band->phyrev, 3)) | |
264 | ||
265 | #define WLC_SGI_CAP_PHY(wlc) ((WLCISNPHY(wlc->band) && NREV_GE(wlc->band->phyrev, 3)) || \ | |
266 | WLCISLCNPHY(wlc->band)) | |
267 | ||
268 | #define WLC_CHAN_PHYTYPE(x) (((x) & RXS_CHAN_PHYTYPE_MASK) >> RXS_CHAN_PHYTYPE_SHIFT) | |
269 | #define WLC_CHAN_CHANNEL(x) (((x) & RXS_CHAN_ID_MASK) >> RXS_CHAN_ID_SHIFT) | |
270 | #define WLC_RX_CHANNEL(rxh) (WLC_CHAN_CHANNEL((rxh)->RxChan)) | |
271 | ||
272 | /* wlc_bss_info flag bit values */ | |
273 | #define WLC_BSS_HT 0x0020 /* BSS is HT (MIMO) capable */ | |
274 | ||
275 | /* Flags used in wlc_txq_info.stopped */ | |
276 | #define TXQ_STOP_FOR_PRIOFC_MASK 0x000000FF /* per prio flow control bits */ | |
277 | #define TXQ_STOP_FOR_PKT_DRAIN 0x00000100 /* stop txq enqueue for packet drain */ | |
278 | #define TXQ_STOP_FOR_AMPDU_FLOW_CNTRL 0x00000200 /* stop txq enqueue for ampdu flow control */ | |
279 | ||
280 | #define WLC_HT_WEP_RESTRICT 0x01 /* restrict HT with WEP */ | |
281 | #define WLC_HT_TKIP_RESTRICT 0x02 /* restrict HT with TKIP */ | |
282 | ||
283 | /* | |
284 | * core state (mac) | |
285 | */ | |
c41c858f | 286 | struct wlccore { |
a9533e7e HP |
287 | uint coreidx; /* # sb enumerated core */ |
288 | ||
289 | /* fifo */ | |
290 | uint *txavail[NFIFO]; /* # tx descriptors available */ | |
e59fe083 | 291 | s16 txpktpend[NFIFO]; /* tx admission control */ |
a9533e7e HP |
292 | |
293 | macstat_t *macstat_snapshot; /* mac hw prev read values */ | |
c41c858f | 294 | }; |
a9533e7e HP |
295 | |
296 | /* | |
297 | * band state (phy+ana+radio) | |
298 | */ | |
f077f718 | 299 | struct wlcband { |
a9533e7e HP |
300 | int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ |
301 | uint bandunit; /* bandstate[] index */ | |
302 | ||
7d4df48e GKH |
303 | u16 phytype; /* phytype */ |
304 | u16 phyrev; | |
305 | u16 radioid; | |
306 | u16 radiorev; | |
a9533e7e HP |
307 | wlc_phy_t *pi; /* pointer to phy specific information */ |
308 | bool abgphy_encore; | |
309 | ||
41feb5ed | 310 | u8 gmode; /* currently active gmode (see wlioctl.h) */ |
a9533e7e HP |
311 | |
312 | struct scb *hwrs_scb; /* permanent scb for hw rateset */ | |
313 | ||
314 | wlc_rateset_t defrateset; /* band-specific copy of default_bss.rateset */ | |
315 | ||
316 | ratespec_t rspec_override; /* 802.11 rate override */ | |
317 | ratespec_t mrspec_override; /* multicast rate override */ | |
41feb5ed | 318 | u8 band_stf_ss_mode; /* Configured STF type, 0:siso; 1:cdd */ |
562c8850 | 319 | s8 band_stf_stbc_tx; /* STBC TX 0:off; 1:force on; -1:auto */ |
a9533e7e | 320 | wlc_rateset_t hw_rateset; /* rates supported by chip (phy-specific) */ |
41feb5ed | 321 | u8 basic_rate[WLC_MAXRATE + 1]; /* basic rates indexed by rate */ |
a9533e7e | 322 | bool mimo_cap_40; /* 40 MHz cap enabled on this band */ |
562c8850 | 323 | s8 antgain; /* antenna gain from srom */ |
a9533e7e | 324 | |
7d4df48e GKH |
325 | u16 CWmin; /* The minimum size of contention window, in unit of aSlotTime */ |
326 | u16 CWmax; /* The maximum size of contention window, in unit of aSlotTime */ | |
327 | u16 bcntsfoff; /* beacon tsf offset */ | |
f077f718 | 328 | }; |
a9533e7e | 329 | |
a9533e7e | 330 | /* tx completion callback takes 3 args */ |
c6a9e1fc | 331 | typedef void (*pkcb_fn_t) (struct wlc_info *wlc, uint txstatus, void *arg); |
a9533e7e | 332 | |
12bacc1b | 333 | struct pkt_cb { |
a9533e7e HP |
334 | pkcb_fn_t fn; /* function to call when tx frame completes */ |
335 | void *arg; /* void arg for fn */ | |
41feb5ed | 336 | u8 nextidx; /* index of next call back if threading */ |
a9533e7e | 337 | bool entered; /* recursion check */ |
12bacc1b | 338 | }; |
a9533e7e | 339 | |
12bacc1b AS |
340 | /* module control blocks */ |
341 | struct modulecb { | |
a9533e7e HP |
342 | char name[32]; /* module name : NULL indicates empty array member */ |
343 | const bcm_iovar_t *iovars; /* iovar table */ | |
344 | void *hdl; /* handle passed when handler 'doiovar' is called */ | |
345 | watchdog_fn_t watchdog_fn; /* watchdog handler */ | |
346 | iovar_fn_t iovar_fn; /* iovar handler */ | |
347 | down_fn_t down_fn; /* down handler. Note: the int returned | |
348 | * by the down function is a count of the | |
349 | * number of timers that could not be | |
350 | * freed. | |
351 | */ | |
12bacc1b | 352 | }; |
a9533e7e | 353 | |
12bacc1b AS |
354 | /* dump control blocks */ |
355 | struct dumpcb_s { | |
a9533e7e HP |
356 | const char *name; /* dump name */ |
357 | dump_fn_t dump_fn; /* 'wl dump' handler */ | |
358 | void *dump_fn_arg; | |
359 | struct dumpcb_s *next; | |
12bacc1b | 360 | }; |
a9533e7e HP |
361 | |
362 | /* virtual interface */ | |
363 | struct wlc_if { | |
4dc79de1 | 364 | struct wlc_if *next; |
41feb5ed GKH |
365 | u8 type; /* WLC_IFTYPE_BSS or WLC_IFTYPE_WDS */ |
366 | u8 index; /* assigned in wl_add_if(), index of the wlif if any, | |
a9533e7e HP |
367 | * not necessarily corresponding to bsscfg._idx or |
368 | * AID2PVBMAP(scb). | |
369 | */ | |
41feb5ed | 370 | u8 flags; /* flags for the interface */ |
6cdeaef2 | 371 | struct wl_if *wlif; /* pointer to wlif */ |
a9533e7e HP |
372 | struct wlc_txq_info *qi; /* pointer to associated tx queue */ |
373 | union { | |
374 | struct scb *scb; /* pointer to scb if WLC_IFTYPE_WDS */ | |
375 | struct wlc_bsscfg *bsscfg; /* pointer to bsscfg if WLC_IFTYPE_BSS */ | |
376 | } u; | |
377 | }; | |
378 | ||
379 | /* flags for the interface */ | |
380 | #define WLC_IF_LINKED 0x02 /* this interface is linked to a wl_if */ | |
381 | ||
12bacc1b | 382 | struct wlc_hwband { |
a9533e7e HP |
383 | int bandtype; /* WLC_BAND_2G, WLC_BAND_5G */ |
384 | uint bandunit; /* bandstate[] index */ | |
7d4df48e | 385 | u16 mhfs[MHFMAX]; /* MHF array shadow */ |
41feb5ed | 386 | u8 bandhw_stf_ss_mode; /* HW configured STF type, 0:siso; 1:cdd */ |
7d4df48e GKH |
387 | u16 CWmin; |
388 | u16 CWmax; | |
66cbd3ab | 389 | u32 core_flags; |
a9533e7e | 390 | |
7d4df48e GKH |
391 | u16 phytype; /* phytype */ |
392 | u16 phyrev; | |
393 | u16 radioid; | |
394 | u16 radiorev; | |
a9533e7e HP |
395 | wlc_phy_t *pi; /* pointer to phy specific information */ |
396 | bool abgphy_encore; | |
12bacc1b | 397 | }; |
a9533e7e HP |
398 | |
399 | struct wlc_hw_info { | |
e69284f2 | 400 | struct osl_info *osh; /* pointer to os handle */ |
a9533e7e | 401 | bool _piomode; /* true if pio mode */ |
c6a9e1fc | 402 | struct wlc_info *wlc; |
a9533e7e HP |
403 | |
404 | /* fifo */ | |
17d76651 | 405 | struct hnddma_pub *di[NFIFO]; /* hnddma handles, per fifo */ |
a9533e7e | 406 | |
a9533e7e HP |
407 | uint unit; /* device instance number */ |
408 | ||
409 | /* version info */ | |
7d4df48e GKH |
410 | u16 vendorid; /* PCI vendor id */ |
411 | u16 deviceid; /* PCI device id */ | |
a9533e7e | 412 | uint corerev; /* core revision */ |
41feb5ed | 413 | u8 sromrev; /* version # of the srom */ |
7d4df48e | 414 | u16 boardrev; /* version # of particular board */ |
66cbd3ab GKH |
415 | u32 boardflags; /* Board specific flags from srom */ |
416 | u32 boardflags2; /* More board flags if sromrev >= 4 */ | |
3746507a RV |
417 | u32 machwcap; /* MAC capabilities */ |
418 | u32 machwcap_backup; /* backup of machwcap */ | |
7d4df48e | 419 | u16 ucode_dbgsel; /* dbgsel for ucode debug(config gpio) */ |
a9533e7e HP |
420 | |
421 | si_t *sih; /* SB handle (cookie for siutils calls) */ | |
422 | char *vars; /* "environment" name=value */ | |
423 | uint vars_size; /* size of vars, free vars on detach */ | |
424 | d11regs_t *regs; /* pointer to device registers */ | |
425 | void *physhim; /* phy shim layer handler */ | |
426 | void *phy_sh; /* pointer to shared phy state */ | |
12bacc1b AS |
427 | struct wlc_hwband *band;/* pointer to active per-band state */ |
428 | struct wlc_hwband *bandstate[MAXBANDS];/* band state per phy/radio */ | |
7d4df48e | 429 | u16 bmac_phytxant; /* cache of high phytxant state */ |
a9533e7e | 430 | bool shortslot; /* currently using 11g ShortSlot timing */ |
7d4df48e GKH |
431 | u16 SRL; /* 802.11 dot11ShortRetryLimit */ |
432 | u16 LRL; /* 802.11 dot11LongRetryLimit */ | |
433 | u16 SFBL; /* Short Frame Rate Fallback Limit */ | |
434 | u16 LFBL; /* Long Frame Rate Fallback Limit */ | |
a9533e7e HP |
435 | |
436 | bool up; /* d11 hardware up and running */ | |
437 | uint now; /* # elapsed seconds */ | |
438 | uint _nbands; /* # bands supported */ | |
439 | chanspec_t chanspec; /* bmac chanspec shadow */ | |
440 | ||
441 | uint *txavail[NFIFO]; /* # tx descriptors available */ | |
7d4df48e | 442 | u16 *xmtfifo_sz; /* fifo size in 256B for each xmt fifo */ |
a9533e7e HP |
443 | |
444 | mbool pllreq; /* pll requests to keep PLL on */ | |
445 | ||
41feb5ed | 446 | u8 suspended_fifos; /* Which TX fifo to remain awake for */ |
66cbd3ab | 447 | u32 maccontrol; /* Cached value of maccontrol */ |
a9533e7e | 448 | uint mac_suspend_depth; /* current depth of mac_suspend levels */ |
66cbd3ab GKH |
449 | u32 wake_override; /* Various conditions to force MAC to WAKE mode */ |
450 | u32 mute_override; /* Prevent ucode from sending beacons */ | |
a44d4236 | 451 | u8 etheraddr[ETH_ALEN]; /* currently configured ethernet address */ |
66cbd3ab | 452 | u32 led_gpio_mask; /* LED GPIO Mask */ |
a9533e7e HP |
453 | bool noreset; /* true= do not reset hw, used by WLC_OUT */ |
454 | bool forcefastclk; /* true if the h/w is forcing the use of fast clk */ | |
455 | bool clk; /* core is out of reset and has clock */ | |
456 | bool sbclk; /* sb has clock */ | |
d65ddb58 | 457 | struct bmac_pmq *bmac_pmq; /* bmac PM states derived from ucode PMQ */ |
a9533e7e HP |
458 | bool phyclk; /* phy is out of reset and has clock */ |
459 | bool dma_lpbk; /* core is in DMA loopback */ | |
460 | ||
0f0881b0 | 461 | bool ucode_loaded; /* true after ucode downloaded */ |
a9533e7e | 462 | |
a9533e7e | 463 | |
41feb5ed GKH |
464 | u8 hw_stf_ss_opmode; /* STF single stream operation mode */ |
465 | u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic | |
a9533e7e HP |
466 | * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board |
467 | */ | |
299f8a46 RV |
468 | u32 antsel_avail; /* |
469 | * put struct antsel_info here if more info is | |
470 | * needed | |
471 | */ | |
a9533e7e HP |
472 | }; |
473 | ||
474 | /* TX Queue information | |
475 | * | |
476 | * Each flow of traffic out of the device has a TX Queue with independent | |
477 | * flow control. Several interfaces may be associated with a single TX Queue | |
478 | * if they belong to the same flow of traffic from the device. For multi-channel | |
479 | * operation there are independent TX Queues for each channel. | |
480 | */ | |
12bacc1b | 481 | struct wlc_txq_info { |
a9533e7e HP |
482 | struct wlc_txq_info *next; |
483 | struct pktq q; | |
484 | uint stopped; /* tx flow control bits */ | |
12bacc1b | 485 | }; |
a9533e7e HP |
486 | |
487 | /* | |
488 | * Principal common (os-independent) software data structure. | |
489 | */ | |
490 | struct wlc_info { | |
08db27dc | 491 | struct wlc_pub *pub; /* pointer to wlc public state */ |
e69284f2 | 492 | struct osl_info *osh; /* pointer to os handle */ |
a9533e7e HP |
493 | struct wl_info *wl; /* pointer to os-specific private state */ |
494 | d11regs_t *regs; /* pointer to device registers */ | |
495 | ||
e304151f | 496 | struct wlc_hw_info *hw; /* HW related state used primarily by BMAC */ |
a9533e7e HP |
497 | |
498 | /* clock */ | |
499 | int clkreq_override; /* setting for clkreq for PCIE : Auto, 0, 1 */ | |
7d4df48e | 500 | u16 fastpwrup_dly; /* time in us needed to bring up d11 fast clock */ |
a9533e7e HP |
501 | |
502 | /* interrupt */ | |
66cbd3ab GKH |
503 | u32 macintstatus; /* bit channel between isr and dpc */ |
504 | u32 macintmask; /* sw runtime master macintmask value */ | |
505 | u32 defmacintmask; /* default "on" macintmask value */ | |
a9533e7e HP |
506 | |
507 | /* up and down */ | |
508 | bool device_present; /* (removable) device is present */ | |
509 | ||
510 | bool clk; /* core is out of reset and has clock */ | |
511 | ||
512 | /* multiband */ | |
c41c858f | 513 | struct wlccore *core; /* pointer to active io core */ |
f077f718 | 514 | struct wlcband *band; /* pointer to active per-band state */ |
c41c858f | 515 | struct wlccore *corestate; /* per-core state (one per hw core) */ |
f077f718 RV |
516 | /* per-band state (one per phy/radio): */ |
517 | struct wlcband *bandstate[MAXBANDS]; | |
a9533e7e HP |
518 | |
519 | bool war16165; /* PCI slow clock 16165 war flag */ | |
520 | ||
521 | bool tx_suspended; /* data fifos need to remain suspended */ | |
522 | ||
523 | uint txpend16165war; | |
524 | ||
525 | /* packet queue */ | |
526 | uint qvalid; /* DirFrmQValid and BcMcFrmQValid */ | |
527 | ||
528 | /* Regulatory power limits */ | |
562c8850 | 529 | s8 txpwr_local_max; /* regulatory local txpwr max */ |
41feb5ed | 530 | u8 txpwr_local_constraint; /* local power contraint in dB */ |
a9533e7e | 531 | |
a9533e7e | 532 | |
1f2fd453 | 533 | struct ampdu_info *ampdu; /* ampdu module handler */ |
299f8a46 | 534 | struct antsel_info *asi; /* antsel module handler */ |
a9533e7e HP |
535 | wlc_cm_info_t *cmi; /* channel manager module handler */ |
536 | ||
537 | void *btparam; /* bus type specific cookie */ | |
538 | ||
539 | uint vars_size; /* size of vars, free vars on detach */ | |
540 | ||
7d4df48e GKH |
541 | u16 vendorid; /* PCI vendor id */ |
542 | u16 deviceid; /* PCI device id */ | |
a9533e7e HP |
543 | uint ucode_rev; /* microcode revision */ |
544 | ||
66cbd3ab | 545 | u32 machwcap; /* MAC capabilities, BMAC shadow */ |
a9533e7e | 546 | |
a44d4236 | 547 | u8 perm_etheraddr[ETH_ALEN]; /* original sprom local ethernet address */ |
a9533e7e HP |
548 | |
549 | bool bandlocked; /* disable auto multi-band switching */ | |
550 | bool bandinit_pending; /* track band init in auto band */ | |
551 | ||
552 | bool radio_monitor; /* radio timer is running */ | |
553 | bool down_override; /* true=down */ | |
554 | bool going_down; /* down path intermediate variable */ | |
555 | ||
556 | bool mpc; /* enable minimum power consumption */ | |
41feb5ed GKH |
557 | u8 mpc_dlycnt; /* # of watchdog cnt before turn disable radio */ |
558 | u8 mpc_offcnt; /* # of watchdog cnt that radio is disabled */ | |
559 | u8 mpc_delay_off; /* delay radio disable by # of watchdog cnt */ | |
560 | u8 prev_non_delay_mpc; /* prev state wlc_is_non_delay_mpc */ | |
a9533e7e HP |
561 | |
562 | /* timer */ | |
563 | struct wl_timer *wdtimer; /* timer for watchdog routine */ | |
564 | uint fast_timer; /* Periodic timeout for 'fast' timer */ | |
565 | uint slow_timer; /* Periodic timeout for 'slow' timer */ | |
566 | uint glacial_timer; /* Periodic timeout for 'glacial' timer */ | |
567 | uint phycal_mlo; /* last time measurelow calibration was done */ | |
568 | uint phycal_txpower; /* last time txpower calibration was done */ | |
569 | ||
570 | struct wl_timer *radio_timer; /* timer for hw radio button monitor routine */ | |
571 | struct wl_timer *pspoll_timer; /* periodic pspoll timer */ | |
572 | ||
573 | /* promiscuous */ | |
574 | bool monitor; /* monitor (MPDU sniffing) mode */ | |
575 | bool bcnmisc_ibss; /* bcns promisc mode override for IBSS */ | |
576 | bool bcnmisc_scan; /* bcns promisc mode override for scan */ | |
577 | bool bcnmisc_monitor; /* bcns promisc mode override for monitor */ | |
578 | ||
41feb5ed | 579 | u8 bcn_wait_prd; /* max waiting period (for beacon) in 1024TU */ |
a9533e7e HP |
580 | |
581 | /* driver feature */ | |
582 | bool _rifs; /* enable per-packet rifs */ | |
3e26416e | 583 | s32 rifs_advert; /* RIFS mode advertisement */ |
562c8850 | 584 | s8 sgi_tx; /* sgi tx */ |
a9533e7e HP |
585 | bool wet; /* true if wireless ethernet bridging mode */ |
586 | ||
587 | /* AP-STA synchronization, power save */ | |
588 | bool check_for_unaligned_tbtt; /* check unaligned tbtt flag */ | |
589 | bool PM_override; /* no power-save flag, override PM(user input) */ | |
590 | bool PMenabled; /* current power-management state (CAM or PS) */ | |
591 | bool PMpending; /* waiting for tx status with PM indicated set */ | |
592 | bool PMblocked; /* block any PSPolling in PS mode, used to buffer | |
593 | * AP traffic, also used to indicate in progress | |
594 | * of scan, rm, etc. off home channel activity. | |
595 | */ | |
596 | bool PSpoll; /* whether there is an outstanding PS-Poll frame */ | |
41feb5ed | 597 | u8 PM; /* power-management mode (CAM, PS or FASTPS) */ |
a9533e7e HP |
598 | bool PMawakebcn; /* bcn recvd during current waking state */ |
599 | ||
600 | bool WME_PM_blocked; /* Can STA go to PM when in WME Auto mode */ | |
601 | bool wake; /* host-specified PS-mode sleep state */ | |
41feb5ed GKH |
602 | u8 pspoll_prd; /* pspoll interval in milliseconds */ |
603 | u8 bcn_li_bcn; /* beacon listen interval in # beacons */ | |
604 | u8 bcn_li_dtim; /* beacon listen interval in # dtims */ | |
a9533e7e HP |
605 | |
606 | bool WDarmed; /* watchdog timer is armed */ | |
66cbd3ab | 607 | u32 WDlast; /* last time wlc_watchdog() was called */ |
a9533e7e HP |
608 | |
609 | /* WME */ | |
610 | ac_bitmap_t wme_dp; /* Discard (oldest first) policy per AC */ | |
611 | bool wme_apsd; /* enable Advanced Power Save Delivery */ | |
612 | ac_bitmap_t wme_admctl; /* bit i set if AC i under admission control */ | |
7d4df48e | 613 | u16 edcf_txop[AC_COUNT]; /* current txop for each ac */ |
a9533e7e HP |
614 | wme_param_ie_t wme_param_ie; /* WME parameter info element, which on STA |
615 | * contains parameters in use locally, and on | |
616 | * AP contains parameters advertised to STA | |
617 | * in beacons and assoc responses. | |
618 | */ | |
619 | bool wme_prec_queuing; /* enable/disable non-wme STA prec queuing */ | |
7d4df48e | 620 | u16 wme_retries[AC_COUNT]; /* per-AC retry limits */ |
a9533e7e HP |
621 | |
622 | int vlan_mode; /* OK to use 802.1Q Tags (ON, OFF, AUTO) */ | |
7d4df48e GKH |
623 | u16 tx_prec_map; /* Precedence map based on HW FIFO space */ |
624 | u16 fifo2prec_map[NFIFO]; /* pointer to fifo2_prec map based on WME */ | |
a9533e7e HP |
625 | |
626 | /* BSS Configurations */ | |
627 | wlc_bsscfg_t *bsscfg[WLC_MAXBSSCFG]; /* set of BSS configurations, idx 0 is default and | |
628 | * always valid | |
629 | */ | |
630 | wlc_bsscfg_t *cfg; /* the primary bsscfg (can be AP or STA) */ | |
41feb5ed GKH |
631 | u8 stas_associated; /* count of ASSOCIATED STA bsscfgs */ |
632 | u8 aps_associated; /* count of UP AP bsscfgs */ | |
633 | u8 block_datafifo; /* prohibit posting frames to data fifos */ | |
a9533e7e HP |
634 | bool bcmcfifo_drain; /* TX_BCMC_FIFO is set to drain */ |
635 | ||
636 | /* tx queue */ | |
12bacc1b | 637 | struct wlc_txq_info *tx_queues; /* common TX Queue list */ |
a9533e7e | 638 | |
a9533e7e HP |
639 | /* security */ |
640 | wsec_key_t *wsec_keys[WSEC_MAX_KEYS]; /* dynamic key storage */ | |
641 | wsec_key_t *wsec_def_keys[WLC_DEFAULT_KEYS]; /* default key storage */ | |
642 | bool wsec_swkeys; /* indicates that all keys should be | |
643 | * treated as sw keys (used for debugging) | |
644 | */ | |
12bacc1b AS |
645 | struct modulecb *modulecb; |
646 | struct dumpcb_s *dumpcb_head; | |
a9533e7e | 647 | |
41feb5ed GKH |
648 | u8 mimoft; /* SIGN or 11N */ |
649 | u8 mimo_band_bwcap; /* bw cap per band type */ | |
562c8850 | 650 | s8 txburst_limit_override; /* tx burst limit override */ |
7d4df48e | 651 | u16 txburst_limit; /* tx burst limit value */ |
562c8850 GKH |
652 | s8 cck_40txbw; /* 11N, cck tx b/w override when in 40MHZ mode */ |
653 | s8 ofdm_40txbw; /* 11N, ofdm tx b/w override when in 40MHZ mode */ | |
654 | s8 mimo_40txbw; /* 11N, mimo tx b/w override when in 40MHZ mode */ | |
651bd3a9 RV |
655 | /* HT CAP IE being advertised by this node: */ |
656 | struct ieee80211_ht_cap ht_cap; | |
a9533e7e HP |
657 | |
658 | uint seckeys; /* 54 key table shm address */ | |
659 | uint tkmickeys; /* 12 TKIP MIC key table shm address */ | |
660 | ||
661 | wlc_bss_info_t *default_bss; /* configured BSS parameters */ | |
662 | ||
7d4df48e GKH |
663 | u16 AID; /* association ID */ |
664 | u16 counter; /* per-sdu monotonically increasing counter */ | |
665 | u16 mc_fid_counter; /* BC/MC FIFO frame ID counter */ | |
a9533e7e | 666 | |
0965ae88 | 667 | bool ibss_allowed; /* false, all IBSS will be ignored during a scan |
a9533e7e HP |
668 | * and the driver will not allow the creation of |
669 | * an IBSS network | |
670 | */ | |
671 | bool ibss_coalesce_allowed; | |
672 | ||
673 | char country_default[WLC_CNTRY_BUF_SZ]; /* saved country for leaving 802.11d | |
674 | * auto-country mode | |
675 | */ | |
676 | char autocountry_default[WLC_CNTRY_BUF_SZ]; /* initial country for 802.11d | |
677 | * auto-country mode | |
678 | */ | |
679 | #ifdef BCMDBG | |
680 | bcm_tlv_t *country_ie_override; /* debug override of announced Country IE */ | |
681 | #endif | |
682 | ||
7d4df48e | 683 | u16 prb_resp_timeout; /* do not send prb resp if request older than this, |
a9533e7e HP |
684 | * 0 = disable |
685 | */ | |
686 | ||
687 | wlc_rateset_t sup_rates_override; /* use only these rates in 11g supported rates if | |
688 | * specifed | |
689 | */ | |
690 | ||
691 | chanspec_t home_chanspec; /* shared home chanspec */ | |
692 | ||
693 | /* PHY parameters */ | |
694 | chanspec_t chanspec; /* target operational channel */ | |
7d4df48e GKH |
695 | u16 usr_fragthresh; /* user configured fragmentation threshold */ |
696 | u16 fragthresh[NFIFO]; /* per-fifo fragmentation thresholds */ | |
697 | u16 RTSThresh; /* 802.11 dot11RTSThreshold */ | |
698 | u16 SRL; /* 802.11 dot11ShortRetryLimit */ | |
699 | u16 LRL; /* 802.11 dot11LongRetryLimit */ | |
700 | u16 SFBL; /* Short Frame Rate Fallback Limit */ | |
701 | u16 LFBL; /* Long Frame Rate Fallback Limit */ | |
a9533e7e HP |
702 | |
703 | /* network config */ | |
704 | bool shortpreamble; /* currently operating with CCK ShortPreambles */ | |
705 | bool shortslot; /* currently using 11g ShortSlot timing */ | |
562c8850 GKH |
706 | s8 barker_preamble; /* current Barker Preamble Mode */ |
707 | s8 shortslot_override; /* 11g ShortSlot override */ | |
a9533e7e | 708 | bool include_legacy_erp; /* include Legacy ERP info elt ID 47 as well as g ID 42 */ |
0f0881b0 | 709 | bool barker_overlap_control; /* true: be aware of overlapping BSSs for barker */ |
a9533e7e HP |
710 | bool ignore_bcns; /* override: ignore non shortslot bcns in a 11g network */ |
711 | bool legacy_probe; /* restricts probe requests to CCK rates */ | |
712 | ||
12bacc1b | 713 | struct wlc_protection *protection; |
562c8850 | 714 | s8 PLCPHdr_override; /* 802.11b Preamble Type override */ |
a9533e7e | 715 | |
12bacc1b | 716 | struct wlc_stf *stf; |
a9533e7e | 717 | |
12bacc1b | 718 | struct pkt_cb *pkt_callback; /* tx completion callback handlers */ |
a9533e7e | 719 | |
66cbd3ab | 720 | u32 txretried; /* tx retried number in one msdu */ |
a9533e7e HP |
721 | |
722 | ratespec_t bcn_rspec; /* save bcn ratespec purpose */ | |
723 | ||
724 | bool apsd_sta_usp; /* Unscheduled Service Period in progress on STA */ | |
725 | struct wl_timer *apsd_trigger_timer; /* timer for wme apsd trigger frames */ | |
66cbd3ab | 726 | u32 apsd_trigger_timeout; /* timeout value for apsd_trigger_timer (in ms) |
a9533e7e HP |
727 | * 0 == disable |
728 | */ | |
5ff6a1fd | 729 | ac_bitmap_t apsd_trigger_ac; /* Permissible Access Category in which APSD Null |
a9533e7e HP |
730 | * Trigger frames can be send |
731 | */ | |
41feb5ed | 732 | u8 htphy_membership; /* HT PHY membership */ |
a9533e7e HP |
733 | |
734 | bool _regulatory_domain; /* 802.11d enabled? */ | |
735 | ||
41feb5ed | 736 | u8 mimops_PM; |
a9533e7e | 737 | |
41feb5ed | 738 | u8 txpwr_percent; /* power output percentage */ |
a9533e7e | 739 | |
41feb5ed | 740 | u8 ht_wsec_restriction; /* the restriction of HT with TKIP or WEP */ |
a9533e7e HP |
741 | |
742 | uint tempsense_lasttime; | |
743 | ||
7d4df48e GKH |
744 | u16 tx_duty_cycle_ofdm; /* maximum allowed duty cycle for OFDM */ |
745 | u16 tx_duty_cycle_cck; /* maximum allowed duty cycle for CCK */ | |
a9533e7e | 746 | |
7d4df48e | 747 | u16 next_bsscfg_ID; |
a9533e7e | 748 | |
4dc79de1 | 749 | struct wlc_if *wlcif_list; /* linked list of wlc_if structs */ |
12bacc1b AS |
750 | struct wlc_txq_info *active_queue; /* txq for the currently active |
751 | * transmit context | |
752 | */ | |
66cbd3ab | 753 | u32 mpc_dur; /* total time (ms) in mpc mode except for the |
a9533e7e HP |
754 | * portion since radio is turned off last time |
755 | */ | |
66cbd3ab | 756 | u32 mpc_laston_ts; /* timestamp (ms) when radio is turned off last |
a9533e7e HP |
757 | * time |
758 | */ | |
759 | bool pr80838_war; | |
760 | uint hwrxoff; | |
761 | }; | |
762 | ||
763 | /* antsel module specific state */ | |
764 | struct antsel_info { | |
c6a9e1fc | 765 | struct wlc_info *wlc; /* pointer to main wlc structure */ |
08db27dc | 766 | struct wlc_pub *pub; /* pointer to public fn */ |
41feb5ed | 767 | u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic |
a9533e7e HP |
768 | * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board |
769 | */ | |
41feb5ed | 770 | u8 antsel_antswitch; /* board level antenna switch type */ |
a9533e7e HP |
771 | bool antsel_avail; /* Ant selection availability (SROM based) */ |
772 | wlc_antselcfg_t antcfg_11n; /* antenna configuration */ | |
773 | wlc_antselcfg_t antcfg_cur; /* current antenna config (auto) */ | |
774 | }; | |
775 | ||
776 | #define CHANNEL_BANDUNIT(wlc, ch) (((ch) <= CH_MAX_2G_CHANNEL) ? BAND_2G_INDEX : BAND_5G_INDEX) | |
fd64bcc4 | 777 | #define OTHERBANDUNIT(wlc) ((uint)((wlc)->band->bandunit ? BAND_2G_INDEX : BAND_5G_INDEX)) |
a9533e7e HP |
778 | |
779 | #define IS_MBAND_UNLOCKED(wlc) \ | |
780 | ((NBANDS(wlc) > 1) && !(wlc)->bandlocked) | |
781 | ||
a9533e7e | 782 | #define WLC_BAND_PI_RADIO_CHANSPEC wlc_phy_chanspec_get(wlc->band->pi) |
a9533e7e HP |
783 | |
784 | /* sum the individual fifo tx pending packet counts */ | |
a9533e7e HP |
785 | #define TXPKTPENDTOT(wlc) ((wlc)->core->txpktpend[0] + (wlc)->core->txpktpend[1] + \ |
786 | (wlc)->core->txpktpend[2] + (wlc)->core->txpktpend[3]) | |
787 | #define TXPKTPENDGET(wlc, fifo) ((wlc)->core->txpktpend[(fifo)]) | |
788 | #define TXPKTPENDINC(wlc, fifo, val) ((wlc)->core->txpktpend[(fifo)] += (val)) | |
789 | #define TXPKTPENDDEC(wlc, fifo, val) ((wlc)->core->txpktpend[(fifo)] -= (val)) | |
790 | #define TXPKTPENDCLR(wlc, fifo) ((wlc)->core->txpktpend[(fifo)] = 0) | |
791 | #define TXAVAIL(wlc, fifo) (*(wlc)->core->txavail[(fifo)]) | |
792 | #define GETNEXTTXP(wlc, _queue) \ | |
793 | dma_getnexttxp((wlc)->hw->di[(_queue)], HNDDMA_RANGE_TRANSMITTED) | |
a9533e7e HP |
794 | |
795 | #define WLC_IS_MATCH_SSID(wlc, ssid1, ssid2, len1, len2) \ | |
a043b266 | 796 | ((len1 == len2) && !memcmp(ssid1, ssid2, len1)) |
a9533e7e | 797 | |
c6a9e1fc RV |
798 | extern void wlc_high_dpc(struct wlc_info *wlc, u32 macintstatus); |
799 | extern void wlc_fatal_error(struct wlc_info *wlc); | |
800 | extern void wlc_bmac_rpc_watchdog(struct wlc_info *wlc); | |
801 | extern void wlc_recv(struct wlc_info *wlc, struct sk_buff *p); | |
802 | extern bool wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2); | |
803 | extern void wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, | |
c26b1378 | 804 | bool commit, s8 txpktpend); |
c6a9e1fc | 805 | extern void wlc_txfifo_complete(struct wlc_info *wlc, uint fifo, s8 txpktpend); |
c26b1378 AS |
806 | extern void wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu, |
807 | uint prec); | |
c6a9e1fc | 808 | extern void wlc_info_init(struct wlc_info *wlc, int unit); |
7cc4a4c0 | 809 | extern void wlc_print_txstatus(tx_status_t *txs); |
c6a9e1fc RV |
810 | extern int wlc_xmtfifo_sz_get(struct wlc_info *wlc, uint fifo, uint *blocks); |
811 | extern void wlc_write_template_ram(struct wlc_info *wlc, int offset, int len, | |
a9533e7e | 812 | void *buf); |
c6a9e1fc | 813 | extern void wlc_write_hw_bcntemplates(struct wlc_info *wlc, void *bcn, int len, |
a9533e7e HP |
814 | bool both); |
815 | #if defined(BCMDBG) | |
c6a9e1fc | 816 | extern void wlc_get_rcmta(struct wlc_info *wlc, int idx, |
a44d4236 | 817 | u8 *addr); |
a9533e7e | 818 | #endif |
c6a9e1fc | 819 | extern void wlc_set_rcmta(struct wlc_info *wlc, int idx, |
a44d4236 | 820 | const u8 *addr); |
c6a9e1fc | 821 | extern void wlc_read_tsf(struct wlc_info *wlc, u32 *tsf_l_ptr, |
66cbd3ab | 822 | u32 *tsf_h_ptr); |
c6a9e1fc RV |
823 | extern void wlc_set_cwmin(struct wlc_info *wlc, u16 newmin); |
824 | extern void wlc_set_cwmax(struct wlc_info *wlc, u16 newmax); | |
825 | extern void wlc_fifoerrors(struct wlc_info *wlc); | |
826 | extern void wlc_pllreq(struct wlc_info *wlc, bool set, mbool req_bit); | |
827 | extern void wlc_reset_bmac_done(struct wlc_info *wlc); | |
c6a9e1fc RV |
828 | extern void wlc_hwtimer_gptimer_set(struct wlc_info *wlc, uint us); |
829 | extern void wlc_hwtimer_gptimer_abort(struct wlc_info *wlc); | |
a9533e7e HP |
830 | |
831 | #if defined(BCMDBG) | |
7cc4a4c0 | 832 | extern void wlc_print_rxh(d11rxhdr_t *rxh); |
c6a9e1fc | 833 | extern void wlc_print_hdrs(struct wlc_info *wlc, const char *prefix, u8 *frame, |
7cc4a4c0 JC |
834 | d11txh_t *txh, d11rxhdr_t *rxh, uint len); |
835 | extern void wlc_print_txdesc(d11txh_t *txh); | |
bc042b67 AS |
836 | #else |
837 | #define wlc_print_txdesc(a) | |
a9533e7e HP |
838 | #endif |
839 | #if defined(BCMDBG) | |
41feb5ed | 840 | extern void wlc_print_dot11_mac_hdr(u8 *buf, int len); |
a9533e7e HP |
841 | #endif |
842 | ||
e304151f RV |
843 | extern void wlc_setxband(struct wlc_hw_info *wlc_hw, uint bandunit); |
844 | extern void wlc_coredisable(struct wlc_hw_info *wlc_hw); | |
a9533e7e | 845 | |
c6a9e1fc | 846 | extern bool wlc_valid_rate(struct wlc_info *wlc, ratespec_t rate, int band, |
a9533e7e | 847 | bool verbose); |
c6a9e1fc | 848 | extern void wlc_ap_upd(struct wlc_info *wlc); |
a9533e7e HP |
849 | |
850 | /* helper functions */ | |
c6a9e1fc RV |
851 | extern void wlc_shm_ssid_upd(struct wlc_info *wlc, wlc_bsscfg_t *cfg); |
852 | extern int wlc_set_gmode(struct wlc_info *wlc, u8 gmode, bool config); | |
a9533e7e | 853 | |
c6a9e1fc RV |
854 | extern void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc); |
855 | extern void wlc_mac_bcn_promisc(struct wlc_info *wlc); | |
856 | extern void wlc_mac_promisc(struct wlc_info *wlc); | |
12bacc1b AS |
857 | extern void wlc_txflowcontrol(struct wlc_info *wlc, struct wlc_txq_info *qi, |
858 | bool on, int prio); | |
859 | extern void wlc_txflowcontrol_override(struct wlc_info *wlc, | |
860 | struct wlc_txq_info *qi, | |
a9533e7e | 861 | bool on, uint override); |
c6a9e1fc | 862 | extern bool wlc_txflowcontrol_prio_isset(struct wlc_info *wlc, |
12bacc1b AS |
863 | struct wlc_txq_info *qi, int prio); |
864 | extern void wlc_send_q(struct wlc_info *wlc, struct wlc_txq_info *qi); | |
c6a9e1fc | 865 | extern int wlc_prep_pdu(struct wlc_info *wlc, struct sk_buff *pdu, uint *fifo); |
a9533e7e | 866 | |
c6a9e1fc | 867 | extern u16 wlc_calc_lsig_len(struct wlc_info *wlc, ratespec_t ratespec, |
a9533e7e | 868 | uint mac_len); |
c6a9e1fc | 869 | extern ratespec_t wlc_rspec_to_rts_rspec(struct wlc_info *wlc, ratespec_t rspec, |
7d4df48e | 870 | bool use_rspec, u16 mimo_ctlchbw); |
c6a9e1fc | 871 | extern u16 wlc_compute_rtscts_dur(struct wlc_info *wlc, bool cts_only, |
a9533e7e | 872 | ratespec_t rts_rate, ratespec_t frame_rate, |
41feb5ed GKH |
873 | u8 rts_preamble_type, |
874 | u8 frame_preamble_type, uint frame_len, | |
a9533e7e HP |
875 | bool ba); |
876 | ||
c6a9e1fc | 877 | extern void wlc_tbtt(struct wlc_info *wlc, d11regs_t *regs); |
a9533e7e HP |
878 | |
879 | #if defined(BCMDBG) | |
c6a9e1fc RV |
880 | extern void wlc_dump_ie(struct wlc_info *wlc, bcm_tlv_t *ie, |
881 | struct bcmstrbuf *b); | |
a9533e7e HP |
882 | #endif |
883 | ||
c6a9e1fc RV |
884 | extern bool wlc_ps_check(struct wlc_info *wlc); |
885 | extern void wlc_reprate_init(struct wlc_info *wlc); | |
7cc4a4c0 | 886 | extern void wlc_bsscfg_reprate_init(wlc_bsscfg_t *bsscfg); |
66cbd3ab GKH |
887 | extern void wlc_uint64_sub(u32 *a_high, u32 *a_low, u32 b_high, |
888 | u32 b_low); | |
889 | extern u32 wlc_calc_tbtt_offset(u32 bi, u32 tsf_h, u32 tsf_l); | |
a9533e7e HP |
890 | |
891 | /* Shared memory access */ | |
c6a9e1fc RV |
892 | extern void wlc_write_shm(struct wlc_info *wlc, uint offset, u16 v); |
893 | extern u16 wlc_read_shm(struct wlc_info *wlc, uint offset); | |
894 | extern void wlc_set_shm(struct wlc_info *wlc, uint offset, u16 v, int len); | |
895 | extern void wlc_copyto_shm(struct wlc_info *wlc, uint offset, const void *buf, | |
a9533e7e | 896 | int len); |
c6a9e1fc RV |
897 | extern void wlc_copyfrom_shm(struct wlc_info *wlc, uint offset, void *buf, |
898 | int len); | |
a9533e7e | 899 | |
c6a9e1fc RV |
900 | extern void wlc_update_beacon(struct wlc_info *wlc); |
901 | extern void wlc_bss_update_beacon(struct wlc_info *wlc, | |
902 | struct wlc_bsscfg *bsscfg); | |
a9533e7e | 903 | |
c6a9e1fc RV |
904 | extern void wlc_update_probe_resp(struct wlc_info *wlc, bool suspend); |
905 | extern void wlc_bss_update_probe_resp(struct wlc_info *wlc, wlc_bsscfg_t *cfg, | |
a9533e7e HP |
906 | bool suspend); |
907 | ||
c6a9e1fc RV |
908 | extern bool wlc_ismpc(struct wlc_info *wlc); |
909 | extern bool wlc_is_non_delay_mpc(struct wlc_info *wlc); | |
910 | extern void wlc_radio_mpc_upd(struct wlc_info *wlc); | |
911 | extern bool wlc_prec_enq(struct wlc_info *wlc, struct pktq *q, void *pkt, | |
912 | int prec); | |
913 | extern bool wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, | |
c26b1378 | 914 | struct sk_buff *pkt, int prec, bool head); |
c6a9e1fc RV |
915 | extern u16 wlc_phytxctl1_calc(struct wlc_info *wlc, ratespec_t rspec); |
916 | extern void wlc_compute_plcp(struct wlc_info *wlc, ratespec_t rate, uint length, | |
41feb5ed | 917 | u8 *plcp); |
c6a9e1fc | 918 | extern uint wlc_calc_frame_time(struct wlc_info *wlc, ratespec_t ratespec, |
41feb5ed | 919 | u8 preamble_type, uint mac_len); |
a9533e7e | 920 | |
c6a9e1fc | 921 | extern void wlc_set_chanspec(struct wlc_info *wlc, chanspec_t chanspec); |
a9533e7e | 922 | |
c6a9e1fc | 923 | extern bool wlc_timers_init(struct wlc_info *wlc, int unit); |
a9533e7e HP |
924 | |
925 | extern const bcm_iovar_t wlc_iovars[]; | |
926 | ||
66cbd3ab | 927 | extern int wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid, |
a9533e7e | 928 | const char *name, void *params, uint p_len, void *arg, |
4dc79de1 | 929 | int len, int val_size, struct wlc_if *wlcif); |
a9533e7e HP |
930 | |
931 | #if defined(BCMDBG) | |
c6a9e1fc | 932 | extern void wlc_print_ies(struct wlc_info *wlc, u8 *ies, uint ies_len); |
a9533e7e HP |
933 | #endif |
934 | ||
c6a9e1fc RV |
935 | extern int wlc_set_nmode(struct wlc_info *wlc, s32 nmode); |
936 | extern void wlc_ht_mimops_cap_update(struct wlc_info *wlc, u8 mimops_mode); | |
937 | extern void wlc_mimops_action_ht_send(struct wlc_info *wlc, | |
938 | wlc_bsscfg_t *bsscfg, u8 mimops_mode); | |
a9533e7e | 939 | |
c6a9e1fc | 940 | extern void wlc_switch_shortslot(struct wlc_info *wlc, bool shortslot); |
7cc4a4c0 JC |
941 | extern void wlc_set_bssid(wlc_bsscfg_t *cfg); |
942 | extern void wlc_edcf_setparams(wlc_bsscfg_t *cfg, bool suspend); | |
a9533e7e | 943 | |
c6a9e1fc | 944 | extern void wlc_set_ratetable(struct wlc_info *wlc); |
7cc4a4c0 | 945 | extern int wlc_set_mac(wlc_bsscfg_t *cfg); |
c6a9e1fc | 946 | extern void wlc_beacon_phytxctl_txant_upd(struct wlc_info *wlc, |
a9533e7e | 947 | ratespec_t bcn_rate); |
c6a9e1fc RV |
948 | extern void wlc_mod_prb_rsp_rate_table(struct wlc_info *wlc, uint frame_len); |
949 | extern ratespec_t wlc_lowest_basic_rspec(struct wlc_info *wlc, | |
950 | wlc_rateset_t *rs); | |
951 | extern u16 wlc_compute_bcntsfoff(struct wlc_info *wlc, ratespec_t rspec, | |
a9533e7e | 952 | bool short_preamble, bool phydelay); |
c6a9e1fc RV |
953 | extern void wlc_radio_disable(struct wlc_info *wlc); |
954 | extern void wlc_bcn_li_upd(struct wlc_info *wlc); | |
955 | ||
956 | extern int wlc_get_revision_info(struct wlc_info *wlc, void *buf, uint len); | |
957 | extern void wlc_out(struct wlc_info *wlc); | |
958 | extern void wlc_set_home_chanspec(struct wlc_info *wlc, chanspec_t chanspec); | |
959 | extern void wlc_watchdog_upd(struct wlc_info *wlc, bool tbtt); | |
960 | extern bool wlc_ps_allowed(struct wlc_info *wlc); | |
961 | extern bool wlc_stay_awake(struct wlc_info *wlc); | |
962 | extern void wlc_wme_initparams_sta(struct wlc_info *wlc, wme_param_ie_t *pe); | |
963 | ||
12bacc1b AS |
964 | extern void wlc_bss_list_free(struct wlc_info *wlc, |
965 | struct wlc_bss_list *bss_list); | |
c6a9e1fc | 966 | extern void wlc_ht_mimops_cap_update(struct wlc_info *wlc, u8 mimops_mode); |
a9533e7e | 967 | #endif /* _wlc_h_ */ |