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