From e0372fe994e175630701eda4c2cf15bb269079ca Mon Sep 17 00:00:00 2001 From: Roland Vossen Date: Wed, 30 Mar 2011 11:21:00 +0200 Subject: [PATCH] staging: brcm80211: made overlapping WMM functions more similar Code cleanup. Functions wlc_edcf_setparams() and wlc_wme_setparams() duplicate code amongst each other. This commit attempts to make life easier for the reviewer, by introducing non functional changes that bring wlc_edcf_setparams() more in line with wlc_wme_setparams(). As a result the subsequent commit can be reviewed more easily. Signed-off-by: Roland Vossen Reviewed-by: Arend van Spriel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/brcm80211/brcmsmac/wlc_main.c | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_main.c b/drivers/staging/brcm80211/brcmsmac/wlc_main.c index 7b91ea7befb5..f178146254a1 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_main.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_main.c @@ -1435,16 +1435,21 @@ void wlc_wme_setparams(struct wlc_info *wlc, u16 aci, void wlc_edcf_setparams(struct wlc_info *wlc, bool suspend) { - uint aci, i, j; + u16 aci; + int i_ac, i; edcf_acparam_t *edcf_acp; shm_acparams_t acp_shm; u16 *shm_entry; + struct ieee80211_tx_queue_params txq_pars; + struct ieee80211_tx_queue_params *params = &txq_pars; ASSERT(wlc); /* Only apply params if the core is out of reset and has clocks */ - if (!wlc->clk) + if (!wlc->clk) { + WL_ERROR("wl%d: %s : no-clock\n", wlc->pub->unit, __func__); return; + } /* * AP uses AC params from wme_param_ie_ap. @@ -1456,7 +1461,7 @@ void wlc_edcf_setparams(struct wlc_info *wlc, bool suspend) wlc->wme_admctl = 0; - for (i = 0; i < AC_COUNT; i++, edcf_acp++) { + for (i_ac = 0; i_ac < AC_COUNT; i_ac++, edcf_acp++) { memset((char *)&acp_shm, 0, sizeof(shm_acparams_t)); /* find out which ac this set of params applies to */ aci = (edcf_acp->ACI & EDCF_ACI_MASK) >> EDCF_ACI_SHIFT; @@ -1467,12 +1472,13 @@ void wlc_edcf_setparams(struct wlc_info *wlc, bool suspend) } /* fill in shm ac params struct */ - acp_shm.txop = le16_to_cpu(edcf_acp->TXOP); + params->txop = edcf_acp->TXOP; + acp_shm.txop = le16_to_cpu(params->txop); /* convert from units of 32us to us for ucode */ - wlc->edcf_txop[aci] = acp_shm.txop = + wlc->edcf_txop[aci & 0x3] = acp_shm.txop = EDCF_TXOP2USEC(acp_shm.txop); - acp_shm.aifs = (edcf_acp->ACI & EDCF_AIFSN_MASK); - + params->aifs = edcf_acp->ACI; + acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK); if (aci == AC_VI && acp_shm.txop == 0 && acp_shm.aifs < EDCF_AIFSN_MAX) acp_shm.aifs++; @@ -1485,10 +1491,12 @@ void wlc_edcf_setparams(struct wlc_info *wlc, bool suspend) } /* CWmin = 2^(ECWmin) - 1 */ - acp_shm.cwmin = EDCF_ECW2CW(edcf_acp->ECW & EDCF_ECWMIN_MASK); + params->cw_min = EDCF_ECW2CW(edcf_acp->ECW & EDCF_ECWMIN_MASK); + acp_shm.cwmin = params->cw_min; /* CWmax = 2^(ECWmax) - 1 */ - acp_shm.cwmax = EDCF_ECW2CW((edcf_acp->ECW & EDCF_ECWMAX_MASK) + params->cw_max = EDCF_ECW2CW((edcf_acp->ECW & EDCF_ECWMAX_MASK) >> EDCF_ECWMAX_SHIFT); + acp_shm.cwmax = params->cw_max; acp_shm.cwcur = acp_shm.cwmin; acp_shm.bslots = R_REG(&wlc->regs->tsf_random) & acp_shm.cwcur; @@ -1502,10 +1510,10 @@ void wlc_edcf_setparams(struct wlc_info *wlc, bool suspend) /* Fill in shm acparam table */ shm_entry = (u16 *) &acp_shm; - for (j = 0; j < (int)sizeof(shm_acparams_t); j += 2) + for (i = 0; i < (int)sizeof(shm_acparams_t); i += 2) wlc_write_shm(wlc, M_EDCF_QINFO + - wme_shmemacindex(aci) * M_EDCF_QLEN + j, + wme_shmemacindex(aci) * M_EDCF_QLEN + i, *shm_entry++); } -- 2.30.2