diff options
author | sam <sam@FreeBSD.org> | 2007-10-13 22:30:41 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2007-10-13 22:30:41 +0000 |
commit | 3b495719346f7940e511e1b63d49dfcbff9124c1 (patch) | |
tree | cfc6c45264a64c5c6a52e0851fef275cbf938994 | |
parent | a5038f060de9f1cc50cf532f78541dfd901f10b8 (diff) | |
download | FreeBSD-src-3b495719346f7940e511e1b63d49dfcbff9124c1.zip FreeBSD-src-3b495719346f7940e511e1b63d49dfcbff9124c1.tar.gz |
revert 1.18: the negotiated rate set may not match the hal
rate tables, so using the hal's rateCodeToIndex array
will produce wrong indices for the negotiated rate set
MFC after: 3 days
-rw-r--r-- | sys/dev/ath/ath_rate/sample/sample.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 29ee82b..180ef82 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -138,6 +138,17 @@ bin_to_size(int index) { return packet_size_bins[index]; } +static __inline int +rate_to_ndx(struct sample_node *sn, int rate) { + int x = 0; + for (x = 0; x < sn->num_rates; x++) { + if (sn->rates[x].rate == rate) { + return x; + } + } + return -1; +} + void ath_rate_node_init(struct ath_softc *sc, struct ath_node *an) { @@ -504,11 +515,10 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an, struct sample_node *sn = ATH_NODE_SAMPLE(an); const struct ath_tx_status *ts = &bf->bf_status.ds_txstat; const struct ath_desc *ds0 = &bf->bf_desc[0]; - const HAL_RATE_TABLE *rt = sc->sc_currates; - int short_tries, long_tries, frame_size; - int mrr, ndx0, ndx1, ndx2, ndx3; + int final_rate, short_tries, long_tries, frame_size; + int mrr; - ndx0 = rt->rateCodeToIndex[ts->ts_rate &~ HAL_TXSTAT_ALTRATE]; + final_rate = sc->sc_hwmap[ts->ts_rate &~ HAL_TXSTAT_ALTRATE].ieeerate; short_tries = ts->ts_shortretry; long_tries = ts->ts_longretry + 1; frame_size = ds0->ds_ctl0 & 0x0fff; /* low-order 12 bits of ds_ctl0 */ @@ -526,6 +536,8 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an, } mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); if (!mrr || !(ts->ts_rate & HAL_TXSTAT_ALTRATE)) { + int ndx = rate_to_ndx(sn, final_rate); + /* * Only one rate was used; optimize work. */ @@ -534,18 +546,18 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an, __func__, ether_sprintf(an->an_node.ni_macaddr), bin_to_size(size_to_bin(frame_size)), ts->ts_status ? "FAIL" : "OK", - sn->rates[ndx0].rate, short_tries, long_tries); + final_rate, short_tries, long_tries); update_stats(sc, an, frame_size, - ndx0, long_tries, + ndx, long_tries, 0, 0, 0, 0, 0, 0, short_tries, long_tries, ts->ts_status); } else { - int hwrate0, tries0; - int hwrate1, tries1; - int hwrate2, tries2; - int hwrate3, tries3; + int hwrate0, rate0, tries0, ndx0; + int hwrate1, rate1, tries1, ndx1; + int hwrate2, rate2, tries2, ndx2; + int hwrate3, rate3, tries3, ndx3; int finalTSIdx = ts->ts_finaltsi; /* @@ -563,17 +575,21 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an, hwrate3 = MS(ds0->ds_ctl3, AR5416_XmitRate3); } - ndx0 = rt->rateCodeToIndex[hwrate0]; + rate0 = sc->sc_hwmap[hwrate0].ieeerate; tries0 = MS(ds0->ds_ctl2, AR_XmitDataTries0); + ndx0 = rate_to_ndx(sn, rate0); - ndx1 = rt->rateCodeToIndex[hwrate1]; + rate1 = sc->sc_hwmap[hwrate1].ieeerate; tries1 = MS(ds0->ds_ctl2, AR_XmitDataTries1); + ndx1 = rate_to_ndx(sn, rate1); - ndx2 = rt->rateCodeToIndex[hwrate2]; + rate2 = sc->sc_hwmap[hwrate2].ieeerate; tries2 = MS(ds0->ds_ctl2, AR_XmitDataTries2); + ndx2 = rate_to_ndx(sn, rate2); - ndx3 = rt->rateCodeToIndex[hwrate3]; + rate3 = sc->sc_hwmap[hwrate3].ieeerate; tries3 = MS(ds0->ds_ctl2, AR_XmitDataTries3); + ndx3 = rate_to_ndx(sn, rate3); DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s size %d finaltsidx %d tries %d %s rate/try [%d/%d %d/%d %d/%d %d/%d]\n", @@ -582,10 +598,10 @@ ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an, finalTSIdx, long_tries, ts->ts_status ? "FAIL" : "OK", - sn->rates[ndx0].rate, tries0, - sn->rates[ndx1].rate, tries1, - sn->rates[ndx2].rate, tries2, - sn->rates[ndx3].rate, tries3); + rate0, tries0, + rate1, tries1, + rate2, tries2, + rate3, tries3); /* * NB: series > 0 are not penalized for failure |