From owner-p4-projects@FreeBSD.ORG Tue Feb 19 18:51:55 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DF0D816A420; Tue, 19 Feb 2008 18:51:54 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A53316A417 for ; Tue, 19 Feb 2008 18:51:54 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 59D6E13C465 for ; Tue, 19 Feb 2008 18:51:54 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1JIps2M087072 for ; Tue, 19 Feb 2008 18:51:54 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1JIpsqZ087069 for perforce@freebsd.org; Tue, 19 Feb 2008 18:51:54 GMT (envelope-from sam@freebsd.org) Date: Tue, 19 Feb 2008 18:51:54 GMT Message-Id: <200802191851.m1JIpsqZ087069@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 135737 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 18:51:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=135737 Change 135737 by sam@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<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. */