diff options
author | damien <damien@FreeBSD.org> | 2005-11-15 17:17:15 +0000 |
---|---|---|
committer | damien <damien@FreeBSD.org> | 2005-11-15 17:17:15 +0000 |
commit | c5a63d4930261dcf56d27baa488b7fb86d25145d (patch) | |
tree | 42a10684a8dcbb723e502887450a81a7a14fb349 /sys/dev/ral | |
parent | 4d0bac87fc56808998c605a342222b4ae15e0710 (diff) | |
download | FreeBSD-src-c5a63d4930261dcf56d27baa488b7fb86d25145d.zip FreeBSD-src-c5a63d4930261dcf56d27baa488b7fb86d25145d.tar.gz |
Optimize and clean TX time computation.
Avoid a test and a modulus operation.
MFC after: 2 weeks
Diffstat (limited to 'sys/dev/ral')
-rw-r--r-- | sys/dev/ral/if_ral.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/sys/dev/ral/if_ral.c b/sys/dev/ral/if_ral.c index 79cbd05..86e74a0 100644 --- a/sys/dev/ral/if_ral.c +++ b/sys/dev/ral/if_ral.c @@ -1624,33 +1624,18 @@ static uint16_t ral_txtime(int len, int rate, uint32_t flags) { uint16_t txtime; - int ceil, dbps; if (RAL_RATE_IS_OFDM(rate)) { - /* - * OFDM TXTIME calculation. - * From IEEE Std 802.11a-1999, pp. 37. - */ - dbps = rate * 2; /* data bits per OFDM symbol */ - - ceil = (16 + 8 * len + 6) / dbps; - if ((16 + 8 * len + 6) % dbps != 0) - ceil++; - - txtime = 16 + 4 + 4 * ceil + 6; + /* IEEE Std 802.11a-1999, pp. 37 */ + txtime = (8 + 4 * len + 3 + rate - 1) / rate; + txtime = 16 + 4 + 4 * txtime + 6; } else { - /* - * High Rate TXTIME calculation. - * From IEEE Std 802.11b-1999, pp. 28. - */ - ceil = (8 * len * 2) / rate; - if ((8 * len * 2) % rate != 0) - ceil++; - + /* IEEE Std 802.11b-1999, pp. 28 */ + txtime = (16 * len + rate - 1) / rate; if (rate != 2 && (flags & IEEE80211_F_SHPREAMBLE)) - txtime = 72 + 24 + ceil; + txtime += 72 + 24; else - txtime = 144 + 48 + ceil; + txtime += 144 + 48; } return txtime; |