Commit | Line | Data |
---|---|---|
a9533e7e HP |
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_pub_h_ | |
18 | #define _wlc_pub_h_ | |
19 | ||
20 | #include <wlc_types.h> | |
21 | #include <wlc_scb.h> | |
22 | ||
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 */ | |
26 | ||
27 | /* phy types */ | |
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 */ | |
36 | ||
37 | /* bw */ | |
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 */ | |
41 | ||
42 | #define CHSPEC_WLC_BW(chanspec) (CHSPEC_IS40(chanspec) ? WLC_40_MHZ : \ | |
43 | CHSPEC_IS20(chanspec) ? WLC_20_MHZ : \ | |
44 | WLC_10_MHZ) | |
45 | ||
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 */ | |
53 | ||
54 | #define WLC_PHYTYPE(_x) (_x) /* macro to perform WLC PHY -> D11 PHY TYPE, currently 1:1 */ | |
55 | ||
56 | #define MA_WINDOW_SZ 8 /* moving average window size */ | |
57 | ||
58 | #define WLC_SNR_INVALID 0 /* invalid SNR value */ | |
59 | ||
7068c2f1 | 60 | /* a large TX Power as an init value to factor out of min() calculations, |
562c8850 | 61 | * keep low enough to fit in an s8, units are .25 dBm |
a9533e7e HP |
62 | */ |
63 | #define WLC_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */ | |
64 | ||
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 */ | |
72 | ||
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 */ | |
78 | ||
79 | #define TXCORE_POLICY_ALL 0x1 /* use all available core for transmit */ | |
80 | ||
81 | /* Tx Chain values */ | |
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 */ | |
92 | ||
93 | #define RXBUFSZ PKTBUFSZ | |
94 | #ifndef AIDMAPSZ | |
e18d5313 | 95 | #define AIDMAPSZ (roundup(MAXSCB, NBBY)/NBBY) /* aid bitmap size in bytes */ |
a9533e7e HP |
96 | #endif /* AIDMAPSZ */ |
97 | ||
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 */ | |
114 | } wlc_tunables_t; | |
115 | ||
116 | typedef struct wlc_rateset { | |
117 | uint count; /* number of rates in rates[] */ | |
41feb5ed GKH |
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 */ | |
a9533e7e HP |
121 | } wlc_rateset_t; |
122 | ||
123 | struct rsn_parms { | |
41feb5ed GKH |
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 */ | |
a9533e7e HP |
131 | }; |
132 | ||
133 | /* | |
134 | * buffer length needed for wlc_format_ssid | |
135 | * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL. | |
136 | */ | |
3726ed4d | 137 | #define SSID_FMT_BUF_LEN ((4 * IEEE80211_MAX_SSID_LEN) + 1) |
a9533e7e HP |
138 | |
139 | #define RSN_FLAGS_SUPPORTED 0x1 /* Flag for rsn_params */ | |
140 | #define RSN_FLAGS_PREAUTH 0x2 /* Flag for WPA2 rsn_params */ | |
141 | ||
142 | /* All the HT-specific default advertised capabilities (including AMPDU) | |
143 | * should be grouped here at one place | |
144 | */ | |
145 | #define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */ | |
146 | ||
147 | /* defaults for the HT (MIMO) bss */ | |
04795017 RV |
148 | #define HT_CAP ((HT_CAP_MIMO_PS_OFF << IEEE80211_HT_CAP_SM_PS_SHIFT) |\ |
149 | IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD |\ | |
150 | HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_DSSSCCK40) | |
a9533e7e | 151 | |
a9533e7e HP |
152 | /* Event data type */ |
153 | typedef struct wlc_event { | |
154 | wl_event_msg_t event; /* encapsulated event */ | |
155 | struct ether_addr *addr; /* used to keep a trace of the potential present of | |
156 | * an address in wlc_event_msg_t | |
157 | */ | |
158 | int bsscfgidx; /* BSS config when needed */ | |
159 | struct wl_if *wlif; /* pointer to wlif */ | |
160 | void *data; /* used to hang additional data on an event */ | |
161 | struct wlc_event *next; /* enables ordered list of pending events */ | |
162 | } wlc_event_t; | |
163 | ||
164 | /* wlc internal bss_info, wl external one is in wlioctl.h */ | |
165 | typedef struct wlc_bss_info { | |
a44d4236 | 166 | u8 BSSID[ETH_ALEN]; /* network BSSID */ |
7d4df48e | 167 | u16 flags; /* flags for internal attributes */ |
41feb5ed GKH |
168 | u8 SSID_len; /* the length of SSID */ |
169 | u8 SSID[32]; /* SSID string */ | |
e59fe083 GKH |
170 | s16 RSSI; /* receive signal strength (in dBm) */ |
171 | s16 SNR; /* receive signal SNR in dB */ | |
7d4df48e GKH |
172 | u16 beacon_period; /* units are Kusec */ |
173 | u16 atim_window; /* units are Kusec */ | |
a9533e7e | 174 | chanspec_t chanspec; /* Channel num, bw, ctrl_sb and band */ |
562c8850 | 175 | s8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */ |
a9533e7e | 176 | wlc_rateset_t rateset; /* supported rates */ |
41feb5ed | 177 | u8 dtim_period; /* DTIM period */ |
562c8850 | 178 | s8 phy_noise; /* noise right after tx (in dBm) */ |
7d4df48e | 179 | u16 capability; /* Capability information */ |
41feb5ed | 180 | u8 wme_qosinfo; /* QoS Info from WME IE; valid if WLC_BSS_WME flag set */ |
a9533e7e HP |
181 | struct rsn_parms wpa; |
182 | struct rsn_parms wpa2; | |
7d4df48e | 183 | u16 qbss_load_aac; /* qbss load available admission capacity */ |
a9533e7e | 184 | /* qbss_load_chan_free <- (0xff - channel_utilization of qbss_load_ie_t) */ |
41feb5ed GKH |
185 | u8 qbss_load_chan_free; /* indicates how free the channel is */ |
186 | u8 mcipher; /* multicast cipher */ | |
187 | u8 wpacfg; /* wpa config index */ | |
a9533e7e HP |
188 | } wlc_bss_info_t; |
189 | ||
190 | /* forward declarations */ | |
191 | struct wlc_if; | |
192 | ||
193 | /* wlc_ioctl error codes */ | |
194 | #define WLC_ENOIOCTL 1 /* No such Ioctl */ | |
195 | #define WLC_EINVAL 2 /* Invalid value */ | |
196 | #define WLC_ETOOSMALL 3 /* Value too small */ | |
197 | #define WLC_ETOOBIG 4 /* Value too big */ | |
198 | #define WLC_ERANGE 5 /* Out of range */ | |
199 | #define WLC_EDOWN 6 /* Down */ | |
200 | #define WLC_EUP 7 /* Up */ | |
201 | #define WLC_ENOMEM 8 /* No Memory */ | |
202 | #define WLC_EBUSY 9 /* Busy */ | |
203 | ||
204 | /* IOVar flags for common error checks */ | |
205 | #define IOVF_MFG (1<<3) /* flag for mfgtest iovars */ | |
206 | #define IOVF_WHL (1<<4) /* value must be whole (0-max) */ | |
207 | #define IOVF_NTRL (1<<5) /* value must be natural (1-max) */ | |
208 | ||
209 | #define IOVF_SET_UP (1<<6) /* set requires driver be up */ | |
210 | #define IOVF_SET_DOWN (1<<7) /* set requires driver be down */ | |
211 | #define IOVF_SET_CLK (1<<8) /* set requires core clock */ | |
212 | #define IOVF_SET_BAND (1<<9) /* set requires fixed band */ | |
213 | ||
214 | #define IOVF_GET_UP (1<<10) /* get requires driver be up */ | |
215 | #define IOVF_GET_DOWN (1<<11) /* get requires driver be down */ | |
216 | #define IOVF_GET_CLK (1<<12) /* get requires core clock */ | |
217 | #define IOVF_GET_BAND (1<<13) /* get requires fixed band */ | |
218 | #define IOVF_OPEN_ALLOW (1<<14) /* set allowed iovar for opensrc */ | |
219 | ||
220 | /* watchdog down and dump callback function proto's */ | |
221 | typedef int (*watchdog_fn_t) (void *handle); | |
222 | typedef int (*down_fn_t) (void *handle); | |
7cc4a4c0 | 223 | typedef int (*dump_fn_t) (void *handle, struct bcmstrbuf *b); |
a9533e7e HP |
224 | |
225 | /* IOVar handler | |
226 | * | |
227 | * handle - a pointer value registered with the function | |
228 | * vi - iovar_info that was looked up | |
229 | * actionid - action ID, calculated by IOV_GVAL() and IOV_SVAL() based on varid. | |
230 | * name - the actual iovar name | |
231 | * params/plen - parameters and length for a get, input only. | |
232 | * arg/len - buffer and length for value to be set or retrieved, input or output. | |
233 | * vsize - value size, valid for integer type only. | |
234 | * wlcif - interface context (wlc_if pointer) | |
235 | * | |
236 | * All pointers may point into the same buffer. | |
237 | */ | |
7cc4a4c0 | 238 | typedef int (*iovar_fn_t) (void *handle, const bcm_iovar_t *vi, |
66cbd3ab | 239 | u32 actionid, const char *name, void *params, |
a9533e7e | 240 | uint plen, void *arg, int alen, int vsize, |
7cc4a4c0 | 241 | struct wlc_if *wlcif); |
a9533e7e HP |
242 | |
243 | #define MAC80211_PROMISC_BCNS (1 << 0) | |
244 | #define MAC80211_SCAN (1 << 1) | |
245 | ||
246 | /* | |
247 | * Public portion of "common" os-independent state structure. | |
248 | * The wlc handle points at this. | |
249 | */ | |
08db27dc | 250 | struct wlc_pub { |
a9533e7e HP |
251 | void *wlc; |
252 | ||
253 | struct ieee80211_hw *ieee_hw; | |
254 | struct scb *global_scb; | |
255 | scb_ampdu_t *global_ampdu; | |
256 | uint mac80211_state; | |
257 | uint unit; /* device instance number */ | |
258 | uint corerev; /* core revision */ | |
e69284f2 | 259 | struct osl_info *osh; /* pointer to os handle */ |
a9533e7e HP |
260 | si_t *sih; /* SB handle (cookie for siutils calls) */ |
261 | char *vars; /* "environment" name=value */ | |
262 | bool up; /* interface up and running */ | |
263 | bool hw_off; /* HW is off */ | |
264 | wlc_tunables_t *tunables; /* tunables: ntxd, nrxd, maxscb, etc. */ | |
265 | bool hw_up; /* one time hw up/down(from boot or hibernation) */ | |
266 | bool _piomode; /* true if pio mode *//* BMAC_NOTE: NEED In both */ | |
267 | uint _nbands; /* # bands supported */ | |
268 | uint now; /* # elapsed seconds */ | |
269 | ||
270 | bool promisc; /* promiscuous destination address */ | |
271 | bool delayed_down; /* down delayed */ | |
272 | bool _ap; /* AP mode enabled */ | |
273 | bool _apsta; /* simultaneous AP/STA mode enabled */ | |
274 | bool _assoc_recreate; /* association recreation on up transitions */ | |
275 | int _wme; /* WME QoS mode */ | |
41feb5ed | 276 | u8 _mbss; /* MBSS mode on */ |
a9533e7e HP |
277 | bool allmulti; /* enable all multicasts */ |
278 | bool associated; /* true:part of [I]BSS, false: not */ | |
279 | /* (union of stas_associated, aps_associated) */ | |
280 | bool phytest_on; /* whether a PHY test is running */ | |
281 | bool bf_preempt_4306; /* True to enable 'darwin' mode */ | |
282 | bool _ampdu; /* ampdu enabled or not */ | |
283 | bool _cac; /* 802.11e CAC enabled */ | |
41feb5ed | 284 | u8 _n_enab; /* bitmap of 11N + HT support */ |
a9533e7e HP |
285 | bool _n_reqd; /* N support required for clients */ |
286 | ||
562c8850 | 287 | s8 _coex; /* 20/40 MHz BSS Management AUTO, ENAB, DISABLE */ |
a9533e7e HP |
288 | bool _priofc; /* Priority-based flowcontrol */ |
289 | ||
a44d4236 | 290 | u8 cur_etheraddr[ETH_ALEN]; /* our local ethernet address */ |
a9533e7e | 291 | |
a44d4236 | 292 | u8 *multicast; /* ptr to list of multicast addresses */ |
a9533e7e HP |
293 | uint nmulticast; /* # enabled multicast addresses */ |
294 | ||
66cbd3ab | 295 | u32 wlfeatureflag; /* Flags to control sw features from registry */ |
a9533e7e HP |
296 | int psq_pkts_total; /* total num of ps pkts */ |
297 | ||
7d4df48e | 298 | u16 txmaxpkts; /* max number of large pkts allowed to be pending */ |
a9533e7e HP |
299 | |
300 | /* s/w decryption counters */ | |
66cbd3ab | 301 | u32 swdecrypt; /* s/w decrypt attempts */ |
a9533e7e HP |
302 | |
303 | int bcmerror; /* last bcm error */ | |
304 | ||
305 | mbool radio_disabled; /* bit vector for radio disabled reasons */ | |
306 | bool radio_active; /* radio on/off state */ | |
7d4df48e | 307 | u16 roam_time_thresh; /* Max. # secs. of not hearing beacons |
a9533e7e HP |
308 | * before roaming. |
309 | */ | |
310 | bool align_wd_tbtt; /* Align watchdog with tbtt indication | |
311 | * handling. This flag is cleared by default | |
312 | * and is set by per port code explicitly and | |
313 | * you need to make sure the OSL_SYSUPTIME() | |
314 | * is implemented properly in osl of that port | |
315 | * when it enables this Power Save feature. | |
316 | */ | |
a9533e7e | 317 | |
7d4df48e | 318 | u16 boardrev; /* version # of particular board */ |
41feb5ed | 319 | u8 sromrev; /* version # of the srom */ |
a9533e7e | 320 | char srom_ccode[WLC_CNTRY_BUF_SZ]; /* Country Code in SROM */ |
66cbd3ab GKH |
321 | u32 boardflags; /* Board specific flags from srom */ |
322 | u32 boardflags2; /* More board flags if sromrev >= 4 */ | |
a9533e7e HP |
323 | bool tempsense_disable; /* disable periodic tempsense check */ |
324 | ||
325 | bool _lmac; /* lmac module included and enabled */ | |
326 | bool _lmacproto; /* lmac protocol module included and enabled */ | |
327 | bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */ | |
328 | bool _ampdumac; /* mac assist ampdu enabled or not */ | |
08db27dc | 329 | }; |
a9533e7e HP |
330 | |
331 | /* wl_monitor rx status per packet */ | |
332 | typedef struct wl_rxsts { | |
333 | uint pkterror; /* error flags per pkt */ | |
334 | uint phytype; /* 802.11 A/B/G ... */ | |
335 | uint channel; /* channel */ | |
336 | uint datarate; /* rate in 500kbps */ | |
337 | uint antenna; /* antenna pkts received on */ | |
338 | uint pktlength; /* pkt length minus bcm phy hdr */ | |
66cbd3ab | 339 | u32 mactime; /* time stamp from mac, count per 1us */ |
a9533e7e | 340 | uint sq; /* signal quality */ |
3e26416e GKH |
341 | s32 signal; /* in dbm */ |
342 | s32 noise; /* in dbm */ | |
a9533e7e HP |
343 | uint preamble; /* Unknown, short, long */ |
344 | uint encoding; /* Unknown, CCK, PBCC, OFDM */ | |
345 | uint nfrmtype; /* special 802.11n frames(AMPDU, AMSDU) */ | |
346 | struct wl_if *wlif; /* wl interface */ | |
347 | } wl_rxsts_t; | |
348 | ||
349 | /* status per error RX pkt */ | |
350 | #define WL_RXS_CRC_ERROR 0x00000001 /* CRC Error in packet */ | |
351 | #define WL_RXS_RUNT_ERROR 0x00000002 /* Runt packet */ | |
352 | #define WL_RXS_ALIGN_ERROR 0x00000004 /* Misaligned packet */ | |
353 | #define WL_RXS_OVERSIZE_ERROR 0x00000008 /* packet bigger than RX_LENGTH (usually 1518) */ | |
354 | #define WL_RXS_WEP_ICV_ERROR 0x00000010 /* Integrity Check Value error */ | |
355 | #define WL_RXS_WEP_ENCRYPTED 0x00000020 /* Encrypted with WEP */ | |
356 | #define WL_RXS_PLCP_SHORT 0x00000040 /* Short PLCP error */ | |
357 | #define WL_RXS_DECRYPT_ERR 0x00000080 /* Decryption error */ | |
358 | #define WL_RXS_OTHER_ERR 0x80000000 /* Other errors */ | |
359 | ||
360 | /* phy type */ | |
361 | #define WL_RXS_PHY_A 0x00000000 /* A phy type */ | |
362 | #define WL_RXS_PHY_B 0x00000001 /* B phy type */ | |
363 | #define WL_RXS_PHY_G 0x00000002 /* G phy type */ | |
364 | #define WL_RXS_PHY_N 0x00000004 /* N phy type */ | |
365 | ||
366 | /* encoding */ | |
367 | #define WL_RXS_ENCODING_CCK 0x00000000 /* CCK encoding */ | |
368 | #define WL_RXS_ENCODING_OFDM 0x00000001 /* OFDM encoding */ | |
369 | ||
370 | /* preamble */ | |
371 | #define WL_RXS_UNUSED_STUB 0x0 /* stub to match with wlc_ethereal.h */ | |
372 | #define WL_RXS_PREAMBLE_SHORT 0x00000001 /* Short preamble */ | |
373 | #define WL_RXS_PREAMBLE_LONG 0x00000002 /* Long preamble */ | |
374 | #define WL_RXS_PREAMBLE_MIMO_MM 0x00000003 /* MIMO mixed mode preamble */ | |
375 | #define WL_RXS_PREAMBLE_MIMO_GF 0x00000004 /* MIMO green field preamble */ | |
376 | ||
377 | #define WL_RXS_NFRM_AMPDU_FIRST 0x00000001 /* first MPDU in A-MPDU */ | |
378 | #define WL_RXS_NFRM_AMPDU_SUB 0x00000002 /* subsequent MPDU(s) in A-MPDU */ | |
379 | #define WL_RXS_NFRM_AMSDU_FIRST 0x00000004 /* first MSDU in A-MSDU */ | |
380 | #define WL_RXS_NFRM_AMSDU_SUB 0x00000008 /* subsequent MSDU(s) in A-MSDU */ | |
381 | ||
382 | /* forward declare and use the struct notation so we don't have to | |
383 | * have it defined if not necessary. | |
384 | */ | |
385 | struct wlc_info; | |
386 | struct wlc_hw_info; | |
387 | struct wlc_bsscfg; | |
388 | struct wlc_if; | |
389 | ||
a9533e7e HP |
390 | /*********************************************** |
391 | * Feature-related macros to optimize out code * | |
392 | * ********************************************* | |
393 | */ | |
394 | ||
395 | /* AP Support (versus STA) */ | |
396 | #define AP_ENAB(pub) (0) | |
397 | ||
398 | /* Macro to check if APSTA mode enabled */ | |
399 | #define APSTA_ENAB(pub) (0) | |
400 | ||
401 | /* Some useful combinations */ | |
402 | #define STA_ONLY(pub) (!AP_ENAB(pub)) | |
403 | #define AP_ONLY(pub) (AP_ENAB(pub) && !APSTA_ENAB(pub)) | |
404 | ||
405 | #define ENAB_1x1 0x01 | |
406 | #define ENAB_2x2 0x02 | |
407 | #define ENAB_3x3 0x04 | |
408 | #define ENAB_4x4 0x08 | |
409 | #define SUPPORT_11N (ENAB_1x1|ENAB_2x2) | |
410 | #define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3) | |
411 | /* WL11N Support */ | |
412 | #if ((defined(NCONF) && (NCONF != 0)) || (defined(LCNCONF) && (LCNCONF != 0)) || \ | |
413 | (defined(HTCONF) && (HTCONF != 0)) || (defined(SSLPNCONF) && (SSLPNCONF != 0))) | |
414 | #define N_ENAB(pub) ((pub)->_n_enab & SUPPORT_11N) | |
415 | #define N_REQD(pub) ((pub)->_n_reqd) | |
416 | #else | |
417 | #define N_ENAB(pub) 0 | |
418 | #define N_REQD(pub) 0 | |
419 | #endif | |
420 | ||
421 | #if (defined(HTCONF) && (HTCONF != 0)) | |
422 | #define HT_ENAB(pub) (((pub)->_n_enab & SUPPORT_HT) == SUPPORT_HT) | |
423 | #else | |
424 | #define HT_ENAB(pub) 0 | |
425 | #endif | |
426 | ||
427 | #define AMPDU_AGG_HOST 1 | |
428 | #define AMPDU_ENAB(pub) ((pub)->_ampdu) | |
429 | ||
430 | #define EDCF_ENAB(pub) (WME_ENAB(pub)) | |
431 | #define QOS_ENAB(pub) (WME_ENAB(pub) || N_ENAB(pub)) | |
432 | ||
53b6b34d | 433 | #define MONITOR_ENAB(wlc) ((wlc)->monitor) |
a9533e7e | 434 | |
53b6b34d | 435 | #define PROMISC_ENAB(wlc) ((wlc)->promisc) |
a9533e7e | 436 | |
a9533e7e HP |
437 | #define WLC_PREC_COUNT 16 /* Max precedence level implemented */ |
438 | ||
54991ad6 | 439 | /* pri is priority encoded in the packet. This maps the Packet priority to |
a9533e7e HP |
440 | * enqueue precedence as defined in wlc_prec_map |
441 | */ | |
41feb5ed | 442 | extern const u8 wlc_prio2prec_map[]; |
a9533e7e HP |
443 | #define WLC_PRIO_TO_PREC(pri) wlc_prio2prec_map[(pri) & 7] |
444 | ||
445 | /* This maps priority to one precedence higher - Used by PS-Poll response packets to | |
446 | * simulate enqueue-at-head operation, but still maintain the order on the queue | |
447 | */ | |
7068c2f1 | 448 | #define WLC_PRIO_TO_HI_PREC(pri) min(WLC_PRIO_TO_PREC(pri) + 1, WLC_PREC_COUNT - 1) |
a9533e7e | 449 | |
41feb5ed | 450 | extern const u8 wme_fifo2ac[]; |
a9533e7e HP |
451 | #define WME_PRIO2AC(prio) wme_fifo2ac[prio2fifo[(prio)]] |
452 | ||
453 | /* Mask to describe all precedence levels */ | |
454 | #define WLC_PREC_BMP_ALL MAXBITVAL(WLC_PREC_COUNT) | |
455 | ||
456 | /* Define a bitmap of precedences comprised by each AC */ | |
457 | #define WLC_PREC_BMP_AC_BE (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_BE)) | \ | |
458 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_BE)) | \ | |
459 | NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_EE)) | \ | |
460 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_EE))) | |
461 | #define WLC_PREC_BMP_AC_BK (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_BK)) | \ | |
462 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_BK)) | \ | |
463 | NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_NONE)) | \ | |
464 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_NONE))) | |
465 | #define WLC_PREC_BMP_AC_VI (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_CL)) | \ | |
466 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_CL)) | \ | |
467 | NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_VI)) | \ | |
468 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_VI))) | |
469 | #define WLC_PREC_BMP_AC_VO (NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_VO)) | \ | |
470 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_VO)) | \ | |
471 | NBITVAL(WLC_PRIO_TO_PREC(PRIO_8021D_NC)) | \ | |
472 | NBITVAL(WLC_PRIO_TO_HI_PREC(PRIO_8021D_NC))) | |
473 | ||
474 | /* WME Support */ | |
475 | #define WME_ENAB(pub) ((pub)->_wme != OFF) | |
476 | #define WME_AUTO(wlc) ((wlc)->pub->_wme == AUTO) | |
477 | ||
478 | #define WLC_USE_COREFLAGS 0xffffffff /* invalid core flags, use the saved coreflags */ | |
479 | ||
480 | #define WLC_UPDATE_STATS(wlc) 0 /* No stats support */ | |
481 | #define WLCNTINCR(a) /* No stats support */ | |
482 | #define WLCNTDECR(a) /* No stats support */ | |
914d69d6 JC |
483 | #define WLCNTADD(a, delta) /* No stats support */ |
484 | #define WLCNTSET(a, value) /* No stats support */ | |
a9533e7e HP |
485 | #define WLCNTVAL(a) 0 /* No stats support */ |
486 | ||
487 | /* common functions for every port */ | |
7d4df48e | 488 | extern void *wlc_attach(void *wl, u16 vendor, u16 device, uint unit, |
e69284f2 BR |
489 | bool piomode, struct osl_info *osh, void *regsva, |
490 | uint bustype, void *btparam, uint *perr); | |
a9533e7e HP |
491 | extern uint wlc_detach(struct wlc_info *wlc); |
492 | extern int wlc_up(struct wlc_info *wlc); | |
493 | extern uint wlc_down(struct wlc_info *wlc); | |
494 | ||
495 | extern int wlc_set(struct wlc_info *wlc, int cmd, int arg); | |
496 | extern int wlc_get(struct wlc_info *wlc, int cmd, int *arg); | |
497 | extern int wlc_iovar_getint(struct wlc_info *wlc, const char *name, int *arg); | |
498 | extern int wlc_iovar_setint(struct wlc_info *wlc, const char *name, int arg); | |
7d4df48e | 499 | extern bool wlc_chipmatch(u16 vendor, u16 device); |
a9533e7e HP |
500 | extern void wlc_init(struct wlc_info *wlc); |
501 | extern void wlc_reset(struct wlc_info *wlc); | |
502 | ||
503 | extern void wlc_intrson(struct wlc_info *wlc); | |
66cbd3ab GKH |
504 | extern u32 wlc_intrsoff(struct wlc_info *wlc); |
505 | extern void wlc_intrsrestore(struct wlc_info *wlc, u32 macintmask); | |
a9533e7e | 506 | extern bool wlc_intrsupd(struct wlc_info *wlc); |
7cc4a4c0 | 507 | extern bool wlc_isr(struct wlc_info *wlc, bool *wantdpc); |
a9533e7e | 508 | extern bool wlc_dpc(struct wlc_info *wlc, bool bounded); |
4dc79de1 RV |
509 | extern bool wlc_send80211_raw(struct wlc_info *wlc, struct wlc_if *wlcif, |
510 | void *p, uint ac); | |
c6a9e1fc | 511 | extern bool wlc_sendpkt_mac80211(struct wlc_info *wlc, struct sk_buff *sdu, |
c26b1378 | 512 | struct ieee80211_hw *hw); |
a9533e7e HP |
513 | extern int wlc_iovar_op(struct wlc_info *wlc, const char *name, void *params, |
514 | int p_len, void *arg, int len, bool set, | |
515 | struct wlc_if *wlcif); | |
516 | extern int wlc_ioctl(struct wlc_info *wlc, int cmd, void *arg, int len, | |
517 | struct wlc_if *wlcif); | |
518 | /* helper functions */ | |
519 | extern void wlc_statsupd(struct wlc_info *wlc); | |
520 | extern int wlc_get_header_len(void); | |
c6a9e1fc RV |
521 | extern void wlc_mac_bcn_promisc_change(struct wlc_info *wlc, bool promisc); |
522 | extern void wlc_set_addrmatch(struct wlc_info *wlc, int match_reg_offset, | |
a44d4236 | 523 | const u8 *addr); |
c6a9e1fc | 524 | extern void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void *arg, |
c26b1378 | 525 | bool suspend); |
a9533e7e | 526 | |
08db27dc | 527 | extern struct wlc_pub *wlc_pub(void *wlc); |
a9533e7e HP |
528 | |
529 | /* common functions for every port */ | |
530 | extern int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw); | |
531 | extern int wlc_bmac_up_finish(struct wlc_hw_info *wlc_hw); | |
532 | extern int wlc_bmac_down_prep(struct wlc_hw_info *wlc_hw); | |
533 | extern int wlc_bmac_down_finish(struct wlc_hw_info *wlc_hw); | |
534 | ||
66cbd3ab GKH |
535 | extern u32 wlc_reg_read(struct wlc_info *wlc, void *r, uint size); |
536 | extern void wlc_reg_write(struct wlc_info *wlc, void *r, u32 v, uint size); | |
537 | extern void wlc_corereset(struct wlc_info *wlc, u32 flags); | |
7d4df48e | 538 | extern void wlc_mhf(struct wlc_info *wlc, u8 idx, u16 mask, u16 val, |
a9533e7e | 539 | int bands); |
7d4df48e | 540 | extern u16 wlc_mhf_get(struct wlc_info *wlc, u8 idx, int bands); |
66cbd3ab | 541 | extern u32 wlc_delta_txfunfl(struct wlc_info *wlc, int fifo); |
7cc4a4c0 JC |
542 | extern void wlc_rate_lookup_init(struct wlc_info *wlc, wlc_rateset_t *rateset); |
543 | extern void wlc_default_rateset(struct wlc_info *wlc, wlc_rateset_t *rs); | |
a9533e7e HP |
544 | |
545 | /* wlc_phy.c helper functions */ | |
a9533e7e | 546 | extern void wlc_set_ps_ctrl(struct wlc_info *wlc); |
66cbd3ab | 547 | extern void wlc_mctrl(struct wlc_info *wlc, u32 mask, u32 val); |
a9533e7e HP |
548 | extern void wlc_scb_ratesel_init_all(struct wlc_info *wlc); |
549 | ||
550 | /* ioctl */ | |
562c8850 GKH |
551 | extern int wlc_iovar_gets8(struct wlc_info *wlc, const char *name, |
552 | s8 *arg); | |
08db27dc RV |
553 | extern int wlc_iovar_check(struct wlc_pub *pub, const bcm_iovar_t *vi, |
554 | void *arg, | |
a9533e7e HP |
555 | int len, bool set); |
556 | ||
08db27dc | 557 | extern int wlc_module_register(struct wlc_pub *pub, const bcm_iovar_t *iovars, |
a9533e7e HP |
558 | const char *name, void *hdl, iovar_fn_t iovar_fn, |
559 | watchdog_fn_t watchdog_fn, down_fn_t down_fn); | |
08db27dc RV |
560 | extern int wlc_module_unregister(struct wlc_pub *pub, const char *name, |
561 | void *hdl); | |
a9533e7e | 562 | extern void wlc_event_if(struct wlc_info *wlc, struct wlc_bsscfg *cfg, |
7cc4a4c0 | 563 | wlc_event_t *e, const struct ether_addr *addr); |
a9533e7e HP |
564 | extern void wlc_suspend_mac_and_wait(struct wlc_info *wlc); |
565 | extern void wlc_enable_mac(struct wlc_info *wlc); | |
7d4df48e | 566 | extern u16 wlc_rate_shm_offset(struct wlc_info *wlc, u8 rate); |
66cbd3ab GKH |
567 | extern u32 wlc_get_rspec_history(struct wlc_bsscfg *cfg); |
568 | extern u32 wlc_get_current_highest_rate(struct wlc_bsscfg *cfg); | |
6a3be6e6 RV |
569 | extern void wlc_scan_start(struct wlc_info *wlc); |
570 | extern void wlc_scan_stop(struct wlc_info *wlc); | |
a9533e7e | 571 | |
2d956e22 | 572 | static inline int wlc_iovar_getuint(struct wlc_info *wlc, const char *name, |
7cc4a4c0 | 573 | uint *arg) |
a9533e7e HP |
574 | { |
575 | return wlc_iovar_getint(wlc, name, (int *)arg); | |
576 | } | |
577 | ||
41feb5ed GKH |
578 | static inline int wlc_iovar_getu8(struct wlc_info *wlc, const char *name, |
579 | u8 *arg) | |
a9533e7e | 580 | { |
562c8850 | 581 | return wlc_iovar_gets8(wlc, name, (s8 *) arg); |
a9533e7e HP |
582 | } |
583 | ||
2d956e22 | 584 | static inline int wlc_iovar_setuint(struct wlc_info *wlc, const char *name, |
a9533e7e HP |
585 | uint arg) |
586 | { | |
587 | return wlc_iovar_setint(wlc, name, (int)arg); | |
588 | } | |
589 | ||
590 | #if defined(BCMDBG) | |
591 | extern int wlc_iocregchk(struct wlc_info *wlc, uint band); | |
592 | #endif | |
593 | #if defined(BCMDBG) | |
594 | extern int wlc_iocpichk(struct wlc_info *wlc, uint phytype); | |
595 | #endif | |
596 | ||
597 | /* helper functions */ | |
41feb5ed | 598 | extern void wlc_getrand(struct wlc_info *wlc, u8 *buf, int len); |
a9533e7e HP |
599 | |
600 | struct scb; | |
601 | extern void wlc_ps_on(struct wlc_info *wlc, struct scb *scb); | |
602 | extern void wlc_ps_off(struct wlc_info *wlc, struct scb *scb, bool discard); | |
5abb04a6 | 603 | extern bool wlc_check_radio_disabled(struct wlc_info *wlc); |
a9533e7e HP |
604 | extern bool wlc_radio_monitor_stop(struct wlc_info *wlc); |
605 | ||
606 | #if defined(BCMDBG) | |
580a0bd9 | 607 | extern int wlc_format_ssid(char *buf, const unsigned char ssid[], uint ssid_len); |
a9533e7e HP |
608 | #endif |
609 | ||
610 | extern void wlc_pmkid_build_cand_list(struct wlc_bsscfg *cfg, bool check_SSID); | |
611 | extern void wlc_pmkid_event(struct wlc_bsscfg *cfg); | |
612 | ||
613 | #define MAXBANDS 2 /* Maximum #of bands */ | |
614 | /* bandstate array indices */ | |
615 | #define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */ | |
616 | #define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */ | |
617 | ||
618 | #define BAND_2G_NAME "2.4G" | |
619 | #define BAND_5G_NAME "5G" | |
620 | ||
66cbd3ab | 621 | /* BMAC RPC: 7 u32 params: pkttotlen, fifo, commit, fid, txpktpend, pktflag, rpc_id */ |
a9533e7e HP |
622 | #define WLC_RPCTX_PARAMS 32 |
623 | ||
624 | #endif /* _wlc_pub_h_ */ |