PERFORCE change 135737 for review
Sam Leffler
sam at FreeBSD.org
Tue Feb 19 18:51:55 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=135737
Change 135737 by sam at sam_ebb on 2008/02/19 18:51:26
fixup staggered beacon scheduling:
o assign vap 0 to slot 0 always to optimize single bss operation
o correct slot assignment spreading
o switch stagbeacons on+off based on the number of vaps beaconing
Affected files ...
.. //depot/projects/vap/sys/dev/ath/if_ath.c#28 edit
Differences ...
==== //depot/projects/vap/sys/dev/ath/if_ath.c#28 (text+ko) ====
@@ -719,6 +719,28 @@
if (i != 0 || --sc->sc_nbssid0 == 0)
sc->sc_bssidmask &= ~(1<<i);
}
+/*
+ * Assign a beacon xmit slot. We try to space out
+ * assignments so when beacons are staggered the
+ * traffic coming out of the cab q has maximal time
+ * to go out before the next beacon is scheduled.
+ */
+static int
+assign_bslot(struct ath_softc *sc)
+{
+ u_int slot, free;
+
+ free = 0;
+ for (slot = 0; slot < ATH_BCBUF; slot++)
+ if (sc->sc_bslot[slot] == NULL) {
+ if (sc->sc_bslot[(slot+1)%ATH_BCBUF] == NULL &&
+ sc->sc_bslot[(slot-1)%ATH_BCBUF] == NULL)
+ return slot;
+ free = slot;
+ /* NB: keep looking for a double slot */
+ }
+ return free;
+}
static struct ieee80211vap *
ath_vap_create(struct ieee80211com *ic,
@@ -796,6 +818,9 @@
device_printf(sc->sc_dev, "unknown opmode %d\n", opmode);
return NULL;
}
+ /*
+ * Check that a beacon buffer is available; the code below assumes it.
+ */
if (needbeacon & STAILQ_EMPTY(&sc->sc_bbuf)) {
device_printf(sc->sc_dev, "no beacon buffer available\n");
return NULL;
@@ -808,6 +833,7 @@
return NULL;
}
+ /* STA, AHDEMO? */
if (opmode == IEEE80211_M_HOSTAP)
assign_address(sc, mac, flags & IEEE80211_CLONE_BSSID);
@@ -841,34 +867,17 @@
avp->av_bcbuf = STAILQ_FIRST(&sc->sc_bbuf);
STAILQ_REMOVE_HEAD(&sc->sc_bbuf, bf_list);
if (opmode != IEEE80211_M_IBSS || !sc->sc_hasveol) {
- int slot;
/*
* Assign the vap to a beacon xmit slot. As above
* this cannot fail to find a free one.
*/
- avp->av_bslot = 0;
- for (slot = 0; slot < ATH_BCBUF; slot++) {
- if (sc->sc_bslot[slot] == NULL) {
- /*
- * XXX hack, space out slots to better
- * deal with traffic coming out of the
- * cab q.
- */
- if (slot + 1 < ATH_BCBUF &&
- sc->sc_bslot[slot+1] == NULL) {
- avp->av_bslot = slot + 1;
- break;
- }
- avp->av_bslot = slot;
- /* NB: keep looking for a double slot */
- }
- }
+ avp->av_bslot = assign_bslot(sc);
KASSERT(sc->sc_bslot[avp->av_bslot] == NULL,
("beacon slot %u not empty", avp->av_bslot));
sc->sc_bslot[avp->av_bslot] = vap;
sc->sc_nbcnvaps++;
}
- if (sc->sc_hastsfadd) {
+ if (sc->sc_hastsfadd && sc->sc_nbcnvaps > 0) {
/*
* Multple vaps are to transmit beacons and we
* have h/w support for TSF adjusting; enable
@@ -946,8 +955,11 @@
}
ath_beacon_return(sc, avp->av_bcbuf);
avp->av_bcbuf = NULL;
- if (sc->sc_nbcnvaps == 0)
+ if (sc->sc_nbcnvaps == 0) {
sc->sc_stagbeacons = 0;
+ if (sc->sc_hastsfadd)
+ ath_hal_settsfadjust(sc->sc_ah, 0);
+ }
/*
* Reclaim any pending mcast frames for the vap.
*/
More information about the p4-projects
mailing list