net80211: remove hardcoded slot time durations from drivers
- Add IEEE80211_GET_SLOTTIME(ic) macro. - Use predefined macroses to set slot time. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4044
This commit is contained in:
parent
6000e4fde4
commit
093224c446
@ -2721,8 +2721,7 @@ bwn_updateslot(struct ieee80211com *ic)
|
||||
BWN_LOCK(sc);
|
||||
if (sc->sc_flags & BWN_FLAG_RUNNING) {
|
||||
mac = (struct bwn_mac *)sc->sc_curmac;
|
||||
bwn_set_slot_time(mac,
|
||||
(ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20);
|
||||
bwn_set_slot_time(mac, IEEE80211_GET_SLOTTIME(ic));
|
||||
}
|
||||
BWN_UNLOCK(sc);
|
||||
}
|
||||
|
@ -2423,7 +2423,7 @@ otus_updateslot(struct otus_softc *sc)
|
||||
|
||||
OTUS_LOCK_ASSERT(sc);
|
||||
|
||||
slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
slottime = IEEE80211_GET_SLOTTIME(ic);
|
||||
otus_write(sc, AR_MAC_REG_SLOT_TIME, slottime << 10);
|
||||
(void)otus_write_barrier(sc);
|
||||
}
|
||||
|
@ -2254,7 +2254,7 @@ rt2560_update_slot(struct ieee80211com *ic)
|
||||
uint32_t tmp;
|
||||
|
||||
#ifndef FORCE_SLOTTIME
|
||||
slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
slottime = IEEE80211_GET_SLOTTIME(ic);
|
||||
#else
|
||||
/*
|
||||
* Setting slot time according to "short slot time" capability
|
||||
@ -2272,13 +2272,13 @@ rt2560_update_slot(struct ieee80211com *ic)
|
||||
* (-1Mb~-2Mb lower) and the _whole_ BSS would stop using short
|
||||
* slot time.
|
||||
*/
|
||||
slottime = 20;
|
||||
slottime = IEEE80211_DUR_SLOT;
|
||||
#endif
|
||||
|
||||
/* update the MAC slot boundaries */
|
||||
tx_sifs = RAL_SIFS - RT2560_TXRX_TURNAROUND;
|
||||
tx_pifs = tx_sifs + slottime;
|
||||
tx_difs = tx_sifs + 2 * slottime;
|
||||
tx_difs = IEEE80211_DUR_DIFS(tx_sifs, slottime);
|
||||
eifs = (ic->ic_curmode == IEEE80211_MODE_11B) ? 364 : 60;
|
||||
|
||||
tmp = RAL_READ(sc, RT2560_CSR11);
|
||||
|
@ -2090,7 +2090,7 @@ rt2661_update_slot(struct ieee80211com *ic)
|
||||
uint8_t slottime;
|
||||
uint32_t tmp;
|
||||
|
||||
slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
slottime = IEEE80211_GET_SLOTTIME(ic);
|
||||
|
||||
tmp = RAL_READ(sc, RT2661_MAC_CSR9);
|
||||
tmp = (tmp & ~0xff) | slottime;
|
||||
|
@ -3048,7 +3048,7 @@ rt2860_updateslot(struct ieee80211com *ic)
|
||||
|
||||
tmp = RAL_READ(sc, RT2860_BKOFF_SLOT_CFG);
|
||||
tmp &= ~0xff;
|
||||
tmp |= (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
tmp |= IEEE80211_GET_SLOTTIME(ic);
|
||||
RAL_WRITE(sc, RT2860_BKOFF_SLOT_CFG, tmp);
|
||||
}
|
||||
|
||||
|
@ -2068,7 +2068,7 @@ rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id)
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
uint8_t slottime;
|
||||
|
||||
slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
slottime = IEEE80211_GET_SLOTTIME(ic);
|
||||
|
||||
rum_modbits(sc, RT2573_MAC_CSR9, slottime, 0xff);
|
||||
|
||||
|
@ -5186,7 +5186,7 @@ run_updateslot_cb(void *arg)
|
||||
|
||||
run_read(sc, RT2860_BKOFF_SLOT_CFG, &tmp);
|
||||
tmp &= ~0xff;
|
||||
tmp |= (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
tmp |= IEEE80211_GET_SLOTTIME(ic);
|
||||
run_write(sc, RT2860_BKOFF_SLOT_CFG, tmp);
|
||||
}
|
||||
|
||||
|
@ -1771,7 +1771,7 @@ ural_update_slot(struct ural_softc *sc)
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
uint16_t slottime, sifs, eifs;
|
||||
|
||||
slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20;
|
||||
slottime = IEEE80211_GET_SLOTTIME(ic);
|
||||
|
||||
/*
|
||||
* These settings may sound a bit inconsistent but this is what the
|
||||
|
@ -4291,18 +4291,18 @@ urtw_updateslottask(void *arg, int pending)
|
||||
if (sc->sc_flags & URTW_RTL8187B) {
|
||||
urtw_write8_m(sc, URTW_SIFS, 0x22);
|
||||
if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan))
|
||||
urtw_write8_m(sc, URTW_SLOT, 0x9);
|
||||
urtw_write8_m(sc, URTW_SLOT, IEEE80211_DUR_SHSLOT);
|
||||
else
|
||||
urtw_write8_m(sc, URTW_SLOT, 0x14);
|
||||
urtw_write8_m(sc, URTW_SLOT, IEEE80211_DUR_SLOT);
|
||||
urtw_write8_m(sc, URTW_8187B_EIFS, 0x5b);
|
||||
urtw_write8_m(sc, URTW_CARRIER_SCOUNT, 0x5b);
|
||||
} else {
|
||||
urtw_write8_m(sc, URTW_SIFS, 0x22);
|
||||
if (sc->sc_state == IEEE80211_S_ASSOC &&
|
||||
ic->ic_flags & IEEE80211_F_SHSLOT)
|
||||
urtw_write8_m(sc, URTW_SLOT, 0x9);
|
||||
urtw_write8_m(sc, URTW_SLOT, IEEE80211_DUR_SHSLOT);
|
||||
else
|
||||
urtw_write8_m(sc, URTW_SLOT, 0x14);
|
||||
urtw_write8_m(sc, URTW_SLOT, IEEE80211_DUR_SLOT);
|
||||
if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
|
||||
urtw_write8_m(sc, URTW_DIFS, 0x14);
|
||||
urtw_write8_m(sc, URTW_EIFS, 0x5b - 0x14);
|
||||
|
@ -3621,8 +3621,7 @@ urtwn_wme_update(struct ieee80211com *ic)
|
||||
int ac;
|
||||
|
||||
acm = 0;
|
||||
slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ?
|
||||
IEEE80211_DUR_SHSLOT : IEEE80211_DUR_SLOT;
|
||||
slottime = IEEE80211_GET_SLOTTIME(ic);
|
||||
|
||||
URTWN_LOCK(sc);
|
||||
for (ac = WME_AC_BE; ac < WME_NUM_AC; ac++) {
|
||||
|
@ -53,6 +53,10 @@
|
||||
#define IEEE80211_DUR_SHSLOT 9 /* ERP short slottime */
|
||||
#define IEEE80211_DUR_OFDM_SLOT 9 /* OFDM slottime */
|
||||
|
||||
#define IEEE80211_GET_SLOTTIME(ic) \
|
||||
((ic->ic_flags & IEEE80211_F_SHSLOT) ? \
|
||||
IEEE80211_DUR_SHSLOT : IEEE80211_DUR_SLOT)
|
||||
|
||||
/*
|
||||
* DIFS (microseconds).
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user