Date: Tue, 2 Jan 2018 00:07:28 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327479 - in head/sys/dev: ath bwn iwi iwm iwn mwl otus ral rtwn usb/wlan wpi Message-ID: <201801020007.w0207Sn8025379@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Tue Jan 2 00:07:28 2018 New Revision: 327479 URL: https://svnweb.freebsd.org/changeset/base/327479 Log: [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. Modified: head/sys/dev/ath/if_ath_beacon.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/bwn/if_bwn.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwm/if_iwm.c head/sys/dev/iwn/if_iwn.c head/sys/dev/mwl/if_mwl.c head/sys/dev/otus/if_otus.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c head/sys/dev/rtwn/if_rtwn.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/ath/if_ath_beacon.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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. */ Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/ath/if_ath_tx.c Tue Jan 2 00:07:28 2018 (r327479) @@ -1554,7 +1554,6 @@ ath_tx_normal_setup(struct ath_softc *sc, struct ieee8 { 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 ieee8 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: Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/bwn/if_bwn.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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); Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/iwi/if_iwi.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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, st 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, st 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; } Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/iwm/if_iwm.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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); Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/iwn/if_iwn.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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)); Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/mwl/if_mwl.c Tue Jan 2 00:07:28 2018 (r327479) @@ -2893,10 +2893,14 @@ 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 */ Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/otus/if_otus.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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, Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/ral/rt2661.c Tue Jan 2 00:07:28 2018 (r327479) @@ -1437,7 +1437,6 @@ rt2661_tx_data(struct rt2661_softc *sc, struct mbuf *m 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 *m } 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. */ Modified: head/sys/dev/ral/rt2860.c ============================================================================== --- head/sys/dev/ral/rt2860.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/ral/rt2860.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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++) { Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/rtwn/if_rtwn.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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); Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/usb/wlan/if_rum.c Tue Jan 2 00:07:28 2018 (r327479) @@ -2301,10 +2301,13 @@ 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, Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/usb/wlan/if_run.c Tue Jan 2 00:07:28 2018 (r327479) @@ -2217,10 +2217,13 @@ run_newstate(struct ieee80211vap *vap, enum ieee80211_ 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); Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Tue Jan 2 00:02:36 2018 (r327478) +++ head/sys/dev/wpi/if_wpi.c Tue Jan 2 00:07:28 2018 (r327479) @@ -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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801020007.w0207Sn8025379>