From owner-p4-projects@FreeBSD.ORG Tue Jan 13 14:43:57 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 85DDB16A4D0; Tue, 13 Jan 2004 14:43:57 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E95616A4CF for ; Tue, 13 Jan 2004 14:43:57 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE8DE43D2D for ; Tue, 13 Jan 2004 14:43:44 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i0DMhi0B069474 for ; Tue, 13 Jan 2004 14:43:44 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i0DMhinl069471 for perforce@freebsd.org; Tue, 13 Jan 2004 14:43:44 -0800 (PST) (envelope-from sam@freebsd.org) Date: Tue, 13 Jan 2004 14:43:44 -0800 (PST) Message-Id: <200401132243.i0DMhinl069471@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 Subject: PERFORCE change 45303 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jan 2004 22:43:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=45303 Change 45303 by sam@sam_ebb on 2004/01/13 14:43:28 o beware of non-existent rate codes when filling in the hwmap o beware of a node not have a rate set when setting up the rate control state; this can happen prior to association but is ok since we should only be sending management frames during that time Affected files ... .. //depot/projects/netperf+sockets/sys/dev/ath/if_ath.c#14 edit Differences ... ==== //depot/projects/netperf+sockets/sys/dev/ath/if_ath.c#14 (text+ko) ==== @@ -2781,8 +2781,11 @@ for (i = 0; i < rt->rateCount; i++) sc->sc_rixmap[rt->info[i].dot11Rate & IEEE80211_RATE_VAL] = i; memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); - for (i = 0; i < 32; i++) - sc->sc_hwmap[i] = rt->info[rt->rateCodeToIndex[i]].dot11Rate; + for (i = 0; i < 32; i++) { + u_int8_t ix = rt->rateCodeToIndex[i]; + if (ix != 0xff) + sc->sc_hwmap[i] = rt->info[ix].dot11Rate; + } sc->sc_currates = rt; sc->sc_curmode = mode; /* NB: caller is responsible for reseting rate control state */ @@ -2799,17 +2802,27 @@ DPRINTF(ATH_DEBUG_RATE, ("%s: set xmit rate for %s to %dM\n", __func__, ether_sprintf(ni->ni_macaddr), - (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2)); + ni->ni_rates.rs_nrates > 0 ? + (ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0)); ni->ni_txrate = rate; + /* XXX management/control frames always go at the lowest speed */ + an->an_tx_mgtrate = rt->info[0].rateCode; + an->an_tx_mgtratesp = an->an_tx_mgtrate | rt->info[0].shortPreamble; + /* + * Before associating a node has no rate set setup + * so we can't calculate any transmit codes to use. + * This is ok since we should never be sending anything + * but management frames and those always go at the + * lowest hardware rate. + */ + if (ni->ni_rates.rs_nrates == 0) + goto done; an->an_tx_rix0 = sc->sc_rixmap[ ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL]; an->an_tx_rate0 = rt->info[an->an_tx_rix0].rateCode; an->an_tx_rate0sp = an->an_tx_rate0 | rt->info[an->an_tx_rix0].shortPreamble; - /* XXX management/control frames always go at the lowest speed */ - an->an_tx_mgtrate = rt->info[0].rateCode; - an->an_tx_mgtratesp = an->an_tx_mgtrate | rt->info[0].shortPreamble; if (sc->sc_mrretry) { /* * Hardware supports multi-rate retry; setup two @@ -2851,6 +2864,7 @@ an->an_tx_rate2 = an->an_tx_rate2sp = 0; an->an_tx_rate3 = an->an_tx_rate3sp = 0; } +done: an->an_tx_ok = an->an_tx_err = an->an_tx_retr = an->an_tx_upper = 0; }