Date: Tue, 13 Jan 2004 14:43:44 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 45303 for review Message-ID: <200401132243.i0DMhinl069471@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401132243.i0DMhinl069471>