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