/* Starting corerev for the fifo size table */
#define XMTFIFOTBL_STARTREV 20
-/* iterate through all valid bsscfg entries */
-#define FOREACH_BSS(wlc, idx, cfg) \
- for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) { \
- cfg = (wlc)->bsscfg[idx]; \
- if (!cfg) \
- continue;
-/* close marker for iterator code block */
-#define END_FOREACH_BSS() }
-
/* currently the best mechanism for determining SIFS is the band in use */
static u16 get_sifs(struct brcms_band *band)
{
*/
bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
{
- int idx;
- struct brcms_bss_cfg *cfg;
+ struct brcms_bss_cfg *cfg = wlc->bsscfg;
/* disallow PS when one of the following global conditions meets */
if (!wlc->pub->associated)
if (wlc->monitor)
return false;
- for (idx = 0; idx < BRCMS_MAXBSSCFG; idx++) {
- cfg = wlc->bsscfg[idx];
- if (cfg && cfg->associated) {
- /*
- * disallow PS when one of the following
- * bsscfg specific conditions meets
- */
- if (!cfg->BSS)
- return false;
+ if (cfg->associated) {
+ /*
+ * disallow PS when one of the following
+ * bsscfg specific conditions meets
+ */
+ if (!cfg->BSS)
+ return false;
- if (!cfg->dtim_programmed)
- return false;
- }
+ if (!cfg->dtim_programmed)
+ return false;
}
return true;
{
struct d11regs *regs;
u16 chanspec;
- int i;
- struct brcms_bss_cfg *bsscfg;
bool mute = false;
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
brcms_c_reprate_init(wlc);
/* write ethernet address to core */
- FOREACH_BSS(wlc, i, bsscfg)
- brcms_c_set_mac(bsscfg);
- brcms_c_set_bssid(bsscfg);
- END_FOREACH_BSS()
+ brcms_c_set_mac(wlc->bsscfg);
+ brcms_c_set_bssid(wlc->bsscfg);
/* Update tsf_cfprep if associated and up */
- if (wlc->pub->associated) {
- FOREACH_BSS(wlc, i, bsscfg)
- if (bsscfg->up) {
- u32 bi;
+ if (wlc->pub->associated && wlc->bsscfg->up) {
+ u32 bi;
- /* get beacon period and convert to uS */
- bi = bsscfg->current_bss->beacon_period << 10;
- /*
- * update since init path would reset
- * to default value
- */
- W_REG(®s->tsf_cfprep,
- (bi << CFPREP_CBI_SHIFT));
-
- /* Update maccontrol PM related bits */
- brcms_c_set_ps_ctrl(wlc);
+ /* get beacon period and convert to uS */
+ bi = wlc->bsscfg->current_bss->beacon_period << 10;
+ /*
+ * update since init path would reset
+ * to default value
+ */
+ W_REG(®s->tsf_cfprep,
+ (bi << CFPREP_CBI_SHIFT));
- break;
- }
- END_FOREACH_BSS()
+ /* Update maccontrol PM related bits */
+ brcms_c_set_ps_ctrl(wlc);
}
brcms_c_bandinit_ordered(wlc, chanspec);
brcms_b_set_shortslot(wlc->hw, shortslot);
}
-/*
- * propagate home chanspec to all bsscfgs in
- * case bsscfg->current_bss->chanspec is referenced
- */
void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec)
{
if (wlc->home_chanspec != chanspec) {
- int idx;
- struct brcms_bss_cfg *cfg;
-
wlc->home_chanspec = chanspec;
- FOREACH_BSS(wlc, idx, cfg)
- if (!cfg->associated)
- continue;
-
- cfg->current_bss->chanspec = chanspec;
- END_FOREACH_BSS()
-
-
+ if (wlc->bsscfg->associated)
+ wlc->bsscfg->current_bss->chanspec = chanspec;
}
}
static void brcms_c_setband(struct brcms_c_info *wlc,
uint bandunit)
{
- int idx;
- struct brcms_bss_cfg *cfg;
+ struct brcms_bss_cfg *cfg = wlc->bsscfg;
wlc->band = wlc->bandstate[bandunit];
return;
/* wait for at least one beacon before entering sleeping state */
- for (idx = 0; idx < BRCMS_MAXBSSCFG; idx++) {
- cfg = wlc->bsscfg[idx];
- if (cfg && cfg->associated)
- cfg->PMawakebcn = true;
- }
+ if (cfg->associated)
+ cfg->PMawakebcn = true;
+
brcms_c_set_ps_ctrl(wlc);
/* band-specific initializations */
goto fail;
}
- wlc->bsscfg[0] = wlc->cfg;
+ wlc->bsscfg = wlc->cfg;
wlc->cfg->_idx = 0;
wlc->cfg->wlc = wlc;
if (status == -ENOMEDIUM) {
if (!mboolisset
(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE)) {
- int idx;
- struct brcms_bss_cfg *bsscfg;
+ struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
mboolset(wlc->pub->radio_disabled,
WL_RADIO_HW_DISABLE);
- FOREACH_BSS(wlc, idx, bsscfg)
- if (!bsscfg->enable || !bsscfg->BSS)
- continue;
- wiphy_err(wlc->wiphy, "wl%d.%d: up"
+ if (bsscfg->enable && bsscfg->BSS)
+ wiphy_err(wlc->wiphy, "wl%d: up"
": rfdisable -> "
"bsscfg_disable()\n",
- wlc->pub->unit, idx);
- END_FOREACH_BSS()
+ wlc->pub->unit);
}
}
}
*/
void brcms_c_update_beacon(struct brcms_c_info *wlc)
{
- int idx;
- struct brcms_bss_cfg *bsscfg;
+ struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
- /* update AP or IBSS beacons */
- FOREACH_BSS(wlc, idx, bsscfg)
- if (bsscfg->up && !bsscfg->BSS)
- brcms_c_bss_update_beacon(wlc, bsscfg);
- END_FOREACH_BSS()
+ if (bsscfg->up && !bsscfg->BSS)
+ brcms_c_bss_update_beacon(wlc, bsscfg);
}
/* Write ssid into shared memory */
void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
{
- int idx;
- struct brcms_bss_cfg *bsscfg;
+ struct brcms_bss_cfg *bsscfg = wlc->bsscfg;
/* update AP or IBSS probe responses */
- FOREACH_BSS(wlc, idx, bsscfg)
- if (bsscfg->up && !bsscfg->BSS)
- brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
- END_FOREACH_BSS()
+ if (bsscfg->up && !bsscfg->BSS)
+ brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
}
void
/* init tx reported rate mechanism */
void brcms_c_reprate_init(struct brcms_c_info *wlc)
{
- int i;
- struct brcms_bss_cfg *bsscfg;
-
- FOREACH_BSS(wlc, i, bsscfg)
- brcms_c_bsscfg_reprate_init(bsscfg);
- END_FOREACH_BSS()
+ brcms_c_bsscfg_reprate_init(wlc->bsscfg);
}
/* per bsscfg init tx reported rate mechanism */