Author: adrian Date: Tue Feb 8 18:31:28 2011 New Revision: 218448 URL: http://svn.freebsd.org/changeset/base/218448
Log: Commit some missing bits to the sample rate module to (more) correctly calculate 802.11n packet duration. This doesn't yet take into account HT40 packet durations as the node info (needed to know if it's a HT20 or HT40 node) isn't available everywhere it needs to be. Modified: head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Tue Feb 8 17:04:52 2011 (r218447) +++ head/sys/dev/ath/ath_rate/sample/sample.h Tue Feb 8 18:31:28 2011 (r218448) @@ -114,7 +114,7 @@ struct sample_node { * Calculate the transmit duration of a frame. */ static unsigned calc_usecs_unicast_packet(struct ath_softc *sc, - int length, + int length, int rix, int short_retries, int long_retries) { const HAL_RATE_TABLE *rt = sc->sc_currates; struct ifnet *ifp = sc->sc_ifp; @@ -153,6 +153,11 @@ static unsigned calc_usecs_unicast_packe t_sifs = 8; t_difs = 28; break; + case IEEE80211_T_HT: + t_slot = 9; + t_sifs = 8; + t_difs = 28; + break; case IEEE80211_T_DS: /* fall through to default */ default: @@ -172,7 +177,6 @@ static unsigned calc_usecs_unicast_packe cts = 1; cix = rt->info[sc->sc_protrix].controlRate; - } if (0 /*length > ic->ic_rtsthreshold */) { @@ -192,8 +196,9 @@ static unsigned calc_usecs_unicast_packe if (rts) /* SIFS + CTS */ ctsduration += rt->info[cix].spAckDuration; - ctsduration += ath_hal_computetxtime(sc->sc_ah, - rt, length, rix, AH_TRUE); + /* XXX assumes short preamble */ + /* XXX assumes HT/20; the node info isn't yet available here */ + ctsduration += ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, AH_TRUE); if (cts) /* SIFS + ACK */ ctsduration += rt->info[cix].spAckDuration; @@ -201,9 +206,12 @@ static unsigned calc_usecs_unicast_packe tt += (short_retries + 1) * ctsduration; } tt += t_difs; + + /* XXX assumes short preamble */ + /* XXX assumes HT/20; the node info isn't yet available here */ + tt += (long_retries+1)*ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, AH_TRUE); tt += (long_retries+1)*(t_sifs + rt->info[rix].spAckDuration); - tt += (long_retries+1)*ath_hal_computetxtime(sc->sc_ah, rt, length, - rix, AH_TRUE); + for (x = 0; x <= short_retries + long_retries; x++) { cw = MIN(WIFI_CW_MAX, (cw + 1) * 2); tt += (t_slot * cw/2); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"