2
* Copyright (c) 2010 Broadcom Corporation
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.
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.
20
#include <wlc_types.h>
23
#define WLC_NUMRATES 16 /* max # of rates in a rateset */
24
#define MAXMULTILIST 32 /* max # multicast addresses */
25
#define D11_PHY_HDR_LEN 6 /* Phy header length - 6 bytes */
28
#define PHY_TYPE_A 0 /* Phy type A */
29
#define PHY_TYPE_G 2 /* Phy type G */
30
#define PHY_TYPE_N 4 /* Phy type N */
31
#define PHY_TYPE_LP 5 /* Phy type Low Power A/B/G */
32
#define PHY_TYPE_SSN 6 /* Phy type Single Stream N */
33
#define PHY_TYPE_LCN 8 /* Phy type Single Stream N */
34
#define PHY_TYPE_LCNXN 9 /* Phy type 2-stream N */
35
#define PHY_TYPE_HT 7 /* Phy type 3-Stream N */
38
#define WLC_10_MHZ 10 /* 10Mhz nphy channel bandwidth */
39
#define WLC_20_MHZ 20 /* 20Mhz nphy channel bandwidth */
40
#define WLC_40_MHZ 40 /* 40Mhz nphy channel bandwidth */
42
#define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? WLC_40_MHZ : \
43
CHSPEC_IS20(chanspec) ? WLC_20_MHZ : \
46
#define WLC_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
47
#define WLC_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
48
#define WLC_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
49
#define WLC_RSSI_LOW -70 /* Low quality cutoffs */
50
#define WLC_RSSI_GOOD -68 /* Good quality cutoffs */
51
#define WLC_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
52
#define WLC_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
54
#define WLC_PHYTYPE(_x) (_x) /* macro to perform WLC PHY -> D11 PHY TYPE, currently 1:1 */
56
#define MA_WINDOW_SZ 8 /* moving average window size */
58
#define WLC_SNR_INVALID 0 /* invalid SNR value */
60
/* a large TX Power as an init value to factor out of min() calculations,
61
* keep low enough to fit in an s8, units are .25 dBm
63
#define WLC_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */
65
/* legacy rx Antenna diversity for SISO rates */
66
#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */
67
#define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */
68
#define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */
69
#define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */
70
#define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */
71
#define ANT_RX_DIV_DEF ANT_RX_DIV_START_0 /* default antdiv setting */
73
/* legacy rx Antenna diversity for SISO rates */
74
#define ANT_TX_FORCE_0 0 /* Tx on antenna 0, "legacy term Main" */
75
#define ANT_TX_FORCE_1 1 /* Tx on antenna 1, "legacy term Aux" */
76
#define ANT_TX_LAST_RX 3 /* Tx on phy's last good Rx antenna */
77
#define ANT_TX_DEF 3 /* driver's default tx antenna setting */
79
#define TXCORE_POLICY_ALL 0x1 /* use all available core for transmit */
82
#define TXCHAIN_DEF 0x1 /* def bitmap of txchain */
83
#define TXCHAIN_DEF_NPHY 0x3 /* default bitmap of tx chains for nphy */
84
#define TXCHAIN_DEF_HTPHY 0x7 /* default bitmap of tx chains for nphy */
85
#define RXCHAIN_DEF 0x1 /* def bitmap of rxchain */
86
#define RXCHAIN_DEF_NPHY 0x3 /* default bitmap of rx chains for nphy */
87
#define RXCHAIN_DEF_HTPHY 0x7 /* default bitmap of rx chains for nphy */
88
#define ANTSWITCH_NONE 0 /* no antenna switch */
89
#define ANTSWITCH_TYPE_1 1 /* antenna switch on 4321CB2, 2of3 */
90
#define ANTSWITCH_TYPE_2 2 /* antenna switch on 4321MPCI, 2of3 */
91
#define ANTSWITCH_TYPE_3 3 /* antenna switch on 4322, 2of3 */
93
#define RXBUFSZ PKTBUFSZ
95
#define AIDMAPSZ (roundup(MAXSCB, NBBY)/NBBY) /* aid bitmap size in bytes */
98
typedef struct wlc_tunables {
99
int ntxd; /* size of tx descriptor table */
100
int nrxd; /* size of rx descriptor table */
101
int rxbufsz; /* size of rx buffers to post */
102
int nrxbufpost; /* # of rx buffers to post */
103
int maxscb; /* # of SCBs supported */
104
int ampdunummpdu; /* max number of mpdu in an ampdu */
105
int maxpktcb; /* max # of packet callbacks */
106
int maxucodebss; /* max # of BSS handled in ucode bcn/prb */
107
int maxucodebss4; /* max # of BSS handled in sw bcn/prb */
108
int maxbss; /* max # of bss info elements in scan list */
109
int datahiwat; /* data msg txq hiwat mark */
110
int ampdudatahiwat; /* AMPDU msg txq hiwat mark */
111
int rxbnd; /* max # of rx bufs to process before deferring to dpc */
112
int txsbnd; /* max # tx status to process in wlc_txstatus() */
113
int memreserved; /* memory reserved for BMAC's USB dma rx */
116
typedef struct wlc_rateset {
117
uint count; /* number of rates in rates[] */
118
u8 rates[WLC_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
119
u8 htphy_membership; /* HT PHY Membership */
120
u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */
124
u8 flags; /* misc booleans (e.g., supported) */
125
u8 multicast; /* multicast cipher */
126
u8 ucount; /* count of unicast ciphers */
127
u8 unicast[4]; /* unicast ciphers */
128
u8 acount; /* count of auth modes */
129
u8 auth[4]; /* Authentication modes */
130
u8 PAD[4]; /* padding for future growth */
134
* buffer length needed for wlc_format_ssid
135
* 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
137
#define SSID_FMT_BUF_LEN ((4 * DOT11_MAX_SSID_LEN) + 1)
139
#define RSN_FLAGS_SUPPORTED 0x1 /* Flag for rsn_params */
140
#define RSN_FLAGS_PREAUTH 0x2 /* Flag for WPA2 rsn_params */
142
/* All the HT-specific default advertised capabilities (including AMPDU)
143
* should be grouped here at one place
145
#define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */
147
/* defaults for the HT (MIMO) bss */
148
#define HT_CAP ((HT_CAP_MIMO_PS_OFF << HT_CAP_MIMO_PS_SHIFT) | HT_CAP_40MHZ | \
149
HT_CAP_GF | HT_CAP_MAX_AMSDU | HT_CAP_DSSS_CCK)
151
/* WLC packet type is a void * */
152
typedef void *wlc_pkt_t;
154
/* Event data type */
155
typedef struct wlc_event {
156
wl_event_msg_t event; /* encapsulated event */
157
struct ether_addr *addr; /* used to keep a trace of the potential present of
158
* an address in wlc_event_msg_t
160
int bsscfgidx; /* BSS config when needed */
161
struct wl_if *wlif; /* pointer to wlif */
162
void *data; /* used to hang additional data on an event */
163
struct wlc_event *next; /* enables ordered list of pending events */
166
/* wlc internal bss_info, wl external one is in wlioctl.h */
167
typedef struct wlc_bss_info {
168
struct ether_addr BSSID; /* network BSSID */
169
u16 flags; /* flags for internal attributes */
170
u8 SSID_len; /* the length of SSID */
171
u8 SSID[32]; /* SSID string */
172
s16 RSSI; /* receive signal strength (in dBm) */
173
s16 SNR; /* receive signal SNR in dB */
174
u16 beacon_period; /* units are Kusec */
175
u16 atim_window; /* units are Kusec */
176
chanspec_t chanspec; /* Channel num, bw, ctrl_sb and band */
177
s8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */
178
wlc_rateset_t rateset; /* supported rates */
179
u8 dtim_period; /* DTIM period */
180
s8 phy_noise; /* noise right after tx (in dBm) */
181
u16 capability; /* Capability information */
182
struct dot11_bcn_prb *bcn_prb; /* beacon/probe response frame (ioctl na) */
183
u16 bcn_prb_len; /* beacon/probe response frame length (ioctl na) */
184
u8 wme_qosinfo; /* QoS Info from WME IE; valid if WLC_BSS_WME flag set */
185
struct rsn_parms wpa;
186
struct rsn_parms wpa2;
187
u16 qbss_load_aac; /* qbss load available admission capacity */
188
/* qbss_load_chan_free <- (0xff - channel_utilization of qbss_load_ie_t) */
189
u8 qbss_load_chan_free; /* indicates how free the channel is */
190
u8 mcipher; /* multicast cipher */
191
u8 wpacfg; /* wpa config index */
194
/* forward declarations */
197
/* wlc_ioctl error codes */
198
#define WLC_ENOIOCTL 1 /* No such Ioctl */
199
#define WLC_EINVAL 2 /* Invalid value */
200
#define WLC_ETOOSMALL 3 /* Value too small */
201
#define WLC_ETOOBIG 4 /* Value too big */
202
#define WLC_ERANGE 5 /* Out of range */
203
#define WLC_EDOWN 6 /* Down */
204
#define WLC_EUP 7 /* Up */
205
#define WLC_ENOMEM 8 /* No Memory */
206
#define WLC_EBUSY 9 /* Busy */
208
/* IOVar flags for common error checks */
209
#define IOVF_MFG (1<<3) /* flag for mfgtest iovars */
210
#define IOVF_WHL (1<<4) /* value must be whole (0-max) */
211
#define IOVF_NTRL (1<<5) /* value must be natural (1-max) */
213
#define IOVF_SET_UP (1<<6) /* set requires driver be up */
214
#define IOVF_SET_DOWN (1<<7) /* set requires driver be down */
215
#define IOVF_SET_CLK (1<<8) /* set requires core clock */
216
#define IOVF_SET_BAND (1<<9) /* set requires fixed band */
218
#define IOVF_GET_UP (1<<10) /* get requires driver be up */
219
#define IOVF_GET_DOWN (1<<11) /* get requires driver be down */
220
#define IOVF_GET_CLK (1<<12) /* get requires core clock */
221
#define IOVF_GET_BAND (1<<13) /* get requires fixed band */
222
#define IOVF_OPEN_ALLOW (1<<14) /* set allowed iovar for opensrc */
224
/* watchdog down and dump callback function proto's */
225
typedef int (*watchdog_fn_t) (void *handle);
226
typedef int (*down_fn_t) (void *handle);
227
typedef int (*dump_fn_t) (void *handle, struct bcmstrbuf *b);
231
* handle - a pointer value registered with the function
232
* vi - iovar_info that was looked up
233
* actionid - action ID, calculated by IOV_GVAL() and IOV_SVAL() based on varid.
234
* name - the actual iovar name
235
* params/plen - parameters and length for a get, input only.
236
* arg/len - buffer and length for value to be set or retrieved, input or output.
237
* vsize - value size, valid for integer type only.
238
* wlcif - interface context (wlc_if pointer)
240
* All pointers may point into the same buffer.
242
typedef int (*iovar_fn_t) (void *handle, const bcm_iovar_t *vi,
243
u32 actionid, const char *name, void *params,
244
uint plen, void *arg, int alen, int vsize,
245
struct wlc_if *wlcif);
247
#define MAC80211_PROMISC_BCNS (1 << 0)
248
#define MAC80211_SCAN (1 << 1)
251
* Public portion of "common" os-independent state structure.
252
* The wlc handle points at this.
257
struct ieee80211_hw *ieee_hw;
258
struct scb *global_scb;
259
scb_ampdu_t *global_ampdu;
261
uint unit; /* device instance number */
262
uint corerev; /* core revision */
263
struct osl_info *osh; /* pointer to os handle */
264
si_t *sih; /* SB handle (cookie for siutils calls) */
265
char *vars; /* "environment" name=value */
266
bool up; /* interface up and running */
267
bool hw_off; /* HW is off */
268
wlc_tunables_t *tunables; /* tunables: ntxd, nrxd, maxscb, etc. */
269
bool hw_up; /* one time hw up/down(from boot or hibernation) */
270
bool _piomode; /* true if pio mode *//* BMAC_NOTE: NEED In both */
271
uint _nbands; /* # bands supported */
272
uint now; /* # elapsed seconds */
274
bool promisc; /* promiscuous destination address */
275
bool delayed_down; /* down delayed */
276
bool _ap; /* AP mode enabled */
277
bool _apsta; /* simultaneous AP/STA mode enabled */
278
bool _assoc_recreate; /* association recreation on up transitions */
279
int _wme; /* WME QoS mode */
280
u8 _mbss; /* MBSS mode on */
281
bool allmulti; /* enable all multicasts */
282
bool associated; /* true:part of [I]BSS, false: not */
283
/* (union of stas_associated, aps_associated) */
284
bool phytest_on; /* whether a PHY test is running */
285
bool bf_preempt_4306; /* True to enable 'darwin' mode */
286
bool _ampdu; /* ampdu enabled or not */
287
bool _cac; /* 802.11e CAC enabled */
288
u8 _n_enab; /* bitmap of 11N + HT support */
289
bool _n_reqd; /* N support required for clients */
291
s8 _coex; /* 20/40 MHz BSS Management AUTO, ENAB, DISABLE */
292
bool _priofc; /* Priority-based flowcontrol */
294
struct ether_addr cur_etheraddr; /* our local ethernet address */
296
struct ether_addr *multicast; /* ptr to list of multicast addresses */
297
uint nmulticast; /* # enabled multicast addresses */
299
u32 wlfeatureflag; /* Flags to control sw features from registry */
300
int psq_pkts_total; /* total num of ps pkts */
302
u16 txmaxpkts; /* max number of large pkts allowed to be pending */
304
/* s/w decryption counters */
305
u32 swdecrypt; /* s/w decrypt attempts */
307
int bcmerror; /* last bcm error */
309
mbool radio_disabled; /* bit vector for radio disabled reasons */
310
bool radio_active; /* radio on/off state */
311
u16 roam_time_thresh; /* Max. # secs. of not hearing beacons
314
bool align_wd_tbtt; /* Align watchdog with tbtt indication
315
* handling. This flag is cleared by default
316
* and is set by per port code explicitly and
317
* you need to make sure the OSL_SYSUPTIME()
318
* is implemented properly in osl of that port
319
* when it enables this Power Save feature.
322
u16 boardrev; /* version # of particular board */
323
u8 sromrev; /* version # of the srom */
324
char srom_ccode[WLC_CNTRY_BUF_SZ]; /* Country Code in SROM */
325
u32 boardflags; /* Board specific flags from srom */
326
u32 boardflags2; /* More board flags if sromrev >= 4 */
327
bool tempsense_disable; /* disable periodic tempsense check */
329
bool _lmac; /* lmac module included and enabled */
330
bool _lmacproto; /* lmac protocol module included and enabled */
331
bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */
332
bool _ampdumac; /* mac assist ampdu enabled or not */
335
/* wl_monitor rx status per packet */
336
typedef struct wl_rxsts {
337
uint pkterror; /* error flags per pkt */
338
uint phytype; /* 802.11 A/B/G ... */
339
uint channel; /* channel */
340
uint datarate; /* rate in 500kbps */
341
uint antenna; /* antenna pkts received on */
342
uint pktlength; /* pkt length minus bcm phy hdr */
343
u32 mactime; /* time stamp from mac, count per 1us */
344
uint sq; /* signal quality */
345
s32 signal; /* in dbm */
346
s32 noise; /* in dbm */
347
uint preamble; /* Unknown, short, long */
348
uint encoding; /* Unknown, CCK, PBCC, OFDM */
349
uint nfrmtype; /* special 802.11n frames(AMPDU, AMSDU) */
350
struct wl_if *wlif; /* wl interface */
353
/* status per error RX pkt */
354
#define WL_RXS_CRC_ERROR 0x00000001 /* CRC Error in packet */
355
#define WL_RXS_RUNT_ERROR 0x00000002 /* Runt packet */
356
#define WL_RXS_ALIGN_ERROR 0x00000004 /* Misaligned packet */
357
#define WL_RXS_OVERSIZE_ERROR 0x00000008 /* packet bigger than RX_LENGTH (usually 1518) */
358
#define WL_RXS_WEP_ICV_ERROR 0x00000010 /* Integrity Check Value error */
359
#define WL_RXS_WEP_ENCRYPTED 0x00000020 /* Encrypted with WEP */
360
#define WL_RXS_PLCP_SHORT 0x00000040 /* Short PLCP error */
361
#define WL_RXS_DECRYPT_ERR 0x00000080 /* Decryption error */
362
#define WL_RXS_OTHER_ERR 0x80000000 /* Other errors */
365
#define WL_RXS_PHY_A 0x00000000 /* A phy type */
366
#define WL_RXS_PHY_B 0x00000001 /* B phy type */
367
#define WL_RXS_PHY_G 0x00000002 /* G phy type */
368
#define WL_RXS_PHY_N 0x00000004 /* N phy type */
371
#define WL_RXS_ENCODING_CCK 0x00000000 /* CCK encoding */
372
#define WL_RXS_ENCODING_OFDM 0x00000001 /* OFDM encoding */
375
#define WL_RXS_UNUSED_STUB 0x0 /* stub to match with wlc_ethereal.h */
376
#define WL_RXS_PREAMBLE_SHORT 0x00000001 /* Short preamble */
377
#define WL_RXS_PREAMBLE_LONG 0x00000002 /* Long preamble */
378
#define WL_RXS_PREAMBLE_MIMO_MM 0x00000003 /* MIMO mixed mode preamble */
379
#define WL_RXS_PREAMBLE_MIMO_GF 0x00000004 /* MIMO green field preamble */
381
#define WL_RXS_NFRM_AMPDU_FIRST 0x00000001 /* first MPDU in A-MPDU */
382
#define WL_RXS_NFRM_AMPDU_SUB 0x00000002 /* subsequent MPDU(s) in A-MPDU */
383
#define WL_RXS_NFRM_AMSDU_FIRST 0x00000004 /* first MSDU in A-MSDU */
384
#define WL_RXS_NFRM_AMSDU_SUB 0x00000008 /* subsequent MSDU(s) in A-MSDU */
386
/* forward declare and use the struct notation so we don't have to
387
* have it defined if not necessary.
394
/***********************************************
395
* Feature-related macros to optimize out code *
396
* *********************************************
399
/* AP Support (versus STA) */
400
#define AP_ENAB(pub) (0)
402
/* Macro to check if APSTA mode enabled */
403
#define APSTA_ENAB(pub) (0)
405
/* Some useful combinations */
406
#define STA_ONLY(pub) (!AP_ENAB(pub))
407
#define AP_ONLY(pub) (AP_ENAB(pub) && !APSTA_ENAB(pub))
409
#define ENAB_1x1 0x01
410
#define ENAB_2x2 0x02
411
#define ENAB_3x3 0x04
412
#define ENAB_4x4 0x08
413
#define SUPPORT_11N (ENAB_1x1|ENAB_2x2)
414
#define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3)
416
#if ((defined(NCONF) && (NCONF != 0)) || (defined(LCNCONF) && (LCNCONF != 0)) || \
417
(defined(HTCONF) && (HTCONF != 0)) || (defined(SSLPNCONF) && (SSLPNCONF != 0)))
418
#define N_ENAB(pub) ((pub)->_n_enab & SUPPORT_11N)
419
#define N_REQD(pub) ((pub)->_n_reqd)
421
#define N_ENAB(pub) 0
422
#define N_REQD(pub) 0
425
#if (defined(HTCONF) && (HTCONF != 0))
426
#define HT_ENAB(pub) (((pub)->_n_enab & SUPPORT_HT) == SUPPORT_HT)
428
#define HT_ENAB(pub) 0
431
#define AMPDU_AGG_HOST 1
432
#define AMPDU_ENAB(pub) ((pub)->_ampdu)
434
#define EDCF_ENAB(pub) (WME_ENAB(pub))
435
#define QOS_ENAB(pub) (WME_ENAB(pub) || N_ENAB(pub))
437
#define MONITOR_ENAB(wlc) ((wlc)->monitor)
439
#define PROMISC_ENAB(wlc) ((wlc)->promisc)
441
#define WLC_PREC_COUNT 16 /* Max precedence level implemented */
443
/* pri is priority encoded in the packet. This maps the Packet priority to
444
* enqueue precedence as defined in wlc_prec_map
446
extern const u8 wlc_prio2prec_map[];
447
#define WLC_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7]
449
/* This maps priority to one precedence higher - Used by PS-Poll response packets to
450
* simulate enqueue-at-head operation, but still maintain the order on the queue
452
#define WLC_PRIO_TO_HI_PREC(pri) min(WLC_PRIO_TO_PREC(pri) + 1, WLC_PREC_COUNT - 1)
454
extern const u8 wme_fifo2ac[];
455
#define WME_PRIO2AC(prio) wme_fifo2ac[prio2fifo[(prio)]]
457
/* Mask to describe all precedence levels */
458
#define WLC_PREC_BMP_ALL MAXBITVAL(WLC_PREC_COUNT)
460
/* Define a bitmap of precedences comprised by each AC */
461
#define WLC_PREC_BMP_AC_BE (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_BE)) | \
462
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \
463
NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_EE)) | \
464
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_EE)))
465
#define WLC_PREC_BMP_AC_BK (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_BK)) | \
466
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \
467
NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_NONE)) | \
468
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_NONE)))
469
#define WLC_PREC_BMP_AC_VI (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_CL)) | \
470
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \
471
NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_VI)) | \
472
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_VI)))
473
#define WLC_PREC_BMP_AC_VO (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_VO)) | \
474
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \
475
NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_NC)) | \
476
NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_NC)))
479
#define WME_ENAB(pub) ((pub)->_wme != OFF)
480
#define WME_AUTO(wlc) ((wlc)->pub->_wme == AUTO)
482
#define WLC_USE_COREFLAGS 0xffffffff /* invalid core flags, use the saved coreflags */
484
#define WLC_UPDATE_STATS(wlc) 0 /* No stats support */
485
#define WLCNTINCR(a) /* No stats support */
486
#define WLCNTDECR(a) /* No stats support */
487
#define WLCNTADD(a, delta) /* No stats support */
488
#define WLCNTSET(a, value) /* No stats support */
489
#define WLCNTVAL(a) 0 /* No stats support */
491
/* common functions for every port */
492
extern void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit,
493
bool piomode, struct osl_info *osh, void *regsva,
494
uint bustype, void *btparam, uint *perr);
495
extern uint wlc_detach(struct wlc_info *wlc);
496
extern int wlc_up(struct wlc_info *wlc);
497
extern uint wlc_down(struct wlc_info *wlc);
499
extern int wlc_set(struct wlc_info *wlc, int cmd, int arg);
500
extern int wlc_get(struct wlc_info *wlc, int cmd, int *arg);
501
extern int wlc_iovar_getint(struct wlc_info *wlc, const char *name, int *arg);
502
extern int wlc_iovar_setint(struct wlc_info *wlc, const char *name, int arg);
503
extern bool wlc_chipmatch(u16 vendor, u16 device);
504
extern void wlc_init(struct wlc_info *wlc);
505
extern void wlc_reset(struct wlc_info *wlc);
507
extern void wlc_intrson(struct wlc_info *wlc);
508
extern u32 wlc_intrsoff(struct wlc_info *wlc);
509
extern void wlc_intrsrestore(struct wlc_info *wlc, u32 macintmask);
510
extern bool wlc_intrsupd(struct wlc_info *wlc);
511
extern bool wlc_isr(struct wlc_info *wlc, bool *wantdpc);
512
extern bool wlc_dpc(struct wlc_info *wlc, bool bounded);
513
extern bool wlc_send80211_raw(struct wlc_info *wlc, struct wlc_if *wlcif,
515
extern bool wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu,
516
struct ieee80211_hw *hw);
517
extern int wlc_iovar_op(struct wlc_info *wlc, const char *name, void *params,
518
int p_len, void *arg, int len, bool set,
519
struct wlc_if *wlcif);
520
extern int wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len,
521
struct wlc_if *wlcif);
522
/* helper functions */
523
extern void wlc_statsupd(struct wlc_info *wlc);
524
extern int wlc_get_header_len(void);
525
extern void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc);
526
extern void wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset,
527
const struct ether_addr *addr);
528
extern void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void *arg,
531
extern struct wlc_pub *wlc_pub(void *wlc);
533
/* common functions for every port */
534
extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw);
535
extern int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw);
536
extern int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw);
537
extern int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw);
539
extern u32 wlc_reg_read(struct wlc_info *wlc, void *r, uint size);
540
extern void wlc_reg_write(struct wlc_info *wlc, void *r, u32 v, uint size);
541
extern void wlc_corereset(struct wlc_info *wlc, u32 flags);
542
extern void wlc_mhf(struct wlc_info *wlc, u8 idx, u16 mask, u16 val,
544
extern u16 wlc_mhf_get(struct wlc_info *wlc, u8 idx, int bands);
545
extern u32 wlc_delta_txfunfl(struct wlc_info *wlc, int fifo);
546
extern void wlc_rate_lookup_init(struct wlc_info *wlc, wlc_rateset_t *rateset);
547
extern void wlc_default_rateset(struct wlc_info *wlc, wlc_rateset_t *rs);
549
/* wlc_phy.c helper functions */
550
extern void wlc_set_ps_ctrl(struct wlc_info *wlc);
551
extern void wlc_mctrl(struct wlc_info *wlc, u32 mask, u32 val);
552
extern void wlc_scb_ratesel_init_all(struct wlc_info *wlc);
555
extern int wlc_iovar_gets8(struct wlc_info *wlc, const char *name,
557
extern int wlc_iovar_check(struct wlc_pub *pub, const bcm_iovar_t *vi,
561
extern int wlc_module_register(struct wlc_pub *pub, const bcm_iovar_t *iovars,
562
const char *name, void *hdl, iovar_fn_t iovar_fn,
563
watchdog_fn_t watchdog_fn, down_fn_t down_fn);
564
extern int wlc_module_unregister(struct wlc_pub *pub, const char *name,
566
extern void wlc_event_if(struct wlc_info *wlc, struct wlc_bsscfg *cfg,
567
wlc_event_t *e, const struct ether_addr *addr);
568
extern void wlc_suspend_mac_and_wait(struct wlc_info *wlc);
569
extern void wlc_enable_mac(struct wlc_info *wlc);
570
extern u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate);
571
extern u32 wlc_get_rspec_history(struct wlc_bsscfg *cfg);
572
extern u32 wlc_get_current_highest_rate(struct wlc_bsscfg *cfg);
573
extern void wlc_scan_start(struct wlc_info *wlc);
574
extern void wlc_scan_stop(struct wlc_info *wlc);
576
static inline int wlc_iovar_getuint(struct wlc_info *wlc, const char *name,
579
return wlc_iovar_getint(wlc, name, (int *)arg);
582
static inline int wlc_iovar_getu8(struct wlc_info *wlc, const char *name,
585
return wlc_iovar_gets8(wlc, name, (s8 *) arg);
588
static inline int wlc_iovar_setuint(struct wlc_info *wlc, const char *name,
591
return wlc_iovar_setint(wlc, name, (int)arg);
595
extern int wlc_iocregchk(struct wlc_info *wlc, uint band);
598
extern int wlc_iocpichk(struct wlc_info *wlc, uint phytype);
601
/* helper functions */
602
extern void wlc_getrand(struct wlc_info *wlc, u8 *buf, int len);
605
extern void wlc_ps_on(struct wlc_info *wlc, struct scb *scb);
606
extern void wlc_ps_off(struct wlc_info *wlc, struct scb *scb, bool discard);
607
extern bool wlc_radio_monitor_stop(struct wlc_info *wlc);
610
extern int wlc_format_ssid(char *buf, const unsigned char ssid[], uint ssid_len);
613
extern void wlc_pmkid_build_cand_list(struct wlc_bsscfg *cfg, bool check_SSID);
614
extern void wlc_pmkid_event(struct wlc_bsscfg *cfg);
616
#define MAXBANDS 2 /* Maximum #of bands */
617
/* bandstate array indices */
618
#define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */
619
#define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */
621
#define BAND_2G_NAME "2.4G"
622
#define BAND_5G_NAME "5G"
624
/* BMAC RPC: 7 u32 params: pkttotlen, fifo, commit, fid, txpktpend, pktflag, rpc_id */
625
#define WLC_RPCTX_PARAMS 32
627
#endif /* _wlc_pub_h_ */