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