[net80211] convert all of the WME use over to a temporary copy of WME info.

This removes the direct WME info access in the ieee80211com struct and instead
provides a method of fetching the data.  Right now it's a no-op but eventually
it'll turn into a per-VAP method for drivers that support it (eg iwn, iwm,
upcoming ath10k work) as things like p2p support require this kind of behaviour.

Tested:

* ath(4), STA and AP mode

TODO:

* yes, this is slightly stack size-y, but it is an important first step
  to get drivers migrated over to a sensible WME API.  A lot of per-phy things
  need to be converted to per-VAP before P2P, 11ac firmware, etc stuff shows up.
This commit is contained in:
adrian 2018-01-02 00:07:28 +00:00
parent 1df3a19fc9
commit 37d68cafec
14 changed files with 65 additions and 30 deletions

View File

@ -150,8 +150,12 @@ ath_beaconq_config(struct ath_softc *sc)
qi.tqi_cwmin = ATH_BEACON_CWMIN_DEFAULT;
qi.tqi_cwmax = ATH_BEACON_CWMAX_DEFAULT;
} else {
struct wmeParams *wmep =
&ic->ic_wme.wme_chanParams.cap_wmeParams[WME_AC_BE];
struct chanAccParams chp;
struct wmeParams *wmep;
ieee80211_wme_ic_getparams(ic, &chp);
wmep = &chp.cap_wmeParams[WME_AC_BE];
/*
* Adhoc mode; important thing is to use 2x cwmin.
*/

View File

@ -1554,7 +1554,6 @@ ath_tx_normal_setup(struct ath_softc *sc, struct ieee80211_node *ni,
{
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = &sc->sc_ic;
const struct chanAccParams *cap = &ic->ic_wme.wme_chanParams;
int error, iswep, ismcast, isfrag, ismrr;
int keyix, hdrlen, pktlen, try0 = 0;
u_int8_t rix = 0, txrate = 0;
@ -1697,7 +1696,11 @@ ath_tx_normal_setup(struct ath_softc *sc, struct ieee80211_node *ni,
ismrr = 1;
bf->bf_state.bfs_doratelookup = 1;
}
if (cap->cap_wmeParams[pri].wmep_noackPolicy)
/*
* Check whether to set NOACK for this WME category or not.
*/
if (ieee80211_wme_vap_ac_is_noack(vap, pri))
flags |= HAL_TXDESC_NOACK;
break;
default:

View File

@ -1755,15 +1755,18 @@ bwn_wme_update(struct ieee80211com *ic)
{
struct bwn_softc *sc = ic->ic_softc;
struct bwn_mac *mac = sc->sc_curmac;
struct chanAccParams chp;
struct wmeParams *wmep;
int i;
ieee80211_wme_ic_getparams(ic, &chp);
BWN_LOCK(sc);
mac = sc->sc_curmac;
if (mac != NULL && mac->mac_status >= BWN_MAC_STATUS_INITED) {
bwn_mac_suspend(mac);
for (i = 0; i < N(sc->sc_wmeParams); i++) {
wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[i];
wmep = &chp.cap_wmeParams[i];
bwn_wme_loadparams(mac, wmep, bwn_wme_shm_offsets[i]);
}
bwn_mac_enable(mac);

View File

@ -1050,12 +1050,15 @@ static int
iwi_wme_setparams(struct iwi_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
struct chanAccParams chp;
const struct wmeParams *wmep;
int ac;
ieee80211_wme_ic_getparams(ic, &chp);
for (ac = 0; ac < WME_NUM_AC; ac++) {
/* set WME values for current operating mode */
wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac];
wmep = &chp.cap_wmeParams[ac];
sc->wme[0].aifsn[ac] = wmep->wmep_aifsn;
sc->wme[0].cwmin[ac] = IWI_EXP2(wmep->wmep_logcwmin);
sc->wme[0].cwmax[ac] = IWI_EXP2(wmep->wmep_logcwmax);
@ -1771,11 +1774,9 @@ iwi_tx_start(struct iwi_softc *sc, struct mbuf *m0, struct ieee80211_node *ni,
int ac)
{
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211com *ic = ni->ni_ic;
struct iwi_node *in = (struct iwi_node *)ni;
const struct ieee80211_frame *wh;
struct ieee80211_key *k;
const struct chanAccParams *cap;
struct iwi_tx_ring *txq = &sc->txq[ac];
struct iwi_tx_data *data;
struct iwi_tx_desc *desc;
@ -1797,8 +1798,7 @@ iwi_tx_start(struct iwi_softc *sc, struct mbuf *m0, struct ieee80211_node *ni,
flags |= IWI_DATA_FLAG_SHPREAMBLE;
if (IEEE80211_QOS_HAS_SEQ(wh)) {
xflags |= IWI_DATA_XFLAG_QOS;
cap = &ic->ic_wme.wme_chanParams;
if (!cap->cap_wmeParams[ac].wmep_noackPolicy)
if (ieee80211_wme_vap_ac_is_noack(vap, ac))
flags &= ~IWI_DATA_FLAG_NEED_ACK;
}

View File

@ -6041,6 +6041,7 @@ iwm_wme_update(struct ieee80211com *ic)
{
#define IWM_EXP2(x) ((1 << (x)) - 1) /* CWmin = 2^ECWmin - 1 */
struct iwm_softc *sc = ic->ic_softc;
struct chanAccParams chp;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
struct iwm_vap *ivp = IWM_VAP(vap);
struct iwm_node *in;
@ -6050,9 +6051,11 @@ iwm_wme_update(struct ieee80211com *ic)
if (vap == NULL)
return (0);
ieee80211_wme_ic_getparams(ic, &chp);
IEEE80211_LOCK(ic);
for (aci = 0; aci < WME_NUM_AC; aci++)
tmp[aci] = ic->ic_wme.wme_chanParams.cap_wmeParams[aci];
tmp[aci] = chp.cap_wmeParams[aci];
IEEE80211_UNLOCK(ic);
IWM_LOCK(sc);

View File

@ -5301,17 +5301,19 @@ iwn_updateedca(struct ieee80211com *ic)
#define IWN_EXP2(x) ((1 << (x)) - 1) /* CWmin = 2^ECWmin - 1 */
struct iwn_softc *sc = ic->ic_softc;
struct iwn_edca_params cmd;
struct chanAccParams chp;
int aci;
DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
ieee80211_wme_ic_getparams(ic, &chp);
memset(&cmd, 0, sizeof cmd);
cmd.flags = htole32(IWN_EDCA_UPDATE);
IEEE80211_LOCK(ic);
for (aci = 0; aci < WME_NUM_AC; aci++) {
const struct wmeParams *ac =
&ic->ic_wme.wme_chanParams.cap_wmeParams[aci];
const struct wmeParams *ac = &chp.cap_wmeParams[aci];
cmd.ac[aci].aifsn = ac->wmep_aifsn;
cmd.ac[aci].cwmin = htole16(IWN_EXP2(ac->wmep_logcwmin));
cmd.ac[aci].cwmax = htole16(IWN_EXP2(ac->wmep_logcwmax));

View File

@ -2893,11 +2893,15 @@ mwl_txq_update(struct mwl_softc *sc, int ac)
{
#define MWL_EXPONENT_TO_VALUE(v) ((1<<v)-1)
struct ieee80211com *ic = &sc->sc_ic;
struct chanAccParams chp;
struct mwl_txq *txq = sc->sc_ac2q[ac];
struct wmeParams *wmep = &ic->ic_wme.wme_chanParams.cap_wmeParams[ac];
struct wmeParams *wmep;
struct mwl_hal *mh = sc->sc_mh;
int aifs, cwmin, cwmax, txoplim;
ieee80211_wme_ic_getparams(ic, &chp);
wmep = &chp.cap_wmeParams[ac];
aifs = wmep->wmep_aifsn;
/* XXX in sta mode need to pass log values for cwmin/max */
cwmin = MWL_EXPONENT_TO_VALUE(wmep->wmep_logcwmin);

View File

@ -2392,12 +2392,15 @@ otus_updateedca_locked(struct otus_softc *sc)
{
#define EXP2(val) ((1 << (val)) - 1)
#define AIFS(val) ((val) * 9 + 10)
struct chanAccParams chp;
struct ieee80211com *ic = &sc->sc_ic;
const struct wmeParams *edca;
ieee80211_wme_ic_getparams(ic, &chp);
OTUS_LOCK_ASSERT(sc);
edca = ic->ic_wme.wme_chanParams.cap_wmeParams;
edca = chp.cap_wmeParams;
/* Set CWmin/CWmax values. */
otus_write(sc, AR_MAC_REG_AC0_CW,

View File

@ -1437,7 +1437,6 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0,
struct ieee80211_frame *wh;
const struct ieee80211_txparam *tp = ni->ni_txparms;
struct ieee80211_key *k;
const struct chanAccParams *cap;
struct mbuf *mnew;
bus_dma_segment_t segs[RT2661_MAX_SCATTER];
uint16_t dur;
@ -1458,10 +1457,8 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m0,
}
rate &= IEEE80211_RATE_VAL;
if (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_QOS) {
cap = &ic->ic_wme.wme_chanParams;
noack = cap->cap_wmeParams[ac].wmep_noackPolicy;
}
if (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_QOS)
noack = !! ieee80211_wme_vap_ac_is_noack(vap, ac);
if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
k = ieee80211_crypto_encap(ni, m0);
@ -2045,9 +2042,12 @@ static int
rt2661_wme_update(struct ieee80211com *ic)
{
struct rt2661_softc *sc = ic->ic_softc;
struct chanAccParams chp;
const struct wmeParams *wmep;
wmep = ic->ic_wme.wme_chanParams.cap_wmeParams;
ieee80211_wme_ic_getparams(ic, &chp);
wmep = chp.cap_wmeParams;
/* XXX: not sure about shifts. */
/* XXX: the reference driver plays with AC_VI settings too. */

View File

@ -3115,10 +3115,13 @@ static int
rt2860_updateedca(struct ieee80211com *ic)
{
struct rt2860_softc *sc = ic->ic_softc;
struct chanAccParams chp;
const struct wmeParams *wmep;
int aci;
wmep = ic->ic_wme.wme_chanParams.cap_wmeParams;
ieee80211_wme_ic_getparams(ic, &chp);
wmep = chp.cap_wmeParams;
/* update MAC TX configuration registers */
for (aci = 0; aci < WME_NUM_AC; aci++) {

View File

@ -1574,17 +1574,19 @@ rtwn_set_channel(struct ieee80211com *ic)
static int
rtwn_wme_update(struct ieee80211com *ic)
{
struct chanAccParams chp;
struct ieee80211_channel *c = ic->ic_curchan;
struct rtwn_softc *sc = ic->ic_softc;
struct wmeParams *wmep = sc->cap_wmeParams;
uint8_t aifs, acm, slottime;
int ac;
ieee80211_wme_ic_getparams(ic, &chp);
/* Prevent possible races. */
IEEE80211_LOCK(ic); /* XXX */
RTWN_LOCK(sc);
memcpy(wmep, ic->ic_wme.wme_chanParams.cap_wmeParams,
sizeof(sc->cap_wmeParams));
memcpy(wmep, chp.cap_wmeParams, sizeof(sc->cap_wmeParams));
RTWN_UNLOCK(sc);
IEEE80211_UNLOCK(ic);

View File

@ -2301,11 +2301,14 @@ rum_update_slot(struct ieee80211com *ic)
static int
rum_wme_update(struct ieee80211com *ic)
{
const struct wmeParams *chanp =
ic->ic_wme.wme_chanParams.cap_wmeParams;
struct chanAccParams chp;
const struct wmeParams *chanp;
struct rum_softc *sc = ic->ic_softc;
int error = 0;
ieee80211_wme_ic_getparams(ic, &chp);
chanp = chp.cap_wmeParams;
RUM_LOCK(sc);
error = rum_write(sc, RT2573_AIFSN_CSR,
chanp[WME_AC_VO].wmep_aifsn << 12 |

View File

@ -2217,11 +2217,14 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
static int
run_wme_update(struct ieee80211com *ic)
{
struct chanAccParams chp;
struct run_softc *sc = ic->ic_softc;
const struct wmeParams *ac =
ic->ic_wme.wme_chanParams.cap_wmeParams;
const struct wmeParams *ac;
int aci, error = 0;
ieee80211_wme_ic_getparams(ic, &chp);
ac = chp.cap_wmeParams;
/* update MAC TX configuration registers */
RUN_LOCK(sc);
for (aci = 0; aci < WME_NUM_AC; aci++) {

View File

@ -3521,16 +3521,18 @@ wpi_updateedca(struct ieee80211com *ic)
{
#define WPI_EXP2(x) ((1 << (x)) - 1) /* CWmin = 2^ECWmin - 1 */
struct wpi_softc *sc = ic->ic_softc;
struct chanAccParams chp;
struct wpi_edca_params cmd;
int aci, error;
ieee80211_wme_ic_getparams(ic, &chp);
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__);
memset(&cmd, 0, sizeof cmd);
cmd.flags = htole32(WPI_EDCA_UPDATE);
for (aci = 0; aci < WME_NUM_AC; aci++) {
const struct wmeParams *ac =
&ic->ic_wme.wme_chanParams.cap_wmeParams[aci];
const struct wmeParams *ac = &chp.cap_wmeParams[aci];
cmd.ac[aci].aifsn = ac->wmep_aifsn;
cmd.ac[aci].cwmin = htole16(WPI_EXP2(ac->wmep_logcwmin));
cmd.ac[aci].cwmax = htole16(WPI_EXP2(ac->wmep_logcwmax));