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 #define NBANDS(wlc) ((wlc)->pub->_nbands)
21 #define NBANDS_PUB(pub) ((pub)->_nbands)
22 #define NBANDS_HW(hw) ((hw)->_nbands)
24 #define IS_SINGLEBAND_5G(device) 0
26 /* Keep WLC_HIGH_ONLY, WLC_SPLIT for USB extension later on */
34 /* **** Core type/rev defaults **** */
35 #define D11_DEFAULT 0x0fffffb0 /* Supported D11 revs: 4, 5, 7-27
36 * also need to update wlc.h MAXCOREREV
39 #define NPHY_DEFAULT 0x000001ff /* Supported nphy revs:
51 #define LCNPHY_DEFAULT 0x00000007 /* Supported lcnphy revs:
52 * 0 4313a0, 4336a0, 4330a0
57 #define SSLPNPHY_DEFAULT 0x0000000f /* Supported sslpnphy revs:
65 #define D11CONF 0x100000
75 #define WLC_DATAHIWAT 32
78 #define AMPDU_NUM_MPDU 8
81 /* For undefined values, use defaults */
83 #define D11CONF D11_DEFAULT
86 #define NCONF NPHY_DEFAULT
89 #define LCNCONF LCNPHY_DEFAULT
93 #define SSLPNCONF SSLPNPHY_DEFAULT
100 /********************************************************************
101 * Phy/Core Configuration. Defines macros to to check core phy/rev *
102 * compile-time configuration. Defines default core support. *
103 * ******************************************************************
106 /* Basic macros to check a configuration bitmask */
108 #define CONF_HAS(config, val) ((config) & (1 << (val)))
109 #define CONF_MSK(config, mask) ((config) & (mask))
110 #define MSK_RANGE(low, hi) ((1 << ((hi)+1)) - (1 << (low)))
111 #define CONF_RANGE(config, low, hi) (CONF_MSK(config, MSK_RANGE(low, high)))
113 #define CONF_IS(config, val) ((config) == (1 << (val)))
114 #define CONF_GE(config, val) ((config) & (0-(1 << (val))))
115 #define CONF_GT(config, val) ((config) & (0-2*(1 << (val))))
116 #define CONF_LT(config, val) ((config) & ((1 << (val))-1))
117 #define CONF_LE(config, val) ((config) & (2*(1 << (val))-1))
119 /* Wrappers for some of the above, specific to config constants */
121 #define NCONF_HAS(val) CONF_HAS(NCONF, val)
122 #define NCONF_MSK(mask) CONF_MSK(NCONF, mask)
123 #define NCONF_IS(val) CONF_IS(NCONF, val)
124 #define NCONF_GE(val) CONF_GE(NCONF, val)
125 #define NCONF_GT(val) CONF_GT(NCONF, val)
126 #define NCONF_LT(val) CONF_LT(NCONF, val)
127 #define NCONF_LE(val) CONF_LE(NCONF, val)
129 #define LCNCONF_HAS(val) CONF_HAS(LCNCONF, val)
130 #define LCNCONF_MSK(mask) CONF_MSK(LCNCONF, mask)
131 #define LCNCONF_IS(val) CONF_IS(LCNCONF, val)
132 #define LCNCONF_GE(val) CONF_GE(LCNCONF, val)
133 #define LCNCONF_GT(val) CONF_GT(LCNCONF, val)
134 #define LCNCONF_LT(val) CONF_LT(LCNCONF, val)
135 #define LCNCONF_LE(val) CONF_LE(LCNCONF, val)
137 #define D11CONF_HAS(val) CONF_HAS(D11CONF, val)
138 #define D11CONF_MSK(mask) CONF_MSK(D11CONF, mask)
139 #define D11CONF_IS(val) CONF_IS(D11CONF, val)
140 #define D11CONF_GE(val) CONF_GE(D11CONF, val)
141 #define D11CONF_GT(val) CONF_GT(D11CONF, val)
142 #define D11CONF_LT(val) CONF_LT(D11CONF, val)
143 #define D11CONF_LE(val) CONF_LE(D11CONF, val)
145 #define PHYCONF_HAS(val) CONF_HAS(PHYTYPE, val)
146 #define PHYCONF_IS(val) CONF_IS(PHYTYPE, val)
148 #define NREV_IS(var, val) (NCONF_HAS(val) && (NCONF_IS(val) || ((var) == (val))))
149 #define NREV_GE(var, val) (NCONF_GE(val) && (!NCONF_LT(val) || ((var) >= (val))))
150 #define NREV_GT(var, val) (NCONF_GT(val) && (!NCONF_LE(val) || ((var) > (val))))
151 #define NREV_LT(var, val) (NCONF_LT(val) && (!NCONF_GE(val) || ((var) < (val))))
152 #define NREV_LE(var, val) (NCONF_LE(val) && (!NCONF_GT(val) || ((var) <= (val))))
154 #define LCNREV_IS(var, val) (LCNCONF_HAS(val) && (LCNCONF_IS(val) || ((var) == (val))))
155 #define LCNREV_GE(var, val) (LCNCONF_GE(val) && (!LCNCONF_LT(val) || ((var) >= (val))))
156 #define LCNREV_GT(var, val) (LCNCONF_GT(val) && (!LCNCONF_LE(val) || ((var) > (val))))
157 #define LCNREV_LT(var, val) (LCNCONF_LT(val) && (!LCNCONF_GE(val) || ((var) < (val))))
158 #define LCNREV_LE(var, val) (LCNCONF_LE(val) && (!LCNCONF_GT(val) || ((var) <= (val))))
160 #define D11REV_IS(var, val) (D11CONF_HAS(val) && (D11CONF_IS(val) || ((var) == (val))))
161 #define D11REV_GE(var, val) (D11CONF_GE(val) && (!D11CONF_LT(val) || ((var) >= (val))))
162 #define D11REV_GT(var, val) (D11CONF_GT(val) && (!D11CONF_LE(val) || ((var) > (val))))
163 #define D11REV_LT(var, val) (D11CONF_LT(val) && (!D11CONF_GE(val) || ((var) < (val))))
164 #define D11REV_LE(var, val) (D11CONF_LE(val) && (!D11CONF_GT(val) || ((var) <= (val))))
166 #define PHYTYPE_IS(var, val) (PHYCONF_HAS(val) && (PHYCONF_IS(val) || ((var) == (val))))
168 /* Finally, early-exit from switch case if anyone wants it... */
170 #define CASECHECK(config, val) if (!(CONF_HAS(config, val))) break
171 #define CASEMSK(config, mask) if (!(CONF_MSK(config, mask))) break
173 #if (D11CONF ^ (D11CONF & D11_DEFAULT))
174 #error "Unsupported MAC revision configured"
176 #if (NCONF ^ (NCONF & NPHY_DEFAULT))
177 #error "Unsupported NPHY revision configured"
179 #if (LCNCONF ^ (LCNCONF & LCNPHY_DEFAULT))
180 #error "Unsupported LPPHY revision configured"
183 /* *** Consistency checks *** */
185 #error "No MAC revisions configured!"
188 #if !NCONF && !LCNCONF && !SSLPNCONF
189 #error "No PHY configured!"
192 /* Set up PHYTYPE automatically: (depends on PHY_TYPE_X, from d11.h) */
194 #define _PHYCONF_N (1 << PHY_TYPE_N)
197 #define _PHYCONF_LCN (1 << PHY_TYPE_LCN)
199 #define _PHYCONF_LCN 0
203 #define _PHYCONF_SSLPN (1 << PHY_TYPE_SSN)
205 #define _PHYCONF_SSLPN 0
206 #endif /* SSLPNCONF */
208 #define PHYTYPE (_PHYCONF_N | _PHYCONF_LCN | _PHYCONF_SSLPN)
210 /* Utility macro to identify 802.11n (HT) capable PHYs */
211 #define PHYTYPE_11N_CAP(phytype) \
212 (PHYTYPE_IS(phytype, PHY_TYPE_N) || \
213 PHYTYPE_IS(phytype, PHY_TYPE_LCN) || \
214 PHYTYPE_IS(phytype, PHY_TYPE_SSN))
216 /* Last but not least: shorter wlc-specific var checks */
217 #define WLCISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N)
218 #define WLCISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN)
219 #define WLCISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN)
221 #define WLC_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype)
223 /**********************************************************************
224 * ------------- End of Core phy/rev configuration. ----------------- *
225 * ********************************************************************
228 /*************************************************
229 * Defaults for tunables (e.g. sizing constants)
231 * For each new tunable, add a member to the end
232 * of wlc_tunables_t in wlc_pub.h to enable
233 * runtime checks of tunable values. (Directly
234 * using the macros in code invalidates ROM code)
236 * ***********************************************
239 #define NTXD 256 /* Max # of entries in Tx FIFO based on 4kb page size */
242 #define NRXD 256 /* Max # of entries in Rx FIFO based on 4kb page size */
246 #define NRXBUFPOST 32 /* try to keep this # rbufs posted to the chip */
247 #endif /* NRXBUFPOST */
249 #ifndef MAXSCB /* station control blocks in cache */
250 #define MAXSCB 32 /* Maximum SCBs in cache for STA */
253 #ifndef AMPDU_NUM_MPDU
254 #define AMPDU_NUM_MPDU 16 /* max allowed number of mpdus in an ampdu (2 streams) */
255 #endif /* AMPDU_NUM_MPDU */
257 #ifndef AMPDU_NUM_MPDU_3STREAMS
258 #define AMPDU_NUM_MPDU_3STREAMS 32 /* max allowed number of mpdus in an ampdu for 3+ streams */
259 #endif /* AMPDU_NUM_MPDU_3STREAMS */
261 /* Count of packet callback structures. either of following
262 * 1. Set to the number of SCBs since a STA
263 * can queue up a rate callback for each IBSS STA it knows about, and an AP can
264 * queue up an "are you there?" Null Data callback for each associated STA
265 * 2. controlled by tunable config file
268 #define MAXPKTCB MAXSCB /* Max number of packet callbacks */
269 #endif /* MAXPKTCB */
272 #define CTFPOOLSZ 128
273 #endif /* CTFPOOLSZ */
275 /* NetBSD also needs to keep track of this */
276 #define WLC_MAX_UCODE_BSS (16) /* Number of BSS handled in ucode bcn/prb */
277 #define WLC_MAX_UCODE_BSS4 (4) /* Number of BSS handled in sw bcn/prb */
278 #ifndef WLC_MAXBSSCFG
279 #define WLC_MAXBSSCFG (1) /* max # BSS configs */
280 #endif /* WLC_MAXBSSCFG */
283 #define MAXBSS 64 /* max # available networks */
286 #ifndef WLC_DATAHIWAT
287 #define WLC_DATAHIWAT 50 /* data msg txq hiwat mark */
288 #endif /* WLC_DATAHIWAT */
290 #ifndef WLC_AMPDUDATAHIWAT
291 #define WLC_AMPDUDATAHIWAT 255
292 #endif /* WLC_AMPDUDATAHIWAT */
294 /* bounded rx loops */
296 #define RXBND 8 /* max # frames to process in wlc_recv() */
299 #define TXSBND 8 /* max # tx status to process in wlc_txstatus() */
302 #define BAND_5G(bt) ((bt) == WLC_BAND_5G)
303 #define BAND_2G(bt) ((bt) == WLC_BAND_2G)
305 #define WLBANDINITDATA(_data) _data
306 #define WLBANDINITFN(_fn) _fn
308 #define WLANTSEL_ENAB(wlc) 1
310 #endif /* _wlc_cfg_h_ */