summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-02-08 18:31:28 +0000
committeradrian <adrian@FreeBSD.org>2011-02-08 18:31:28 +0000
commit85440e5501344465392163e6c6b96b2701b30b9e (patch)
tree8a8be147a877b6e627269b6d7bb61ec2b2c2a4c1
parent951fbe8cc6800ff977d79ab82e1f570fab3634d4 (diff)
downloadFreeBSD-src-85440e5501344465392163e6c6b96b2701b30b9e.zip
FreeBSD-src-85440e5501344465392163e6c6b96b2701b30b9e.tar.gz
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.
-rw-r--r--sys/dev/ath/ath_rate/sample/sample.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/ath/ath_rate/sample/sample.h b/sys/dev/ath/ath_rate/sample/sample.h
index 25cb337..3a090fe 100644
--- a/sys/dev/ath/ath_rate/sample/sample.h
+++ b/sys/dev/ath/ath_rate/sample/sample.h
@@ -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_packet(struct ath_softc *sc,
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_packet(struct ath_softc *sc,
cts = 1;
cix = rt->info[sc->sc_protrix].controlRate;
-
}
if (0 /*length > ic->ic_rtsthreshold */) {
@@ -192,8 +196,9 @@ static unsigned calc_usecs_unicast_packet(struct ath_softc *sc,
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_packet(struct ath_softc *sc,
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);
OpenPOWER on IntegriCloud