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