summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoravos <avos@FreeBSD.org>2015-12-13 20:48:24 +0000
committeravos <avos@FreeBSD.org>2015-12-13 20:48:24 +0000
commit093224c4462002b02a08f5b23e361e7983b9fee1 (patch)
treeb814d4d67532060ec79203f4a600bc5f31291fbd /sys
parent6000e4fde45e8fe83b65b851e2f7347b4982d075 (diff)
downloadFreeBSD-src-093224c4462002b02a08f5b23e361e7983b9fee1.zip
FreeBSD-src-093224c4462002b02a08f5b23e361e7983b9fee1.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/bwn/if_bwn.c3
-rw-r--r--sys/dev/otus/if_otus.c2
-rw-r--r--sys/dev/ral/rt2560.c6
-rw-r--r--sys/dev/ral/rt2661.c2
-rw-r--r--sys/dev/ral/rt2860.c2
-rw-r--r--sys/dev/usb/wlan/if_rum.c2
-rw-r--r--sys/dev/usb/wlan/if_run.c2
-rw-r--r--sys/dev/usb/wlan/if_ural.c2
-rw-r--r--sys/dev/usb/wlan/if_urtw.c8
-rw-r--r--sys/dev/usb/wlan/if_urtwn.c3
-rw-r--r--sys/net80211/ieee80211_phy.h4
11 files changed, 19 insertions, 17 deletions
diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c
index 0746a8e..93996e2 100644
--- a/sys/dev/bwn/if_bwn.c
+++ b/sys/dev/bwn/if_bwn.c
@@ -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);
}
diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c
index 0d59278..160b05e 100644
--- a/sys/dev/otus/if_otus.c
+++ b/sys/dev/otus/if_otus.c
@@ -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);
}
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
index e5d7518..d62c470 100644
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -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);
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index cff64b1..a2e955c 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -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;
diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c
index a572dbf..9447976 100644
--- a/sys/dev/ral/rt2860.c
+++ b/sys/dev/ral/rt2860.c
@@ -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);
}
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
index 02788b1..49864b3 100644
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -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);
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
index aa853c6..1ad9f60 100644
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -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);
}
diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c
index 6174215..4d84e5a 100644
--- a/sys/dev/usb/wlan/if_ural.c
+++ b/sys/dev/usb/wlan/if_ural.c
@@ -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
diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c
index 3f4e4c7..105fd9d 100644
--- a/sys/dev/usb/wlan/if_urtw.c
+++ b/sys/dev/usb/wlan/if_urtw.c
@@ -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);
diff --git a/sys/dev/usb/wlan/if_urtwn.c b/sys/dev/usb/wlan/if_urtwn.c
index 3223008..becf6c8 100644
--- a/sys/dev/usb/wlan/if_urtwn.c
+++ b/sys/dev/usb/wlan/if_urtwn.c
@@ -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++) {
diff --git a/sys/net80211/ieee80211_phy.h b/sys/net80211/ieee80211_phy.h
index bf39cdd..cb6b358 100644
--- a/sys/net80211/ieee80211_phy.h
+++ b/sys/net80211/ieee80211_phy.h
@@ -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).
*/
OpenPOWER on IntegriCloud