From 8443256dbb8e3937f9004767a551f228740d4764 Mon Sep 17 00:00:00 2001 From: kevlo Date: Mon, 3 Jul 2017 09:21:09 +0000 Subject: [PATCH] Replace slot time durations with macros. ok stsp@ --- sys/dev/ic/athn.c | 5 +++-- sys/dev/ic/bwi.c | 9 +++------ sys/dev/ic/rt2560.c | 5 +++-- sys/dev/ic/rt2661.c | 5 +++-- sys/dev/ic/rt2860.c | 5 +++-- sys/dev/usb/if_otus.c | 5 +++-- sys/dev/usb/if_ral.c | 5 +++-- sys/dev/usb/if_rum.c | 5 +++-- sys/dev/usb/if_run.c | 5 +++-- sys/dev/usb/if_urtw.c | 10 +++++----- 10 files changed, 32 insertions(+), 27 deletions(-) diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index 806325a1c14..54f1e668f7d 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.97 2017/05/18 08:35:56 stsp Exp $ */ +/* $OpenBSD: athn.c,v 1.98 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -2619,7 +2619,8 @@ athn_updateslot(struct ieee80211com *ic) struct athn_softc *sc = ic->ic_softc; int slot; - slot = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + slot = (ic->ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT : IEEE80211_DUR_DS_SLOT; AR_WRITE(sc, AR_D_GBL_IFS_SLOT, slot * athn_clock_rate(sc)); AR_WRITE_BARRIER(sc); } diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 9374ecc8e85..db0de53b04c 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.124 2017/01/22 10:17:37 dlg Exp $ */ +/* $OpenBSD: bwi.c,v 1.125 2017/07/03 09:21:09 kevlo Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -2441,9 +2441,6 @@ bwi_mac_get_property(struct bwi_mac *mac) return (0); } -#define IEEE80211_DUR_SLOT 20 /* DS/CCK slottime, ERP long slottime */ -#define IEEE80211_DUR_SHSLOT 9 /* ERP short slottime */ - void bwi_mac_updateslot(struct bwi_mac *mac, int shslot) { @@ -2458,9 +2455,9 @@ bwi_mac_updateslot(struct bwi_mac *mac, int shslot) return; if (shslot) - slot_time = IEEE80211_DUR_SHSLOT; + slot_time = IEEE80211_DUR_DS_SHSLOT; else - slot_time = IEEE80211_DUR_SLOT; + slot_time = IEEE80211_DUR_DS_SLOT; CSR_WRITE_2(mac->mac_sc, BWI_MAC_SLOTTIME, slot_time + BWI_MAC_SLOTTIME_ADJUST); diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c index 87f1d5fddb9..d951ec9b8ee 100644 --- a/sys/dev/ic/rt2560.c +++ b/sys/dev/ic/rt2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2560.c,v 1.82 2017/01/22 10:17:38 dlg Exp $ */ +/* $OpenBSD: rt2560.c,v 1.83 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -2356,7 +2356,8 @@ rt2560_set_slottime(struct rt2560_softc *sc) uint16_t sifs, pifs, difs, eifs; uint32_t tmp; - slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT : IEEE80211_DUR_DS_SLOT; /* define the MAC slot boundaries */ sifs = RAL_SIFS - RT2560_RXTX_TURNAROUND; diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index dc731e9d478..b88aee1af20 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.91 2017/01/22 10:17:38 dlg Exp $ */ +/* $OpenBSD: rt2661.c,v 1.92 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2006 @@ -2427,7 +2427,8 @@ rt2661_set_slottime(struct rt2661_softc *sc) uint8_t slottime; uint32_t tmp; - slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT: IEEE80211_DUR_DS_SLOT; tmp = RAL_READ(sc, RT2661_MAC_CSR9); tmp = (tmp & ~0xff) | slottime; diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c index 28b4512995e..1da76f7476a 100644 --- a/sys/dev/ic/rt2860.c +++ b/sys/dev/ic/rt2860.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2860.c,v 1.93 2017/05/31 03:45:15 jsg Exp $ */ +/* $OpenBSD: rt2860.c,v 1.94 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2007-2010 Damien Bergamini @@ -2851,7 +2851,8 @@ 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 |= (ic->ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT : IEEE80211_DUR_DS_SLOT; RAL_WRITE(sc, RT2860_BKOFF_SLOT_CFG, tmp); } diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index 0185d107979..b63ccc75e58 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.57 2017/04/08 02:57:25 deraadt Exp $ */ +/* $OpenBSD: if_otus.c,v 1.58 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini @@ -1640,7 +1640,8 @@ otus_updateslot_cb(struct otus_softc *sc, void *arg) { uint32_t slottime; - slottime = (sc->sc_ic.ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + slottime = (sc->sc_ic.ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT: IEEE80211_DUR_DS_SLOT; otus_write(sc, AR_MAC_REG_SLOT_TIME, slottime << 10); (void)otus_write_barrier(sc); } diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index add8e74454d..9dd16fabd24 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.142 2017/01/22 10:17:39 dlg Exp $ */ +/* $OpenBSD: if_ral.c,v 1.143 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2005, 2006 @@ -1684,7 +1684,8 @@ 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 = (ic->ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT : IEEE80211_DUR_DS_SLOT; /* * These settings may sound a bit inconsistent but this is what the diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 49ab637ddcc..a025da21fe0 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.121 2017/03/26 15:31:15 deraadt Exp $ */ +/* $OpenBSD: if_rum.c,v 1.122 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini @@ -1764,7 +1764,8 @@ rum_update_slot(struct rum_softc *sc) uint8_t slottime; uint32_t tmp; - slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT : IEEE80211_DUR_DS_SLOT; tmp = rum_read(sc, RT2573_MAC_CSR9); tmp = (tmp & ~0xff) | slottime; diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index cbeb3066d37..f8769b938d0 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.119 2017/06/02 15:09:13 kevlo Exp $ */ +/* $OpenBSD: if_run.c,v 1.120 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini @@ -3756,7 +3756,8 @@ run_updateslot_cb(struct run_softc *sc, void *arg) run_read(sc, RT2860_BKOFF_SLOT_CFG, &tmp); tmp &= ~0xff; - tmp |= (sc->sc_ic.ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; + tmp |= (sc->sc_ic.ic_flags & IEEE80211_F_SHSLOT) ? + IEEE80211_DUR_DS_SHSLOT : IEEE80211_DUR_DS_SLOT; run_write(sc, RT2860_BKOFF_SLOT_CFG, tmp); } diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index 4a983089f41..c156f627ccb 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtw.c,v 1.64 2017/01/22 10:17:39 dlg Exp $ */ +/* $OpenBSD: if_urtw.c,v 1.65 2017/07/03 09:21:09 kevlo Exp $ */ /*- * Copyright (c) 2009 Martynas Venckus @@ -2956,9 +2956,9 @@ urtw_8225_rf_set_chan(struct urtw_rf *rf, int chan) 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_DS_SHSLOT); else - urtw_write8_m(sc, URTW_SLOT, 0x14); + urtw_write8_m(sc, URTW_SLOT, IEEE80211_DUR_DS_SLOT); if (IEEE80211_IS_CHAN_G(c)) { urtw_write8_m(sc, URTW_DIFS, 0x14); @@ -3386,9 +3386,9 @@ urtw_8225v2_rf_set_chan(struct urtw_rf *rf, int chan) 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_DS_SHSLOT); else - urtw_write8_m(sc, URTW_SLOT, 0x14); + urtw_write8_m(sc, URTW_SLOT, IEEE80211_DUR_DS_SLOT); if (IEEE80211_IS_CHAN_G(c)) { urtw_write8_m(sc, URTW_DIFS, 0x14); -- 2.20.1