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